示例#1
0
def in_features(reads, features):
    """Returns a boolean indicating whether any of the reads in the first
    argument overlap with any of the features in the second.

    """
    overlap = False
    r0, r1 = sam.coverage(reads)
    for f in features:
        if f.start <= r0 <= f.end or f.start <= r1 <= f.end:
            overlap = True
            break
        elif f.start > r1:
            break
    return overlap
示例#2
0
文件: gff.py 项目: ahammel/srtools
def in_features(reads, features):
    """Returns a boolean indicating whether any of the reads in the first
    argument overlap with any of the features in the second.

    """
    overlap = False
    r0, r1 = sam.coverage(reads)
    for f in features:
        if f.start <= r0 <= f.end or f.start <= r1 <= f.end:
            overlap = True
            break
        elif f.start > r1:
            break
    return overlap
示例#3
0
 def test_coverage(self):
     self.expressed_locus_alignment.rewind()
     test_reads = list(self.expressed_locus_alignment)
     assert sam.coverage(test_reads[:1]) == (1,5)
     assert sam.coverage(test_reads[:2]) == (1,7)
     assert sam.coverage(test_reads[:3]) == (1,17)
     assert sam.coverage(test_reads[:4]) == (1,18)
     assert sam.coverage(test_reads[2:]) == (13,18)
     assert sam.coverage(test_reads[1:]) == (3,18)