public void CalculateBndBorderDistanceWorks([NotNull] string chr, uint position, [NotNull] string otherChr, uint otherPos, int ciStart, int ciEnd, double percentDistance, uint basepairDistance, uint borderStart, uint borderEnd) { var thisPos = ContigAndPosition.Create(ContigInfo.Create(chr), position); var otherPosition = ContigAndPosition.Create(ContigInfo.Create(otherChr), otherPos); var ci = new InclusiveInterval <int>(ciStart, ciEnd); var actualCi = thisPos.CalculateBndBorderInterval(otherPosition, ci, percentDistance, basepairDistance); var expectedCi = ContigAndInterval.Create(ContigInfo.Create(chr), borderStart, borderEnd); Assert.Equal(expectedCi, actualCi); }
internal void CheckContigId(string line) { var chromAndLengthInfo = GetChromAndLengthInfo(line); if (chromAndLengthInfo.Length == 0) { return; } if (!_refNameToChromosome.TryGetValue(chromAndLengthInfo[0], out IChromosome chromosome)) { return; } if (!int.TryParse(chromAndLengthInfo[1], out int length)) { return; } var assemblyThisChrom = ContigInfo.GetGenomeAssembly(chromosome, length); if (assemblyThisChrom == GenomeAssembly.rCRS) { IsRcrsMitochondrion = true; return; } if (!GenomeAssemblyHelper.AutosomeAndAllosomeAssemblies.Contains(assemblyThisChrom)) { return; } if (InferredGenomeAssembly == GenomeAssembly.Unknown) { InferredGenomeAssembly = assemblyThisChrom; } if (InferredGenomeAssembly != assemblyThisChrom) { throw new UserErrorException($"Inconsistent genome assemblies inferred:\ncurrent line \"{line}\" indicates {assemblyThisChrom}, whereas the lines above it indicate {InferredGenomeAssembly}."); } }
public static void WittyerBndCreateCorrectly() { var vcfSettings = VcfVariantParserSettings.Create(ImmutableList.Create("proband", "father"), GenomeAssembly.Grch37); var bnd1 = VcfVariant.TryParse(GenotypedBnd, vcfSettings).GetOrThrowDebug(); var bnd2 = VcfVariant.TryParse(GenotypedBndPair, vcfSettings).GetOrThrowDebug(); var wittyerBnd = WittyerBndInternal .Create(bnd2, bnd2.Samples["father"], WittyerType.TranslocationBreakend, Bins, BasepairDistance, PercentDistance, bnd1); var expectedContig = ContigInfo.Create("1"); var expectedEndInterval = ContigAndInterval.Create(ContigInfo.Create("4"), 191034451, 191035452); MultiAssert.Equal(expectedContig, wittyerBnd.Contig); MultiAssert.Equal(expectedEndInterval, wittyerBnd.EndInterval); MultiAssert.Equal(230675U, wittyerBnd.Start); MultiAssert.Equal(231676U, wittyerBnd.Stop); MultiAssert.Equal(WittyerConstants.StartingBin, wittyerBnd.Win.Start); MultiAssert.Equal(null, wittyerBnd.Win.End); MultiAssert.AssertAll(); }