upstream-extended/iuc/tool_collections/samtools/samtools_fastx/samtools_fastx.xml
1<tool id="samtools_fastx" name="Samtools fastx" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
2 <description>extract FASTA or FASTQ from alignment files</description>
3 <macros>
4 <import>macros.xml</import>
5 </macros>
6 <expand macro="requirements" />
7 <expand macro="stdio"/>
8 <expand macro="version_command" />
9 <command><![CDATA[
10@ADDTHREADS@
11@ADDMEMORY@
12## name sort input file if neccessary
13#if not $input.is_of_type('qname_sorted.bam', 'qname_input_sorted.bam'):
14 samtools sort -@ \$addthreads -m \$addmemory"M" -n '$input' -T "\${TMPDIR:-.}" > input &&
15#else:
16 ln -s '$input' input &&
17#end if
18
19#set command=str($output_fmt_cond.output_fmt_select)[:5]
20
21samtools $command
22#if str($output_fmt_cond.output_fmt_select).startswith('fastq'):
23 #if str($output_fmt_cond.default_quality) != '':
24 -v $output_fmt_cond.default_quality
25 #end if
26 $output_fmt_cond.output_quality
27 $output_fmt_cond.ilumina_casava
28#end if
29$copy_tags
30#if str($copy_arb_tags) != '':
31 -T '$copy_arb_tags'
32#end if
33$read_numbering
34#if 'r0' in str($outputs):
35 -0 nonspecific.$output_fmt_cond.output_fmt_select
36#end if
37#if 'r1' in str($outputs):
38 -1 forward.$output_fmt_cond.output_fmt_select
39#end if
40#if 'r2' in str($outputs):
41 -2 reverse.$output_fmt_cond.output_fmt_select
42#end if
43#set $filter = $inclusive_filter
44@FLAGS@
45-f $flags
46#set $filter = $exclusive_filter
47@FLAGS@
48-F $flags
49#set $filter = $exclusive_filter_all
50@FLAGS@
51-G $flags
52#if 's' in str($outputs):
53 -s singletons.$output_fmt_cond.output_fmt_select
54#end if
55#if str($idxout_cond.idxout_select) == 'yes':
56 #if str($idxout_cond.write1st) == 'yes':
57 --i1 i1.$output_fmt_cond.output_fmt_select
58 #end if
59 #if str($idxout_cond.write2nd) == 'yes':
60 --i2 i2.$output_fmt_cond.output_fmt_select
61 #end if
62 #if str($idxout_cond.index_format) != '':
63 --index-format $idxout_cond.index_format
64 #end if
65 #if str($idxout_cond.barcode_tag) != '':
66 --barcode-tag $idxout_cond.barcode_tag
67 #end if
68 #if str($idxout_cond.quality_tag) != '':
69 --quality-tag $idxout_cond.quality_tag
70 #end if
71#end if
72
73input
74
75#if str($outputs)=='None' or 'other' in str($outputs):
76 ## since currently stdout in not zipped (samtools doesn't know about the extension)
77 #if str($output_fmt_cond.output_fmt_select).endswith('.gz'):
78 | gzip -
79 #end if
80 > output.$output_fmt_cond.output_fmt_select
81 && ln -s output.$output_fmt_cond.output_fmt_select output
82#else
83 ## otherwise the remaining sequences would show up in the datasets info box
84 > /dev/null
85#end if
86#if 'r0' in str($outputs):
87 && ln -s nonspecific.$output_fmt_cond.output_fmt_select nonspecific
88#end if
89#if 'r1' in str($outputs):
90 && ln -s forward.$output_fmt_cond.output_fmt_select forward
91#end if
92#if 'r2' in str($outputs):
93 && ln -s reverse.$output_fmt_cond.output_fmt_select reverse
94#end if
95#if 's' in str($outputs):
96 && ln -s singletons.$output_fmt_cond.output_fmt_select singletons
97#end if
98#if str($idxout_cond.idxout_select) == 'yes':
99 #if str($idxout_cond.write1st) == 'yes':
100 && ln -s i1.$output_fmt_cond.output_fmt_select i1
101 #end if
102 #if str($idxout_cond.write2nd) == 'yes':
103 && ln -s i2.$output_fmt_cond.output_fmt_select i2
104 #end if
105#end if
106 ]]>
107 </command>
108 <inputs>
109 <param name="input" type="data" format="sam,bam,cram" label="BAM or SAM file to convert" />
110 <conditional name="output_fmt_cond">
111 <param name="output_fmt_select" type="select" label="Output format">
112 <option value="fasta" selected="True">FASTA</option>
113 <option value="fastqsanger">FASTQ</option>
114 <option value="fasta.gz">compressed FASTA</option>
115 <option value="fastqsanger.gz">compressed FASTQ</option>
116 </param>
117 <when value="fastqsanger">
118 <param name="default_quality" argument="-v" type="integer" optional="True" label="Default quality if none is given" />
119 <param name="output_quality" argument="-O" type="boolean" truevalue="-O" falsevalue="" checked="false" label="Output quality in the OQ tag if available" />
120 <param name="ilumina_casava" argument="-i" type="boolean" truevalue="-i" falsevalue="" checked="false" label="add Illumina Casava 1.8 format entry to header (eg 1:N:0:ATCACG)" />
121 </when>
122 <when value="fasta" />
123 <when value="fastqsanger.gz">
124 <param name="default_quality" argument="-v" type="integer" optional="True" label="Default quality if none is given" />
125 <param name="output_quality" argument="-O" type="boolean" truevalue="-O" falsevalue="" checked="false" label="Output quality in the OQ tag if available" />
126 <param name="ilumina_casava" argument="-i" type="boolean" truevalue="-i" falsevalue="" checked="false" label="add Illumina Casava 1.8 format entry to header (eg 1:N:0:ATCACG)" />
127 </when>
128 <when value="fasta.gz" />
129 </conditional>
130 <param name="outputs" type="select" multiple="true" label="outputs">
131 <option value="other" selected="true">others</option>
132 <option value="r1">READ1</option>
133 <option value="r2">READ2</option>
134 <option value="s">singletons</option>
135 <option value="r0">unspecific</option>
136 <help>disjoint subsets of the reads can be redirected to separate data sets. "READ[12]" are reads for which the READ[12] flag is set and the READ[21] flag is not set. "unspecific" reads are those for which both ore neither of these flags are set. "singletons" are the singleto reads. Note that if selected READ1 and READ2 contain only the paired reads. "other" are the remaining reads. If onlz 'others' or nothing is selected all reads go to a single data set. </help>
137 </param>
138 <param name="copy_tags" argument="-t" type="boolean" truevalue="-t" falsevalue="" label="Copy RG/BC/QT tags to output header" />
139 <param name="copy_arb_tags" argument="-T" type="text" optional="true" label="copy arbitrary tags to the FASTA header line" />
140 <param name="read_numbering" type="select" label="Omit or append read numbers">
141 <option value="" selected="True">no</option>
142 <option value="-n">Do not append /1 and /2 to read names</option>
143 <option value="-N">always append /1 and /2 to read name</option>
144 </param>
145 <param name="inclusive_filter" argument="-f" type="select" multiple="True" label="Require that these flags are set">
146 <expand macro="flag_options"/>
147 </param>
148 <param name="exclusive_filter" argument="-F" type="select" multiple="True" label="Exclude reads with any of the following flags set">
149 <expand macro="flag_options" s256="true" s2048="true"/>
150 </param>
151 <param name="exclusive_filter_all" argument="-G" type="select" multiple="True" label="Exclude reads with all of the following flags set">
152 <expand macro="flag_options" />
153 </param>
154
155 <conditional name="idxout_cond">
156 <param name="idxout_select" type="select" label="Write index read files">
157 <option value="no" selected="True">No</option>
158 <option value="yes">Yes (beta: feedback welcome)</option>
159 </param>
160 <when value="no" />
161 <when value="yes">
162 <param name="write1st" argument="--i1" type="boolean" truevalue="yes" falsevalue="no" checked="true" label="write first index reads to extra data set" />
163 <param name="write2nd" argument="--i2" type="boolean" truevalue="yes" falsevalue="no" checked='true' label="write second index reads to extra data set" />
164 <param argument="--index-format" type="text" label="Index format: How to parse barcode and quality tags">
165 <help>
166The index-format string describes how to parse the barcode and quality tags, for example:
167 i14i8 the first 14 characters are index 1, the next 8 characters are index 2
168 n8i14 ignore the first 8 characters, and use the next 14 characters for index 1
169 If the tag contains a separator, then the numeric part can be replaced with '*' to mean
170 'read until the separator or end of tag', for example:
171 n*i* ignore the left part of the tag until the separator, then use the second part
172 of the tag as index 1
173 </help>
174 </param>
175 <param argument="--barcode-tag" type="text" optional="True" label="Barcode tag [default: BC]"/>
176 <param argument="--quality-tag" type="text" optional="True" label="Quality tag [default: QT]"/>
177 </when>
178 </conditional>
179 </inputs>
180 <outputs>
181 <data name="nonspecific" format="fasta" from_work_dir="nonspecific" label="${on_string} converted to ${output_fmt_cond.output_fmt_select} (nonspecific)">
182 <filter>'r0' in str(outputs)</filter>
183 <actions>
184 <action type="format">
185 <option type="from_param" name="output_fmt_cond" param_attribute="output_fmt_select" />
186 </action>
187 </actions>
188 </data>
189 <data name="forward" format="fasta" from_work_dir="forward" label="${on_string} converted to ${output_fmt_cond.output_fmt_select} (READ1)">
190 <filter>'r1' in str(outputs)</filter>
191 <actions>
192 <action type="format">
193 <option type="from_param" name="output_fmt_cond" param_attribute="output_fmt_select" />
194 </action>
195 </actions>
196 </data>
197 <data name="reverse" format="fasta" from_work_dir="reverse" label="${on_string} converted to ${output_fmt_cond.output_fmt_select} (READ2)">
198 <filter>'r2' in str(outputs)</filter>
199 <actions>
200 <action type="format">
201 <option type="from_param" name="output_fmt_cond" param_attribute="output_fmt_select" />
202 </action>
203 </actions>
204 </data>
205 <data name="singletons" format="fasta" from_work_dir="singletons" label="${on_string} converted to ${output_fmt_cond.output_fmt_select} (singletons)">
206 <filter>'s' in str(outputs)</filter>
207 <actions>
208 <action type="format">
209 <option type="from_param" name="output_fmt_cond" param_attribute="output_fmt_select" />
210 </action>
211 </actions>
212 </data>
213 <data name="output" format="fasta" from_work_dir="output" label="${on_string} converted to ${output_fmt_cond.output_fmt_select}">
214 <filter>str(outputs)=='None' or 'other' in str(outputs)</filter>
215 <actions>
216 <action type="format">
217 <option type="from_param" name="output_fmt_cond" param_attribute="output_fmt_select" />
218 </action>
219 </actions>
220 </data>
221 <data name="i1" format="fasta" from_work_dir="i1" label="${on_string} converted to ${output_fmt_cond.output_fmt_select} (1st index)">
222 <filter>idxout_cond['idxout_select']=='yes' and idxout_cond['write1st']</filter>
223 <actions>
224 <action type="format">
225 <option type="from_param" name="output_fmt_cond" param_attribute="output_fmt_select" />
226 </action>
227 </actions>
228 </data>
229 <data name="i2" format="fasta" from_work_dir="i2" label="${on_string} converted to ${output_fmt_cond.output_fmt_select} (2nd index)">
230 <filter>idxout_cond['idxout_select']=='yes' and idxout_cond['write2nd']</filter>
231 <actions>
232 <action type="format">
233 <option type="from_param" name="output_fmt_cond" param_attribute="output_fmt_select" />
234 </action>
235 </actions>
236 </data>
237 </outputs>
238 <tests>
239 <!-- tests from original Galaxy tool -->
240 <!-- 1 -->
241 <test expect_num_outputs="1">
242 <param name="input" value="samtools_fastx-in1.bam" ftype="bam" />
243 <conditional name="output_fmt_cond">
244 <param name="output_fmt_select" value="fasta" />
245 </conditional>
246 <param name="outputs" value="other" />
247 <output name="output" file="samtools_fastx-out1.fasta" ftype="fasta" />
248 </test>
249 <!-- 2 -->
250 <test expect_num_outputs="3">
251 <param name="input" value="samtools_fastx-in2.bam" ftype="bam" />
252 <conditional name="output_fmt_cond">
253 <param name="output_fmt_select" value="fastqsanger" />
254 </conditional>
255 <param name="outputs" value="r0,r1,r2" />
256 <output name="nonspecific" file="samtools_fastx-out2-1.fastq" ftype="fastqsanger" />
257 <output name="forward" file="samtools_fastx-out2-2.fastq" ftype="fastqsanger" />
258 <output name="reverse" file="samtools_fastx-out2-3.fastq" ftype="fastqsanger" />
259 </test>
260 <!-- 3 -->
261 <test expect_num_outputs="3">
262 <param name="input" value="samtools_fastx-in3.sam" ftype="sam" />
263 <conditional name="output_fmt_cond">
264 <param name="output_fmt_select" value="fasta" />
265 </conditional>
266 <param name="outputs" value="r0,r1,r2" />
267 <output name="nonspecific" file="samtools_fastx-out3-1.fasta" ftype="fasta" />
268 <output name="forward" file="samtools_fastx-out3-2.fasta" ftype="fasta" />
269 <output name="reverse" file="samtools_fastx-out3-3.fasta" ftype="fasta" />
270 </test>
271 <!-- tests from original Galaxy tool with gz output. for some reason gzip (which is used
272 for compressing stdout does not give exactly the same file contents .. the other
273 compressed files seem to)-->
274 <!-- 4 -->
275 <test expect_num_outputs="1">
276 <param name="input" value="samtools_fastx-in1.bam" ftype="bam" />
277 <conditional name="output_fmt_cond">
278 <param name="output_fmt_select" value="fasta.gz" />
279 </conditional>
280 <param name="outputs" value="other" />
281 <output name="output" file="samtools_fastx-out1.fasta.gz" ftype="fasta.gz" decompress="true"/>
282 </test>
283 <!-- 5 -->
284 <test expect_num_outputs="3">
285 <param name="input" value="samtools_fastx-in2.bam" ftype="bam" />
286 <conditional name="output_fmt_cond">
287 <param name="output_fmt_select" value="fastqsanger.gz" />
288 </conditional>
289 <param name="outputs" value="r0,r1,r2" />
290 <output name="nonspecific" file="samtools_fastx-out2-1.fastq.gz" ftype="fastqsanger.gz" decompress="true" />
291 <output name="forward" file="samtools_fastx-out2-2.fastq.gz" ftype="fastqsanger.gz" decompress="true" />
292 <output name="reverse" file="samtools_fastx-out2-3.fastq.gz" ftype="fastqsanger.gz" decompress="true" />
293 </test>
294 <!-- 6 -->
295 <test expect_num_outputs="3">
296 <param name="input" value="samtools_fastx-in3.sam" ftype="sam" />
297 <conditional name="output_fmt_cond">
298 <param name="output_fmt_select" value="fasta.gz" />
299 </conditional>
300 <param name="outputs" value="r0,r1,r2" />
301 <output name="nonspecific" file="samtools_fastx-out3-1.fasta.gz" ftype="fasta.gz" decompress="true" />
302 <output name="forward" file="samtools_fastx-out3-2.fasta.gz" ftype="fasta.gz" decompress="true" />
303 <output name="reverse" file="samtools_fastx-out3-3.fasta.gz" ftype="fasta.gz" decompress="true" />
304 </test>
305 <!-- tests from: https://github.com/samtools/samtools/blob/6d79411685d8f0fbb34e123f52d72b63271f4dcb/test/test.pl#L2313-->
306 <!--# basic 2 output test without singleton tracking-->
307 <!--test_cmd($opts, out=>'bam2fq/1.stdout.expected', out_map=>{'1.fq' => 'bam2fq/1.1.fq.expected', '2.fq' => 'bam2fq/1.2.fq.expected'},cmd=>"$$opts{bin}/samtools fastq @$threads -1 $$opts{path}/1.fq -2 $$opts{path}/2.fq $$opts{path}/dat/bam2fq.001.sam");-->
308 <!-- 7 -->
309 <test expect_num_outputs="3">
310 <param name="input" value="bam2fq.001.sam" ftype="sam" />
311 <conditional name="output_fmt_cond">
312 <param name="output_fmt_select" value="fastqsanger" />
313 </conditional>
314 <param name="outputs" value="r1,r2,other" />
315 <output name="forward" file="1.1.fq.expected" ftype="fastqsanger" />
316 <output name="reverse" file="1.2.fq.expected" ftype="fastqsanger" />
317 <output name="output" file="1.stdout.expected" ftype="fastqsanger" />
318 </test>
319 <!--# basic 2 output test with singleton tracking but no singleton-->
320 <!--test_cmd($opts, out=>'bam2fq/2.stdout.expected', out_map=>{'1.fq' => 'bam2fq/2.1.fq.expected', '2.fq' => 'bam2fq/2.2.fq.expected', 's.fq' => 'bam2fq/2.s.fq.expected'}, cmd=>"$$opts{bin}/samtools fastq @$threads -s $$opts{path}/s.fq -1 $$opts{path}/1.fq -2 $$opts{path}/2.fq $$opts{path}/dat/bam2fq.001.sam");-->
321 <!-- 8 -->
322 <test expect_num_outputs="4">
323 <param name="input" value="bam2fq.001.sam" ftype="sam" />
324 <conditional name="output_fmt_cond">
325 <param name="output_fmt_select" value="fastqsanger" />
326 </conditional>
327 <param name="outputs" value="r1,r2,s,other" />
328 <output name="forward" file="2.1.fq.expected" ftype="fastqsanger" />
329 <output name="reverse" file="2.2.fq.expected" ftype="fastqsanger" />
330 <output name="singletons" file="2.s.fq.expected" ftype="fastqsanger" />
331 <output name="output" file="2.stdout.expected" ftype="fastqsanger" />
332 </test>
333 <!--# basic 2 output test with singleton tracking with a singleton in the middle-->
334 <!--test_cmd($opts, out=>'bam2fq/2.stdout.expected', out_map=>{'1.fq' => 'bam2fq/3.1.fq.expected', '2.fq' => 'bam2fq/3.2.fq.expected', 's.fq' => 'bam2fq/3.s.fq.expected'}, cmd=>"$$opts{bin}/samtools fastq @$threads -s $$opts{path}/s.fq -1 $$opts{path}/1.fq -2 $$opts{path}/2.fq $$opts{path}/dat/bam2fq.002.sam");-->
335 <!-- 9 -->
336 <test expect_num_outputs="4">
337 <param name="input" value="bam2fq.002.sam" ftype="sam" />
338 <conditional name="output_fmt_cond">
339 <param name="output_fmt_select" value="fastqsanger" />
340 </conditional>
341 <param name="outputs" value="r1,r2,s,other" />
342 <output name="forward" file="3.1.fq.expected" ftype="fastqsanger" />
343 <output name="reverse" file="3.2.fq.expected" ftype="fastqsanger" />
344 <output name="singletons" file="3.s.fq.expected" ftype="fastqsanger" />
345 <output name="output" file="3.stdout.expected" ftype="fastqsanger" />
346 </test>
347 <!--# basic 2 output test with singleton tracking with a singleton as last read-->
348 <!--test_cmd($opts, out=>'bam2fq/2.stdout.expected', out_map=>{'1.fq' => 'bam2fq/4.1.fq.expected', '2.fq' => 'bam2fq/4.2.fq.expected', 's.fq' => 'bam2fq/4.s.fq.expected'}, cmd=>"$$opts{bin}/samtools fastq @$threads -s $$opts{path}/s.fq -1 $$opts{path}/1.fq -2 $$opts{path}/2.fq $$opts{path}/dat/bam2fq.003.sam");-->
349 <!-- 10 -->
350 <test expect_num_outputs="4">
351 <param name="input" value="bam2fq.003.sam" ftype="sam" />
352 <conditional name="output_fmt_cond">
353 <param name="output_fmt_select" value="fastqsanger" />
354 </conditional>
355 <param name="outputs" value="r1,r2,s,other" />
356 <output name="forward" file="4.1.fq.expected" ftype="fastqsanger" />
357 <output name="reverse" file="4.2.fq.expected" ftype="fastqsanger" />
358 <output name="singletons" file="4.s.fq.expected" ftype="fastqsanger" />
359 <output name="output" file="4.stdout.expected" ftype="fastqsanger" />
360 </test>
361 <!--# tag output test with singleton tracking with a singleton as last read-->
362 <!--test_cmd($opts, out=>'bam2fq/2.stdout.expected', out_map=>{'1.fq' => 'bam2fq/4.1.fq.expected', '2.fq' => 'bam2fq/4.2.fq.expected', 's.fq' => 'bam2fq/4.s.fq.expected', 'bc.fq' => 'bam2fq/bc.fq.expected'}, cmd=>"$$opts{bin}/samtools fastq @$threads \-\-barcode-tag BC \-\-index-format 'n2i2' \-\-i1 $$opts{path}/bc.fq -s $$opts{path}/s.fq -1 $$opts{path}/1.fq -2 $$opts{path}/2.fq $$opts{path}/dat/bam2fq.004.sam");-->
363 <!-- 11 -->
364 <test expect_num_outputs="5">
365 <param name="input" value="bam2fq.004.sam" ftype="sam" />
366 <conditional name="output_fmt_cond">
367 <param name="output_fmt_select" value="fastqsanger" />
368 </conditional>
369 <param name="outputs" value="r1,r2,s,other" />
370 <conditional name="idxout_cond">
371 <param name="idxout_select" value="yes"/>
372 <param name="write1st" value="true"/>
373 <param name="write2nd" value="false"/>
374 <param name="barcode_tag" value="BC"/>
375 <param name="index_format" value="n2i2"/>
376 </conditional>
377 <output name="forward" file="4.1.fq.expected" ftype="fastqsanger" />
378 <output name="reverse" file="4.2.fq.expected" ftype="fastqsanger" />
379 <output name="singletons" file="4.s.fq.expected" ftype="fastqsanger" />
380 <output name="output" file="4.stdout.expected" ftype="fastqsanger" />
381 <output name="i1" file="bc.fq.expected" ftype="fastqsanger" />
382 </test>
383 <!--# test -O flag with no OQ tags-->
384 <!--test_cmd($opts, out=>'bam2fq/2.stdout.expected', out_map=>{'1.fq' => 'bam2fq/4.1.fq.expected', '2.fq' => 'bam2fq/4.2.fq.expected', 's.fq' => 'bam2fq/4.s.fq.expected', 'bc.fq' => 'bam2fq/bc.fq.expected'}, cmd=>"$$opts{bin}/samtools fastq @$threads \-\-barcode-tag BC -O \-\-index-format 'n2i2' \-\-i1 $$opts{path}/bc.fq -s $$opts{path}/s.fq -1 $$opts{path}/1.fq -2 $$opts{path}/2.fq $$opts{path}/dat/bam2fq.004.sam");-->
385 <!-- 12 -->
386 <test expect_num_outputs="5">
387 <param name="input" value="bam2fq.004.sam" ftype="sam" />
388 <conditional name="output_fmt_cond">
389 <param name="output_fmt_select" value="fastqsanger" />
390 <param name="output_quality" value="true" />
391 </conditional>
392 <param name="outputs" value="r1,r2,s,other" />
393 <conditional name="idxout_cond">
394 <param name="idxout_select" value="yes"/>
395 <param name="write1st" value="true"/>
396 <param name="write2nd" value="false"/>
397 <param name="barcode_tag" value="BC"/>
398 <param name="index_format" value="n2i2"/>
399 </conditional>
400 <output name="forward" file="4.1.fq.expected" ftype="fastqsanger" />
401 <output name="reverse" file="4.2.fq.expected" ftype="fastqsanger" />
402 <output name="singletons" file="4.s.fq.expected" ftype="fastqsanger" />
403 <output name="output" file="4.stdout.expected" ftype="fastqsanger" />
404 <output name="i1" file="bc.fq.expected" ftype="fastqsanger" />
405 </test>
406 <!--# test -O flag with OQ tags-->
407 <!--test_cmd($opts, out=>'bam2fq/2.stdout.expected', out_map=>{'1.fq' => 'bam2fq/10.1.fq.expected', '2.fq' => 'bam2fq/10.2.fq.expected', 's.fq' => 'bam2fq/10.s.fq.expected', 'bc.fq' => 'bam2fq/bc10.fq.expected'}, cmd=>"$$opts{bin}/samtools fastq @$threads \-\-barcode-tag BC -O \-\-index-format 'n2i2' \-\-i1 $$opts{path}/bc.fq -s $$opts{path}/s.fq -1 $$opts{path}/1.fq -2 $$opts{path}/2.fq $$opts{path}/dat/bam2fq.010.sam");-->
408 <!-- 13 -->
409 <test expect_num_outputs="5">
410 <param name="input" value="bam2fq.010.sam" ftype="sam" />
411 <conditional name="output_fmt_cond">
412 <param name="output_fmt_select" value="fastqsanger" />
413 <param name="output_quality" value="true" />
414 </conditional>
415 <param name="outputs" value="r1,r2,s,other" />
416 <conditional name="idxout_cond">
417 <param name="idxout_select" value="yes"/>
418 <param name="write1st" value="true"/>
419 <param name="write2nd" value="false"/>
420 <param name="barcode_tag" value="BC"/>
421 <param name="index_format" value="n2i2"/>
422 </conditional>
423 <output name="forward" file="10.1.fq.expected" ftype="fastqsanger" />
424 <output name="reverse" file="10.2.fq.expected" ftype="fastqsanger" />
425 <output name="singletons" file="10.s.fq.expected" ftype="fastqsanger" />
426 <output name="output" file="2.stdout.expected" ftype="fastqsanger" />
427 <output name="i1" file="bc10.fq.expected" ftype="fastqsanger" />
428 </test>
429 <!--# tag output test with separators and -N flag-->
430 <!--test_cmd($opts, out=>'bam2fq/2.stdout.expected', out_map=>{'1.fq' => 'bam2fq/5.1.fq.expected', '2.fq' => 'bam2fq/5.2.fq.expected', 's.fq' => 'bam2fq/5.s.fq.expected', 'bc_split.fq' => 'bam2fq/bc_split.fq.expected'}, cmd=>"$$opts{bin}/samtools fastq @$threads \-\-barcode-tag BC -N \-\-index-format 'n*i*' \-\-i1 $$opts{path}/bc_split.fq -s $$opts{path}/s.fq -1 $$opts{path}/1.fq -2 $$opts{path}/2.fq $$opts{path}/dat/bam2fq.005.sam");-->
431 <!-- 14 -->
432 <test expect_num_outputs="5">
433 <param name="input" value="bam2fq.005.sam" ftype="sam" />
434 <conditional name="output_fmt_cond">
435 <param name="output_fmt_select" value="fastqsanger" />
436 </conditional>
437 <param name="outputs" value="r1,r2,s,other" />
438 <param name="read_numbering" value="-N"/>
439 <conditional name="idxout_cond">
440 <param name="idxout_select" value="yes"/>
441 <param name="write1st" value="true"/>
442 <param name="write2nd" value="false"/>
443 <param name="barcode_tag" value="BC"/>
444 <param name="index_format" value="n*i*"/>
445 </conditional>
446 <output name="forward" file="5.1.fq.expected" ftype="fastqsanger" />
447 <output name="reverse" file="5.2.fq.expected" ftype="fastqsanger" />
448 <output name="singletons" file="5.s.fq.expected" ftype="fastqsanger" />
449 <output name="output" file="2.stdout.expected" ftype="fastqsanger" />
450 <output name="i1" file="bc_split.fq.expected" ftype="fastqsanger" />
451 </test>
452 <!--# -t flag-->
453 <!--test_cmd($opts, out=>'bam2fq/2.stdout.expected', out_map=>{'1.fq' => 'bam2fq/6.1.fq.expected', '2.fq' => 'bam2fq/6.2.fq.expected', 's.fq' => 'bam2fq/6.s.fq.expected'}, cmd=>"$$opts{bin}/samtools fastq @$threads -N -t -s $$opts{path}/s.fq -1 $$opts{path}/1.fq -2 $$opts{path}/2.fq $$opts{path}/dat/bam2fq.005.sam");-->
454 <!-- 15 -->
455 <test expect_num_outputs="4">
456 <param name="input" value="bam2fq.005.sam" ftype="sam" />
457 <conditional name="output_fmt_cond">
458 <param name="output_fmt_select" value="fastqsanger" />
459 </conditional>
460 <param name="outputs" value="r1,r2,s,other" />
461 <param name="copy_tags" value="true" />
462 <param name="read_numbering" value="-N"/>
463 <output name="forward" file="6.1.fq.expected" ftype="fastqsanger" />
464 <output name="reverse" file="6.2.fq.expected" ftype="fastqsanger" />
465 <output name="singletons" file="6.s.fq.expected" ftype="fastqsanger" />
466 <output name="output" file="2.stdout.expected" ftype="fastqsanger" />
467 </test>
468 <!--# -T flag-->
469 <!--test_cmd($opts, out=>'bam2fq/2.stdout.expected', out_map=>{'1.fq' => 'bam2fq/7.1.fq.expected', '2.fq' => 'bam2fq/7.2.fq.expected', 's.fq' => 'bam2fq/7.s.fq.expected'}, cmd=>"$$opts{bin}/samtools fastq @$threads -N -t -T MD,ia -s $$opts{path}/s.fq -1 $$opts{path}/1.fq -2 $$opts{path}/2.fq $$opts{path}/dat/bam2fq.005.sam");-->
470 <!-- 16 -->
471 <test expect_num_outputs="4">
472 <param name="input" value="bam2fq.005.sam" ftype="sam" />
473 <conditional name="output_fmt_cond">
474 <param name="output_fmt_select" value="fastqsanger" />
475 </conditional>
476 <param name="outputs" value="r1,r2,s,other" />
477 <param name="copy_tags" value="true" />
478 <param name="copy_arb_tags" value="MD,ia" />
479 <param name="read_numbering" value="-N"/>
480 <output name="forward" file="7.1.fq.expected" ftype="fastqsanger" />
481 <output name="reverse" file="7.2.fq.expected" ftype="fastqsanger" />
482 <output name="singletons" file="7.s.fq.expected" ftype="fastqsanger" />
483 <output name="output" file="2.stdout.expected" ftype="fastqsanger" />
484 </test>
485 <!--# -i flag with no index-->
486 <!--test_cmd($opts, out=>'bam2fq/2.stdout.expected', out_map=>{'1.fq' => 'bam2fq/7.1.fq.expected', '2.fq' => 'bam2fq/7.2.fq.expected', 's.fq' => 'bam2fq/7.s.fq.expected'}, cmd=>"$$opts{bin}/samtools fastq @$threads -N -t -i -T MD,ia -s $$opts{path}/s.fq -1 $$opts{path}/1.fq -2 $$opts{path}/2.fq $$opts{path}/dat/bam2fq.005.sam");-->
487 <!-- 17 -->
488 <test expect_num_outputs="6">
489 <param name="input" value="bam2fq.005.sam" ftype="sam" />
490 <conditional name="output_fmt_cond">
491 <param name="output_fmt_select" value="fastqsanger" />
492 <param name="ilumina_casava" value="true" />
493 </conditional>
494 <param name="outputs" value="r1,r2,s,other" />
495 <conditional name="idxout_cond">
496 <param name="idxout_select" value="yes"/>
497 <param name="index_format" value="n2i2"/>
498 </conditional>
499 <param name="copy_tags" value="true" />
500 <param name="copy_arb_tags" value="MD,ia" />
501 <param name="read_numbering" value="-N"/>
502 <output name="forward" file="11.1.fq.expected" ftype="fastqsanger" />
503 <output name="reverse" file="11.2.fq.expected" ftype="fastqsanger" />
504 <output name="singletons" file="11.s.fq.expected" ftype="fastqsanger" />
505 <output name="output" file="2.stdout.expected" ftype="fastqsanger" />
506 <output name="i1" file="11.i.fq.expected" ftype="fastqsanger" />
507 <output name="i2" file="11.i2.fq.expected" ftype="fastqsanger" />
508 </test>
509 <!--# -i flag with index-->
510 <!--test_cmd($opts, out=>'bam2fq/2.stdout.expected', out_map=>{'1.fq' => 'bam2fq/8.1.fq.expected', '2.fq' => 'bam2fq/8.2.fq.expected', 's.fq' => 'bam2fq/8.s.fq.expected', 'i.fq' => 'bam2fq/8.i.fq.expected'}, cmd=>"$$opts{bin}/samtools fastq @$threads \-\-barcode-tag BC -i \-\-index-format 'n2i2' \-\-i1 $$opts{path}/i.fq -s $$opts{path}/s.fq -1 $$opts{path}/1.fq -2 $$opts{path}/2.fq $$opts{path}/dat/bam2fq.004.sam");-->
511 <!-- 18 -->
512 <test expect_num_outputs="6">
513 <param name="input" value="bam2fq.004.sam" ftype="sam" />
514 <conditional name="output_fmt_cond">
515 <param name="output_fmt_select" value="fastqsanger" />
516 <param name="ilumina_casava" value="true" />
517 </conditional>
518 <param name="outputs" value="r1,r2,s,other" />
519 <conditional name="idxout_cond">
520 <param name="idxout_select" value="yes"/>
521 <param name="write1st" value="true"/>
522 <param name="barcode_tag" value="BC"/>
523 <param name="index_format" value="n2i2"/>
524 </conditional>
525 <output name="forward" file="8.1.fq.expected" ftype="fastqsanger" />
526 <output name="reverse" file="8.2.fq.expected" ftype="fastqsanger" />
527 <output name="singletons" file="8.s.fq.expected" ftype="fastqsanger" />
528 <output name="output" file="2.stdout.expected" ftype="fastqsanger" />
529 <output name="i1" file="8.i.fq.expected" ftype="fastqsanger" />
530 <output name="i2" file="8.i2.fq.expected" ftype="fastqsanger" />
531 </test>
532 </tests>
533 <help><![CDATA[
534This tool uses `Samtools <http://www.htslib.org/>`_ to extract sequences from a
535SAM or BAM file in FASTA or FASTQ format.
536 ]]>
537 </help>
538 <expand macro="citations" />
539</tool>