changeset 2:457b09031d57 draft

Uploaded
author iuc
date Tue, 19 May 2015 07:05:36 -0400
parents 82aac94b06c3
children 2cd7e321d259
files genomeCoverageBed.xml macros.xml mapBed.xml mergeBed.xml randomBed.xml test-data/mergedBed_result5.bed test-data/randomBed_result1.bed
diffstat 7 files changed, 78 insertions(+), 101 deletions(-) [+]
line wrap: on
line diff
--- a/genomeCoverageBed.xml	Thu Jan 08 14:25:51 2015 -0500
+++ b/genomeCoverageBed.xml	Tue May 19 07:05:36 2015 -0400
@@ -19,14 +19,14 @@
         $strand
 
         #if str($report.report_select) == "bg":
-            #if $zero_regions.value:
-                $zero_regions
+            #if $report.zero_regions:
+                $report.zero_regions
             #else:
                 -bg
             #end if
 
-            #if str($scale):
-              -scale $scale
+            #if str($report.scale):
+              -scale $report.scale
             #end if
         #else:
             #if str($report.max):
--- a/macros.xml	Thu Jan 08 14:25:51 2015 -0500
+++ b/macros.xml	Tue May 19 07:05:36 2015 -0400
@@ -4,7 +4,6 @@
             <requirement type="package" version="2.22">bedtools</requirement>
             <yield/>
         </requirements>
-        <version_command>bedtools --version</version_command>
     </xml>
     <token name="@WRAPPER_VERSION@">2.22</token>
     <xml name="stdio">
@@ -16,6 +15,7 @@
             <regex match="Error:" />
             <regex match="Exception:" />
         </stdio>
+        <version_command>bedtools --version</version_command>
     </xml>
     <xml name="reciprocal">
         <param name="reciprocal" type="boolean" checked="false" truevalue="-r" falsevalue=""
@@ -45,8 +45,8 @@
         </conditional>
     </xml>
     <xml name="split">
-        <param name="split" type="boolean" checked="false" truevalue="-split" falsevalue="" 
-            label="Treat split/spliced BAM or BED12 entries as distinct BED intervals when computing coverage." 
+        <param name="split" type="boolean" checked="false" truevalue="-split" falsevalue=""
+            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">
@@ -81,14 +81,42 @@
     <!-- ToDo column_picker -->
     <xml name="choose_columns">
         <param name="cols" type="text" value=""
-            label="Specify the column(s) (comma separated) that should be summarized"
-            help="(-c)">
+            label="Specify the column(s) that should be summarized"
+            help="comma separated (-c)">
             <sanitizer invalid_char="">
                 <valid initial="string.digits"><add value=","/></valid>
             </sanitizer>
         </param>
     </xml>
 
+    <xml name="choose_column">
+        <param name="col" type="data_column" data_ref="input" label="Specify the column(s) that should be summarized" help="(-c)" />
+    </xml>
+
+    <token name="@C_AND_O_ARGUMENT@">
+        #set $col = list()
+        #set $op = list()
+        #for $item in $c_and_o_argument_repeat:
+            #silent $col.append( str($item.col) )
+            #silent $op.append( str($item.operation) )
+        #end for
+        #if $col:
+            -c #echo ','.join($col)#
+            -o #echo ','.join($op)#
+        #end if
+    </token>
+
+    <xml name="c_and_o_argument">
+        <repeat name="c_and_o_argument_repeat" title="Applying operations to columns from merged intervals" min="0">
+            <expand macro="choose_column" />
+            <expand macro="choose_operations">
+                <expand macro="math_options" />
+                <expand macro="additional_math_options" />
+            </expand>
+        </repeat>
+    </xml>
+
+
     <xml name="choose_operations">
         <param name="operation" type="select" label="Specify the operation">
             <yield />
--- a/mapBed.xml	Thu Jan 08 14:25:51 2015 -0500
+++ b/mapBed.xml	Tue May 19 07:05:36 2015 -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></description>
     <macros>
         <import>macros.xml</import>
@@ -11,8 +11,7 @@
         -a "${inputA}"
         -b "${inputB}"
         $strand
-        -o $operation
-        -c "${cols}"
+        @C_AND_O_ARGUMENT@
         -f $overlap
         $reciprocal
         $split
