diff samtools_view.xml @ 15:6be888be75f9 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/samtools_view commit cd62639660bef041ba14ecff337fb98e84e75d8a
author iuc
date Mon, 20 Nov 2023 22:17:43 +0000
parents 5826298f6a73
children 2dce91e11ca7
line wrap: on
line diff
--- a/samtools_view.xml	Mon Aug 15 09:19:43 2022 +0000
+++ b/samtools_view.xml	Mon Nov 20 22:17:43 2023 +0000
@@ -1,4 +1,4 @@
-<tool id="samtools_view" name="Samtools view" version="@TOOL_VERSION@+galaxy0" profile="@PROFILE@">
+<tool id="samtools_view" name="Samtools view" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
     <description>- reformat, filter, or subsample SAM, BAM or CRAM</description>
     <macros>
         <import>macros.xml</import>
@@ -154,11 +154,11 @@
                         ## not dealing with all of the reads in the indexed
                         ## file. We have to do an extra pass over the input to
                         ## count the reads to subsample.
-                        sample_fragment=`samtools view -c $std_filters infile $reg_filters | awk '{s=\$1} END {frac=s/${mode.subsample_config.subsampling_mode.target}; printf("%.8f\n", frac > 1 ? $seed+1/frac : ".0")}'` &&
+                        sample_fragment=`samtools view -c $std_filters infile $reg_filters | awk '{s=\$1} END {fac=s/${mode.subsample_config.subsampling_mode.target}; printf("%.8f\n", fac > 1 ? 1/fac : 1)}'` &&
                     #else:
                         ## We can get the count of reads to subsample using
                         ## an inexpensive call to idxstats.
-                        sample_fragment=`samtools idxstats infile | awk '{s+=\$4+\$3} END {frac=s/${mode.subsample_config.subsampling_mode.target}; printf("%.8f\n", frac > 1 ? $seed+1/frac : ".0")}'` &&
+                        sample_fragment=`samtools idxstats infile | awk '{s+=\$4+\$3} END {fac=s/${mode.subsample_config.subsampling_mode.target}; printf("%.8f\n", fac > 1 ? 1/fac : 1)}'` &&
                     #end if
                 #end if
             #end if
@@ -172,12 +172,13 @@
             $std_filters
 
             #if $with_subsampling:
+                --subsample-seed $seed
                 #if str($mode.subsample_config.subsampling_mode.select_subsample) == "target":
                     ##this is calculated at execution time before the main samtools command
-                    -s \${sample_fragment}
+                    --subsample \${sample_fragment}
                 #else:
-                    #set $fraction = $seed + 1 / float($mode.subsample_config.subsampling_mode.factor)
-                    -s $fraction
+                    #set $fraction = 1 / float($mode.subsample_config.subsampling_mode.factor)
+                    --subsample $fraction
                 #end if
             #end if
 
@@ -398,13 +399,13 @@
         </data>
     </outputs>
     <tests>
-<!-- 1) sam to bam (copied from the sam_to_bam tool) -->
-        <test>
+        <!-- 1) sam to bam (copied from the sam_to_bam tool) -->
+        <test expect_num_outputs="1">
             <param name="input" ftype="sam" value="in_test_1.sam" />
             <output name="outputsam" ftype="bam" file="test_1.bam" lines_diff="4" />
         </test>
         <!-- 2) -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" ftype="sam" dbkey="equCab2" value="in_test_1.sam" />
             <conditional name="addref_cond">
                 <param name="addref_select" value="cached" />
@@ -413,7 +414,7 @@
             <output name="outputsam" ftype="bam" file="test_2.bam" lines_diff="4" />
         </test>
         <!-- 3) -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" ftype="sam" value="in_test_3.sam" />
             <conditional name="addref_cond">
                 <param name="addref_select" value="history" />
@@ -422,7 +423,7 @@
             <output name="outputsam" ftype="bam" file="test_3.bam" lines_diff="4" />
         </test>
         <!-- 4) cram to bam -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" value="in_test_4.cram" ftype="cram" />
             <conditional name="addref_cond">
                 <param name="addref_select" value="history" />
@@ -431,7 +432,7 @@
             <output name="outputsam" file="test_4.bam" ftype="bam" lines_diff="4" />
         </test>
         <!-- 5) within bam operations expected to result in sorting or not -->
-        <test >
+        <test expect_num_outputs="1">
             <!-- sorted bam should always result in unmodifed output -->
             <param name="input" ftype="bam" value="in_test_5.bam" />
             <assert_command>
