diff macros.xml @ 35:9845c649f41b draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cutadapt commit c37e2aeba811fd041c08f0e119a3cbe90bfa7418
author iuc
date Sun, 17 Dec 2023 18:52:25 +0000
parents 8c0175e03cee
children 64172f1c1202
line wrap: on
line diff
--- a/macros.xml	Fri May 19 21:42:14 2023 +0000
+++ b/macros.xml	Sun Dec 17 18:52:25 2023 +0000
@@ -1,7 +1,7 @@
 <macros>
-    <token name="@TOOL_VERSION@">4.4</token>
+    <token name="@TOOL_VERSION@">4.6</token>
     <token name="@VERSION_SUFFIX@">0</token>
-    <token name="@FASTQ_TYPES@">fastq.gz,fastq,fasta</token>
+    <token name="@FASTQ_TYPES@">fastq.bz2,fastq.gz,fastq,fasta.bz2,fasta.gz,fasta</token>
     <xml name="edam_ontology">
         <edam_topics>                                                                                  
             <edam_topic>topic_0632</edam_topic>
@@ -25,46 +25,41 @@
             <xref type='bio.tools'>cutadapt</xref>
         </xrefs>
     </xml>
+
+    <!-- parametrized token - you need to set `$ADAPTER_ARGUMENT` -->
+    <token name="@adapter_cli@">
+        #if $a.adapter_source.adapter_source_list == 'builtin':
+            $ADAPTER_ARGUMENT '${a.adapter_source.adapter.fields.name}'='${a.adapter_source.adapter}${a.single_noindels}'
+        #else if $a.adapter_source.adapter_source_list == 'file':
+            $ADAPTER_ARGUMENT file:'${a.adapter_source.adapter_file}${a.single_noindels}'
+        #else if str($a.adapter_source.adapter_name) != "":
+            $ADAPTER_ARGUMENT '${a.adapter_source.adapter_name}'='${a.adapter_source.adapter}${a.single_noindels}'
+        #else
+            $ADAPTER_ARGUMENT '${a.adapter_source.adapter}${a.single_noindels}'
+         #end if
+    </token>
+
      <token name="@read1_options@"><![CDATA[
 
         ## Read1 trimming
 
+        #set ADAPTER_ARGUMENT="-a"
         #for $a in $library.r1.adapters
-            #if $a.adapter_source.adapter_source_list == 'builtin':
-                -a '${a.adapter_source.adapter.fields.name}'='${a.adapter_source.adapter}${adapter_options.internal}${a.single_noindels}'
-            #else if $a.adapter_source.adapter_source_list == 'file':
-                -a file:'${a.adapter_source.adapter_file}${adapter_options.internal}${a.single_noindels}'
-            #else if str($a.adapter_source.adapter_name) != "":
-                -a '${a.adapter_source.adapter_name}'='${a.adapter_source.adapter}${adapter_options.internal}${a.single_noindels}'
-            #else
-                -a '${a.adapter_source.adapter}${adapter_options.internal}${a.single_noindels}'
-            #end if
+            @adapter_cli@
         #end for
-        #for $aa in $library.r1.anywhere_adapters
-            #if $aa.anywhere_adapter_source.anywhere_adapter_source_list == 'builtin':
-                -b '${aa.anywhere_adapter_source.anywhere_adapter.fields.name}'='${aa.anywhere_adapter_source.anywhere_adapter}${aa.single_noindels}'
-            #else if $aa.anywhere_adapter_source.anywhere_adapter_source_list == 'file':
-                -b file:'${aa.anywhere_adapter_source.anywhere_adapter_file}${aa.single_noindels}'
-            #else if str($aa.anywhere_adapter_source.anywhere_adapter_name) != "":
-                -b '${aa.anywhere_adapter_source.anywhere_adapter_name}'='${aa.anywhere_adapter_source.anywhere_adapter}${aa.single_noindels}'
-            #else
-                -b '${aa.anywhere_adapter_source.anywhere_adapter}${aa.single_noindels}'
-            #end if
+        
+        #set ADAPTER_ARGUMENT="-b"
+        #for $a in $library.r1.anywhere_adapters
+            @adapter_cli@
         #end for
-        #for $fa in $library.r1.front_adapters
-            #if $fa.front_adapter_source.front_adapter_source_list == 'builtin':
-                -g '${fa.front_adapter_source.front_adapter.fields.name}'='${adapter_options.internal}${fa.front_adapter_source.front_adapter}${fa.single_noindels}'
-            #else if $fa.front_adapter_source.front_adapter_source_list == 'file':
-                -g file:'${adapter_options.internal}${fa.front_adapter_source.front_adapter_file}${fa.single_noindels}'
-            #else if str($fa.front_adapter_source.front_adapter_name) != "":
-                -g '${fa.front_adapter_source.front_adapter_name}'='${adapter_options.internal}${fa.front_adapter_source.front_adapter}${fa.single_noindels}'
-            #else
-                -g '${adapter_options.internal}${fa.front_adapter_source.front_adapter}${fa.single_noindels}'
-            #end if
+        
+        #set ADAPTER_ARGUMENT="-g"
+        #for $a in $library.r1.front_adapters
+            @adapter_cli@
         #end for
 
-        #if str($library.r1.cut) != '0':
-            -u $library.r1.cut
+        #if str($cut) != '0':
+            -u $cut
         #end if
 
         ## Additional Outputs
@@ -94,38 +89,17 @@
 
         ## Read2 trimming
 
+        #set ADAPTER_ARGUMENT="-A"
         #for $a in $library.r2.adapters2
-            #if $a.adapter_source2.adapter_source_list2 == 'builtin':
-                -A '${a.adapter_source2.adapter2.fields.name}'='${a.adapter_source2.adapter2}${adapter_options.internal}${a.single_noindels}'
-            #else if $a.adapter_source2.adapter_source_list2 == 'file':
-                -A file:'${a.adapter_source2.adapter_file2}${adapter_options.internal}${a.single_noindels}'
-            #else if str($a.adapter_source2.adapter_name2) != "":
-                -A '${a.adapter_source2.adapter_name2}'='${a.adapter_source2.adapter2}${adapter_options.internal}${a.single_noindels}'
-            #else
-                -A '${a.adapter_source2.adapter2}${adapter_options.internal}${a.single_noindels}'
-            #end if
+            @adapter_cli@
         #end for
-        #for $aa in $library.r2.anywhere_adapters2
-            #if $aa.anywhere_adapter_source2.anywhere_adapter_source_list2 == 'builtin':
-                -B '${aa.anywhere_adapter_source2.anywhere_adapter2.fields.name}'='${aa.anywhere_adapter_source2.anywhere_adapter2}${aa.single_noindels}'
-            #else if $aa.anywhere_adapter_source2.anywhere_adapter_source_list2 == 'file':
-                -B file:'${aa.anywhere_adapter_source2.anywhere_adapter_file2}${aa.single_noindels}'
-            #else if str($aa.anywhere_adapter_source2.anywhere_adapter_name2) != "":
-                -B '${aa.anywhere_adapter_source2.anywhere_adapter_name2}'='${aa.anywhere_adapter_source2.anywhere_adapter2}${aa.single_noindels}'
-            #else
-                -B '${aa.anywhere_adapter_source2.anywhere_adapter2}'
-            #end if
+        #set ADAPTER_ARGUMENT="-B"
+        #for $a in $library.r2.anywhere_adapters2
+            @adapter_cli@
         #end for
-        #for $fa in $library.r2.front_adapters2
-            #if $fa.front_adapter_source2.front_adapter_source_list2 == 'builtin':
-                -G '${fa.front_adapter_source2.front_adapter2.fields.name}'='${adapter_options.internal}${fa.front_adapter_source2.front_adapter2}${fa.single_noindels}'
-            #else if $fa.front_adapter_source2.front_adapter_source_list2  == 'file':
-                -G file:'${adapter_options.internal}${fa.front_adapter_source2.front_adapter_file2}${fa.single_noindels}'
-            #else if str($fa.front_adapter_source2.front_adapter_name2) != "":
-                -G '${fa.front_adapter_source2.front_adapter_name2}'='${adapter_options.internal}${fa.front_adapter_source2.front_adapter2}${fa.single_noindels}'
-            #else
-                -G '${adapter_options.internal}${fa.front_adapter_source2.front_adapter2}${fa.single_noindels}'
-            #end if
+        #set ADAPTER_ARGUMENT="-G"
+        #for $a in $library.r2.front_adapters2
+            @adapter_cli@
         #end for
 
         #if str($library.r2.cut2) != '0':
@@ -182,97 +156,46 @@
             </sanitizer>
         </xml>
         
-        <xml name="adapter" token_name="" token_argument="" token_value="" token_label="">
-            <param name="@NAME@" argument="@ARGUMENT@" type="text" value="@VALUE@" label="@LABEL@">
-                <expand macro="adapter_sanitizer"/>
-            </param>
-        </xml>
-        
-        <xml name="adapter_select" token_name="" token_argument="" token_label="">
-            <param name="@NAME@" argument="@ARGUMENT@" type="select" label="@LABEL@">
-                <options from_data_table="adapters">
-                    <filter type="sort_by" column="1" />
-                </options>
-                <expand macro="adapter_sanitizer"/>
-            </param>
+        <xml name="adapter_conditional" tokens="adapter_type,argument">
+            <conditional name="adapter_source">
+                <param name="adapter_source_list" type="select" label="Source" >
+                    <option value="builtin" selected="true">Standard (select from the list below)</option>
+                    <option value="user">Enter custom sequence</option>
+                    <option value="file">File from history</option>
+                </param>
+                <when value="user">
+                    <param name="adapter_name" type="text" value="" optional="true" label="Custom @ADAPTER_TYPE@ adapter name" help="Optional if 'Multiple output' is selected in the Outputs selector'" />
+                    <param name="adapter" argument="@ARGUMENT@" type="text" value="AATTGGCC" label="Custom @ADAPTER_TYPE@ adapter sequence">
+                        <expand macro="adapter_sanitizer"/>
+                    </param>
+                </when>
+                <when value="builtin">
+                    <param name="adapter" argument="@ARGUMENT@" type="select" label="@ADAPTER_TYPE@ adapter">
+                        <options from_data_table="adapters">
+                            <filter type="sort_by" column="1" />
+                            </options>
+                        <expand macro="adapter_sanitizer"/>
+                    </param>
+                </when>
+                <when value="file">
+                    <param name="adapter_file" argument="@ARGUMENT@" format="fasta" type="data"  label="File containing @ADAPTER_TYPE@ adapters" help="Should be of datatype FASTA" />
+                </when>
+            </conditional>
+            <param name="single_noindels" type="boolean" truevalue=";noindels" falsevalue="" checked="false" label="Disallow indels for this adapter"/>
         </xml>
 
         <xml name="single_end_options" >
-
-            <section name="r1" title="Read 1 Options" expanded="True">
-
+            <section name="r1" title="Read 1 Options" expanded="true">
                 <repeat name="adapters" title="3' (End) Adapters" help="Sequence of an adapter ligated to the 3' end (paired data: of the first read). The adapter and subsequent bases are trimmed. If a '$' character is appended ('anchoring'), the adapter is only found if it is a suffix of the read. To search for a linked adapter, separate the 2 sequences with 3 dots (ADAPTER1...ADAPTER2), see Help below.">
-                    <conditional name="adapter_source">
-                        <param name="adapter_source_list" type="select" label="Source" >
-                            <option value="builtin" selected="True">Standard (select from the list below)</option>
-                            <option value="user">Enter custom sequence</option>
-                            <option value="file">File from history</option>
-                        </param>
-
-                        <when value="user">
-                            <param name="adapter_name" type="text" value="" optional="True" label="Enter custom 3' adapter name (Optional if Multiple output is 'No')" />
-                            <expand macro="adapter" name="adapter" argument="-a" type="text" value="AATTGGCC" label="Enter custom 3' adapter sequence" />
-                        </when>
-
-                        <when value="builtin">
-                            <expand macro="adapter_select" name="adapter" argument="-a" label="Choose 3' adapter"/>
-                        </when>
-
-                        <when value="file">
-                            <param name="adapter_file" argument="-a" format="fasta" type="data" help="Should be of datatype FASTA" label="Choose file containing 3' adapters" />
-                        </when>
-                    </conditional>
-                    <param name="single_noindels" type="boolean" truevalue=";noindels" falsevalue="" checked="false" label="Disallow indels for this adapter"/>
+                    <expand macro="adapter_conditional" argument="-a" adapter_type="3'"/>
                 </repeat>
-
                 <repeat name="front_adapters" title="5' (Front) Adapters" help="Sequence of an adapter ligated to the 5' end (paired data: of the first read). The adapter and any preceding bases are trimmed. Partial matches at the 5' end are allowed. If a '^' character is prepended ('anchoring'), the adapter is only found if it is a prefix of the read. To search for a linked adapter, separate the 2 sequences with 3 dots (ADAPTER1...ADAPTER2), see Help below.">
-                    <conditional name="front_adapter_source">
-                        <param name="front_adapter_source_list" type="select" label="Source">
-                            <option value="builtin" selected="True">Standard (select from the list below)</option>
-                            <option value="user">Enter custom sequence</option>
-                            <option value="file">File from history</option>
-                        </param>
-
-                        <when value="user">
-                            <param name="front_adapter_name" type="text" value="" optional="True" label="Enter custom 5' adapter name (Optional if Multiple output is 'No')" />
-                            <expand macro="adapter" name="front_adapter" argument="-g" value="AATTGGCC" label="Enter custom 5' adapter sequence" />
-                        </when>
-                        <when value="builtin">
-                            <expand macro="adapter_select" name="front_adapter" argument="-g" label="Choose 5' adapter"/>
-                        </when>
-                        <when value="file">
-                            <param name="front_adapter_file" argument="-g" format="fasta" type="data" help="Should be of datatype &quot;FASTA&quot;" label="Choose file containing 5' adapters" />
-                        </when>
-                    </conditional>
-                    <param name="single_noindels" type="boolean" truevalue=";noindels" falsevalue="" checked="false" label="Disallow indels for this adapter"/>
+                    <expand macro="adapter_conditional" argument="-g" adapter_type="5'"/>
                 </repeat>
-
                 <repeat name="anywhere_adapters" title="5' or 3' (Anywhere) Adapters" help="Sequence of an adapter that may be ligated to the 5' or 3' end (paired data: of the first read). Both types of matches as described under 3' und 5' Adapters are allowed. If the first base of the read is part of the match, the behavior is as with 5' Adapters, otherwise as with 3' Adapters. This option is mostly for rescuing failed library preparations - do not use if you know which end your adapter was ligated to!">
-                    <conditional name="anywhere_adapter_source">
-                        <param name="anywhere_adapter_source_list" type="select" label="Source">
-                            <option value="builtin" selected="True">Standard (select from the list below)</option>
-                            <option value="user">Enter custom sequence</option>
-                            <option value="file">File from history</option>
-                        </param>
-
-                        <when value="user">
-                            <param name="anywhere_adapter_name" type="text" value="" optional="True" label="Enter custom 5' or 3' adapter name (Optional if Multiple output is 'No')"  />
-                            <expand macro="adapter" name="anywhere_adapter" argument="-b" value="AATTGGCC" label="Enter custom 5' or 3' adapter sequence" />
-                        </when>
-                        <when value="builtin">
-                            <expand macro="adapter_select" name="anywhere_adapter" argument="-b" label="Choose 5' or 3' adapter"/>
-                        </when>
-                        <when value="file">
-                            <param name="anywhere_adapter_file" argument="-b" format="fasta" type="data" help="Should be of datatype &quot;FASTA&quot;" label="Choose file containing 3' or 5' adapters" />
-                        </when>
-                    </conditional>
-                    <param name="single_noindels" type="boolean" truevalue=";noindels" falsevalue="" checked="false" label="Disallow indels for this adapter"/>
+                    <expand macro="adapter_conditional" argument="-b" adapter_type="5' or 3'"/>
                 </repeat>
-
-                <param argument="--cut" type="integer" value="0" optional="True" label="Cut bases from reads before adapter trimming" help="Remove bases from each read (first read only if paired). If positive, remove bases from the beginning. If negative, remove bases from the end. This is applied *before* adapter trimming." />
-
             </section>
-
         </xml>
 
         <xml name="paired_end_options" >
@@ -281,84 +204,29 @@
             <expand macro="single_end_options" />
 
             <!-- Read 2 Options -->
-            <section name="r2" title="Read 2 Options" expanded="True">
-
+            <section name="r2" title="Read 2 Options" expanded="true">
                 <repeat name="adapters2" title="3' (End) Adapters" help="Sequence of an adapter ligated to the 3' end of the second read in each pair. The adapter and subsequent bases are trimmed. If a '$' character is appended ('anchoring'), the adapter is only found if it is a suffix of the read. To search for a linked adapter, separate the 2 sequences with 3 dots (ADAPTER1...ADAPTER2), see Help below.">
-                    <conditional name="adapter_source2">
-                        <param name="adapter_source_list2" type="select" label="Source" >
-                            <option value="builtin" selected="True">Standard (select from the list below)</option>
-                            <option value="user">Enter custom sequence</option>
-                            <option value="file">File from history</option>
-                        </param>
-
-                        <when value="user">
-                            <param name="adapter_name2" type="text" value="" optional="True" label="Enter custom 3' adapter name (Optional)" />
-                            <expand macro="adapter" name="adapter2" argument="-A" label="Enter custom 3' adapter sequence" value="AATTGGCC" />
-                        </when>
-
-                        <when value="builtin">
-                            <expand macro="adapter_select" name="adapter2" argument="-A" label="Choose 3' adapter"/>
-                        </when>
-                        <when value="file">
-                            <param name="adapter_file2" argument="-a" format="fasta" type="data" help="Should be of datatype &quot;FASTA&quot;" label="Choose file containing 3' adapters" />
-                        </when>
-                    </conditional>
-                    <param name="single_noindels" type="boolean" truevalue=";noindels" falsevalue="" checked="false" label="Disallow indels for this adapter"/>
+                    <expand macro="adapter_conditional" argument="-A" adapter_type="3'"/>
+                </repeat>
+                <repeat name="front_adapters2" title="5' (Front) Adapters" help="Sequence of an adapter ligated to the 5' end of the second read in each pair. The adapter and any preceding bases are trimmed. Partial matches at the 5' end are allowed. If a '^' character is prepended ('anchoring'), the adapter is only found if it is a prefix of the read. To search for a linked adapter, separate the 2 sequences with 3 dots (ADAPTER1...ADAPTER2), see Help below.">
+                    <expand macro="adapter_conditional" argument="-G" adapter_type="5'"/>
+                </repeat>
+                <repeat name="anywhere_adapters2" title="5' or 3' (Anywhere) Adapters" help="Sequence of an adapter that may be ligated to the 5' or 3' end of the second read in each pair. Both types of matches as described under under 3' und 5' Adapters are allowed. If the first base of the read is part of the match, the behavior is as with 5' Adapters, otherwise as with 3' Adapters. This option is mostly for rescuing failed library preparations - do not use if you know which end your adapter was ligated to!">
+                    <expand macro="adapter_conditional" argument="-B" adapter_type="5' or 3'"/>
                 </repeat>
 
-                <repeat name="front_adapters2" title="5' (Front) Adapters" help="Sequence of an adapter ligated to the 5' end of the second read in each pair. The adapter and any preceding bases are trimmed. Partial matches at the 5' end are allowed. If a '^' character is prepended ('anchoring'), the adapter is only found if it is a prefix of the read. To search for a linked adapter, separate the 2 sequences with 3 dots (ADAPTER1...ADAPTER2), see Help below.">
-                    <conditional name="front_adapter_source2">
-                        <param name="front_adapter_source_list2" type="select" label="Source">
-                            <option value="builtin" selected="True">Standard (select from the list below)</option>
-                            <option value="user">Enter custom sequence</option>
-                            <option value="file">File from history</option>
-                        </param>
-
-                        <when value="user">
-                            <param name="front_adapter_name2" type="text" value="" label="Enter custom 5' adapter name (Optional)" />
-                            <expand macro="adapter" name="front_adapter2" argument="-G" value="AATTGGCC" label="Enter custom 5' adapter sequence" />
-                        </when>
-                        <when value="builtin">
-                            <expand macro="adapter_select" name="front_adapter2" argument="-G" label="Choose 5' adapter"/>
-                        </when>
-                        <when value="file">
-                            <param name="front_adapter_file2" argument="-g" format="fasta" type="data" help="Should be of datatype &quot;FASTA&quot;" label="Choose file containing 5' adapters" />
-                        </when>
-                    </conditional>
-                    <param name="single_noindels" type="boolean" truevalue=";noindels" falsevalue="" checked="false" label="Disallow indels for this adapter"/>
-                </repeat>
-
-                <repeat name="anywhere_adapters2" title="5' or 3' (Anywhere) Adapters" help="Sequence of an adapter that may be ligated to the 5' or 3' end of the second read in each pair. Both types of matches as described under under 3' und 5' Adapters are allowed. If the first base of the read is part of the match, the behavior is as with 5' Adapters, otherwise as with 3' Adapters. This option is mostly for rescuing failed library preparations - do not use if you know which end your adapter was ligated to!">
-                    <conditional name="anywhere_adapter_source2">
-                        <param name="anywhere_adapter_source_list2" type="select" label="Source">
-                            <option value="builtin" selected="True">Standard (select from the list below)</option>
-                            <option value="user">Enter custom sequence</option>
-                            <option value="file">File from history</option>
-                        </param>
-
-                        <when value="user">
-                            <param name="anywhere_adapter_name2" type="text" value="" optional="True" label="Enter custom 5' or 3' adapter name (Optional)" />
-                            <expand macro="adapter" name="anywhere_adapter2" argument="-B" label="Enter custom 5' or 3' adapter sequence" value="AATTGGCC" />
-                        </when>
-                        <when value="builtin">
-                            <expand macro="adapter_select" name="anywhere_adapter2" argument="-B" type="select" label="Choose 5' or 3' adapter"/>
-                        </when>
-                        <when value="file">
-                            <param name="anywhere_adapter_file2" argument="-b" format="fasta" type="data" help="Should be of datatype &quot;FASTA&quot;" label="Choose file containing 3' or 5' adapters" />
-                        </when>
-                    </conditional>
-                    <param name="single_noindels" type="boolean" truevalue=";noindels" falsevalue="" checked="false" label="Disallow indels for this adapter"/>
-                </repeat>
-
-            <param name="cut2" argument="-U" type="integer" value="0" optional="True" label="Cut bases from the second read in each pair." help="Remove bases from the beginning or end of each read before trimming adapters. If positive, the bases are removed from the beginning of each read. If negative, the bases are removed from the end of each read." />
-            <param name="quality_cutoff2" type="text" optional="true" label="Optional separate quality cutoff for Read 2" help="Trim low-quality bases from 5' and/or 3' ends of each read before adapter removal. If one value is given, only the 3' end is trimmed. If two comma-separated cutoffs are given, the 5' end is trimmed with the first cutoff, the 3' end with the second. Leave blank to use the same value as for Read 1">
-                <sanitizer>
-                    <valid initial="string.digits"><add value="," /></valid>
-                </sanitizer>
-                <validator type="regex">[0-9,]+</validator>
-            </param>
+                <!-- read modification -->
+                <param name="cut2" argument="-U" type="integer" value="0" optional="true" label="Cut bases from the second read in each pair." help="Remove bases from the beginning or end of each read before trimming adapters. If positive, the bases are removed from the beginning of each read. If negative, the bases are removed from the end of each read." />
+                <param name="quality_cutoff2" argument="-Q" type="text" optional="true" label="Optional separate quality cutoff for Read 2" help="Trim low-quality bases from 5' and/or 3' ends of each read before adapter removal. If one value is given, only the 3' end is trimmed. If two comma-separated cutoffs are given, the 5' end is trimmed with the first cutoff, the 3' end with the second. Leave blank to use the same value as for Read 1">
+                    <sanitizer>
+                        <valid initial="string.digits"><add value="," /></valid>
+                    </sanitizer>
+                    <validator type="regex">[0-9]+(,[0-9])?</validator>
+                </param>
+                <!-- read filtering-->
+                <param name="minimum_length2" type="integer" min="0" value="" optional="true" label="Minimum length (R2)" />
+                <param name="maximum_length2" type="integer" min="0" value="" optional="true" label="Maximum length (R2)" />
             </section>
-
         </xml>
 
         <xml name="inherit_format_1">