@@ -26,16 +25,12 @@
     <inputs>
         <param format="bam,bed,vcf,gff,gff3" name="inputA" type="data" label="File A (BAM/BED/VCF/GFF)" />
         <param format="bam,bed,gff,vcf,gff3" name="inputB" type="data" label="File B (BAM/BED/VCF/GFF)" />
-        <expand macro="choose_columns" /> 
         <expand macro="overlap" />
         <param name="reciprocal" type="boolean" checked="false" truevalue="-r" falsevalue="" 
             label="Require reciprocal overlap"
             help="If set, the overlap between the BAM alignment and the BED interval must affect the above fraction of both the alignment and the BED interval. (-r)" />
         <expand macro="strand2" />
-        <expand macro="choose_operations">
-            <expand macro="math_options" />
-            <expand macro="additional_math_options" />
-        </expand>
+        <expand macro="c_and_o_argument" />
         <expand macro="split" />
         <expand macro="print_header" />
         <conditional name="genome">
@@ -53,30 +48,38 @@
         <test>
             <param name="inputA" value="mapBed1.bed" ftype="bed" />
             <param name="inputB" value="mapBed2.bed" ftype="bed" />
-            <param name="cols" value="5" />
-            <param name="operation" value="mean" />
+            <repeat name="c_and_o_argument_repeat">
+                <param name="cols" value="5" />
+                <param name="operation" value="mean" />
+            </repeat>
             <output name="output" file="mapBed_result1.bed" ftype="bed" />
         </test>
         <test>
             <param name="inputA" value="mapBed1.bed" ftype="bed" />
             <param name="inputB" value="mapBed2.bed" ftype="bed" />
-            <param name="cols" value="5" />
-            <param name="operation" value="collapse" />
+            <repeat name="c_and_o_argument_repeat">
+                <param name="col" value="5" />
+                <param name="operation" value="collapse" />
+            </repeat>
             <output name="output" file="mapBed_result2.bed" ftype="bed" />
         </test>
         <test>
             <param name="inputA" value="mapBed1.bed" ftype="bed" />
             <param name="inputB" value="mapBed2.bed" ftype="bed" />
-            <param name="cols" value="5" />
-            <param name="operation" value="collapse" />
+            <repeat name="c_and_o_argument_repeat">
+                <param name="cols" value="5" />
+                <param name="operation" value="collapse" />
+            </repeat>
             <param name="strand" value="-S" />
             <output name="output" file="mapBed_result3.bed" ftype="bed" />
         </test>
         <test>
             <param name="inputA" value="mapBed1.bed" ftype="bed" />
             <param name="inputB" value="mapBed2.bed" ftype="bed" />
-            <param name="cols" value="5" />
-            <param name="operation" value="collapse" />
+            <repeat name="c_and_o_argument_repeat">
+                <param name="cols" value="5" />
+                <param name="operation" value="collapse" />
+            </repeat>
             <param name="strand" value="-s" />
             <output name="output" file="mapBed_result4.bed" ftype="bed" />
         </test>
--- a/mergeBed.xml	Thu Jan 08 14:25:51 2015 -0500
+++ b/mergeBed.xml	Tue May 19 07:05:36 2015 -0400
@@ -1,4 +1,4 @@
-<tool id="bedtools_mergebed" name="Merge BED files" version="@WRAPPER_VERSION@.0">
+<tool id="bedtools_mergebed" name="Merge BED files" version="@WRAPPER_VERSION@.1">
     <description>(mergeBed)</description>
     <macros>
         <import>macros.xml</import>
@@ -12,6 +12,7 @@
             $strand
             -d $distance
             $header
+            @C_AND_O_ARGUMENT@
             > "${output}"
 ]]>
     </command>
@@ -27,11 +28,7 @@
             label="Maximum distance between features allowed for features to be merged"
             help="That is, overlapping and/or book-ended features are merged. (-d)"/>
         <expand macro="print_header" />
-        <expand macro="choose_columns" />
-        <expand macro="choose_operations">
-            <expand macro="math_options" />
-            <expand macro="additional_math_options" />
-        </expand>
+        <expand macro="c_and_o_argument" />
     </inputs>
     <outputs>
         <data format="bed" name="output" metadata_source="input" label="Merged ${input.name}"/>
@@ -56,6 +53,15 @@
             <param name="distance" value="1000" />
             <output name="output" file="mergedBed_result4.bed" ftype="bed" />
         </test>
