changeset 17:44867b59dbf2 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bedtools commit cf7a3674bc833bbd5fdd2ad02e724935ffc7a174
author iuc
date Tue, 05 Sep 2017 15:40:14 -0400
parents e0cec48a4695
children 18aeac3cd1db
files bedToBam.xml bedpeToBam.xml complementBed.xml fisherBed.xml flankBed.xml genomeCoverageBed.xml macros.xml makeWindowsBed.xml mapBed.xml multiIntersectBed.xml randomBed.xml shuffleBed.xml slopBed.xml test-data/mapBed3.bed test-data/mapBed4.bed test-data/mapBed_result5.bed tool-data/dbkeys.loc.sample tool_data_table_conf.xml.sample unionBedGraphs.xml
diffstat 19 files changed, 225 insertions(+), 90 deletions(-) [+]
line wrap: on
line diff
--- a/bedToBam.xml	Fri Aug 18 15:33:08 2017 -0400
+++ b/bedToBam.xml	Tue Sep 05 15:40:14 2017 -0400
@@ -1,4 +1,4 @@
-<tool id="bedtools_bedtobam" name="BED to BAM" version="@WRAPPER_VERSION@.0">
+<tool id="bedtools_bedtobam" name="BED to BAM" version="@WRAPPER_VERSION@.1">
     <description>converter</description>
     <macros>
         <import>macros.xml</import>
@@ -10,7 +10,7 @@
         bedtools bedtobam
         $bed12
         -mapq $mapq
-        -g $genome
+        -g @GENOME_FILE@
         -i '$input'
         > '$output'
 ]]>
@@ -20,7 +20,7 @@
         <param name="bed12" type="boolean" truevalue="-bed12" falsevalue="" checked="false"
             label="Indicate that the input BED file is in BED12 (a.k.a 'blocked' BED) format"
             help="If Selected, bedToBam will convert blocked BED features (e.g., gene annotaions) into 'spliced' BAM alignments by creating an appropriate CIGAR string. (-bed12)"/>
-        <expand macro="genome" />
+        <expand macro="input_conditional_genome_file" />
         <param name="mapq" type="integer" value="255"
             label="Set a mapping quality (SAM MAPQ field) value for all BED entries" help="(-mapq)"/>
     </inputs>
@@ -30,6 +30,7 @@
     <tests>
         <test>
             <param name="input" value="bedToBam1.bed" ftype="bed" />
+            <param name="genome_file_opts_selector" value="hist" />
             <param name="genome" value="mm9_chr1.len" ftype="tabular" />
             <output name="output" file="bedToBam_result.bam" lines_diff="4" ftype="bam" />
         </test>
--- a/bedpeToBam.xml	Fri Aug 18 15:33:08 2017 -0400
+++ b/bedpeToBam.xml	Tue Sep 05 15:40:14 2017 -0400
@@ -1,4 +1,4 @@
-<tool id="bedtools_bedpetobam" name="BEDPE to BAM" version="@WRAPPER_VERSION@.0">
+<tool id="bedtools_bedpetobam" name="BEDPE to BAM" version="@WRAPPER_VERSION@.1">
     <description>converter</description>
     <macros>
         <import>macros.xml</import>
@@ -10,13 +10,13 @@
         bedtools bedpetobam
             -mapq $mapq
             -i '$input'
-            -g $genome
+            -g @GENOME_FILE@
             > '$output'
 ]]>
     </command>
     <inputs>
         <param name="input" format="bed,gff,vcf" type="data" label="BED/VCF/GFF file"/>
-        <expand macro="genome" />
+        <expand macro="input_conditional_genome_file" />
         <param name="mapq" type="integer" value="255"
             label="Set a mapping quality (SAM MAPQ field) value for all BED entries"
             help="(-mapq)" />
@@ -27,6 +27,7 @@
     <tests>
         <test>
             <param name="input" value="bedpeToBamBed1.bed" ftype="bed" />
+            <param name="genome_file_opts_selector" value="hist" />
             <param name="genome" value="mm9.len"/>
             <output name="output" file="bedpeToBam_result1.bam" lines_diff="72" ftype="bam" />
         </test>
--- a/complementBed.xml	Fri Aug 18 15:33:08 2017 -0400
+++ b/complementBed.xml	Tue Sep 05 15:40:14 2017 -0400
@@ -1,4 +1,4 @@
-<tool id="bedtools_complementbed" name="ComplementBed" version="@WRAPPER_VERSION@.0">
+<tool id="bedtools_complementbed" name="ComplementBed" version="@WRAPPER_VERSION@.1">
     <description>Extract intervals not represented by an interval file</description>
     <macros>
         <import>macros.xml</import>
@@ -9,13 +9,13 @@
 <![CDATA[
         complementBed
         -i "$input"
-        -g "$genome"
+        -g @GENOME_FILE@
         > "$output"
 ]]>
     </command>
     <inputs>
         <param format="bed,vcf,gff,gff3" name="input" type="data" label="BED/VCF/GFF file"/>
