SNP calling: heuristics, likelihood and Bayes

The practice

A genome is sequenced, and you have to say what this individual carries at every position. You will do it three times — with thresholds you choose, with maximum likelihood, and with Bayes — and score all three on the same reads. Everything below is simulated, so the truth is known and every call can be marked.

The genome

A locus is polymorphic in the population with probability v, the variant rate. At a polymorphic locus the alternative allele has frequency q, and what this individual carries is drawn from

P(hom ref) = p² + F·p·q    P(het) = 2pq(1 − F)    P(hom alt) = q² + F·p·q

with p = 1 − q. F is Wright's inbreeding coefficient: at F = 0 the genotypes are in Hardy-Weinberg proportions, and as F rises heterozygotes are emptied into the two homozygous classes. Note what follows — a polymorphic locus can leave this individual homozygous for the reference, and at such a position there is nothing in the reads to find. Calls are scored against the individual's genotype, not against whether the locus is variable in the population.

The sequencing

Every position is sequenced, variable or not. It receives a Poisson number of reads with the mean depth you set, so some positions arrive with three reads and others with seventeen. Each read draws one of the two alleles the individual carries, with probability one half each, and carries a Phred quality Q of its own. The base is then misread with probability

e = 10−Q/10

becoming one of the three other bases. The quality is honest by construction: a base reported at Q20 really is wrong one time in a hundred. Whether a caller believes it is another matter.

What you have to build

Three callers, one in each tab, all scored on these same reads. Each reports the same two tables: whether a variant is there at all, and which genotype was called. Start at 10×, where every method looks good, then drop the depth to 4× and look again — the differences between the three live at low depth.