changeset 4:46c6639921f1 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/samtools_bedcov commit 0f75269223c0821c6c82acf98fde947d0f816f2b"
author iuc
date Tue, 28 Sep 2021 16:11:43 +0000
parents 9149ad20699a
children 6856f8a01905
files macros.xml samtools_bedcov.xml test-data/samtools_bedcov_out7.tab test-data/samtools_depth_out5.tab test-data/samtools_depth_out6.tab
diffstat 5 files changed, 128 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/macros.xml	Mon Jul 29 08:47:23 2019 -0400
+++ b/macros.xml	Tue Sep 28 16:11:43 2021 +0000
@@ -5,10 +5,16 @@
             <yield/>
         </requirements>
     </xml>
-    <token name="@TOOL_VERSION@">1.9</token>
-    <token name="@FLAGS@">#set $flags = sum(map(int, str($filter).split(',')))</token>
+    <token name="@TOOL_VERSION@">1.13</token>
+    <token name="@PROFILE@">20.05</token>
+    <token name="@FLAGS@"><![CDATA[
+        #set $flags = 0
+        #if $filter
+            #set $flags = sum(map(int, str($filter).split(',')))
+        #end if
+    ]]></token>
     <token name="@PREPARE_IDX@"><![CDATA[
-        ##prepare input and indices 
+        ##prepare input and indices
         ln -s '$input' infile &&
         #if $input.is_of_type('bam'):
             #if str( $input.metadata.bam_index ) != "None":
@@ -25,7 +31,7 @@
         #end if
     ]]></token>
     <token name="@PREPARE_IDX_MULTIPLE@"><![CDATA[
-        ##prepare input and indices 
+        ##prepare input and indices
         #for $i, $bam in enumerate( $input_bams ):
             ln -s '$bam' '${i}' &&
             #if $bam.is_of_type('bam'):
@@ -63,6 +69,51 @@
             #set reffai=None
         #end if
     ]]></token>
