diff intersectBed.xml @ 34:dde39ba9c031 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bedtools commit b68002321ade5e160c556517a98ffb70f068be95
author iuc
date Mon, 29 Apr 2019 05:55:48 -0400
parents 4f7a5ccd2ae9
children b28e0cfa7ba1
line wrap: on
line diff
--- a/intersectBed.xml	Mon Dec 17 14:23:31 2018 -0500
+++ b/intersectBed.xml	Mon Apr 29 05:55:48 2019 -0400
@@ -1,4 +1,4 @@
-<tool id="bedtools_intersectbed" name="bedtools Intersect intervals" version="@WRAPPER_VERSION@">
+<tool id="bedtools_intersectbed" name="bedtools Intersect intervals" version="@TOOL_VERSION@+galaxy1">
     <description>find overlapping intervals in various ways</description>
     <macros>
         <import>macros.xml</import>
@@ -8,76 +8,82 @@
     </expand>
     <expand macro="stdio" />
     <command><![CDATA[
-        #import re
-        #set modes = ' '.join( str($overlap_mode).split(',') )
+#import re
+#set modes = ' '.join(str($overlap_mode).split(','))
+
+#if $modes == "None":
+    #set modes = ''
+#end if
 
-        #if $modes == "None":
-            #set modes = ''
-        #end if
+bedtools intersect
+#if $inputA.is_of_type('bam'):
+    -abam '${inputA}'
+#else:
+    -a '${inputA}'
+#end if
 
-        bedtools intersect
-        #if $inputA.is_of_type('bam'):
-            -abam '${inputA}'
-        #else:
-            -a '${inputA}'
-        #end if
+#if str($reduce_or_iterate.reduce_or_iterate_selector) == 'iterate':
+    -b '$reduce_or_iterate.inputB'
+#else:
+    -b
+    #for $file in $reduce_or_iterate.inputB
+        '$file'
+    #end for
 
-        #if str($reduce_or_iterate.reduce_or_iterate_selector) == 'iterate':
-            -b '$reduce_or_iterate.inputB'
-        #else:
-            #set inputBs = "' '".join([str($file) for $file in $reduce_or_iterate.inputB])
-            -b '$inputBs'
-            #if $reduce_or_iterate.names:
-                #set namesB = "' '".join([re.sub('[^\s\w\-]', '_', str($file.element_identifier)) for $file in $reduce_or_iterate.inputB])
-                -names '$namesB'
-            #end if
+    #if $reduce_or_iterate.names:
+        #set namesB = "' '".join([re.sub('[^\s\w\-]', '_', str($file.element_identifier)) for $file in $reduce_or_iterate.inputB])
+        -names '$namesB'
+    #end if
+#end if
+$split
+$strand
+#if $fraction_cond.fraction_select == "specify":
+    #if str($fraction_cond.overlap)
+        -f $fraction_cond.overlap
+    #end if
+    $fraction_cond.reciprocal_cond.reciprocal
+    #if str($fraction_cond.reciprocal_cond.reciprocal) == '':
+        #if str($fraction_cond.reciprocal_cond.overlapB):
+            -F $fraction_cond.reciprocal_cond.overlapB
         #end if
-        $split
-        $strand
-        #if $fraction_cond.fraction_select == "specify":
-            -f '${fraction_cond.overlap}'
-            $fraction_cond.reciprocal_cond.reciprocal 
-            #if str($fraction_cond.reciprocal_cond.reciprocal) == '':
-                -F '${fraction_cond.reciprocal_cond.overlapB}'
-                $fraction_cond.reciprocal_cond.disjoint
-            #end if
-        #end if
-        $invert
-        $once
-        $header
-        $modes
-        $sorted
-        #if str($sorted) != '':
-            #if str($reduce_or_iterate.reduce_or_iterate_selector) == 'iterate' and $reduce_or_iterate.inputB.is_of_type('bam'):
-                -g <(samtools view -H $reduce_or_iterate.inputB | tr ':' '\t' | grep SN | cut -f 3,5)
-            #else if str($reduce_or_iterate.reduce_or_iterate_selector) == 'reduce' and str($reduce_or_iterate.inputB) != 'None' and $reduce_or_iterate.inputB[0].is_of_type('bam'):
-                -g <(samtools view -H $reduce_or_iterate.inputB[0] | tr ':' '\t' | grep SN | cut -f 3,5)
-            #end if
-        #end if
-        $bed
-        $count
-        > '${output}'
-]]>
-    </command>
+        $fraction_cond.reciprocal_cond.disjoint
+    #end if
+#end if
+$invert
+$once
+$header
+$modes
+$sorted
+#if str($sorted) != '':
+    #if str($reduce_or_iterate.reduce_or_iterate_selector) == 'iterate' and $reduce_or_iterate.inputB.is_of_type('bam'):
+        -g <(samtools view -H $reduce_or_iterate.inputB | tr ':' '\t' | grep SN | cut -f 3,5)
+    #else if str($reduce_or_iterate.reduce_or_iterate_selector) == 'reduce' and str($reduce_or_iterate.inputB) != 'None' and $reduce_or_iterate.inputB[0].is_of_type('bam'):
+        -g <(samtools view -H $reduce_or_iterate.inputB[0] | tr ':' '\t' | grep SN | cut -f 3,5)
+    #end if
+#end if
+$bed
+$count
+> '${output}'
+    ]]></command>
     <inputs>
