Models and algorithms for haplotype phasing and variant calling