https://github.com/pysam-developers/pysam
Tip revision: 746e4d9bd149722f2dbdb99b1e15760a7c2b7979 authored by Andreas Heger on 16 June 2020, 22:52:51 UTC
bump version to 0.16.0.1 to allow upload of fixed wheels to pypi
bump version to 0.16.0.1 to allow upload of fixed wheels to pypi
Tip revision: 746e4d9
_cython_flagstat.pyx
from pysam.libcalignmentfile cimport AlignmentFile, AlignedSegment
from pysam.libcalignmentfile cimport BAM_FPROPER_PAIR, BAM_FPAIRED
from pysam.libcalignedsegment cimport pysam_get_flag
def count(AlignmentFile samfile):
cdef int is_proper = 0
cdef int is_paired = 0
cdef AlignedSegment read
cdef int f
for read in samfile:
f = pysam_get_flag(read._delegate)
if f & BAM_FPAIRED:
is_paired += 1
if f & BAM_FPROPER_PAIR:
is_proper += 1
return is_paired, is_proper