changeset 23:61dfbc82ffc8 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/bcftools commit f6efda26965eb73c9107d367fd5ffdf246ed0dbc
author iuc
date Tue, 02 Dec 2025 08:17:05 +0000
parents ccb83bf54de0
children
files bcftools_cnv.xml macros.xml
diffstat 2 files changed, 202 insertions(+), 158 deletions(-) [+]
line wrap: on
line diff
--- a/bcftools_cnv.xml	Sun Aug 18 10:06:44 2024 +0000
+++ b/bcftools_cnv.xml	Tue Dec 02 08:17:05 2025 +0000
@@ -4,13 +4,12 @@
         <token name="@EXECUTABLE@">cnv</token>
         <import>macros.xml</import>
     </macros>
-    <expand macro="bio_tools" />
+    <expand macro="bio_tools"/>
     <expand macro="requirements">
-        <expand macro="matplotlib_requirement" />
+        <expand macro="matplotlib_requirement"/>
     </expand>
-    <expand macro="version_command" />
+    <expand macro="version_command"/>
     <command detect_errors="aggressive"><![CDATA[
-@PREPARE_ENV@
 @PREPARE_INPUT_FILE@
 #set $section = $sec_restrict
 @PREPARE_TARGETS_FILE@
@@ -94,10 +93,10 @@
 ]]>
     </command>
     <inputs>
-        <expand macro="macro_input" />
-        <param argument="-s" name="query_sample" type="text" label="Query Sample" optional="True" help="The name (as used in the input) of the query sample in the input. Can be ommitted if, and only if, there is only one sample in the input." />
-        <param argument="-c" name="control_sample" type="text" label="Control Sample" optional="True" help="The name (as used in the input) of an optional control sample to compare against. Note: The pairwise calling mode represents the real strength of the tool as it helps to reduce the number of false calls and also allows one to distinguish between normal and novel copy number variation." />
-        <expand macro="macro_AF_file" />
+        <expand macro="macro_input"/>
+        <param argument="-s" name="query_sample" type="text" label="Query Sample" optional="True" help="The name (as used in the input) of the query sample in the input. Can be ommitted if, and only if, there is only one sample in the input."/>
+        <param argument="-c" name="control_sample" type="text" label="Control Sample" optional="True" help="The name (as used in the input) of an optional control sample to compare against. Note: The pairwise calling mode represents the real strength of the tool as it helps to reduce the number of false calls and also allows one to distinguish between normal and novel copy number variation."/>
+        <expand macro="macro_AF_file"/>
         <conditional name="plotting">
             <param name="generate_plots" type="select" label="Plot results?">
                 <option value="all">Yes, plot results for all chromosomes</option>
@@ -105,82 +104,52 @@
                 <option value="none">No, do not generate plots</option>
             </param>
             <when value="all">
-                <param name="plot_threshold" type="hidden" value="0" />
+                <param name="plot_threshold" type="hidden" value="0"/>
             </when>
             <when value="some">
-                <param argument="-p" name="plot_threshold" type="float" value="0"
-                label="Plot Threshold"
-                help="Plot aberrant chromosomes with quality at least 'float'" />
+                <param argument="-p" name="plot_threshold" type="float" value="0" label="Plot Threshold" help="Plot aberrant chromosomes with quality at least 'float'"/>
             </when>
-            <when value="none" />
+            <when value="none"/>
         </conditional>
         <section name="sec_restrict" expanded="false" title="Restrict to">
-            <expand macro="macro_restrict" />
-            <expand macro="macro_restrict" type="target" label_type="Target" />
+            <expand macro="macro_region_restrict"/>
+            <expand macro="macro_target_restrict"/>
         </section>
         <section name="sec_hmm" expanded="false" title="HMM Options">
