diff awk.xml @ 24:c41d78ae5fee draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 4dd118c84ed4d6157303e71438c24446ec4b4f31
author bgruening
date Wed, 04 Jun 2025 15:12:29 +0000
parents 3dc70b59608c
children
line wrap: on
line diff
--- a/awk.xml	Tue Mar 25 14:34:17 2025 +0000
+++ b/awk.xml	Wed Jun 04 15:12:29 2025 +0000
@@ -15,6 +15,9 @@
             --sandbox
             -v FS='	'
             -v OFS='	'
+            #for $i, $r in enumerate($variables, start=1)
+                -v VAR$i='$r.value'
+            #end for
             --re-interval
             -f '$awk_script'
             '$infile'
@@ -33,17 +36,38 @@
                 </valid>
             </sanitizer>
         </param>
+        <repeat name="variables" min="0" default="0" title="Variables">
+            <param name="value" type="text" label="Value">
+                <validator type="regex">[a-zA-Z0-9 .]+</validator>
+            </param>
+        </repeat>
     </inputs>
     <outputs>
         <data name="outfile" format_source="infile" metadata_source="infile"/>
     </outputs>
     <tests>
         <test>
-            <param name="infile" value="awk1.txt" />
+            <param name="infile" value="awk1.txt"/>
             <!-- commas are not allowed in a value field. Values with comma will be splitted -->
             <param name="code" value='$2>0.5 { print $2*9"\t"$1 }' />
             <output name="outfile" file="awk_results1.txt" />
         </test>
+        <test>
+            <param name="infile" value="awk1.txt"/>
+            <!-- commas are not allowed in a value field. Values with comma will be splitted -->
+            <param name="code" value='$2>VAR2 { print VAR1"\t"$2*9"\t"$1 }' />
+            <repeat name="variables">
+                <param name="value" value="xyz"/>
+            </repeat>
+            <repeat name="variables">
+                <param name="value" value="0.1"/>
+            </repeat>
+            <output name="outfile">
+                <assert_contents>
+                    <has_line_matching expression="^xyz.*" n="6"/>
+                </assert_contents>
+            </output>
+        </test>
     </tests>
     <help>
 <![CDATA[
@@ -74,6 +98,11 @@
 
     pattern { action 1; action 2; action 3; }
 
+**Variables**
+
+In order to allow parametrization in workflows, the tool allows to specify values for variables that can be used in AWK program.
+that will be named **VAR1**, **VAR2**, ...
+
 
 **Pattern Examples**