BCFTOOLS VIEW

View, filter, and extract subsets from VCF/BCF files

Comma-separated sample names

BCFTOOLS VIEW

Function

bcftools view is used to filter, subset, convert, and display VCF/BCF files. It allows extraction of variants by region, chromosome, samples, and quality filters.


Input Format

  • VCF files (.vcf, .vcf.gz)
  • BCF files (.bcf)
  • Indexed files recommended for region queries

Output Format

  • Compressed VCF (.vcf.gz)
  • BCF (.bcf)
  • Optional index files (.tbi / .csi)

Applications

  • Variant filtering (PASS-only selection)
  • Region-based extraction
  • Sample subsetting
  • VCF ↔ BCF conversion
  • Pipeline preprocessing step

Example Usage

bcftools view input.vcf.gz -Oz -o output.vcf.gz
bcftools view -f PASS input.vcf.gz -Oz -o pass.vcf.gz
bcftools view -r chr1:1000-5000 input.vcf.gz -Oz -o region.vcf.gz
bcftools view -s sample1,sample2 input.vcf.gz -Oz -o subset.vcf.gz

Important Notes:
  • Region queries require indexed VCF/BCF files.
  • Sample names must match exactly.
  • BCF format is faster for large datasets.
  • PASS filtering removes low-quality variants.