Li–Stephens HMM: phasing and imputing a diploid genotype
The two copies of a sample's genome are modelled as mosaics of the haplotypes in a reference panel. At every SNP the
hidden state says which panel haplotype each copy is copying. Given the panel and the sample's unphased genotype, the
HMM recovers this pair of paths. The path phases the genotype, and it also fills in missing genotypes (?)
from the haplotypes being copied. You can edit the panel or the genotype to rerun.
Keys: → step, ← back, f run all, r reset,
v switch the drawn path between Viterbi and posterior decoding.
1 Reference panel and genotype
R = A/G · Y = C/T · K = G/T · M = A/C · S = C/G · W = A/T · ? or N = missing
2 Model
3 Panel, decoded path and phased haplotypes
copy a (first haplotype of the state)copy b (second)g lowercase: observed allele differs from the copied one (an error)T bold: imputed from the copied haplotype
4 Hidden states (a, b) at every SNP
One n×n grid per SNP: row = a (copy a), column = b (copy b); shade = value ÷ largest value at that SNPforward α̃ onlyposterior α̃β̃decoded state