Written and maintained by CASRAI Editorial Board
Published
On this page
bcftools is a set of command-line utilities for manipulating variant calls stored in the Variant Call Format (VCF) and its binary counterpart BCF. It can call SNPs and indels from aligned reads, then filter, normalize, merge, intersect, annotate, query and summarize the resulting files. Every command accepts VCF or BCF, compressed or not, and is designed to be chained with Unix pipes.
Short answer
Use bcftools when you already have variant data (or aligned BAM/CRAM reads) and need to turn it into a clean, queryable VCF/BCF. The standard calling pipeline is bcftools mpileup -f reference.fa alignments.bam | bcftools call -mv -Ob -o calls.bcf, followed by quality filtering with bcftools view -i 'QUAL>=20'. The rest of the toolkit handles everything that happens to a VCF before and after calling.
What bcftools is
The bcftools manual describes the program as “a set of utilities that manipulate variant calls in the Variant Call Format (VCF) and its binary counterpart BCF”, and states that all commands work transparently with both formats, uncompressed or BGZF-compressed. It belongs to the same family as SAMtools and HTSlib, the library underneath both. A 2021 paper in GigaScience (“Twelve years of SAMtools and BCFtools”, Danecek et al.) reports that the software is freely available on GitHub under the permissive MIT licence, that the first version appeared twelve years before the paper, and that it has been installed more than one million times via Bioconda.
Two design points explain most of how people use it. First, commands are built to work on a stream: a hyphen (-) means standard input or output, so subcommands can be piped into each other. Second, operations that read several VCFs at once need them indexed, and an index requires the file to be compressed (BGZF). That is why multi-file workflows almost always start by compressing and indexing each file.
The data table below this article summarizes the the subcommands covered here, their purpose and their input requirements, as stated in the manual. If you are new to the formats involved, the CASRAI guide to the BAM index (.bai) file explains the alignment-side index that mpileup relies on for region queries.
How the mpileup and call pipeline works
Variant calling in bcftools is a two-step pipeline. The manual’s variant-calling how-to gives the basic form as bcftools mpileup -f reference.fa alignments.bam | bcftools call -mv -Ob -o calls.bcf.
Step 1: mpileup
bcftools mpileup generates a VCF or BCF containing genotype likelihoods for one or several alignment files (BAM or CRAM). It lives in bcftools rather than in samtools; the manual says it was moved “to avoid errors resulting from use of incompatible versions of samtools and bcftools”. Individuals are identified from the SM tags in the @RG read-group headers, so correct read-group metadata matters for multi-sample runs.
- Regions:
-rrestricts the run to a region and needs an index;-tstreams through targets without an index. The manual notes that-rcan be slower than-twhen there are many regions. - Depth cap:
-d/--max-depthdefaults to 250 reads per input file per position. The how-to advises raising it for deeper data. - Annotations:
-a/--annotateadds optional tags such as FORMAT/AD, ADF, ADR, DP, SP and SCR. The manual marks DV and DP4 as deprecated.
Step 2: call
bcftools call turns likelihoods into variant calls. You must choose a calling model: the older -c/--consensus-caller or the newer -m/--multiallelic-caller. The manual states that the multiallelic model is recommended for most tasks. Other options used in the standard recipe:
-voutputs variant sites only.-Psets the prior and works only with-m. The how-to gives the default as 1.1e-3; a smaller value is stricter and a larger one more permissive.-Oselects the output type:bcompressed BCF,uuncompressed BCF,zcompressed VCF,vuncompressed VCF.--ploidyand--ploidy-fileoverride ploidy; regions not listed default to ploidy 2.
When piping between bcftools subcommands, the manual recommends -Ou (uncompressed BCF), which avoids spending time compressing data that the next command immediately decompresses. Use a compressed type only for the file you intend to keep.
Filtering and normalizing variants
Quality filtering
The how-to uses expression-based filtering, for example bcftools view -i 'QUAL>=20' calls.bcf. To sanity-check a threshold it suggests looking at the transition/transversion ratio: bcftools filter -i'QUAL>20' calls.vcf.gz | bcftools stats | grep TSTV. Other metrics it lists as useful include read depth, the minimum number of high-quality non-reference reads and proximity to indels (bcftools filter -g).
The same page is explicit about limits. The QUAL value does not account for systematic biases such as collapsed paralogous copies, a filter tuned on one dataset may not transfer to another, and fixed-threshold filtering is described as the minimum approach. Machine-learning filters (an SVM is mentioned) are noted but not implemented in bcftools.
Normalization with norm
bcftools norm left-aligns and normalizes indels, checks whether REF alleles match the reference, splits multiallelic sites into multiple rows, and can recover multiallelic records from multiple rows. Four details are easy to miss:
- Left-alignment and normalization are applied only when
--fasta-refis supplied. -m -splits and-m +joins multiallelic sites; the argument can restrict this to snps, indels, both or any.-a/--atomizedecomposes multi-nucleotide variants into SNVs.-ccontrols reference checking with four modes: exit, warn, exclude or set. The manual warns thats(set) will not fix strand issues.
Combining and comparing files: merge, concat, isec and norm
The most frequent bcftools mistake is picking the wrong combining command. The manual draws the lines this way:
- merge combines files from non-overlapping sample sets (it adds sample columns). Only records from different files can be merged, never from the same file. If sample names collide it raises an error unless
--force-samplesis given, which prepends the file index to the name (for example2:S3). - concat joins files that contain the same samples (it adds rows). For a vertical merge of records the manual points to concat or
norm -m. - isec computes intersections, unions and complements of VCFs; the complement option (
-C) gives positions present only in the first file. - norm -m splits or joins multiallelic records within a file.
When several VCFs are read simultaneously, all of them must be indexed and therefore compressed. bcftools index creates a CSI index by default (supporting chromosomes up to 231 in length); the -t option writes a TBI index instead (limited to 229). On loading, CSI is tried first.
Other subcommands worth knowing
The manual lists a wider command set than calling and filtering. Selected entries, with the manual’s own one-line purpose:
annotateedits a VCF, adding or removing annotations.csqis a haplotype-aware consequence caller; for a different approach to consequence prediction see the ANNOVAR guide.gtcheckchecks sample concordance, sample swaps and contamination.queryextracts fields in a custom format, e.g.bcftools query -f '%CHROMt%POSt%REFt%ALT[t%SAMPLE=%GT]n' file.vcf.gz.statswrites text output suitable for machine processing, plottable withplot-vcfstats; given two files it reports concordance statistics.consensus,cnv,roh,polysomy,convert,reheader,sort,headandplugincover consensus sequences, copy-number and runs-of-homozygosity analyses, format conversion, header edits, sorting and user plugins.
The project site also hosts how-tos for CNV, consequence, consensus and ROH calling, converting formats, adding annotation, extracting information, filter expressions, performance and scaling, and plugins.
Where it matters for lab workflows
In a sequencing workflow bcftools sits after alignment and before interpretation: reads are aligned to a reference, bcftools produces and cleans a VCF, and downstream tools annotate it. Because reference naming differs between builds, check which assembly your reads and your reference FASTA use; the CASRAI comparison of GRCh38, hg38 and b37 covers the naming differences. Variants from public cohorts such as the 1000 Genomes Project or the genome Aggregation Database (gnomAD) are commonly distributed as VCF, which bcftools can read directly.
For data management, record the bcftools version string (the manual itself identifies the documented build as git version 1.22-8, last updated 2025-06-17) together with the exact command line, reference file and filter thresholds, since the how-to states that thresholds tuned on one dataset may not transfer.
Common misunderstandings
- “mpileup is part of samtools.” It was moved into bcftools so that the pileup and the caller come from matching versions.
- “norm left-aligns indels automatically.” Only if you pass
--fasta-ref. - “merge stacks two files of the same samples.” It does not; merge is for different samples. Same-sample files go through concat.
- “A QUAL cutoff makes the call set clean.” The how-to says QUAL ignores systematic biases and treats fixed thresholds as a minimum.
- “Compressed output is always better.” For intermediate pipe steps the manual recommends uncompressed
-Ou. - “Old BCF files will work.” The obsolete BCF1 format produced by samtools 0.1.19 and earlier is not compatible.
Installing bcftools
The project’s installation page describes building from source: clone HTSlib (with --recurse-submodules) and bcftools from GitHub, optionally run autoheader && autoconf && ./configure --enable-libgsl --enable-perl-filters, then make. Plugins are found through the BCFTOOLS_PLUGINS environment variable, which must point at the plugins directory. The 2021 paper also notes availability through Bioconda.
FAQ
What is bcftools used for?
Calling, filtering, normalizing, merging, intersecting, annotating, querying and summarizing variants in VCF and BCF files.
Does bcftools work on both VCF and BCF?
Yes. The manual says all commands work transparently with VCF and BCF, uncompressed or BGZF-compressed.
Which calling model should I use?
The manual recommends the multiallelic model (-m) for most tasks.
Why does merging two VCFs fail?
Typically the files are not indexed (so not compressed), or they share sample names. Duplicate names produce an error unless --force-samples is used.
Is bcftools free to use?
It is available on GitHub under the MIT licence, per the 2021 GigaScience paper.
Sources
- bcftools manual, samtools.github.io/bcftools/bcftools.html (last updated 2025-06-17, git version 1.22-8; read 2026-11-14).
- bcftools how-to: Variant calling and filtering, samtools.github.io/bcftools/howtos/variant-calling.html (read 2026-11-14).
- bcftools how-to index, samtools.github.io/bcftools/howtos/index.html (read 2026-11-14).
- bcftools installation how-to, samtools.github.io/bcftools/howtos/install.html (read 2026-11-14).
- Danecek P et al. “Twelve years of SAMtools and BCFtools.” GigaScience 2021;10(2):giab008, doi:10.1093/gigascience/giab008, PMID 33590861 (read 2026-11-14).
Data: bcftools subcommands: purpose, input requirements and documented caveats
Compiled from the official bcftools manual (git version 1.22-8, updated 2025-06-17): nine subcommands with their stated purpose, input requirements and caveats the manual documents.
Period covered: 2025.
| Subcommand | Purpose | Input requirement | Documented caveat |
|---|---|---|---|
| mpileup | Genotype likelihoods from BAM/CRAM alignments | Alignment files; region (-r) needs an index, -t streams without one | Moved from samtools; default max depth 250 per file per position |
| call | SNP and indel calling from likelihoods | Output of mpileup; choose -m (recommended for most tasks) or -c | Default ploidy 2 for regions not listed; -P prior only with -m |
| norm | Left-align and normalize indels, check REF, split or join multiallelics | Single file; left-alignment only with --fasta-ref | -c check-ref modes e, w, x, s; s does not fix strand issues |
| merge | Combine files from non-overlapping sample sets | Multiple indexed (compressed) files | Records merge only across files; duplicate sample names error without --force-samples |
| concat | Join files with the same samples | Same samples in every file | Named in the manual as the vertical alternative to merge |
| isec | Intersections, unions and complements of VCFs | Multiple indexed (compressed) files | -C gives positions only in the first file |
| index | Create an index for VCF/BCF | Compressed (BGZF) file | CSI by default (chromosomes up to 2^31); TBI with -t (up to 2^29) |
| stats | Summary statistics, plottable with plot-vcfstats | One file, or two for concordance | Text output suitable for machine processing |
| gtcheck | Sample concordance, swaps and contamination | VCF/BCF | Listed as a quality-control command in the manual |
Sources
- bcftools manual (accessed 2026-11-14)
Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.







