public static IEnumerable <Coverage> EstimateIncreasingCoverages(this IEnumerable <MatchedWith> matches, double queryLength, double trackLength, double fingerprintLength, double permittedGap) { var sequences = LongestIncreasingTrackSequence.FindAllIncreasingTrackSequences(matches, permittedGap); var coverages = sequences.Select(sequence => new Coverage(sequence, queryLength, trackLength, fingerprintLength, permittedGap)); return(OverlappingRegionFilter.FilterCrossMatchedCoverages(coverages)); }
public void ShouldNotFailWithJustOneEntryAtTheInput() { var matches = new List <Matches> { new Matches(TestUtilities.GetMatchedWith(new[] { 1 }, new[] { 1 })) }; var result = OverlappingRegionFilter.MergeOverlappingSequences(matches, PermittedGap); Assert.AreEqual(1, result.Count()); }
public void ShouldMergeOverlappingRegionsWithLongestInFront() { var result = OverlappingRegionFilter.MergeOverlappingSequences( new List <Matches> { new Matches(TestUtilities.GetMatchedWith(new[] { 0, 1, 3, 4 }, new[] { 0, 1, 2, 3 }).ToList()), new Matches(TestUtilities.GetMatchedWith(new[] { 2 }, new[] { 1 }).ToList()) }, PermittedGap) .ToList(); Assert.AreEqual(1, result.Count); CollectionAssert.AreEqual(new float[] { 0, 1, 2, 3, 4 }, result[0].Select(with => with.QueryMatchAt)); }
public void ShouldFilterOverlappingRegionsWithLongestInFront2() { var result = OverlappingRegionFilter.FilterOverlappingSequences( new List <List <MatchedWith> > { TestUtilities.GetMatchedWith(new float[] { 0, 1, 2 }, new float[] { 0, 1, 2 }).ToList(), TestUtilities.GetMatchedWith(new float[] { 4, 5 }, new float[] { 4, 5 }).ToList() }) .ToList(); Assert.AreEqual(2, result.Count); CollectionAssert.AreEqual(new float[] { 0, 1, 2 }, result[0].Select(with => with.QueryAt)); CollectionAssert.AreEqual(new float[] { 4, 5 }, result[1].Select(with => with.QueryAt)); }
public void ShouldIdentifyThatItIsContainedWithinItself() { // a ------------ // b --- var a = TestUtilities.GetMatchedWith(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }).EstimateCoverage(10, 10, 1, 1); var b = TestUtilities.GetMatchedWith(new[] { 4, 5, 6 }, new[] { 4, 5, 6 }).EstimateCoverage(3, 3, 1, 1); Assert.IsTrue(a.Contains(b)); Assert.IsFalse(b.Contains(a)); var results = OverlappingRegionFilter.FilterCrossMatchedCoverages(new[] { a, b }).ToList(); Assert.AreEqual(1, results.Count); Assert.AreSame(a, results.First()); }
public void ShouldFilterOverlappingRegionsWithLongestInTheBack() { var result = OverlappingRegionFilter.MergeOverlappingSequences( new List <Matches> { new Matches(TestUtilities.GetMatchedWith(new[] { 4, 6, 7, 9, 10 }, new[] { 4, 5, 6, 7, 9 }).ToList()), new Matches(TestUtilities.GetMatchedWith(new[] { 10, 11, 17 }, new[] { 10, 11, 12 }).ToList()), new Matches(TestUtilities.GetMatchedWith(new[] { 0, 1, 2 }, new[] { 0, 1, 2 }).ToList()), new Matches(TestUtilities.GetMatchedWith(new[] { 5 }, new[] { 5 }).ToList()), new Matches(TestUtilities.GetMatchedWith(new[] { 6 }, new[] { 6 }).ToList()) }, PermittedGap) .ToList(); Assert.AreEqual(2, result.Count); CollectionAssert.AreEqual(new float[] { 4, 5, 6, 7, 9, 10, 11, 17 }, result[0].Select(with => with.QueryMatchAt)); CollectionAssert.AreEqual(new float[] { 0, 1, 2 }, result[1].Select(with => with.QueryMatchAt)); }