-            <param argument="--aberrant" name="aberrant_query" type="float" value="1" min="0" max="1"
-            label="Estimated purity of the query sample"
-            help="Estimate of the fractional contribution of the desired query tissue to the (possibly control-contaminated) query sample (default: 1 = no contamination with control tissue)" />
-            <param argument="--aberrant" name="aberrant_control" type="float" value="1" min="0" max="1"
-            label="Estimated purity of the control sample"
-            help="Estimate of the fractional contribution of the desired control tissue to the (possibly query-contaminated) control sample (default: 1 = no contamination with query tissue)" />
+            <param argument="--aberrant" name="aberrant_query" type="float" value="1" min="0" max="1" label="Estimated purity of the query sample" help="Estimate of the fractional contribution of the desired query tissue to the (possibly control-contaminated) query sample (default: 1 = no contamination with control tissue)"/>
+            <param argument="--aberrant" name="aberrant_control" type="float" value="1" min="0" max="1" label="Estimated purity of the control sample" help="Estimate of the fractional contribution of the desired control tissue to the (possibly query-contaminated) control sample (default: 1 = no contamination with query tissue)"/>
             <conditional name="aberrant_optimization">
-                <param name="do_optimize" type="select"
-                label="Adjust sample purity estimates based on data?"
-                help="Instead of treating your specified estimates of the sample purities as fixed values, the tool can use them as starting values for an iterative optimization that tries to estimate the sample purities from the data. Note: With estimate optimization enabled the final estimates will be reported as cell fraction (CF) estimates in the summary report.">
+                <param name="do_optimize" type="select" label="Adjust sample purity estimates based on data?" help="Instead of treating your specified estimates of the sample purities as fixed values, the tool can use them as starting values for an iterative optimization that tries to estimate the sample purities from the data. Note: With estimate optimization enabled the final estimates will be reported as cell fraction (CF) estimates in the summary report.">
                     <option value="no">No, leave sample purities as specified</option>
                     <option value="yes">Yes, adjust purity estimates</option>
                 </param>
-                <when value="no" />
+                <when value="no"/>
                 <when value="yes">
-                    <param argument="--optimize" name="lower_bound" type="float" value="0.3" min="1e-9" max="1"
-                    label="Lower bound for adjusted estimate"
-                    help="Constrains the final adjusted purity estimates not to be smaller than this value." />
+                    <param argument="--optimize" name="lower_bound" type="float" value="0.3" min="1e-9" max="1" label="Lower bound for adjusted estimate" help="Constrains the final adjusted purity estimates not to be smaller than this value."/>
                 </when>
             </conditional>
             <conditional name="score_usage">
-                <param name="compute_on" type="select" label="Use BAF and LRR annotations to call CNVs?"
-                help="Using LRR information in addition to BAF values is the default and helps in dealing with random noise in the data. However, the tool is also able to call CNVs from BAF values alone in case your input does not feature LRR information.">
+                <param name="compute_on" type="select" label="Use BAF and LRR annotations to call CNVs?" help="Using LRR information in addition to BAF values is the default and helps in dealing with random noise in the data. However, the tool is also able to call CNVs from BAF values alone in case your input does not feature LRR information.">
                     <option value="baf+lrr">Yes (requires input with both BAF and LRR subfields)</option>
                     <option value="baf">No, use BAF values exclusively</option>
                 </param>
                 <when value="baf+lrr">
