Skip to content
Tutorials Center
My learning

Topics

Lesson 27 of 49 ยท Genomics Pipelines

Variant Calling and the VCF Format

Learn how variant callers weigh allele counts to decide genotypes, how to read a VCF line, which filters matter, and how variants are annotated and prioritized.

Mapped reads sit in a BAM file as a tall stack above every position of the genome. At most positions, all reads agree with the reference. At a few million positions in a person's genome, they do not. Variant calling is the step that decides, position by position, whether the disagreement is a real difference in the sample's DNA or just noise from sequencing and mapping.

The result is a VCF file (Variant Call Format), the most widely exchanged file in genetics. This lesson shows how a caller turns allele counts into genotypes, how to read every column of a VCF line, which warning signs to filter on, and how a list of variants becomes a short list of candidates.

Left: ten reads at one position, five with the reference base G and five with the alternate A. Right: genotypes 0/0, 0/1 and 1/1. Bottom: one VCF line with its columns named.
Caption: count the alleles, choose a genotype, write a VCF line.

What you will learn

  • What a variant caller is deciding and why it needs a probabilistic model.
  • How genotype codes 0/0, 0/1 and 1/1 relate to allele counts.
  • How to read a VCF header, the fixed columns, INFO and per-sample fields.
  • Which evidence (depth, strand, mapping quality) makes a call trustworthy.
  • How annotation tools turn variants into predicted effects.

Key terms

SNV: single-nucleotide variant, one base changed. Indel: a short insertion or deletion.

Allele: one version of a sequence at a position. REF is the reference allele; ALT is the alternative.

Genotype (GT): which alleles the sample carries: 0/0 (two REF), 0/1 (one of each), 1/1 (two ALT).

QUAL: Phred-scaled confidence that the site is truly variant.

Depth (DP): the number of reads covering the position.

What is the caller deciding?

Look at one position where the reference says G. Suppose 20 reads cover it. If 20 say G, the sample is almost certainly homozygous reference (0/0). If 10 say G and 10 say A, the sample is likely heterozygous (0/1): a diploid cell has two copies of each autosome, and reads are drawn from both about equally. If 20 say A, it is homozygous alternate (1/1).

The hard cases are in between. Is 3 A out of 20 a real heterozygous variant with a lucky imbalance, or an error rate of 15% on a bad day? The answer depends on the base qualities, the mapping qualities and how often errors occur in the sequencing chemistry. This is why callers use probability models instead of simple thresholds.

A minimal model: binomial likelihoods

Let n be the depth, k the number of reads showing ALT, and e the per-base error rate (about 0.01 for Q20 data). If the true genotype is:

  • 0/0: each read shows ALT only by error, so k ~ Binomial(n, e);
  • 0/1: each read comes from the ALT chromosome with probability 1/2, so k ~ Binomial(n, 0.5);
  • 1/1: each read shows ALT unless it is an error, so k ~ Binomial(n, 1 - e).

Bayes' rule multiplies each likelihood by a prior: most positions in the genome are homozygous reference, so a call must overcome that prior. The posterior probabilities are then normalized, and the caller reports the genotype with the highest one. The genotype quality (GQ) is -10 * log10(1 - best posterior), and QUAL is -10 * log10(P(0/0 | data)).

Real callers extend this idea in important ways. GATK HaplotypeCaller locally reassembles the reads in an active region into candidate haplotypes and realigns reads to them, which makes indels much more reliable. bcftools mpileup and call computes genotype likelihoods from each base's quality, quickly. FreeBayes is haplotype-based and Bayesian. DeepVariant converts a pileup into an image and classifies it with a neural network trained on truth sets. They differ in speed and accuracy, but they all emit VCF.

Reading a VCF file

A VCF begins with meta-information lines starting with ## that declare the format version, reference, contigs, and the meaning of every INFO and FORMAT key. One header line starting with a single # names the columns. Then each data line is one site:

Text
##fileformat=VCFv4.2
##INFO=<ID=DP,Number=1,Type=Integer,Description="Total read depth">
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
#CHROM  POS     ID  REF  ALT  QUAL  FILTER  INFO   FORMAT    sample1
chr1    100200  .   G    A    812   PASS    DP=38  GT:AD:DP  0/1:19,19:38
Column Meaning
CHROM, POS chromosome and 1-based position
ID an identifier such as an rsID, or .
REF, ALT reference allele and comma-separated alternate alleles
QUAL Phred-scaled confidence that the site is variant
FILTER PASS or the names of filters the site failed
INFO site-level annotations, KEY=value separated by semicolons
FORMAT the keys that appear in each sample column, colon-separated
sample columns one per sample, values in FORMAT order

In the example, GT:AD:DP tells you the sample column 0/1:19,19:38 holds a genotype (0/1), allele depths (19 reads for REF, 19 for ALT) and a total depth (38).

