Skip to content

Comparing callers

Sarek ran four variant callers on the same recalibrated CRAM file. Each one reads the same alignments and decides which genotype HG002 carries at each position, and each decides it with a different model. This page puts the four call sets on one footing, counts where they agree, and compares their genotypes at the sites they share. Which calls are right is a question for the truth set, and the Benchmarking page answers it.

Caller How it decides Primary source
GATK HaplotypeCaller finds active regions, reassembles their reads into candidate haplotypes, scores each read against each haplotype with a pair HMM, then assigns genotypes with Bayes’ rule Poplin et al. 2017
DeepVariant encodes the reads around each candidate as a tensor of base, base quality, mapping quality, strand and allele support, and a convolutional network classifies the genotype Poplin et al. 2018
freebayes a Bayesian model over the literal read sequences in a window, so it can report MNPs and complex events as one allele Garrison and Marth 2012
bcftools mpileup and call genotype likelihoods from the pileup at each position, then the multiallelic caller, call -m Li 2011, Danecek et al. 2021

The table follows the HaplotypeCaller documentation, the DeepVariant usage guide and the freebayes README. The first two callers rebuild the local sequence before they genotype, and bcftools looks at one position at a time.

The files also leave sarek in different states. The HaplotypeCaller calls pass through CNNScoreVariants and FilterVariantTranches, which write a FILTER value, and DeepVariant labels its own rejects RefCall or NoCall. The freebayes file is the one sarek cut at QUAL > 30, with no FILTER value, and the bcftools file carries no filter. Sarek also hands DeepVariant the recalibrated CRAM, although the DeepVariant usage guide advises against BQSR because it lowers accuracy a little.

Two call sets can hold the same variant and still disagree on paper. The loop below removes the differences of spelling before any comparison.

  • reheader renames the sample after the caller. HaplotypeCaller and freebayes call it HG002_HG002, the sarek patient and sample joined, and DeepVariant and bcftools call it HG002. A tool that joins files by sample, such as bcftools merge, would treat those as two people.
  • --apply-filters PASS,. keeps the records that passed or were never filtered.
  • --exclude 'ALT="."' drops records with no alternative allele. The bcftools file holds such records with the genotype ./., because sarek drops only homozygous reference genotypes, and a missing genotype is not one.
  • norm --multiallelics -any splits a record with two ALT alleles in two, and --fasta-ref lets norm trim shared bases and shift each indel to its leftmost position.
  • The last view keeps the genotypes that carry the alternative allele inside the region, and it drops the * allele, which only says that an upstream deletion covers the position.

The HG002 inputs come from NIST and the Genome in a Bottle consortium. The preparation on October 29, 2026 selects the chromosome 20 interval, subsets the GIAB v4.2.1 benchmark, and produces fresh analysis outputs. The source and terms notice identifies the original sequencing and benchmark publications, the exact source files, and the changes. It also records the grants for the Broad reference bundle and Ensembl release 99 annotation.

Terminal window
set -o pipefail
REF=/opt/reference/chr20.fasta
REGION=/opt/data/region/chr20_region.bed
CALLS=/opt/data/variant_calling
# /work is the page folder. The R and Python tabs read the files from there.
OUT=/work/outputs/comparing_callers
mkdir -p "$OUT"
callers=(haplotypecaller deepvariant freebayes bcftools)
inputs=(
"$CALLS/haplotypecaller/HG002.haplotypecaller.filtered.vcf.gz"
"$CALLS/deepvariant/HG002.deepvariant.vcf.gz"
"$CALLS/freebayes/HG002.freebayes.filtered.vcf.gz"
"$CALLS/bcftools/HG002.bcftools.vcf.gz"
)
printf '%-16s %-12s %7s %6s %s\n' caller sample records no_alt \
"norm total/split/joined/realigned/mismatch/dup/skipped"
for i in "${!callers[@]}"; do
caller=${callers[$i]}
sample=$(bcftools query --list-samples "${inputs[$i]}")
records=$(bcftools view --no-header "${inputs[$i]}" | wc -l)
no_alt=$(bcftools view --no-header --include 'ALT="."' "${inputs[$i]}" \
| wc -l)
# Name the sample after the caller, keep the passing records that carry
# an ALT allele, split and left-align, then keep the non-reference
# genotypes that are not a spanning deletion (*) inside the region.
bcftools reheader --samples-list "$caller" "${inputs[$i]}" \
| bcftools view --apply-filters PASS,. --exclude 'ALT="."' -Ou \
| bcftools norm --multiallelics -any --fasta-ref "$REF" -Ou \
2> "norm_$caller.log" \
| bcftools view --include 'GT="alt" && ALT!="*"' \
--targets-file "$REGION" \
-Oz --output "$OUT/$caller.vcf.gz" --write-index=tbi
printf '%-16s %-12s %7d %6d %s\n' "$caller" "$sample" "$records" \
"$no_alt" "$(grep '^Lines' "norm_$caller.log" | cut -f2)"
done
caller sample records no_alt norm total/split/joined/realigned/mismatch/dup/skipped
haplotypecaller HG002_HG002 1807 0 1795/50/0/21/0/0/0
deepvariant HG002 2010 0 1788/40/0/20/0/0/0
freebayes HG002_HG002 1713 0 1713/57/0/380/0/0/0
bcftools HG002 1933 124 1809/31/0/334/0/0/0

