1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
from pysam.libcalignmentfile cimport AlignmentFile, AlignedSegment
from pysam.libctabix cimport Tabixfile
cdef AlignmentFile samfile
cdef Tabixfile tabixfile
def testCountBAM(AlignmentFile samfile):
'''test reading from a BAM file accessing
the flag field directly.'''
cdef AlignedSegment read
cdef int n = 0
for read in samfile.fetch():
flag = read._delegate.core.flag
n += 1
return n
def testCountGTF(Tabixfile tabixfile):
'''test reading from a tabixfile.'''
cdef int n = 0
for entry in tabixfile.fetch():
n += 1
return n
|