A few conventions matter for correct parsing:

  • Genotype separators. / means unphased (we do not know which allele is on which chromosome copy); | means phased. A missing call is ./..
  • Allele numbers. 0 is REF, 1 is the first ALT, 2 the second, and so on, so 1/2 is a heterozygote of two different alternates.
  • Indels are written with a shared anchor base: a deletion of TG after a C is REF=CTG, ALT=C, and an insertion of AA after a C is REF=C, ALT=CAA.
  • Multiple samples are placed side by side in a joint VCF, which is how cohort studies compare people.

For large projects the usual flow is to run HaplotypeCaller per sample in gVCF mode (which also records the confidence of non-variant stretches) and then joint-genotype all samples together, so that "no call" and "reference" are never confused.

Trusting a call: filters and sanity checks

Raw callers over-call a little on purpose, and a filtering step removes the dubious sites. Useful evidence:

  • Depth. Very low depth means too little evidence; very high depth often means a repeat or collapsed duplication where reads from many copies pile on one spot.
  • Allele balance. A heterozygous call should be near 50% ALT. A call at 10% ALT in germline data is suspect (though perfectly normal in tumor samples with subclonal mutations).
  • Strand bias. If all ALT reads are on one strand, the "variant" is often an artifact. GATK reports FS and SOR for this.
  • Mapping quality. ALT reads with low MAPQ imply a repeat problem (GATK's MQ).
  • Quality by depth (QD) normalizes QUAL by coverage so that deep regions do not look better than they are.

GATK's documentation suggests hard-filter cut-offs such as QD < 2.0, FS > 60.0 and MQ < 40.0 for SNVs, which you tune to your data. Another useful whole-genome check is the transition/transversion ratio (Ti/Tv): transitions (Aโ†”G, Cโ†”T) occur about twice as often as transversions in real human variation, so a whole-genome SNV set with Ti/Tv near 2 is healthy, while a value near 0.5 (what random errors would give) means the call set is mostly noise. A typical human genome differs from the reference at roughly four to five million sites.

From variants to meaning: annotation

A VCF tells you where. Annotation tells you what. Tools such as VEP (Ensembl), SnpEff and ANNOVAR add, for each variant: the overlapping gene and transcript, a consequence (synonymous_variant, missense_variant, stop_gained, frameshift_variant, splice_donor_variant, intergenic and so on), the amino-acid change in HGVS notation, predicted damage scores, and the allele frequency in population databases such as gnomAD, plus clinical interpretations from ClinVar. A variant seen in 20% of healthy people is rarely the cause of a rare disease.

The usual path is a funnel: millions of variants, filter to high-quality calls, drop common ones, keep those with predicted functional impact, intersect with a gene list or inheritance pattern, and end with a handful of candidates for human review. Classification of clinical variants follows professional guidelines (the ACMG/AMP categories from pathogenic to benign) and is a job for qualified specialists.

This lesson is educational information about computational methods. It is not a way to interpret anyone's genetic test results; clinical decisions need qualified professionals and validated tests.

Common misconceptions

"A high QUAL means the variant matters." QUAL measures confidence that a difference exists, not whether it affects health or function.

"Heterozygous always means exactly 50% ALT reads." Sampling is random, so 8 of 20 or 13 of 20 happens by chance, and mapping bias can shift balance. Allele balance is a range, not a number.

"No variant listed means the genome matches the reference there." Not necessarily: it may just mean low coverage, so there was not enough evidence either way. This is exactly why gVCFs record reference confidence.

Try it

The first example is a genotype caller implementing the binomial model above, with illustrative prior probabilities (assumptions for the demonstration). The second parses VCF lines and computes allele balance and Ti/Tv from a small made-up list. The third plots how the posterior changes as the ALT count changes at a fixed depth.

Python A binomial genotype caller

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Python Parse VCF lines

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Python Posterior probability by ALT count

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. In a VCF, what does the genotype 1/1 mean?

    0 is REF and 1 is the first ALT, so 1/1 is homozygous alternate.
  2. 2. Which data would make you most suspicious of a heterozygous SNV call in germline DNA?

    A low ALT fraction, one strand only and low mapping quality all point to an artifact.
  3. 3. A deletion of 'TG' after the base 'C' is written in VCF as:

    VCF anchors indels with the preceding base: REF holds the longer allele CTG, ALT holds C.
  4. 4. Why is the Ti/Tv ratio a useful quality check for a whole-genome SNV call set?

    Biology favors transitions (about 2:1 in human genomes), but random errors give about 1:2, so a low ratio signals noise.
  5. 5. What does a high QUAL value tell you?

    QUAL is confidence in the existence of a variant, not in its biological importance.

Summary

  • A caller decides genotypes by comparing allele counts with error and heterozygous models, weighted by priors; the output is a VCF.
  • Genotype 0/0, 0/1 and 1/1 mean zero, one or two copies of the ALT allele; / unphased, | phased.
  • A VCF data line has eight fixed columns, then FORMAT and one column per sample; positions are 1-based and indels use an anchor base.
  • Trust a call when depth, allele balance, strand, mapping quality and QD all look sensible; check Ti/Tv across the set.
  • Annotation adds gene, consequence and population frequency; prioritization is a funnel ending with human review.

Next: Chapter Review: Genomics Pipelines