-        <param format="bam,@STD_BEDTOOLS_INPUTS@" name="inputA" type="data" label="File A to intersect with B" help="BAM/@STD_BEDTOOLS_INPUT_LABEL@ format" />
+        <param name="inputA" type="data" format="bam,@STD_BEDTOOLS_INPUTS@" label="File A to intersect with B" help="BAM/@STD_BEDTOOLS_INPUT_LABEL@ format" />
         <conditional name="reduce_or_iterate">
-            <param name='reduce_or_iterate_selector' type='select' label='Combined or separate output files'>
-                <option value='iterate' selected='true'>One output file per 'input B' file</option>
-                <option value='reduce'>Single output containing intersections of any 'input B' lines with A </option>
+            <param name="reduce_or_iterate_selector" type="select" label="Combined or separate output files">
+                <option value="iterate" selected="true">One output file per 'input B' file</option>
+                <option value="reduce">Single output containing intersections of any 'input B' lines with A</option>
             </param>
-            <when value='iterate'>
-                <param format="bam,@STD_BEDTOOLS_INPUTS@" name="inputB" type="data"
-                       label="File(s) B to intersect with A" help="BAM/@STD_BEDTOOLS_INPUT_LABEL@ format"/>
+            <when value="iterate">
+                <param name="inputB" argument="-b" type="data" format="bam,@STD_BEDTOOLS_INPUTS@"
+                       label="File B to intersect with A" help="BAM/@STD_BEDTOOLS_INPUT_LABEL@ format"/>
             </when>
-            <when value='reduce'>
-                <param format="bam,@STD_BEDTOOLS_INPUTS@" name="inputB" type="data" multiple="true"
+            <when value="reduce">
+                <param name="inputB" argument="-b" type="data" format="bam,@STD_BEDTOOLS_INPUTS@" multiple="true"
                        label="File(s) B to intersect with A" help="BAM/@STD_BEDTOOLS_INPUT_LABEL@ format"/>
-                <param argument="names" type="boolean" truevalue="yes" falsevalue="no" label="add data set names instead of indices" help=""/>
+                <param argument="-names" type="boolean" truevalue="yes" falsevalue="no" label="Add data set names instead of indices" />
             </when>
         </conditional>
         <expand macro="strand2" />
-        <param name="overlap_mode" type="select" multiple="True" label="What should be written to the output file?">
+        <param name="overlap_mode" type="select" multiple="true" label="What should be written to the output file?">
             <option value="-wa">Write the original entry in A for each overlap (-wa)</option>
             <option value="-wb">Write the original entry in B for each overlap. Useful for knowing what A overlaps. Restricted by the fraction- and reciprocal option (-wb)</option>
             <option value="-wo">Write the original A and B entries plus the number of base pairs of overlap between the two features. Only A features with overlap are reported. Restricted by the fraction- and reciprocal option (-wo)</option>
@@ -87,46 +93,45 @@
 
         <expand macro="split" />
         <conditional name="fraction_cond">