+
+    <xml name="optional_reference">
+        <conditional name="addref_cond">
+            <param name="addref_select" type="select" label="Use a reference sequence">
+                <help>@HELP@</help>
+                <option value="no">No</option>
+                <option value="history">Use a genome/index from the history</option>
+                <option value="cached">Use a built-in genome</option>
+            </param>
+            <when value="no"/>
+            <when value="history">
+                <param name="ref" argument="@ARGUMENT@" type="data" format="fasta,fasta.gz" label="Reference"/>
+            </when>
+            <when value="cached">
+                <param name="ref" argument="@ARGUMENT@" type="select" label="Reference">
+                    <options from_data_table="fasta_indexes">
+                        <filter type="data_meta" ref="input" key="dbkey" column="dbkey"/>
+                    </options>
+                    <validator  type="no_options" message="No reference genome is available for the build associated with the selected input dataset"/>
+                </param>
+            </when>
+        </conditional>
+    </xml>
+    <xml name="mandatory_reference" token_help="" token_argument="">
+        <conditional name="addref_cond">
+            <param name="addref_select" type="select" label="Use a reference sequence">
+                <help>@HELP@</help>
+                <option value="history">Use a genome/index from the history</option>
+                <option value="cached">Use a built-in genome</option>
+            </param>
+            <when value="history">
+                <param name="ref" argument="@ARGUMENT@" type="data" format="fasta,fasta.gz" label="Reference"/>
+            </when>
+            <when value="cached">
+                <param name="ref" argument="@ARGUMENT@" type="select" label="Reference">
+                    <options from_data_table="fasta_indexes">
+                        <filter type="data_meta" ref="input" key="dbkey" column="dbkey"/>
+                        <validator message="No reference genome is available for the build associated with the selected input dataset" type="no_options" />
+                    </options>
+                </param>
+            </when>
+        </conditional>
+    </xml>
+
+
     <token name="@ADDTHREADS@"><![CDATA[
         ##compute the number of ADDITIONAL threads to be used by samtools (-@)
         addthreads=\${GALAXY_SLOTS:-1} && (( addthreads-- )) &&
@@ -70,28 +121,28 @@
     <token name="@ADDMEMORY@"><![CDATA[
         ##compute the number of memory available to samtools sort (-m)
         ##use only 75% of available: https://github.com/samtools/samtools/issues/831
-        addmemory=\${GALAXY_MEMORY_MB_PER_SLOT:-768} && 
+        addmemory=\${GALAXY_MEMORY_MB_PER_SLOT:-768} &&
         ((addmemory=addmemory*75/100)) &&
     ]]></token>
     <xml name="seed_input">
-       <param name="seed" type="integer" optional="True" label="Seed for random number generator" help="If empty a random seed is used." /> 
+       <param name="seed" type="integer" optional="True" label="Seed for random number generator" help="If empty a random seed is used." />
     </xml>
-    <xml name="flag_options">
-        <option value="1">read is paired</option>
-        <option value="2">read is mapped in a proper pair</option>
-        <option value="4">read is unmapped</option>
-        <option value="8">mate is unmapped</option>
-        <option value="16">read reverse strand</option>
-        <option value="32">mate reverse strand</option>
-        <option value="64">read is the first in a pair</option>
-        <option value="128">read is the second in a pair</option>
-        <option value="256">alignment or read is not primary</option>
-        <option value="512">read fails platform/vendor quality checks</option>
-        <option value="1024">read is a PCR or optical duplicate</option>
-        <option value="2048">supplementary alignment</option>
+    <xml name="flag_options" token_s1="false" token_s2="false" token_s4="false" token_s8="false" token_s16="false" token_s32="false" token_s64="false" token_s128="false" token_s256="false" token_s512="false" token_s1024="false" token_s2048="false">
+        <option value="1" selected="@S1@">Read is paired</option>
+        <option value="2" selected="@S2@">Read is mapped in a proper pair</option>
+        <option value="4" selected="@S4@">Read is unmapped</option>
+        <option value="8" selected="@S8@">Mate is unmapped</option>
+        <option value="16" selected="@S16@">Read is mapped to the reverse strand of the reference</option>
+        <option value="32" selected="@S32@">Mate is mapped to the reverse strand of the reference</option>
+        <option value="64" selected="@S64@">Read is the first in a pair</option>
+        <option value="128" selected="@S128@">Read is the second in a pair</option>
+        <option value="256" selected="@S256@">Alignment of the read is not primary</option>
+        <option value="512" selected="@S512@">Read fails platform/vendor quality checks</option>
+        <option value="1024" selected="@S1024@">Read is a PCR or optical duplicate</option>
+        <option value="2048" selected="@S2048@">Alignment is supplementary</option>
     </xml>
 
-    <!-- region specification macros and tokens for tools that allow the specification 
+    <!-- region specification macros and tokens for tools that allow the specification
          of region by bed file / space separated list of regions -->
     <token name="@REGIONS_FILE@"><![CDATA[
         #if $cond_region.select_region == 'tab':
--- a/samtools_bedcov.xml	Mon Jul 29 08:47:23 2019 -0400
+++ b/samtools_bedcov.xml	Tue Sep 28 16:11:43 2021 +0000
@@ -1,4 +1,4 @@
-<tool id="samtools_bedcov" name="BedCov" version="2.0.2">
+<tool id="samtools_bedcov" name="Samtools bedcov" version="2.0.3" profile="@PROFILE@">
     <description>calculate read depth for a set of genomic intervals</description>
     <macros>
         <import>macros.xml</import>
@@ -14,44 +14,89 @@
                 -Q $mapq
             #end if
             $countdel
+            #set $filter = $additional_options.required_flags
+            @FLAGS@
+            -g $flags
+            #set $filter = $additional_options.skipped_flags
+            @FLAGS@
+            -G $flags
+            #if $depth_thresh:
+                -d $depth_thresh
+            #end if
             '${input_bed}'
-            #for $i in range(len( $input_bams )):
+            #for $i in range(len($input_bams)):
                 '${i}'
             #end for
             > '${output}'
     ]]></command>
     <inputs>
-        <param name="input_bed" type="data" format="bed" label="Genemic intervals (in BED format)" />
+        <param name="input_bed" type="data" format="bed" label="Genetic intervals (in BED format)" />
         <param name="input_bams" type="data" format="bam" multiple="true" label="BAM file(s)" />
         <param name="mapq" argument="-Q" type="integer" value="" optional="true" label="Minimum MAPQ" help="Only count reads with mapping quality greater than this value" />
         <param name="countdel" argument="-j" type="boolean" checked="false" truevalue="-j" falsevalue="" label="Exclude deletions and ref skips" help=" Do not include deletions (D) and ref skips (N) in bedcov computation" />
+        <param name="depth_thresh" argument="-d" type="integer" value="" min="0" optional="true" label="Depth threshold" help="Number of reference bases with coverage above and including this value will be displayed in a separate column." />
+
+        <section name="additional_options" title="Additional Filter Options">
+            <param name="required_flags" argument="-g" type="select" multiple="True" label="Require that these flags are set.">
+                <expand macro="flag_options" />
+            </param>
+
+            <param name="skipped_flags" argument="-G" type="select" multiple="True" label="Exclude reads with any of the following flags set (the default set is UNMAP,SECONDARY,QCFAIL,DUP or 0x704).">
+                <expand macro="flag_options" s4="true" s256="true" s512="true" s1024="true"/>
+            </param>
+        </section>
     </inputs>
     <outputs>
         <data name="output" format="tabular" label="${tool.name} on ${on_string}" />
     </outputs>
     <tests>
+        <!-- 1) -->
         <test>
             <param name="input_bed" value="eboVir3.1.bed" ftype="bed" />
             <param name="input_bams" value="eboVir3.bam" ftype="bam" />
             <output name="output" file="samtools_bedcov_out1.tab" />
         </test>
+        <!-- 2) -->
         <test>
             <param name="input_bed" value="eboVir3.1.bed" ftype="bed" />
             <param name="input_bams" value="eboVir3.bam,eboVir3.2.bam" ftype="bam" />
             <output name="output" file="samtools_bedcov_out2.tab" />
         </test>
