Example #1
0
 def testEmptyCoverageCounts(self):
     """
     When no intervals are added, coverageCounts should return an empty
     Counter.
     """
     ri = ReadIntervals(100)
     self.assertEqual({}, ri.coverageCounts())
Example #2
0
 def testEmptyCoverageCountsOnZeroLengthSequence(self):
     """
     When no intervals are added, coverageCounts should return an empty
     Counter.
     """
     ri = ReadIntervals(0)
     self.assertEqual({}, ri.coverageCounts())
Example #3
0
 def coverageCounts(self):
     """
     For each location in the title sequence, return a count of how many
     times that location is covered by a read.
     """
     intervals = ReadIntervals(self.subjectLength)
     for hsp in self.hsps():
         intervals.add(hsp.subjectStart, hsp.subjectEnd)
     return intervals.coverageCounts()
Example #4
0
 def coverageCounts(self):
     """
     For each location in the title sequence, return a count of how many
     times that location is covered by a read.
     """
     intervals = ReadIntervals(self.subjectLength)
     for hsp in self.hsps():
         intervals.add(hsp.subjectStart, hsp.subjectEnd)
     return intervals.coverageCounts()
Example #5
0
 def testOneIntervalInMiddleCoverageCounts(self):
     """
     If there is a single interval in the middle of the hit, coverageCounts
     should return the correct result.
     """
     ri = ReadIntervals(10)
     ri.add(5, 6)
     c = Counter([5])
     self.assertEqual(c, ri.coverageCounts())
Example #6
0
 def testOneIntervalStartingAtZeroCoverageCounts(self):
     """
     If there is a single interval that starts at zero but doesn't
     cover the whole hit, coverageCounts should return the correct result.
     """
     ri = ReadIntervals(10)
     ri.add(0, 5)
     c = Counter([0, 1, 2, 3, 4])
     self.assertEqual(c, ri.coverageCounts())
Example #7
0
 def testOneIntervalExactCoveringCoverageCounts(self):
     """
     If there is a single interval that spans the whole hit exactly,
     coverageCounts should return the correct result.
     """
     ri = ReadIntervals(10)
     ri.add(0, 10)
     c = Counter([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
     self.assertEqual(c, ri.coverageCounts())
Example #8
0
 def testTwoOverlappingIntervalsInMiddleCoverageCounts(self):
     """
     If there are two overlapping intervals in the middle of the hit,
     coverageCounts should return the correct result.
     """
     ri = ReadIntervals(10)
     ri.add(5, 7)
     ri.add(6, 8)
     c = Counter([5, 6, 6, 7])
     self.assertEqual(c, ri.coverageCounts())
Example #9
0
 def testOneIntervalEndingAtHitEndCoverageCounts(self):
     """
     If there is a single interval that ends at the end of the hit
     but doesn't start at zero, coverageCounts should return the correct
     result.
     """
     ri = ReadIntervals(10)
     ri.add(5, 10)
     c = Counter([5, 6, 7, 8, 9])
     self.assertEqual(c, ri.coverageCounts())
Example #10
0
 def testOneIntervalCoveringAllExtendingRightCoverageCounts(self):
     """
     If there is a single interval that spans the whole hit, including
     going beyond the hit to the right, coverageCounts should return the
     correct result.
     """
     ri = ReadIntervals(10)
     ri.add(0, 12)
     c = Counter([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
     self.assertEqual(c, ri.coverageCounts())