diff closestBed.xml @ 1:82aac94b06c3 draft

Uploaded
author iuc
date Thu, 08 Jan 2015 14:25:51 -0500
parents b8348686a0b9
children 607c0576c6ab
line wrap: on
line diff
--- a/closestBed.xml	Tue Nov 04 01:45:04 2014 -0500
+++ b/closestBed.xml	Thu Jan 08 14:25:51 2015 -0500
@@ -6,37 +6,138 @@
     <expand macro="requirements" />
     <expand macro="stdio" />
     <command>
+<![CDATA[
+        #set inputBs = ' '.join( [ str( $file ) for $file in $inputB ] )
+
         closestBed
         $strand
         $addition
+        #if $addition2.addition2_select:
+            -D $addition2.addition2_select
+            $addition2.iu
+            $addition2.id
+        #end if
+        $io
+        -mdb $mdb
         -t $ties
         -a $inputA
-        -b $inputB
-        &gt; $output
+        -b $inputBs
+        > $output
+]]>
     </command>
     <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="overlap intervals in this BED/VCF/GFF file?"/>
+        <param format="bed,gff,vcf,gff3" name="inputB" type="data" multiple="True" label="overlap intervals in this BED/VCF/GFF file?"/>
 
-        <param name="ties" type="select" label="How ties for closest feature should be handled" help="This occurs when two features in B have exactly the same overlap with a feature in A.">
+        <param name="ties" type="select"
+            label="How ties for closest feature should be handled"
+            help="This occurs when two features in B have exactly the same overlap with a feature in A.">
             <option value="all" selected="True">all - Report all ties (default)</option>
             <option value="first">first - Report the first tie that occurred in the B file</option>
             <option value="last">last - Report the last tie that occurred in the B file</option>
         </param>
 
-        <param name="strand" type="boolean" checked="false" truevalue="-s" falsevalue="" label="Force strandedness" help="That is, find the closest feature in B overlaps A on the same strand. By default, this is disabled" />
-        <param name="addition" type="boolean" checked="false" truevalue="-d" falsevalue="" label="In addition to the closest feature in B, report its distance to A as an extra column. The reported distance for overlapping features will be 0" />
+        <expand macro="strand2" />
+
+        <param name="addition" type="boolean" checked="false" truevalue="-d" falsevalue=""
+            label="In addition to the closest feature in B, report its distance to A as an extra column" 
+            help="The reported distance for overlapping features will be 0. (-d)" />
+
+        <conditional name="addition2">
+            <param name="addition2_select" type="select" optional="True"
+                label="Add additional columns to report distance to upstream feature. Distance defintion" 
+                help="Like -d, report the closest feature in B, and its distance to A as an extra column. However unlike -d, use negative distances to report upstream features. (-D)">
+                <option value="" selected="True">Do not report the distance et all.</option>
+                <option value="ref">Report distance with respect to the reference genome. B features with a lower (start, stop) are upstream. (-ref)</option>
+                <option value="a">Report distance with respect to A. When A is on the - strand, "upstream" means B has a higher (start,stop). (-a)</option>
+                <option value="b">Report distance with respect to B. When B is on the - strand, "upstream" means A has a higher (start,stop). (-b)</option>
+            </param>
+            <when value="ref">
+                <param name="iu" type="boolean" checked="false" truevalue="-iu" falsevalue=""
+                    label="Ignore features in B that are upstream of features in A" 
+                    help="This option requires -D and follows its orientation rules for determining what is 'upstream'. (-iu)" />
+
+                <param name="id" type="boolean" checked="false" truevalue="-id" falsevalue=""
+                    label="Ignore features in B that are downstream of features in A" 
+                    help="This option requires -D and follows its orientation rules for determining what is 'downstream'. (-id)" />
+            </when>
+            <when value="a">
+                <param name="iu" type="boolean" checked="false" truevalue="-iu" falsevalue=""
+                    label="Ignore features in B that are upstream of features in A" 
+                    help="This option requires -D and follows its orientation rules for determining what is 'upstream'. (-iu)" />
+
+                <param name="id" type="boolean" checked="false" truevalue="-id" falsevalue=""
+                    label="Ignore features in B that are downstream of features in A" 
+                    help="This option requires -D and follows its orientation rules for determining what is 'downstream'. (-id)" />
+            </when>
+            <when value="b">
+                <param name="iu" type="boolean" checked="false" truevalue="-iu" falsevalue=""
+                    label="Ignore features in B that are upstream of features in A" 
+                    help="This option requires -D and follows its orientation rules for determining what is 'upstream'. (-iu)" />
+
+                <param name="id" type="boolean" checked="false" truevalue="-id" falsevalue=""
+                    label="Ignore features in B that are downstream of features in A" 
+                    help="This option requires -D and follows its orientation rules for determining what is 'downstream'. (-id)" />
+            </when>
+        </conditional>
+
+        <param name="io" type="boolean" checked="false" truevalue="-io" falsevalue=""
+            label="Ignore features in B that overlap A" 
+            help="That is, we want close, yet not touching features only. (-io)" />
+
+        <param name="mdb" type="select" optional="True"
+            label="How multiple databases are resolved" 
+            help="(-mdb)">
+            <option value="each" selected="True">Report closest records for each database. (-each)</option>
+            <option value="all">Report closest records among all databases. (-all)</option>
+        </param>
     </inputs>
     <outputs>
