upstream-extended/iuc/tools/bcftools/bcftools_query.xml
1<tool name="bcftools @EXECUTABLE@" id="bcftools_@EXECUTABLE@" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
2 <description>Extracts fields from VCF/BCF file and prints them in user-defined format</description>
3 <macros>
4 <token name="@EXECUTABLE@">query</token>
5 <import>macros.xml</import>
6 </macros>
7 <expand macro="bio_tools" />
8 <expand macro="requirements" />
9 <expand macro="version_command" />
10 <command detect_errors="aggressive"><![CDATA[
11@PREPARE_INPUT_FILES@
12#set $section = $sec_restrict
13@PREPARE_TARGETS_FILE@
14@PREPARE_REGIONS_FILE@
15
16bcftools @EXECUTABLE@
17
18## Query section
19#set $section = $sec_query
20 --format '${section.format}'
21
22${section.allow_undef_tags}
23
24${section.print_header}
25
26## Default section
27#set $section = $sec_restrict
28@INCLUDE@
29@EXCLUDE@
30@COLLAPSE@
31@REGIONS@
32@SAMPLES@
33@TARGETS@
34
35## Primary Input/Outputs
36--vcf-list @INPUT_LIST_FILE@
37> $output_file
38]]>
39 </command>
40 <inputs>
41 <expand macro="macro_inputs" />
42 <section name="sec_restrict" expanded="false" title="Restrict to">
43 <expand macro="macro_collapse" />
44 <expand macro="macro_samples" />
45 <expand macro="macro_region_restrict" />
46 <expand macro="macro_target_restrict" />
47 <expand macro="macro_include" />
48 <expand macro="macro_exclude" />
49 </section>
50 <section name="sec_query" expanded="true" title="Query Options">
51 <param name="format" type="text" value="" label="Format for Output">
52 <help>
53 <![CDATA[
54 Example: %CHROM\t%POS\t%REF\t%ALT{0}\n
55 ( NOTE TAB: '\t' and new line character: '\n' )
56 ]]>
57 </help>
58 <sanitizer sanitize="False"/>
59 <validator type="empty_field" />
60 </param>
61 <param name="tsv" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Output is tab-delimited"
62 help="Fields in your Format are separated by a TAB character: \t"/>
63 <param name="allow_undef_tags" type="boolean" truevalue="--allow-undef-tags" falsevalue="" label="Allow Undefined Tags"
64 help="Print "." for undefined tags" />
65 <param name="print_header" type="boolean" truevalue="--print-header" falsevalue="" label="Print Header Line" />
66 </section>
67
68 </inputs>
69 <outputs>
70 <data name="output_file" format="txt">
71 <change_format>
72 <when input="tsv" value="True" format="tabular" />
73 </change_format>
74 </data>
75 </outputs>
76 <tests>
77 <test>
78 <param name="input_files" ftype="vcf" value="query.vcf" />
79 <section name="sec_query">
80 <param name="format" value="%CHROM\t%POS\t%REF\t%ALT\t%DP4\t%AN[\t%GT\t%TGT]\n" />
81 <param name="tsv" value="True" />
82 </section>
83 <output name="output_file" file="query.out" />
84 </test>
85 <!-- Test region overlap option-->
86 <test>
87 <param name="input_files" ftype="vcf" value="query.vcf" />
88 <section name="sec_query">
89 <param name="format" value="%CHROM\t%POS\t%REF\t%ALT\t%DP4\t%AN[\t%GT\t%TGT]\n" />
90 <param name="tsv" value="True" />
91 </section>
92 <section name="sec_restrict">
93 <conditional name="regions">
94 <param name="regions_src" value="regions" />
95 <repeat name="region_specs">
96 <param name="chrom" value="1" />
97 </repeat>
98 </conditional>
99 </section>
100 <output name="output_file" file="query.out" compare="contains" lines_diff="4"/>
101 <assert_command>
102 <has_text text="--regions-overlap" />
103 </assert_command>
104 </test>
105 </tests>
106 <help><![CDATA[
107=====================================
108 bcftools @EXECUTABLE@
109=====================================
110
111Extracts fields from VCF/BCF file and prints them in user-defined format
112
113 Format:
114
115 ::
116
117 ``%CHROM`` The CHROM column (similarly also other columns: POS, ID, REF, ALT, QUAL, FILTER)
118 ``%INFO/TAG`` Any tag in the INFO column
119 ``%TYPE`` Variant type (REF, SNP, MNP, INDEL, OTHER)
120 ``%MASK`` Indicates presence of the site in other files (with multiple files)
121 ``%TAG{INT}`` Curly brackets to subscript vectors (0-based)
122 ``%FIRST_ALT`` Alias for %ALT{0}
123 ``[]`` The brackets loop over all samples
124 ``%GT`` Genotype (e.g. 0/1)
125 ``%TBCSQ`` Translated FORMAT/BCSQ. See the csq command above for explanation and examples.
126 ``%TGT`` Translated genotype (e.g. C/A)
127 ``%IUPACGT`` Genotype translated to IUPAC ambiguity codes (e.g. M instead of C/A)
128 ``%LINE`` Prints the whole line
129 ``%SAMPLE`` Sample name
130 ``%POS0`` POS in 0-based coordinates
131 ``%END`` End position of the REF allele
132 ``%END0`` End position of the REF allele in 0-based cordinates
133 ``\n`` new line
134 ``\t`` tab character
135
136
137 Examples:
138
139 ::
140
141 # Print chromosome, position, ref allele and the first alternate allele
142 bcftools query -f '%CHROM %POS %REF %ALT{0}\n' file.vcf.gz
143
144 # Similar to above, but use tabs instead of spaces, add sample name and genotype
145 bcftools query -f '%CHROM\t%POS\t%REF\t%ALT[\t%SAMPLE=%GT]\n' file.vcf.gz
146
147 # Print FORMAT/GT fields followed by FORMAT/GT fields
148 bcftools query -f 'GQ:[ %GQ] \t GT:[ %GT]\n' file.vcf
149
150 # Make a BED file: chr, pos (0-based), end pos (1-based), id
151 bcftools query -f'%CHROM\t%POS0\t%END\t%ID\n' file.bcf
152
153
154@COLLAPSE_HELP@
155@REGIONS_HELP@
156@TARGETS_HELP@
157@EXPRESSIONS_HELP@
158
159@BCFTOOLS_MANPAGE@#@EXECUTABLE@
160
161@BCFTOOLS_HOWTOS@
162]]>
163 </help>
164 <expand macro="citations" />
165</tool>