upstream-extended/iuc/tools/bcftools/macros.xml
1<macros>
2 <token name="@TOOL_VERSION@">1.24</token>
3 <token name="@VERSION_SUFFIX@">0</token>
4 <token name="@PROFILE@">24.1</token>
5 <xml name="bio_tools">
6 <xrefs>
7 <xref type="bio.tools">bcftools</xref>
8 </xrefs>
9 </xml>
10 <xml name="requirements">
11 <requirements>
12 <requirement type="package" version="@TOOL_VERSION@">bcftools</requirement>
13 <requirement type="package" version="1.24">htslib</requirement>
14 <yield />
15 </requirements>
16 </xml>
17 <xml name="samtools_requirement">
18 <requirement type="package" version="1.24">samtools</requirement>
19 </xml>
20 <xml name="matplotlib_requirement">
21 <requirement type="package" version="3.11.0">matplotlib</requirement>
22 </xml>
23 <xml name="version_command">
24 <version_command>bcftools 2>&1 | grep 'Version:'</version_command>
25 </xml>
26
27 <xml name="citations">
28 <citations>
29 <citation type="doi">10.1093/bioinformatics/btp352</citation>
30 <yield />
31 </citations>
32 </xml>
33 <token name="@BCFTOOLS_HOWTOS@">https://samtools.github.io/bcftools/howtos/index.html</token>
34 <token name="@BCFTOOLS_MANPAGE@">https://www.htslib.org/doc/bcftools.html</token>
35 <token name="@THREADS@">
36 --threads \${GALAXY_SLOTS:-4}
37 </token>
38 <xml name="macro_input">
39 <!--
40 REQUIRES https://github.com/galaxyproject/galaxy/pull/14605/files
41 <param name="input_files" type="data" format="vcf,vcf.gz,vcf_bgzip,bcf" label="Other VCF/BCF Datasets" multiple="True" />
42 -->
43 <param name="input_file" type="data" format="vcf,vcf_bgzip,bcf" label="VCF/BCF Data" />
44 </xml>
45 <token name="@PREPARE_INPUT_FILE@">
46<![CDATA[
47## May need to symlink input if there is an associated
48#set $input_vcf = 'input.vcf.gz'
49#if $input_file.is_of_type('vcf')
50 bgzip -c '$input_file' > $input_vcf &&
51 bcftools index $input_vcf &&
52##elif $input_file.is_of_type('vcf_bgzip') or $input_file.is_of_type('vcf.gz')
53#elif $input_file.is_of_type('vcf_bgzip')
54 ln -s '$input_file' $input_vcf &&
55 #if $input_file.metadata.tabix_index:
56 ln -s '${input_file.metadata.tabix_index}' ${input_vcf}.tbi &&
57 #else
58 bcftools index $input_vcf &&
59 #end if
60#elif $input_file.is_of_type('bcf')
61 #set $input_vcf = 'input.bcf'
62 ln -s '$input_file' $input_vcf &&
63 #if $input_file.metadata.bcf_index:
64 ln -s '${input_file.metadata.bcf_index}' ${input_vcf}.csi &&
65 #else
66 bcftools index $input_vcf &&
67 #end if
68#end if
69]]>
70 </token>
71 <token name="@INPUT_FILE@">
72$input_vcf
73 </token>
74
75 <xml name="macro_inputs">
76 <!--
77 REQUIRES https://github.com/galaxyproject/galaxy/pull/14605/files
78 <param name="input_files" type="data" format="vcf,vcf.gz,vcf_bgzip,bcf" label="Other VCF/BCF Datasets" multiple="True" />
79 -->
80 <param name="input_files" type="data" format="vcf,vcf_bgzip,bcf" label="Other VCF/BCF Datasets" multiple="True" />
81 </xml>
82 <token name="@PREPARE_INPUT_FILES@">
83<![CDATA[
84## May need to symlink input if there is an associated
85#set $input_vcfs = []
86#set $vcfs_list_file = 'vcfs_list'
87#for (i, input_file) in enumerate($input_files):
88 #set $input_vcf = 'input' + str($i) + '.vcf.gz'
89 #if $input_file.is_of_type('vcf')
90 bgzip -c '$input_file' > $input_vcf &&
91 bcftools index $input_vcf &&
92 ##elif $input_file.is_of_type('vcf_bgzip') or $input_file.is_of_type('vcf.gz') -> REQUIRES https://github.com/galaxyproject/galaxy/pull/14605
93 #elif $input_file.is_of_type('vcf_bgzip') or $input_file.is_of_type('vcf.gz')
94 ln -s '$input_file' $input_vcf &&
95 #if $input_file.metadata.tabix_index:
96 ln -s '${input_file.metadata.tabix_index}' ${input_vcf}.tbi &&
97 #else
98 bcftools index $input_vcf &&
99 #end if
100 #elif $input_file.is_of_type('bcf')
101 #set $input_vcf = 'input' + str($i) + '.bcf.gz'
102 ln -s '$input_file' $input_vcf &&
103 #if $input_file.metadata.bcf_index:
104 ln -s '${input_file.metadata.bcf_index}' ${input_vcf}.csi &&
105 #else
106 bcftools index $input_vcf &&
107 #end if
108 #end if
109 echo '$input_vcf' >> $vcfs_list_file &&
110 $input_vcfs.append($input_vcf)
111#end for
112]]>
113 </token>
114 <token name="@INPUT_FILES@">
115#echo ' '.join($input_vcfs)#
116 </token>
117 <token name="@INPUT_LIST_FILE@">
118$vcfs_list_file
119 </token>
120
121 <xml name="test_using_reference" token_select_from="history" token_ref="">
122 <conditional name="reference_source">
123 <param name="reference_source_selector" value="@SELECT_FROM@" />
124 <param name="fasta_ref" ftype="fasta" value="@REF@" />
125 </conditional>
126 </xml>
127
128 <xml name="macro_fasta_ref">
129 <conditional name="reference_source">
130 <param name="reference_source_selector" type="select" label="Choose the source for the reference genome">
131 <option value="cached">Use a built-in genome</option>
132 <option value="history">Use a genome from the history</option>
133 </param>
134 <when value="cached">
135 <param name="fasta_ref" type="select" label="Reference genome">
136 <options from_data_table="fasta_indexes">
137 <filter type="data_meta" column="dbkey" key="dbkey" ref="input_file" />
138 <validator type="no_options" message="A built-in reference genome is not available for the build associated with the selected input file" />
139 </options>
140 </param>
141 </when>
142 <when value="history">
143 <param name="fasta_ref" type="data" format="fasta" label="Reference genome" />
144 </when>
145 </conditional>
146 </xml>
147 <token name="@PREPARE_FASTA_REF@">
148<![CDATA[
149#set $input_fa_ref = None
150#if 'fasta_ref' in $section and $section.fasta_ref:
151 #if 'reference_source_selector' in $section:
152 #if str($section.reference_source_selector) == "history":
153 #set $input_fa_ref = 'ref.fa'
154 ln -s '$section.fasta_ref' $input_fa_ref &&
155 samtools faidx $input_fa_ref &&
156 #else:
157 #set $input_fa_ref = str($section.fasta_ref.fields.path)
158 #end if
159 #end if
160#end if
161]]>
162 </token>
163 <token name="@FASTA_REF@">
164#if $input_fa_ref is not None:
165 --fasta-ref $input_fa_ref
166#elif 'fasta_ref' in $section and $section.fasta_ref:
167 --fasta-ref '${section.fasta_ref}'
168#end if
169 </token>
170
171 <xml name="macro_AF_file">
172 <param argument="--AF-file" type="data" format="tabular" optional="true" label="Allele frequencies file" help="Tab-delimited file containing the columns CHR,POS,REF,ALT,AF" />
173 </xml>
174 <!-- This may need to bgzip and tabix the file -->
175 <token name="@PREPARE_AF_FILE@">
176<![CDATA[
177#if 'AF_file' in $section and $section.AF_file:
178 #pass
179#end if
180]]>
181 </token>
182 <token name="@AF_FILE@">
183#if 'AF_file' in $section and $section.AF_file:
184 --AF-file '${section.AF_file}'
185#end if
186 </token>
187
188 <xml name="macro_estimate_AF">
189 <param argument="--estimate-AF" type="data" format="data" optional="true" label="Estimate allele frequency" help="Calculate AC,AN counts on the fly, using either all samples ("-") or samples listed in <file>" />
190 </xml>
191 <token name="@ESTIMATE_AF@">
192#if 'estimate_AF' in $section and $section.estimate_AF:
193 --estimate-AF "${section.estimate_AF}"
194#end if
195 </token>
196
197 <xml name="macro_exons_file">
198 <param name="exons_file" type="data" format="tabular" optional="true" label="Exons file" help="Tab-delimited file with exons for indel frameshifts (chr,from,to; 1-based, inclusive, bgzip compressed)" />
199 </xml>
200 <token name="@PREPARE_EXONS_FILE@">
201<![CDATA[
202#set $exons_path = None
203#if 'exons_file' in $section and $section.exons_file:
204 #set $exons_path = 'exons_file.tab.gz'
205 bgzip -c "$section.exons_file" > $exons_path &&
206 tabix -s 1 -b 2 -e 3 $exons_path &&
207#end if
208]]>
209 </token>
210 <token name="@EXONS_FILE@">
211#if 'exons_file' in $section and $section.exons_file:
212 --exons $exons_path
213#end if
214 </token>
215
216 <xml name="macro_ploidy_file">
217 <param name="ploidy_file" type="data" format="tabular" optional="true" label="Ploidy file" help="Tab-delimited list of CHROM,FROM,TO,SEX,PLOIDY" />
218 </xml>
219 <token name="@PLOIDY_FILE@">
220#if 'ploidy_file' in $section and $section.ploidy_file:
221 --ploidy "${section.ploidy_file}"
222#end if
223 </token>
224
225 <xml name="macro_collapse_opt_none">
226 <option value="none">none - require the exact same set of alleles in all files</option>
227 </xml>
228 <xml name="macro_collapse_opt_id">
229 <option value="id">id - only records with identical ID column are compatible. </option>
230 </xml>
231 <xml name="macro_collapse">
232 <param name="collapse" type="select" optional="true" label="Collapse" help="Controls how to treat records with duplicate positions and defines compatible records across multiple input files">
233 <option value="snps">snps - allow different alleles, as long as they all are SNPs</option>
234 <option value="indels">indels - allow different alleles, as long as they all are indels</option>
235 <option value="both">both - indels and snps </option>
236 <option value="some">some - at least some of the ALTs must match</option>
237 <option value="any">any - any combination of alleles</option>
238 <yield/>
239 </param>
240 </xml>
241 <token name="@COLLAPSE@">
242#if $section.collapse:
243 --collapse ${section.collapse}
244#end if
245 </token>
246
247 <xml name="macro_apply_filters">
248 <param argument="--apply_filters" type="text" value="" optional="true" label="Apply filters"
249 help="Skip sites where FILTER column does not contain any of the strings listed (e.g. "PASS,.")">
250 <validator type="regex" message="FILTER terms separated by commas">^([^ \t\n\r\f\v,]+(,[^ \t\n\r\f\v,]+)*)?$</validator>
251 </param>
252 </xml>
253 <token name="@APPLY_FILTERS@">
254#if $section.apply_filters:
255 --apply-filters '${section.apply_filters}'
256#end if
257 </token>
258
259 <xml name="macro_select_output_type">
260 <param name="output_type" type="select">
261 <option value="b">compressed BCF</option>
262 <!-- no galaxy datatypes for these
263 <option value="u">uncompressed BCF</option>
264 <option value="z">compressed VCF</option>
265 -->
266 <option value="v">uncompressed VCF</option>
267 </param>
268 </xml>
269 <token name="@OUTPUT_TYPE@">
270#if str($output_type) != "__none__":
271 --output-type '${output_type}'
272#end if
273 </token>
274
275 <xml name="macro_vcf_output">
276 <data name="output_file" format="vcf">
277 <change_format>
278 <when input="output_type" value="b" format="bcf" />
279 <when input="output_type" value="u" format="bcf" />
280 <when input="output_type" value="z" format="vcf_bgzip" />
281 <when input="output_type" value="v" format="vcf" />
282 </change_format>
283 </data>
284 </xml>
285
286 <xml name="macro_invert_targets">
287 <param name="invert_targets_file" type="boolean" truevalue="^" falsevalue=""
288 label="Invert Targets"
289 help="inverts the query/filtering applied by the targets" />
290 </xml>
291
292 <xml name="macro_restriction_spec" tokens="type,label_type">
293 <repeat name="@TYPE@_specs" title="@LABEL_TYPE@ Filter" default="1" min="1">
294 <param name="chrom" type="text" label="@LABEL_TYPE@ chromosome">
295 <validator type="expression" message="A chromosome identifier is required when specifying a @LABEL_TYPE@ filter">value.strip()</validator>
296 </param>
297 <param name="start" type="text" label="@LABEL_TYPE@ start position">
298 <validator type="expression" message="an integer number is required">not value or value.isdigit()</validator>
299 </param>
300 <param name="stop" type="text" label="@LABEL_TYPE@ end position">
301 <validator type="expression" message="an integer number is required">not value or value.isdigit()</validator>
302 </param>
303 </repeat>
304 </xml>
305
306 <xml name="macro_restrictions_file" tokens="type,label_type">
307 <param name="@TYPE@s_file" type="data" format="tabular" label="@LABEL_TYPE@s File" help="restrict to @LABEL_TYPE@s listed in a file" />
308 </xml>
309
310 <xml name="__macro_restrict__" tokens="type,label_select,label_type,pos_is_default,rec_is_default">
311 <conditional name="@TYPE@s">
312 <param name="@TYPE@s_src" type="select" label="@LABEL_SELECT@">
313 <option value="__none__">Do not restrict to @LABEL_TYPE@s</option>
314 <option value="@TYPE@s">Specify one or more @LABEL_TYPE@(s) directly</option>
315 <option value="@TYPE@s_file">Operate on @LABEL_TYPE@s specified in a history dataset</option>
316 </param>
317 <when value="__none__"/>
318 <when value="@TYPE@s">
319 <expand macro="macro_restriction_spec" type="@TYPE@" label_type="@LABEL_TYPE@" />
320 <yield />
321 <param argument="--@TYPE@s-overlap" type="select" label="Consider variant calls with partial overlap with @LABEL_TYPE@(s) if ..." help="Set to 0 if the record has to have POS inside a region; set to 1 if also overlapping records with POS outside a region should be included (this includes indels with POS at the end of a region, which are technically outside the region); or set to 2 to include only true overlapping variation (compare the full VCF representation 'TA>T-' vs the true sequence variation 'A>-').">
322 <option value="0" selected="@POS_IS_DEFAULT@">0: the variant's POS falls in the region</option>
323 <option value="1" selected="@REC_IS_DEFAULT@">1: any part of the variant's representation overlaps the region</option>
324 <option value="2">2: the variant's actual sequence change falls in the region</option>
325 </param>
326 </when>
327 <when value="@TYPE@s_file">
328 <expand macro="macro_restrictions_file" type="@TYPE@" label_type="@LABEL_TYPE@" />
329 <yield />
330 <param argument="--@TYPE@s-overlap" type="select" label="@LABEL_TYPE@ overlap" help="Include if POS in the region (0), record overlaps (1), variant overlaps (2)">
331 <option value="0" selected="@POS_IS_DEFAULT@">0: POS in the region</option>
332 <option value="1" selected="@REC_IS_DEFAULT@">1: Record overlaps</option>
333 <option value="2">2: Variant overlaps</option>
334 </param>
335 </when>
336 </conditional>
337 </xml>
338
339 <xml name="__macro_restrict_simple__" tokens="type,label_select,label_type">
340 <conditional name="@TYPE@s">
341 <param name="@TYPE@s_src" type="select" label="@LABEL_SELECT@">
342 <option value="__none__">Do not restrict to @LABEL_TYPE@s</option>
343 <option value="@TYPE@s">Specify one or more @LABEL_TYPE@(s) directly</option>
344 <option value="@TYPE@s_file">Operate on @LABEL_TYPE@s specified in a history dataset</option>
345 </param>
346 <when value="__none__"/>
347 <when value="@TYPE@s">
348 <expand macro="macro_restriction_spec" type="@TYPE@" label_type="@LABEL_TYPE@" />
349 <yield />
350 </when>
351 <when value="@TYPE@s_file">
352 <expand macro="macro_restrictions_file" type="@TYPE@" label_type="@LABEL_TYPE@" />
353 <yield />
354 </when>
355 </conditional>
356 </xml>
357
358 <xml name="macro_region_restrict" token_label_select="Regions">
359 <expand macro="__macro_restrict__" type="region" label_select="@LABEL_SELECT@" label_type="Region" pos_is_default="false" rec_is_default="true" />
360 </xml>
361
362 <xml name="macro_region_restrict_simple" token_label_select="Regions">
363 <!-- To be used with subcommands that don't support the 'regions-overlap' option. Currently only mpileup? -->
364 <expand macro="__macro_restrict_simple__" type="region" label_select="@LABEL_SELECT@" label_type="Region" />
365 </xml>
366
367 <xml name="macro_target_restrict">
368 <expand macro="__macro_restrict__" type="target" label_select="Target" label_type="Target" pos_is_default="true" rec_is_default="false">
369 <expand macro="macro_invert_targets" />
370 </expand>
371 </xml>
372
373 <xml name="macro_target_restrict_simple">
374 <!-- To be used with subcommands that don't support the 'regions-overlap' option. Currently only mpileup and call? -->
375 <expand macro="__macro_restrict_simple__" type="target" label_select="Target" label_type="Target">
376 <expand macro="macro_invert_targets" />
377 </expand>
378 </xml>
379
380 <xml name="macro_mask_restrict">
381 <expand macro="__macro_restrict__" type="mask" label_select="Mask" label_type="Mask" pos_is_default="false" rec_is_default="true" />
382 </xml>
383
384 <token name="@PARSE_INTERVALS@">
385<![CDATA[
386#set $components = []
387#for $i in $intervals:
388 #set $chrom = str($i.chrom).strip()
389 #set $start = str($i.start).strip()
390 #set $stop = str($i.stop).strip()
391 #if $start or $stop:
392 $components.append($chrom + ':' + ($start or '1') + '-' + $stop)
393 #else:
394 $components.append($chrom)
395 #end if
396#end for
397#set $intervals_spec = ','.join($components)
398]]>
399 </token>
400
401 <token name="@MASK@">
402<![CDATA[
403#if $section.conditional_soft_filter.selector == 'enabled' and $section.conditional_soft_filter.soft_filter
404 #if $section.conditional_soft_filter.masks.masks_src != '__none__':
405 #if $section.conditional_soft_filter.masks.masks_src == 'masks':
406 #set $intervals = $section.conditional_soft_filter.masks.mask_specs
407 @PARSE_INTERVALS@
408 --mask '$intervals_spec'
409 #elif $section.conditional_soft_filter.masks.masks_src == 'masks_file':
410 --mask-file '$section.conditional_soft_filter.masks.masks_file'
411 #end if
412 --mask-overlap $section.conditional_soft_filter.masks_overlap
413 #end if
414#end if
415
416]]>
417 </token>
418
419 <token name="@REGIONS@">
420<![CDATA[
421#if $section.regions.regions_src != '__none__':
422 #if $section.regions.regions_src == 'regions':
423 #set $intervals = $section.regions.region_specs
424 @PARSE_INTERVALS@
425 --regions '$intervals_spec'
426 #elif $section.regions.regions_src == 'regions_file':
427 #if $regions_path is not None:
428 --regions-file '$regions_path'
429 #else:
430 --regions-file '$section.regions.regions_file'
431 #end if
432 #end if
433 #if 'regions_overlap' in $section.regions:
434 --regions-overlap $section.regions.regions_overlap
435 #end if
436#end if
437]]>
438 </token>
439
440 <token name="@TARGETS@">
441<![CDATA[
442#if $section.targets.targets_src != '__none__':
443 #if $section.targets.targets_src == 'targets':
444 #set $intervals = $section.targets.target_specs
445 @PARSE_INTERVALS@
446 --targets '${section.targets.invert_targets_file}$intervals_spec'
447 #elif $section.targets.targets_src == 'targets_file':
448 #if $targets_path:
449 --targets-file '${section.targets.invert_targets_file}${targets_path}'
450 #else:
451 --targets-file '${section.targets.invert_targets_file}${section.targets.targets_file}'
452 #end if
453 #end if
454 #if 'targets_overlap' in $section.targets:
455 --targets-overlap $section.targets.targets_overlap
456 #end if
457#end if
458]]>
459 </token>
460
461 <token name="@PREPARE_REGIONS_FILE@">
462<![CDATA[
463#set $regions_path = None
464#if 'regions' in $section
465 #if $section.regions.regions_src == 'regions_file':
466 #if $section.regions.regions_file.ext.startswith('bed'):
467 #set $regions_path = 'regions_file.bed'
468 ln -s '$section.regions.regions_file' $regions_path &&
469 #end if
470 #end if
471#end if
472]]>
473 </token>
474
475 <token name="@PREPARE_TARGETS_FILE@">
476<![CDATA[
477#set $targets_path = None
478#if 'targets' in $section
479 #if $section.targets.targets_src == 'targets_file':
480 #set $targets_path = 'targets_file.tab.gz'
481 bgzip -c "$section.targets.targets_file" > $targets_path &&
482 tabix -s 1 -b 2 -e 2 $targets_path &&
483 #end if
484#elif $section.targets_file:
485 #set $targets_path = 'targets_file.tab.gz'
486 bgzip -c "$section.targets_file" > $targets_path &&
487 tabix -s 1 -b 2 -e 2 $targets_path &&
488#end if
489]]>
490 </token>
491
492 <token name="@TARGETS_FILE@">
493<![CDATA[
494#if $targets_path is not None:
495 --targets-file "${section.invert_targets_file}${targets_path}"
496#elif $section.targets_file:
497 --targets-file "${section.invert_targets_file}${section.targets_file}"
498#end if
499]]>
500 </token>
501
502 <xml name="macro_samples">
503 <param argument="--samples" type="text" value="" optional="true" label="Samples"
504 help="Comma-separated list of samples to annotate (or exclude) or - to include all samples">
505 <validator type="regex" message="Comma-separated list of samples or - to include all samples">^(-|\w+(,\w+)*)?$</validator>
506 </param>
507 <param name="invert_samples" type="boolean" truevalue="^" falsevalue="" checked="false" label="Invert Samples"
508 help="Inverts the query/filtering applied by Samples (adds "^" prefix to exclude)" />
509 <param argument="--samples_file" type="data" format="tabular" optional="true" label="Samples file" help="File of samples to include" />
510 <param name="invert_samples_file" type="boolean" truevalue="^" falsevalue="" checked="false" label="Invert Samples file"
511 help="inverts the query/filtering applied by Samples file" />
512 </xml>
513
514 <xml name="macro_samples_enhanced" token_all_samples="" token_file_help="File listing samples to include one per line.">
515 <conditional name="specify_samples">
516 <param name="how" type="select" label="How do you want to select samples?">
517 <option value="-s">Specify samples manually</option>
518 <option value="-S">Provide sample file</option>
519 <option value="@ALL_SAMPLES@" selected="true">No selection; just use all samples found in input</option>
520 </param>
521 <when value="-s">
522 <param argument="--samples" name="samples_spec" type="text" optional="false" label="Sample(s)" help="Specify a single sample by name or a comma-separated list of sample names.">
523 <validator type="expression" message="Please specify a single sample by name or a comma-separated list of sample names">value.strip() and value[0] not in "^," and ",," not in value</validator>
524 </param>
525 <param name="invert_samples" type="boolean" truevalue="^" falsevalue="" label="Exclude these samples instead of including them?" help="Equivalent to prefixing the list of samples with "^" on the command line."/>
526 </when>
527 <when value="-S">
528 <param argument="--samples_file" type="data" format="tabular" optional="@IS_OPTIONAL@" label="Samples file" help="@FILE_HELP@" />
529 <param name="invert_samples" type="boolean" truevalue="^" falsevalue="" label="Exclude the samples listed in the file instead of including them?" help="Equivalent to prefixing the file with "^" on the command line."/>
530 </when>
531 <when value="@ALL_SAMPLES@" />
532 </conditional>
533 </xml>
534 <token name="@SAMPLES@">
535#set $samples_defined = False
536#if str($section.samples) != '':
537 #set $samples_defined = True
538 --samples '${section.invert_samples}${section.samples}'
539#end if
540#if $section.samples_file:
541 #set $samples_defined = True
542 --samples-file "${section.invert_samples_file}${section.samples_file}"
543#end if
544 </token>
545
546 <xml name="macro_sample" token_help="Apply variants of the given sample">
547 <param name="sample" type="text" optional="true" label="Sample" help="@HELP@" />
548 </xml>
549 <token name="@SAMPLE@">
550#if $section.sample:
551 --sample '${section.sample}'
552#end if
553 </token>
554
555 <xml name="macro_include_exclude_validate_sanitize">
556 <validator type="expression" message="Single quote or trailing backslash not allowed">"'" not in value and value[-1] != "\\"</validator>
557 <sanitizer>
558 <valid initial="string.ascii_letters,string.digits,string.whitespace,string.punctuation">
559 <remove value="@" />
560 <remove value="'" />
561 </valid>
562 </sanitizer>
563 </xml>
564
565 <xml name="macro_include">
566 <param argument="--include" type="text" optional="true" label="Include" help="Select sites for which the expression is true">
567 <expand macro="macro_include_exclude_validate_sanitize" />
568 </param>
569 </xml>
570 <token name="@INCLUDE@">
571#if $section.include:
572 --include '${section.include}'
573#end if
574 </token>
575
576 <xml name="macro_exclude">
577 <param argument="--exclude" type="text" optional="true" label="Exclude" help="Exclude sites for which the expression is true">
578 <expand macro="macro_include_exclude_validate_sanitize" />
579 </param>
580 </xml>
581 <token name="@EXCLUDE@">
582#if $section.exclude:
583 --exclude '${section.exclude}'
584#end if
585 </token>
586
587 <xml name="macro_columns">
588 <param name="columns" type="text" value="" optional="true" label="Columns"
589 help="List of columns in the annotation file, e.g. CHROM,POS,REF,ALT,-,INFO/TAG. See man page for details">
590 <validator type="regex" message="COLUMN names separated by commas">^([^,]+(,[^,]+)*)?$</validator>
591 </param>
592 </xml>
593 <token name="@COLUMNS@">
594#if $section.columns != '':
595 --columns '${section.columns}'
596#end if
597 </token>
598
599 <xml name="macro_haploid2diploid">
600 <param name="haploid2diploid" type="boolean" truevalue="--haploid2diploid" falsevalue="" label="Haploid2Diploid" help="convert haploid genotypes to diploid homozygotes" />
601 </xml>
602
603 <xml name="macro_vcf_ids">
604 <param name="vcf_ids" type="boolean" truevalue="--vcf-ids" falsevalue="" label="Vcf Ids" help="output VCF IDs instead of CHROM:POS_REF_ALT" />
605 </xml>
606 <token name="@VCF_IDS@">
607${section.vcf_ids}
608 </token>
609
610<xml name="macro_output_tags">
611 <param name="output_tags" argument="--annotate" type="select" optional="true" multiple="True" display="checkboxes" label="Optional tags to output" help="--annotate">
612 <yield />
613 </param>
614</xml>
615
616<xml name="macro_overlap" token_argument="" token_label="">
617</xml>
618
619
620 <token name="@OUTPUT_HELP@">
621
622 <![CDATA[
623Output Type
624-----------
625
626Output compressed BCF (b), or uncompressed VCF (v).
627Use the BCF option when piping between bcftools subcommands to speed up
628performance by removing unecessary compression/decompression
629and VCF<->BCF conversion.
630
631This Galaxy tool recommends using the compressed BCF format
632as piping is not implemented, and uncompressed data would
633use unnecessary amounts of space.
634 ]]></token>
635 <token name="@REGIONS_HELP@">
636 <![CDATA[
637Region Selections
638-----------------
639
640Regions can be specified in a VCF,
641BED, or tab-delimited file (the default). The columns of the
642tab-delimited file are: CHROM, POS, and, optionally, POS_TO,
643where positions are 1-based and inclusive. Uncompressed
644files are stored in memory, while bgzip-compressed and
645tabix-indexed region files are streamed. Note that sequence
646names must match exactly, "chr20" is not the same as "20".
647Also note that chromosome ordering in FILE will be
648respected, the VCF will be processed in the order in which
649chromosomes first appear in FILE. However, within
650chromosomes, the VCF will always be processed in ascending
651genomic coordinate order no matter what order they appear in
652FILE. Note that overlapping regions in FILE can result in
653duplicated out of order positions in the output. This option
654requires indexed VCF/BCF files.
655 ]]></token>
656 <token name="@TARGETS_HELP@"><![CDATA[
657Targets
658-------
659
660Similar to regions, but the next position is accessed by streaming the whole
661VCF/BCF rather than using the tbi/csi index. Both regions and targets options can be
662applied simultaneously: regions uses the index to jump to a region and targets discards
663positions which are not in the targets. Unlike regions, targets can be prefixed with
664"^" to request logical complement. For example, "^X,Y,MT" indicates that
665sequences X, Y and MT should be skipped. Yet another difference between the two
666is that regions checks both start and end positions of indels, whereas targets checks
667start positions only.
668
669For the bcftools call command, with the option -C alleles, third column of the
670targets file must be comma-separated list of alleles, starting with the
671reference allele. Note that the file must be compressed and index. Such a file
672can be easily created from a VCF using::
673
674 bcftools query -f'%CHROM\t%POS\t%REF,%ALT\n' file.vcf | bgzip -c > als.tsv.gz && tabix -s1 -b2 -e2 als.tsv.gz
675 ]]>
676 <!-- TODO: galaxy-ify -->
677 </token>
678
679
680 <token name="@COLLAPSE_HELP@">
681Collapse
682--------
683
684Controls how to treat records with duplicate positions and defines compatible
685records across multiple input files. Here by "compatible" we mean records which
686should be considered as identical by the tools. For example, when performing
687line intersections, the desire may be to consider as identical all sites with
688matching positions (bcftools isec -c all), or only sites with matching variant
689type (bcftools isec -c snps -c indels), or only sites with all alleles
690identical (bcftools isec -c none).
691
692
693+------------+----------------------------------------------------------------+
694| Flag value | Result |
695+============+================================================================+
696| none | only records with identical REF and ALT alleles are compatible |
697+------------+----------------------------------------------------------------+
698| some | only records where some subset of ALT alleles match are |
699| | compatible |
700+------------+----------------------------------------------------------------+
701| all | all records are compatible, regardless of whether the ALT |
702| | alleles match or not. In the case of records with the same |
703| | position, only the first wil lbe considered and appear on |
704| | output. |
705+------------+----------------------------------------------------------------+
706| snps | any SNP records are compatible, regardless of whether the ALT |
707| | alleles match or not. For duplicate positions, only the first |
708| | SNP record will be considered and appear on output. |
709+------------+----------------------------------------------------------------+
710| indels | all indel records are compatible, regardless of whether the |
711| | REF and ALT alleles match or not. For duplicate positions, |
712| | only the first indel record will be considered and appear on |
713| | output. |
714+------------+----------------------------------------------------------------+
715| both | abbreviation of "-c indels -c snps" |
716+------------+----------------------------------------------------------------+
717| id | only records with identical ID column are compatible. |
718| | Supportedby bcftools merge only. |
719+------------+----------------------------------------------------------------+
720 </token>
721
722 <token name="@EXPRESSIONS_HELP@">
723 <![CDATA[
724Expressions
725-----------
726
727Valid expressions may contain:
728
729- numerical constants, string constants
730
731 ::
732
733 1, 1.0, 1e-4
734 "String"
735
736- arithmetic operators
737
738 ::
739
740 +,*,-,/
741
742- comparison operators
743
744 ::
745
746 == (same as =), >, >=, <=, <, !=
747
748- regex operators "~" and its negation "!~"
749
750 ::
751
752 INFO/HAYSTACK ~ "needle"
753
754- parentheses
755
756 ::
757
758 (, )
759
760- logical operators
761
762 ::
763
764 && (same as &), ||, |
765
766- INFO tags, FORMAT tags, column names
767
768 ::
769
770 INFO/DP or DP
771 FORMAT/DV, FMT/DV, or DV
772 FILTER, QUAL, ID, REF, ALT[0]
773
774- 1 (or 0) to test the presence (or absence) of a flag
775
776 ::
777
778 FlagA=1 && FlagB=0
779
780- "." to test missing values
781
782 ::
783
784 DP=".", DP!=".", ALT="."
785
786- missing genotypes can be matched regardless of phase and ploidy (".|.", "./.", ".") using this expression
787
788 ::
789
790 GT="."
791
792- TYPE for variant type in REF,ALT columns (indel,snp,mnp,ref,other)
793
794 ::
795
796 TYPE="indel" | TYPE="snp"
797
798- array subscripts, "*" for any field
799
800 ::
801
802 (DP4[0]+DP4[1])/(DP4[2]+DP4[3]) > 0.3
803 DP4[*] == 0
804 CSQ[*] ~ "missense_variant.*deleterious"
805
806- function on FORMAT tags (over samples) and INFO tags (over vector fields)
807
808 ::
809
810 MAX, MIN, AVG, SUM, STRLEN, ABS
811
812- variables calculated on the fly if not present: number of alternate alleles; number of samples; count of alternate alleles; minor allele count (similar to AC but is always smaller than 0.5); frequency of alternate alleles (AF=AC/AN); frequency of minor alleles (MAF=MAC/AN); number of alleles in called genotypes
813
814 ::
815
816 N_ALT, N_SAMPLES, AC, MAC, AF, MAF, AN
817
818**Notes:**
819
820- String comparisons and regular expressions are case-insensitive
821- If the subscript "*" is used in regular expression search, the whole field
822 is treated as one string. For example, the regex ``STR[*]~"B,C"`` will be
823 true for the string vector INFO/STR=AB,CD.
824- Variables and function names are case-insensitive, but not tag names. For
825 example, "qual" can be used instead of "QUAL", "strlen()" instead of
826 "STRLEN()" , but not "dp" instead of "DP".
827
828**Examples:**
829
830 ::
831
832 MIN(DV)>5
833 MIN(DV/DP)>0.3
834 MIN(DP)>10 & MIN(DV)>3
835 FMT/DP>10 & FMT/GQ>10 .. both conditions must be satisfied within one sample
836 FMT/DP>10 && FMT/GQ>10 .. the conditions can be satisfied in different samples
837 QUAL>10 | FMT/GQ>10 .. selects only GQ>10 samples
838 QUAL>10 || FMT/GQ>10 .. selects all samples at QUAL>10 sites
839 TYPE="snp" && QUAL>=10 && (DP4[2]+DP4[3] > 2)
840 MIN(DP)>35 && AVG(GQ)>50
841 ID=@file .. selects lines with ID present in the file
842 ID!=@~/file .. skip lines with ID present in the ~/file
843 MAF[0]<0.05 .. select rare variants at 5% cutoff
844 ]]></token>
845</macros>