-        <data format_source="inputA" name="output" metadata_source="inputA" label="Intersection of ${inputA.name} and ${inputB.name}"/>
+        <data format_source="inputA" name="output" metadata_source="inputA" label="Clostest region of ${inputA} in ${inputB}"/>
     </outputs>
+    <tests>
+        <test>
+            <param name="inputA" value="closestBedA.bed" ftype="bed" />
+            <param name="inputB" value="closestBedB.bed" ftype="bed" />
+            <output name="output" file="closestBed_result1.bed" ftype="bed" />
+        </test>
+        <test>
+            <param name="inputA" value="closestBed_a.bed" ftype="bed" />
+            <param name="inputB" value="closestBed_b1.bed,closestBed_b2.bed" ftype="bed" />
+            <param name="addition" value="True" />
+            <output name="output" file="closestBed_result2.bed" ftype="bed" />
+        </test>
+        <test>
+            <param name="inputA" value="closestBed_a.bed" ftype="bed" />
+            <param name="inputB" value="closestBed_b1.bed,closestBed_b2.bed" ftype="bed" />
+            <param name="addition" value="True" />
+            <param name="mdb" value="all" />
+            <output name="output" file="closestBed_result3.bed" ftype="bed" />
+        </test>
+        <test>
+            <param name="inputA" value="closestBed_c.bed" ftype="bed" />
+            <param name="inputB" value="closestBed_d.bed" ftype="bed" />
+            <param name="addition2_select" value="ref" />
+            <output name="output" file="closestBed_result4.bed" ftype="bed" />
+        </test>
+        <test>
+            <param name="inputA" value="closestBed_c.bed" ftype="bed" />
+            <param name="inputB" value="closestBed_d.bed" ftype="bed" />
+            <param name="addition2_select" value="a" />
+            <output name="output" file="closestBed_result5.bed" ftype="bed" />
+        </test>
+    </tests>
     <help>
-
+<![CDATA[
 **What it does**
 
 Similar to intersectBed, closestBed searches for overlapping features in A and B. In the event that no feature in B overlaps the current feature in A, closestBed will report the closest (that is, least genomic distance from the start or end of A) feature in B. For example, one might want to find which is the closest gene to a significant GWAS polymorphism. Note that closestBed will report an overlapping feature as the closest—that is, it does not restrict to closest non-overlapping feature.
 
+.. image:: $PATH_TO_IMAGES/closest-glyph.png
+
+
 @REFERENCES@
+]]>
     </help>
     <expand macro="citations" />
 </tool>