A computer-implemented method for phasing diploid genotypes, the method comprising: accessing a set of reference haplotypes corresponding to reference diploid genotypes that have already been phased; dividing each of the reference haplotypes into a plurality of windows of sequential single nucleotide polymorphisms (SNPs); generating a set of Markov models, each Markov model based on one of the windows and the SNPs of the reference haplotypes within that window, each of the Markov models having a plurality of nodes and a plurality of edges, each edge joining one of the nodes (parent node) with another of the nodes (sub node), each edge assigned with a transition probability, at least one of the edges that joins a sub node with a haplotype count of zero is assigned with a non-zero probability; accessing an input sample of a diploid genotype; generating, for each window, a set of pairs of possible haplotype phasings for the diploid genotype based on the Markov model for that window; updating, for each window, the corresponding Markov model, the updating comprising updating the transition probability assigned to each edge based on the SNPs for that window from the reference haplotypes and also based on the set of pairs of possible haplotype phasings for that window; generating, for each window, a pair of probable haplotype phasings for the diploid genotype based on the re-generated Markov model for that window; combining the pairs of probable haplotype phasings for the windows into a single pair of probable phased haplotypes; and providing the single pair of probable phased haplotypes for the input sample of the diploid genotype. accessing a set of reference haplotypes corresponding to reference diploid genotypes that have already been phased; dividing each of the reference haplotypes into a plurality of windows of sequential single nucleotide polymorphisms (SNPs); generating a set of Markov models, each Markov model based on one of the windows and the SNPs of the reference haplotypes within that window, each of the Markov models having a plurality of nodes and a plurality of edges, each edge joining one of the nodes (parent node) with another of the nodes (sub node), each edge assigned with a transition probability, at least one of the edges that joins a sub node with a haplotype count of zero is assigned with a non-zero probability; accessing an input sample of a diploid genotype; generating, for each window, a set of pairs of possible haplotype phasings for the diploid genotype based on the Markov model for that window; updating, for each window, the corresponding Markov model, the updating comprising updating the transition probability assigned to each edge based on the SNPs for that window from the reference haplotypes and also based on the set of pairs of possible haplotype phasings for that window; generating, for each window, a pair of probable haplotype phasings for the diploid genotype based on the re-generated Markov model for that window; combining the pairs of probable haplotype phasings for the windows into a single pair of probable phased haplotypes; and providing the single pair of probable phased haplotypes for the input sample of the diploid genotype.