vcf-query
Quick Start
- Command:
vcf-query [OPTIONS] file.vcf.gz - Local executable:
/home/vimalinx/miniforge3/envs/bio/bin/vcf-query - Full reference: See
references/help.md
When To Use This Tool
- Extract selected VCF fields into a custom tabular report.
- Loop over per-sample genotype fields with bracket expressions.
- Run quick region-restricted queries on an indexed
.vcf.gz. - Keep using it only if you already depend on the vcftools Perl utility; for new workflows, prefer
bcftools query.
Common Patterns
# 1) Extract core variant fields plus depth
vcf-query \
file.vcf.gz \
-f '%CHROM\t%POS\t%REF\t%ALT\t%INFO/DP\n'
# 2) Emit per-sample genotype information
vcf-query \
file.vcf.gz \
-f '%CHROM:%POS[\t%SAMPLE=%GT]\n'
# 3) Restrict output to a region
vcf-query \
file.vcf.gz \
-r 1:1000-2000 \
-f '%CHROM\t%POS\t%FILTER\n'
Recommended Workflow
- Start by listing available columns with
-lif the file provenance is unclear. - Build the output format string deliberately with
%INFO/TAG,%GT,%SAMPLE, and bracket loops when sample iteration is needed. - Restrict to a genomic interval with
-ronly when the file is properly indexed. - Redirect output to a file or pipe it into downstream table-processing tools.
Guardrails
- Input files are expected to be compressed VCFs, and region queries require tabix indexing.
- This script is explicitly marked upstream as not being supported in the future; prefer
bcftools queryfor durable pipelines. - The default format string already loops over samples, so be explicit with
-fif you want predictable output. -c/--columnscan take either a comma-separated list or a file of one column name per line.