+        <test>
+            <param name="input" value="mergedBed4.bed" ftype="bed" />
+            <param name="distance" value="1000" />
+            <repeat name="c_and_o_argument_repeat">
+                <param name="col" value="1"/>
+                <param name="operation" value="count"/>
+            </repeat>
+            <output name="output" file="mergedBed_result5.bed" ftype="bed" />
+        </test>
     </tests>
     <help>
 <![CDATA[
@@ -92,7 +98,7 @@
 
 
 ==========================================================================
-*-s* Enforcing "strandedness" 
+*-s* Enforcing "strandedness"
 ==========================================================================
 The ``-s`` option will only merge intervals that are overlapping/bookended
 *and* are on the same strand.
@@ -112,26 +118,6 @@
 
 
 ==========================================================================
-*-n* Reporting the number of features that were merged 
-==========================================================================
-The -n option will report the number of features that were combined from the 
-original file in order to make the newly merged feature. If a feature in the 
-original file was not merged with any other features, a "1" is reported.
-
-::
-
-  $ cat A.bed
-  chr1  100  200
-  chr1  180  250
-  chr1  250  500
-  chr1  501  1000
-  
-  $ bedtools merge -i A.bed -n
-  chr1  100  500  3
-  chr1  501  1000 1
-
-
-==========================================================================
 *-d* Controlling how close two features must be in order to merge 
 ==========================================================================
 By default, only overlapping or book-ended features are combined into a new 
@@ -154,48 +140,6 @@
   chr1  100  200  1000
 
 
-=============================================================
-*-nms* Reporting the names of the features that were merged
-=============================================================
-Occasionally, one might like to know that names of the features that were 
-merged into a new feature. The ``-nms`` option will add an extra column to the 
-``merge`` output which lists (separated by semicolons) the names of the
-merged features.
-
-::
-
-  $ cat A.bed
-  chr1  100  200  A1
-  chr1  150  300  A2
-  chr1  250  500  A3
- 
-  $ bedtools merge -i A.bed -nms
-  chr1  100  500  A1,A2,A3
-  
-
-===============================================================
-*-scores* Reporting the scores of the features that were merged
-===============================================================
-Similarly, we might like to know that scores of the features that were 
-merged into a new feature. Enter the ``-scores`` option.  One can specify 
-how the scores from each overlapping interval should be reported.
-
-::
-
-  $ cat A.bed
-  chr1  100  200  A1 1
-  chr1  150  300  A2 2
-  chr1  250  500  A3 3
- 
-  $ bedtools merge -i A.bed -scores mean
-  chr1  100  500  2
-  
-  $ bedtools merge -i A.bed -scores max
-  chr1  100  500  3
-
-  $ bedtools merge -i A.bed -scores collapse
-  chr1  100  500  1,2,3
-
 @REFERENCES@
 ]]>
     </help>
--- a/randomBed.xml	Thu Jan 08 14:25:51 2015 -0500
+++ b/randomBed.xml	Tue May 19 07:05:36 2015 -0400
@@ -11,7 +11,7 @@
         -g $genome
         -l $length
         -n $intervals
-        #if $seed.seed_choose:
+        #if str($seed.seed_choose) == "True":
             -seed $seed.seed
         #end if
         > "$output"
@@ -29,11 +29,15 @@
     <tests>
         <test>
             <param name="genome" value="mm9_chr1.len" />
-            <param name="seed_choose" value="True" />
-            <param name="seed" value="1" />
+            <param name="seed_choose" value="False" />
             <param name="length" value="5" />
             <param name="intervals" value="3" />
-            <output name="output" file="randomBed_result1.bed" ftype="bed" />
+            <output name="output">
+                <assert_contents>
+                    <has_text_matching expression="chr1" />
+                    <has_n_columns n="6" />
+                </assert_contents>
+            </output>
         </test>
     </tests>
     <help>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/mergedBed_result5.bed	Tue May 19 07:05:36 2015 -0400
@@ -0,0 +1,1 @@
+chr1	100	1000	2
--- a/test-data/randomBed_result1.bed	Thu Jan 08 14:25:51 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-chr1	115594142	115594147	1	5	+
-chr1	167415497	167415502	2	5	-
-chr1	191692404	191692409	3	5	-