BCFTOOLS FILTER

Apply quality filters and expression-based variant filtering

BCFTOOLS FILTER

Function

bcftools filter applies expressions to retain or remove variants based on quality, depth, and other annotations. It supports both hard filtering (remove variants) and soft filtering (tag in FILTER column).


Input Format

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

Output Format

  • Filtered VCF (.vcf.gz)
  • Filtered BCF (.bcf)
  • Soft-filtered annotations or removed variants

Applications

  • Quality-based variant filtering
  • Depth and mapping quality filtering
  • Removal of low-confidence variants
  • Soft filtering for downstream review
  • Pre-processing for variant analysis pipelines

Example Usage

bcftools filter -i 'QUAL>30' input.vcf.gz -Oz -o filtered.vcf.gz
bcftools filter -i 'DP>10 && QUAL>20' input.vcf.gz -Oz -o filtered.vcf.gz
bcftools filter -s LowQual -e 'QUAL<20' input.vcf.gz -Oz -o annotated.vcf.gz
bcftools filter -r chr1:1000-5000 input.vcf.gz -Oz -o region.vcf.gz

Important Notes:
  • -i keeps variants matching condition.
  • -e removes variants matching condition.
  • Soft filtering keeps variants but tags them.
  • Region filtering requires indexed files.