@@ -440,7 +441,7 @@
             <output name="outputsam" ftype="bam" file="test_5.bam" lines_diff="2"/>
         </test>
         <!-- 6) -->
-        <test>
+        <test expect_num_outputs="1">
             <!-- sorted bam should always result in unmodifed output -->
             <param name="input" ftype="bam" value="in_test_5.bam" />
             <conditional name="mode">
@@ -456,7 +457,7 @@
             <output name="outputsam" ftype="bam" file="test_5.bam" lines_diff="2"/>
         </test>
         <!-- 7) -->
-        <test>
+        <test expect_num_outputs="1">
             <!-- qname_sorted.bam should get sorted during "conversion" to bam ... -->
             <param name="input" ftype="qname_sorted.bam" value="in_test_7.bam" />
             <assert_command>
@@ -465,7 +466,7 @@
             <output name="outputsam" ftype="bam" file="test_7.bam" lines_diff="4" />
         </test>
         <!-- 8) -->
-        <test>
+        <test expect_num_outputs="1">
             <!-- ... but should be emitted unmodifed when using input format -->
             <param name="input" ftype="qname_sorted.bam" value="in_test_7.bam" />
             <conditional name="mode">
@@ -481,7 +482,7 @@
             <output name="outputsam" ftype="qname_sorted.bam" file="test_8.bam" lines_diff="2"/>
         </test>
         <!-- 9) -->
-        <test>
+        <test expect_num_outputs="1">
             <!-- unsorted.bam should get sorted during "conversion" to bam ... -->
             <param name="input" ftype="unsorted.bam" value="in_test_7.bam" />
             <assert_command>
@@ -490,7 +491,7 @@
             <output name="outputsam" ftype="bam" file="test_7.bam" lines_diff="4" />
         </test>
         <!-- 10) -->
-        <test>
+        <test expect_num_outputs="1">
             <!-- ... ... but should be emitted unmodifed when using input format -->
             <param name="input" ftype="unsorted.bam" value="in_test_7.bam" />
             <conditional name="mode">
@@ -506,7 +507,7 @@
             <output name="outputsam" ftype="unsorted.bam" file="test_8.bam" lines_diff="2" />
         </test>
         <!-- 11) bam to sam + header options (adapted from bam_to_sam tool)-->
-        <test>
+        <test expect_num_outputs="1">
             <param ftype="bam" name="input" value="in_test_11.bam" />
             <conditional name="mode">
                 <conditional name="output_options">
@@ -519,7 +520,7 @@
             <output file="test_11.sam" ftype="sam" name="outputsam" lines_diff="2" />
         </test>
         <!-- 12) -->
-        <test>
+        <test expect_num_outputs="1">
             <param ftype="bam" name="input" value="in_test_11.bam" />
             <conditional name="mode">
                 <param name="outtype" value="header" />
@@ -532,7 +533,7 @@
             <output file="test_12.sam" ftype="sam" name="outputsam" lines_diff="2" />
         </test>
         <!-- 13) -->
-        <test>
+        <test expect_num_outputs="1">
             <param ftype="bam" name="input" value="in_test_11.bam" />
             <conditional name="mode">
                 <conditional name="output_options">
@@ -545,7 +546,7 @@
             <output file="test_13.sam" ftype="sam" name="outputsam" lines_diff="2" />
         </test>
         <!-- 14) count alignments -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" value="in_test_14.bam" ftype="bam" />
             <conditional name="mode">
                 <param name="outtype" value="all_reads" />
@@ -556,7 +557,7 @@
             <output name="outputcnt" file="test_14.tab" ftype="tabular" lines_diff="2" />
         </test>
         <!-- 15) region filters -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" value="in_test_15.sam" ftype="sam" />
             <conditional name="mode">
                 <param name="outtype" value="selected_reads" />
@@ -578,7 +579,7 @@
             <output name="outputsam" file="test_15.cram" ftype="cram" compare="sim_size" delta="250" />
         </test>
         <!-- 16) -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" value="in_test_14.bam" ftype="bam" />
             <conditional name="mode">
                 <param name="outtype" value="selected_reads" />
@@ -600,7 +601,7 @@
             <output name="outputsam" file="test_15.cram" ftype="cram" compare="sim_size" delta="250" />
         </test>
         <!-- 17) -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" value="in_test_17.cram" dbkey="equCab2" ftype="cram" />
             <conditional name="mode">
                 <param name="outtype" value="selected_reads" />
