/// <summary> /// Create a new class that compares a sample to a known haplotype /// </summary> public HaplotypeComparison(PhyloTreeNodev2 node, SimpleSample sample) { this.node = node; var polysInNode = sample.Filter.FilterPolys(node.Mutations).ToList(); NumberOfPolymorhpismsInHaplotype = (ushort)polysInNode.Count; haplotypeWeightPoly = polysInNode.Sum(x => x.getMutationRate()); MatchingPolymorphisms = polysInNode.Where(z => sample.Polymorphisms.Contains(z)).ToList(); NumberOfPolymorphismsMissingFromGenotype = (ushort)(polysInNode.Count - MatchingPolymorphisms.Count); NumberOfPolymorphismsMissingFromHaplotype = (ushort)(sample.Polymorphisms.Count - MatchingPolymorphisms.Count); matchingWeightPoly = MatchingPolymorphisms.Sum(x => x.getMutationRate()); var CorrectInHaplotypeRatio = haplotypeWeightPoly == 0 ? 1.0 : (matchingWeightPoly / haplotypeWeightPoly); var CorrectInSampleRatio = sample.TotalSampleWeight == 0 ? 1.0 : (matchingWeightPoly / sample.TotalSampleWeight); Rank = .5 * CorrectInHaplotypeRatio + .5 * CorrectInSampleRatio; }
public HaplotypeSearcher() { treeRoot = TreeLoader.LoadTree(); //CONSTANTS.TREE_XML_FILE); var skipped = HaploSearchManager.SetPhylogeneticWeights(); //CONSTANTS.WEIGHT_FILE); }