The no_alt column counts the records the exclude filter removed, and only bcftools has any, 124 of its 1,933 records. In the norm summary, realigned counts the records whose alleles norm rewrote. That is 380 freebayes records and 334 bcftools records, against 21 for HaplotypeCaller and 20 for DeepVariant.

Terminal window
printf '%-16s %7s %6s %6s %6s\n' caller records snvs indels other
for caller in "${callers[@]}"; do
vcf="$OUT/$caller.vcf.gz"
records=$(bcftools view --no-header "$vcf" | wc -l)
snvs=$(bcftools view --no-header --types snps "$vcf" | wc -l)
indels=$(bcftools view --no-header --types indels "$vcf" | wc -l)
printf '%-16s %7d %6d %6d %6d\n' "$caller" "$records" "$snvs" \
"$indels" "$((records - snvs - indels))"
done
caller records snvs indels other
haplotypecaller 1834 1452 382 0
deepvariant 1828 1444 384 0
freebayes 1770 1378 335 57
bcftools 1840 1479 361 0

The four sets hold 1,770 to 1,840 records. bcftools calls the most SNVs, 1,479, and DeepVariant the most indels, 384. Only freebayes has records in the other column, 57 MNPs and complex alleles that norm does not break up, and since no other caller writes such records, none of the 57 can match another file.

Terminal window
bcftools isec --nfiles +1 --collapse none \
"$OUT/haplotypecaller.vcf.gz" "$OUT/deepvariant.vcf.gz" \
"$OUT/freebayes.vcf.gz" "$OUT/bcftools.vcf.gz" \
> "$OUT/isec_sites.tsv"
head -n 3 "$OUT/isec_sites.tsv"
echo "sites: $(wc -l < "$OUT/isec_sites.tsv")"
cut -f5 "$OUT/isec_sites.tsv" | sort | uniq -c | sort -k1,1nr -k2,2
# The spans of the freebayes records that norm left as MNPs or complex
# alleles, and the 1101 sites, called by all but freebayes, inside them.
bcftools view --exclude-types snps,indels "$OUT/freebayes.vcf.gz" \
| bcftools query --format '%POS0\t%END\n' > freebayes_complex.tsv
awk 'NR == FNR {start[NR] = $1; end[NR] = $2; n = NR; next}
$5 == "1101" {
sites++
for (i = 1; i <= n; i++) {
if ($2 > start[i] && $2 <= end[i]) {inside++; break}
}
}
END {print inside " of " sites " sites lie in " n " freebayes records"}' \
freebayes_complex.tsv "$OUT/isec_sites.tsv"
chr20 10002077 G A 1111
chr20 10002161 A T 1111
chr20 10002243 T C 1111
sites: 1999
1656 1111
102 1101
67 0010
46 0001
37 1000
28 1100
17 0011
13 0111
11 0100
7 0110
7 1110
4 0101
2 1010
1 1001
1 1011
77 of 102 sites lie in 57 freebayes records

--nfiles +1 lists every site in at least one file, and --collapse none pairs two records only when POS, REF and ALT all match. The fifth column is a bit string in the order of the files, HaplotypeCaller, DeepVariant, freebayes and bcftools, so 1101 means every caller except freebayes.

