comparison macros_process.xml @ 2:fa593b13402f draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/stacks2 commit 9c41b2599125298b1a4d9ffb2511cdc87ff79a73
author matthias
date Tue, 18 Dec 2018 12:57:35 -0500
parents
children a70c766ce64f
comparison
equal deleted inserted replaced
1:58b5c841fa51 2:fa593b13402f
1 <?xml version="1.0"?>
2
3 <!-- macros and tokens for process_radtags and process_short_reads -->
4
5 <macros>
6 <!-- fastq input for process_radtags/shortreads-->
7 <xml name="process_inputs">
8 <conditional name="input_type">
9 <param name="options_type_selector" type="select" label="Single-end or paired-end reads files">
10 <option value="single" selected="True">Single-end files</option>
11 <option value="paired">Paired-end files</option>
12 </param>
13 <when value="single">
14 <param name="fqinputs" argument="-f" format="fastqsanger,fastqsanger.gz" multiple="true" type="data" label="singles-end reads infile(s)" help="input files" />
15 <param name="barcode_encoding" type="select" label="Barcode location">
16 <expand macro="barcode_encoding_single" type="Barcode" />
17 </param>
18 </when>
19 <when value="paired">
20 <param name="fqinputs" type="data_collection" collection_type="list:paired" label="paired-end reads infile(s)" format="fastqsanger,fastqsanger.gz"/>
21 <param name="barcode_encoding" type="select" label="Barcode location">
22 <expand macro="barcode_encoding_pair" type="Barcode" />
23 </param>
24 </when>
25 </conditional>
26 <param name="barcode" argument="-b" type="data" format="tabular,txt" label="Barcode file" />
27 </xml>
28 <token name="@FASTQ_INPUT_PREPROC@"><![CDATA[
29 #for $input in $input_type.fqinputs:
30 #if $input_type.options_type_selector == "single"
31 #set $isfq=$input.is_of_type('fastqsanger')
32 #set $name=$clean_ext($input.element_identifier)
33 #else:
34 #set $isfq=$input.forward.is_of_type('fastqsanger')
35 ## TODO if https://github.com/galaxyproject/galaxy/pull/7031 is
36 ## backported use element_identifier consistently and fix release in <tool>?
37 #set $name=$clean_ext($input.name)
38 #end if
39
40 #if $isfq:
41 #set $ext = "fastq"
42 #set inputype = "fastq"
43 #else
44 #set $ext = "fastq.gz"
45 #set inputype = "gzfastq"
46 #end if
47
48 #if $input_type.options_type_selector == "single"
49 ln -s '$input' 'stacks_inputs/${name}.${ext}' &&
50 #else:
51 ## procrad needs _R[12]_ in the file name, so we add an add 0
52 ln -s '$input.forward' 'stacks_inputs/${name}_R1_0.${ext}' &&
53 ln -s '$input.reverse' 'stacks_inputs/${name}_R2_0.${ext}' &&
54 #end if
55 #end for
56 ]]></token>
57 <token name="@PROCESS_IOOPTIONS@"><![CDATA[
58 -p stacks_inputs/
59 #if $input_type.options_type_selector == "paired"
60 --paired
61 #end if
62 -i $inputype
63 -b '$barcode'
64 $input_type.barcode_encoding
65 #if str( $outype ) != "auto"
66 -y $outype
67 #end if
68 -o stacks_outputs
69 ]]></token>
70 <xml name="process_output_types">
71 <param name="outype" argument="-y" type="select" label="Output format" >
72 <option value="auto" selected="True">Same as input</option>
73 <option value="fastq">fastq</option>
74 <option value="fasta">fasta</option>
75 <option value="gzfastq">gzipped fastq</option>
76 <option value="gzfasta">gzipped fasta</option>
77 </param>
78 </xml>
79
80 <xml name="discover_faqgz_output_macro" token_pattern="" token_dir="">
81 <expand macro="discover_faq_output_macro" pattern="@PATTERN@" dir="@DIR@"/>
82 <discover_datasets pattern="@PATTERN@\.fq\.gz$" ext="fastqsanger.gz" directory="@DIR@/" />
83 <discover_datasets pattern="@PATTERN@\.fa\.gz$" ext="fasta.gz" directory="@DIR@/" />
84 </xml>
85 <xml name="discover_faq_output_macro" token_pattern="" token_dir="">
86 <discover_datasets pattern="@PATTERN@\.fq$" ext="fastqsanger" directory="@DIR@/" />
87 <discover_datasets pattern="@PATTERN@\.fa$" ext="fasta" directory="@DIR@/" />
88 </xml>
89
90 <xml name="process_outputs">
91 <collection name="demultiplexed" type="list" label="${tool.name} on ${on_string} Demultiplexed reads">
92 <filter>input_type['options_type_selector'] == "single"</filter>
93 <expand macro="discover_faqgz_output_macro" pattern="(?P&lt;name&gt;.+)" dir="stacks_outputs"/>
94 </collection>
95 <collection name="demultiplexed_paired" type="list:paired" label="${tool.name} on ${on_string} Demultiplexed reads">
96 <filter>input_type['options_type_selector'] == "paired"</filter>
97 <expand macro="discover_faqgz_output_macro" pattern="(?P&lt;identifier_0&gt;.+)\.(?P&lt;identifier_1&gt;[^.]+)" dir="stacks_outputs"/>
98 </collection>
99
100 <collection name="remaining" type="list:paired" label="${tool.name} on ${on_string} Remaining orphan reads">
101 <filter>input_type['options_type_selector'] == "paired"</filter>
102 <expand macro="discover_faqgz_output_macro" pattern="(?P&lt;identifier_0&gt;.+)\.rem\.(?P&lt;identifier_1&gt;[^.]+)" dir="stacks_outputs/remaining"/>
103 </collection>
104
105 <!-- note irrespective of -y output is always named fastq and are never zipped -->
106 <collection name="discarded" type="list" label="${tool.name} on ${on_string} Discarded reads">
107 <filter>capture is True and input_type['options_type_selector'] == "single"</filter>
108 <expand macro="discover_faq_output_macro" pattern="(?P&lt;name&gt;.*)" dir="stacks_outputs/discarded"/>
109 </collection>
110 <collection name="discarded_paired" type="list:paired" label="${tool.name} on ${on_string} Discarded reads">
111 <filter>capture is True and input_type['options_type_selector'] == "paired"</filter>
112 <expand macro="discover_faq_output_macro" pattern="(?P&lt;identifier_0&gt;.+)\.(?P&lt;identifier_1&gt;[^.]+)" dir="stacks_outputs/discarded"/>
113 </collection>
114 </xml>
115
116 <!-- FASTQ filtering options -->
117 <xml name="process_filter">
118 <conditional name="filter_cond" >
119 <param name="filter_select" type="select" label="do quality filtering">
120 <option value="yes">Yes</option>
121 <option value="no" selected="true">No</option>
122 </param>
123 <when value="yes">
124 <param name="sliding" type="float" value="0.15" min="0" max="1" argument="-w" label="Set the size of the sliding window as a fraction of the read length, between 0 and 1" />
125 <param name="score" type="integer" value="10" min="0" max="40" argument="-s" label="Set the score limit. If the average score within the sliding window drops below this value, the read is discarded" />
126 <param name="remove" type="boolean" checked="false" truevalue="-c" falsevalue="" argument="-c" label="Clean data, remove any read with an uncalled base" />
127 <param name="discard" type="boolean" checked="false" truevalue="-q" falsevalue="" argument="-q" label="Discard reads with low quality scores"/>
128 <param argument="--filter_illumina" type="boolean" checked="false" truevalue="--filter_illumina" falsevalue="" label="discard reads that have been marked by Illumina's chastity/purity filter as failing" />
129 </when>
130 <when value="no">
131 <param argument="--len_limit" type="integer" value="" optional="true" label="minimum sequence length" help="useful if your data has already been trimmed"/>
132 </when>
133 </conditional>
134 <param name="capture" type="boolean" checked="false" truevalue="-D" falsevalue="" argument="-D" label="Capture discarded reads to a file" />
135 </xml>
136 <token name="@PROCESS_FILTER@"><![CDATA[
137 #if $filter_cond.filter_select == 'yes':
138 -w $filter_cond.sliding
139 -s $filter_cond.score
140 $filter_cond.remove
141 $filter_cond.discard
142 $filter_cond.filter_illumina
143 #else
144 #if str($filter_cond.len_limit) != "":
145 --len_limit $filter_cond.len_limit
146 #end if
147 #end if
148 $capture
149 ]]></token>
150 <token name="@PROCESS_FASTQ_POSTPROC@"><![CDATA[
151 #if $capture:
152 && mkdir stacks_outputs/discarded/
153 && mv stacks_outputs/*discards stacks_outputs/discarded/
154
155 ## fix the _R[12]_0 that was added for preparing the input
156 #if $input_type.options_type_selector == 'paired':
157 && find stacks_outputs/discarded/ -type f | while read file; do mv "\$file" "\$(echo \$file | sed 's/_R1_0/.1/; s/_R2_0/.2/;')"; done
158 #end if
159 ## also remove the gz which is added by procrad (but its uncompressed)
160 && find stacks_outputs/discarded/ -type f -iname "*.gz.discards" | while read file; do mv "\$file" "\$(echo \$file | sed 's/.gz.discards$/.discards/;')"; done
161
162 ## the discard files are named fastq even if the output is fasta
163 #if str($outype).endswith("fasta"):
164 && find stacks_outputs/discarded/ -type f | while read file; do mv "\$file" "\$(echo \$file | sed 's/\.fastq.discards/.fa/;')"; done
165 #else
166 && find stacks_outputs/discarded/ -type f | while read file; do mv "\$file" "\$(echo \$file | sed 's/\.fastq.discards/.fq/;')"; done
167 #end if
168 #end if
169 ## prepare paired read output for processing in galaxy
170 #if $input_type.options_type_selector == 'paired':
171 && mkdir stacks_outputs/remaining
172 && find stacks_outputs -iregex ".*\.rem\.[12]\.f[aq]\(\.gz\)?" | while read file; do mv "\$file" stacks_outputs/remaining/; done
173 && find stacks_outputs/ -iregex ".*.f[aq]\(\.gz\)?" | while read file; do mv "\$file" "\$(echo \$file | sed 's/\.1\./.forward./; s/\.2\./.reverse./')"; done
174 #end if
175 ]]></token>
176
177
178
179 <!-- adapter trimming options -->
180 <xml name="process_adapter">
181 <param argument="--adapter_1" type="text" value="" optional="true" label="adaptor sequence that may occur on the first read" />
182 <param argument="--adapter_2" type="text" value="" optional="true" label="adaptor sequence that may occur on the paired-read" />
183 <param argument="--adapter_mm" type="integer" value="" optional="true" label="number of mismatches allowed in the adapter sequence"/>
184 </xml>
185 <token name="@PROCESS_ADAPTER@"><![CDATA[
186 ## Adapter options
187 #if str($options_advanced.adapter_1) != "":
188 --adapter_1 $options_advanced.adapter_1
189 #end if
190 #if str($options_advanced.adapter_2) != "":
191 --adapter_2 $options_advanced.adapter_2
192 #end if
193 #if str($options_advanced.adapter_mm) != "":
194 --adapter_mm $options_advanced.adapter_mm
195 #end if
196 ]]></token>
197
198 <!-- barcode rescue options -->
199 <xml name="rescue_barcode">
200 <conditional name="rescue_cond">
201 <param name="rescue" type="select" argument="-r" label="Rescue mutated barcodes and RAD-Tags?">
202 <option value="-r">yes</option>
203 <option value="" selected="true">no</option>
204 </param>
205 <when value="-r">
206 <param argument="--barcode_dist_1" type="integer" value="" optional="true" label="number of allowed mismatches when rescuing first read barcodes" help="(default 1)"/>
207 <param argument="--barcode_dist_2" type="integer" value="" optional="true" label="number of allowed mismatches when rescuing paired read barcodes" help="(default value for single end barcodes)"/>
208 </when>
209 <when value=""/>
210 </conditional>
211 </xml>
212 <token name="@RESCUE_BARCODE@"><![CDATA[
213 #if str($options_advanced.rescue_cond.rescue) != ""
214 $options_advanced.rescue_cond.rescue
215 #if str($options_advanced.rescue_cond.barcode_dist_1) != "":
216 --barcode_dist_1 $options_advanced.rescue_cond.barcode_dist_1
217 #end if
218 #if str($options_advanced.rescue_cond.barcode_dist_2) != "":
219 --barcode_dist_2 $options_advanced.rescue_cond.barcode_dist_2
220 #end if
221 #end if
222 ]]></token>
223
224 <!-- advanced options that are shared -->
225 <xml name="common_advanced">
226 <param name="truncate" type="integer" value="" optional="True" argument="-t" label="Truncate final read length to this value" />
227 <param argument="--retain_header" type="boolean" checked="false" truevalue="--retain_header" falsevalue="" label="Retain unmodified FASTQ headers in the output" />
228 </xml>
229 <token name="@COMMON_ADVANCED@"><![CDATA[
230 #if str($options_advanced.truncate)
231 -t $options_advanced.truncate
232 #end if
233 $options_advanced.retain_header
234 ]]></token>
235 </macros>