diff samtools_stats.xml @ 8:e28839a4b932 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/samtools_stats commit 0f75269223c0821c6c82acf98fde947d0f816f2b"
author iuc
date Tue, 28 Sep 2021 16:17:39 +0000
parents 145f6d74ff5e
children 1cc79f49b8d5
line wrap: on
line diff
--- a/samtools_stats.xml	Thu Oct 17 02:21:23 2019 -0400
+++ b/samtools_stats.xml	Tue Sep 28 16:17:39 2021 +0000
@@ -1,4 +1,4 @@
-<tool id="samtools_stats" name="Samtools stats" version="2.0.2+galaxy2">
+<tool id="samtools_stats" name="Samtools stats" version="2.0.3" profile="@PROFILE@">
     <description>generate statistics for BAM dataset</description>
     <macros>
         <import>macros.xml</import>
@@ -16,16 +16,12 @@
             #end if
             ${remove_dups}
             #if str( $filter_by_flags.filter_flags ) == "filter":
-                #if $filter_by_flags.require_flags:
-                    #set $filter = $filter_by_flags.require_flags
-                    @FLAGS@
-                    --required-flag $flags
-                #end if
-                #if $filter_by_flags.exclude_flags:
-                    #set $filter = $filter_by_flags.exclude_flags
-                    @FLAGS@
-                    --filtering-flag $flags
-                #end if
+                #set $filter = $filter_by_flags.require_flags
+                @FLAGS@
+                --required-flag $flags
+                #set $filter = $filter_by_flags.exclude_flags
+                @FLAGS@
+                --filtering-flag $flags
             #end if
             #if str($gc_depth):
                 --GC-depth ${gc_depth}
@@ -33,12 +29,9 @@
             #if str($insert_size):
                 --insert-size ${insert_size}
             #end if
-            ## The code below is commented out because using -I/--id options causes 
-            ## in samtools up to 1.9 the following exception
-            ## Samtools-htslib: init_group_id() header parsing not yet implemented
-            ##if str($read_group) != "":
-            ##    -I "${read_group}"
-            ##end if
+            ## #if $read_group
+            ##    -I '$read_group'
+            ## #end if
             #if str($read_length):
                 --read-length ${read_length}
             #end if
@@ -63,7 +56,7 @@
             #if str($cov_threshold):
                 -g $cov_threshold
             #end if
-            -@ \$addthreads 
+            -@ \$addthreads
             infile
             @REGIONS_MANUAL@
             > '$output'
@@ -139,40 +132,19 @@
         <!-- TODO I would like to set the default values of float and int parameters as on the samtools stats help page, but then the tests don't work. Hence I leave the optional and give the defaults in the help -->
         <param name="gc_depth" argument="--GC-depth" type="float" optional="True" label="Size of GC-depth bins" help="Decreasing bin size increases memory requirement. default=2e4" />
         <param name="insert_size" argument="--insert-size" type="integer" optional="True" label="Maximum insert size" help="default=8000" />
-        <!--
-            The -I option of samtools stats returns the following message up to version 1.9:
-            Samtools-htslib: init_group_id() header parsing not yet implemented
-            Because of this the section below is commented out until this stats bug is fixed
-            <param name="read_group" type="select" optional="true" label="Limit to a specific read group name" >
-                <options>
-                    <filter type="data_meta" ref="input" key="read_groups" />
-                </options>
-            </param>
-        -->
+        <!-- TOOD https://github.com/samtools/samtools/issues/1489 -->    
+        <param name="read_group" argument="--id" type="select" optional="true" label="Limit to a specific read group name" >
+            <options>
+                <filter type="data_meta" ref="input" key="read_groups" />
+            </options>
+        </param>
         <param name="read_length" argument="--read-length" type="integer" optional="true" label="Minimum read length to generate statistics for" help="No cutoff if left empty" />
         <param name="most_inserts" argument="--most-inserts" type="float" optional="true" label="Report only the main part of inserts" help="default=0.99" />
         <param name="trim_quality" argument="--trim-quality" type="integer" optional="true" label="BWA trim parameter" help="default=0" />
 
-        <conditional name="addref_cond">
-            <param name="addref_select" type="select" label="Use a reference sequence" help="Required for GC-depth and mismatches-per-cycle calculation">
-                <option value="no">No</option>
-                <option value="cached">Locally cached</option>
-                <option value="history">History</option>
-            </param>
-            <when value="no"/>
-            <when value="cached">
-                <param name="ref" type="select" label="Using genome">
-                    <options from_data_table="fasta_indexes">
-                        <filter type="data_meta" ref="input" key="dbkey" column="dbkey" />
-                    </options>
-                </param>
-            </when>
-            <when value="history">
-                <param name="ref" type="data" format="fasta" label="Using file" />
-            </when>
-        </conditional>
+        <expand macro="optional_reference" argument="--ref-seq" help="Required for GC-depth and mismatches-per-cycle calculation"/>
         <!-- unfortunately -t takes tabular and not bed like view (otherwise a macro might have simplified this) -->