-            <param name='fraction_select' type='select' label='Required overlap'>
-                <option value='default' selected='true'>Default: 1bp</option>
-                <option value='specify'>Specify minimum overlap(s)</option>
+            <param name="fraction_select" type="select" label="Required overlap">
+                <option value="default" selected="true">Default: 1bp</option>
+                <option value="specify">Specify minimum overlap(s)</option>
             </param>
             <when value="default"/>
-            <when value='specify'>
+            <when value="specify">
                 <expand macro="overlap" />
                 <conditional name="reciprocal_cond">
                     <expand macro="reciprocal" />
                 <when value="-r"/>
                 <when value="">
-                    <expand macro="overlapB" />
-                    <param name="disjoint" argument="-e" type="boolean" checked="false" truevalue="-e"  falsevalue=""
+                    <expand macro="overlap" name="overlapB" argument="-F" fracof="B"/>
+                    <param name="disjoint" argument="-e" type="boolean" truevalue="-e"  falsevalue="" checked="false"
                         label="Require that the fraction of overlap is fulfilled for A OR B." help="If enabled, then for -f 0.90 and -F 0.10 this requires that either 90% of A is covered OR 10% of B is covered, otherwise, both fractions would have to be satisfied."/>
                 </when>
             </conditional>
             </when>
         </conditional>
         <!-- -v -->
-        <param name="invert" type="boolean" checked="false" truevalue="-v" falsevalue=""
-            label="Report only those alignments that **do not** overlap with file(s) B"
-            help="(-v)"/>
+        <param name="invert" argument="-v" type="boolean" truevalue="-v" falsevalue="" checked="false"
+            label="Report only those alignments that **do not** overlap with file(s) B" />
         <!-- -u -->
-        <param name="once" type="boolean" checked="false" truevalue="-u" falsevalue=""
+        <param name="once" argument="-u" type="boolean" truevalue="-u" falsevalue="" checked="false"
             label="Write the original A entry _once_ if _any_ overlaps found in B."
-            help="Just report the fact >=1 hit was found. (-u)" />
+            help="Just report the fact >=1 hit was found" />
         <!-- -c -->
-        <param name="count" type="boolean" checked="false" truevalue="-c" falsevalue=""
+        <param name="count" argument="-c" type="boolean" truevalue="-c" falsevalue="" checked="false"
             label="For each entry in A, report the number of overlaps with B."
-            help="Reports 0 for A entries that have no overlap with B. (-c)" />
+            help="Reports 0 for A entries that have no overlap with B" />
         <!-- -bed -->
-        <param argument="-bed" type="boolean" checked="false" truevalue="-bed" falsevalue=""
+        <param argument="-bed" type="boolean" truevalue="-bed" falsevalue="" checked="false"
             label="When using BAM input (-abam), write output as BED instead of BAM." />
         <!-- -sorted -g  -->
-        <param argument="-sorted" type="boolean" checked="false" truevalue="-sorted" falsevalue=""
+        <param argument="-sorted" type="boolean" truevalue="-sorted" falsevalue="" checked="false"
             label="For coordinate sorted input file the more efficient sweeping algorithm is enabled." />
         <expand macro="print_header" />
     </inputs>
     <outputs>
-        <data format_source="inputA" name="output" metadata_source="inputA">
+        <data name="output" format_source="inputA" metadata_source="inputA">
             <change_format>
                 <when input="bed" value="-bed" format="bed" />
             </change_format>
@@ -137,7 +142,7 @@
         <test>
             <param name="inputA" value="intersect-A.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="iterate" />
+                <param name="reduce_or_iterate_selector" value="iterate" />
                 <param name="inputB" value="intersect-B.bed" ftype="bed" />
             </conditional>
             <output name="output" file="intersect-default.bed" ftype="bed" />
@@ -145,7 +150,7 @@
         <test>
             <param name="inputA" value="intersect-query.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="reduce" />
+                <param name="reduce_or_iterate_selector" value="reduce" />
                 <param name="inputB" value="intersect-d1.bed,intersect-d2.bed,intersect-d3.bed" ftype="bed" />
             </conditional>
             <output name="output" file="intersect-multiple.bed" ftype="bed" />
@@ -153,7 +158,7 @@
         <test>
             <param name="inputA" value="intersect-query.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="reduce" />