-        <expand macro="genome" />
+        <expand macro="input_conditional_genome_file" />
     </inputs>
     <outputs>
         <data format_source="input" name="output" metadata_source="input" label="Complemen of ${input.name}"/>
@@ -23,6 +23,7 @@
     <tests>
         <test>
             <param name="input" value="a.bed" ftype="bed" />
+            <param name="genome_file_opts_selector" value="hist" />
             <param name="genome" value="mm9_chr1.len" />
             <output name="output" file="complementBed_result1.bed" ftype="bed" />
         </test>
--- a/fisherBed.xml	Fri Aug 18 15:33:08 2017 -0400
+++ b/fisherBed.xml	Tue Sep 05 15:40:14 2017 -0400
@@ -1,4 +1,4 @@
-<tool id="bedtools_fisher" name="FisherBed" version="@WRAPPER_VERSION@.0">
+<tool id="bedtools_fisher" name="FisherBed" version="@WRAPPER_VERSION@.1">
     <description>calculate Fisher statistic between two feature files</description>
     <macros>
         <import>macros.xml</import>
@@ -13,7 +13,7 @@
         -a '$inputA'
         -b '$inputB'
         -f $overlap
-        -g $genome
+        -g @GENOME_FILE@
         $reciprocal
         $m
         > '$output'
@@ -22,7 +22,7 @@
     <inputs>
         <param format="bed,vcf,gff,gff3" name="inputA" type="data" label="BED/VCF/GFF file"/>
         <param format="bed,gff,vcf,gff3" name="inputB" type="data" label="BED/VCF/GFF file"/>
-        <expand macro="genome" />
+        <expand macro="input_conditional_genome_file" />
         <expand macro="strand2" />
         <expand macro="split" />
         <expand macro="overlap" />
@@ -37,6 +37,7 @@
         <test>
             <param name="inputA" value="fisherBed1.bed" ftype="bed" />
             <param name="inputB" value="fisherBed2.bed" ftype="bed" />
+            <param name="genome_file_opts_selector" value="hist" />
             <param name="genome" value="fisherBed.len" ftype="tabular" />
             <output name="output" file="fisherBed_result1.bed" ftype="bed" />
         </test>
--- a/flankBed.xml	Fri Aug 18 15:33:08 2017 -0400
+++ b/flankBed.xml	Tue Sep 05 15:40:14 2017 -0400
@@ -1,4 +1,4 @@
-<tool id="bedtools_flankbed" name="FlankBed" version="@WRAPPER_VERSION@.0">
+<tool id="bedtools_flankbed" name="FlankBed" version="@WRAPPER_VERSION@.1">
     <description>create new intervals from the flanks of existing intervals</description>
     <macros>
         <import>macros.xml</import>
@@ -10,7 +10,7 @@
         flankBed
         $pct
         $strand
-        -g $genome
+        -g @GENOME_FILE@
         -i '$input'
 
         #if $addition.addition_select == 'b':
@@ -24,7 +24,7 @@
     </command>
     <inputs>
         <param format="bed,vcf,gff,gff3" name="input" type="data" label="BED/VCF/GFF file"/>
-        <expand macro="genome" />
+        <expand macro="input_conditional_genome_file" />
         <param name="pct" type="boolean" checked="false" truevalue="-pct" falsevalue=""
             label="Define -l and -r as a fraction of the feature’s length"
             help="E.g. if used on a 1000bp feature, -l 0.50, will add 500 bp “upstream”. (-pct)" />
@@ -39,6 +39,7 @@
     <tests>
         <test>
             <param name="input" value="a.bed" ftype="bed" />
+            <param name="genome_file_opts_selector" value="hist" />
             <param name="genome" value="mm9_chr1.len"/>
             <param name="addition_select" value="b"/>
             <param name="b" value="5"/>
@@ -46,6 +47,7 @@
         </test>
         <test>
             <param name="input" value="a.bed" ftype="bed" />
+            <param name="genome_file_opts_selector" value="hist" />
             <param name="genome" value="mm9_chr1.len"/>
             <param name="addition_select" value="lr"/>
             <param name="l" value="2"/>
--- a/genomeCoverageBed.xml	Fri Aug 18 15:33:08 2017 -0400
+++ b/genomeCoverageBed.xml	Tue Sep 05 15:40:14 2017 -0400
@@ -1,4 +1,4 @@
-<tool id="bedtools_genomecoveragebed" name="Genome Coverage" version="@WRAPPER_VERSION@.0">
+<tool id="bedtools_genomecoveragebed" name="Genome Coverage" version="@WRAPPER_VERSION@.1">
     <description>compute the coverage over an entire genome</description>
     <macros>
         <import>macros.xml</import>