Of 1,999 sites, 1,656 are in all four call sets. The next group, 1101, holds 102 sites that only freebayes lacks, and 77 of them lie inside one of its 57 complex records. freebayes found those alleles and wrote them as part of a longer one. bcftools has 46 private sites, HaplotypeCaller 37 and DeepVariant 11.

The R tab reads each normalized file with VariantAnnotation and the Python tab with cyvcf2. Both build a key from the position and the two alleles, spread the keys into one column per caller, and count the patterns. Both print the same 15 patterns as bcftools isec.

suppressPackageStartupMessages({
library(VariantAnnotation)
library(dplyr)
library(tidyr)
library(ggplot2)
library(patchwork)
})
callers <- c("haplotypecaller", "deepvariant", "freebayes", "bcftools")
vcf_dir <- "outputs/comparing_callers"
#' Read one normalized call set as a table of alleles and zygosity.
#'
#' @param caller Caller name, which is also the sample name in the VCF.
#' @param vcf_dir Folder that holds the normalized VCF files.
#' @return A tibble with one row per record: caller, key and zygosity.
ReadCalls <- function(caller, vcf_dir) {
vcf <- readVcf(file.path(vcf_dir, paste0(caller, ".vcf.gz")))
genotype <- geno(vcf)$GT[, caller]
tibble(
caller = caller,
key = paste(
start(vcf), as.character(ref(vcf)),
as.character(unlist(alt(vcf))), sep = ":"
),
zygosity = ifelse(genotype == "1/1", "hom", "het")
)
}
calls <- bind_rows(lapply(callers, ReadCalls, vcf_dir = vcf_dir))
membership <- calls |>
mutate(called = 1L) |>
select(key, caller, called) |>
pivot_wider(names_from = caller, values_from = called, values_fill = 0L)
membership$pattern <- do.call(paste0, membership[callers])
pattern_counts <- membership |>
count(pattern, name = "sites") |>
arrange(desc(sites), pattern)
print(as.data.frame(pattern_counts), row.names = FALSE)
pattern sites
1111 1656
1101 102
0010 67
0001 46
1000 37
1100 28
0011 17
0111 13
0100 11
0110 7
1110 7
0101 4
1010 2
1001 1
1011 1

A Venn diagram of four sets has 15 regions and is hard to read. An UpSet chart draws one bar per pattern, and the dot matrix under each bar names its callers.

caller_names <- c(
haplotypecaller = "HaplotypeCaller", deepvariant = "DeepVariant",
freebayes = "freebayes", bcftools = "bcftools"
)
set_sizes <- table(calls$caller)[callers]
row_labels <- sprintf(
"%s (%s)", caller_names[callers], format(set_sizes, big.mark = ",")
)
bar_data <- pattern_counts |>
mutate(pattern = factor(pattern, levels = pattern))
dot_data <- expand_grid(pattern = bar_data$pattern, row = seq_along(callers))
dot_data$called <- substr(dot_data$pattern, dot_data$row, dot_data$row) == "1"
dot_data$label <- factor(row_labels[dot_data$row], levels = rev(row_labels))
bars <- ggplot(bar_data, aes(pattern, sites)) +
geom_col(fill = "#2a78d6", width = 0.7) +
geom_text(aes(label = sites), vjust = -0.5, size = 3, colour = "#52514e") +
scale_y_continuous(expand = expansion(mult = c(0, 0.1))) +
labs(
x = NULL, y = "Sites",
title = "Overlap of four call sets, HG002 chr20:10,000,001-11,000,000"
) +
theme_minimal(base_size = 11) +
theme(
axis.text.x = element_blank(),
panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank()
)
dots <- ggplot(dot_data, aes(pattern, label)) +
geom_path(
data = dot_data[dot_data$called, ], aes(group = pattern),
colour = "#0b0b0b", linewidth = 0.8
) +
geom_point(aes(colour = called), size = 3) +
scale_colour_manual(
values = c(`TRUE` = "#0b0b0b", `FALSE` = "#dcdbd5"), guide = "none"
) +
labs(x = "Callers that make the call", y = NULL) +
theme_minimal(base_size = 11) +
theme(axis.text.x = element_blank(), panel.grid = element_blank())
overlap_plot <- bars / dots + plot_layout(heights = c(3, 1.4))
ggsave(
"outputs/comparing-callers_overlap_r.png", overlap_plot,
width = 9, height = 5.5, dpi = 120, bg = "white"
)