-                    <param argument="--BAF-weight" name="baf_weight" type="float" value="1" min="0" max="1"
-                    label="Baf Weight" help="relative contribution from BAF" />
-
-                    <param argument="--BAF-dev" name="baf_dev_query" type="float" value="0.04" min="0" max="1"
-                    label="Query sample BAF deviation"
-                    help="Expected BAF deviation in the query sample (default: 0.04)" />
-                    <param argument="--BAF-dev" name="baf_dev_control" type="float" value="0.04" min="0" max="1"
-                    label="Control sample BAF deviation"
-                    help="Expected BAF deviation in the control sample (default: 0.04)" />
-
-                    <param argument="--LRR-weight" name="lrr_weight" type="float" value="0.2" min="0" max="1"
-                    label="LRR Weight"
-                    help="Relative contribution from LRR. This option can have a big effect on the number of calls produced. With truly random noise (such as in simulated data), the value should be set high (1.0), but in the presence of systematic noise when LRR values are not informative, lower values result in cleaner calls (default: 0.2)." />
-                    <param argument="--LRR-dev" name="lrr_dev_query" type="float" value="0.2" min="0" max="1"
-                    label="Query sample LRR Deviation"
-                    help="Expected LRR deviation in the query sample (default: 0.2)" />
-                    <param argument="--LRR-dev" name="lrr_dev_control" type="float" value="0.2" min="0" max="1"
-                    label="Control sample LRR Deviation"
-                    help="Expected LRR deviation in the control sample (default: 0.2)" />
-                    <param argument="--LRR-smooth-win" name="lrr_smooth_win" type="integer" value="10"
-                    label="LRR Smoothing Window"
-                    help="Window of LRR moving average smoothing (default: 10)" />
+                    <param argument="--BAF-weight" name="baf_weight" type="float" value="1" min="0" max="1" label="Baf Weight" help="relative contribution from BAF"/>
+                    <param argument="--BAF-dev" name="baf_dev_query" type="float" value="0.04" min="0" max="1" label="Query sample BAF deviation" help="Expected BAF deviation in the query sample (default: 0.04)"/>
+                    <param argument="--BAF-dev" name="baf_dev_control" type="float" value="0.04" min="0" max="1" label="Control sample BAF deviation" help="Expected BAF deviation in the control sample (default: 0.04)"/>
+                    <param argument="--LRR-weight" name="lrr_weight" type="float" value="0.2" min="0" max="1" label="LRR Weight" help="Relative contribution from LRR. This option can have a big effect on the number of calls produced. With truly random noise (such as in simulated data), the value should be set high (1.0), but in the presence of systematic noise when LRR values are not informative, lower values result in cleaner calls (default: 0.2)."/>
+                    <param argument="--LRR-dev" name="lrr_dev_query" type="float" value="0.2" min="0" max="1" label="Query sample LRR Deviation" help="Expected LRR deviation in the query sample (default: 0.2)"/>
+                    <param argument="--LRR-dev" name="lrr_dev_control" type="float" value="0.2" min="0" max="1" label="Control sample LRR Deviation" help="Expected LRR deviation in the control sample (default: 0.2)"/>
+                    <param argument="--LRR-smooth-win" name="lrr_smooth_win" type="integer" value="10" label="LRR Smoothing Window" help="Window of LRR moving average smoothing (default: 10)"/>
                 </when>
                 <when value="baf">
-                    <param argument="--BAF-dev" name="baf_dev_query" type="float" value="0.04" min="0" max="1"
-                    label="Query sample BAF deviation"
-                    help="Expected BAF deviation in the query sample (default: 0.04)" />
-                    <param argument="--BAF-dev" name="baf_dev_control" type="float" value="0.04" min="0" max="1"
-                    label="Control sample BAF deviation"
-                    help="Expected BAF deviation in the control sample (default: 0.04)" />
-                    <param name="baf_weight" type="hidden" value="1" />
-                    <param name="lrr_weight" type="hidden" value="0" />
+                    <param argument="--BAF-dev" name="baf_dev_query" type="float" value="0.04" min="0" max="1" label="Query sample BAF deviation" help="Expected BAF deviation in the query sample (default: 0.04)"/>
+                    <param argument="--BAF-dev" name="baf_dev_control" type="float" value="0.04" min="0" max="1" label="Control sample BAF deviation" help="Expected BAF deviation in the control sample (default: 0.04)"/>
+                    <param name="baf_weight" type="hidden" value="1"/>
+                    <param name="lrr_weight" type="hidden" value="0"/>
                 </when>
             </conditional>
-            <param argument="--err-prob" type="float" value="1e-4" label="Err Prob" help="Uniform error probability" />
+            <param argument="--err-prob" type="float" value="1e-4" label="Err Prob" help="Uniform error probability"/>
             <param argument="--same-prob" type="float" value="0.5" min="0" max="1" label="Same Prob">
                 <help>
                     The prior probability of the query and the control sample being the same. 
@@ -204,41 +173,51 @@
     </outputs>
     <tests>
         <test expect_num_outputs="3">