@@ -8,12 +8,7 @@
     <command>
 <![CDATA[
         bedtools genomecov
-        #if $input_type.input_type_select == 'bam'
-            -ibam '$input_type.input'
-        #else
-            -i '$input_type.input'
-            -g '$input_type.genome'
-        #end if
+        @GENOME_FILE_COVERAGE@
 
         $split
         $strand
@@ -49,7 +44,7 @@
             </param>
             <when value="bed">
                 <param format="bed,vcf,gff,gff3" name="input" type="data" label="BED/VCF/GFF file" />
-                <expand macro="genome" />
+                <expand macro="input_conditional_genome_file" />
             </when>
             <when value="bam">
                 <param format="bam" name="input" type="data" label="BAM file" />
@@ -65,11 +60,11 @@
                     label="Report regions with zero coverage" help="If set, regions without any coverage will also be reported.  (-bga)" />
                 <param name="scale" type="float" value="1.0"
                     label="Scale the coverage by a constant factor"
-                    help="Each bedGraph coverage value is multiplied by this factor before being reported. Useful for normalizing coverage by, e.g., reads per million (RPM). (-scale)"/>
+                    help="Each bedGraph coverage value is multiplied by this factor before being reported. Useful for normalizing coverage by, e.g., reads per million (RPM). (-scale)" />
             </when>
             <when value="hist">
                 <param name="max" type="integer" label="Specify max depth" value="0"
-                    help="Combine all positions with a depth >= max into a single bin in the histogram. (-max)"/>
+                    help="Combine all positions with a depth >= max into a single bin in the histogram. (-max)" />
             </when>
         </conditional>
         <expand macro="split" />
@@ -99,6 +94,7 @@
         <test>
             <param name="input_type_select" value="bed" />
             <param name="input" value="genomeCoverageBed1.bed" ftype="bed" />
+            <param name="genome_file_opts_selector" value="hist" />
             <param name="genome" value="genomeCoverageBed1.len" ftype="tabular" />
             <param name="report_select" value="hist" />
             <output name="output" file="genomeCoverageBed_result1.bed" ftype="tabular" />
--- a/macros.xml	Fri Aug 18 15:33:08 2017 -0400
+++ b/macros.xml	Tue Sep 05 15:40:14 2017 -0400
@@ -49,10 +49,68 @@
             label="Treat split/spliced BAM or BED12 entries as distinct BED intervals when computing coverage."
             help="If set, the coverage will be calculated based the spliced intervals only. For BAM files, this inspects the CIGAR N operation to infer the blocks for computing coverage. For BED12 files, this inspects the BlockCount, BlockStarts, and BlockEnds fields (i.e., columns 10,11,12). If this option is not set, coverage will be calculated based on the interval's START/END coordinates, and would include introns in the case of RNAseq data. (-split)" />
     </xml>
-    <xml name="genome">
-        <param format="tabular" name="genome" type="data" label="Genome file" />
-        <!--TODO: make use of: ${chromInfo} -->
+    <xml name="input_conditional_genome_file">
+        <conditional name="genome_file_opts">
+            <param name="genome_file_opts_selector" type="select" label="Genome file">
+                <option value="loc" selected="True">Locally installed Genome file</option>
+                <option value="hist">Genome file from your history</option>
+            </param>
+            <when value="loc">
+                <param name="genome" type="select" multiple="false" label="Genome file">
+                    <options from_data_table="__dbkeys__" />
+                </param>
+            </when>
+            <when value="hist">
+                <param name="genome" type="data" format="tabular" label="Genome file" />
+            </when>
+        </conditional>
     </xml>
+    <token name="@GENOME_FILE@">
+#if $genome_file_opts.genome_file_opts_selector == "loc":
+    '$genome_file_opts.genome.fields.len_path'
+#elif $genome_file_opts.genome_file_opts_selector == "hist":
+    '$genome_file_opts.genome'
+#end if
+    </token>
+    <token name="@GENOME_FILE_MAPBED@">
+#if $genome.genome_choose == "-g":
+    #if $genome.genome_file_opts.genome_file_opts_selector == "loc":
+        -g '$genome.genome_file_opts.genome.fields.len_path'
+    #elif $genome.genome_file_opts.genome_file_opts_selector == "hist":
+        -g '$genome.genome_file_opts.genome'
+    #end if
+#end if
+    </token>
+    <token name="@GENOME_FILE_MAKEWINDOWS@">
+#if $type.type_select == "genome":
+    #if $type.genome_file_opts.genome_file_opts_selector == "loc":
+        -g '$type.genome_file_opts.genome.fields.len_path'
+    #elif $type.genome_file_opts.genome_file_opts_selector == "hist":
+        -g '$type.genome_file_opts.genome'
+    #end if
+#end if
+    </token>
+    <token name="@GENOME_FILE_UNION@">
+#if $empty.empty_selector == "-empty":
+    #if $empty.genome_file_opts.genome_file_opts_selector == "loc":
+        -g '$empty.genome_file_opts.genome.fields.len_path'
+    #elif $empty.genome_file_opts.genome_file_opts_selector == "hist":
+        -g '$empty.genome_file_opts.genome'
+    #end if
+#end if
+    </token>
+    <token name="@GENOME_FILE_COVERAGE@">
+#if $input_type.input_type_select == "bed":
+    -i '$input_type.input'
+    #if $input_type.genome_file_opts.genome_file_opts_selector == "loc":
+        -g '$input_type.genome_file_opts.genome.fields.len_path'
+    #elif $input_type.genome_file_opts.genome_file_opts_selector == "hist":
+        -g '$input_type.genome_file_opts.genome'
+    #end if
+#elif $input_type.input_type_select == "bam":
+    -ibam '$input_type.input'
+#end if
+    </token>
     <xml name="closest_D_option">
         <param name="iu" type="boolean" checked="false" truevalue="-iu" falsevalue=""
             label="Ignore features in B that are upstream of features in A"
--- a/makeWindowsBed.xml	Fri Aug 18 15:33:08 2017 -0400
+++ b/makeWindowsBed.xml	Tue Sep 05 15:40:14 2017 -0400
@@ -1,4 +1,4 @@
-<tool id="bedtools_makewindowsbed" name="MakeWindowsBed" version="@WRAPPER_VERSION@.0">
+<tool id="bedtools_makewindowsbed" name="MakeWindowsBed" version="@WRAPPER_VERSION@.1">
     <description>make interval windows across a genome</description>
     <macros>
         <import>macros.xml</import>
@@ -9,7 +9,7 @@
 <![CDATA[
         bedtools makewindows
         #if $type.type_select == 'genome':
-            -g '$type.genome'
+            @GENOME_FILE_MAKEWINDOWS@
         #else:
             -b '$type.input'
         #end if
@@ -36,7 +36,7 @@
                 <param  name="input" format="bed,vcf,gff,gff3" type="data" label="BED/VCF/GFF file"/>
             </when>
             <when value="genome">
-                <expand macro="genome" />
+                <expand macro="input_conditional_genome_file" />
             </when>
         </conditional>
         <conditional name="action">
@@ -81,6 +81,7 @@
     <tests>
         <test>
             <param name="type_select" value="genome" />
+            <param name="genome_file_opts_selector" value="hist" />
             <param name="genome" value="mm9_chr1.len" ftype="tabular" />
             <param name="action_select" value="windowsize" />
             <param name="windowsize" value="1000000" />
@@ -88,6 +89,7 @@
         </test>
         <test>
             <param name="type_select" value="genome" />
+            <param name="genome_file_opts_selector" value="hist" />
             <param name="genome" value="mm9_chr1.len" ftype="tabular" />
             <param name="action_select" value="windowsize" />
             <param name="windowsize" value="1000000" />
@@ -97,6 +99,7 @@
         </test>
         <test>
             <param name="type_select" value="genome" />
+            <param name="genome_file_opts_selector" value="hist" />
             <param name="genome" value="mm9_chr1.len" ftype="tabular" />
             <param name="action_select" value="number" />
             <param name="number" value="100" />
--- a/mapBed.xml	Fri Aug 18 15:33:08 2017 -0400
+++ b/mapBed.xml	Tue Sep 05 15:40:14 2017 -0400
@@ -1,4 +1,4 @@
-<tool id="bedtools_map" name="MapBed" version="@WRAPPER_VERSION@.0">
+<tool id="bedtools_map" name="MapBed" version="@WRAPPER_VERSION@.1">
     <description>apply a function to a column for each overlapping interval</description>
     <macros>
         <import>macros.xml</import>
@@ -8,17 +8,15 @@
     <command>
 <![CDATA[
         bedtools map
-        -a "${inputA}"
-        -b "${inputB}"
+        -a '${inputA}'
+        -b '${inputB}'
         $strand
         @C_AND_O_ARGUMENT@
         -f $overlap
         $reciprocal
         $split
         $header
-        #if $genome.genome_choose == "-g" :
-            -g $genome.genome
-        #end if
+        @GENOME_FILE_MAPBED@
         > "${output}"
 ]]>
     </command>
@@ -36,16 +34,19 @@
         <expand macro="split" />
         <expand macro="print_header" />
         <conditional name="genome">
-            <param name="genome_choose" type="boolean" checked="false" truevalue="-g" falsevalue=""
-                label="Treat split/spliced BAM or BED12 entries as distinct BED intervals when computing coverage." help="(-g)" />
+            <param name="genome_choose" argument="-g" type="select" 
+                label="Specify a genome file the defines the expected chromosome order in the input files." >
+                <option value="" selected="true">No</option>
+                <option value="-g">Yes</option>
+            </param>
             <when value="-g">
-                <expand macro="genome" />
+                <expand macro="input_conditional_genome_file" />
             </when>
             <when value="" />
         </conditional>
     </inputs>
     <outputs>
-        <data format_source="inputA" name="output" metadata_source="inputA" label="Mapping of ${inputB.name} into ${inputA.name}"/>
+        <data format_source="inputA" name="output" metadata_source="inputA" label="Mapping of ${inputB.name} into ${inputA.name}" />
     </outputs>
     <tests>
         <test>
@@ -86,6 +87,19 @@
             <param name="strand" value="-s" />
             <output name="output" file="mapBed_result4.bed" ftype="bed" />
         </test>
+        <test>
+            <param name="inputA" value="mapBed3.bed" ftype="bed" />
+            <param name="inputB" value="mapBed4.bed" ftype="bed" />
+            <repeat name="c_and_o_argument_repeat">
+                <param name="col" value="5" />
+                <param name="operation" value="collapse" />
+            </repeat>
+            <param name="strand" value="-s" />
+            <param name="genome_choose" value="-g" />
+            <param name="genome_file_opts_selector" value="hist" />
+            <param name="genome" value="mm9.len" ftype="bed" />
+            <output name="output" file="mapBed_result5.bed" ftype="bed" />
+        </test>
     </tests>
     <help>
 <![CDATA[
--- a/multiIntersectBed.xml	Fri Aug 18 15:33:08 2017 -0400
+++ b/multiIntersectBed.xml	Tue Sep 05 15:40:14 2017 -0400
@@ -1,4 +1,4 @@
-<tool id="bedtools_multiintersectbed" name="Multiple Intersect" version="@WRAPPER_VERSION@.0">
+<tool id="bedtools_multiintersectbed" name="Multiple Intersect" version="@WRAPPER_VERSION@.1">
     <description>identifies common intervals among multiple interval files</description>
     <macros>
         <import>macros.xml</import>
@@ -11,10 +11,8 @@
         $header
         $cluster
         -filler "${filler}"
-        #if $zero.value == True:
-            -empty
-            -g $genome
-        #end if
+        $empty.empty_selector
+        @GENOME_FILE_UNION@
 
         #if str($tag.tag_select) == "tag":
             #set files = '" "'.join( [ str( $file ) for $file in $tag.inputs ] )
@@ -45,17 +43,23 @@
             <when value="custom">
                 <repeat name="beds" title="Add BED files" min="2" >
                     <param name="input" format="bed" type="data" multiple="True" label="BED file" />
-                    <param name="custom_name" type="text" area="false" label="Custom sample name"/>
+                    <param name="custom_name" type="text" area="false" label="Custom sample name" />
                 </repeat>
             </when>
         </conditional>
-        <expand macro="genome" />
         <param name="cluster" type="boolean" checked="false" truevalue="-cluster" falsevalue=""
             label="Invoke Ryan Layers's clustering algorithm"
             help="(-cluster)" />
-        <param name="zero" type="boolean" checked="true"
-            label="Report regions that are not covered by any of the files"
-            help="If set, regions that are not overlapped by any file will also be reported. Requires a valid organism key for all input datasets" />
+        <conditional name="empty">
+            <param name="empty_selector" argument="-empty" type="select" label="Report empty regions" help="Include regions that have zero coverage in all BedGraph datasets">
+                <option value="-empty">Yes</option>
+                <option value="">No</option>
+            </param>
+            <when value="-empty">
+                <expand macro="input_conditional_genome_file" />
+            </when>
+            <when value="" />
+        </conditional>
         <param name="filler" type="text" value="N/A"
             label="Text to use for no-coverage value"
             help="Can be 0.0, N/A, - or any other value. (-filler)" />
@@ -67,23 +71,24 @@
     </outputs>
     <tests>
         <test>
-            <param name="tag_select" value="tag"/>
+            <param name="tag_select" value="tag" />
             <param name="inputs" value="multiIntersectBed1.bed,multiIntersectBed2.bed,multiIntersectBed3.bed" ftype="bed" />
-            <param name="zero" value="False"/>
+            <param name="empty_selector" value="" />
             <output name="output" file="multiIntersectBed_result1.bed" ftype="bed" />
         </test>
         <test>
-            <param name="tag_select" value="tag"/>
+            <param name="tag_select" value="tag" />
             <param name="inputs" value="multiIntersectBed1.bed,multiIntersectBed2.bed,multiIntersectBed3.bed" ftype="bed" />
-            <param name="header" value="True"/>
-            <param name="zero" value="False"/>
+            <param name="header" value="True" />
+            <param name="empty_selector" value="" />
             <output name="output" file="multiIntersectBed_result2.bed" lines_diff="2" ftype="bed" />
         </test>
         <test>
-            <param name="tag_select" value="tag"/>
+            <param name="tag_select" value="tag" />
             <param name="inputs" value="multiIntersectBed1.bed,multiIntersectBed2.bed,multiIntersectBed3.bed" ftype="bed" />
-            <param name="zero" value="True"/>
-            <param name="genome" value="multiIntersectBed1.len"/>
+            <param name="empty_selector" value="-empty" />
+            <param name="genome_file_opts_selector" value="hist" />
+            <param name="genome" value="multiIntersectBed1.len" />
             <output name="output" file="multiIntersectBed_result3.bed" ftype="bed" />
         </test>
     </tests>
--- a/randomBed.xml	Fri Aug 18 15:33:08 2017 -0400
+++ b/randomBed.xml	Tue Sep 05 15:40:14 2017 -0400
@@ -1,4 +1,4 @@
-<tool id="bedtools_randombed" name="RandomBed" version="@WRAPPER_VERSION@.0">
+<tool id="bedtools_randombed" name="RandomBed" version="@WRAPPER_VERSION@.1">
     <description>generate random intervals in a genome</description>
     <macros>
         <import>macros.xml</import>
@@ -8,7 +8,7 @@
     <command>
 <![CDATA[
         bedtools random
-        -g $genome
+        -g @GENOME_FILE@
         -l $length
         -n $intervals
         #if str($seed.seed_choose) == "True":
@@ -18,7 +18,7 @@
 ]]>
     </command>
     <inputs>
-        <expand macro="genome" />
+        <expand macro="input_conditional_genome_file" />
         <param name="length" type="integer" value="100" label="The length of the intervals to generate" help="(-l)" />
         <param name="intervals" type="integer" value="1000000" label="The number of intervals to generate" help="(-n)" />
         <expand macro="seed" />
@@ -28,6 +28,7 @@
     </outputs>
     <tests>
         <test>
+            <param name="genome_file_opts_selector" value="hist" />
             <param name="genome" value="mm9_chr1.len" />
             <param name="seed_choose" value="False" />
             <param name="length" value="5" />
--- a/shuffleBed.xml	Fri Aug 18 15:33:08 2017 -0400
+++ b/shuffleBed.xml	Tue Sep 05 15:40:14 2017 -0400
@@ -1,4 +1,4 @@
-<tool id="bedtools_shufflebed" name="ShuffleBed" version="@WRAPPER_VERSION@.0">
+<tool id="bedtools_shufflebed" name="ShuffleBed" version="@WRAPPER_VERSION@.1">
     <description>randomly redistrubute intervals in a genome</description>
     <macros>
         <import>macros.xml</import>
@@ -8,7 +8,7 @@
     <command>
 <![CDATA[
         bedtools shuffle
-        -g '$genome'
+        -g @GENOME_FILE@
         -i '$inputA'
         $bedpe
         #if str($seed.seed_choose) == "True":
@@ -31,7 +31,7 @@
     <inputs>
         <param format="bed,vcf,gff,gff3" name="inputA" type="data" label="BED/VCF/GFF file"/>
         <param name="bedpe" type="boolean" label="The file is in BEDPE format" checked="False" truevalue="-bedpe" falsevalue="" />
-        <expand macro="genome" />
+        <expand macro="input_conditional_genome_file" />
         <param name="chrom" type="boolean" checked="False" truevalue="-chrom" falsevalue=""
             label="Keep features in the input file on the same chromosome"
             help="Solely permute their location on the chromosome. By default, both the chromosome and position are randomly chosen. (-chrom)" />
@@ -67,6 +67,7 @@
     <tests>
         <test>
             <param name="inputA" value="shuffleBed1.bed" ftype="bed" />
+            <param name="genome_file_opts_selector" value="hist" />
             <param name="genome" value="shuffleBed.len" ftype="tabular" />
             <param name="chrom" value="" />
             <param name="seed_choose" value="True" />
@@ -75,6 +76,7 @@
         </test>
         <test>
             <param name="inputA" value="shuffleBed1.bed" ftype="bed" />
+            <param name="genome_file_opts_selector" value="hist" />
             <param name="genome" value="shuffleBed.len" ftype="tabular" />
             <param name="chrom" value="True" />
             <param name="seed_choose" value="True" />
@@ -83,6 +85,7 @@
         </test>
         <test>
             <param name="inputA" value="shuffleBed1.bed" ftype="bed" />
+            <param name="genome_file_opts_selector" value="hist" />
             <param name="genome" value="shuffleBed.len" ftype="tabular" />
             <param name="excl" value="shuffleBed2.bed" ftype="bed" />
             <param name="seed_choose" value="True" />
@@ -91,6 +94,7 @@
         </test>
         <test>
             <param name="inputA" value="shuffleBed1.bed" ftype="bed" />
+            <param name="genome_file_opts_selector" value="hist" />
             <param name="genome" value="shuffleBed.len" ftype="bed" />
             <param name="allow_beyond" value="True" />
             <param name="seed_choose" value="True" />
--- a/slopBed.xml	Fri Aug 18 15:33:08 2017 -0400
+++ b/slopBed.xml	Tue Sep 05 15:40:14 2017 -0400
@@ -1,4 +1,4 @@
-<tool id="bedtools_slopbed" name="SlopBed" version="@WRAPPER_VERSION@.0">
+<tool id="bedtools_slopbed" name="SlopBed" version="@WRAPPER_VERSION@.1">
     <description>adjust the size of intervals</description>
     <macros>
         <import>macros.xml</import>
@@ -10,7 +10,7 @@
         bedtools slop
         $pct
         $strand
-        -g '$genome'
+        -g @GENOME_FILE@
         -i '$inputA'
         #if $addition.addition_select == 'b':
             -b $addition.b
@@ -24,7 +24,7 @@
     </command>
     <inputs>
         <param format="bed,vcf,gff,gff3" name="inputA" type="data" label="BED/VCF/GFF file"/>
-        <expand macro="genome" />
+        <expand macro="input_conditional_genome_file" />
         <param name="pct" type="boolean" checked="false" truevalue="-pct" falsevalue=""
             label="Define -l and -r as a fraction of the feature’s length"
             help="E.g. if used on a 1000bp feature, -l 0.50, will add 500 bp “upstream”" />
@@ -40,6 +40,7 @@
     <tests>
         <test>
             <param name="inputA" value="a.bed" ftype="bed" />
+            <param name="genome_file_opts_selector" value="hist" />
             <param name="genome" value="mm9_chr1.len" ftype="bed" />
             <param name="addition_select" value="b" />
             <param name="b" value="5" />
@@ -47,6 +48,7 @@
         </test>
         <test>
             <param name="inputA" value="a.bed" ftype="bed" />
+            <param name="genome_file_opts_selector" value="hist" />
             <param name="genome" value="mm9_chr1.len" ftype="bed" />
             <param name="addition_select" value="lr" />
             <param name="l" value="2" />
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/mapBed3.bed	Tue Sep 05 15:40:14 2017 -0400
@@ -0,0 +1,6 @@
+chr1	10	20	a1	1	+
+chr1	50	60	a2	2	-
+chr1	80	90	a3	3	-
+chr9	10	20	a1	1	+
+chr9	50	60	a2	2	-
+chr9	80	90	a3	3	-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/mapBed4.bed	Tue Sep 05 15:40:14 2017 -0400
@@ -0,0 +1,10 @@
+chr1	12	14	b1	2	+
+chr1	13	15	b2	5	-
+chr1	16	18	b3	5	+
+chr1	82	85	b4	2	-
+chr1	85	87	b5	3	+
+chr9	12	14	b1	2	+
+chr9	13	15	b2	5	-
+chr9	16	18	b3	5	+
+chr9	82	85	b4	2	-
+chr9	85	87	b5	3	+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/mapBed_result5.bed	Tue Sep 05 15:40:14 2017 -0400
@@ -0,0 +1,6 @@
+chr1	10	20	a1	1	+	2,5
+chr1	50	60	a2	2	-	.
+chr1	80	90	a3	3	-	2
+chr9	10	20	a1	1	+	2,5
+chr9	50	60	a2	2	-	.
+chr9	80	90	a3	3	-	2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool-data/dbkeys.loc.sample	Tue Sep 05 15:40:14 2017 -0400
@@ -0,0 +1,13 @@
+#This file lists the locations and dbkeys of all the genome files
+#See here for details: http://bedtools.readthedocs.io/en/latest/content/general-usage.html#genome-file-format
+#You can add elements to this data table using the data_manager_fetch_genome_dbkeys_all_fasta data manager.
+#Alternatively, index files created using samtools faidx (http://www.htslib.org/doc/faidx.html) contain 3 extra columns, but work fine.
+#This file has the format (white space characters are TAB characters):
+#
+#<dbkey>	<display_name>	<file_path>
+#
+#So, dbkeys.loc could look something like this:
+#
+#apiMel3	Honeybee (Apis mellifera): apiMel3	/path/to/genome/apiMel3/apiMel3.len
+#hg19	Human (Homo sapiens): hg19 Canonical	/path/to/genome/hg19/hg19canon.len
+#
--- a/tool_data_table_conf.xml.sample	Fri Aug 18 15:33:08 2017 -0400
+++ b/tool_data_table_conf.xml.sample	Tue Sep 05 15:40:14 2017 -0400
@@ -8,5 +8,10 @@
     <table name="all_gff" comment_char="#">
         <columns>value, dbkey, name, path</columns>
         <file path="tool-data/all_gff.loc" />
-    </table>	
+    </table>
+    <!-- Locations of dbkeys and len files under genome directory -->
+    <table name="__dbkeys__" comment_char="#">
+        <columns>value, name, len_path</columns>
+        <file path="tool-data/dbkeys.loc" />
+    </table>
 </tables>
--- a/unionBedGraphs.xml	Fri Aug 18 15:33:08 2017 -0400
+++ b/unionBedGraphs.xml	Tue Sep 05 15:40:14 2017 -0400
@@ -1,4 +1,4 @@
-<tool id="bedtools_unionbedgraph" name="Merge BedGraph files" version="@WRAPPER_VERSION@.0">
+<tool id="bedtools_unionbedgraph" name="Merge BedGraph files" version="@WRAPPER_VERSION@.1">
     <description>combines coverage intervals from multiple BEDGRAPH files</description>
     <macros>
         <import>macros.xml</import>
@@ -10,10 +10,8 @@
     unionBedGraphs
         $header
         -filler "${filler}"
-        #if $zero.value == True:
-            -empty
-            -g $genome
-        #end if
+        $empty.empty_selector
+        @GENOME_FILE_UNION@
 
         #if str($tag.tag_select) == "tag":
             #set files = '" "'.join( [ str( $file ) for $file in $tag.inputs ] )
@@ -43,14 +41,20 @@
             <when value="custom">
                 <repeat name="bedgraphs" title="Add BedGraph files" min="2" >
                     <param name="input" format="bedgraph" type="data" multiple="True" label="BedGraph file" />
-                    <param name="custom_name" type="text" area="false" label="Custom sample name"/>
+                    <param name="custom_name" type="text" area="false" label="Custom sample name" />
                 </repeat>
             </when>
         </conditional>
-        <expand macro="genome" />
-        <param name="zero" type="boolean" checked="true"
-            label="Report regions with zero coverage"
-            help="If set, regions without any coverage will also be reported. Requires a valid organism key for all input datasets" />
+        <conditional name="empty">
+            <param name="empty_selector" argument="-empty" type="select" label="Report empty regions" help="Include regions that have zero coverage in all BedGraph datasets">
+                <option value="-empty">Yes</option>
+                <option value="">No</option>
+            </param>
+            <when value="-empty">
+                <expand macro="input_conditional_genome_file" />
+            </when>
+            <when value="" />
+        </conditional>
         <param name="filler" type="text" value="N/A"
             label="Text to use for no-coverage value"
             help="Can be 0.0, N/A, - or any other value. (-filler)" />
@@ -61,27 +65,28 @@
     </outputs>
     <tests>
         <test>
-            <param name="tag_select" value="tag"/>
+            <param name="tag_select" value="tag" />
             <param name="inputs" value="unionBedGraphs1.bg,unionBedGraphs2.bg,unionBedGraphs3.bg" ftype="bedgraph" />
-            <param name="zero" value="False"/>
+            <param name="empty_selector" value="" />
             <output name="output" file="unionBedGraphs_result1.bg" ftype="bedgraph" />
         </test>
         <test>
-            <param name="tag_select" value="tag"/>
+            <param name="tag_select" value="tag" />
             <param name="inputs" value="unionBedGraphs1.bg,unionBedGraphs2.bg,unionBedGraphs3.bg" ftype="bedgraph" />
-            <param name="header" value="True"/>
-            <param name="zero" value="False"/>
+            <param name="header" value="True" />
+            <param name="empty_selector" value="" />
             <output name="output" file="unionBedGraphs_result2.bg" ftype="bedgraph" />
         </test>
         <test>
-            <param name="tag_select" value="tag"/>
+            <param name="tag_select" value="tag" />
             <param name="inputs" value="unionBedGraphs1.bg,unionBedGraphs2.bg,unionBedGraphs3.bg" ftype="bedgraph" />
-            <param name="zero" value="True"/>
-            <param name="genome" value="unionBedGraphs1.len"/>
+            <param name="empty_selector" value="-empty" />
+            <param name="genome_file_opts_selector" value="hist" />
+            <param name="genome" value="unionBedGraphs1.len" />
             <output name="output" file="unionBedGraphs_result3.bg" ftype="bedgraph" />
         </test>
         <test>
-            <param name="tag_select" value="custom"/>
+            <param name="tag_select" value="custom" />
             <repeat name="bedgraphs">
                 <param name="input" value="unionBedGraphs1.bg" />
                 <param name="custom_name" value="first" />
@@ -94,8 +99,9 @@
                 <param name="input" value="unionBedGraphs3.bg" />
                 <param name="custom_name" value="third" />
             </repeat>
-            <param name="zero" value="True"/>
-            <param name="genome" value="unionBedGraphs1.len"/>
+            <param name="empty_selector" value="-empty" />
+            <param name="genome_file_opts_selector" value="hist" />
+            <param name="genome" value="unionBedGraphs1.len" />
             <output name="output" file="unionBedGraphs_result4.bg" ftype="bedgraph" />
         </test>
     </tests>