Use when extracting and formatting specific fields from compressed VCF files, querying variants by region, or generating custom tabular output with genotype and INFO data.
vcf-query [OPTIONS] file.vcf.gz/home/vimalinx/miniforge3/envs/bio/bin/vcf-queryreferences/help.md.vcf.gz.bcftools query.# 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'
-l if the file provenance is unclear.%INFO/TAG, %GT, %SAMPLE, and bracket loops when sample iteration is needed.-r only when the file is properly indexed.bcftools query for durable pipelines.-f if you want predictable output.-c/--columns can take either a comma-separated list or a file of one column name per line.