-            <param name="input_file" ftype="vcf" value="cnv.vcf" />
-            <output name="output_summary" file="cnv_summary.tab" compare="re_match" />
+            <param name="input_file" ftype="vcf" value="cnv.vcf"/>
+            <output name="output_summary" file="cnv_summary.tab" compare="re_match"/>
         </test>
         <test expect_num_outputs="2">
-            <param name="input_file" ftype="vcf" value="cnv.vcf" />
+            <param name="input_file" ftype="vcf" value="cnv.vcf"/>
             <conditional name="plotting">
-                <param name="generate_plots" value="none" />
+                <param name="generate_plots" value="none"/>
             </conditional>
-            <output name="output_summary" file="cnv_summary.tab" compare="re_match" />
+            <output name="output_summary" file="cnv_summary.tab" compare="re_match"/>
         </test>
         <test expect_num_outputs="3">
-            <param name="input_file" ftype="vcf" value="cnv.vcf" />
-            <param name="query_sample" value="test" />
-            <param name="control_sample" value="test" />
-            <output name="output_summary" file="cnv_pairwise_summary.tab" compare="re_match" />
+            <param name="input_file" ftype="vcf" value="cnv.vcf"/>
+            <param name="query_sample" value="test"/>
+            <param name="control_sample" value="test"/>
+            <output name="output_summary" file="cnv_pairwise_summary.tab" compare="re_match"/>
         </test>
         <test expect_num_outputs="2">
-            <param name="input_file" ftype="vcf" value="cnv_baf_only.vcf" />
+            <param name="input_file" ftype="vcf" value="cnv_baf_only.vcf"/>
             <conditional name="plotting">
-                <param name="generate_plots" value="none" />
+                <param name="generate_plots" value="none"/>
             </conditional>
-            <conditional name="score_usage">
-                <param name="compute_on" value="baf" />
-            </conditional>
-            <output name="output_summary" file="cnv_summary.tab" compare="re_match" />
+            <section name="sec_hmm">
+                <conditional name="score_usage">
+                    <param name="compute_on" value="baf"/>
+                </conditional>
+            </section>
+            <output name="output_summary" file="cnv_summary.tab" compare="re_match"/>
         </test>
         <!-- Test region overlap option -->
         <test expect_num_outputs="3">
-            <param name="input_file" ftype="vcf" value="cnv.vcf" />
+            <param name="input_file" ftype="vcf" value="cnv.vcf"/>
             <section name="sec_restrict">
-                <param name="regions_overlap" value="1"/>
+                <conditional name="regions">
+                    <param name="regions_src" value="regions" />
+                    <repeat name="region_specs">
+                        <param name="chrom" value="10" />
+                    </repeat>
+                    <repeat name="region_specs">
+                        <param name="chrom" value="11" />
+                    </repeat>
+                </conditional>
             </section>
-            <output name="output_summary" file="cnv_summary.tab" compare="re_match" />
+            <output name="output_summary" file="cnv_summary.tab" compare="re_match"/>
             <assert_command>
-                <has_text text="--regions-overlap" />
+                <has_text text="--regions-overlap"/>
             </assert_command>
         </test>
     </tests>
@@ -255,8 +234,8 @@
 
 @BCFTOOLS_MANPAGE@#@EXECUTABLE@
 
-@BCFTOOLS_WIKI@
+@BCFTOOLS_HOWTOS@
 ]]>
     </help>
-    <expand macro="citations" />
+    <expand macro="citations"/>
 </tool>
--- a/macros.xml	Sun Aug 18 10:06:44 2024 +0000
+++ b/macros.xml	Tue Dec 02 08:17:05 2025 +0000
@@ -1,7 +1,7 @@
 <macros>
-  <token name="@TOOL_VERSION@">1.15.1</token>
-  <token name="@VERSION_SUFFIX@">4</token>
-  <token name="@PROFILE@">20.01</token>
+  <token name="@TOOL_VERSION@">1.22</token>
+  <token name="@VERSION_SUFFIX@">0</token>
+  <token name="@PROFILE@">24.1</token>
   <xml name="bio_tools">
       <xrefs>
           <xref type="bio.tools">bcftools</xref>
@@ -10,15 +10,15 @@
   <xml name="requirements">
     <requirements>
       <requirement type="package" version="@TOOL_VERSION@">bcftools</requirement>
