File: _compile_test.pyx

package info (click to toggle)
python-pysam 0.15.4+ds-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 27,992 kB
  • sloc: ansic: 140,738; python: 7,881; sh: 265; makefile: 223; perl: 41
file content (29 lines) | stat: -rw-r--r-- 619 bytes parent folder | download | duplicates (4)
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