-        
+
         <expand macro="regions_macro"/>
 
         <param name="sparse" argument="-x/--sparse" type="boolean" truevalue="-x" falsevalue="" checked="False" label="Suppress absence of insertions" help="Suppress outputting IS rows where there are no insertions."/>
@@ -198,7 +170,7 @@
                 <param name="addref_select" value="history" />
                 <param name="ref" value="test.fa" ftype="fasta" />
             </conditional>
-            <output name="output" file="1.stats.expected" ftype="tabular" lines_diff="3" />
+            <output name="output" file="1.stats.expected" ftype="tabular" lines_diff="2" />
         </test>
         <!-- test_cmd($opts,out=>'stat/1.stats.expected',cmd=>"$$opts{bin}/samtools stats -r $$opts{path}/stat/test.fa $$opts{path}/stat/1_map_cigar.sam | tail -n+4", exp_fix=>$efix);-->
         <test>
@@ -207,7 +179,7 @@
                 <param name="addref_select" value="history" />
                 <param name="ref" value="test.fa" ftype="fasta" />
             </conditional>
-            <output name="output" file="2.stats.expected" ftype="tabular" lines_diff="3" />
+            <output name="output" file="2.stats.expected" ftype="tabular" lines_diff="2" />
         </test>
         <!-- test_cmd($opts,out=>'stat/2.stats.expected',cmd=>"$$opts{bin}/samtools stats -r $$opts{path}/stat/test.fa $$opts{path}/stat/2_equal_cigar_full_seq.sam | tail -n+4", exp_fix=>$efix);-->
         <!-- test_cmd($opts,out=>'stat/3.stats.expected',cmd=>"$$opts{bin}/samtools stats -r $$opts{path}/stat/test.fa $$opts{path}/stat/3_map_cigar_equal_seq.sam | tail -n+4", exp_fix=>$efix);-->
@@ -220,7 +192,7 @@
                 <param name="addref_select" value="history" />
                 <param name="ref" value="test.fa" ftype="fasta" />
             </conditional>
-            <output name="output" file="6.stats.expected" ftype="tabular" lines_diff="3" />
+            <output name="output" file="6.stats.expected" ftype="tabular" lines_diff="2" />
         </test>
         <!-- test_cmd($opts,out=>'stat/6.stats.expected',cmd=>"$$opts{bin}/samtools stats -r $$opts{path}/stat/test.fa -i 0 $$opts{path}/stat/5_insert_cigar.sam | tail -n+4", exp_fix=>$efix); -->
         <!-- test_cmd($opts,out=>'stat/7.stats.expected',cmd=>"$$opts{bin}/samtools stats -r $$opts{path}/stat/test.fa $$opts{path}/stat/7_supp.sam | tail -n+4", exp_fix=>$efix); -->
@@ -236,7 +208,7 @@
                 <param name="select_region" value="tab"/>
                 <param name="targetregions" value="11.stats.targets" ftype="tabular" />
             </conditional>
-            <output name="output" file="11.stats.expected" ftype="tabular" lines_diff="3" />
+            <output name="output" file="11.stats.expected" ftype="tabular" lines_diff="4" />
         </test>
         <!-- test_cmd($opts,out=>'stat/11.stats.expected',cmd=>"$$opts{bin}/samtools stats -t $$opts{path}/stat/11.stats.targets $$opts{path}/stat/11_target.sam | tail -n+4", exp_fix=>$efix); -->
 
@@ -251,7 +223,7 @@
                 <param name="regions_repeat_1|region" value="ref1:30-46"/>
                 <param name="regions_repeat_2|region" value="ref1:39-56"/>
             </conditional>
-            <output name="output" file="11.stats.expected" ftype="tabular" lines_diff="3" />
+            <output name="output" file="11.stats.expected" ftype="tabular" lines_diff="2" />
         </test>
         <!-- test_cmd($opts,out=>'stat/11.stats.expected',cmd=>"$$opts{bin}/samtools stats $$opts{path}/stat/11_target.bam ref1:10-24 ref1:30-46 ref1:39-56 | tail -n+4", exp_fix=>$efix);
 -->
@@ -265,7 +237,7 @@
                 <param name="targetregions" value="11.stats.targets" ftype="tabular" />
             </conditional>
             <param name="cov_threshold" value="4" />