-      <requirement type="package" version="1.15.1">htslib</requirement>
+      <requirement type="package" version="1.22.1">htslib</requirement>
       <yield />
     </requirements>
   </xml>
   <xml name="samtools_requirement">
-      <requirement type="package" version="1.15.1">samtools</requirement>
+      <requirement type="package" version="1.22.1">samtools</requirement>
   </xml>
   <xml name="matplotlib_requirement">
-      <requirement type="package" version="3.5.3">matplotlib</requirement>
+      <requirement type="package" version="3.10.7">matplotlib</requirement>
   </xml>
   <xml name="version_command">
     <version_command>bcftools 2&gt;&amp;1 | grep 'Version:'</version_command>
@@ -30,16 +30,11 @@
       <yield />
     </citations>
   </xml>
-  <token name="@BCFTOOLS_WIKI@">https://github.com/samtools/bcftools/wiki</token>
-  <token name="@BCFTOOLS_MANPAGE@">http://samtools.github.io/bcftools/bcftools.html</token>
+  <token name="@BCFTOOLS_HOWTOS@">https://samtools.github.io/bcftools/howtos/index.html</token>
+  <token name="@BCFTOOLS_MANPAGE@">https://www.htslib.org/doc/bcftools.html</token>
   <token name="@THREADS@">
   --threads \${GALAXY_SLOTS:-4}
   </token>
-  <token name="@PREPARE_ENV@">
-<![CDATA[
-export BCFTOOLS_PLUGINS=`which bcftools | sed 's,bin/bcftools,libexec/bcftools,'`;
-]]>
-  </token>
   <xml name="macro_input">
     <!-- 
     REQUIRES https://github.com/galaxyproject/galaxy/pull/14605/files
@@ -294,8 +289,8 @@
     help="inverts the query/filtering applied by the targets" />
   </xml>
 
-  <xml name="macro_restriction_spec" token_type="region" token_label_type="Region">
-    <repeat name="@TYPE@s" title="@LABEL_TYPE@ Filter" default="1" min="1">
+  <xml name="macro_restriction_spec" tokens="type,label_type">
+    <repeat name="@TYPE@_specs" title="@LABEL_TYPE@ Filter" default="1" min="1">
         <param name="chrom" type="text" label="@LABEL_TYPE@ chromosome">
             <validator type="expression" message="A chromosome identifier is required when specifying a @LABEL_TYPE@ filter">value.strip()</validator>
         </param>
@@ -305,36 +300,85 @@
         <param name="stop" type="text" label="@LABEL_TYPE@ end position">
             <validator type="expression" message="an integer number is required">not value or value.isdigit()</validator>
         </param>
-        <yield />
     </repeat>
   </xml>
 
-  <xml name="macro_restrictions_file" token_type="region" token_label_type="Region">
+  <xml name="macro_restrictions_file" tokens="type,label_type">
     <param name="@TYPE@s_file" type="data" format="tabular" label="@LABEL_TYPE@s File" help="restrict to @LABEL_TYPE@s listed in a file" />
   </xml>
 
-  <xml name="macro_restrict" token_type="region" token_label_type="Region" >
+  <xml name="__macro_restrict__" tokens="type,label_select,label_type,pos_is_default,rec_is_default">
     <conditional name="@TYPE@s">