UpSet chart of the four call sets drawn with ggplot2. 1,656 sites are in all four sets and 102 in every set except freebayes, and the other thirteen patterns hold 67 sites or fewer.

Most variants in the region are easy, and all four methods find them. The disagreement sits in the short bars, and the second bar comes from how freebayes writes alleles rather than from what it found.

A site in all four sets can still get four answers about zygosity. The code takes the 1,656 shared sites, counts the callers that call each one homozygous, and finds the lone caller wherever three agree and one does not.

shared_keys <- membership$key[membership$pattern == "1111"]
shared <- calls |>
filter(key %in% shared_keys) |>
select(key, caller, zygosity) |>
pivot_wider(names_from = caller, values_from = zygosity)
# The number of callers that call each shared site homozygous.
shared$hom_calls <- rowSums(shared[callers] == "hom")
cat(sprintf("shared sites: %d\n", nrow(shared)))
cat(sprintf(
"same zygosity in all four: %d\n", sum(shared$hom_calls %in% c(0, 4))
))
cat(sprintf("two against two: %d\n", sum(shared$hom_calls == 2)))
# At a three against one site, the lone caller holds the minority zygosity.
lone <- shared |> filter(hom_calls %in% c(1, 3))
minority <- ifelse(lone$hom_calls == 1, "hom", "het")
is_lone <- lone[callers] == minority
site_type <- ifelse(grepl("^[0-9]+:[ACGT]:[ACGT]$", lone$key), "snv", "indel")
lone_counts <- t(rowsum(is_lone * 1L, site_type))
print(lone_counts)
# The gate compares these counts with the Python tab.
set_sizes <- table(calls$caller)[callers]
parity_metrics <- c(
setNames(as.list(as.integer(set_sizes)), paste0("records_", callers)),
setNames(
as.list(pattern_counts$sites), paste0("pattern_", pattern_counts$pattern)
),
list(
shared_sites = nrow(shared),
same_zygosity = sum(shared$hom_calls %in% c(0, 4)),
two_against_two = sum(shared$hom_calls == 2)
),
setNames(
as.list(as.vector(lone_counts)),
paste(
"lone", rep(rownames(lone_counts), ncol(lone_counts)),
rep(colnames(lone_counts), each = nrow(lone_counts)), sep = "_"
)
)
)
jsonlite::write_json(
parity_metrics, "outputs/comparing_callers_metrics_r.json",
auto_unbox = TRUE
)
shared sites: 1656
same zygosity in all four: 1629
two against two: 3
indel snv
haplotypecaller 0 0
deepvariant 0 0
freebayes 5 5
bcftools 13 1

All four callers give the same zygosity at 1,629 of the 1,656 shared sites, and 3 sites split two against two. At the others one caller stands alone, and it is always freebayes or bcftools. freebayes stands alone at 5 SNVs and 5 indels, and bcftools at 13 indels and 1 SNV. The Benchmarking page finds most bcftools errors at indels too, often as a false positive and a false negative at one position, which is how a wrong genotype shows up there.

Exact matching punishes spelling. bcftools norm leaves MNPs and complex alleles whole, and that cost freebayes 77 of the 102 sites it seems to miss. bcftools norm --atomize splits MNPs into single bases, and the haplotype comparison on the Benchmarking page avoids the problem.

Counting straight from the sarek files inflates the private calls. The DeepVariant file holds its RefCall and NoCall records, and the bcftools file holds records with no alternative allele, so read the FILTER column and the genotypes before you count.

Agreement is not accuracy. Misplaced reads can carry the same false allele into every caller, and a call that one caller makes alone can be the only right one. The overlap shows where to look, and the truth set shows who was right.

The code for this page is in the companion repository under guides/dnaseq/comparing-callers/.

Danecek and colleagues, 2021 describe the development and the current features of SAMtools and BCFtools.

Obenchain and colleagues, 2014 describe VariantAnnotation, the Bioconductor package for the exploration and annotation of genetic variants.

The BCFtools command reference defines normalization and set intersections. Those operations establish what a shared variant representation means.

The VCF specification defines alternate alleles, genotypes, and filter fields. These definitions help distinguish shared sites from shared allele and genotype calls.