@@ -622,7 +623,7 @@
             <output name="outputsam" file="test_17.bam" ftype="bam" lines_diff="4" />
         </test>
         <!-- 18) -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" value="in_test_14.bam" ftype="bam" />
             <conditional name="mode">
                 <param name="outtype" value="selected_reads" />
@@ -645,7 +646,7 @@
             <output name="outputsam" file="test_15.cram" ftype="cram" compare="sim_size" delta="250" />
         </test>
         <!-- 19) -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" value="test_15.cram" ftype="cram" />
             <conditional name="mode">
                 <param name="outtype" value="selected_reads" />
@@ -668,7 +669,7 @@
             <output name="outputsam" file="test_19.bam" ftype="bam" lines_diff="4"/>
         </test>
         <!-- 20) -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" value="test_15.cram" ftype="cram" />
             <conditional name="mode">
                 <param name="outtype" value="selected_reads" />
@@ -691,7 +692,7 @@
             <output name="outputsam" file="test_20.bam" ftype="bam" lines_diff="4" />
         </test>
         <!-- 21) sampling options target < total reads -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" value="in_test_15.sam" ftype="sam" />
             <conditional name="mode">
                 <param name="outtype" value="selected_reads" />
@@ -710,7 +711,7 @@
             <output name="outputsam" file="test_21.sam" ftype="sam" compare="diff" lines_diff="10" />
         </test>
         <!-- 22) target > total reads -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" value="in_test_15.sam" ftype="sam" />
             <conditional name="mode">
                 <param name="outtype" value="selected_reads" />
@@ -729,7 +730,7 @@
             <output name="outputsam" file="test_22.sam" ftype="sam" lines_diff="2"/>
         </test>
         <!-- 23) -->
-        <test>
+        <test expect_num_outputs="1">
             <!-- subsampling SAM input without reads -->
             <param name="input" value="in_test_23.sam" ftype="sam" />
             <conditional name="mode">
@@ -749,7 +750,7 @@
             <output name="outputsam" file="test_23.sam" ftype="sam" lines_diff="2"/>
         </test>
         <!-- 24) -->
-        <test>
+        <test expect_num_outputs="1">
             <!-- subsampling BAM input without reads -->
             <param name="input" value="in_test_24.bam" ftype="bam" />
             <conditional name="mode">
@@ -769,7 +770,7 @@
             <output name="outputsam" file="test_24.bam" ftype="bam" lines_diff="2" />
         </test>
         <!-- 25) -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" value="in_test_15.sam" ftype="sam" />
             <conditional name="mode">
                 <param name="outtype" value="selected_reads" />
@@ -789,7 +790,7 @@
             <output name="outputsam" file="test_25.sam" ftype="sam" compare="diff" lines_diff="2" />
         </test>
         <!-- 26) -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" value="in_test_14.bam" ftype="bam" />
             <conditional name="mode">
                 <param name="outtype" value="selected_reads" />
@@ -809,7 +810,7 @@
             <output name="outputsam" file="test_26.bam" ftype="bam" lines_diff="2" />
         </test>
         <!-- 27) -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" value="in_test_14.bam" ftype="bam" />
             <conditional name="mode">
                 <param name="outtype" value="selected_reads" />
@@ -829,7 +830,7 @@
             <output name="outputsam" file="test_27.bam" ftype="bam" lines_diff="2"/>
         </test>
         <!-- 28) -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" value="in_test_14.bam" ftype="bam" />
             <conditional name="mode">
                 <param name="outtype" value="selected_reads" />
@@ -849,7 +850,7 @@
             <output name="outputsam" file="test_28.bam" ftype="bam" lines_diff="2" />
         </test>
         <!-- 29) -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" value="in_test_14.bam" ftype="bam" />
             <conditional name="mode">
                 <param name="outtype" value="selected_reads" />
@@ -870,7 +871,7 @@
             <output name="outputsam" file="test_29.bam" ftype="bam" lines_diff="2"/>
         </test>
         <!-- 30) testing tag filtering -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" value="in_test_30.bam" ftype="bam" />
             <conditional name="mode">
                 <param name="outtype" value="selected_reads" />
@@ -889,7 +890,7 @@
             <output name="outputsam" file="test_30.bam" ftype="bam" lines_diff="2" />
         </test>
         <!-- 31) testing readname filtering -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="input" value="in_test_30.bam" ftype="bam" />
             <conditional name="mode">
                 <param name="outtype" value="selected_reads" />