-            <output name="output" file="11.stats.g4.expected" ftype="tabular" lines_diff="3" />
+            <output name="output" file="11.stats.g4.expected" ftype="tabular" lines_diff="4" />
         </test>
         <!-- test_cmd($opts,out=>'stat/11.stats.g4.expected',cmd=>"$$opts{bin}/samtools stats -g 4 -t $$opts{path}/stat/11.stats.targets $$opts{path}/stat/11_target.sam | tail -n+4", exp_fix=>$efix);-->
         <test>
@@ -280,7 +252,7 @@
                 <param name="regions_repeat_2|region" value="ref1:39-56"/>
             </conditional>
             <param name="cov_threshold" value="4" />
-            <output name="output" file="11.stats.g4.expected" ftype="tabular" lines_diff="3" />
+            <output name="output" file="11.stats.g4.expected" ftype="tabular" lines_diff="2" />
         </test>
         <!-- test_cmd($opts,out=>'stat/11.stats.g4.expected',cmd=>"$$opts{bin}/samtools stats -g 4 $$opts{path}/stat/11_target.bam ref1:10-24 ref1:30-46 ref1:39-56 | tail -n+4", exp_fix=>$efix); -->
         <test>
@@ -292,7 +264,7 @@
                 <param name="select_region" value="tab"/>
                 <param name="targetregions" value="12_3reads.bed" ftype="tabular" />
             </conditional>
-            <output name="output" file="12.3reads.overlap.expected" ftype="tabular" lines_diff="3" />
+            <output name="output" file="12.3reads.overlap.expected" ftype="tabular" lines_diff="4" />
         </test>
         <!-- test_cmd($opts,out=>'stat/12.3reads.overlap.expected',cmd=>"$$opts{bin}/samtools stats $$opts{path}/stat/12_overlaps.bam -t $$opts{path}/stat/12_3reads.bed | tail -n+4", exp_fix=>$efix);-->
         <test>
@@ -305,7 +277,7 @@
                 <param name="targetregions" value="12_3reads.bed" ftype="tabular" />
             </conditional>
             <param name="remove_overlaps" value="-p"/>
-            <output name="output" file="12.3reads.nooverlap.expected" ftype="tabular" lines_diff="3" />
+            <output name="output" file="12.3reads.nooverlap.expected" ftype="tabular" lines_diff="4" />
         </test>
         <!-- test_cmd($opts,out=>'stat/12.3reads.nooverlap.expected',cmd=>"$$opts{bin}/samtools stats $$opts{path}/stat/12_overlaps.bam -p -t $$opts{path}/stat/12_3reads.bed | tail -n+4", exp_fix=>$efix);-->
         <test>
@@ -317,7 +289,7 @@
                 <param name="select_region" value="tab"/>
                 <param name="targetregions" value="12_2reads.bed" ftype="tabular" />
             </conditional>
-            <output name="output" file="12.2reads.overlap.expected" ftype="tabular" lines_diff="3" />
+            <output name="output" file="12.2reads.overlap.expected" ftype="tabular" lines_diff="4" />
         </test>
         <!-- test_cmd($opts,out=>'stat/12.2reads.overlap.expected',cmd=>"$$opts{bin}/samtools stats $$opts{path}/stat/12_overlaps.bam -t $$opts{path}/stat/12_2reads.bed | tail -n+4", exp_fix=>$efix);-->
         <test>
@@ -330,7 +302,7 @@
                 <param name="targetregions" value="12_2reads.bed" ftype="tabular" />
             </conditional>
             <param name="remove_overlaps" value="-p"/>
-            <output name="output" file="12.2reads.nooverlap.expected" ftype="tabular" lines_diff="3" />
+            <output name="output" file="12.2reads.nooverlap.expected" ftype="tabular" lines_diff="4" />
         </test>
         <!-- test_cmd($opts,out=>'stat/12.2reads.nooverlap.expected',cmd=>"$$opts{bin}/samtools stats $$opts{path}/stat/12_overlaps.bam -p -t $$opts{path}/stat/12_2reads.bed | tail -n+4", exp_fix=>$efix);-->
         <test>
@@ -357,6 +329,18 @@
                 <element name="Summary Numbers" ftype="tabular" file="samtools_stats_out1__sn.tab" />
             </output_collection>
         </test>
+        <!-- test filtering by read group -->
+        <!-- <test>
+            <param name="input" value="11_target.sam" ftype="sam" />
+            <conditional name="addref_cond">
+                <param name="addref_select" value="no" />
+            </conditional>
+            <param name="read_group" value="grp1" />
+            <output name="output" file="11.stats.read_groups.expected" ftype="tabular" lines_diff="2" />
+            <assert_command>
+                <has_text text="-I 'grp1'"/>
+            </assert_command>
+        </test> -->
     </tests>
     <help><![CDATA[
 **What it does**
@@ -367,4 +351,3 @@
     ]]></help>
     <expand macro="citations"/>
 </tool>
-