+        <!-- 3) -->
         <test>
             <param name="input_bed" value="eboVir3.1.bed" ftype="bed" />
             <param name="input_bams" value="eboVir3.bam" ftype="bam" />
             <param name="mapq" value="40"/>
             <output name="output" file="samtools_bedcov_out1.tab" />
         </test>
+        <!-- 4) -->
         <test>
             <param name="input_bed" value="eboVir3.1.bed" ftype="bed" />
             <param name="input_bams" value="eboVir3.bam,eboVir3.2.bam" ftype="bam" />
             <param name="countdel" value="-j" />
             <output name="output" file="samtools_bedcov_out2.tab" />
         </test>
+        <!-- 5) Testing argument -g -->
+        <test>
+            <param name="input_bed" value="eboVir3.1.bed" ftype="bed" />
+            <param name="input_bams" value="eboVir3.bam" ftype="bam" />
+            <param name="required_flags" value="2,16,64" />
+            <output name="output" file="samtools_depth_out5.tab" />
+        </test>
+        <!-- 6) Testing argument -G -->
+        <test>
+            <param name="input_bed" value="eboVir3.1.bed" ftype="bed" />
+            <param name="input_bams" value="eboVir3.bam" ftype="bam" />
+            <param name="skipped_flags" value="2,16,64" />
+            <output name="output" file="samtools_depth_out6.tab" />
+        </test>
+        <!-- 7) Testing depth threshold -d -->
+        <test>
+            <param name="input_bed" value="eboVir3.1.bed" ftype="bed" />
+            <param name="input_bams" value="eboVir3.bam" ftype="bam" />
+            <param name="depth_thresh" value="10" />
+            <output name="output" file="samtools_bedcov_out7.tab" />
+        </test>
     </tests>
     <help>
 **What it does**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/samtools_bedcov_out7.tab	Tue Sep 28 16:11:43 2021 +0000
@@ -0,0 +1,3 @@
+eboVir3	500	1500	7919	229
+eboVir3	1500	2000	3009	9
+eboVir3	1500	3000	9986	122
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/samtools_depth_out5.tab	Tue Sep 28 16:11:43 2021 +0000
@@ -0,0 +1,3 @@
+eboVir3	500	1500	7919
+eboVir3	1500	2000	3009
+eboVir3	1500	3000	9986
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/samtools_depth_out6.tab	Tue Sep 28 16:11:43 2021 +0000
@@ -0,0 +1,3 @@
+eboVir3	500	1500	1884
+eboVir3	1500	2000	803
+eboVir3	1500	3000	2693