+                <param name="reduce_or_iterate_selector" value="reduce" />
                 <param name="inputB" value="intersect-d1.bed,intersect-d2.bed,intersect-d3.bed" ftype="bed" />
             </conditional>
             <param name="overlap_mode" value="-wa,-wb" />
@@ -161,10 +166,10 @@
             <output name="output" file="intersect-multiple-wa-wb.bed" ftype="bed" />
         </test>
         <test>
-                <param name="inputB" value="intersect-d1.bed,intersect-d2.bed,intersect-d3.bed" ftype="bed" />
+            <param name="inputB" value="intersect-d1.bed,intersect-d2.bed,intersect-d3.bed" ftype="bed" />
             <param name="inputA" value="intersect-query.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="reduce" />
+                <param name="reduce_or_iterate_selector" value="reduce" />
                 <param name="inputB" value="intersect-d1.bed,intersect-d2.bed,intersect-d3.bed" ftype="bed" />
                 <param name="names" value="yes" />
             </conditional>
@@ -175,7 +180,7 @@
         <test>
             <param name="inputA" value="intersect-query.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="reduce" />
+                <param name="reduce_or_iterate_selector" value="reduce" />
                 <param name="inputB" value="intersect-d1.bed,intersect-d2.bed,intersect-d3.bed" ftype="bed" />
             </conditional>
             <param name="invert" value="-v" />
@@ -185,12 +190,12 @@
         <test>
             <param name="inputA" value="intersect-query.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="reduce" />
+                <param name="reduce_or_iterate_selector" value="reduce" />
                 <param name="inputB" value="intersect-d1.bed,intersect-d2.bed,intersect-d3.bed" ftype="bed" />
             </conditional>
             <param name="overlap_mode" value="-wa,-wb" />
             <conditional name="fraction_cond">
-                <param name='fraction_select' value='specify'/>
+                <param name="fraction_select" value="specify"/>
                 <param name="overlap" value="1.0" />
             </conditional>
             <param name="sorted" value="-sorted" />
@@ -199,7 +204,7 @@
         <test>
             <param name="inputA" value="intersect-A.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="iterate" />
+                <param name="reduce_or_iterate_selector" value="iterate" />
                 <param name="inputB" value="intersect-B.bed" ftype="bed" />
             </conditional>
             <param name="overlap_mode" value="-wa" />
@@ -208,7 +213,7 @@
         <test>
             <param name="inputA" value="intersect-A.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="iterate" />
+                <param name="reduce_or_iterate_selector" value="iterate" />
                 <param name="inputB" value="intersect-B.bed" ftype="bed" />
             </conditional>
             <param name="overlap_mode" value="-wb" />
@@ -217,7 +222,7 @@
         <test>
             <param name="inputA" value="intersect-A.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="iterate" />
+                <param name="reduce_or_iterate_selector" value="iterate" />
                 <param name="inputB" value="intersect-B.bed" ftype="bed" />
             </conditional>
             <param name="overlap_mode" value="-wa,-wb" />
@@ -226,7 +231,7 @@
         <test>
             <param name="inputA" value="intersect-A.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="iterate" />
+                <param name="reduce_or_iterate_selector" value="iterate" />
                 <param name="inputB" value="intersect-B.bed" ftype="bed" />
             </conditional>
             <param name="overlap_mode" value="-loj" />
@@ -235,7 +240,7 @@
         <test>
             <param name="inputA" value="intersect-A.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="iterate" />
+                <param name="reduce_or_iterate_selector" value="iterate" />
                 <param name="inputB" value="intersect-B.bed" ftype="bed" />
             </conditional>
             <param name="overlap_mode" value="-wo" />
@@ -244,7 +249,7 @@
         <test>
             <param name="inputA" value="intersect-A.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="iterate" />
+                <param name="reduce_or_iterate_selector" value="iterate" />
                 <param name="inputB" value="intersect-B.bed" ftype="bed" />
             </conditional>
             <param name="overlap_mode" value="-wao" />
@@ -253,7 +258,7 @@
         <test>
             <param name="inputA" value="intersect-A.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="iterate" />
