diff macros.xml @ 3:b91e0f76afe9 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/samtools_view commit b3426aed6615742d96dfb8f7346a9e0d4e391a99-dirty
author iuc
date Sun, 14 Oct 2018 13:56:29 -0400
parents 02afb5ea2fce
children b01db2684fa5
line wrap: on
line diff
--- a/macros.xml	Thu Sep 27 08:51:16 2018 -0400
+++ b/macros.xml	Sun Oct 14 13:56:29 2018 -0400
@@ -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">