changeset 3:097c44aaf6d4 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/samtools_view commit 640b53919bfc0ae4b895451218e919a52ac14b9d
author iuc
date Tue, 20 Nov 2018 06:19:49 -0500
parents 80d8ca44f8da
children 2ec9fb20bb27
files macros.xml samtools_view.xml test-data/test_counts.tab
diffstat 3 files changed, 48 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/macros.xml	Thu Sep 27 08:49:45 2018 -0400
+++ b/macros.xml	Tue Nov 20 06:19:49 2018 -0500
@@ -53,11 +53,11 @@
         #if $addref_cond.addref_select == "history":
             ln -s '${addref_cond.ref}' reference.fa &&
             samtools faidx reference.fa &&
-            #set reffa=str($addref_cond.ref)
+            #set reffa="reference.fa"
             #set reffai="reference.fa.fai"
         #elif $addref_cond.addref_select == "cached":
             #set reffa=str($addref_cond.ref.fields.path)
-            #set reffai=str($addref_cond.ref.fields.path)
+            #set reffai=str($addref_cond.ref.fields.path)+".fai"
         #else
             #set reffa=None
             #set reffai=None
@@ -67,7 +67,6 @@
         ##compute the number of ADDITIONAL threads to be used by samtools (-@)
         addthreads=\${GALAXY_SLOTS:-1} && (( addthreads-- )) &&
     ]]></token>
-
     <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
@@ -91,6 +90,42 @@
         <option value="1024">read is a PCR or optical duplicate</option>
         <option value="2048">supplementary alignment</option>
     </xml>
+
+    <!-- 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':
+            -t '$cond_region.targetregions'
+        #end if
+    ]]></token>
+    <token name="@REGIONS_MANUAL@"><![CDATA[
+        #if $cond_region.select_region == 'text':
+            #for $i, $x in enumerate($cond_region.regions_repeat):
+               '${x.region}'
+            #end for
+        #end if
+    ]]></token>
+    <xml name="regions_macro">
+        <conditional name="cond_region">
+            <param name="select_region" type="select" label="Filter by regions" help="restricts output to only those alignments which overlap the specified region(s)">
+                <option value="no" selected="True">No</option>
+                <option value="text">Manualy specify regions</option>
+                <option value="tab">Regions from tabular file</option>
+            </param>
+            <when value="no"/>
+            <when value="text">
+                <repeat name="regions_repeat" min="1" default="1" title="Regions">
+                    <param name="region" type="text" label="region" help="format chr:from-to">
+                        <validator type="regex" message="Required format: CHR[:FROM[-TO]]; where CHR: string containing any character except quotes, whitespace and colon; FROM and TO: any integer">^[^\s'\":]+(:\d+(-\d+){0,1}){0,1}$</validator>
+                    </param>
+                </repeat>
+            </when>
+            <when value="tab">
+                <param name="targetregions" argument="-t/--target-regions" type="data" format="tabular" label="Target regions file" help="Do stats in these regions only. Tab-delimited file chr,from,to (1-based, inclusive)" />
+            </when>
+        </conditional>
+    </xml>
+
     <xml name="citations">
         <citations>
             <citation type="bibtex">
--- a/samtools_view.xml	Thu Sep 27 08:49:45 2018 -0400
+++ b/samtools_view.xml	Tue Nov 20 06:19:49 2018 -0500
@@ -41,7 +41,7 @@
         ## filter options (regions filter is the last parameter)
         #if $cond_filter.select_filter == 'yes':
             #if $cond_filter.cond_region.select_region == 'bed' and str( $cond_filter.cond_region.bedfile ) != 'None'
-                -L '$cond_filter.bedfile'
+                -L '$cond_filter.cond_region.bedfile'
             #end if
             #if $cond_filter.cond_rg.select_rg == 'text':
                 -r '$cond_filter.cond_rg.readgr'
@@ -263,7 +263,7 @@
                 <when input="outtype" value="cram" format="cram" />
             </change_format>
         </data>
-        <data name="outputcnt" format="txt" from_work_dir="sam" label="${tool.name} on ${on_string}: Counts">
+        <data name="outputcnt" format="txt" from_work_dir="outfile" label="${tool.name} on ${on_string}: Counts">
             <filter>outtype == 'count'</filter>
         </data>
     </outputs>
@@ -312,6 +312,12 @@
             </conditional>
             <output name="outputsam" file="test.cram" ftype="cram" compare="sim_size" delta="250" />
         </test>
+       <!-- count alignments -->
+       <test>
+            <param name="input" value="test.bam" ftype="bam" />
+            <param name="outtype" value="count" />
+            <output name="outputcnt" file="test_counts.tab" ftype="txt" />
+        </test>
         <test>
             <param name="input" value="test.sam" ftype="sam" />
             <param name="outtype" value="cram" />
@@ -425,7 +431,7 @@
                 <param name="seed" value="7" />
                 <param name="target" value="2" />
             </conditional>
-            <output name="outputsam" file="test_ds.sam" ftype="sam" compare="diff" lines_diff="4" />
+            <output name="outputsam" file="test_ds.sam" ftype="sam" compare="diff" lines_diff="6" />
         </test>
         <test>
             <param name="input" value="test.bam" ftype="bam" />
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test_counts.tab	Tue Nov 20 06:19:49 2018 -0500
@@ -0,0 +1,1 @@
+10