Mercurial > repos > jjohnson > fgbio_trim_fastq
comparison macros.xml @ 0:604d9b0ad9a4 draft default tip
"planemo upload commit 77a5370a0978b5332bb3a9f063588a52a468ea08"
author | jjohnson |
---|---|
date | Thu, 19 Aug 2021 15:13:17 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:604d9b0ad9a4 |
---|---|
1 <macros> | |
2 <token name="@TOOL_VERSION@">1.3.0</token> | |
3 <token name="@VERSION_SUFFIX@">1</token> | |
4 <xml name="requirements"> | |
5 <requirements> | |
6 <requirement type="package" version="@TOOL_VERSION@">fgbio</requirement> | |
7 <yield/> | |
8 </requirements> | |
9 </xml> | |
10 <xml name="citations"> | |
11 <citations> | |
12 <citation type="bibtex">@online{fgbio, | |
13 author = {Tim Fennell, Nils Homer}, | |
14 title = {fgbio}, | |
15 year = 2015, | |
16 url = {https://github.com/fulcrumgenomics/fgbio}, | |
17 urldate = {2021-03-01} | |
18 }</citation> | |
19 </citations> | |
20 </xml> | |
21 <token name="@READ_STRUCTURE_PATTERN@">(([1-9][0-9]*[TBMS])*([+]|[1-9][0-9]*)[TBMS])</token> | |
22 <token name="@READ_STRUCTURES_PATTERN@">@READ_STRUCTURE_PATTERN@(\s@READ_STRUCTURE_PATTERN@)*</token> | |
23 <xml name="read_structures_validator" token_pattern="@READ_STRUCTURES_PATTERN@"> | |
24 <validator type="regex" message="">^@READ_STRUCTURES_PATTERN@$</validator> | |
25 </xml> | |
26 <xml name="read_structures" token_pattern="@READ_STRUCTURES_PATTERN@"> | |
27 <param argument="--read-structures" type="text" value="" optional="true" label="Read structures, one for each of the FASTQ"> | |
28 <expand macro="read_structures_validator" pattern="@READ_STRUCTURE_PATTERN@" /> | |
29 </param> | |
30 </xml> | |
31 | |
32 <xml name="fastq_input" token_fastqtype="reads" token_defaultpaired="True" token_defaultnone="False"> | |
33 <conditional name="@FASTQTYPE@"> | |
34 <param name="type" type="select" label="Library type of FASTQ @FASTQTYPE@"> | |
35 <option value="none" selected="@DEFAULTNONE@">NO fastq @FASTQTYPE@</option> | |
36 <option value="single">Single-end</option> | |
37 <option value="paired" selected="@DEFAULTPAIRED@">Paired-end</option> | |
38 <option value="paired_collection">Paired-end Dataset Collection</option> | |
39 </param> | |
40 <when value="none"/> | |
41 <when value="single"> | |
42 <param name="input_single" type="data" format="fastq,fastq.gz" label="Reads in FASTQ format" /> | |
43 <expand macro="read_structures" pattern="@READ_STRUCTURE_PATTERN@" /> | |
44 </when> | |
45 <when value="paired"> | |
46 <param name="input_read1" type="data" format="fastq,fastq.gz" label="Reads #1 in FASTQ format" /> | |
47 <param name="input_read2" type="data" format="fastq,fastq.gz" label="Reads #2 in FASTQ format" /> | |
48 <expand macro="read_structures" pattern="@READ_STRUCTURES_PATTERN@" /> | |
49 </when> | |
50 <when value="paired_collection"> | |
51 <param name="input_readpair" type="data_collection" collection_type="paired" format="fastq,fastq.gz" label="Paired Reads in FASTQ format" /> | |
52 <expand macro="read_structures" pattern="@READ_STRUCTURES_PATTERN@" /> | |
53 </when> | |
54 </conditional> | |
55 </xml> | |
56 <xml name="fastq_reads"> | |
57 <expand macro="fastq_input" fastqtype="reads" defaultpaired="True" defaultnone="False"/> | |
58 </xml> | |
59 <xml name="fastq_inputs"> | |
60 <expand macro="fastq_input" fastqtype="reads" defaultpaired="True" defaultnone="False"/> | |
61 <expand macro="fastq_input" fastqtype="indices" defaultpaired="False" defaultnone="True"/> | |
62 </xml> | |
63 <token name="@FASTQ_READS@"><![CDATA[ | |
64 #set $fastqs = [] | |
65 #set $read_structs = [] | |
66 #if $reads.type == 'single': | |
67 $fastqs.append($reads.input_single) | |
68 #elif $reads.type == 'paired': | |
69 $fastqs.append($reads.input_read1) | |
70 $fastqs.append($reads.input_read2) | |
71 #elif $reads.type == 'paired_collection': | |
72 $fastqs.append($reads.input_readpair.forward) | |
73 $fastqs.append($reads.input_readpair.reverse) | |
74 #end if | |
75 #if $reads.type !='none' and $reads.read_structures: | |
76 $read_structs.append(str($reads.read_structures)) | |
77 #end if | |
78 #set $read_structures = "%s" % (' '.join($read_structs)) | |
79 #if $read_structs: | |
80 --read-structures $read_structures | |
81 #end if | |
82 ]]></token> | |
83 <token name="@LINK_FASTQ_INPUTS@"><![CDATA[ | |
84 #import re | |
85 #def identifier_or_name($input1) | |
86 #if hasattr($input1, 'element_identifier') | |
87 #return $input1.element_identifier | |
88 #else | |
89 #return $input1.name | |
90 #end if | |
91 #end def | |
92 #def clean($name1) | |
93 #set $name_clean = $re.sub('[^\w\-_]', '_', $re.sub('(?i)[.](fq|fastq)$','', $re.sub('.*/','', $name1.rstrip('.gz')))) | |
94 #return $name_clean | |
95 #end def | |
96 #def ln_name($ds) | |
97 #set $ext = '' | |
98 #if $ds.is_of_type('mzml') or $ds.is_of_type('fastq.gz') | |
99 #set $ext = ".fastq.gz" | |
100 #else if $ds.is_of_type('fastq') | |
101 #set $ext = ".fastq" | |
102 #end if | |
103 #set $name = "%s%s" % ($clean($identifier_or_name($ds)),$ext) | |
104 #return $name | |
105 #end def | |
106 #set $fastqs = [] | |
107 #set $read_structs = [] | |
108 #if $reads.type == 'single': | |
109 #set $i_name = $ln_name($reads.input_single) | |
110 #silent $fastqs.append($i_name) | |
111 ln -s '$reads.input_single' '$i_name' && | |
112 #elif $reads.type == 'paired': | |
113 #set $f_name = $ln_name($reads.input_read1) | |
114 #silent $fastqs.append($f_name) | |
115 ln -s '$reads.input_read1' '$f_name' && | |
116 #set $r_name = $ln_name($reads.input_read2) | |
117 #silent $fastqs.append($r_name) | |
118 ln -s '$reads.input_read2' '$r_name' && | |
119 #elif $reads.type == 'paired_collection': | |
120 #set $f_name = $ln_name($reads.input_readpair.forward) | |
121 #silent $fastqs.append($f_name) | |
122 ln -s '$reads.input_readpair.forward' '$f_name' && | |
123 #set $r_name = $ln_name($reads.input_readpair.reverse) | |
124 #silent $fastqs.append($r_name) | |
125 ln -s '$reads.input_readpair.reverse' '$r_name' && | |
126 #end if | |
127 #if $reads.type !='none' and $reads.read_structures: | |
128 $read_structs.append(str($reads.read_structures)) | |
129 #end if | |
130 #if $indices.type == 'single': | |
131 #set $i_name = $ln_name($indices.input_single) | |
132 #silent $fastqs.append($i_name) | |
133 ln -s '$indices.input_single' '$i_name' && | |
134 #elif $indices.type == 'paired': | |
135 #set $f_name = $ln_name($indices.input_read1) | |
136 #silent $fastqs.append($f_name) | |
137 ln -s '$indices.input_read1' '$f_name' && | |
138 #set $r_name = $ln_name($indices.input_read2) | |
139 #silent $fastqs.append($r_name) | |
140 ln -s '$indices.input_read2' '$r_name' && | |
141 #elif $indices.type == 'paired_collection': | |
142 #set $f_name = $ln_name($indices.input_readpair.forward) | |
143 #silent $fastqs.append($f_name) | |
144 ln -s '$indices.input_readpair.forward' '$f_name' && | |
145 #set $r_name = $ln_name($indices.input_readpair.reverse) | |
146 #silent $fastqs.append($r_name) | |
147 ln -s '$indices.input_readpair.reverse' '$r_name' && | |
148 #end if | |
149 #if $indices.type != 'none' and $indices.read_structures: | |
150 $read_structs.append(str($indices.read_structures)) | |
151 #end if | |
152 ]]></token> | |
153 <token name="@FASTQ_INPUTS@"><![CDATA[ | |
154 --input | |
155 #for $input in $fastqs | |
156 '$input' | |
157 #end for | |
158 #set $read_structures = "%s" % (' '.join($read_structs)) | |
159 #if $read_structs: | |
160 --read-structures $read_structures | |
161 #end if | |
162 ]]></token> | |
163 <xml name="inherit_format_1"> | |
164 <actions> | |
165 <conditional name="library.type"> | |
166 <when value="single"> | |
167 <action type="format"> | |
168 <option type="from_param" name="library.input_1" param_attribute="ext" /> | |
169 </action> | |
170 </when> | |
171 <when value="paired"> | |
172 <action type="format"> | |
173 <option type="from_param" name="library.input_1" param_attribute="ext" /> | |
174 </action> | |
175 </when> | |
176 <when value="paired_collection"> | |
177 <action type="format"> | |
178 <option type="from_param" name="library.input_1" param_attribute="forward.ext" /> | |
179 </action> | |
180 </when> | |
181 </conditional> | |
182 </actions> | |
183 </xml> | |
184 | |
185 <xml name="inherit_format_2"> | |
186 <actions> | |
187 <conditional name="library.type"> | |
188 <when value="paired"> | |
189 <action type="format"> | |
190 <option type="from_param" name="library.input_2" param_attribute="ext" /> | |
191 </action> | |
192 </when> | |
193 <when value="paired_collection"> | |
194 <action type="format"> | |
195 <option type="from_param" name="library.input_1" param_attribute="reverse.ext" /> | |
196 </action> | |
197 </when> | |
198 </conditional> | |
199 </actions> | |
200 </xml> | |
201 <xml name="sam_tag_validator"> | |
202 | |
203 <validator type="regex" message="">^[A-Za-z][A-Za-z]$</validator> | |
204 </xml> | |
205 <xml name="sam_sort_order"> | |
206 <param argument="--sort-order" type="select" optional="true" label="Sort BAM by"> | |
207 <option value="TemplateCoordinate">TemplateCoordinate</option> | |
208 <option value="Coordinate">Coordinate</option> | |
209 <option value="Queryname">Queryname</option> | |
210 <option value="Random">Random</option> | |
211 <option value="RandomQuery">RandomQuery</option> | |
212 </param> | |
213 </xml> | |
214 | |
215 <xml name="sort_order_change_format"> | |
216 <change_format> | |
217 <when input="sort_order" value="Coordinate" format="bam" /> | |
218 <when input="sort_order" value="TemplateCoordinate" format="bam" /> | |
219 <when input="sort_order" value="QueryName" format="unsorted.bam" /> | |
220 <when input="sort_order" value="Random" format="unsorted.bam" /> | |
221 <when input="sort_order" value="RandomQuery" format="unsorted.bam" /> | |
222 </change_format> | |
223 </xml> | |
224 | |
225 <token name="@READ_STRUCTURES_HELP@"><![CDATA[ | |
226 **Read Structures** | |
227 | |
228 Read structures are made up of <number><operator> pairs much like the CIGAR string in BAM files. Four kinds of operators are recognized: | |
229 | |
230 - T identifies a template read | |
231 - B identifies a sample barcode read | |
232 - M identifies a unique molecular index read | |
233 - S identifies a set of bases that should be skipped or ignored | |
234 | |
235 The last <number><operator> pair may be specified using a + sign instead of number to denote “all remaining bases”. This is useful if, e.g., fastqs have been trimmed and contain reads of varying length. For example to convert a paired-end run with an index read and where the first 5 bases of R1 are a UMI and the second five bases are monotemplate you might specify: | |
236 | |
237 :: | |
238 | |
239 --input r1.fq r2.fq i1.fq --read-structures 5M5S+T +T +B | |
240 | |
241 Alternative if you know your reads are of fixed length you could specify: | |
242 | |
243 :: | |
244 | |
245 --input r1.fq r2.fq i1.fq --read-structures 5M5S65T 75T 8B | |
246 | |
247 | |
248 ]]></token> | |
249 <xml name="citations"> | |
250 <citations> | |
251 <yield /> | |
252 </citations> | |
253 </xml> | |
254 </macros> |