public void GetMultiAllelicQScores() { CalledAllele variant1 = TestHelper.CreateDummyAllele("chr1", 1000, "A", "C", 30, 12); CalledAllele variant2 = TestHelper.CreateDummyAllele("chr1", 1000, "A", "T", 30, 11); MixtureModelResult result = AdaptiveGenotyperCalculator.GetMultiAllelicQScores(variant1, variant2, new List <double[]> { Means, Means }); // The 4th GP should always be the minimum because that reflects the 1/2 call Assert.Equal(4, result.GenotypePosteriors.ToList().IndexOf(result.GenotypePosteriors.Min())); }
private void TestCalculation(CalledAllele variant, double frequency, double depth, int expectedValue) { variant.TotalCoverage = (int)depth; variant.AlleleSupport = (int)(depth * frequency); if (variant.Genotype == Genotype.HomozygousRef) { variant.AlleleSupport = (int)(depth * (1.0 - frequency)); } MixtureModelResult result = AdaptiveGenotyperCalculator.GetGenotypeAndQScore(variant, Means, Priors); Assert.Equal(expectedValue, result.QScore); }
public void AddLocus(CalledAllele variant) { ReferenceName.Add(variant.Chromosome); ReferencePosition.Add(variant.ReferencePosition); ChrIndexer.Add(variant.Chromosome + ":" + variant.ReferencePosition.ToString(), Count); NumIndexer.Add(Count, variant.Chromosome + ":" + variant.ReferencePosition.ToString()); int dp = variant.TotalCoverage; if (dp < AdaptiveGenotyperCalculator.MaxEffectiveDepth) { Dp.Add(dp); Ad.Add(VariantReader.GetAlternateAlleleSupport(variant)); } else { var(ad, depth) = AdaptiveGenotyperCalculator.DownsampleVariant( VariantReader.GetAlternateAlleleSupport(variant), dp); Dp.Add(depth); Ad.Add(ad); } Count++; }