+                <param name="reduce_or_iterate_selector" value="iterate" />
                 <param name="inputB" value="intersect-B.bed" ftype="bed" />
             </conditional>
             <param name="once" value="-u" />
@@ -262,7 +267,7 @@
         <test>
             <param name="inputA" value="intersect-A.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="iterate" />
+                <param name="reduce_or_iterate_selector" value="iterate" />
                 <param name="inputB" value="intersect-B.bed" ftype="bed" />
             </conditional>
             <param name="count" value="-c"/>
@@ -271,7 +276,7 @@
         <test>
             <param name="inputA" value="intersect-A.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="iterate" />
+                <param name="reduce_or_iterate_selector" value="iterate" />
                 <param name="inputB" value="intersect-B.bed" ftype="bed" />
             </conditional>
             <param name="invert" value="-v"/>
@@ -280,12 +285,12 @@
         <test>
             <param name="inputA" value="intersect-A2.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="iterate" />
+                <param name="reduce_or_iterate_selector" value="iterate" />
                 <param name="inputB" value="intersect-B2.bed" ftype="bed" />
             </conditional>
             <param name="overlap_mode" value="-wa,-wb" />
             <conditional name="fraction_cond">
-                <param name='fraction_select' value='specify'/>
+                <param name="fraction_select" value="specify"/>
                 <param name="overlap" value="0.5" />
             </conditional>
             <output name="output" file="intersect-fracA.bed" ftype="bed" />
@@ -293,12 +298,12 @@
         <test>
             <param name="inputA" value="intersect-A2.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="iterate" />
+                <param name="reduce_or_iterate_selector" value="iterate" />
                 <param name="inputB" value="intersect-B2.bed" ftype="bed" />
             </conditional>
             <param name="overlap_mode" value="-wa,-wb" />
             <conditional name="fraction_cond">
-                <param name='fraction_select' value='specify'/>
+                <param name="fraction_select" value="specify"/>
                 <param name="overlap" value="0.5" />
                 <conditional name="reciprocal_cond">
                     <param name="reciprocal" value="-r" />
@@ -309,12 +314,12 @@
         <test>
             <param name="inputA" value="intersect-A2.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="iterate" />
+                <param name="reduce_or_iterate_selector" value="iterate" />
                 <param name="inputB" value="intersect-B2.bed" ftype="bed" />
             </conditional>
             <param name="overlap_mode" value="-wa,-wb" />
             <conditional name="fraction_cond">
-                <param name='fraction_select' value='specify'/>
+                <param name="fraction_select" value="specify"/>
                 <param name="overlap" value="0.5" />
                 <conditional name="reciprocal_cond">
                     <param name="overlapB" value="0.5" />
@@ -325,12 +330,12 @@
         <test>
             <param name="inputA" value="intersect-A2.bed" ftype="bed" />
             <conditional name="reduce_or_iterate">
-                <param name='reduce_or_iterate_selector' value="iterate" />
+                <param name="reduce_or_iterate_selector" value="iterate" />
                 <param name="inputB" value="intersect-B2.bed" ftype="bed" />
             </conditional>
             <param name="overlap_mode" value="-wa,-wb" />
             <conditional name="fraction_cond">
-                <param name='fraction_select' value='specify'/>
+                <param name="fraction_select" value="specify"/>
                 <param name="overlap" value="0.5" />
                 <conditional name="reciprocal_cond">
                     <param name="overlapB" value="0.5" />
@@ -362,8 +367,7 @@
             <output name="output" file="intersectBed_result3.bed" ftype="bed" />
         </test>
     </tests>
-    <help>
-<![CDATA[
+    <help><![CDATA[
 **What it does**
 
 By far, the most common question asked of two sets of genomic features is whether or not any of the features in the two sets “overlap” with one another. This is known as feature intersection. bedtools intersect allows one to screen for overlaps between two sets of genomic features. Moreover, it allows one to have fine control as to how the intersections are reported. bedtools intersect works with both @STD_BEDTOOLS_INPUT_LABEL@ and BAM files as input.
@@ -379,7 +383,6 @@
 Note that a BAM alignment will be sent to the output file **once** even if it overlaps more than one interval in the BED file.
 
 @REFERENCES@
-]]>
-    </help>
+    ]]></help>
     <expand macro="citations" />
 </tool>