Skip to content

BCFtools filter

bcftools filter removes variant records from a VCF or BCF file that do not meet a quality expression. The output is a bgzip-compressed VCF (.vcf.gz) that can be registered in the Data library and passed to downstream tools.

Details

PropertyValue
TypeNative tool
Binarybcftools
Subcommandfilter -i (include mode)

Installation

BCFtools must be installed and available in your system PATH.

bash
brew install bcftools
bash
sudo apt install bcftools
bash
conda install -c bioconda bcftools

Accepted inputs

ExtensionDescription
.vcfUncompressed VCF
.vcf.gzBgzip-compressed VCF
.bcfBinary call format
.bcf.gzCompressed BCF

Running BCFtools filter

  1. Navigate to Tools → BCFtools filter.
  2. Select a VCF or BCF file from your Data library.
  3. Choose a preset or write a custom filter expression.
  4. Click Run filter.

Liatir runs the selected filter expression and shows the compressed VCF output in the results panel.

Filter expression syntax

The -i flag operates in include mode: only variants that satisfy the expression are kept. Variants that do not match are removed.

Fields

FieldTypeDescription
QUALfloatPhred-scaled variant quality
DPintegerTotal read depth at the site
AFfloatAllele frequency (if present in INFO)
FILTERstringFilter field value ("PASS", ".", etc.)
TYPEstringVariant type: "snp", "indel", "mnp", "other"
INFO/DPintegerDepth from INFO field (same as DP for most callers)
FORMAT/GQintegerGenotype quality per sample

Operators

OperatorMeaning
>, <, >=, <=Numeric comparison
=, ==Equality
!=Not equal
&&Logical AND
||Logical OR
!Logical NOT

Preset expressions

PresetExpressionUse case
PASS onlyFILTER="PASS"Keep only variants that passed the caller's internal filters
QUAL > 20QUAL>20Basic quality gate; common minimum for variant analysis
QUAL > 30QUAL>30Stricter quality gate
QUAL + depthQUAL>20 && DP>10Combined quality and coverage filter
SNPs onlyTYPE="snp"Keep only SNPs, discard indels
Indels onlyTYPE="indel"Keep only indels

Custom examples

# High-confidence SNPs
TYPE="snp" && QUAL>30 && DP>20

# Only PASS variants with allele frequency > 5%
FILTER="PASS" && AF>0.05

# Variants on a specific chromosome (requires region syntax instead)
# Use bcftools view -r chr1 for region filtering

Filter vs Annotate

bcftools filter removes non-matching records from the output entirely. If you want to keep all records but mark the filtered ones (soft-filtering), use bcftools filter without -i/-x and instead use the -s flag to set a FILTER tag. The Liatir implementation uses hard-filtering (-i include mode) for simplicity.

Output

The filtered output is a bgzip-compressed VCF (.vcf.gz). It appears in the results panel with:

  • Add to Data — registers the filtered VCF in the Data library for immediate use as input to BCFtools stats, SnpEff, or any downstream step.
  • Save as… — copies the file to a location you choose via the system save dialog.

After filtering, run BCFtools stats on the filtered output to verify the Ts/Tv ratio and variant counts are within expected ranges.

Liatir — powerful bioinformatics on your machine.

By using this app, you agree to our Privacy Policy and Terms of Service.