upstream-extended/iuc/tools/bcftools/bcftools_view.xml
1<tool name="bcftools @EXECUTABLE@" id="bcftools_@EXECUTABLE@" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
2 <description>VCF/BCF conversion, view, subset and filter VCF/BCF files</description>
3 <macros>
4 <token name="@EXECUTABLE@">view</token>
5 <import>macros.xml</import>
6 <xml name="macro_types_options">
7 <option value="snps">snps</option>
8 <option value="indels">indels</option>
9 <option value="mnps">mnps</option>
10 <option value="other">other</option>
11 </xml>
12 </macros>
13 <expand macro="bio_tools" />
14 <expand macro="requirements" />
15 <expand macro="version_command" />
16 <command detect_errors="aggressive"><![CDATA[
17@PREPARE_INPUT_FILE@
18#set $section = $sec_restrict
19@PREPARE_TARGETS_FILE@
20@PREPARE_REGIONS_FILE@
21
22bcftools @EXECUTABLE@
23
24## Subset section
25#set $section = $sec_subset
26${section.trim_alt_alleles}
27${section.no_update}
28@SAMPLES@
29${section.force_samples}
30
31
32## Filter section
33#set $section = $sec_filter
34#if str($section.min_ac)
35 --min-ac ${section.min_ac}
36#end if
37#if str($section.max_ac)
38 --max-ac ${section.max_ac}
39#end if
40#if str($section.select_genotype) != "None":
41 --genotype "${section.select_genotype}"
42#end if
43## known or novel
44#if $section.known_or_novel:
45 ${section.known_or_novel}
46#end if
47#if str($section.min_alleles)
48 --min-alleles ${section.min_alleles}
49#end if
50#if str($section.max_alleles)
51 --max-alleles ${section.max_alleles}
52#end if
53#if $section.phased:
54 ${section.phased}
55#end if
56#if str($section.min_af)
57 --min-af ${section.min_af}
58#end if
59#if str($section.max_af)
60 --max-af ${section.max_af}
61#end if
62#if $section.uncalled:
63 ${section.uncalled}
64#end if
65#if $section.types:
66 --types "${section.types}"
67#end if
68#if $section.exclude_types:
69 --exclude-types "${section.exclude_types}"
70#end if
71#if $section.private:
72 ${section.private}
73#end if
74
75## Output section
76#set $section = $sec_output
77${section.drop_genotypes}
78#if $section.header:
79 ${section.header}
80#end if
81#if str($section.compression_level)
82 --compression-level ${section.compression_level}
83#end if
84
85#set $section = $sec_restrict
86@APPLY_FILTERS@
87@INCLUDE@
88@EXCLUDE@
89@REGIONS@
90@TARGETS@
91
92@OUTPUT_TYPE@
93@THREADS@
94
95## Primary Input/Outputs
96@INPUT_FILE@
97> '$output_file'
98]]>
99 </command>
100 <inputs>
101 <expand macro="macro_input" />
102 <section name="sec_restrict" expanded="false" title="Restrict to">
103 <expand macro="macro_apply_filters" />
104 <expand macro="macro_region_restrict" />
105 <expand macro="macro_target_restrict" />
106 <expand macro="macro_include" />
107 <expand macro="macro_exclude" />
108 </section>
109 <section name="sec_subset" expanded="false" title="Subset Options">
110 <expand macro="macro_samples" />
111 <param name="force_samples" type="boolean" truevalue="--force-samples" falsevalue="" label="Force Samples"
112 help="Only warn about unknown subset samples" />
113 <param name="no_update" type="boolean" truevalue="--no-update" falsevalue="" label="No Update"
114 help="Do not (re)calculate INFO fields for the subset (currently INFO/AC and INFO/AN)" />
115 <param name="trim_alt_alleles" type="boolean" truevalue="--trim-alt-alleles" falsevalue="" label="Trim Alt Alleles"
116 help="Trim alternate alleles not seen in the subset" />
117 </section>
118 <section name="sec_filter" expanded="false" title="Filter Options">
119 <param name="min_ac" type="integer" label="Min Ac" optional="True"
120 help="(-c --min-ac) Minimum count for non-reference (nref), 1st alternate (alt1), least frequent (minor), most frequent (major) or sum of all but most frequent (nonmajor) alleles" />
121 <param name="max_ac" type="integer" label="Max Ac" optional="True"
122 help="(-C --max-ac) Maximum count for non-reference (nref), 1st alternate (alt1), least frequent (minor), most frequent (major) or sum of all but most frequent (nonmajor) alleles" />
123 <param name="select_genotype" type="select" label="Select Genotype" optional="True">
124 <help>
125 Include only sites with one or more homozygous (hom), heterozygous (het) or missing (miss) genotypes.
126 When prefixed with ^, the logic is reversed.
127 Please notice that if the input file doesn't have any genotype columns,
128 then this option is ignored altogether.
129 </help>
130 <option value="hom">hom</option>
131 <option value="het">het</option>
132 <option value="miss">miss</option>
133 <option value="^hom">^hom</option>
134 <option value="^het">^het</option>
135 <option value="^miss">^miss</option>
136 </param>
137 <param name="types" type="select" label="Select Types" multiple="true" optional="True">
138 <help>
139 List of variant types to select. Site is selected if any of the ALT alleles is of the type requested.
140 Types are determined by comparing the REF and ALT alleles in the VCF record.
141 </help>
142 <expand macro="macro_types_options" />
143 </param>
144
145 <param name="exclude_types" type="select" label="Exclude Types" multiple="true" optional="True">
146 <help>
147 List of variant types to exclude. Site is excluded if any of the ALT alleles is of the type requested.
148 Types are determined by comparing the REF and ALT alleles in the VCF record.
149 </help>
150 <expand macro="macro_types_options" />
151 </param>
152
153
154 <param name="known_or_novel" type="select" label="filter known or novel ID" optional="true">
155 <option value="--novel">(-k) print novel sites only (ID column is ".")</option>
156 <option value="--known">(-n) print known sites only (ID column is not ".")</option>
157 </param>
158
159 <param name="min_alleles" type="integer" label="Min Alleles" optional="True"
160 help="(-m) Minimum number of alleles listed in REF and ALT (e.g. -m2)" />
161 <param name="max_alleles" type="integer" label="Max Alleles" optional="True"
162 help="(-M) Maximum number of alleles listed in REF and ALT (e.g. -M2 for biallelic sites)" />
163
164 <param name="phased" type="select" label="filter phased" optional="true">
165 <help>
166 Haploid genotypes are considered phased. Missing genotypes considered unphased unless the phased bit is set.
167 </help>
168 <option value="--phased">(-p) print sites where all samples are phased</option>
169 <option value="--exclude-phased">(-P) exclude sites where all samples are phased</option>
170 </param>
171
172 <!-- TODO optional select for type: nref,alt1,minor,major,sum -->
173 <param name="min_af" type="float" label="Min Af" optional="True"
174 help="(-q) Minimum frequency for non-reference (nref), 1st alternate (alt1), least frequent (minor), most frequent (major) or sum of all but most frequent (nonmajor) alleles" />
175 <param name="max_af" type="float" label="Max Af" optional="True"
176 help="(-Q) Maximum frequency for non-reference (nref), 1st alternate (alt1), least frequent (minor), most frequent (major) or sum of all but most frequent (nonmajor) alleles" />
177
178 <param name="uncalled" type="select" label="filter on genotype uncalled" optional="true">
179 <option value="--uncalled">uncalled - print sites without a called genotype</option>
180 <option value="--exclude-uncalled">exclude-uncalled - exclude sites without a called genotype</option>
181 </param>
182
183 <param name="private" type="select" label="filter on private" optional="true">
184 <help><![CDATA[
185 Private: Where only the subset samples carry an non-reference allele.
186 ( Ignored if samples are not included )
187 ]]></help>
188 <option value="--private">(-x) private - print sites where only the subset samples carry an non-reference allele</option>
189 <option value="--exclude-private">(-X) exclude-private - exclude sites where only the subset samples carry an non-reference allele</option>
190 </param>
191
192 </section>
193
194 <section name="sec_output" expanded="false" title="Output Options">
195 <param name="drop_genotypes" type="boolean" truevalue="--drop-genotypes" falsevalue="" label="Drop Genotypes"
196 help="Drop individual genotype information (after subsetting if -s option set)" />
197 <param name="header" type="select" label="output header" optional="true">
198 <option value="--no-header">(-h) no-header</option>
199 <option value="--header-only">(-H) header-only</option>
200 </param>
201 <param name="compression_level" type="integer" min="0" max="9" label="Compression Level" optional="True"
202 help="Compression level: 0 uncompressed, 1 best speed, 9 best compression" />
203 </section>
204 <expand macro="macro_select_output_type" />
205 </inputs>
206 <outputs>
207 <expand macro="macro_vcf_output" />
208 </outputs>
209 <tests>
210 <test>
211 <param name="input_file" ftype="vcf" value="view.vcf" />
212 <section name="sec_filter">
213 <param name="min_ac" value="1" />
214 <param name="max_ac" value="1" />
215 <param name="types" value="snps" />
216 </section>
217 <section name="sec_subset">
218 <param name="samples" value="NA00002" />
219 </section>
220 <param name="output_type" value="v" />
221 <output name="output_file">
222 <assert_contents>
223 <has_text text="rs2298108" />
224 <not_has_text text="rs6111385" />
225 </assert_contents>
226 </output>
227 </test>
228 <test>
229 <param name="input_file" ftype="bcf" value="view.bcf" />
230 <section name="sec_filter">
231 <param name="min_ac" value="1" />
232 <param name="max_ac" value="1" />
233 <param name="types" value="snps" />
234 </section>
235 <section name="sec_subset">
236 <param name="samples" value="NA00002" />
237 </section>
238 <param name="output_type" value="v" />
239 <output name="output_file">
240 <assert_contents>
241 <has_text text="rs2298108" />
242 <not_has_text text="rs6111385" />
243 </assert_contents>
244 </output>
245 </test>
246 <test>
247 <param name="input_file" ftype="vcf" value="view.vcf" />
248 <section name="sec_filter">
249 <param name="known_or_novel" value="--novel" />
250 <param name="private" value="--exclude-private" />
251 </section>
252 <section name="sec_subset">
253 <param name="samples" value="NA00003" />
254 </section>
255 <section name="sec_restrict">
256 <conditional name="regions">
257 <param name="regions_src" value="regions"/>
258 <repeat name="region_specs">
259 <param name="chrom" value="Y" />
260 <param name="start" value="20" />
261 </repeat>
262 </conditional>
263 </section>
264 <param name="output_type" value="v" />
265 <output name="output_file">
266 <assert_contents>
267 <has_text text="8657215" />
268 <not_has_text text="rs6111385" />
269 </assert_contents>
270 </output>
271 <assert_command>
272 <has_text text="--regions 'Y:20-'"/>
273 </assert_command>
274 </test>
275 <test>
276 <param name="input_file" ftype="vcf" value="view.vcf" />
277 <section name="sec_filter">
278 <param name="known_or_novel" value="--known" />
279 <param name="private" value="--exclude-private" />
280 </section>
281 <section name="sec_subset">
282 <param name="samples" value="NA00003" />
283 </section>
284 <section name="sec_restrict">
285 <param name="apply_filters" value="PASS" />
286 <conditional name="regions">
287 <param name="regions_src" value="regions"/>
288 <repeat name="region_specs">
289 <param name="chrom" value="Y" />
290 <param name="start" value="20" />
291 </repeat>
292 </conditional>
293 </section>
294 <param name="output_type" value="v" />
295 <output name="output_file">
296 <assert_contents>
297 <has_text text="Minimum number of alternate bases" />
298 <not_has_text text="8657215" />
299 </assert_contents>
300 </output>
301 </test>
302 <test>
303 <param name="input_file" ftype="vcf" value="view.vcf" />
304 <section name="sec_filter">
305 <param name="private" value="--private" />
306 </section>
307 <section name="sec_subset">
308 <param name="samples" value="NA00003" />
309 </section>
310 <param name="output_type" value="v" />
311 <output name="output_file">
312 <assert_contents>
313 <has_text text="rs62584840" />
314 <not_has_text text="8657215" />
315 </assert_contents>
316 </output>
317 </test>
318 <test>
319 <param name="input_file" ftype="vcf" value="view.vcf" />
320 <section name="sec_restrict">
321 <param name="include" value="QUAL==999 && (FS<20 || FS>=41.02) && ICF>-0.1 && HWE*2>1.2" />
322 </section>
323 <param name="output_type" value="v" />
324 <output name="output_file">
325 <assert_contents>
326 <has_text text="rs5939407" />
327 <not_has_text text="8657215" />
328 </assert_contents>
329 </output>
330 </test>
331 <test>
332 <param name="input_file" ftype="vcf" value="view.vcf" />
333 <section name="sec_filter">
334 <param name="phased" value="--phased" />
335 </section>
336 <param name="output_type" value="v" />
337 <output name="output_file">
338 <assert_contents>
339 <has_text text="rs78249411" />
340 <not_has_text text="rs6111385" />
341 </assert_contents>
342 </output>
343 </test>
344 <test>
345 <param name="input_file" ftype="vcf" value="view.vcf" />
346 <section name="sec_filter">
347 <param name="phased" value="--exclude-phased" />
348 </section>
349 <param name="output_type" value="v" />
350 <output name="output_file">
351 <assert_contents>
352 <has_text text="rs6111385" />
353 <not_has_text text="rs78249411" />
354 </assert_contents>
355 </output>
356 </test>
357 <test>
358 <param name="input_file" ftype="vcf" value="view.vcf" />
359 <section name="sec_filter">
360 <param name="min_alleles" value="2" />
361 <param name="max_alleles" value="2" />
362 <param name="min_af" value="0.3" />
363 <param name="max_af" value="0.7" />
364 </section>
365 <section name="sec_output">
366 <param name="header" value="--header-only" />
367 </section>
368 <param name="output_type" value="v" />
369 <output name="output_file">
370 <assert_contents>
371 <has_text text="##bcftools_viewCommand" />
372 <not_has_text text="rs78249411" />
373 </assert_contents>
374 </output>
375 </test>
376 <test>
377 <param name="input_file" ftype="vcf" value="view.vcf" />
378 <section name="sec_filter">
379 <param name="uncalled" value="--uncalled" />
380 </section>
381 <section name="sec_output">
382 <param name="header" value="--no-header" />
383 </section>
384 <param name="output_type" value="v" />
385 <output name="output_file">
386 <assert_contents>
387 <not_has_text text="##bcftools_viewCommand" />
388 <has_text text="5464562" />
389 </assert_contents>
390 </output>
391 </test>
392 <test>
393 <param name="input_file" ftype="vcf" value="view.vcf" />
394 <section name="sec_filter">
395 <param name="exclude_types" value="snps" />
396 </section>
397 <section name="sec_output">
398 <param name="drop_genotypes" value="true" />
399 </section>
400 <param name="output_type" value="v" />
401 <output name="output_file">
402 <assert_contents>
403 <not_has_text text="##FORMAT=<ID=GT" />
404 <not_has_text text="rs62584840" />
405 <has_text text="2343543" />
406 </assert_contents>
407 </output>
408 </test>
409 <test>
410 <param name="input_file" ftype="vcf" value="view.vcf" />
411 <section name="sec_filter">
412 <param name="phased" value="--phased" />
413 <param name="select_genotype" value="^het" />
414 </section>
415 <param name="output_type" value="v" />
416 <output name="output_file">
417 <assert_contents>
418 <has_text text="--genotype ^het" />
419 <has_text text="rs78249411" />
420 <not_has_text text="3048719" />
421 </assert_contents>
422 </output>
423 </test>
424 <!-- Test region overlap option -->
425 <test>
426 <param name="input_file" ftype="vcf" value="view.vcf" />
427 <section name="sec_filter">
428 <param name="min_ac" value="1" />
429 <param name="max_ac" value="1" />
430 <param name="types" value="snps" />
431 </section>
432 <section name="sec_subset">
433 <param name="samples" value="NA00002" />
434 </section>
435 <param name="output_type" value="v" />
436 <section name="sec_restrict">
437 <conditional name="regions">
438 <param name="regions_src" value="regions" />
439 <repeat name="region_specs">
440 <param name="chrom" value="20" />
441 </repeat>
442 </conditional>
443 </section>
444 <output name="output_file">
445 <assert_contents>
446 <has_text text="rs2298108" />
447 <not_has_text text="rs6111385" />
448 </assert_contents>
449 </output>
450 <assert_command>
451 <has_text text="--regions-overlap" />
452 </assert_command>
453 </test>
454 </tests>
455 <help><![CDATA[
456=====================================
457 bcftools @EXECUTABLE@
458=====================================
459
460VCF/BCF conversion, view, subset and filter VCF/BCF files.
461
462@REGIONS_HELP@
463@TARGETS_HELP@
464@EXPRESSIONS_HELP@
465
466@BCFTOOLS_MANPAGE@#@EXECUTABLE@
467
468@BCFTOOLS_HOWTOS@
469]]>
470 </help>
471 <expand macro="citations" />
472</tool>