-        <param name="@TYPE@s_src" type="select" label="@LABEL_TYPE@s">
-            <option value="__none__">Do not restrict to @LABEL_TYPE@s</option>
-            <option value="@TYPE@s">Specify one or more @LABEL_TYPE@(s) directly</option>
-            <option value="@TYPE@s_file">Operate on @LABEL_TYPE@s specified in a history dataset</option>
+      <param name="@TYPE@s_src" type="select" label="@LABEL_SELECT@">
+        <option value="__none__">Do not restrict to @LABEL_TYPE@s</option>
+        <option value="@TYPE@s">Specify one or more @LABEL_TYPE@(s) directly</option>
+        <option value="@TYPE@s_file">Operate on @LABEL_TYPE@s specified in a history dataset</option>
+      </param>
+      <when value="__none__"/>
+      <when value="@TYPE@s">
+        <expand macro="macro_restriction_spec" type="@TYPE@" label_type="@LABEL_TYPE@" />
+        <yield />
+        <param argument="--@TYPE@s-overlap" type="select" label="Consider variant calls with partial overlap with @LABEL_TYPE@(s) if ..." help="Set to 0 if the record has to have POS inside a region; set to 1 if also overlapping records with POS outside a region should be included (this includes indels with POS at the end of a region, which are technically outside the region); or set to 2 to include only true overlapping variation (compare the full VCF representation 'TA>T-' vs the true sequence variation 'A>-').">
+          <option value="0" selected="@POS_IS_DEFAULT@">0: the variant's POS falls in the region</option>
+          <option value="1" selected="@REC_IS_DEFAULT@">1: any part of the variant's representation overlaps the region</option>
+          <option value="2">2: the variant's actual sequence change falls in the region</option>
+        </param>
+      </when>
+      <when value="@TYPE@s_file">
+        <expand macro="macro_restrictions_file" type="@TYPE@" label_type="@LABEL_TYPE@" />
+        <yield />
+        <param argument="--@TYPE@s-overlap" type="select" label="@LABEL_TYPE@ overlap" help="Include if POS in the region (0), record overlaps (1), variant overlaps (2)">
+          <option value="0" selected="@POS_IS_DEFAULT@">0: POS in the region</option>
+          <option value="1" selected="@REC_IS_DEFAULT@">1: Record overlaps</option>
+          <option value="2">2: Variant overlaps</option>
         </param>
-        <when value="__none__"/>
-        <when value="@TYPE@s">
-            <expand macro="macro_restriction_spec" type="@TYPE@" label_type="@LABEL_TYPE@" />
-            <yield />
-        </when>
-        <when value="@TYPE@s_file">
-            <expand macro="macro_restrictions_file" type="@TYPE@" label_type="@LABEL_TYPE@" />
-            <yield />
-        </when>        
+      </when>
+    </conditional>
+  </xml>
+
+  <xml name="__macro_restrict_simple__" tokens="type,label_select,label_type">
+    <conditional name="@TYPE@s">
+      <param name="@TYPE@s_src" type="select" label="@LABEL_SELECT@">
+        <option value="__none__">Do not restrict to @LABEL_TYPE@s</option>
+        <option value="@TYPE@s">Specify one or more @LABEL_TYPE@(s) directly</option>
+        <option value="@TYPE@s_file">Operate on @LABEL_TYPE@s specified in a history dataset</option>
+      </param>
+      <when value="__none__"/>
+      <when value="@TYPE@s">
+        <expand macro="macro_restriction_spec" type="@TYPE@" label_type="@LABEL_TYPE@" />
+        <yield />
+      </when>
+      <when value="@TYPE@s_file">
+        <expand macro="macro_restrictions_file" type="@TYPE@" label_type="@LABEL_TYPE@" />
+        <yield />
+      </when>
     </conditional>
-    <param argument="--@TYPE@s-overlap" type="select" optional="true" label="@LABEL_TYPE@ overlap" help="Include if POS in the region (0), record overlaps (1), variant overlaps (2)">
-        <option value="0">0: POS in the region</option>
-        <option value="1">1: Record overlaps</option>
-        <option value="2">2: Variant overlaps</option>
-    </param>
+  </xml>
+
+  <xml name="macro_region_restrict" token_label_select="Regions">
+    <expand macro="__macro_restrict__" type="region" label_select="@LABEL_SELECT@" label_type="Region" pos_is_default="false" rec_is_default="true" />
+  </xml>
+
+  <xml name="macro_region_restrict_simple" token_label_select="Regions">
+    <!-- To be used with subcommands that don't support the 'regions-overlap' option. Currently only mpileup? -->
+    <expand macro="__macro_restrict_simple__" type="region" label_select="@LABEL_SELECT@" label_type="Region" />
+  </xml>
+
+  <xml name="macro_target_restrict">
+    <expand macro="__macro_restrict__" type="target" label_select="Target" label_type="Target" pos_is_default="true" rec_is_default="false">
+      <expand macro="macro_invert_targets" />
+    </expand>
+  </xml>
+
+  <xml name="macro_target_restrict_simple">
+    <!-- To be used with subcommands that don't support the 'regions-overlap' option. Currently only mpileup and call? -->
+    <expand macro="__macro_restrict_simple__" type="target" label_select="Target" label_type="Target">
+      <expand macro="macro_invert_targets" />
+    </expand>
+  </xml>
+
+  <xml name="macro_mask_restrict">
+    <expand macro="__macro_restrict__" type="mask" label_select="Mask" label_type="Mask" pos_is_default="false" rec_is_default="true" />
   </xml>
 
   <token name="@PARSE_INTERVALS@">
