private static MitoHeteroplasmyProvider GetProvider() { var provider = new MitoHeteroplasmyProvider(); provider.Add(1, "C", new[] { 0.123, 0.200, 0.301 }, new[] { 1, 3, 4 }); provider.Add(1, "G", new[] { 0.101, 0.201 }, new[] { 1, 2 }); provider.Add(2, "T", new[] { 0, 0.001, 0.002, 0.003 }, new[] { 134, 1111, 936, 203 }); return(provider); }
public void ExtractSample_MitoHeteroplasmy_AsExpected() { var provider = new MitoHeteroplasmyProvider(); provider.Add(1, "C", new[] { 0.123, 0.200, 0.301 }, new[] { 1, 2, 4 }); provider.Add(1, "G", new[] { 0.101, 0.201 }, new[] { 1, 2 }); var simplePosition = new SimplePosition(ChromosomeUtilities.ChrM, 1, "A", new[] { "C", "T" }); var formatIndices = new FormatIndices(); formatIndices.Set("GT:SQ:AD:AF:F1R2:F2R1:DP:SB:MB:PS"); var sample = SampleFieldExtractor.ExtractSample("1|2:3.96:0,15,85:0.195:13,6:20,2:100:17,16,4,4:13,20,4,4:534234", formatIndices, simplePosition, provider); Assert.Equal(new[] { 15 / 100.0, 85 / 100.0 }, sample.VariantFrequencies); Assert.Equal(new[] { "14.29", "null" }, sample.HeteroplasmyPercentile); }
public void CapVrf() { var provider = new MitoHeteroplasmyProvider(); provider.Add(750, "G", new[] { 0.0, 0.001, 0.002, 0.991, 0.994, 0.995, 0.996, 0.997, 0.998, 0.999 }, new[] { 24, 4, 2, 3, 2, 1, 1, 4, 3, 2460 }); var chrom = ChromosomeUtilities.ChrM; var position = 750; var altAlleles = new[] { "G" }; var percentilesSample = provider.GetVrfPercentiles(chrom, position, altAlleles, new[] { 1.0 }); Assert.Single(percentilesSample); Assert.True(percentilesSample[0].HasValue); Assert.Equal(1.76, percentilesSample[0].Value, 2); }