Apply quality filters and expression-based variant filtering
BCFTOOLS FILTERbcftools 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).
.vcf, .vcf.gz).bcf).vcf.gz).bcf)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
-i keeps variants matching condition.-e removes variants matching condition.