@@ -345,7 +389,7 @@
   #set $start = str($i.start).strip()
   #set $stop = str($i.stop).strip()
   #if $start or $stop:
-    $components.append($chrom + ':' + ($start or '0') + '-' + $stop)
+    $components.append($chrom + ':' + ($start or '1') + '-' + $stop)
   #else:
     $components.append($chrom)
   #end if
@@ -357,18 +401,14 @@
   <token name="@MASK@">
 <![CDATA[
 #if $section.conditional_soft_filter.selector == 'enabled' and $section.conditional_soft_filter.soft_filter
-  #if $section.conditional_soft_filter.masks.masks_src == 'regions':
-    #set $intervals = $section.conditional_soft_filter.masks.masks
-    @PARSE_INTERVALS@
-    --mask '$intervals_spec'
-  #elif $section.conditional_soft_filter.masks.masks_src == 'masks_file' and $section.conditional_soft_filter.masks.masks_file:
-    #if $masks_path is not None:
-      --mask-file '$masks_path'
-    #else:
+  #if $section.conditional_soft_filter.masks.masks_src != '__none__':
+    #if $section.conditional_soft_filter.masks.masks_src == 'masks':
+      #set $intervals = $section.conditional_soft_filter.masks.mask_specs
+      @PARSE_INTERVALS@
+      --mask '$intervals_spec'
+    #elif $section.conditional_soft_filter.masks.masks_src == 'masks_file':
       --mask-file '$section.conditional_soft_filter.masks.masks_file'
     #end if
-  #end if
-  #if $section.conditional_soft_filter.masks_overlap
     --mask-overlap $section.conditional_soft_filter.masks_overlap
   #end if
 #end if
@@ -378,37 +418,42 @@
 
   <token name="@REGIONS@">
 <![CDATA[
-#if $section.regions.regions_src == 'regions':
-  #set $intervals = $section.regions.regions
-  @PARSE_INTERVALS@
-  --regions '$intervals_spec'
-#elif $section.regions.regions_src == 'regions_file' and $section.regions.regions_file:
-  #if $regions_path is not None:
-    --regions-file '$regions_path'
-  #else:
-    --regions-file '$section.regions.regions_file'
+#if $section.regions.regions_src != '__none__':
+  #if $section.regions.regions_src == 'regions':
+    #set $intervals = $section.regions.region_specs
+    @PARSE_INTERVALS@
+    --regions '$intervals_spec'
+  #elif $section.regions.regions_src == 'regions_file':
+    #if $regions_path is not None:
+      --regions-file '$regions_path'
+    #else:
+      --regions-file '$section.regions.regions_file'
+    #end if
+  #end if
+  #if 'regions_overlap' in $section.regions:
+    --regions-overlap $section.regions.regions_overlap
   #end if
 #end if
-#if $section.regions_overlap
-  --regions-overlap $section.regions_overlap
-#end if
-
 ]]>
   </token>
   
   <token name="@TARGETS@">
 <![CDATA[
-#if $targets_path:
-  --targets-file "${section.targets.invert_targets_file}${targets_path}"
-#elif $section.targets.targets_src == 'targets':
-  #set $intervals = $section.targets.targets
-  @PARSE_INTERVALS@
-  --targets '${section.targets.invert_targets_file}$intervals_spec'
-#elif $section.targets.targets_src == 'targets_file' and $section.targets.targets_file:
-  --targets-file "${section.targets.invert_targets_file}${section.targets.targets_file}"
-#end if
-#if $section.targets_overlap
-  --targets-overlap $section.targets_overlap
+#if $section.targets.targets_src != '__none__':
+  #if $section.targets.targets_src == 'targets':
+    #set $intervals = $section.targets.target_specs
+    @PARSE_INTERVALS@
+    --targets '${section.targets.invert_targets_file}$intervals_spec'
+  #elif $section.targets.targets_src == 'targets_file':
+    #if $targets_path:
+      --targets-file '${section.targets.invert_targets_file}${targets_path}'
+    #else:
+      --targets-file '${section.targets.invert_targets_file}${section.targets.targets_file}'
+    #end if
+  #end if
+  #if 'targets_overlap' in $section.targets:
+    --targets-overlap $section.targets.targets_overlap
+  #end if
 #end if
 ]]>
   </token>
@@ -417,7 +462,7 @@
 <![CDATA[
 #set $regions_path = None
 #if 'regions' in $section
-  #if $section.regions.regions_src == 'regions_file' and $section.regions.regions_file:
+  #if $section.regions.regions_src == 'regions_file':
     #if $section.regions.regions_file.ext.startswith('bed'):
       #set $regions_path = 'regions_file.bed'
       ln -s '$section.regions.regions_file' $regions_path &&
@@ -461,11 +506,31 @@
       </param>
       <param name="invert_samples" type="boolean" truevalue="^" falsevalue="" checked="false" label="Invert Samples"
              help="Inverts the query/filtering applied by Samples (adds &quot;^&quot; prefix to exclude)" />
-      <param argument="--samples_file" type="data" format="tabular" optional="true" label="Samples file"
-             help="File of samples to include" />
+      <param argument="--samples_file" type="data" format="tabular" optional="true" label="Samples file" help="File of samples to include" />
       <param name="invert_samples_file" type="boolean" truevalue="^" falsevalue="" checked="false" label="Invert Samples file"
              help="inverts the query/filtering applied by Samples file" />
   </xml>
+
+  <xml name="macro_samples_enhanced" token_all_samples="" token_file_help="File listing samples to include one per line.">
+      <conditional name="specify_samples">
+          <param name="how" type="select" label="How do you want to select samples?">
+              <option value="-s">Specify samples manually</option>
+              <option value="-S">Provide sample file</option>
+              <option value="@ALL_SAMPLES@" selected="true">No selection; just use all samples found in input</option>
+          </param>
+          <when value="-s">
+              <param argument="--samples" name="samples_spec" type="text" optional="false" label="Sample(s)" help="Specify a single sample by name or a comma-separated list of sample names.">
+                <validator type="expression" message="Please specify a single sample by name or a comma-separated list of sample names">value.strip() and value[0] not in "^," and ",," not in value</validator>
+              </param>
+              <param name="invert_samples" type="boolean" truevalue="^" falsevalue="" label="Exclude these samples instead of including them?" help="Equivalent to prefixing the list of samples with &quot;^&quot; on the command line."/>
+          </when>
+          <when value="-S">
+              <param argument="--samples_file" type="data" format="tabular" optional="@IS_OPTIONAL@" label="Samples file" help="@FILE_HELP@" />
+              <param name="invert_samples" type="boolean" truevalue="^" falsevalue="" label="Exclude the samples listed in the file instead of including them?" help="Equivalent to prefixing the file with &quot;^&quot; on the command line."/>
+          </when>
+          <when value="@ALL_SAMPLES@" />
+      </conditional>
+  </xml>
   <token name="@SAMPLES@">
 #set $samples_defined = False
 #if str($section.samples) != '':
@@ -478,8 +543,8 @@
 #end if
   </token>
 
-  <xml name="macro_sample">
-      <param name="sample" type="text" optional="true" label="Sample" help="Apply variants of the given sample" />
+  <xml name="macro_sample" token_help="Apply variants of the given sample">
+      <param name="sample" type="text" optional="true" label="Sample" help="@HELP@" />
   </xml>
   <token name="@SAMPLE@">
 #if $section.sample: