/* Generated by Cython 0.17.2 on Tue Oct 1 11:06:17 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02040000 #error Cython requires Python 2.4+. #else #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ (PyObject*)0)) #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ !PyComplex_Check(o)) #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #define __Pyx_PyIndex_Check PyIndex_Check #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #else #define CYTHON_PEP393_ENABLED 0 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) #else #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #define __PYX_HAVE__samtoolsWrapper #define __PYX_HAVE_API__samtoolsWrapper #include "string.h" #include "stdlib.h" #include "stdio.h" #include "ctype.h" #include "unistd.h" #include "razf.h" #include "stdint.h" #include "bam.h" #include "sam.h" #include "pysam_util.h" #include "math.h" #include "bgzf.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif /* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif /* unused attribute */ #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; static const char *__pyx_f[] = { "samtoolsWrapper.pyx", }; /*--- Type declarations ---*/ struct __pyx_obj_15samtoolsWrapper_Samfile; struct __pyx_obj_15samtoolsWrapper_IteratorRowAll; struct __pyx_obj_15samtoolsWrapper_AlignedRead; struct __pyx_obj_15samtoolsWrapper_IteratorRow; struct __pyx_opt_args_15samtoolsWrapper_7Samfile__open; struct __pyx_opt_args_15samtoolsWrapper_7Samfile__parseRegion; struct __pyx_t_15samtoolsWrapper_cAlignedRead; typedef struct __pyx_t_15samtoolsWrapper_cAlignedRead __pyx_t_15samtoolsWrapper_cAlignedRead; /* "samtoolsWrapper.pxd":254 * cdef int _isOpen( self ) * cdef _hasIndex( self ) * cpdef _open(self, mode, loadIndex=*) # <<<<<<<<<<<<<< * cdef char* getrname(self, int tid) * cdef _parseRegion(self, reference=*, start=*, end=*, region=*) */ struct __pyx_opt_args_15samtoolsWrapper_7Samfile__open { int __pyx_n; PyObject *loadIndex; }; /* "samtoolsWrapper.pxd":256 * cpdef _open(self, mode, loadIndex=*) * cdef char* getrname(self, int tid) * cdef _parseRegion(self, reference=*, start=*, end=*, region=*) # <<<<<<<<<<<<<< * cpdef IteratorRow fetch(self, char* reference, int start, int end) * cpdef IteratorRowAll fetchAllReads(self) */ struct __pyx_opt_args_15samtoolsWrapper_7Samfile__parseRegion { int __pyx_n; PyObject *reference; PyObject *start; PyObject *end; PyObject *region; }; /* "samtoolsWrapper.pxd":311 * ################################################################################################### * * ctypedef struct cAlignedRead: # <<<<<<<<<<<<<< * char* seq * char* qual */ struct __pyx_t_15samtoolsWrapper_cAlignedRead { char *seq; char *qual; short *cigarOps; short *hash; short mateChromID; short cigarLen; short chromID; short rlen; int pos; int end; int insertSize; int matePos; int bitFlag; char mapq; }; /* "samtoolsWrapper.pxd":223 * * ################################################################################################### * cdef class Samfile # <<<<<<<<<<<<<< * * cdef class IteratorRow: */ struct __pyx_obj_15samtoolsWrapper_Samfile { PyObject_HEAD struct __pyx_vtabstruct_15samtoolsWrapper_Samfile *__pyx_vtab; char *filename; samfile_t *samfile; bam_index_t *index; int isbam; PyObject *indexesByRegion; PyObject *lock; }; /* "samtoolsWrapper.pxd":233 * ################################################################################################### * * cdef class IteratorRowAll: # <<<<<<<<<<<<<< * cdef bam1_t* b * cdef samfile_t* fp */ struct __pyx_obj_15samtoolsWrapper_IteratorRowAll { PyObject_HEAD struct __pyx_vtabstruct_15samtoolsWrapper_IteratorRowAll *__pyx_vtab; bam1_t *b; samfile_t *fp; }; /* "samtoolsWrapper.pxd":266 * ################################################################################################### * * cdef class AlignedRead: # <<<<<<<<<<<<<< * cdef bam1_t* _delegate * cdef int hashValue */ struct __pyx_obj_15samtoolsWrapper_AlignedRead { PyObject_HEAD struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *__pyx_vtab; bam1_t *_delegate; int hashValue; int readEnd; char *_seq; char *_qual; }; /* "samtoolsWrapper.pxd":225 * cdef class Samfile * * cdef class IteratorRow: # <<<<<<<<<<<<<< * cdef bam_fetch_iterator_t* bam_iter # iterator state object * cdef bam1_t* b */ struct __pyx_obj_15samtoolsWrapper_IteratorRow { PyObject_HEAD struct __pyx_vtabstruct_15samtoolsWrapper_IteratorRow *__pyx_vtab; bam_fetch_iterator_t *bam_iter; bam1_t *b; int useIndex; }; /* "samtoolsWrapper.pyx":326 * ###################################################################### * * cdef class Samfile: # <<<<<<<<<<<<<< * """ * *(filename, mode='r', referencenames = None, referencelengths = None, text = NULL, header = None)* */ struct __pyx_vtabstruct_15samtoolsWrapper_Samfile { void (*clearHeader)(struct __pyx_obj_15samtoolsWrapper_Samfile *); void (*clearIndex)(struct __pyx_obj_15samtoolsWrapper_Samfile *); void (*createCache)(struct __pyx_obj_15samtoolsWrapper_Samfile *); void (*clearCache)(struct __pyx_obj_15samtoolsWrapper_Samfile *); int (*_isOpen)(struct __pyx_obj_15samtoolsWrapper_Samfile *); PyObject *(*_hasIndex)(struct __pyx_obj_15samtoolsWrapper_Samfile *); PyObject *(*_open)(struct __pyx_obj_15samtoolsWrapper_Samfile *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_15samtoolsWrapper_7Samfile__open *__pyx_optional_args); char *(*getrname)(struct __pyx_obj_15samtoolsWrapper_Samfile *, int); PyObject *(*_parseRegion)(struct __pyx_obj_15samtoolsWrapper_Samfile *, struct __pyx_opt_args_15samtoolsWrapper_7Samfile__parseRegion *__pyx_optional_args); struct __pyx_obj_15samtoolsWrapper_IteratorRow *(*fetch)(struct __pyx_obj_15samtoolsWrapper_Samfile *, char *, int, int, int __pyx_skip_dispatch); struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *(*fetchAllReads)(struct __pyx_obj_15samtoolsWrapper_Samfile *, int __pyx_skip_dispatch); PyObject *(*close)(struct __pyx_obj_15samtoolsWrapper_Samfile *, int __pyx_skip_dispatch); void (*loadOffsetsForRegions)(struct __pyx_obj_15samtoolsWrapper_Samfile *, PyObject *); void (*openBAMFile)(struct __pyx_obj_15samtoolsWrapper_Samfile *, PyObject *); }; static struct __pyx_vtabstruct_15samtoolsWrapper_Samfile *__pyx_vtabptr_15samtoolsWrapper_Samfile; /* "samtoolsWrapper.pyx":849 * ################################################################################################### * * cdef class IteratorRowAll: # <<<<<<<<<<<<<< * """ * iterates over all mapped reads */ struct __pyx_vtabstruct_15samtoolsWrapper_IteratorRowAll { bam1_t *(*getCurrent)(struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *); int (*cnext)(struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *); }; static struct __pyx_vtabstruct_15samtoolsWrapper_IteratorRowAll *__pyx_vtabptr_15samtoolsWrapper_IteratorRowAll; /* "samtoolsWrapper.pyx":1238 * * * cdef class AlignedRead: # <<<<<<<<<<<<<< * ''' * Class representing an aligned read. see SAM format specification for meaning of */ struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead { PyObject *(*qname)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *, int __pyx_skip_dispatch); char *(*fastQName)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); char *(*seq)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); char *(*qual)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); PyObject *(*tags)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*flag)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*rname)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*getCigarLength)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*pos)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*end)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); PyObject *(*bin)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*getCigarOpCode)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *, int); int (*getCigarOpLength)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *, int); int (*rlen)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*mapq)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *, int __pyx_skip_dispatch); int (*mrnm)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*mpos)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*isize)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*is_paired)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*is_proper_pair)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*is_unmapped)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*mate_is_unmapped)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*is_reverse)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*mate_is_reverse)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*is_read1)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*is_read2)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*is_secondary)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*is_qcfail)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); int (*is_duplicate)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *); PyObject *(*opt)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *, PyObject *); }; static struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *__pyx_vtabptr_15samtoolsWrapper_AlignedRead; /* "samtoolsWrapper.pyx":778 * ###################################################################### * * cdef class IteratorRow: # <<<<<<<<<<<<<< * """ * Iterates over mapped reads in a region. */ struct __pyx_vtabstruct_15samtoolsWrapper_IteratorRow { int (*cnext)(struct __pyx_obj_15samtoolsWrapper_IteratorRow *); }; static struct __pyx_vtabstruct_15samtoolsWrapper_IteratorRow *__pyx_vtabptr_15samtoolsWrapper_IteratorRow; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil) \ if (acquire_gil) { \ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ PyGILState_Release(__pyx_gilstate_save); \ } else { \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil) \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif #define __Pyx_RefNannyFinishContext() \ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ const char* function_name); /*proto*/ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; } #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { #if CYTHON_COMPILING_IN_CPYTHON if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, i); Py_INCREF(r); return r; } else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); Py_INCREF(r); return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else return PySequence_GetItem(o, i); #endif } #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { #if CYTHON_COMPILING_IN_CPYTHON if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); return r; } else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); Py_INCREF(r); return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else return PySequence_GetItem(o, i); #endif } #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { #if CYTHON_COMPILING_IN_CPYTHON if (PyList_CheckExact(o)) { Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, n); Py_INCREF(r); return r; } } else if (PyTuple_CheckExact(o)) { Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, n); Py_INCREF(r); return r; } } else { /* inlined PySequence_GetItem() */ PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_item)) { if (unlikely(i < 0) && likely(m->sq_length)) { Py_ssize_t l = m->sq_length(o); if (unlikely(l < 0)) return NULL; i += l; } return m->sq_item(o, i); } } #else if (PySequence_Check(o)) { return PySequence_GetItem(o, i); } #endif return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ static CYTHON_INLINE int __Pyx_PyDict_Contains(PyObject* item, PyObject* dict, int eq) { int result = PyDict_Contains(dict, item); return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); } #if PY_MAJOR_VERSION >= 3 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { PyObject *value; value = PyDict_GetItemWithError(d, key); if (unlikely(!value)) { if (!PyErr_Occurred()) PyErr_SetObject(PyExc_KeyError, key); return NULL; } Py_INCREF(value); return value; } #else #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) #endif static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) { int result = PySequence_Contains(seq, item); return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); } static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { if (likely(PyList_CheckExact(L))) { if (unlikely(PyList_Append(L, x) < 0)) return NULL; Py_INCREF(Py_None); return Py_None; /* this is just to have an accurate signature */ } else { PyObject *r, *m; m = __Pyx_GetAttrString(L, "append"); if (!m) return NULL; r = PyObject_CallFunctionObjArgs(m, x, NULL); Py_DECREF(m); return r; } } static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int32_t(int32_t); static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t); static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/ #if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3 static PyObject* __pyx_print = 0; static PyObject* __pyx_print_kwargs = 0; #endif static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint8_t(uint8_t); static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static void __Pyx_WriteUnraisable(const char *name, int clineno, int lineno, const char *filename); /*proto*/ static int __Pyx_check_binary_version(void); static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /*proto*/ static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ typedef struct { int code_line; PyCodeObject* code_object; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; }; static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cython' */ /* Module declarations from 'samtoolsWrapper' */ static PyTypeObject *__pyx_ptype_15samtoolsWrapper_Samfile = 0; static PyTypeObject *__pyx_ptype_15samtoolsWrapper_IteratorRow = 0; static PyTypeObject *__pyx_ptype_15samtoolsWrapper_IteratorRowAll = 0; static PyTypeObject *__pyx_ptype_15samtoolsWrapper_AlignedRead = 0; static int __pyx_v_15samtoolsWrapper_TYPE_BAM; static int __pyx_v_15samtoolsWrapper_TYPE_READ; static struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_f_15samtoolsWrapper_makeAlignedRead(bam1_t *); /*proto*/ static CYTHON_INLINE int __pyx_f_15samtoolsWrapper_Read_IsCompressed(__pyx_t_15samtoolsWrapper_cAlignedRead *); /*proto*/ static CYTHON_INLINE void __pyx_f_15samtoolsWrapper_Read_SetCompressed(__pyx_t_15samtoolsWrapper_cAlignedRead *); /*proto*/ static CYTHON_INLINE void __pyx_f_15samtoolsWrapper_Read_SetUnCompressed(__pyx_t_15samtoolsWrapper_cAlignedRead *); /*proto*/ static bam_index_t *__pyx_f_15samtoolsWrapper_my_bam_index_load(char *); /*proto*/ static void __pyx_f_15samtoolsWrapper_compressSeq(__pyx_t_15samtoolsWrapper_cAlignedRead *, char *); /*proto*/ static void __pyx_f_15samtoolsWrapper_compressQual(__pyx_t_15samtoolsWrapper_cAlignedRead *, int); /*proto*/ static void __pyx_f_15samtoolsWrapper_uncompressSeq(__pyx_t_15samtoolsWrapper_cAlignedRead *, char *); /*proto*/ static void __pyx_f_15samtoolsWrapper_uncompressQual(__pyx_t_15samtoolsWrapper_cAlignedRead *); /*proto*/ #define __Pyx_MODULE_NAME "samtoolsWrapper" int __pyx_module_is_main_samtoolsWrapper = 0; /* Implementation of 'samtoolsWrapper' */ static PyObject *__pyx_builtin_StandardError; static PyObject *__pyx_builtin_IOError; static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_StopIteration; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_map; static PyObject *__pyx_builtin_KeyError; static PyObject *__pyx_builtin_chr; static PyObject *__pyx_pf_15samtoolsWrapper_unpickleSamfile(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_samFilePointer, PyObject *__pyx_v_indexFilePointer, PyObject *__pyx_v_indexesByRegion, PyObject *__pyx_v_isbam, PyObject *__pyx_v_filename); /* proto */ static int __pyx_pf_15samtoolsWrapper_7Samfile___cinit__(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self, PyObject *__pyx_v_fileName); /* proto */ static void __pyx_pf_15samtoolsWrapper_7Samfile_2__dealloc__(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_4__reduce__(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_6_open(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self, PyObject *__pyx_v_mode, PyObject *__pyx_v_loadIndex); /* proto */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_8fetch(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self, char *__pyx_v_reference, int __pyx_v_start, int __pyx_v_end); /* proto */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_10fetchAllReads(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_12close(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_11nreferences___get__(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_10references___get__(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_7lengths___get__(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_4text___get__(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_6header___get__(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15samtoolsWrapper_2unpickleIteratorRow(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_samfile, PyObject *__pyx_v_bamIterPointer, PyObject *__pyx_v_useIndex); /* proto */ static int __pyx_pf_15samtoolsWrapper_11IteratorRow___cinit__(struct __pyx_obj_15samtoolsWrapper_IteratorRow *__pyx_v_self, struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_samfile, int __pyx_v_tid, int __pyx_v_beg, int __pyx_v_end, int __pyx_v_useIndex); /* proto */ static PyObject *__pyx_pf_15samtoolsWrapper_11IteratorRow_2__reduce__(struct __pyx_obj_15samtoolsWrapper_IteratorRow *__pyx_v_self); /* proto */ static void __pyx_pf_15samtoolsWrapper_11IteratorRow_4__dealloc__(struct __pyx_obj_15samtoolsWrapper_IteratorRow *__pyx_v_self); /* proto */ static int __pyx_pf_15samtoolsWrapper_14IteratorRowAll___cinit__(struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *__pyx_v_self, struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_samfile); /* proto */ static PyObject *__pyx_pf_15samtoolsWrapper_14IteratorRowAll_2__iter__(struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15samtoolsWrapper_14IteratorRowAll_4__next__(struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *__pyx_v_self); /* proto */ static void __pyx_pf_15samtoolsWrapper_14IteratorRowAll_6__dealloc__(struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *__pyx_v_self); /* proto */ static int __pyx_pf_15samtoolsWrapper_11AlignedRead___cinit__(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self); /* proto */ static void __pyx_pf_15samtoolsWrapper_11AlignedRead_2__dealloc__(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15samtoolsWrapper_11AlignedRead_4__str__(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15samtoolsWrapper_11AlignedRead_6__richcmp__(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self, struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_other, int __pyx_v_opCode); /* proto */ static Py_hash_t __pyx_pf_15samtoolsWrapper_11AlignedRead_8__hash__(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15samtoolsWrapper_11AlignedRead_10qname(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_15samtoolsWrapper_11AlignedRead_12mapq(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self); /* proto */ static char __pyx_k_1[] = "Could not allocate BAM BGZF buffer in Samfile.createCache()"; static char __pyx_k_3[] = "Out of memory"; static char __pyx_k_7[] = "Could not open BAM file %s"; static char __pyx_k_8[] = "Writing to BAM files not supported"; static char __pyx_k_10[] = "invalid file opening mode `%s`"; static char __pyx_k_11[] = "BAM file is read-only"; static char __pyx_k_12[] = "Could not open file `%s`. Check that file/path exists."; static char __pyx_k_13[] = "Error while opening index for file `%s`. Check that index exists "; static char __pyx_k_15[] = "%s:%s-%s"; static char __pyx_k_16[] = "tid (%s) out of range 0<=tid<%i"; static char __pyx_k_17[] = "%s:%i-%i"; static char __pyx_k_18[] = "invalid region `%s`"; static char __pyx_k_19[] = "invalid region: start (%i) > end (%i)"; static char __pyx_k_20[] = "start out of range (%i)"; static char __pyx_k_21[] = "end out of range (%i)"; static char __pyx_k_23[] = "Random access query only allowed for BAM files."; static char __pyx_k_25[] = "BAM file is not open. Cannot return reads."; static char __pyx_k_27[] = "\n"; static char __pyx_k_29[] = "@"; static char __pyx_k_31[] = "Header line without '@': '%s. Total header text is %s'"; static char __pyx_k_32[] = "\t"; static char __pyx_k_34[] = "header line with invalid type '%s': '%s'"; static char __pyx_k_35[] = ":"; static char __pyx_k_37[] = "unknown field code '%s' in record '%s'"; static char __pyx_k_38[] = "multiple '%s' lines are not permitted"; static char __pyx_k_39[] = "Calling IteratorRow unpickle"; static char __pyx_k_41[] = "Done Calling IteratorRow unpickle"; static char __pyx_k_43[] = "BAM file %s is not open. Cannot read from file."; static char __pyx_k_44[] = "Cannot retrieve random region from BAM file %s, as it does not have a BAM index"; static char __pyx_k_45[] = "Calling IteratorRow reduce"; static char __pyx_k_48[] = "Done Calling IteratorRow reduce"; static char __pyx_k_50[] = "=ACMGRSVTWYHKDBN"; static char __pyx_k_51[] = "Shit 3. Qual = %s"; static char __pyx_k_52[] = "Shit 4!. Qual = %s"; static char __pyx_k_53[] = "Shit 1. Qual = %s. Count = %s!"; static char __pyx_k_54[] = "Shit 2!. Qual = %s. Count = %s"; static char __pyx_k_55[] = "Argh. cmp code = %s"; static char __pyx_k_56[] = "%s_%s_%s_%s_%s_%s"; static char __pyx_k_57[] = "Index %s is >= cigar length (%s)"; static char __pyx_k_58[] = "Unrecognized type "; static char __pyx_k_59[] = "tag '%s' not present"; static char __pyx_k_60[] = "%c"; static char __pyx_k_61[] = "number of :term:`reference` sequences in the file."; static char __pyx_k_62[] = "tuple with the names of :term:`reference` sequences."; static char __pyx_k_63[] = "tuple of the lengths of the :term:`reference` sequences. The lengths are in the same order as :attr:`pysam.Samfile.reference`\n "; static char __pyx_k_64[] = "full contents of the :term:`sam file` header as a string."; static char __pyx_k_65[] = "header information within the :term:`sam file`. The records and fields are returned as\n a two-level dictionary.\n "; static char __pyx_k_74[] = "/home/rimmer/nethome/Code/Trunk/coreutils/samtoolsWrapper.pyx"; static char __pyx_k__A[] = "A"; static char __pyx_k__C[] = "C"; static char __pyx_k__S[] = "S"; static char __pyx_k__Z[] = "Z"; static char __pyx_k__b[] = "b"; static char __pyx_k__c[] = "c"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__r[] = "r"; static char __pyx_k__s[] = "s"; static char __pyx_k__AS[] = "AS"; static char __pyx_k__CL[] = "CL"; static char __pyx_k__CN[] = "CN"; static char __pyx_k__CO[] = "CO"; static char __pyx_k__DS[] = "DS"; static char __pyx_k__DT[] = "DT"; static char __pyx_k__GO[] = "GO"; static char __pyx_k__HD[] = "HD"; static char __pyx_k__ID[] = "ID"; static char __pyx_k__LB[] = "LB"; static char __pyx_k__LN[] = "LN"; static char __pyx_k__M5[] = "M5"; static char __pyx_k__PG[] = "PG"; static char __pyx_k__PI[] = "PI"; static char __pyx_k__PL[] = "PL"; static char __pyx_k__PN[] = "PN"; static char __pyx_k__PP[] = "PP"; static char __pyx_k__PU[] = "PU"; static char __pyx_k__RG[] = "RG"; static char __pyx_k__SM[] = "SM"; static char __pyx_k__SN[] = "SN"; static char __pyx_k__SO[] = "SO"; static char __pyx_k__SP[] = "SP"; static char __pyx_k__SQ[] = "SQ"; static char __pyx_k__UR[] = "UR"; static char __pyx_k__VN[] = "VN"; static char __pyx_k__os[] = "os"; static char __pyx_k__rb[] = "rb"; static char __pyx_k__Log[] = "Log"; static char __pyx_k__beg[] = "beg"; static char __pyx_k__chr[] = "chr"; static char __pyx_k__end[] = "end"; static char __pyx_k__map[] = "map"; static char __pyx_k__rbh[] = "rbh"; static char __pyx_k__tid[] = "tid"; static char __pyx_k__join[] = "join"; static char __pyx_k__mapq[] = "mapq"; static char __pyx_k__mode[] = "mode"; static char __pyx_k__text[] = "text"; static char __pyx_k__zlib[] = "zlib"; static char __pyx_k___open[] = "_open"; static char __pyx_k__cigar[] = "cigar"; static char __pyx_k__close[] = "close"; static char __pyx_k__debug[] = "debug"; static char __pyx_k__error[] = "error"; static char __pyx_k__fetch[] = "fetch"; static char __pyx_k__isbam[] = "isbam"; static char __pyx_k__qname[] = "qname"; static char __pyx_k__range[] = "range"; static char __pyx_k__split[] = "split"; static char __pyx_k__start[] = "start"; static char __pyx_k__strip[] = "strip"; static char __pyx_k__theIt[] = "theIt"; static char __pyx_k__types[] = "types"; static char __pyx_k__logger[] = "logger"; static char __pyx_k__IOError[] = "IOError"; static char __pyx_k__logging[] = "logging"; static char __pyx_k__samfile[] = "samfile"; static char __pyx_k__theFile[] = "theFile"; static char __pyx_k__KeyError[] = "KeyError"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__fileName[] = "fileName"; static char __pyx_k__filename[] = "filename"; static char __pyx_k__useIndex[] = "useIndex"; static char __pyx_k__enumerate[] = "enumerate"; static char __pyx_k__getLogger[] = "getLogger"; static char __pyx_k__itertools[] = "itertools"; static char __pyx_k__loadIndex[] = "loadIndex"; static char __pyx_k__reference[] = "reference"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k__startswith[] = "startswith"; static char __pyx_k__StandardError[] = "StandardError"; static char __pyx_k__StopIteration[] = "StopIteration"; static char __pyx_k__VALID_HEADERS[] = "VALID_HEADERS"; static char __pyx_k__fetchAllReads[] = "fetchAllReads"; static char __pyx_k__bamIterPointer[] = "bamIterPointer"; static char __pyx_k__samFilePointer[] = "samFilePointer"; static char __pyx_k__indexesByRegion[] = "indexesByRegion"; static char __pyx_k__samtoolsWrapper[] = "samtoolsWrapper"; static char __pyx_k__unpickleSamfile[] = "unpickleSamfile"; static char __pyx_k__indexFilePointer[] = "indexFilePointer"; static char __pyx_k__VALID_HEADER_ORDER[] = "VALID_HEADER_ORDER"; static char __pyx_k__VALID_HEADER_TYPES[] = "VALID_HEADER_TYPES"; static char __pyx_k__VALID_HEADER_FIELDS[] = "VALID_HEADER_FIELDS"; static char __pyx_k__unpickleIteratorRow[] = "unpickleIteratorRow"; static PyObject *__pyx_kp_s_1; static PyObject *__pyx_kp_s_10; static PyObject *__pyx_kp_s_11; static PyObject *__pyx_kp_s_12; static PyObject *__pyx_kp_s_13; static PyObject *__pyx_kp_s_15; static PyObject *__pyx_kp_s_16; static PyObject *__pyx_kp_s_17; static PyObject *__pyx_kp_s_18; static PyObject *__pyx_kp_s_19; static PyObject *__pyx_kp_s_20; static PyObject *__pyx_kp_s_21; static PyObject *__pyx_kp_s_23; static PyObject *__pyx_kp_s_25; static PyObject *__pyx_kp_s_27; static PyObject *__pyx_kp_s_29; static PyObject *__pyx_kp_s_3; static PyObject *__pyx_kp_s_31; static PyObject *__pyx_kp_s_32; static PyObject *__pyx_kp_s_34; static PyObject *__pyx_kp_s_35; static PyObject *__pyx_kp_s_37; static PyObject *__pyx_kp_s_38; static PyObject *__pyx_kp_s_39; static PyObject *__pyx_kp_s_41; static PyObject *__pyx_kp_s_43; static PyObject *__pyx_kp_s_44; static PyObject *__pyx_kp_s_45; static PyObject *__pyx_kp_s_48; static PyObject *__pyx_kp_s_51; static PyObject *__pyx_kp_s_52; static PyObject *__pyx_kp_s_53; static PyObject *__pyx_kp_s_54; static PyObject *__pyx_kp_s_55; static PyObject *__pyx_kp_s_56; static PyObject *__pyx_kp_s_57; static PyObject *__pyx_kp_s_58; static PyObject *__pyx_kp_s_59; static PyObject *__pyx_kp_s_60; static PyObject *__pyx_kp_s_7; static PyObject *__pyx_kp_s_74; static PyObject *__pyx_kp_s_8; static PyObject *__pyx_n_s__A; static PyObject *__pyx_n_s__AS; static PyObject *__pyx_n_s__C; static PyObject *__pyx_n_s__CL; static PyObject *__pyx_n_s__CN; static PyObject *__pyx_n_s__CO; static PyObject *__pyx_n_s__DS; static PyObject *__pyx_n_s__DT; static PyObject *__pyx_n_s__GO; static PyObject *__pyx_n_s__HD; static PyObject *__pyx_n_s__ID; static PyObject *__pyx_n_s__IOError; static PyObject *__pyx_n_s__KeyError; static PyObject *__pyx_n_s__LB; static PyObject *__pyx_n_s__LN; static PyObject *__pyx_n_s__Log; static PyObject *__pyx_n_s__M5; static PyObject *__pyx_n_s__PG; static PyObject *__pyx_n_s__PI; static PyObject *__pyx_n_s__PL; static PyObject *__pyx_n_s__PN; static PyObject *__pyx_n_s__PP; static PyObject *__pyx_n_s__PU; static PyObject *__pyx_n_s__RG; static PyObject *__pyx_n_s__S; static PyObject *__pyx_n_s__SM; static PyObject *__pyx_n_s__SN; static PyObject *__pyx_n_s__SO; static PyObject *__pyx_n_s__SP; static PyObject *__pyx_n_s__SQ; static PyObject *__pyx_n_s__StandardError; static PyObject *__pyx_n_s__StopIteration; static PyObject *__pyx_n_s__UR; static PyObject *__pyx_n_s__VALID_HEADERS; static PyObject *__pyx_n_s__VALID_HEADER_FIELDS; static PyObject *__pyx_n_s__VALID_HEADER_ORDER; static PyObject *__pyx_n_s__VALID_HEADER_TYPES; static PyObject *__pyx_n_s__VN; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s__Z; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s___open; static PyObject *__pyx_n_s__b; static PyObject *__pyx_n_s__bamIterPointer; static PyObject *__pyx_n_s__beg; static PyObject *__pyx_n_s__c; static PyObject *__pyx_n_s__chr; static PyObject *__pyx_n_s__cigar; static PyObject *__pyx_n_s__close; static PyObject *__pyx_n_s__d; static PyObject *__pyx_n_s__debug; static PyObject *__pyx_n_s__end; static PyObject *__pyx_n_s__enumerate; static PyObject *__pyx_n_s__error; static PyObject *__pyx_n_s__f; static PyObject *__pyx_n_s__fetch; static PyObject *__pyx_n_s__fetchAllReads; static PyObject *__pyx_n_s__fileName; static PyObject *__pyx_n_s__filename; static PyObject *__pyx_n_s__getLogger; static PyObject *__pyx_n_s__h; static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__indexFilePointer; static PyObject *__pyx_n_s__indexesByRegion; static PyObject *__pyx_n_s__isbam; static PyObject *__pyx_n_s__itertools; static PyObject *__pyx_n_s__join; static PyObject *__pyx_n_s__loadIndex; static PyObject *__pyx_n_s__logger; static PyObject *__pyx_n_s__logging; static PyObject *__pyx_n_s__map; static PyObject *__pyx_n_s__mapq; static PyObject *__pyx_n_s__mode; static PyObject *__pyx_n_s__os; static PyObject *__pyx_n_s__qname; static PyObject *__pyx_n_s__r; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__rb; static PyObject *__pyx_n_s__rbh; static PyObject *__pyx_n_s__reference; static PyObject *__pyx_n_s__s; static PyObject *__pyx_n_s__samFilePointer; static PyObject *__pyx_n_s__samfile; static PyObject *__pyx_n_s__samtoolsWrapper; static PyObject *__pyx_n_s__split; static PyObject *__pyx_n_s__start; static PyObject *__pyx_n_s__startswith; static PyObject *__pyx_n_s__strip; static PyObject *__pyx_n_s__text; static PyObject *__pyx_n_s__theFile; static PyObject *__pyx_n_s__theIt; static PyObject *__pyx_n_s__tid; static PyObject *__pyx_n_s__types; static PyObject *__pyx_n_s__unpickleIteratorRow; static PyObject *__pyx_n_s__unpickleSamfile; static PyObject *__pyx_n_s__useIndex; static PyObject *__pyx_n_s__zlib; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_k_9; static PyObject *__pyx_k_tuple_2; static PyObject *__pyx_k_tuple_4; static PyObject *__pyx_k_tuple_5; static PyObject *__pyx_k_tuple_6; static PyObject *__pyx_k_tuple_14; static PyObject *__pyx_k_tuple_22; static PyObject *__pyx_k_tuple_24; static PyObject *__pyx_k_tuple_26; static PyObject *__pyx_k_tuple_28; static PyObject *__pyx_k_tuple_30; static PyObject *__pyx_k_tuple_33; static PyObject *__pyx_k_tuple_36; static PyObject *__pyx_k_tuple_40; static PyObject *__pyx_k_tuple_42; static PyObject *__pyx_k_tuple_46; static PyObject *__pyx_k_tuple_47; static PyObject *__pyx_k_tuple_49; static PyObject *__pyx_k_tuple_66; static PyObject *__pyx_k_tuple_67; static PyObject *__pyx_k_tuple_68; static PyObject *__pyx_k_tuple_69; static PyObject *__pyx_k_tuple_70; static PyObject *__pyx_k_tuple_71; static PyObject *__pyx_k_tuple_72; static PyObject *__pyx_k_tuple_75; static PyObject *__pyx_k_codeobj_73; static PyObject *__pyx_k_codeobj_76; /* "samtoolsWrapper.pyx":201 * ################################################################################################### * * cdef void my_free(void* thePointer): # <<<<<<<<<<<<<< * """ * Cython wrapper. Used for profiling. */ static void __pyx_f_15samtoolsWrapper_my_free(void *__pyx_v_thePointer) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("my_free", 0); /* "samtoolsWrapper.pyx":205 * Cython wrapper. Used for profiling. * """ * free(thePointer) # <<<<<<<<<<<<<< * * ################################################################################################### */ free(__pyx_v_thePointer); __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":209 * ################################################################################################### * * cdef void* my_malloc(size_t theSize): # <<<<<<<<<<<<<< * """ * Cython wrapper. Used for profiling. */ static void *__pyx_f_15samtoolsWrapper_my_malloc(size_t __pyx_v_theSize) { void *__pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("my_malloc", 0); /* "samtoolsWrapper.pyx":213 * Cython wrapper. Used for profiling. * """ * return malloc(theSize) # <<<<<<<<<<<<<< * * ################################################################################################### */ __pyx_r = malloc(__pyx_v_theSize); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":217 * ################################################################################################### * * cdef void* my_calloc(size_t theSize1, size_t theSize2): # <<<<<<<<<<<<<< * """ * Cython wrapper. Used for profiling. */ static void *__pyx_f_15samtoolsWrapper_my_calloc(size_t __pyx_v_theSize1, size_t __pyx_v_theSize2) { void *__pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("my_calloc", 0); /* "samtoolsWrapper.pyx":221 * Cython wrapper. Used for profiling. * """ * return calloc(theSize1, theSize2) # <<<<<<<<<<<<<< * * ################################################################################################### */ __pyx_r = calloc(__pyx_v_theSize1, __pyx_v_theSize2); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":225 * ################################################################################################### * * cdef void* my_realloc(void* thePointer, size_t newSize): # <<<<<<<<<<<<<< * """ * Cython wrapper. Used for profiling. */ static void *__pyx_f_15samtoolsWrapper_my_realloc(void *__pyx_v_thePointer, size_t __pyx_v_newSize) { void *__pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("my_realloc", 0); /* "samtoolsWrapper.pyx":229 * Cython wrapper. Used for profiling. * """ * return realloc(thePointer, newSize) # <<<<<<<<<<<<<< * * ################################################################################################### */ __pyx_r = realloc(__pyx_v_thePointer, __pyx_v_newSize); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_1unpickleSamfile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_15samtoolsWrapper_unpickleSamfile[] = "\n "; static PyMethodDef __pyx_mdef_15samtoolsWrapper_1unpickleSamfile = {__Pyx_NAMESTR("unpickleSamfile"), (PyCFunction)__pyx_pw_15samtoolsWrapper_1unpickleSamfile, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_15samtoolsWrapper_unpickleSamfile)}; static PyObject *__pyx_pw_15samtoolsWrapper_1unpickleSamfile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_samFilePointer = 0; PyObject *__pyx_v_indexFilePointer = 0; PyObject *__pyx_v_indexesByRegion = 0; PyObject *__pyx_v_isbam = 0; PyObject *__pyx_v_filename = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("unpickleSamfile (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samFilePointer,&__pyx_n_s__indexFilePointer,&__pyx_n_s__indexesByRegion,&__pyx_n_s__isbam,&__pyx_n_s__filename,0}; PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samFilePointer)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexFilePointer)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("unpickleSamfile", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexesByRegion)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("unpickleSamfile", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__isbam)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("unpickleSamfile", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("unpickleSamfile", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unpickleSamfile") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_samFilePointer = values[0]; __pyx_v_indexFilePointer = values[1]; __pyx_v_indexesByRegion = values[2]; __pyx_v_isbam = values[3]; __pyx_v_filename = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("unpickleSamfile", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("samtoolsWrapper.unpickleSamfile", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_15samtoolsWrapper_unpickleSamfile(__pyx_self, __pyx_v_samFilePointer, __pyx_v_indexFilePointer, __pyx_v_indexesByRegion, __pyx_v_isbam, __pyx_v_filename); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":292 * ###################################################################### * * def unpickleSamfile(samFilePointer, indexFilePointer, indexesByRegion, isbam, filename): # <<<<<<<<<<<<<< * """ * """ */ static PyObject *__pyx_pf_15samtoolsWrapper_unpickleSamfile(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_samFilePointer, PyObject *__pyx_v_indexFilePointer, PyObject *__pyx_v_indexesByRegion, PyObject *__pyx_v_isbam, PyObject *__pyx_v_filename) { struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_theFile = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_t_4; char *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("unpickleSamfile", 0); /* "samtoolsWrapper.pyx":296 * """ * #logger.debug("Calling Samfile unpickle") * cdef Samfile theFile = Samfile(filename) # <<<<<<<<<<<<<< * * if samFilePointer is None: */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_filename); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename); __Pyx_GIVEREF(__pyx_v_filename); __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_15samtoolsWrapper_Samfile)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_v_theFile = ((struct __pyx_obj_15samtoolsWrapper_Samfile *)__pyx_t_2); __pyx_t_2 = 0; /* "samtoolsWrapper.pyx":298 * cdef Samfile theFile = Samfile(filename) * * if samFilePointer is None: # <<<<<<<<<<<<<< * theFile.samfile = NULL * else: */ __pyx_t_3 = (__pyx_v_samFilePointer == Py_None); if (__pyx_t_3) { /* "samtoolsWrapper.pyx":299 * * if samFilePointer is None: * theFile.samfile = NULL # <<<<<<<<<<<<<< * else: * theFile.samfile = (samFilePointer) */ __pyx_v_theFile->samfile = NULL; goto __pyx_L3; } /*else*/ { /* "samtoolsWrapper.pyx":301 * theFile.samfile = NULL * else: * theFile.samfile = (samFilePointer) # <<<<<<<<<<<<<< * * if indexFilePointer is None: */ __pyx_v_theFile->samfile = ((samfile_t *)__pyx_v_samFilePointer); } __pyx_L3:; /* "samtoolsWrapper.pyx":303 * theFile.samfile = (samFilePointer) * * if indexFilePointer is None: # <<<<<<<<<<<<<< * theFile.index = NULL * else: */ __pyx_t_3 = (__pyx_v_indexFilePointer == Py_None); if (__pyx_t_3) { /* "samtoolsWrapper.pyx":304 * * if indexFilePointer is None: * theFile.index = NULL # <<<<<<<<<<<<<< * else: * theFile.index = (indexFilePointer) */ __pyx_v_theFile->index = NULL; goto __pyx_L4; } /*else*/ { /* "samtoolsWrapper.pyx":306 * theFile.index = NULL * else: * theFile.index = (indexFilePointer) # <<<<<<<<<<<<<< * * theFile.indexesByRegion = indexesByRegion */ __pyx_v_theFile->index = ((bam_index_t *)__pyx_v_indexFilePointer); } __pyx_L4:; /* "samtoolsWrapper.pyx":308 * theFile.index = (indexFilePointer) * * theFile.indexesByRegion = indexesByRegion # <<<<<<<<<<<<<< * theFile.isbam = isbam * theFile.filename = filename */ if (!(likely(PyDict_CheckExact(__pyx_v_indexesByRegion))||((__pyx_v_indexesByRegion) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_v_indexesByRegion)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_indexesByRegion); __Pyx_GIVEREF(__pyx_v_indexesByRegion); __Pyx_GOTREF(__pyx_v_theFile->indexesByRegion); __Pyx_DECREF(((PyObject *)__pyx_v_theFile->indexesByRegion)); __pyx_v_theFile->indexesByRegion = ((PyObject*)__pyx_v_indexesByRegion); /* "samtoolsWrapper.pyx":309 * * theFile.indexesByRegion = indexesByRegion * theFile.isbam = isbam # <<<<<<<<<<<<<< * theFile.filename = filename * */ __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_isbam); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_theFile->isbam = __pyx_t_4; /* "samtoolsWrapper.pyx":310 * theFile.indexesByRegion = indexesByRegion * theFile.isbam = isbam * theFile.filename = filename # <<<<<<<<<<<<<< * * #logger.debug("Done Calling Samfile unpickle") */ __pyx_t_5 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_theFile->filename = __pyx_t_5; /* "samtoolsWrapper.pyx":314 * #logger.debug("Done Calling Samfile unpickle") * * return theFile # <<<<<<<<<<<<<< * * ###################################################################### */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_theFile)); __pyx_r = ((PyObject *)__pyx_v_theFile); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("samtoolsWrapper.unpickleSamfile", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_theFile); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":318 * ###################################################################### * * cdef bam_index_t* my_bam_index_load(char *f): # <<<<<<<<<<<<<< * """ * Wrapper for profiling. */ static bam_index_t *__pyx_f_15samtoolsWrapper_my_bam_index_load(char *__pyx_v_f) { bam_index_t *__pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("my_bam_index_load", 0); /* "samtoolsWrapper.pyx":322 * Wrapper for profiling. * """ * return bam_index_load(f) # <<<<<<<<<<<<<< * * ###################################################################### */ __pyx_r = bam_index_load(__pyx_v_f); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_15samtoolsWrapper_7Samfile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_15samtoolsWrapper_7Samfile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_fileName = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fileName,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fileName)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_fileName = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("samtoolsWrapper.Samfile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_15samtoolsWrapper_7Samfile___cinit__(((struct __pyx_obj_15samtoolsWrapper_Samfile *)__pyx_v_self), __pyx_v_fileName); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":356 * access to reads via :meth:`fetch` and :meth:`pileup` is disabled. * """ * def __cinit__(self, fileName): # <<<<<<<<<<<<<< * """ * Constructor. */ static int __pyx_pf_15samtoolsWrapper_7Samfile___cinit__(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self, PyObject *__pyx_v_fileName) { int __pyx_r; __Pyx_RefNannyDeclarations char *__pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); /* "samtoolsWrapper.pyx":360 * Constructor. * """ * self.samfile = NULL # <<<<<<<<<<<<<< * self.isbam = False * self.filename = fileName */ __pyx_v_self->samfile = NULL; /* "samtoolsWrapper.pyx":361 * """ * self.samfile = NULL * self.isbam = False # <<<<<<<<<<<<<< * self.filename = fileName * self.index = NULL */ __pyx_v_self->isbam = 0; /* "samtoolsWrapper.pyx":362 * self.samfile = NULL * self.isbam = False * self.filename = fileName # <<<<<<<<<<<<<< * self.index = NULL * self.indexesByRegion = {} */ __pyx_t_1 = PyBytes_AsString(__pyx_v_fileName); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->filename = __pyx_t_1; /* "samtoolsWrapper.pyx":363 * self.isbam = False * self.filename = fileName * self.index = NULL # <<<<<<<<<<<<<< * self.indexesByRegion = {} * self.lock = None */ __pyx_v_self->index = NULL; /* "samtoolsWrapper.pyx":364 * self.filename = fileName * self.index = NULL * self.indexesByRegion = {} # <<<<<<<<<<<<<< * self.lock = None * */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __Pyx_GOTREF(__pyx_v_self->indexesByRegion); __Pyx_DECREF(((PyObject *)__pyx_v_self->indexesByRegion)); __pyx_v_self->indexesByRegion = __pyx_t_2; __pyx_t_2 = 0; /* "samtoolsWrapper.pyx":365 * self.index = NULL * self.indexesByRegion = {} * self.lock = None # <<<<<<<<<<<<<< * * def __dealloc__( self ): */ __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->lock); __Pyx_DECREF(__pyx_v_self->lock); __pyx_v_self->lock = Py_None; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("samtoolsWrapper.Samfile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static void __pyx_pw_15samtoolsWrapper_7Samfile_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_15samtoolsWrapper_7Samfile_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_15samtoolsWrapper_7Samfile_2__dealloc__(((struct __pyx_obj_15samtoolsWrapper_Samfile *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":367 * self.lock = None * * def __dealloc__( self ): # <<<<<<<<<<<<<< * """ * Clean up. Here I've pasted the code from several clean-up */ static void __pyx_pf_15samtoolsWrapper_7Samfile_2__dealloc__(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); /* "samtoolsWrapper.pyx":375 * # remember: dealloc cannot call other methods * # Note that __del__ is not called. * if self.samfile != NULL: # <<<<<<<<<<<<<< * samclose(self.samfile) * self.samfile = NULL */ __pyx_t_1 = (__pyx_v_self->samfile != NULL); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":376 * # Note that __del__ is not called. * if self.samfile != NULL: * samclose(self.samfile) # <<<<<<<<<<<<<< * self.samfile = NULL * */ samclose(__pyx_v_self->samfile); /* "samtoolsWrapper.pyx":377 * if self.samfile != NULL: * samclose(self.samfile) * self.samfile = NULL # <<<<<<<<<<<<<< * * if self.index != NULL: */ __pyx_v_self->samfile = NULL; goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":379 * self.samfile = NULL * * if self.index != NULL: # <<<<<<<<<<<<<< * bam_index_destroy(self.index); * self.index = NULL */ __pyx_t_1 = (__pyx_v_self->index != NULL); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":380 * * if self.index != NULL: * bam_index_destroy(self.index); # <<<<<<<<<<<<<< * self.index = NULL * */ bam_index_destroy(__pyx_v_self->index); /* "samtoolsWrapper.pyx":381 * if self.index != NULL: * bam_index_destroy(self.index); * self.index = NULL # <<<<<<<<<<<<<< * * cdef void clearHeader(self): */ __pyx_v_self->index = NULL; goto __pyx_L4; } __pyx_L4:; __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":383 * self.index = NULL * * cdef void clearHeader(self): # <<<<<<<<<<<<<< * """ * Clear all the header data. */ static void __pyx_f_15samtoolsWrapper_7Samfile_clearHeader(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("clearHeader", 0); /* "samtoolsWrapper.pyx":387 * Clear all the header data. * """ * if self.samfile.header != NULL: # <<<<<<<<<<<<<< * bam_header_destroy(self.samfile.header) * self.samfile.header = NULL */ __pyx_t_1 = (__pyx_v_self->samfile->header != NULL); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":388 * """ * if self.samfile.header != NULL: * bam_header_destroy(self.samfile.header) # <<<<<<<<<<<<<< * self.samfile.header = NULL * */ bam_header_destroy(__pyx_v_self->samfile->header); /* "samtoolsWrapper.pyx":389 * if self.samfile.header != NULL: * bam_header_destroy(self.samfile.header) * self.samfile.header = NULL # <<<<<<<<<<<<<< * * cdef void clearIndex(self): */ __pyx_v_self->samfile->header = NULL; goto __pyx_L3; } __pyx_L3:; __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":391 * self.samfile.header = NULL * * cdef void clearIndex(self): # <<<<<<<<<<<<<< * """ * Clear all the index file data */ static void __pyx_f_15samtoolsWrapper_7Samfile_clearIndex(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("clearIndex", 0); /* "samtoolsWrapper.pyx":395 * Clear all the index file data * """ * if self.index != NULL: # <<<<<<<<<<<<<< * bam_index_destroy(self.index); * self.index = NULL */ __pyx_t_1 = (__pyx_v_self->index != NULL); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":396 * """ * if self.index != NULL: * bam_index_destroy(self.index); # <<<<<<<<<<<<<< * self.index = NULL * */ bam_index_destroy(__pyx_v_self->index); /* "samtoolsWrapper.pyx":397 * if self.index != NULL: * bam_index_destroy(self.index); * self.index = NULL # <<<<<<<<<<<<<< * * cdef void clearCache(self): */ __pyx_v_self->index = NULL; goto __pyx_L3; } __pyx_L3:; __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":399 * self.index = NULL * * cdef void clearCache(self): # <<<<<<<<<<<<<< * """ * Each BGZF file has 2 64kb buffers. If required, I clear these and set them to NULL, */ static void __pyx_f_15samtoolsWrapper_7Samfile_clearCache(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("clearCache", 0); /* "samtoolsWrapper.pyx":406 * standard C i/o buffer is 4kb per file, which is small enough to not be a problem for now. * """ * if self.samfile.x.bam.uncompressed_block != NULL: # <<<<<<<<<<<<<< * free(self.samfile.x.bam.uncompressed_block) * self.samfile.x.bam.uncompressed_block = NULL */ __pyx_t_1 = (__pyx_v_self->samfile->x.bam->uncompressed_block != NULL); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":407 * """ * if self.samfile.x.bam.uncompressed_block != NULL: * free(self.samfile.x.bam.uncompressed_block) # <<<<<<<<<<<<<< * self.samfile.x.bam.uncompressed_block = NULL * */ free(__pyx_v_self->samfile->x.bam->uncompressed_block); /* "samtoolsWrapper.pyx":408 * if self.samfile.x.bam.uncompressed_block != NULL: * free(self.samfile.x.bam.uncompressed_block) * self.samfile.x.bam.uncompressed_block = NULL # <<<<<<<<<<<<<< * * if self.samfile.x.bam.compressed_block != NULL: */ __pyx_v_self->samfile->x.bam->uncompressed_block = NULL; goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":410 * self.samfile.x.bam.uncompressed_block = NULL * * if self.samfile.x.bam.compressed_block != NULL: # <<<<<<<<<<<<<< * free(self.samfile.x.bam.compressed_block) * self.samfile.x.bam.compressed_block = NULL */ __pyx_t_1 = (__pyx_v_self->samfile->x.bam->compressed_block != NULL); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":411 * * if self.samfile.x.bam.compressed_block != NULL: * free(self.samfile.x.bam.compressed_block) # <<<<<<<<<<<<<< * self.samfile.x.bam.compressed_block = NULL * */ free(__pyx_v_self->samfile->x.bam->compressed_block); /* "samtoolsWrapper.pyx":412 * if self.samfile.x.bam.compressed_block != NULL: * free(self.samfile.x.bam.compressed_block) * self.samfile.x.bam.compressed_block = NULL # <<<<<<<<<<<<<< * * cdef void createCache(self): */ __pyx_v_self->samfile->x.bam->compressed_block = NULL; goto __pyx_L4; } __pyx_L4:; __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":414 * self.samfile.x.bam.compressed_block = NULL * * cdef void createCache(self): # <<<<<<<<<<<<<< * """ * If we have previously cleared the cache, then create it again. */ static void __pyx_f_15samtoolsWrapper_7Samfile_createCache(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self) { __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("createCache", 0); /* "samtoolsWrapper.pyx":418 * If we have previously cleared the cache, then create it again. * """ * if self.samfile != NULL: # <<<<<<<<<<<<<< * if self.samfile.x.bam.uncompressed_block == NULL: * self.samfile.x.bam.uncompressed_block = malloc(64*1024) */ __pyx_t_1 = (__pyx_v_self->samfile != NULL); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":419 * """ * if self.samfile != NULL: * if self.samfile.x.bam.uncompressed_block == NULL: # <<<<<<<<<<<<<< * self.samfile.x.bam.uncompressed_block = malloc(64*1024) * */ __pyx_t_1 = (__pyx_v_self->samfile->x.bam->uncompressed_block == NULL); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":420 * if self.samfile != NULL: * if self.samfile.x.bam.uncompressed_block == NULL: * self.samfile.x.bam.uncompressed_block = malloc(64*1024) # <<<<<<<<<<<<<< * * if self.samfile.x.bam.uncompressed_block == NULL: */ __pyx_v_self->samfile->x.bam->uncompressed_block = malloc(65536); /* "samtoolsWrapper.pyx":422 * self.samfile.x.bam.uncompressed_block = malloc(64*1024) * * if self.samfile.x.bam.uncompressed_block == NULL: # <<<<<<<<<<<<<< * logger.error("Could not allocate BAM BGZF buffer in Samfile.createCache()") * raise StandardError, "Out of memory" */ __pyx_t_1 = (__pyx_v_self->samfile->x.bam->uncompressed_block == NULL); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":423 * * if self.samfile.x.bam.uncompressed_block == NULL: * logger.error("Could not allocate BAM BGZF buffer in Samfile.createCache()") # <<<<<<<<<<<<<< * raise StandardError, "Out of memory" * */ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__error); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "samtoolsWrapper.pyx":424 * if self.samfile.x.bam.uncompressed_block == NULL: * logger.error("Could not allocate BAM BGZF buffer in Samfile.createCache()") * raise StandardError, "Out of memory" # <<<<<<<<<<<<<< * * if self.samfile.x.bam.compressed_block == NULL: */ __Pyx_Raise(__pyx_builtin_StandardError, ((PyObject *)__pyx_kp_s_3), 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; goto __pyx_L4; } __pyx_L4:; /* "samtoolsWrapper.pyx":426 * raise StandardError, "Out of memory" * * if self.samfile.x.bam.compressed_block == NULL: # <<<<<<<<<<<<<< * self.samfile.x.bam.compressed_block = malloc(64*1024) * */ __pyx_t_1 = (__pyx_v_self->samfile->x.bam->compressed_block == NULL); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":427 * * if self.samfile.x.bam.compressed_block == NULL: * self.samfile.x.bam.compressed_block = malloc(64*1024) # <<<<<<<<<<<<<< * * if self.samfile.x.bam.compressed_block == NULL: */ __pyx_v_self->samfile->x.bam->compressed_block = malloc(65536); /* "samtoolsWrapper.pyx":429 * self.samfile.x.bam.compressed_block = malloc(64*1024) * * if self.samfile.x.bam.compressed_block == NULL: # <<<<<<<<<<<<<< * logger.error("Could not allocate BAM BGZF buffer in Samfile.createCache()") * raise StandardError, "Out of memory" */ __pyx_t_1 = (__pyx_v_self->samfile->x.bam->compressed_block == NULL); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":430 * * if self.samfile.x.bam.compressed_block == NULL: * logger.error("Could not allocate BAM BGZF buffer in Samfile.createCache()") # <<<<<<<<<<<<<< * raise StandardError, "Out of memory" * */ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__error); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "samtoolsWrapper.pyx":431 * if self.samfile.x.bam.compressed_block == NULL: * logger.error("Could not allocate BAM BGZF buffer in Samfile.createCache()") * raise StandardError, "Out of memory" # <<<<<<<<<<<<<< * * def __reduce__(self): */ __Pyx_Raise(__pyx_builtin_StandardError, ((PyObject *)__pyx_kp_s_3), 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; goto __pyx_L6; } __pyx_L6:; goto __pyx_L3; } __pyx_L3:; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_WriteUnraisable("samtoolsWrapper.Samfile.createCache", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_15samtoolsWrapper_7Samfile_4__reduce__[] = "\n This function is called by Pickle/cPickle in order to grab the state of this\n object.\n "; static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); __pyx_r = __pyx_pf_15samtoolsWrapper_7Samfile_4__reduce__(((struct __pyx_obj_15samtoolsWrapper_Samfile *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":433 * raise StandardError, "Out of memory" * * def __reduce__(self): # <<<<<<<<<<<<<< * """ * This function is called by Pickle/cPickle in order to grab the state of this */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_4__reduce__(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self) { int __pyx_v_samFilePointer; int __pyx_v_indexFilePointer; PyObject *__pyx_v_data = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); /* "samtoolsWrapper.pyx":439 * """ * #logger.debug("Calling Samfile reduce") * cdef int samFilePointer = (self.samfile) # <<<<<<<<<<<<<< * cdef int indexFilePointer = (self.index) * #print "Pointer values are as follows: Sam file = %s. Index = %s" %(samFilePointer, indexFilePointer) */ __pyx_v_samFilePointer = ((int)__pyx_v_self->samfile); /* "samtoolsWrapper.pyx":440 * #logger.debug("Calling Samfile reduce") * cdef int samFilePointer = (self.samfile) * cdef int indexFilePointer = (self.index) # <<<<<<<<<<<<<< * #print "Pointer values are as follows: Sam file = %s. Index = %s" %(samFilePointer, indexFilePointer) * */ __pyx_v_indexFilePointer = ((int)__pyx_v_self->index); /* "samtoolsWrapper.pyx":443 * #print "Pointer values are as follows: Sam file = %s. Index = %s" %(samFilePointer, indexFilePointer) * * data = (samFilePointer, indexFilePointer, self.indexesByRegion, self.isbam, self.filename) # <<<<<<<<<<<<<< * * if self.samfile == NULL: */ __pyx_t_1 = PyInt_FromLong(__pyx_v_samFilePointer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyInt_FromLong(__pyx_v_indexFilePointer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyInt_FromLong(__pyx_v_self->isbam); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyBytes_FromString(__pyx_v_self->filename); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_self->indexesByRegion)); PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_v_self->indexesByRegion)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->indexesByRegion)); PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 4, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_v_data = __pyx_t_5; __pyx_t_5 = 0; /* "samtoolsWrapper.pyx":445 * data = (samFilePointer, indexFilePointer, self.indexesByRegion, self.isbam, self.filename) * * if self.samfile == NULL: # <<<<<<<<<<<<<< * data = (None,) + data[1:] * */ __pyx_t_6 = (__pyx_v_self->samfile == NULL); if (__pyx_t_6) { /* "samtoolsWrapper.pyx":446 * * if self.samfile == NULL: * data = (None,) + data[1:] # <<<<<<<<<<<<<< * * if self.index == NULL: */ __pyx_t_5 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_data), 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_k_tuple_5), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_data)); __pyx_v_data = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":448 * data = (None,) + data[1:] * * if self.index == NULL: # <<<<<<<<<<<<<< * data = data[0:1] + (None,) + data[2:] * */ __pyx_t_6 = (__pyx_v_self->index == NULL); if (__pyx_t_6) { /* "samtoolsWrapper.pyx":449 * * if self.index == NULL: * data = data[0:1] + (None,) + data[2:] # <<<<<<<<<<<<<< * * #logger.debug("Done Calling Samfile reduce") */ __pyx_t_4 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_data), 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_k_tuple_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_data), 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_data)); __pyx_v_data = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L4; } __pyx_L4:; /* "samtoolsWrapper.pyx":452 * * #logger.debug("Done Calling Samfile reduce") * return (unpickleSamfile, data) # <<<<<<<<<<<<<< * * cdef int _isOpen( self ): */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__unpickleSamfile); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_data)); PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_data)); __Pyx_GIVEREF(((PyObject *)__pyx_v_data)); __pyx_t_3 = 0; __pyx_r = ((PyObject *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("samtoolsWrapper.Samfile.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_data); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":454 * return (unpickleSamfile, data) * * cdef int _isOpen( self ): # <<<<<<<<<<<<<< * '''return true if samfile has been opened.''' * return self.samfile != NULL */ static int __pyx_f_15samtoolsWrapper_7Samfile__isOpen(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_isOpen", 0); /* "samtoolsWrapper.pyx":456 * cdef int _isOpen( self ): * '''return true if samfile has been opened.''' * return self.samfile != NULL # <<<<<<<<<<<<<< * * cdef _hasIndex( self ): */ __pyx_r = (__pyx_v_self->samfile != NULL); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":458 * return self.samfile != NULL * * cdef _hasIndex( self ): # <<<<<<<<<<<<<< * '''return true if samfile has an existing (and opened) index.''' * return self.index != NULL */ static PyObject *__pyx_f_15samtoolsWrapper_7Samfile__hasIndex(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_hasIndex", 0); /* "samtoolsWrapper.pyx":460 * cdef _hasIndex( self ): * '''return true if samfile has an existing (and opened) index.''' * return self.index != NULL # <<<<<<<<<<<<<< * * cdef void openBAMFile(self, mode): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->index != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("samtoolsWrapper.Samfile._hasIndex", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":462 * return self.index != NULL * * cdef void openBAMFile(self, mode): # <<<<<<<<<<<<<< * """ * """ */ static void __pyx_f_15samtoolsWrapper_7Samfile_openBAMFile(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self, PyObject *__pyx_v_mode) { __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; Py_ssize_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("openBAMFile", 0); /* "samtoolsWrapper.pyx":465 * """ * """ * self.samfile = calloc(1, sizeof(samfile_t)) # <<<<<<<<<<<<<< * * if mode[0] == 'r': */ __pyx_v_self->samfile = ((samfile_t *)calloc(1, (sizeof(samfile_t)))); /* "samtoolsWrapper.pyx":467 * self.samfile = calloc(1, sizeof(samfile_t)) * * if mode[0] == 'r': # <<<<<<<<<<<<<< * self.samfile.type |= TYPE_READ * */ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__r), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { /* "samtoolsWrapper.pyx":468 * * if mode[0] == 'r': * self.samfile.type |= TYPE_READ # <<<<<<<<<<<<<< * * if len(mode) > 1 and mode[1] == 'b': */ __pyx_v_self->samfile->type = (__pyx_v_self->samfile->type | __pyx_v_15samtoolsWrapper_TYPE_READ); /* "samtoolsWrapper.pyx":470 * self.samfile.type |= TYPE_READ * * if len(mode) > 1 and mode[1] == 'b': # <<<<<<<<<<<<<< * self.samfile.type |= TYPE_BAM * self.samfile.x.bam = bam_open(self.filename, "r") */ __pyx_t_4 = PyObject_Length(__pyx_v_mode); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = (__pyx_t_4 > 1); if (__pyx_t_3) { __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__b), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = __pyx_t_5; } else { __pyx_t_6 = __pyx_t_3; } if (__pyx_t_6) { /* "samtoolsWrapper.pyx":471 * * if len(mode) > 1 and mode[1] == 'b': * self.samfile.type |= TYPE_BAM # <<<<<<<<<<<<<< * self.samfile.x.bam = bam_open(self.filename, "r") * */ __pyx_v_self->samfile->type = (__pyx_v_self->samfile->type | __pyx_v_15samtoolsWrapper_TYPE_BAM); /* "samtoolsWrapper.pyx":472 * if len(mode) > 1 and mode[1] == 'b': * self.samfile.type |= TYPE_BAM * self.samfile.x.bam = bam_open(self.filename, "r") # <<<<<<<<<<<<<< * * if (self.samfile.x.bam) == NULL: */ __pyx_v_self->samfile->x.bam = bam_open(__pyx_v_self->filename, __pyx_k__r); /* "samtoolsWrapper.pyx":474 * self.samfile.x.bam = bam_open(self.filename, "r") * * if (self.samfile.x.bam) == NULL: # <<<<<<<<<<<<<< * raise StandardError, "Could not open BAM file %s" %(self.filename) * else: */ __pyx_t_6 = (((BGZF *)__pyx_v_self->samfile->x.bam) == NULL); if (__pyx_t_6) { /* "samtoolsWrapper.pyx":475 * * if (self.samfile.x.bam) == NULL: * raise StandardError, "Could not open BAM file %s" %(self.filename) # <<<<<<<<<<<<<< * else: * raise StandardError, "Writing to BAM files not supported" */ __pyx_t_1 = PyBytes_FromString(__pyx_v_self->filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_Raise(__pyx_builtin_StandardError, ((PyObject *)__pyx_t_2), 0, 0); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; goto __pyx_L4; } __pyx_L4:; goto __pyx_L3; } /*else*/ { /* "samtoolsWrapper.pyx":477 * raise StandardError, "Could not open BAM file %s" %(self.filename) * else: * raise StandardError, "Writing to BAM files not supported" # <<<<<<<<<<<<<< * * if len(mode) > 2 and mode[2] == 'h': */ __Pyx_Raise(__pyx_builtin_StandardError, ((PyObject *)__pyx_kp_s_8), 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; /* "samtoolsWrapper.pyx":479 * raise StandardError, "Writing to BAM files not supported" * * if len(mode) > 2 and mode[2] == 'h': # <<<<<<<<<<<<<< * self.samfile.header = bam_header_read(self.samfile.x.bam) * else: */ __pyx_t_4 = PyObject_Length(__pyx_v_mode); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = (__pyx_t_4 > 2); if (__pyx_t_6) { __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__h), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __pyx_t_3; } else { __pyx_t_5 = __pyx_t_6; } if (__pyx_t_5) { /* "samtoolsWrapper.pyx":480 * * if len(mode) > 2 and mode[2] == 'h': * self.samfile.header = bam_header_read(self.samfile.x.bam) # <<<<<<<<<<<<<< * else: * self.samfile.header = NULL */ __pyx_v_self->samfile->header = bam_header_read(__pyx_v_self->samfile->x.bam); goto __pyx_L6; } /*else*/ { /* "samtoolsWrapper.pyx":482 * self.samfile.header = bam_header_read(self.samfile.x.bam) * else: * self.samfile.header = NULL # <<<<<<<<<<<<<< * * cpdef _open(self, mode, loadIndex=True): */ __pyx_v_self->samfile->header = NULL; } __pyx_L6:; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_WriteUnraisable("samtoolsWrapper.Samfile.openBAMFile", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":484 * self.samfile.header = NULL * * cpdef _open(self, mode, loadIndex=True): # <<<<<<<<<<<<<< * """ * open a sam/bam file. */ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_7_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_15samtoolsWrapper_7Samfile__open(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self, PyObject *__pyx_v_mode, int __pyx_skip_dispatch, struct __pyx_opt_args_15samtoolsWrapper_7Samfile__open *__pyx_optional_args) { PyObject *__pyx_v_loadIndex = __pyx_k_9; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; Py_ssize_t __pyx_t_7; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_open", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_loadIndex = __pyx_optional_args->loadIndex; } } /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_15samtoolsWrapper_7Samfile_7_open)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_mode); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_mode); __Pyx_GIVEREF(__pyx_v_mode); __Pyx_INCREF(__pyx_v_loadIndex); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_loadIndex); __Pyx_GIVEREF(__pyx_v_loadIndex); __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "samtoolsWrapper.pyx":491 * closed and a new file will be opened. * """ * if mode not in ("r","rb", "rbh"): # <<<<<<<<<<<<<< * raise StandardError, "invalid file opening mode `%s`" % mode * */ __Pyx_INCREF(__pyx_v_mode); __pyx_t_1 = __pyx_v_mode; __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__r), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (((int)__pyx_t_4)) { __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__rb), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = ((int)__pyx_t_5); } else { __pyx_t_6 = ((int)__pyx_t_4); } if (__pyx_t_6) { __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__rbh), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = ((int)__pyx_t_4); } else { __pyx_t_5 = __pyx_t_6; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = __pyx_t_5; if (__pyx_t_6) { /* "samtoolsWrapper.pyx":492 * """ * if mode not in ("r","rb", "rbh"): * raise StandardError, "invalid file opening mode `%s`" % mode # <<<<<<<<<<<<<< * * # If file is already open, do nothing. */ __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_v_mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_Raise(__pyx_builtin_StandardError, ((PyObject *)__pyx_t_1), 0, 0); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":495 * * # If file is already open, do nothing. * if self.samfile != NULL: # <<<<<<<<<<<<<< * if loadIndex and self.index == NULL: * self.index = my_bam_index_load(self.filename) */ __pyx_t_6 = (__pyx_v_self->samfile != NULL); if (__pyx_t_6) { /* "samtoolsWrapper.pyx":496 * # If file is already open, do nothing. * if self.samfile != NULL: * if loadIndex and self.index == NULL: # <<<<<<<<<<<<<< * self.index = my_bam_index_load(self.filename) * */ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_loadIndex); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_6) { __pyx_t_5 = (__pyx_v_self->index == NULL); __pyx_t_4 = __pyx_t_5; } else { __pyx_t_4 = __pyx_t_6; } if (__pyx_t_4) { /* "samtoolsWrapper.pyx":497 * if self.samfile != NULL: * if loadIndex and self.index == NULL: * self.index = my_bam_index_load(self.filename) # <<<<<<<<<<<<<< * * return */ __pyx_v_self->index = __pyx_f_15samtoolsWrapper_my_bam_index_load(__pyx_v_self->filename); goto __pyx_L5; } __pyx_L5:; /* "samtoolsWrapper.pyx":499 * self.index = my_bam_index_load(self.filename) * * return # <<<<<<<<<<<<<< * * self.samfile = NULL */ __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; goto __pyx_L4; } __pyx_L4:; /* "samtoolsWrapper.pyx":501 * return * * self.samfile = NULL # <<<<<<<<<<<<<< * self.isbam = len(mode) > 1 and mode[1] == 'b' * */ __pyx_v_self->samfile = NULL; /* "samtoolsWrapper.pyx":502 * * self.samfile = NULL * self.isbam = len(mode) > 1 and mode[1] == 'b' # <<<<<<<<<<<<<< * * if mode[0] == "r": */ __pyx_t_7 = PyObject_Length(__pyx_v_mode); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_t_7 > 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_4) { __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_mode, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__b), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __pyx_t_2; __pyx_t_2 = 0; } else { __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; } __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->isbam = __pyx_t_8; /* "samtoolsWrapper.pyx":504 * self.isbam = len(mode) > 1 and mode[1] == 'b' * * if mode[0] == "r": # <<<<<<<<<<<<<< * self.openBAMFile(mode) * else: */ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__r), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_4) { /* "samtoolsWrapper.pyx":505 * * if mode[0] == "r": * self.openBAMFile(mode) # <<<<<<<<<<<<<< * else: * raise StandardError, "BAM file is read-only" */ ((struct __pyx_vtabstruct_15samtoolsWrapper_Samfile *)__pyx_v_self->__pyx_vtab)->openBAMFile(__pyx_v_self, __pyx_v_mode); goto __pyx_L6; } /*else*/ { /* "samtoolsWrapper.pyx":507 * self.openBAMFile(mode) * else: * raise StandardError, "BAM file is read-only" # <<<<<<<<<<<<<< * * if self.samfile == NULL: */ __Pyx_Raise(__pyx_builtin_StandardError, ((PyObject *)__pyx_kp_s_11), 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L6:; /* "samtoolsWrapper.pyx":509 * raise StandardError, "BAM file is read-only" * * if self.samfile == NULL: # <<<<<<<<<<<<<< * raise IOError("Could not open file `%s`. Check that file/path exists." % self.filename ) * */ __pyx_t_4 = (__pyx_v_self->samfile == NULL); if (__pyx_t_4) { /* "samtoolsWrapper.pyx":510 * * if self.samfile == NULL: * raise IOError("Could not open file `%s`. Check that file/path exists." % self.filename ) # <<<<<<<<<<<<<< * * if mode[0] == "r" and self.isbam: */ __pyx_t_1 = PyBytes_FromString(__pyx_v_self->filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "samtoolsWrapper.pyx":512 * raise IOError("Could not open file `%s`. Check that file/path exists." % self.filename ) * * if mode[0] == "r" and self.isbam: # <<<<<<<<<<<<<< * # returns NULL if there is no index or index could not be opened * if loadIndex and self.index == NULL: */ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__r), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_4) { __pyx_t_6 = __pyx_v_self->isbam; } else { __pyx_t_6 = __pyx_t_4; } if (__pyx_t_6) { /* "samtoolsWrapper.pyx":514 * if mode[0] == "r" and self.isbam: * # returns NULL if there is no index or index could not be opened * if loadIndex and self.index == NULL: # <<<<<<<<<<<<<< * self.index = my_bam_index_load(self.filename) * */ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_loadIndex); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_6) { __pyx_t_4 = (__pyx_v_self->index == NULL); __pyx_t_5 = __pyx_t_4; } else { __pyx_t_5 = __pyx_t_6; } if (__pyx_t_5) { /* "samtoolsWrapper.pyx":515 * # returns NULL if there is no index or index could not be opened * if loadIndex and self.index == NULL: * self.index = my_bam_index_load(self.filename) # <<<<<<<<<<<<<< * * if self.index == NULL: */ __pyx_v_self->index = __pyx_f_15samtoolsWrapper_my_bam_index_load(__pyx_v_self->filename); /* "samtoolsWrapper.pyx":517 * self.index = my_bam_index_load(self.filename) * * if self.index == NULL: # <<<<<<<<<<<<<< * raise IOError("Error while opening index for file `%s`. Check that index exists " % self.filename) * */ __pyx_t_5 = (__pyx_v_self->index == NULL); if (__pyx_t_5) { /* "samtoolsWrapper.pyx":518 * * if self.index == NULL: * raise IOError("Error while opening index for file `%s`. Check that index exists " % self.filename) # <<<<<<<<<<<<<< * * cdef void loadOffsetsForRegions(self, list regions): */ __pyx_t_1 = PyBytes_FromString(__pyx_v_self->filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L10; } __pyx_L10:; goto __pyx_L9; } __pyx_L9:; goto __pyx_L8; } __pyx_L8:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("samtoolsWrapper.Samfile._open", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_7_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_15samtoolsWrapper_7Samfile_6_open[] = "\n open a sam/bam file.\n\n If _open is called on an existing bamfile, the current file will be\n closed and a new file will be opened.\n "; static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_7_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_mode = 0; PyObject *__pyx_v_loadIndex = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_open (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mode,&__pyx_n_s__loadIndex,0}; PyObject* values[2] = {0,0}; values[1] = __pyx_k_9; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loadIndex); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_open") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_mode = values[0]; __pyx_v_loadIndex = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_open", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("samtoolsWrapper.Samfile._open", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_15samtoolsWrapper_7Samfile_6_open(((struct __pyx_obj_15samtoolsWrapper_Samfile *)__pyx_v_self), __pyx_v_mode, __pyx_v_loadIndex); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":484 * self.samfile.header = NULL * * cpdef _open(self, mode, loadIndex=True): # <<<<<<<<<<<<<< * """ * open a sam/bam file. */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_6_open(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self, PyObject *__pyx_v_mode, PyObject *__pyx_v_loadIndex) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; struct __pyx_opt_args_15samtoolsWrapper_7Samfile__open __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_open", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.loadIndex = __pyx_v_loadIndex; __pyx_t_1 = ((struct __pyx_vtabstruct_15samtoolsWrapper_Samfile *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self, __pyx_v_mode, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("samtoolsWrapper.Samfile._open", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":520 * raise IOError("Error while opening index for file `%s`. Check that index exists " % self.filename) * * cdef void loadOffsetsForRegions(self, list regions): # <<<<<<<<<<<<<< * """ * Load, and maintain an internal cache, of the file off-sets needed to access */ static void __pyx_f_15samtoolsWrapper_7Samfile_loadOffsetsForRegions(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self, PyObject *__pyx_v_regions) { struct __pyx_obj_15samtoolsWrapper_IteratorRow *__pyx_v_theIterator = 0; CYTHON_UNUSED bamFile *__pyx_v_fp; int __pyx_v_rtid; int __pyx_v_rstart; int __pyx_v_rend; CYTHON_UNUSED int __pyx_v_n_off; CYTHON_UNUSED int __pyx_v_index; CYTHON_UNUSED int __pyx_v_nRegions; PyObject *__pyx_v_chrom = NULL; PyObject *__pyx_v_start = NULL; PyObject *__pyx_v_end = NULL; CYTHON_UNUSED PyObject *__pyx_v_region = NULL; __Pyx_RefNannyDeclarations bamFile *__pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; Py_ssize_t __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *(*__pyx_t_11)(PyObject *); struct __pyx_opt_args_15samtoolsWrapper_7Samfile__parseRegion __pyx_t_12; PyObject *__pyx_t_13 = NULL; int __pyx_t_14; int __pyx_t_15; int __pyx_t_16; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("loadOffsetsForRegions", 0); /* "samtoolsWrapper.pyx":528 * """ * cdef IteratorRow theIterator * cdef bamFile* fp = self.samfile.x.bam # <<<<<<<<<<<<<< * cdef int rtid = -1 * cdef int rstart = -1 */ __pyx_t_1 = __pyx_v_self->samfile->x.bam; __pyx_v_fp = __pyx_t_1; /* "samtoolsWrapper.pyx":529 * cdef IteratorRow theIterator * cdef bamFile* fp = self.samfile.x.bam * cdef int rtid = -1 # <<<<<<<<<<<<<< * cdef int rstart = -1 * cdef int rend = -1 */ __pyx_v_rtid = -1; /* "samtoolsWrapper.pyx":530 * cdef bamFile* fp = self.samfile.x.bam * cdef int rtid = -1 * cdef int rstart = -1 # <<<<<<<<<<<<<< * cdef int rend = -1 * cdef int n_off = -1 */ __pyx_v_rstart = -1; /* "samtoolsWrapper.pyx":531 * cdef int rtid = -1 * cdef int rstart = -1 * cdef int rend = -1 # <<<<<<<<<<<<<< * cdef int n_off = -1 * cdef int index = 0 */ __pyx_v_rend = -1; /* "samtoolsWrapper.pyx":532 * cdef int rstart = -1 * cdef int rend = -1 * cdef int n_off = -1 # <<<<<<<<<<<<<< * cdef int index = 0 * */ __pyx_v_n_off = -1; /* "samtoolsWrapper.pyx":533 * cdef int rend = -1 * cdef int n_off = -1 * cdef int index = 0 # <<<<<<<<<<<<<< * * if not self._isOpen(): */ __pyx_v_index = 0; /* "samtoolsWrapper.pyx":535 * cdef int index = 0 * * if not self._isOpen(): # <<<<<<<<<<<<<< * self._open('rbh', loadIndex=True) # Change to False * */ __pyx_t_2 = (!((struct __pyx_vtabstruct_15samtoolsWrapper_Samfile *)__pyx_v_self->__pyx_vtab)->_isOpen(__pyx_v_self)); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":536 * * if not self._isOpen(): * self._open('rbh', loadIndex=True) # Change to False # <<<<<<<<<<<<<< * * if self.index == NULL: */ __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___open); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_5 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__loadIndex), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_14), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":538 * self._open('rbh', loadIndex=True) # Change to False * * if self.index == NULL: # <<<<<<<<<<<<<< * self.index = my_bam_index_load(self.filename) * */ __pyx_t_2 = (__pyx_v_self->index == NULL); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":539 * * if self.index == NULL: * self.index = my_bam_index_load(self.filename) # <<<<<<<<<<<<<< * * if self.index == NULL: */ __pyx_v_self->index = __pyx_f_15samtoolsWrapper_my_bam_index_load(__pyx_v_self->filename); goto __pyx_L4; } __pyx_L4:; /* "samtoolsWrapper.pyx":541 * self.index = my_bam_index_load(self.filename) * * if self.index == NULL: # <<<<<<<<<<<<<< * raise IOError("Error while opening index for file `%s`. Check that index exists " % self.filename) * */ __pyx_t_2 = (__pyx_v_self->index == NULL); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":542 * * if self.index == NULL: * raise IOError("Error while opening index for file `%s`. Check that index exists " % self.filename) # <<<<<<<<<<<<<< * * cdef int nRegions = len(regions) */ __pyx_t_5 = PyBytes_FromString(__pyx_v_self->filename); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "samtoolsWrapper.pyx":544 * raise IOError("Error while opening index for file `%s`. Check that index exists " % self.filename) * * cdef int nRegions = len(regions) # <<<<<<<<<<<<<< * * for index,(chrom,start,end) in enumerate(regions): */ if (unlikely(((PyObject *)__pyx_v_regions) == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_6 = PyList_GET_SIZE(((PyObject *)__pyx_v_regions)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_nRegions = __pyx_t_6; /* "samtoolsWrapper.pyx":546 * cdef int nRegions = len(regions) * * for index,(chrom,start,end) in enumerate(regions): # <<<<<<<<<<<<<< * region, rtid, rstart, rend = self._parseRegion(chrom, start, end) * theIterator = IteratorRow(self, rtid, rstart, rend, useIndex=1) */ __pyx_t_7 = 0; __pyx_t_4 = ((PyObject *)__pyx_v_regions); __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0; for (;;) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { PyObject* sequence = __pyx_t_5; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 3)) { if (size > 3) __Pyx_RaiseTooManyValuesError(3); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); } else { __pyx_t_3 = PyList_GET_ITEM(sequence, 0); __pyx_t_8 = PyList_GET_ITEM(sequence, 1); __pyx_t_9 = PyList_GET_ITEM(sequence, 2); } __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(__pyx_t_9); #else __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { Py_ssize_t index = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; index = 0; __pyx_t_3 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_8); index = 2; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_9); if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = NULL; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L9_unpacking_done; __pyx_L8_unpacking_failed:; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_11 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L9_unpacking_done:; } __Pyx_XDECREF(__pyx_v_chrom); __pyx_v_chrom = __pyx_t_3; __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_start); __pyx_v_start = __pyx_t_8; __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_v_end); __pyx_v_end = __pyx_t_9; __pyx_t_9 = 0; __pyx_v_index = __pyx_t_7; __pyx_t_7 = (__pyx_t_7 + 1); /* "samtoolsWrapper.pyx":547 * * for index,(chrom,start,end) in enumerate(regions): * region, rtid, rstart, rend = self._parseRegion(chrom, start, end) # <<<<<<<<<<<<<< * theIterator = IteratorRow(self, rtid, rstart, rend, useIndex=1) * #logger.info("Region index = %s (%s:%s-%s). Noff = %s" %(index, chrom, start, end, theIterator.bam_iter.n_off)) */ __pyx_t_12.__pyx_n = 3; __pyx_t_12.reference = __pyx_v_chrom; __pyx_t_12.start = __pyx_v_start; __pyx_t_12.end = __pyx_v_end; __pyx_t_5 = ((struct __pyx_vtabstruct_15samtoolsWrapper_Samfile *)__pyx_v_self->__pyx_vtab)->_parseRegion(__pyx_v_self, &__pyx_t_12); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { PyObject* sequence = __pyx_t_5; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 4)) { if (size > 4) __Pyx_RaiseTooManyValuesError(4); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); __pyx_t_10 = PyTuple_GET_ITEM(sequence, 3); } else { __pyx_t_9 = PyList_GET_ITEM(sequence, 0); __pyx_t_8 = PyList_GET_ITEM(sequence, 1); __pyx_t_3 = PyList_GET_ITEM(sequence, 2); __pyx_t_10 = PyList_GET_ITEM(sequence, 3); } __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_10); #else Py_ssize_t i; PyObject** temps[4] = {&__pyx_t_9,&__pyx_t_8,&__pyx_t_3,&__pyx_t_10}; for (i=0; i < 4; i++) { PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} *(temps[i]) = item; } #endif __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { Py_ssize_t index = -1; PyObject** temps[4] = {&__pyx_t_9,&__pyx_t_8,&__pyx_t_3,&__pyx_t_10}; __pyx_t_13 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_11 = Py_TYPE(__pyx_t_13)->tp_iternext; for (index=0; index < 4; index++) { PyObject* item = __pyx_t_11(__pyx_t_13); if (unlikely(!item)) goto __pyx_L10_unpacking_failed; __Pyx_GOTREF(item); *(temps[index]) = item; } if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_13), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = NULL; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; goto __pyx_L11_unpacking_done; __pyx_L10_unpacking_failed:; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_11 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L11_unpacking_done:; } __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_t_8); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_15 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_16 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_v_region); __pyx_v_region = __pyx_t_9; __pyx_t_9 = 0; __pyx_v_rtid = __pyx_t_14; __pyx_v_rstart = __pyx_t_15; __pyx_v_rend = __pyx_t_16; /* "samtoolsWrapper.pyx":548 * for index,(chrom,start,end) in enumerate(regions): * region, rtid, rstart, rend = self._parseRegion(chrom, start, end) * theIterator = IteratorRow(self, rtid, rstart, rend, useIndex=1) # <<<<<<<<<<<<<< * #logger.info("Region index = %s (%s:%s-%s). Noff = %s" %(index, chrom, start, end, theIterator.bam_iter.n_off)) * self.indexesByRegion["%s:%s-%s" %(chrom,start,end)] = theIterator */ __pyx_t_5 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_10 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_3 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_5 = 0; __pyx_t_10 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__useIndex), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_15samtoolsWrapper_IteratorRow)), ((PyObject *)__pyx_t_8), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_XDECREF(((PyObject *)__pyx_v_theIterator)); __pyx_v_theIterator = ((struct __pyx_obj_15samtoolsWrapper_IteratorRow *)__pyx_t_10); __pyx_t_10 = 0; /* "samtoolsWrapper.pyx":550 * theIterator = IteratorRow(self, rtid, rstart, rend, useIndex=1) * #logger.info("Region index = %s (%s:%s-%s). Noff = %s" %(index, chrom, start, end, theIterator.bam_iter.n_off)) * self.indexesByRegion["%s:%s-%s" %(chrom,start,end)] = theIterator # <<<<<<<<<<<<<< * * if self.index != NULL: */ if (unlikely(((PyObject *)__pyx_v_self->indexesByRegion) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_v_chrom); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_chrom); __Pyx_GIVEREF(__pyx_v_chrom); __Pyx_INCREF(__pyx_v_start); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_start); __Pyx_GIVEREF(__pyx_v_start); __Pyx_INCREF(__pyx_v_end); PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_end); __Pyx_GIVEREF(__pyx_v_end); __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; if (PyDict_SetItem(((PyObject *)__pyx_v_self->indexesByRegion), ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_v_theIterator)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "samtoolsWrapper.pyx":552 * self.indexesByRegion["%s:%s-%s" %(chrom,start,end)] = theIterator * * if self.index != NULL: # <<<<<<<<<<<<<< * bam_index_destroy(self.index); * self.index = NULL */ __pyx_t_2 = (__pyx_v_self->index != NULL); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":553 * * if self.index != NULL: * bam_index_destroy(self.index); # <<<<<<<<<<<<<< * self.index = NULL * */ bam_index_destroy(__pyx_v_self->index); /* "samtoolsWrapper.pyx":554 * if self.index != NULL: * bam_index_destroy(self.index); * self.index = NULL # <<<<<<<<<<<<<< * * cdef char* getrname(self, int tid): */ __pyx_v_self->index = NULL; goto __pyx_L12; } __pyx_L12:; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_13); __Pyx_WriteUnraisable("samtoolsWrapper.Samfile.loadOffsetsForRegions", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_theIterator); __Pyx_XDECREF(__pyx_v_chrom); __Pyx_XDECREF(__pyx_v_start); __Pyx_XDECREF(__pyx_v_end); __Pyx_XDECREF(__pyx_v_region); __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":556 * self.index = NULL * * cdef char* getrname(self, int tid): # <<<<<<<<<<<<<< * ''' * Convert numerical :term:`tid` into :ref:`reference` name. */ static char *__pyx_f_15samtoolsWrapper_7Samfile_getrname(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self, int __pyx_v_tid) { char *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("getrname", 0); /* "samtoolsWrapper.pyx":560 * Convert numerical :term:`tid` into :ref:`reference` name. * ''' * if not 0 <= tid < self.samfile.header.n_targets: # <<<<<<<<<<<<<< * raise ValueError( "tid (%s) out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets)) * */ __pyx_t_1 = (0 <= __pyx_v_tid); if (__pyx_t_1) { __pyx_t_1 = (__pyx_v_tid < __pyx_v_self->samfile->header->n_targets); } __pyx_t_2 = (!__pyx_t_1); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":561 * ''' * if not 0 <= tid < self.samfile.header.n_targets: * raise ValueError( "tid (%s) out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets)) # <<<<<<<<<<<<<< * * return self.samfile.header.target_name[tid] */ __pyx_t_3 = PyInt_FromLong(__pyx_v_tid); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->samfile->header->n_targets); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":563 * raise ValueError( "tid (%s) out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets)) * * return self.samfile.header.target_name[tid] # <<<<<<<<<<<<<< * * cdef _parseRegion(self, reference=None, start=None, end=None, region=None): */ __pyx_r = (__pyx_v_self->samfile->header->target_name[__pyx_v_tid]); goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("samtoolsWrapper.Samfile.getrname", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":565 * return self.samfile.header.target_name[tid] * * cdef _parseRegion(self, reference=None, start=None, end=None, region=None): # <<<<<<<<<<<<<< * """ * parse region information. */ static PyObject *__pyx_f_15samtoolsWrapper_7Samfile__parseRegion(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self, struct __pyx_opt_args_15samtoolsWrapper_7Samfile__parseRegion *__pyx_optional_args) { PyObject *__pyx_v_reference = ((PyObject *)Py_None); PyObject *__pyx_v_start = ((PyObject *)Py_None); PyObject *__pyx_v_end = ((PyObject *)Py_None); PyObject *__pyx_v_region = ((PyObject *)Py_None); int __pyx_v_rtid; int __pyx_v_rstart; int __pyx_v_rend; int __pyx_v_max_pos; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; char *__pyx_t_6; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_parseRegion", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_reference = __pyx_optional_args->reference; if (__pyx_optional_args->__pyx_n > 1) { __pyx_v_start = __pyx_optional_args->start; if (__pyx_optional_args->__pyx_n > 2) { __pyx_v_end = __pyx_optional_args->end; if (__pyx_optional_args->__pyx_n > 3) { __pyx_v_region = __pyx_optional_args->region; } } } } } __Pyx_INCREF(__pyx_v_region); /* "samtoolsWrapper.pyx":582 * cdef int max_pos * * max_pos = 2 << 29 # <<<<<<<<<<<<<< * rtid = rstart = rend = 0 * */ __pyx_v_max_pos = 1073741824; /* "samtoolsWrapper.pyx":583 * * max_pos = 2 << 29 * rtid = rstart = rend = 0 # <<<<<<<<<<<<<< * * # translate to a region */ __pyx_v_rtid = 0; __pyx_v_rstart = 0; __pyx_v_rend = 0; /* "samtoolsWrapper.pyx":586 * * # translate to a region * if reference: # <<<<<<<<<<<<<< * if start != None and end != None: * region = "%s:%i-%i" % (reference, start+1, end) */ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_reference); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { /* "samtoolsWrapper.pyx":587 * # translate to a region * if reference: * if start != None and end != None: # <<<<<<<<<<<<<< * region = "%s:%i-%i" % (reference, start+1, end) * else: */ __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { __pyx_t_2 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __pyx_t_3; } else { __pyx_t_4 = __pyx_t_1; } if (__pyx_t_4) { /* "samtoolsWrapper.pyx":588 * if reference: * if start != None and end != None: * region = "%s:%i-%i" % (reference, start+1, end) # <<<<<<<<<<<<<< * else: * region = reference */ __pyx_t_2 = PyNumber_Add(__pyx_v_start, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_reference); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_reference); __Pyx_GIVEREF(__pyx_v_reference); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_end); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_end); __Pyx_GIVEREF(__pyx_v_end); __pyx_t_2 = 0; __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_v_region); __pyx_v_region = ((PyObject *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L4; } /*else*/ { /* "samtoolsWrapper.pyx":590 * region = "%s:%i-%i" % (reference, start+1, end) * else: * region = reference # <<<<<<<<<<<<<< * * if region: */ __Pyx_INCREF(__pyx_v_reference); __Pyx_DECREF(__pyx_v_region); __pyx_v_region = __pyx_v_reference; } __pyx_L4:; goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":592 * region = reference * * if region: # <<<<<<<<<<<<<< * bam_parse_region(self.samfile.header, region, &rtid, &rstart, &rend) * */ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_4) { /* "samtoolsWrapper.pyx":593 * * if region: * bam_parse_region(self.samfile.header, region, &rtid, &rstart, &rend) # <<<<<<<<<<<<<< * * if rtid < 0: */ __pyx_t_6 = PyBytes_AsString(__pyx_v_region); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} bam_parse_region(__pyx_v_self->samfile->header, __pyx_t_6, (&__pyx_v_rtid), (&__pyx_v_rstart), (&__pyx_v_rend)); /* "samtoolsWrapper.pyx":595 * bam_parse_region(self.samfile.header, region, &rtid, &rstart, &rend) * * if rtid < 0: # <<<<<<<<<<<<<< * raise ValueError("invalid region `%s`" % region) * */ __pyx_t_4 = (__pyx_v_rtid < 0); if (__pyx_t_4) { /* "samtoolsWrapper.pyx":596 * * if rtid < 0: * raise ValueError("invalid region `%s`" % region) # <<<<<<<<<<<<<< * * if rstart > rend: */ __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_18), __pyx_v_region); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "samtoolsWrapper.pyx":598 * raise ValueError("invalid region `%s`" % region) * * if rstart > rend: # <<<<<<<<<<<<<< * raise ValueError('invalid region: start (%i) > end (%i)' % (rstart, rend)) * */ __pyx_t_4 = (__pyx_v_rstart > __pyx_v_rend); if (__pyx_t_4) { /* "samtoolsWrapper.pyx":599 * * if rstart > rend: * raise ValueError('invalid region: start (%i) > end (%i)' % (rstart, rend)) # <<<<<<<<<<<<<< * * if not 0 <= rstart < max_pos: */ __pyx_t_2 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_2 = 0; __pyx_t_5 = 0; __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "samtoolsWrapper.pyx":601 * raise ValueError('invalid region: start (%i) > end (%i)' % (rstart, rend)) * * if not 0 <= rstart < max_pos: # <<<<<<<<<<<<<< * raise ValueError('start out of range (%i)' % rstart) * */ __pyx_t_4 = (0 <= __pyx_v_rstart); if (__pyx_t_4) { __pyx_t_4 = (__pyx_v_rstart < __pyx_v_max_pos); } __pyx_t_1 = (!__pyx_t_4); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":602 * * if not 0 <= rstart < max_pos: * raise ValueError('start out of range (%i)' % rstart) # <<<<<<<<<<<<<< * * if not 0 <= rend < max_pos: */ __pyx_t_5 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_7)); __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; /* "samtoolsWrapper.pyx":604 * raise ValueError('start out of range (%i)' % rstart) * * if not 0 <= rend < max_pos: # <<<<<<<<<<<<<< * raise ValueError('end out of range (%i)' % rend) * */ __pyx_t_1 = (0 <= __pyx_v_rend); if (__pyx_t_1) { __pyx_t_1 = (__pyx_v_rend < __pyx_v_max_pos); } __pyx_t_4 = (!__pyx_t_1); if (__pyx_t_4) { /* "samtoolsWrapper.pyx":605 * * if not 0 <= rend < max_pos: * raise ValueError('end out of range (%i)' % rend) # <<<<<<<<<<<<<< * * return region, rtid, rstart, rend */ __pyx_t_7 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L9; } __pyx_L9:; goto __pyx_L5; } __pyx_L5:; /* "samtoolsWrapper.pyx":607 * raise ValueError('end out of range (%i)' % rend) * * return region, rtid, rstart, rend # <<<<<<<<<<<<<< * * cpdef IteratorRow fetch(self, char* reference, int start, int end): */ __Pyx_XDECREF(__pyx_r); __pyx_t_5 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_2 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_region); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_region); __Pyx_GIVEREF(__pyx_v_region); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_5 = 0; __pyx_t_7 = 0; __pyx_t_2 = 0; __pyx_r = ((PyObject *)__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("samtoolsWrapper.Samfile._parseRegion", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_region); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":609 * return region, rtid, rstart, rend * * cpdef IteratorRow fetch(self, char* reference, int start, int end): # <<<<<<<<<<<<<< * ''' * Fetch reads from a specified region. */ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_9fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static struct __pyx_obj_15samtoolsWrapper_IteratorRow *__pyx_f_15samtoolsWrapper_7Samfile_fetch(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self, char *__pyx_v_reference, int __pyx_v_start, int __pyx_v_end, int __pyx_skip_dispatch) { int __pyx_v_rtid; int __pyx_v_rstart; int __pyx_v_rend; CYTHON_UNUSED int __pyx_v_cacheIndex; struct __pyx_obj_15samtoolsWrapper_IteratorRow *__pyx_v_theIt = 0; CYTHON_UNUSED PyObject *__pyx_v_region = NULL; struct __pyx_obj_15samtoolsWrapper_IteratorRow *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; bamFile *__pyx_t_7; struct __pyx_opt_args_15samtoolsWrapper_7Samfile__parseRegion __pyx_t_8; PyObject *__pyx_t_9 = NULL; PyObject *(*__pyx_t_10)(PyObject *); int __pyx_t_11; int __pyx_t_12; int __pyx_t_13; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fetch", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__fetch); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_15samtoolsWrapper_7Samfile_9fetch)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_2 = PyBytes_FromString(__pyx_v_reference); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __pyx_t_3 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_15samtoolsWrapper_IteratorRow))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((struct __pyx_obj_15samtoolsWrapper_IteratorRow *)__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "samtoolsWrapper.pyx":616 * cdef int rstart * cdef int rend * cdef int cacheIndex = 0 # <<<<<<<<<<<<<< * cdef bam_fetch_iterator_t* theIterator * cdef IteratorRow theIt */ __pyx_v_cacheIndex = 0; /* "samtoolsWrapper.pyx":621 * * # Load from pre-existing iterator * if "%s:%s-%s" %(reference, start, end) in self.indexesByRegion: # <<<<<<<<<<<<<< * theIt = self.indexesByRegion["%s:%s-%s" %(reference, start, end)] * */ __pyx_t_1 = PyBytes_FromString(__pyx_v_reference); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_4 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (unlikely(((PyObject *)__pyx_v_self->indexesByRegion) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_6 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_v_self->indexesByRegion), Py_EQ)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; if (__pyx_t_6) { /* "samtoolsWrapper.pyx":622 * # Load from pre-existing iterator * if "%s:%s-%s" %(reference, start, end) in self.indexesByRegion: * theIt = self.indexesByRegion["%s:%s-%s" %(reference, start, end)] # <<<<<<<<<<<<<< * * # Don't need to load the index, since we already have the pre-computed offsets */ if (unlikely(((PyObject *)__pyx_v_self->indexesByRegion) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_5 = PyBytes_FromString(__pyx_v_reference); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_3 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_self->indexesByRegion), ((PyObject *)__pyx_t_4)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_15samtoolsWrapper_IteratorRow))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_theIt = ((struct __pyx_obj_15samtoolsWrapper_IteratorRow *)__pyx_t_1); __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":625 * * # Don't need to load the index, since we already have the pre-computed offsets * if not self._isOpen(): # <<<<<<<<<<<<<< * self._open('rb', loadIndex=False) * */ __pyx_t_6 = (!((struct __pyx_vtabstruct_15samtoolsWrapper_Samfile *)__pyx_v_self->__pyx_vtab)->_isOpen(__pyx_v_self)); if (__pyx_t_6) { /* "samtoolsWrapper.pyx":626 * # Don't need to load the index, since we already have the pre-computed offsets * if not self._isOpen(): * self._open('rb', loadIndex=False) # <<<<<<<<<<<<<< * * # Re-create cache for BGZF file, if required. */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__loadIndex), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_22), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L4; } __pyx_L4:; /* "samtoolsWrapper.pyx":629 * * # Re-create cache for BGZF file, if required. * self.createCache() # <<<<<<<<<<<<<< * * if self.isbam: */ ((struct __pyx_vtabstruct_15samtoolsWrapper_Samfile *)__pyx_v_self->__pyx_vtab)->createCache(__pyx_v_self); /* "samtoolsWrapper.pyx":631 * self.createCache() * * if self.isbam: # <<<<<<<<<<<<<< * theIt.bam_iter.fp = self.samfile.x.bam * return theIt */ if (__pyx_v_self->isbam) { /* "samtoolsWrapper.pyx":632 * * if self.isbam: * theIt.bam_iter.fp = self.samfile.x.bam # <<<<<<<<<<<<<< * return theIt * else: */ __pyx_t_7 = __pyx_v_self->samfile->x.bam; __pyx_v_theIt->bam_iter->fp = __pyx_t_7; /* "samtoolsWrapper.pyx":633 * if self.isbam: * theIt.bam_iter.fp = self.samfile.x.bam * return theIt # <<<<<<<<<<<<<< * else: * raise StandardError, "Random access query only allowed for BAM files." */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __Pyx_INCREF(((PyObject *)__pyx_v_theIt)); __pyx_r = __pyx_v_theIt; goto __pyx_L0; goto __pyx_L5; } /*else*/ { /* "samtoolsWrapper.pyx":635 * return theIt * else: * raise StandardError, "Random access query only allowed for BAM files." # <<<<<<<<<<<<<< * * # New query */ __Pyx_Raise(__pyx_builtin_StandardError, ((PyObject *)__pyx_kp_s_23), 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L5:; goto __pyx_L3; } /*else*/ { /* "samtoolsWrapper.pyx":640 * else: * # Need to load the index for new queries. * if not self._isOpen(): # <<<<<<<<<<<<<< * self._open('rbh', loadIndex=True) # Change to False * */ __pyx_t_6 = (!((struct __pyx_vtabstruct_15samtoolsWrapper_Samfile *)__pyx_v_self->__pyx_vtab)->_isOpen(__pyx_v_self)); if (__pyx_t_6) { /* "samtoolsWrapper.pyx":641 * # Need to load the index for new queries. * if not self._isOpen(): * self._open('rbh', loadIndex=True) # Change to False # <<<<<<<<<<<<<< * * # Re-create cache for BGZF file, if required. */ __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___open); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__loadIndex), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_24), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L6; } __pyx_L6:; /* "samtoolsWrapper.pyx":644 * * # Re-create cache for BGZF file, if required. * self.createCache() # <<<<<<<<<<<<<< * * if self.isbam: */ ((struct __pyx_vtabstruct_15samtoolsWrapper_Samfile *)__pyx_v_self->__pyx_vtab)->createCache(__pyx_v_self); /* "samtoolsWrapper.pyx":646 * self.createCache() * * if self.isbam: # <<<<<<<<<<<<<< * region, rtid, rstart, rend = self._parseRegion(reference, start, end) * return IteratorRow(self, rtid, rstart, rend, useIndex=1) */ if (__pyx_v_self->isbam) { /* "samtoolsWrapper.pyx":647 * * if self.isbam: * region, rtid, rstart, rend = self._parseRegion(reference, start, end) # <<<<<<<<<<<<<< * return IteratorRow(self, rtid, rstart, rend, useIndex=1) * else: */ __pyx_t_1 = PyBytes_FromString(__pyx_v_reference); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_4 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_8.__pyx_n = 3; __pyx_t_8.reference = ((PyObject *)__pyx_t_1); __pyx_t_8.start = __pyx_t_4; __pyx_t_8.end = __pyx_t_3; __pyx_t_5 = ((struct __pyx_vtabstruct_15samtoolsWrapper_Samfile *)__pyx_v_self->__pyx_vtab)->_parseRegion(__pyx_v_self, &__pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { PyObject* sequence = __pyx_t_5; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 4)) { if (size > 4) __Pyx_RaiseTooManyValuesError(4); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); __pyx_t_2 = PyTuple_GET_ITEM(sequence, 3); } else { __pyx_t_3 = PyList_GET_ITEM(sequence, 0); __pyx_t_4 = PyList_GET_ITEM(sequence, 1); __pyx_t_1 = PyList_GET_ITEM(sequence, 2); __pyx_t_2 = PyList_GET_ITEM(sequence, 3); } __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_2); #else Py_ssize_t i; PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_4,&__pyx_t_1,&__pyx_t_2}; for (i=0; i < 4; i++) { PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} *(temps[i]) = item; } #endif __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { Py_ssize_t index = -1; PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_4,&__pyx_t_1,&__pyx_t_2}; __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; for (index=0; index < 4; index++) { PyObject* item = __pyx_t_10(__pyx_t_9); if (unlikely(!item)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(item); *(temps[index]) = item; } if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L9_unpacking_done; __pyx_L8_unpacking_failed:; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L9_unpacking_done:; } __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_region = __pyx_t_3; __pyx_t_3 = 0; __pyx_v_rtid = __pyx_t_11; __pyx_v_rstart = __pyx_t_12; __pyx_v_rend = __pyx_t_13; /* "samtoolsWrapper.pyx":648 * if self.isbam: * region, rtid, rstart, rend = self._parseRegion(reference, start, end) * return IteratorRow(self, rtid, rstart, rend, useIndex=1) # <<<<<<<<<<<<<< * else: * raise StandardError, "Random access query only allowed for BAM files." */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_5 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_5 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__useIndex), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_15samtoolsWrapper_IteratorRow)), ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_r = ((struct __pyx_obj_15samtoolsWrapper_IteratorRow *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; goto __pyx_L7; } /*else*/ { /* "samtoolsWrapper.pyx":650 * return IteratorRow(self, rtid, rstart, rend, useIndex=1) * else: * raise StandardError, "Random access query only allowed for BAM files." # <<<<<<<<<<<<<< * * cpdef IteratorRowAll fetchAllReads(self): */ __Pyx_Raise(__pyx_builtin_StandardError, ((PyObject *)__pyx_kp_s_23), 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L7:; } __pyx_L3:; __pyx_r = ((struct __pyx_obj_15samtoolsWrapper_IteratorRow *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("samtoolsWrapper.Samfile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_theIt); __Pyx_XDECREF(__pyx_v_region); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_9fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_15samtoolsWrapper_7Samfile_8fetch[] = "\n Fetch reads from a specified region.\n "; static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_9fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { char *__pyx_v_reference; int __pyx_v_start; int __pyx_v_end; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fetch (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("fetch", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("fetch", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_reference = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_reference) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_start = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_end = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("fetch", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("samtoolsWrapper.Samfile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_15samtoolsWrapper_7Samfile_8fetch(((struct __pyx_obj_15samtoolsWrapper_Samfile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":609 * return region, rtid, rstart, rend * * cpdef IteratorRow fetch(self, char* reference, int start, int end): # <<<<<<<<<<<<<< * ''' * Fetch reads from a specified region. */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_8fetch(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self, char *__pyx_v_reference, int __pyx_v_start, int __pyx_v_end) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fetch", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_15samtoolsWrapper_Samfile *)__pyx_v_self->__pyx_vtab)->fetch(__pyx_v_self, __pyx_v_reference, __pyx_v_start, __pyx_v_end, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("samtoolsWrapper.Samfile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":652 * raise StandardError, "Random access query only allowed for BAM files." * * cpdef IteratorRowAll fetchAllReads(self): # <<<<<<<<<<<<<< * ''' * Return all reads from the file, including un-mapped reads. */ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_11fetchAllReads(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *__pyx_f_15samtoolsWrapper_7Samfile_fetchAllReads(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self, int __pyx_skip_dispatch) { struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fetchAllReads", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__fetchAllReads); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_15samtoolsWrapper_7Samfile_11fetchAllReads)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_15samtoolsWrapper_IteratorRowAll))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "samtoolsWrapper.pyx":656 * Return all reads from the file, including un-mapped reads. * ''' * if not self._isOpen(): # <<<<<<<<<<<<<< * raise ValueError("BAM file is not open. Cannot return reads.") * */ __pyx_t_3 = (!((struct __pyx_vtabstruct_15samtoolsWrapper_Samfile *)__pyx_v_self->__pyx_vtab)->_isOpen(__pyx_v_self)); if (__pyx_t_3) { /* "samtoolsWrapper.pyx":657 * ''' * if not self._isOpen(): * raise ValueError("BAM file is not open. Cannot return reads.") # <<<<<<<<<<<<<< * * if self.isbam: */ __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":659 * raise ValueError("BAM file is not open. Cannot return reads.") * * if self.isbam: # <<<<<<<<<<<<<< * return IteratorRowAll(self) * */ if (__pyx_v_self->isbam) { /* "samtoolsWrapper.pyx":660 * * if self.isbam: * return IteratorRowAll(self) # <<<<<<<<<<<<<< * * cpdef close(self): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_15samtoolsWrapper_IteratorRowAll)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_r = ((struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; goto __pyx_L4; } __pyx_L4:; __pyx_r = ((struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("samtoolsWrapper.Samfile.fetchAllReads", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_11fetchAllReads(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_15samtoolsWrapper_7Samfile_10fetchAllReads[] = "\n Return all reads from the file, including un-mapped reads.\n "; static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_11fetchAllReads(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fetchAllReads (wrapper)", 0); __pyx_r = __pyx_pf_15samtoolsWrapper_7Samfile_10fetchAllReads(((struct __pyx_obj_15samtoolsWrapper_Samfile *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":652 * raise StandardError, "Random access query only allowed for BAM files." * * cpdef IteratorRowAll fetchAllReads(self): # <<<<<<<<<<<<<< * ''' * Return all reads from the file, including un-mapped reads. */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_10fetchAllReads(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fetchAllReads", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_15samtoolsWrapper_Samfile *)__pyx_v_self->__pyx_vtab)->fetchAllReads(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("samtoolsWrapper.Samfile.fetchAllReads", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":662 * return IteratorRowAll(self) * * cpdef close(self): # <<<<<<<<<<<<<< * ''' * closes file. */ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_13close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_15samtoolsWrapper_7Samfile_close(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("close", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_15samtoolsWrapper_7Samfile_13close)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "samtoolsWrapper.pyx":666 * closes file. * ''' * if self.samfile != NULL: # <<<<<<<<<<<<<< * samclose(self.samfile) * self.samfile = NULL */ __pyx_t_3 = (__pyx_v_self->samfile != NULL); if (__pyx_t_3) { /* "samtoolsWrapper.pyx":667 * ''' * if self.samfile != NULL: * samclose(self.samfile) # <<<<<<<<<<<<<< * self.samfile = NULL * */ samclose(__pyx_v_self->samfile); /* "samtoolsWrapper.pyx":668 * if self.samfile != NULL: * samclose(self.samfile) * self.samfile = NULL # <<<<<<<<<<<<<< * * if self.index != NULL: */ __pyx_v_self->samfile = NULL; goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":670 * self.samfile = NULL * * if self.index != NULL: # <<<<<<<<<<<<<< * bam_index_destroy(self.index); * self.index = NULL */ __pyx_t_3 = (__pyx_v_self->index != NULL); if (__pyx_t_3) { /* "samtoolsWrapper.pyx":671 * * if self.index != NULL: * bam_index_destroy(self.index); # <<<<<<<<<<<<<< * self.index = NULL * */ bam_index_destroy(__pyx_v_self->index); /* "samtoolsWrapper.pyx":672 * if self.index != NULL: * bam_index_destroy(self.index); * self.index = NULL # <<<<<<<<<<<<<< * * property nreferences: */ __pyx_v_self->index = NULL; goto __pyx_L4; } __pyx_L4:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("samtoolsWrapper.Samfile.close", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_13close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_15samtoolsWrapper_7Samfile_12close[] = "\n closes file.\n "; static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_13close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("close (wrapper)", 0); __pyx_r = __pyx_pf_15samtoolsWrapper_7Samfile_12close(((struct __pyx_obj_15samtoolsWrapper_Samfile *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":662 * return IteratorRowAll(self) * * cpdef close(self): # <<<<<<<<<<<<<< * ''' * closes file. */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_12close(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("close", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((struct __pyx_vtabstruct_15samtoolsWrapper_Samfile *)__pyx_v_self->__pyx_vtab)->close(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("samtoolsWrapper.Samfile.close", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_11nreferences_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_11nreferences_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_15samtoolsWrapper_7Samfile_11nreferences___get__(((struct __pyx_obj_15samtoolsWrapper_Samfile *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":676 * property nreferences: * '''number of :term:`reference` sequences in the file.''' * def __get__(self): # <<<<<<<<<<<<<< * return self.samfile.header.n_targets * */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_11nreferences___get__(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "samtoolsWrapper.pyx":677 * '''number of :term:`reference` sequences in the file.''' * def __get__(self): * return self.samfile.header.n_targets # <<<<<<<<<<<<<< * * property references: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->samfile->header->n_targets); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("samtoolsWrapper.Samfile.nreferences.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_10references_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_10references_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_15samtoolsWrapper_7Samfile_10references___get__(((struct __pyx_obj_15samtoolsWrapper_Samfile *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":681 * property references: * """tuple with the names of :term:`reference` sequences.""" * def __get__(self): # <<<<<<<<<<<<<< * t = [] * for x from 0 <= x < self.samfile.header.n_targets: */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_10references___get__(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self) { PyObject *__pyx_v_t = NULL; long __pyx_v_x; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int32_t __pyx_t_2; int __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "samtoolsWrapper.pyx":682 * """tuple with the names of :term:`reference` sequences.""" * def __get__(self): * t = [] # <<<<<<<<<<<<<< * for x from 0 <= x < self.samfile.header.n_targets: * t.append( self.samfile.header.target_name[x] ) */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_t = __pyx_t_1; __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":683 * def __get__(self): * t = [] * for x from 0 <= x < self.samfile.header.n_targets: # <<<<<<<<<<<<<< * t.append( self.samfile.header.target_name[x] ) * return tuple(t) */ __pyx_t_2 = __pyx_v_self->samfile->header->n_targets; for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_2; __pyx_v_x++) { /* "samtoolsWrapper.pyx":684 * t = [] * for x from 0 <= x < self.samfile.header.n_targets: * t.append( self.samfile.header.target_name[x] ) # <<<<<<<<<<<<<< * return tuple(t) * */ __pyx_t_1 = PyBytes_FromString((__pyx_v_self->samfile->header->target_name[__pyx_v_x])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_3 = PyList_Append(__pyx_v_t, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; } /* "samtoolsWrapper.pyx":685 * for x from 0 <= x < self.samfile.header.n_targets: * t.append( self.samfile.header.target_name[x] ) * return tuple(t) # <<<<<<<<<<<<<< * * property lengths: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyObject *)PyList_AsTuple(__pyx_v_t)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("samtoolsWrapper.Samfile.references.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_t); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_7lengths_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_7lengths_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_15samtoolsWrapper_7Samfile_7lengths___get__(((struct __pyx_obj_15samtoolsWrapper_Samfile *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":690 * """tuple of the lengths of the :term:`reference` sequences. The lengths are in the same order as :attr:`pysam.Samfile.reference` * """ * def __get__(self): # <<<<<<<<<<<<<< * t = [] * for x from 0 <= x < self.samfile.header.n_targets: */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_7lengths___get__(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self) { PyObject *__pyx_v_t = NULL; long __pyx_v_x; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int32_t __pyx_t_2; int __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "samtoolsWrapper.pyx":691 * """ * def __get__(self): * t = [] # <<<<<<<<<<<<<< * for x from 0 <= x < self.samfile.header.n_targets: * t.append( self.samfile.header.target_len[x] ) */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_t = __pyx_t_1; __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":692 * def __get__(self): * t = [] * for x from 0 <= x < self.samfile.header.n_targets: # <<<<<<<<<<<<<< * t.append( self.samfile.header.target_len[x] ) * return tuple(t) */ __pyx_t_2 = __pyx_v_self->samfile->header->n_targets; for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_2; __pyx_v_x++) { /* "samtoolsWrapper.pyx":693 * t = [] * for x from 0 <= x < self.samfile.header.n_targets: * t.append( self.samfile.header.target_len[x] ) # <<<<<<<<<<<<<< * return tuple(t) * */ __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t((__pyx_v_self->samfile->header->target_len[__pyx_v_x])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyList_Append(__pyx_v_t, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "samtoolsWrapper.pyx":694 * for x from 0 <= x < self.samfile.header.n_targets: * t.append( self.samfile.header.target_len[x] ) * return tuple(t) # <<<<<<<<<<<<<< * * property text: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyObject *)PyList_AsTuple(__pyx_v_t)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("samtoolsWrapper.Samfile.lengths.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_t); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_4text_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_4text_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_15samtoolsWrapper_7Samfile_4text___get__(((struct __pyx_obj_15samtoolsWrapper_Samfile *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":698 * property text: * '''full contents of the :term:`sam file` header as a string.''' * def __get__(self): # <<<<<<<<<<<<<< * # create a temporary 0-terminated copy * cdef char * t */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_4text___get__(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self) { char *__pyx_v_t; PyObject *__pyx_v_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "samtoolsWrapper.pyx":701 * # create a temporary 0-terminated copy * cdef char * t * t = calloc( self.samfile.header.l_text + 1, sizeof(char) ) # <<<<<<<<<<<<<< * memcpy( t, self.samfile.header.text, self.samfile.header.l_text ) * cdef bytes result = t */ __pyx_v_t = ((char *)calloc((__pyx_v_self->samfile->header->l_text + 1), (sizeof(char)))); /* "samtoolsWrapper.pyx":702 * cdef char * t * t = calloc( self.samfile.header.l_text + 1, sizeof(char) ) * memcpy( t, self.samfile.header.text, self.samfile.header.l_text ) # <<<<<<<<<<<<<< * cdef bytes result = t * free(t) */ memcpy(__pyx_v_t, __pyx_v_self->samfile->header->text, __pyx_v_self->samfile->header->l_text); /* "samtoolsWrapper.pyx":703 * t = calloc( self.samfile.header.l_text + 1, sizeof(char) ) * memcpy( t, self.samfile.header.text, self.samfile.header.l_text ) * cdef bytes result = t # <<<<<<<<<<<<<< * free(t) * return result */ __pyx_t_1 = PyBytes_FromString(__pyx_v_t); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":704 * memcpy( t, self.samfile.header.text, self.samfile.header.l_text ) * cdef bytes result = t * free(t) # <<<<<<<<<<<<<< * return result * */ free(__pyx_v_t); /* "samtoolsWrapper.pyx":705 * cdef bytes result = t * free(t) * return result # <<<<<<<<<<<<<< * * property header: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("samtoolsWrapper.Samfile.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_6header_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_15samtoolsWrapper_7Samfile_6header_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_15samtoolsWrapper_7Samfile_6header___get__(((struct __pyx_obj_15samtoolsWrapper_Samfile *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":711 * a two-level dictionary. * ''' * def __get__(self): # <<<<<<<<<<<<<< * result = {} * */ static PyObject *__pyx_pf_15samtoolsWrapper_7Samfile_6header___get__(struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_v_t = NULL; PyObject *__pyx_v_line = NULL; PyObject *__pyx_v_fields = NULL; PyObject *__pyx_v_record = NULL; PyObject *__pyx_v_x = NULL; PyObject *__pyx_v_field = NULL; PyObject *__pyx_v_key = NULL; PyObject *__pyx_v_value = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; Py_ssize_t __pyx_t_4; PyObject *(*__pyx_t_5)(PyObject *); PyObject *__pyx_t_6 = NULL; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; Py_ssize_t __pyx_t_10; PyObject *(*__pyx_t_11)(PyObject *); PyObject *__pyx_t_12 = NULL; PyObject *(*__pyx_t_13)(PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "samtoolsWrapper.pyx":712 * ''' * def __get__(self): * result = {} # <<<<<<<<<<<<<< * * if self.samfile.header.text != NULL: */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":714 * result = {} * * if self.samfile.header.text != NULL: # <<<<<<<<<<<<<< * # convert to python string (note: call self.text to create 0-terminated string) * t = self.text */ __pyx_t_2 = (__pyx_v_self->samfile->header->text != NULL); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":716 * if self.samfile.header.text != NULL: * # convert to python string (note: call self.text to create 0-terminated string) * t = self.text # <<<<<<<<<<<<<< * for line in t.split("\n"): * if not line.strip(): continue */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_t = __pyx_t_1; __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":717 * # convert to python string (note: call self.text to create 0-terminated string) * t = self.text * for line in t.split("\n"): # <<<<<<<<<<<<<< * if not line.strip(): continue * */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_t, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_3 = __pyx_t_5(__pyx_t_1); if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_3); } __Pyx_XDECREF(__pyx_v_line); __pyx_v_line = __pyx_t_3; __pyx_t_3 = 0; /* "samtoolsWrapper.pyx":718 * t = self.text * for line in t.split("\n"): * if not line.strip(): continue # <<<<<<<<<<<<<< * * if not line.startswith("@"): */ __pyx_t_3 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_7 = (!__pyx_t_2); if (__pyx_t_7) { goto __pyx_L4_continue; goto __pyx_L6; } __pyx_L6:; /* "samtoolsWrapper.pyx":720 * if not line.strip(): continue * * if not line.startswith("@"): # <<<<<<<<<<<<<< * raise StandardError, "Header line without '@': '%s. Total header text is %s'" % (line,t) * */ __pyx_t_6 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = (!__pyx_t_7); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":721 * * if not line.startswith("@"): * raise StandardError, "Header line without '@': '%s. Total header text is %s'" % (line,t) # <<<<<<<<<<<<<< * * fields = line[1:].split("\t") */ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_line); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_line); __Pyx_GIVEREF(__pyx_v_line); __Pyx_INCREF(__pyx_v_t); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_t); __Pyx_GIVEREF(__pyx_v_t); __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_builtin_StandardError, ((PyObject *)__pyx_t_6), 0, 0); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "samtoolsWrapper.pyx":723 * raise StandardError, "Header line without '@': '%s. Total header text is %s'" % (line,t) * * fields = line[1:].split("\t") # <<<<<<<<<<<<<< * record = fields[0] * assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line) */ __pyx_t_6 = __Pyx_PySequence_GetSlice(__pyx_v_line, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_fields); __pyx_v_fields = __pyx_t_6; __pyx_t_6 = 0; /* "samtoolsWrapper.pyx":724 * * fields = line[1:].split("\t") * record = fields[0] # <<<<<<<<<<<<<< * assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line) * */ __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_fields, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_XDECREF(__pyx_v_record); __pyx_v_record = __pyx_t_6; __pyx_t_6 = 0; /* "samtoolsWrapper.pyx":725 * fields = line[1:].split("\t") * record = fields[0] * assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line) # <<<<<<<<<<<<<< * * # treat comments */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_record, __pyx_t_6, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_2)) { __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_record); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_record); __Pyx_GIVEREF(__pyx_v_record); __Pyx_INCREF(__pyx_v_line); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_line); __Pyx_GIVEREF(__pyx_v_line); __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_34), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "samtoolsWrapper.pyx":728 * * # treat comments * if record == "CO": # <<<<<<<<<<<<<< * if record not in result: result[record] = [] * result[record].append( "\t".join( fields[1:] ) ) */ __pyx_t_3 = PyObject_RichCompare(__pyx_v_record, ((PyObject *)__pyx_n_s__CO), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_2) { /* "samtoolsWrapper.pyx":729 * # treat comments * if record == "CO": * if record not in result: result[record] = [] # <<<<<<<<<<<<<< * result[record].append( "\t".join( fields[1:] ) ) * continue */ __pyx_t_2 = (__Pyx_PyDict_Contains(__pyx_v_record, ((PyObject *)__pyx_v_result), Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; goto __pyx_L9; } __pyx_L9:; /* "samtoolsWrapper.pyx":730 * if record == "CO": * if record not in result: result[record] = [] * result[record].append( "\t".join( fields[1:] ) ) # <<<<<<<<<<<<<< * continue * */ __pyx_t_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_record); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_32), __pyx_n_s__join); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_fields, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; /* "samtoolsWrapper.pyx":731 * if record not in result: result[record] = [] * result[record].append( "\t".join( fields[1:] ) ) * continue # <<<<<<<<<<<<<< * * # the following is clumsy as generators do not work? */ goto __pyx_L4_continue; goto __pyx_L8; } __pyx_L8:; /* "samtoolsWrapper.pyx":734 * * # the following is clumsy as generators do not work? * x = {} # <<<<<<<<<<<<<< * for field in fields[1:]: * key, value = field.split(":",1) */ __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); __Pyx_XDECREF(((PyObject *)__pyx_v_x)); __pyx_v_x = __pyx_t_9; __pyx_t_9 = 0; /* "samtoolsWrapper.pyx":735 * # the following is clumsy as generators do not work? * x = {} * for field in fields[1:]: # <<<<<<<<<<<<<< * key, value = field.split(":",1) * if key not in VALID_HEADER_FIELDS[record]: */ __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_fields, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); if (PyList_CheckExact(__pyx_t_9) || PyTuple_CheckExact(__pyx_t_9)) { __pyx_t_8 = __pyx_t_9; __Pyx_INCREF(__pyx_t_8); __pyx_t_10 = 0; __pyx_t_11 = NULL; } else { __pyx_t_10 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_11 = Py_TYPE(__pyx_t_8)->tp_iternext; } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; for (;;) { if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_8)) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_8)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_9 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_8)) { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_8)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_9 = __pyx_t_11(__pyx_t_8); if (unlikely(!__pyx_t_9)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_9); } __Pyx_XDECREF(__pyx_v_field); __pyx_v_field = __pyx_t_9; __pyx_t_9 = 0; /* "samtoolsWrapper.pyx":736 * x = {} * for field in fields[1:]: * key, value = field.split(":",1) # <<<<<<<<<<<<<< * if key not in VALID_HEADER_FIELDS[record]: * raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) ) */ __pyx_t_9 = PyObject_GetAttr(__pyx_v_field, __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { PyObject* sequence = __pyx_t_3; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_9 = PyList_GET_ITEM(sequence, 0); __pyx_t_6 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_6); #else __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { Py_ssize_t index = -1; __pyx_t_12 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext; index = 0; __pyx_t_9 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_9)) goto __pyx_L12_unpacking_failed; __Pyx_GOTREF(__pyx_t_9); index = 1; __pyx_t_6 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_6)) goto __pyx_L12_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_13 = NULL; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; goto __pyx_L13_unpacking_done; __pyx_L12_unpacking_failed:; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_13 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L13_unpacking_done:; } __Pyx_XDECREF(__pyx_v_key); __pyx_v_key = __pyx_t_9; __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_v_value); __pyx_v_value = __pyx_t_6; __pyx_t_6 = 0; /* "samtoolsWrapper.pyx":737 * for field in fields[1:]: * key, value = field.split(":",1) * if key not in VALID_HEADER_FIELDS[record]: # <<<<<<<<<<<<<< * raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) ) * x[key] = VALID_HEADER_FIELDS[record][key](value) */ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_v_record); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_key, __pyx_t_6, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_2) { /* "samtoolsWrapper.pyx":738 * key, value = field.split(":",1) * if key not in VALID_HEADER_FIELDS[record]: * raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) ) # <<<<<<<<<<<<<< * x[key] = VALID_HEADER_FIELDS[record][key](value) * */ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_key); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_key); __Pyx_GIVEREF(__pyx_v_key); __Pyx_INCREF(__pyx_v_record); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_record); __Pyx_GIVEREF(__pyx_v_record); __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_37), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L14; } __pyx_L14:; /* "samtoolsWrapper.pyx":739 * if key not in VALID_HEADER_FIELDS[record]: * raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) ) * x[key] = VALID_HEADER_FIELDS[record][key](value) # <<<<<<<<<<<<<< * * if VALID_HEADER_TYPES[record] == dict: */ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_v_record); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetItem(__pyx_t_6, __pyx_v_key); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_value); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; if (PyDict_SetItem(((PyObject *)__pyx_v_x), __pyx_v_key, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; /* "samtoolsWrapper.pyx":741 * x[key] = VALID_HEADER_FIELDS[record][key](value) * * if VALID_HEADER_TYPES[record] == dict: # <<<<<<<<<<<<<< * if record in result: * raise ValueError( "multiple '%s' lines are not permitted" % record ) */ __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = PyObject_GetItem(__pyx_t_8, __pyx_v_record); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)((PyObject*)(&PyDict_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_2) { /* "samtoolsWrapper.pyx":742 * * if VALID_HEADER_TYPES[record] == dict: * if record in result: # <<<<<<<<<<<<<< * raise ValueError( "multiple '%s' lines are not permitted" % record ) * result[record] = x */ __pyx_t_2 = (__Pyx_PyDict_Contains(__pyx_v_record, ((PyObject *)__pyx_v_result), Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { /* "samtoolsWrapper.pyx":743 * if VALID_HEADER_TYPES[record] == dict: * if record in result: * raise ValueError( "multiple '%s' lines are not permitted" % record ) # <<<<<<<<<<<<<< * result[record] = x * elif VALID_HEADER_TYPES[record] == list: */ __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_38), __pyx_v_record); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L16; } __pyx_L16:; /* "samtoolsWrapper.pyx":744 * if record in result: * raise ValueError( "multiple '%s' lines are not permitted" % record ) * result[record] = x # <<<<<<<<<<<<<< * elif VALID_HEADER_TYPES[record] == list: * if record not in result: result[record] = [] */ if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_v_x)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L15; } /* "samtoolsWrapper.pyx":745 * raise ValueError( "multiple '%s' lines are not permitted" % record ) * result[record] = x * elif VALID_HEADER_TYPES[record] == list: # <<<<<<<<<<<<<< * if record not in result: result[record] = [] * result[record].append( x ) */ __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = PyObject_GetItem(__pyx_t_8, __pyx_v_record); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)((PyObject*)(&PyList_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_2) { /* "samtoolsWrapper.pyx":746 * result[record] = x * elif VALID_HEADER_TYPES[record] == list: * if record not in result: result[record] = [] # <<<<<<<<<<<<<< * result[record].append( x ) * */ __pyx_t_2 = (__Pyx_PyDict_Contains(__pyx_v_record, ((PyObject *)__pyx_v_result), Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; goto __pyx_L17; } __pyx_L17:; /* "samtoolsWrapper.pyx":747 * elif VALID_HEADER_TYPES[record] == list: * if record not in result: result[record] = [] * result[record].append( x ) # <<<<<<<<<<<<<< * * return result */ __pyx_t_8 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_record); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = __Pyx_PyObject_Append(__pyx_t_8, ((PyObject *)__pyx_v_x)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L15; } __pyx_L15:; __pyx_L4_continue:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":749 * result[record].append( x ) * * return result # <<<<<<<<<<<<<< * * ################################################################################################### */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_12); __Pyx_AddTraceback("samtoolsWrapper.Samfile.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); __Pyx_XDECREF(__pyx_v_t); __Pyx_XDECREF(__pyx_v_line); __Pyx_XDECREF(__pyx_v_fields); __Pyx_XDECREF(__pyx_v_record); __Pyx_XDECREF(__pyx_v_x); __Pyx_XDECREF(__pyx_v_field); __Pyx_XDECREF(__pyx_v_key); __Pyx_XDECREF(__pyx_v_value); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_3unpickleIteratorRow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_15samtoolsWrapper_2unpickleIteratorRow[] = "\n "; static PyMethodDef __pyx_mdef_15samtoolsWrapper_3unpickleIteratorRow = {__Pyx_NAMESTR("unpickleIteratorRow"), (PyCFunction)__pyx_pw_15samtoolsWrapper_3unpickleIteratorRow, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_15samtoolsWrapper_2unpickleIteratorRow)}; static PyObject *__pyx_pw_15samtoolsWrapper_3unpickleIteratorRow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_samfile = 0; PyObject *__pyx_v_bamIterPointer = 0; PyObject *__pyx_v_useIndex = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("unpickleIteratorRow (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__bamIterPointer,&__pyx_n_s__useIndex,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bamIterPointer)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("unpickleIteratorRow", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__useIndex)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("unpickleIteratorRow", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unpickleIteratorRow") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_samfile = values[0]; __pyx_v_bamIterPointer = values[1]; __pyx_v_useIndex = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("unpickleIteratorRow", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("samtoolsWrapper.unpickleIteratorRow", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_15samtoolsWrapper_2unpickleIteratorRow(__pyx_self, __pyx_v_samfile, __pyx_v_bamIterPointer, __pyx_v_useIndex); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":759 * ################################################################################################### * * def unpickleIteratorRow(samfile, bamIterPointer, useIndex): # <<<<<<<<<<<<<< * """ * """ */ static PyObject *__pyx_pf_15samtoolsWrapper_2unpickleIteratorRow(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_samfile, PyObject *__pyx_v_bamIterPointer, PyObject *__pyx_v_useIndex) { struct __pyx_obj_15samtoolsWrapper_IteratorRow *__pyx_v_theIt = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("unpickleIteratorRow", 0); /* "samtoolsWrapper.pyx":762 * """ * """ * logger.debug("Calling IteratorRow unpickle") # <<<<<<<<<<<<<< * * cdef IteratorRow theIt = IteratorRow(samfile, 0, 0, 0, 0) */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__debug); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":764 * logger.debug("Calling IteratorRow unpickle") * * cdef IteratorRow theIt = IteratorRow(samfile, 0, 0, 0, 0) # <<<<<<<<<<<<<< * * if bamIterPointer is None: */ __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_samfile); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_samfile); __Pyx_GIVEREF(__pyx_v_samfile); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_15samtoolsWrapper_IteratorRow)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_v_theIt = ((struct __pyx_obj_15samtoolsWrapper_IteratorRow *)__pyx_t_2); __pyx_t_2 = 0; /* "samtoolsWrapper.pyx":766 * cdef IteratorRow theIt = IteratorRow(samfile, 0, 0, 0, 0) * * if bamIterPointer is None: # <<<<<<<<<<<<<< * theIt.bam_iter = NULL * else: */ __pyx_t_3 = (__pyx_v_bamIterPointer == Py_None); if (__pyx_t_3) { /* "samtoolsWrapper.pyx":767 * * if bamIterPointer is None: * theIt.bam_iter = NULL # <<<<<<<<<<<<<< * else: * theIt.bam_iter = (bamIterPointer) */ __pyx_v_theIt->bam_iter = NULL; goto __pyx_L3; } /*else*/ { /* "samtoolsWrapper.pyx":769 * theIt.bam_iter = NULL * else: * theIt.bam_iter = (bamIterPointer) # <<<<<<<<<<<<<< * * theIt.useIndex = useIndex */ __pyx_v_theIt->bam_iter = ((bam_fetch_iterator_t *)__pyx_v_bamIterPointer); } __pyx_L3:; /* "samtoolsWrapper.pyx":771 * theIt.bam_iter = (bamIterPointer) * * theIt.useIndex = useIndex # <<<<<<<<<<<<<< * logger.debug("Done Calling IteratorRow unpickle") * */ __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_useIndex); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_theIt->useIndex = __pyx_t_4; /* "samtoolsWrapper.pyx":772 * * theIt.useIndex = useIndex * logger.debug("Done Calling IteratorRow unpickle") # <<<<<<<<<<<<<< * * return theIt */ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_42), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "samtoolsWrapper.pyx":774 * logger.debug("Done Calling IteratorRow unpickle") * * return theIt # <<<<<<<<<<<<<< * * ###################################################################### */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_theIt)); __pyx_r = ((PyObject *)__pyx_v_theIt); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("samtoolsWrapper.unpickleIteratorRow", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_theIt); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_15samtoolsWrapper_11IteratorRow_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_15samtoolsWrapper_11IteratorRow_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_samfile = 0; int __pyx_v_tid; int __pyx_v_beg; int __pyx_v_end; int __pyx_v_useIndex; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__tid,&__pyx_n_s__beg,&__pyx_n_s__end,&__pyx_n_s__useIndex,0}; PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beg)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__useIndex); if (value) { values[4] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_samfile = ((struct __pyx_obj_15samtoolsWrapper_Samfile *)values[0]); __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_beg = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_beg == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L3_error;} if (values[4]) { __pyx_v_useIndex = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_useIndex == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_useIndex = ((int)1); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("samtoolsWrapper.IteratorRow.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_15samtoolsWrapper_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_15samtoolsWrapper_11IteratorRow___cinit__(((struct __pyx_obj_15samtoolsWrapper_IteratorRow *)__pyx_v_self), __pyx_v_samfile, __pyx_v_tid, __pyx_v_beg, __pyx_v_end, __pyx_v_useIndex); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":782 * Iterates over mapped reads in a region. * """ * def __cinit__(self, Samfile samfile, int tid, int beg, int end, int useIndex=1): # <<<<<<<<<<<<<< * """ * Constructor. */ static int __pyx_pf_15samtoolsWrapper_11IteratorRow___cinit__(struct __pyx_obj_15samtoolsWrapper_IteratorRow *__pyx_v_self, struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_samfile, int __pyx_v_tid, int __pyx_v_beg, int __pyx_v_end, int __pyx_v_useIndex) { bamFile *__pyx_v_fp; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; bamFile *__pyx_t_4; int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); /* "samtoolsWrapper.pyx":786 * Constructor. * """ * self.bam_iter = NULL # <<<<<<<<<<<<<< * self.b = NULL * self.useIndex = useIndex */ __pyx_v_self->bam_iter = NULL; /* "samtoolsWrapper.pyx":787 * """ * self.bam_iter = NULL * self.b = NULL # <<<<<<<<<<<<<< * self.useIndex = useIndex * */ __pyx_v_self->b = NULL; /* "samtoolsWrapper.pyx":788 * self.bam_iter = NULL * self.b = NULL * self.useIndex = useIndex # <<<<<<<<<<<<<< * * if not samfile._isOpen(): */ __pyx_v_self->useIndex = __pyx_v_useIndex; /* "samtoolsWrapper.pyx":790 * self.useIndex = useIndex * * if not samfile._isOpen(): # <<<<<<<<<<<<<< * raise StandardError, "BAM file %s is not open. Cannot read from file." %(samfile.filename) * */ __pyx_t_1 = (!((struct __pyx_vtabstruct_15samtoolsWrapper_Samfile *)__pyx_v_samfile->__pyx_vtab)->_isOpen(__pyx_v_samfile)); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":791 * * if not samfile._isOpen(): * raise StandardError, "BAM file %s is not open. Cannot read from file." %(samfile.filename) # <<<<<<<<<<<<<< * * cdef bamFile* fp = samfile.samfile.x.bam */ __pyx_t_2 = PyBytes_FromString(__pyx_v_samfile->filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_Raise(__pyx_builtin_StandardError, ((PyObject *)__pyx_t_3), 0, 0); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":793 * raise StandardError, "BAM file %s is not open. Cannot read from file." %(samfile.filename) * * cdef bamFile* fp = samfile.samfile.x.bam # <<<<<<<<<<<<<< * * # Load from BAM by querying index for file off-set */ __pyx_t_4 = __pyx_v_samfile->samfile->x.bam; __pyx_v_fp = __pyx_t_4; /* "samtoolsWrapper.pyx":796 * * # Load from BAM by querying index for file off-set * if useIndex: # <<<<<<<<<<<<<< * if not samfile._hasIndex(): * raise StandardError, "Cannot retrieve random region from BAM file %s, as it does not have a BAM index" %(samfile.filename) */ if (__pyx_v_useIndex) { /* "samtoolsWrapper.pyx":797 * # Load from BAM by querying index for file off-set * if useIndex: * if not samfile._hasIndex(): # <<<<<<<<<<<<<< * raise StandardError, "Cannot retrieve random region from BAM file %s, as it does not have a BAM index" %(samfile.filename) * */ __pyx_t_3 = ((struct __pyx_vtabstruct_15samtoolsWrapper_Samfile *)__pyx_v_samfile->__pyx_vtab)->_hasIndex(__pyx_v_samfile); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = (!__pyx_t_1); if (__pyx_t_5) { /* "samtoolsWrapper.pyx":798 * if useIndex: * if not samfile._hasIndex(): * raise StandardError, "Cannot retrieve random region from BAM file %s, as it does not have a BAM index" %(samfile.filename) # <<<<<<<<<<<<<< * * self.bam_iter = bam_init_fetch_iterator(fp, samfile.index, tid, beg, end) */ __pyx_t_3 = PyBytes_FromString(__pyx_v_samfile->filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_44), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_builtin_StandardError, ((PyObject *)__pyx_t_2), 0, 0); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "samtoolsWrapper.pyx":800 * raise StandardError, "Cannot retrieve random region from BAM file %s, as it does not have a BAM index" %(samfile.filename) * * self.bam_iter = bam_init_fetch_iterator(fp, samfile.index, tid, beg, end) # <<<<<<<<<<<<<< * * # Load from pre-existing BAM iterator. I can't pass that in here, so it will be shoved */ __pyx_v_self->bam_iter = bam_init_fetch_iterator(__pyx_v_fp, __pyx_v_samfile->index, __pyx_v_tid, __pyx_v_beg, __pyx_v_end); goto __pyx_L4; } /*else*/ { } __pyx_L4:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("samtoolsWrapper.IteratorRow.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_11IteratorRow_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_15samtoolsWrapper_11IteratorRow_2__reduce__[] = "\n This function is called by Pickle/cPickle in order to grab the state of this\n object.\n "; static PyObject *__pyx_pw_15samtoolsWrapper_11IteratorRow_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); __pyx_r = __pyx_pf_15samtoolsWrapper_11IteratorRow_2__reduce__(((struct __pyx_obj_15samtoolsWrapper_IteratorRow *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":807 * pass * * def __reduce__(self): # <<<<<<<<<<<<<< * """ * This function is called by Pickle/cPickle in order to grab the state of this */ static PyObject *__pyx_pf_15samtoolsWrapper_11IteratorRow_2__reduce__(struct __pyx_obj_15samtoolsWrapper_IteratorRow *__pyx_v_self) { int __pyx_v_bamIter; int __pyx_v_useIndex; PyObject *__pyx_v_data = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); /* "samtoolsWrapper.pyx":812 * object. * """ * logger.debug("Calling IteratorRow reduce") # <<<<<<<<<<<<<< * * cdef int bamIter = (self.bam_iter) */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__debug); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_46), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":814 * logger.debug("Calling IteratorRow reduce") * * cdef int bamIter = (self.bam_iter) # <<<<<<<<<<<<<< * cdef int useIndex = 0 * */ __pyx_v_bamIter = ((int)__pyx_v_self->bam_iter); /* "samtoolsWrapper.pyx":815 * * cdef int bamIter = (self.bam_iter) * cdef int useIndex = 0 # <<<<<<<<<<<<<< * * data = (self.samfile, bamIter, useIndex) */ __pyx_v_useIndex = 0; /* "samtoolsWrapper.pyx":817 * cdef int useIndex = 0 * * data = (self.samfile, bamIter, useIndex) # <<<<<<<<<<<<<< * * if self.bam_iter == NULL: */ __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__samfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyInt_FromLong(__pyx_v_bamIter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyInt_FromLong(__pyx_v_useIndex); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_v_data = __pyx_t_4; __pyx_t_4 = 0; /* "samtoolsWrapper.pyx":819 * data = (self.samfile, bamIter, useIndex) * * if self.bam_iter == NULL: # <<<<<<<<<<<<<< * data = data[0:1] + (None,) + data[2:] * */ __pyx_t_5 = (__pyx_v_self->bam_iter == NULL); if (__pyx_t_5) { /* "samtoolsWrapper.pyx":820 * * if self.bam_iter == NULL: * data = data[0:1] + (None,) + data[2:] # <<<<<<<<<<<<<< * * logger.debug("Done Calling IteratorRow reduce") */ __pyx_t_4 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_data), 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_k_tuple_47)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_data), 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_data)); __pyx_v_data = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":822 * data = data[0:1] + (None,) + data[2:] * * logger.debug("Done Calling IteratorRow reduce") # <<<<<<<<<<<<<< * return (unpickleIteratorRow, data) * */ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "samtoolsWrapper.pyx":823 * * logger.debug("Done Calling IteratorRow reduce") * return (unpickleIteratorRow, data) # <<<<<<<<<<<<<< * * cdef int cnext(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__unpickleIteratorRow); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_data)); PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_data)); __Pyx_GIVEREF(((PyObject *)__pyx_v_data)); __pyx_t_2 = 0; __pyx_r = ((PyObject *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("samtoolsWrapper.IteratorRow.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_data); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":825 * return (unpickleIteratorRow, data) * * cdef int cnext(self): # <<<<<<<<<<<<<< * ''' * cversion of iterator. Used by IteratorColumn */ static int __pyx_f_15samtoolsWrapper_11IteratorRow_cnext(struct __pyx_obj_15samtoolsWrapper_IteratorRow *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("cnext", 0); /* "samtoolsWrapper.pyx":829 * cversion of iterator. Used by IteratorColumn * ''' * self.b = bam_fetch_iterate(self.bam_iter) # <<<<<<<<<<<<<< * * if self.b == NULL: */ __pyx_v_self->b = bam_fetch_iterate(__pyx_v_self->bam_iter); /* "samtoolsWrapper.pyx":831 * self.b = bam_fetch_iterate(self.bam_iter) * * if self.b == NULL: # <<<<<<<<<<<<<< * return 0 * */ __pyx_t_1 = (__pyx_v_self->b == NULL); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":832 * * if self.b == NULL: * return 0 # <<<<<<<<<<<<<< * * return 1 */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":834 * return 0 * * return 1 # <<<<<<<<<<<<<< * * def __dealloc__(self): */ __pyx_r = 1; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static void __pyx_pw_15samtoolsWrapper_11IteratorRow_5__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_15samtoolsWrapper_11IteratorRow_5__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_15samtoolsWrapper_11IteratorRow_4__dealloc__(((struct __pyx_obj_15samtoolsWrapper_IteratorRow *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":836 * return 1 * * def __dealloc__(self): # <<<<<<<<<<<<<< * ''' * remember: dealloc cannot call other methods! */ static void __pyx_pf_15samtoolsWrapper_11IteratorRow_4__dealloc__(struct __pyx_obj_15samtoolsWrapper_IteratorRow *__pyx_v_self) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); /* "samtoolsWrapper.pyx":842 * # Only want to free memory from iterators which were created * # by this object, not those inserted from cache. * if self.useIndex: # <<<<<<<<<<<<<< * if self.bam_iter: * bam_cleanup_fetch_iterator(self.bam_iter) */ if (__pyx_v_self->useIndex) { /* "samtoolsWrapper.pyx":843 * # by this object, not those inserted from cache. * if self.useIndex: * if self.bam_iter: # <<<<<<<<<<<<<< * bam_cleanup_fetch_iterator(self.bam_iter) * free(self.bam_iter) */ __pyx_t_1 = (__pyx_v_self->bam_iter != 0); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":844 * if self.useIndex: * if self.bam_iter: * bam_cleanup_fetch_iterator(self.bam_iter) # <<<<<<<<<<<<<< * free(self.bam_iter) * */ bam_cleanup_fetch_iterator(__pyx_v_self->bam_iter); /* "samtoolsWrapper.pyx":845 * if self.bam_iter: * bam_cleanup_fetch_iterator(self.bam_iter) * free(self.bam_iter) # <<<<<<<<<<<<<< * * ################################################################################################### */ free(__pyx_v_self->bam_iter); goto __pyx_L4; } __pyx_L4:; goto __pyx_L3; } __pyx_L3:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ static int __pyx_pw_15samtoolsWrapper_14IteratorRowAll_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_15samtoolsWrapper_14IteratorRowAll_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_samfile = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_samfile = ((struct __pyx_obj_15samtoolsWrapper_Samfile *)values[0]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("samtoolsWrapper.IteratorRowAll.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_15samtoolsWrapper_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_15samtoolsWrapper_14IteratorRowAll___cinit__(((struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *)__pyx_v_self), __pyx_v_samfile); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":853 * iterates over all mapped reads * """ * def __cinit__(self, Samfile samfile): # <<<<<<<<<<<<<< * * if not samfile._isOpen(): */ static int __pyx_pf_15samtoolsWrapper_14IteratorRowAll___cinit__(struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *__pyx_v_self, struct __pyx_obj_15samtoolsWrapper_Samfile *__pyx_v_samfile) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; samfile_t *__pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); /* "samtoolsWrapper.pyx":855 * def __cinit__(self, Samfile samfile): * * if not samfile._isOpen(): # <<<<<<<<<<<<<< * raise StandardError, "BAM file %s is not open. Cannot read from file." %(samfile.filename) * */ __pyx_t_1 = (!((struct __pyx_vtabstruct_15samtoolsWrapper_Samfile *)__pyx_v_samfile->__pyx_vtab)->_isOpen(__pyx_v_samfile)); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":856 * * if not samfile._isOpen(): * raise StandardError, "BAM file %s is not open. Cannot read from file." %(samfile.filename) # <<<<<<<<<<<<<< * * self.fp = samfile.samfile */ __pyx_t_2 = PyBytes_FromString(__pyx_v_samfile->filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_Raise(__pyx_builtin_StandardError, ((PyObject *)__pyx_t_3), 0, 0); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":858 * raise StandardError, "BAM file %s is not open. Cannot read from file." %(samfile.filename) * * self.fp = samfile.samfile # <<<<<<<<<<<<<< * self.b = calloc(1, sizeof(bam1_t)) * */ __pyx_t_4 = __pyx_v_samfile->samfile; __pyx_v_self->fp = __pyx_t_4; /* "samtoolsWrapper.pyx":859 * * self.fp = samfile.samfile * self.b = calloc(1, sizeof(bam1_t)) # <<<<<<<<<<<<<< * * def __iter__(self): */ __pyx_v_self->b = ((bam1_t *)calloc(1, (sizeof(bam1_t)))); __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("samtoolsWrapper.IteratorRowAll.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_14IteratorRowAll_3__iter__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_15samtoolsWrapper_14IteratorRowAll_3__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); __pyx_r = __pyx_pf_15samtoolsWrapper_14IteratorRowAll_2__iter__(((struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":861 * self.b = calloc(1, sizeof(bam1_t)) * * def __iter__(self): # <<<<<<<<<<<<<< * return self * */ static PyObject *__pyx_pf_15samtoolsWrapper_14IteratorRowAll_2__iter__(struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__", 0); /* "samtoolsWrapper.pyx":862 * * def __iter__(self): * return self # <<<<<<<<<<<<<< * * cdef bam1_t* getCurrent(self): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":864 * return self * * cdef bam1_t* getCurrent(self): # <<<<<<<<<<<<<< * return self.b * */ static bam1_t *__pyx_f_15samtoolsWrapper_14IteratorRowAll_getCurrent(struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *__pyx_v_self) { bam1_t *__pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getCurrent", 0); /* "samtoolsWrapper.pyx":865 * * cdef bam1_t* getCurrent(self): * return self.b # <<<<<<<<<<<<<< * * cdef int cnext(self): */ __pyx_r = __pyx_v_self->b; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":867 * return self.b * * cdef int cnext(self): # <<<<<<<<<<<<<< * ''' * cversion of iterator. Used by IteratorColumn */ static int __pyx_f_15samtoolsWrapper_14IteratorRowAll_cnext(struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cnext", 0); /* "samtoolsWrapper.pyx":871 * cversion of iterator. Used by IteratorColumn * ''' * return samread(self.fp, self.b) # <<<<<<<<<<<<<< * * def __next__(self): */ __pyx_r = samread(__pyx_v_self->fp, __pyx_v_self->b); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_14IteratorRowAll_5__next__(PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_15samtoolsWrapper_14IteratorRowAll_4__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n "; #if CYTHON_COMPILING_IN_CPYTHON struct wrapperbase __pyx_wrapperbase_15samtoolsWrapper_14IteratorRowAll_4__next__; #endif static PyObject *__pyx_pw_15samtoolsWrapper_14IteratorRowAll_5__next__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); __pyx_r = __pyx_pf_15samtoolsWrapper_14IteratorRowAll_4__next__(((struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":873 * return samread(self.fp, self.b) * * def __next__(self): # <<<<<<<<<<<<<< * """python version of next(). * */ static PyObject *__pyx_pf_15samtoolsWrapper_14IteratorRowAll_4__next__(struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *__pyx_v_self) { int __pyx_v_ret; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__next__", 0); /* "samtoolsWrapper.pyx":878 * pyrex uses this non-standard name instead of next() * """ * cdef int ret = samread(self.fp, self.b) # <<<<<<<<<<<<<< * * if ret > 0: */ __pyx_v_ret = samread(__pyx_v_self->fp, __pyx_v_self->b); /* "samtoolsWrapper.pyx":880 * cdef int ret = samread(self.fp, self.b) * * if ret > 0: # <<<<<<<<<<<<<< * return makeAlignedRead(self.b) * else: */ __pyx_t_1 = (__pyx_v_ret > 0); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":881 * * if ret > 0: * return makeAlignedRead(self.b) # <<<<<<<<<<<<<< * else: * raise StopIteration */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = ((PyObject *)__pyx_f_15samtoolsWrapper_makeAlignedRead(__pyx_v_self->b)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "samtoolsWrapper.pyx":883 * return makeAlignedRead(self.b) * else: * raise StopIteration # <<<<<<<<<<<<<< * * def __dealloc__(self): */ __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("samtoolsWrapper.IteratorRowAll.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static void __pyx_pw_15samtoolsWrapper_14IteratorRowAll_7__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_15samtoolsWrapper_14IteratorRowAll_7__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_15samtoolsWrapper_14IteratorRowAll_6__dealloc__(((struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":885 * raise StopIteration * * def __dealloc__(self): # <<<<<<<<<<<<<< * '''remember: dealloc cannot call other methods!''' * pysam_bam_destroy1(self.b) */ static void __pyx_pf_15samtoolsWrapper_14IteratorRowAll_6__dealloc__(struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* "samtoolsWrapper.pyx":887 * def __dealloc__(self): * '''remember: dealloc cannot call other methods!''' * pysam_bam_destroy1(self.b) # <<<<<<<<<<<<<< * * ################################################################################################### */ pysam_bam_destroy1(__pyx_v_self->b); __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":891 * ################################################################################################### * * cdef void reOrientRead(cAlignedRead* theRead): # <<<<<<<<<<<<<< * """ * """ */ static void __pyx_f_15samtoolsWrapper_reOrientRead(CYTHON_UNUSED __pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_theRead) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reOrientRead", 0); __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":898 * ################################################################################################### * * cdef cAlignedRead* createRead(bam1_t* src, int storeRgID, char** rgID): # <<<<<<<<<<<<<< * """ * Allocate memory for aligned read struct, and populate it. */ static __pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_f_15samtoolsWrapper_createRead(bam1_t *__pyx_v_src, int __pyx_v_storeRgID, char **__pyx_v_rgID) { char *__pyx_v_bamTable; int __pyx_v_characterIndex; int __pyx_v_lenSeq; int __pyx_v_lenQual; CYTHON_UNUSED double __pyx_v_mLTOT; uint8_t *__pyx_v_p; uint8_t *__pyx_v_q; __pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_theRead; char *__pyx_v_seq; char *__pyx_v_qual; uint8_t *__pyx_v_v; char *__pyx_v_tempRgID; int __pyx_v_lenRgID; int __pyx_v_index; int __pyx_v_flag; int __pyx_v_end; short *__pyx_v_cigarOps; int __pyx_v_cigarFlag; int __pyx_v_cigarFlagLen; uint32_t *__pyx_v_cigar_p; __pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_r; __Pyx_RefNannyDeclarations int32_t __pyx_t_1; int __pyx_t_2; int __pyx_t_3; uint32_t __pyx_t_4; short __pyx_t_5; int __pyx_t_6; int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("createRead", 0); /* "samtoolsWrapper.pyx":902 * Allocate memory for aligned read struct, and populate it. * """ * cdef char* bamTable = "=ACMGRSVTWYHKDBN" # <<<<<<<<<<<<<< * cdef int characterIndex = 0 * cdef int lenSeq = src.core.l_qseq */ __pyx_v_bamTable = __pyx_k_50; /* "samtoolsWrapper.pyx":903 * """ * cdef char* bamTable = "=ACMGRSVTWYHKDBN" * cdef int characterIndex = 0 # <<<<<<<<<<<<<< * cdef int lenSeq = src.core.l_qseq * cdef int lenQual = src.core.l_qseq */ __pyx_v_characterIndex = 0; /* "samtoolsWrapper.pyx":904 * cdef char* bamTable = "=ACMGRSVTWYHKDBN" * cdef int characterIndex = 0 * cdef int lenSeq = src.core.l_qseq # <<<<<<<<<<<<<< * cdef int lenQual = src.core.l_qseq * cdef double mLTOT = -0.23025850929940459 # Minus log ten over ten */ __pyx_t_1 = __pyx_v_src->core.l_qseq; __pyx_v_lenSeq = __pyx_t_1; /* "samtoolsWrapper.pyx":905 * cdef int characterIndex = 0 * cdef int lenSeq = src.core.l_qseq * cdef int lenQual = src.core.l_qseq # <<<<<<<<<<<<<< * cdef double mLTOT = -0.23025850929940459 # Minus log ten over ten * */ __pyx_t_1 = __pyx_v_src->core.l_qseq; __pyx_v_lenQual = __pyx_t_1; /* "samtoolsWrapper.pyx":906 * cdef int lenSeq = src.core.l_qseq * cdef int lenQual = src.core.l_qseq * cdef double mLTOT = -0.23025850929940459 # Minus log ten over ten # <<<<<<<<<<<<<< * * cdef uint8_t* p = pysam_bam1_seq(src) */ __pyx_v_mLTOT = -0.23025850929940459; /* "samtoolsWrapper.pyx":908 * cdef double mLTOT = -0.23025850929940459 # Minus log ten over ten * * cdef uint8_t* p = pysam_bam1_seq(src) # <<<<<<<<<<<<<< * cdef uint8_t* q = pysam_bam1_qual(src) * */ __pyx_v_p = pysam_bam1_seq(__pyx_v_src); /* "samtoolsWrapper.pyx":909 * * cdef uint8_t* p = pysam_bam1_seq(src) * cdef uint8_t* q = pysam_bam1_qual(src) # <<<<<<<<<<<<<< * * if lenSeq == 0: */ __pyx_v_q = pysam_bam1_qual(__pyx_v_src); /* "samtoolsWrapper.pyx":911 * cdef uint8_t* q = pysam_bam1_qual(src) * * if lenSeq == 0: # <<<<<<<<<<<<<< * return NULL * */ __pyx_t_2 = (__pyx_v_lenSeq == 0); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":912 * * if lenSeq == 0: * return NULL # <<<<<<<<<<<<<< * * if lenQual == 0: */ __pyx_r = NULL; goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":914 * return NULL * * if lenQual == 0: # <<<<<<<<<<<<<< * return NULL * */ __pyx_t_2 = (__pyx_v_lenQual == 0); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":915 * * if lenQual == 0: * return NULL # <<<<<<<<<<<<<< * * if q[0] == 0xff: */ __pyx_r = NULL; goto __pyx_L0; goto __pyx_L4; } __pyx_L4:; /* "samtoolsWrapper.pyx":917 * return NULL * * if q[0] == 0xff: # <<<<<<<<<<<<<< * return NULL * */ __pyx_t_2 = ((__pyx_v_q[0]) == 0xff); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":918 * * if q[0] == 0xff: * return NULL # <<<<<<<<<<<<<< * * cdef cAlignedRead* theRead = (malloc(sizeof(cAlignedRead))) */ __pyx_r = NULL; goto __pyx_L0; goto __pyx_L5; } __pyx_L5:; /* "samtoolsWrapper.pyx":920 * return NULL * * cdef cAlignedRead* theRead = (malloc(sizeof(cAlignedRead))) # <<<<<<<<<<<<<< * * cdef char* seq = calloc(lenSeq + 1 , sizeof(char)) */ __pyx_v_theRead = ((__pyx_t_15samtoolsWrapper_cAlignedRead *)malloc((sizeof(__pyx_t_15samtoolsWrapper_cAlignedRead)))); /* "samtoolsWrapper.pyx":922 * cdef cAlignedRead* theRead = (malloc(sizeof(cAlignedRead))) * * cdef char* seq = calloc(lenSeq + 1 , sizeof(char)) # <<<<<<<<<<<<<< * cdef char* qual = calloc(lenQual + 1, sizeof(char)) * */ __pyx_v_seq = ((char *)calloc((__pyx_v_lenSeq + 1), (sizeof(char)))); /* "samtoolsWrapper.pyx":923 * * cdef char* seq = calloc(lenSeq + 1 , sizeof(char)) * cdef char* qual = calloc(lenQual + 1, sizeof(char)) # <<<<<<<<<<<<<< * * # Try to grab the read-group tag value */ __pyx_v_qual = ((char *)calloc((__pyx_v_lenQual + 1), (sizeof(char)))); /* "samtoolsWrapper.pyx":926 * * # Try to grab the read-group tag value * cdef uint8_t* v = NULL # <<<<<<<<<<<<<< * cdef char* tempRgID = NULL * cdef int lenRgID = 0 */ __pyx_v_v = NULL; /* "samtoolsWrapper.pyx":927 * # Try to grab the read-group tag value * cdef uint8_t* v = NULL * cdef char* tempRgID = NULL # <<<<<<<<<<<<<< * cdef int lenRgID = 0 * */ __pyx_v_tempRgID = NULL; /* "samtoolsWrapper.pyx":928 * cdef uint8_t* v = NULL * cdef char* tempRgID = NULL * cdef int lenRgID = 0 # <<<<<<<<<<<<<< * * if storeRgID: */ __pyx_v_lenRgID = 0; /* "samtoolsWrapper.pyx":930 * cdef int lenRgID = 0 * * if storeRgID: # <<<<<<<<<<<<<< * v = bam_aux_get(src, "RG") * tempRgID = bam_aux2Z(v) */ if (__pyx_v_storeRgID) { /* "samtoolsWrapper.pyx":931 * * if storeRgID: * v = bam_aux_get(src, "RG") # <<<<<<<<<<<<<< * tempRgID = bam_aux2Z(v) * lenRgID = strlen(tempRgID) */ __pyx_v_v = bam_aux_get(__pyx_v_src, __pyx_k__RG); /* "samtoolsWrapper.pyx":932 * if storeRgID: * v = bam_aux_get(src, "RG") * tempRgID = bam_aux2Z(v) # <<<<<<<<<<<<<< * lenRgID = strlen(tempRgID) * rgID[0] = (calloc(lenRgID+1, sizeof(char))) */ __pyx_v_tempRgID = ((char *)bam_aux2Z(__pyx_v_v)); /* "samtoolsWrapper.pyx":933 * v = bam_aux_get(src, "RG") * tempRgID = bam_aux2Z(v) * lenRgID = strlen(tempRgID) # <<<<<<<<<<<<<< * rgID[0] = (calloc(lenRgID+1, sizeof(char))) * strcpy(rgID[0], tempRgID) */ __pyx_v_lenRgID = strlen(__pyx_v_tempRgID); /* "samtoolsWrapper.pyx":934 * tempRgID = bam_aux2Z(v) * lenRgID = strlen(tempRgID) * rgID[0] = (calloc(lenRgID+1, sizeof(char))) # <<<<<<<<<<<<<< * strcpy(rgID[0], tempRgID) * */ (__pyx_v_rgID[0]) = ((char *)calloc((__pyx_v_lenRgID + 1), (sizeof(char)))); /* "samtoolsWrapper.pyx":935 * lenRgID = strlen(tempRgID) * rgID[0] = (calloc(lenRgID+1, sizeof(char))) * strcpy(rgID[0], tempRgID) # <<<<<<<<<<<<<< * * assert theRead != NULL */ strcpy((__pyx_v_rgID[0]), __pyx_v_tempRgID); goto __pyx_L6; } __pyx_L6:; /* "samtoolsWrapper.pyx":937 * strcpy(rgID[0], tempRgID) * * assert theRead != NULL # <<<<<<<<<<<<<< * assert seq != NULL * assert qual != NULL */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!(__pyx_v_theRead != NULL))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "samtoolsWrapper.pyx":938 * * assert theRead != NULL * assert seq != NULL # <<<<<<<<<<<<<< * assert qual != NULL * */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!(__pyx_v_seq != NULL))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "samtoolsWrapper.pyx":939 * assert theRead != NULL * assert seq != NULL * assert qual != NULL # <<<<<<<<<<<<<< * * cdef int index = 0 */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!(__pyx_v_qual != NULL))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "samtoolsWrapper.pyx":941 * assert qual != NULL * * cdef int index = 0 # <<<<<<<<<<<<<< * #cdef int nQualsBelow20 = 0 * */ __pyx_v_index = 0; /* "samtoolsWrapper.pyx":944 * #cdef int nQualsBelow20 = 0 * * for index from 0 <= index < lenSeq: # <<<<<<<<<<<<<< * characterIndex = ((p)[(index) / 2] >> 4 * (1 - (index) % 2) & 0xf) * seq[index] = bamTable[characterIndex] */ __pyx_t_3 = __pyx_v_lenSeq; for (__pyx_v_index = 0; __pyx_v_index < __pyx_t_3; __pyx_v_index++) { /* "samtoolsWrapper.pyx":945 * * for index from 0 <= index < lenSeq: * characterIndex = ((p)[(index) / 2] >> 4 * (1 - (index) % 2) & 0xf) # <<<<<<<<<<<<<< * seq[index] = bamTable[characterIndex] * qual[index] = q[index] */ __pyx_v_characterIndex = (((__pyx_v_p[(__pyx_v_index / 2)]) >> (4 * (1 - (__pyx_v_index % 2)))) & 0xf); /* "samtoolsWrapper.pyx":946 * for index from 0 <= index < lenSeq: * characterIndex = ((p)[(index) / 2] >> 4 * (1 - (index) % 2) & 0xf) * seq[index] = bamTable[characterIndex] # <<<<<<<<<<<<<< * qual[index] = q[index] * */ (__pyx_v_seq[__pyx_v_index]) = (__pyx_v_bamTable[__pyx_v_characterIndex]); /* "samtoolsWrapper.pyx":947 * characterIndex = ((p)[(index) / 2] >> 4 * (1 - (index) % 2) & 0xf) * seq[index] = bamTable[characterIndex] * qual[index] = q[index] # <<<<<<<<<<<<<< * * assert qual[index] <= 93 */ (__pyx_v_qual[__pyx_v_index]) = (__pyx_v_q[__pyx_v_index]); /* "samtoolsWrapper.pyx":949 * qual[index] = q[index] * * assert qual[index] <= 93 # <<<<<<<<<<<<<< * assert qual[index] >= 0 * */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!((__pyx_v_qual[__pyx_v_index]) <= 93))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "samtoolsWrapper.pyx":950 * * assert qual[index] <= 93 * assert qual[index] >= 0 # <<<<<<<<<<<<<< * * #if qual[index] < 20: */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!((__pyx_v_qual[__pyx_v_index]) >= 0))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif } /* "samtoolsWrapper.pyx":955 * # nQualsBelow20 += 1 * * theRead.seq = seq # <<<<<<<<<<<<<< * theRead.qual = qual * theRead.chromID = src.core.tid */ __pyx_v_theRead->seq = __pyx_v_seq; /* "samtoolsWrapper.pyx":956 * * theRead.seq = seq * theRead.qual = qual # <<<<<<<<<<<<<< * theRead.chromID = src.core.tid * theRead.pos = src.core.pos */ __pyx_v_theRead->qual = __pyx_v_qual; /* "samtoolsWrapper.pyx":957 * theRead.seq = seq * theRead.qual = qual * theRead.chromID = src.core.tid # <<<<<<<<<<<<<< * theRead.pos = src.core.pos * theRead.rlen = src.core.l_qseq */ __pyx_t_1 = __pyx_v_src->core.tid; __pyx_v_theRead->chromID = __pyx_t_1; /* "samtoolsWrapper.pyx":958 * theRead.qual = qual * theRead.chromID = src.core.tid * theRead.pos = src.core.pos # <<<<<<<<<<<<<< * theRead.rlen = src.core.l_qseq * theRead.mapq = src.core.qual */ __pyx_t_1 = __pyx_v_src->core.pos; __pyx_v_theRead->pos = __pyx_t_1; /* "samtoolsWrapper.pyx":959 * theRead.chromID = src.core.tid * theRead.pos = src.core.pos * theRead.rlen = src.core.l_qseq # <<<<<<<<<<<<<< * theRead.mapq = src.core.qual * theRead.cigarLen = src.core.n_cigar */ __pyx_t_1 = __pyx_v_src->core.l_qseq; __pyx_v_theRead->rlen = __pyx_t_1; /* "samtoolsWrapper.pyx":960 * theRead.pos = src.core.pos * theRead.rlen = src.core.l_qseq * theRead.mapq = src.core.qual # <<<<<<<<<<<<<< * theRead.cigarLen = src.core.n_cigar * */ __pyx_t_4 = __pyx_v_src->core.qual; __pyx_v_theRead->mapq = __pyx_t_4; /* "samtoolsWrapper.pyx":961 * theRead.rlen = src.core.l_qseq * theRead.mapq = src.core.qual * theRead.cigarLen = src.core.n_cigar # <<<<<<<<<<<<<< * * cdef int flag = src.core.flag */ __pyx_t_4 = __pyx_v_src->core.n_cigar; __pyx_v_theRead->cigarLen = __pyx_t_4; /* "samtoolsWrapper.pyx":963 * theRead.cigarLen = src.core.n_cigar * * cdef int flag = src.core.flag # <<<<<<<<<<<<<< * cdef int end = theRead.pos * cdef short* cigarOps = (malloc(2*theRead.cigarLen*sizeof(short))) */ __pyx_t_4 = __pyx_v_src->core.flag; __pyx_v_flag = __pyx_t_4; /* "samtoolsWrapper.pyx":964 * * cdef int flag = src.core.flag * cdef int end = theRead.pos # <<<<<<<<<<<<<< * cdef short* cigarOps = (malloc(2*theRead.cigarLen*sizeof(short))) * cdef int cigarFlag = 0 */ __pyx_t_3 = __pyx_v_theRead->pos; __pyx_v_end = __pyx_t_3; /* "samtoolsWrapper.pyx":965 * cdef int flag = src.core.flag * cdef int end = theRead.pos * cdef short* cigarOps = (malloc(2*theRead.cigarLen*sizeof(short))) # <<<<<<<<<<<<<< * cdef int cigarFlag = 0 * cdef int cigarFlagLen = 0 */ __pyx_v_cigarOps = ((short *)malloc(((2 * __pyx_v_theRead->cigarLen) * (sizeof(short))))); /* "samtoolsWrapper.pyx":966 * cdef int end = theRead.pos * cdef short* cigarOps = (malloc(2*theRead.cigarLen*sizeof(short))) * cdef int cigarFlag = 0 # <<<<<<<<<<<<<< * cdef int cigarFlagLen = 0 * */ __pyx_v_cigarFlag = 0; /* "samtoolsWrapper.pyx":967 * cdef short* cigarOps = (malloc(2*theRead.cigarLen*sizeof(short))) * cdef int cigarFlag = 0 * cdef int cigarFlagLen = 0 # <<<<<<<<<<<<<< * * assert cigarOps != NULL */ __pyx_v_cigarFlagLen = 0; /* "samtoolsWrapper.pyx":969 * cdef int cigarFlagLen = 0 * * assert cigarOps != NULL # <<<<<<<<<<<<<< * * cdef uint32_t* cigar_p = pysam_bam1_cigar(src) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!(__pyx_v_cigarOps != NULL))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "samtoolsWrapper.pyx":971 * assert cigarOps != NULL * * cdef uint32_t* cigar_p = pysam_bam1_cigar(src) # <<<<<<<<<<<<<< * * for index from 0 <= index < theRead.cigarLen: */ __pyx_v_cigar_p = pysam_bam1_cigar(__pyx_v_src); /* "samtoolsWrapper.pyx":973 * cdef uint32_t* cigar_p = pysam_bam1_cigar(src) * * for index from 0 <= index < theRead.cigarLen: # <<<<<<<<<<<<<< * * cigarFlag = cigar_p[index] & BAM_CIGAR_MASK */ __pyx_t_5 = __pyx_v_theRead->cigarLen; for (__pyx_v_index = 0; __pyx_v_index < __pyx_t_5; __pyx_v_index++) { /* "samtoolsWrapper.pyx":975 * for index from 0 <= index < theRead.cigarLen: * * cigarFlag = cigar_p[index] & BAM_CIGAR_MASK # <<<<<<<<<<<<<< * cigarFlagLen = cigar_p[index] >> BAM_CIGAR_SHIFT * cigarOps[2*index] = cigarFlag */ __pyx_v_cigarFlag = ((__pyx_v_cigar_p[__pyx_v_index]) & 15); /* "samtoolsWrapper.pyx":976 * * cigarFlag = cigar_p[index] & BAM_CIGAR_MASK * cigarFlagLen = cigar_p[index] >> BAM_CIGAR_SHIFT # <<<<<<<<<<<<<< * cigarOps[2*index] = cigarFlag * cigarOps[ (2*index) + 1] = cigarFlagLen */ __pyx_v_cigarFlagLen = ((__pyx_v_cigar_p[__pyx_v_index]) >> 4); /* "samtoolsWrapper.pyx":977 * cigarFlag = cigar_p[index] & BAM_CIGAR_MASK * cigarFlagLen = cigar_p[index] >> BAM_CIGAR_SHIFT * cigarOps[2*index] = cigarFlag # <<<<<<<<<<<<<< * cigarOps[ (2*index) + 1] = cigarFlagLen * */ (__pyx_v_cigarOps[(2 * __pyx_v_index)]) = __pyx_v_cigarFlag; /* "samtoolsWrapper.pyx":978 * cigarFlagLen = cigar_p[index] >> BAM_CIGAR_SHIFT * cigarOps[2*index] = cigarFlag * cigarOps[ (2*index) + 1] = cigarFlagLen # <<<<<<<<<<<<<< * * # 0 is match. 2 is deletion. 3 is reference skipping */ (__pyx_v_cigarOps[((2 * __pyx_v_index) + 1)]) = __pyx_v_cigarFlagLen; /* "samtoolsWrapper.pyx":981 * * # 0 is match. 2 is deletion. 3 is reference skipping * if cigarFlag == 0 or cigarFlag == 2 or cigarFlag == 3: # <<<<<<<<<<<<<< * end += cigarFlagLen * */ switch (__pyx_v_cigarFlag) { case 0: case 2: case 3: /* "samtoolsWrapper.pyx":982 * # 0 is match. 2 is deletion. 3 is reference skipping * if cigarFlag == 0 or cigarFlag == 2 or cigarFlag == 3: * end += cigarFlagLen # <<<<<<<<<<<<<< * * # Soft-clipping of sequence at start of read changes the mapping */ __pyx_v_end = (__pyx_v_end + __pyx_v_cigarFlagLen); break; } /* "samtoolsWrapper.pyx":988 * # base. I want to adjust this so that the read start refers to the first base in * # the read. * if index == 0 and cigarFlag == 4: # <<<<<<<<<<<<<< * theRead.pos -= cigarFlagLen * # Don't want to pretend that the read extends to the end of the soft-clipped */ __pyx_t_2 = (__pyx_v_index == 0); if (__pyx_t_2) { __pyx_t_6 = (__pyx_v_cigarFlag == 4); __pyx_t_7 = __pyx_t_6; } else { __pyx_t_7 = __pyx_t_2; } if (__pyx_t_7) { /* "samtoolsWrapper.pyx":989 * # the read. * if index == 0 and cigarFlag == 4: * theRead.pos -= cigarFlagLen # <<<<<<<<<<<<<< * # Don't want to pretend that the read extends to the end of the soft-clipped * # sequence. Treat it in the same way as an insertion. */ __pyx_v_theRead->pos = (__pyx_v_theRead->pos - __pyx_v_cigarFlagLen); goto __pyx_L11; } /* "samtoolsWrapper.pyx":992 * # Don't want to pretend that the read extends to the end of the soft-clipped * # sequence. Treat it in the same way as an insertion. * elif cigarFlag == 4: # <<<<<<<<<<<<<< * pass * */ __pyx_t_7 = (__pyx_v_cigarFlag == 4); if (__pyx_t_7) { goto __pyx_L11; } __pyx_L11:; } /* "samtoolsWrapper.pyx":995 * pass * * theRead.end = end # <<<<<<<<<<<<<< * theRead.cigarOps = cigarOps * theRead.bitFlag = flag */ __pyx_v_theRead->end = __pyx_v_end; /* "samtoolsWrapper.pyx":996 * * theRead.end = end * theRead.cigarOps = cigarOps # <<<<<<<<<<<<<< * theRead.bitFlag = flag * theRead.hash = NULL */ __pyx_v_theRead->cigarOps = __pyx_v_cigarOps; /* "samtoolsWrapper.pyx":997 * theRead.end = end * theRead.cigarOps = cigarOps * theRead.bitFlag = flag # <<<<<<<<<<<<<< * theRead.hash = NULL * theRead.mateChromID = src.core.mtid */ __pyx_v_theRead->bitFlag = __pyx_v_flag; /* "samtoolsWrapper.pyx":998 * theRead.cigarOps = cigarOps * theRead.bitFlag = flag * theRead.hash = NULL # <<<<<<<<<<<<<< * theRead.mateChromID = src.core.mtid * theRead.insertSize = src.core.isize */ __pyx_v_theRead->hash = NULL; /* "samtoolsWrapper.pyx":999 * theRead.bitFlag = flag * theRead.hash = NULL * theRead.mateChromID = src.core.mtid # <<<<<<<<<<<<<< * theRead.insertSize = src.core.isize * theRead.matePos = src.core.mpos */ __pyx_t_1 = __pyx_v_src->core.mtid; __pyx_v_theRead->mateChromID = __pyx_t_1; /* "samtoolsWrapper.pyx":1000 * theRead.hash = NULL * theRead.mateChromID = src.core.mtid * theRead.insertSize = src.core.isize # <<<<<<<<<<<<<< * theRead.matePos = src.core.mpos * Read_SetUnCompressed(theRead) */ __pyx_t_1 = __pyx_v_src->core.isize; __pyx_v_theRead->insertSize = __pyx_t_1; /* "samtoolsWrapper.pyx":1001 * theRead.mateChromID = src.core.mtid * theRead.insertSize = src.core.isize * theRead.matePos = src.core.mpos # <<<<<<<<<<<<<< * Read_SetUnCompressed(theRead) * */ __pyx_t_1 = __pyx_v_src->core.mpos; __pyx_v_theRead->matePos = __pyx_t_1; /* "samtoolsWrapper.pyx":1002 * theRead.insertSize = src.core.isize * theRead.matePos = src.core.mpos * Read_SetUnCompressed(theRead) # <<<<<<<<<<<<<< * * return theRead */ __pyx_f_15samtoolsWrapper_Read_SetUnCompressed(__pyx_v_theRead); /* "samtoolsWrapper.pyx":1004 * Read_SetUnCompressed(theRead) * * return theRead # <<<<<<<<<<<<<< * * ################################################################################################### */ __pyx_r = __pyx_v_theRead; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_WriteUnraisable("samtoolsWrapper.createRead", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1008 * ################################################################################################### * * cdef void destroyRead(cAlignedRead* theRead): # <<<<<<<<<<<<<< * """ * De-allocate memory for read. */ static void __pyx_f_15samtoolsWrapper_destroyRead(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_theRead) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("destroyRead", 0); /* "samtoolsWrapper.pyx":1013 * """ * * if theRead.seq != NULL: # <<<<<<<<<<<<<< * free(theRead.seq) * */ __pyx_t_1 = (__pyx_v_theRead->seq != NULL); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":1014 * * if theRead.seq != NULL: * free(theRead.seq) # <<<<<<<<<<<<<< * * if theRead.qual != NULL: */ free(__pyx_v_theRead->seq); goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":1016 * free(theRead.seq) * * if theRead.qual != NULL: # <<<<<<<<<<<<<< * free(theRead.qual) * */ __pyx_t_1 = (__pyx_v_theRead->qual != NULL); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":1017 * * if theRead.qual != NULL: * free(theRead.qual) # <<<<<<<<<<<<<< * * if theRead.cigarOps != NULL: */ free(__pyx_v_theRead->qual); goto __pyx_L4; } __pyx_L4:; /* "samtoolsWrapper.pyx":1019 * free(theRead.qual) * * if theRead.cigarOps != NULL: # <<<<<<<<<<<<<< * free(theRead.cigarOps) * */ __pyx_t_1 = (__pyx_v_theRead->cigarOps != NULL); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":1020 * * if theRead.cigarOps != NULL: * free(theRead.cigarOps) # <<<<<<<<<<<<<< * * if theRead.hash != NULL: */ free(__pyx_v_theRead->cigarOps); goto __pyx_L5; } __pyx_L5:; /* "samtoolsWrapper.pyx":1022 * free(theRead.cigarOps) * * if theRead.hash != NULL: # <<<<<<<<<<<<<< * free(theRead.hash) * */ __pyx_t_1 = (__pyx_v_theRead->hash != NULL); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":1023 * * if theRead.hash != NULL: * free(theRead.hash) # <<<<<<<<<<<<<< * * free(theRead) */ free(__pyx_v_theRead->hash); goto __pyx_L6; } __pyx_L6:; /* "samtoolsWrapper.pyx":1025 * free(theRead.hash) * * free(theRead) # <<<<<<<<<<<<<< * * ################################################################################################### */ free(__pyx_v_theRead); __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":1029 * ################################################################################################### * * cdef void compressSeq(cAlignedRead* read, char* refSeq): # <<<<<<<<<<<<<< * """ * Does exactly what it says on the tin. */ static void __pyx_f_15samtoolsWrapper_compressSeq(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_read, char *__pyx_v_refSeq) { char *__pyx_v_seq; char *__pyx_v_newSeq; char *__pyx_v_finalSeq; int __pyx_v_i; int __pyx_v_nMatches; int __pyx_v_newSeqIndex; int __pyx_v_totalMatches; __Pyx_RefNannyDeclarations char *__pyx_t_1; short __pyx_t_2; int __pyx_t_3; int __pyx_t_4; __Pyx_RefNannySetupContext("compressSeq", 0); /* "samtoolsWrapper.pyx":1033 * Does exactly what it says on the tin. * """ * cdef char* seq = read.seq # <<<<<<<<<<<<<< * cdef char* newSeq = (alloca(sizeof(char)*read.rlen*2)) * #cdef char* newSeq = (malloc(sizeof(char)*read.rlen*2)) */ __pyx_t_1 = __pyx_v_read->seq; __pyx_v_seq = __pyx_t_1; /* "samtoolsWrapper.pyx":1034 * """ * cdef char* seq = read.seq * cdef char* newSeq = (alloca(sizeof(char)*read.rlen*2)) # <<<<<<<<<<<<<< * #cdef char* newSeq = (malloc(sizeof(char)*read.rlen*2)) * cdef char* finalSeq = NULL */ __pyx_v_newSeq = ((char *)alloca((((sizeof(char)) * __pyx_v_read->rlen) * 2))); /* "samtoolsWrapper.pyx":1036 * cdef char* newSeq = (alloca(sizeof(char)*read.rlen*2)) * #cdef char* newSeq = (malloc(sizeof(char)*read.rlen*2)) * cdef char* finalSeq = NULL # <<<<<<<<<<<<<< * cdef int i = 0 * cdef int nMatches = 0 */ __pyx_v_finalSeq = NULL; /* "samtoolsWrapper.pyx":1037 * #cdef char* newSeq = (malloc(sizeof(char)*read.rlen*2)) * cdef char* finalSeq = NULL * cdef int i = 0 # <<<<<<<<<<<<<< * cdef int nMatches = 0 * cdef int newSeqIndex = 0 */ __pyx_v_i = 0; /* "samtoolsWrapper.pyx":1038 * cdef char* finalSeq = NULL * cdef int i = 0 * cdef int nMatches = 0 # <<<<<<<<<<<<<< * cdef int newSeqIndex = 0 * cdef int totalMatches = 0 */ __pyx_v_nMatches = 0; /* "samtoolsWrapper.pyx":1039 * cdef int i = 0 * cdef int nMatches = 0 * cdef int newSeqIndex = 0 # <<<<<<<<<<<<<< * cdef int totalMatches = 0 * */ __pyx_v_newSeqIndex = 0; /* "samtoolsWrapper.pyx":1040 * cdef int nMatches = 0 * cdef int newSeqIndex = 0 * cdef int totalMatches = 0 # <<<<<<<<<<<<<< * * for i in range(read.rlen): */ __pyx_v_totalMatches = 0; /* "samtoolsWrapper.pyx":1042 * cdef int totalMatches = 0 * * for i in range(read.rlen): # <<<<<<<<<<<<<< * * # Ref match. Store count if > 40 */ __pyx_t_2 = __pyx_v_read->rlen; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; /* "samtoolsWrapper.pyx":1045 * * # Ref match. Store count if > 40 * if seq[i] == refSeq[i]: # <<<<<<<<<<<<<< * totalMatches += 1 * */ __pyx_t_4 = ((__pyx_v_seq[__pyx_v_i]) == (__pyx_v_refSeq[__pyx_v_i])); if (__pyx_t_4) { /* "samtoolsWrapper.pyx":1046 * # Ref match. Store count if > 40 * if seq[i] == refSeq[i]: * totalMatches += 1 # <<<<<<<<<<<<<< * * if nMatches == 40: */ __pyx_v_totalMatches = (__pyx_v_totalMatches + 1); /* "samtoolsWrapper.pyx":1048 * totalMatches += 1 * * if nMatches == 40: # <<<<<<<<<<<<<< * newSeq[newSeqIndex] = nMatches * nMatches = 0 */ __pyx_t_4 = (__pyx_v_nMatches == 40); if (__pyx_t_4) { /* "samtoolsWrapper.pyx":1049 * * if nMatches == 40: * newSeq[newSeqIndex] = nMatches # <<<<<<<<<<<<<< * nMatches = 0 * newSeqIndex += 1 */ (__pyx_v_newSeq[__pyx_v_newSeqIndex]) = __pyx_v_nMatches; /* "samtoolsWrapper.pyx":1050 * if nMatches == 40: * newSeq[newSeqIndex] = nMatches * nMatches = 0 # <<<<<<<<<<<<<< * newSeqIndex += 1 * */ __pyx_v_nMatches = 0; /* "samtoolsWrapper.pyx":1051 * newSeq[newSeqIndex] = nMatches * nMatches = 0 * newSeqIndex += 1 # <<<<<<<<<<<<<< * * nMatches += 1 */ __pyx_v_newSeqIndex = (__pyx_v_newSeqIndex + 1); goto __pyx_L6; } __pyx_L6:; /* "samtoolsWrapper.pyx":1053 * newSeqIndex += 1 * * nMatches += 1 # <<<<<<<<<<<<<< * * # Ref mis-match. Store base. */ __pyx_v_nMatches = (__pyx_v_nMatches + 1); goto __pyx_L5; } /*else*/ { /* "samtoolsWrapper.pyx":1057 * # Ref mis-match. Store base. * else: * if nMatches > 0: # <<<<<<<<<<<<<< * newSeq[newSeqIndex] = nMatches * nMatches = 0 */ __pyx_t_4 = (__pyx_v_nMatches > 0); if (__pyx_t_4) { /* "samtoolsWrapper.pyx":1058 * else: * if nMatches > 0: * newSeq[newSeqIndex] = nMatches # <<<<<<<<<<<<<< * nMatches = 0 * newSeqIndex += 1 */ (__pyx_v_newSeq[__pyx_v_newSeqIndex]) = __pyx_v_nMatches; /* "samtoolsWrapper.pyx":1059 * if nMatches > 0: * newSeq[newSeqIndex] = nMatches * nMatches = 0 # <<<<<<<<<<<<<< * newSeqIndex += 1 * */ __pyx_v_nMatches = 0; /* "samtoolsWrapper.pyx":1060 * newSeq[newSeqIndex] = nMatches * nMatches = 0 * newSeqIndex += 1 # <<<<<<<<<<<<<< * * newSeq[newSeqIndex] = seq[i] */ __pyx_v_newSeqIndex = (__pyx_v_newSeqIndex + 1); goto __pyx_L7; } __pyx_L7:; /* "samtoolsWrapper.pyx":1062 * newSeqIndex += 1 * * newSeq[newSeqIndex] = seq[i] # <<<<<<<<<<<<<< * newSeqIndex += 1 * */ (__pyx_v_newSeq[__pyx_v_newSeqIndex]) = (__pyx_v_seq[__pyx_v_i]); /* "samtoolsWrapper.pyx":1063 * * newSeq[newSeqIndex] = seq[i] * newSeqIndex += 1 # <<<<<<<<<<<<<< * * # If we finish off with a load of matches, catch those */ __pyx_v_newSeqIndex = (__pyx_v_newSeqIndex + 1); } __pyx_L5:; } /* "samtoolsWrapper.pyx":1066 * * # If we finish off with a load of matches, catch those * if nMatches > 0: # <<<<<<<<<<<<<< * newSeq[newSeqIndex] = nMatches * nMatches = 0 */ __pyx_t_4 = (__pyx_v_nMatches > 0); if (__pyx_t_4) { /* "samtoolsWrapper.pyx":1067 * # If we finish off with a load of matches, catch those * if nMatches > 0: * newSeq[newSeqIndex] = nMatches # <<<<<<<<<<<<<< * nMatches = 0 * newSeqIndex += 1 */ (__pyx_v_newSeq[__pyx_v_newSeqIndex]) = __pyx_v_nMatches; /* "samtoolsWrapper.pyx":1068 * if nMatches > 0: * newSeq[newSeqIndex] = nMatches * nMatches = 0 # <<<<<<<<<<<<<< * newSeqIndex += 1 * */ __pyx_v_nMatches = 0; /* "samtoolsWrapper.pyx":1069 * newSeq[newSeqIndex] = nMatches * nMatches = 0 * newSeqIndex += 1 # <<<<<<<<<<<<<< * * newSeq[newSeqIndex] = 0 */ __pyx_v_newSeqIndex = (__pyx_v_newSeqIndex + 1); goto __pyx_L8; } __pyx_L8:; /* "samtoolsWrapper.pyx":1071 * newSeqIndex += 1 * * newSeq[newSeqIndex] = 0 # <<<<<<<<<<<<<< * finalSeq = malloc(sizeof(char)*(newSeqIndex+1)) * strcpy(finalSeq, newSeq) */ (__pyx_v_newSeq[__pyx_v_newSeqIndex]) = 0; /* "samtoolsWrapper.pyx":1072 * * newSeq[newSeqIndex] = 0 * finalSeq = malloc(sizeof(char)*(newSeqIndex+1)) # <<<<<<<<<<<<<< * strcpy(finalSeq, newSeq) * finalSeq[newSeqIndex] = 0 */ __pyx_v_finalSeq = ((char *)malloc(((sizeof(char)) * (__pyx_v_newSeqIndex + 1)))); /* "samtoolsWrapper.pyx":1073 * newSeq[newSeqIndex] = 0 * finalSeq = malloc(sizeof(char)*(newSeqIndex+1)) * strcpy(finalSeq, newSeq) # <<<<<<<<<<<<<< * finalSeq[newSeqIndex] = 0 * free(read.seq) */ strcpy(__pyx_v_finalSeq, __pyx_v_newSeq); /* "samtoolsWrapper.pyx":1074 * finalSeq = malloc(sizeof(char)*(newSeqIndex+1)) * strcpy(finalSeq, newSeq) * finalSeq[newSeqIndex] = 0 # <<<<<<<<<<<<<< * free(read.seq) * #free(newSeq) */ (__pyx_v_finalSeq[__pyx_v_newSeqIndex]) = 0; /* "samtoolsWrapper.pyx":1075 * strcpy(finalSeq, newSeq) * finalSeq[newSeqIndex] = 0 * free(read.seq) # <<<<<<<<<<<<<< * #free(newSeq) * read.seq = finalSeq */ free(__pyx_v_read->seq); /* "samtoolsWrapper.pyx":1077 * free(read.seq) * #free(newSeq) * read.seq = finalSeq # <<<<<<<<<<<<<< * * ################################################################################################### */ __pyx_v_read->seq = __pyx_v_finalSeq; __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":1081 * ################################################################################################### * * cdef void compressQual(cAlignedRead* read, int qualBinSize): # <<<<<<<<<<<<<< * """ * Does exactly what it says on the tin. */ static void __pyx_f_15samtoolsWrapper_compressQual(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_read, int __pyx_v_qualBinSize) { int __pyx_v_i; char *__pyx_v_qual; char *__pyx_v_newQual; char *__pyx_v_finalQual; char __pyx_v_lastChar; int __pyx_v_lastCount; int __pyx_v_newQualIndex; __Pyx_RefNannyDeclarations char *__pyx_t_1; int __pyx_t_2; short __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("compressQual", 0); /* "samtoolsWrapper.pyx":1085 * Does exactly what it says on the tin. * """ * cdef int i = 0 # <<<<<<<<<<<<<< * cdef char* qual = read.qual * #cdef char* newQual = (malloc(sizeof(char)*2*read.rlen)) */ __pyx_v_i = 0; /* "samtoolsWrapper.pyx":1086 * """ * cdef int i = 0 * cdef char* qual = read.qual # <<<<<<<<<<<<<< * #cdef char* newQual = (malloc(sizeof(char)*2*read.rlen)) * cdef char* newQual = (alloca(sizeof(char)*2*read.rlen)) */ __pyx_t_1 = __pyx_v_read->qual; __pyx_v_qual = __pyx_t_1; /* "samtoolsWrapper.pyx":1088 * cdef char* qual = read.qual * #cdef char* newQual = (malloc(sizeof(char)*2*read.rlen)) * cdef char* newQual = (alloca(sizeof(char)*2*read.rlen)) # <<<<<<<<<<<<<< * cdef char* finalQual = NULL * cdef char lastChar = 0 */ __pyx_v_newQual = ((char *)alloca((((sizeof(char)) * 2) * __pyx_v_read->rlen))); /* "samtoolsWrapper.pyx":1089 * #cdef char* newQual = (malloc(sizeof(char)*2*read.rlen)) * cdef char* newQual = (alloca(sizeof(char)*2*read.rlen)) * cdef char* finalQual = NULL # <<<<<<<<<<<<<< * cdef char lastChar = 0 * cdef int lastCount = 0 */ __pyx_v_finalQual = NULL; /* "samtoolsWrapper.pyx":1090 * cdef char* newQual = (alloca(sizeof(char)*2*read.rlen)) * cdef char* finalQual = NULL * cdef char lastChar = 0 # <<<<<<<<<<<<<< * cdef int lastCount = 0 * cdef int newQualIndex = 0 */ __pyx_v_lastChar = 0; /* "samtoolsWrapper.pyx":1091 * cdef char* finalQual = NULL * cdef char lastChar = 0 * cdef int lastCount = 0 # <<<<<<<<<<<<<< * cdef int newQualIndex = 0 * */ __pyx_v_lastCount = 0; /* "samtoolsWrapper.pyx":1092 * cdef char lastChar = 0 * cdef int lastCount = 0 * cdef int newQualIndex = 0 # <<<<<<<<<<<<<< * * if qualBinSize > 1: */ __pyx_v_newQualIndex = 0; /* "samtoolsWrapper.pyx":1094 * cdef int newQualIndex = 0 * * if qualBinSize > 1: # <<<<<<<<<<<<<< * for i in range(read.rlen): * qual[i] = (qual[i]/qualBinSize)*qualBinSize */ __pyx_t_2 = (__pyx_v_qualBinSize > 1); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":1095 * * if qualBinSize > 1: * for i in range(read.rlen): # <<<<<<<<<<<<<< * qual[i] = (qual[i]/qualBinSize)*qualBinSize * */ __pyx_t_3 = __pyx_v_read->rlen; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; /* "samtoolsWrapper.pyx":1096 * if qualBinSize > 1: * for i in range(read.rlen): * qual[i] = (qual[i]/qualBinSize)*qualBinSize # <<<<<<<<<<<<<< * * for i in range(read.rlen): */ (__pyx_v_qual[__pyx_v_i]) = (((__pyx_v_qual[__pyx_v_i]) / __pyx_v_qualBinSize) * __pyx_v_qualBinSize); } goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":1098 * qual[i] = (qual[i]/qualBinSize)*qualBinSize * * for i in range(read.rlen): # <<<<<<<<<<<<<< * * assert qual[i] >= 0, "Shit 3. Qual = %s" %(qual[i]) */ __pyx_t_3 = __pyx_v_read->rlen; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; /* "samtoolsWrapper.pyx":1100 * for i in range(read.rlen): * * assert qual[i] >= 0, "Shit 3. Qual = %s" %(qual[i]) # <<<<<<<<<<<<<< * assert qual[i] <= 93, "Shit 4!. Qual = %s" %(qual[i]) * */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!((__pyx_v_qual[__pyx_v_i]) >= 0))) { __pyx_t_5 = PyInt_FromLong((__pyx_v_qual[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_51), __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_6)); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "samtoolsWrapper.pyx":1101 * * assert qual[i] >= 0, "Shit 3. Qual = %s" %(qual[i]) * assert qual[i] <= 93, "Shit 4!. Qual = %s" %(qual[i]) # <<<<<<<<<<<<<< * * if i == 0: */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!((__pyx_v_qual[__pyx_v_i]) <= 93))) { __pyx_t_6 = PyInt_FromLong((__pyx_v_qual[__pyx_v_i])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "samtoolsWrapper.pyx":1103 * assert qual[i] <= 93, "Shit 4!. Qual = %s" %(qual[i]) * * if i == 0: # <<<<<<<<<<<<<< * newQual[newQualIndex] = qual[i] + 33 * newQualIndex += 1 */ __pyx_t_2 = (__pyx_v_i == 0); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":1104 * * if i == 0: * newQual[newQualIndex] = qual[i] + 33 # <<<<<<<<<<<<<< * newQualIndex += 1 * lastChar = qual[i] */ (__pyx_v_newQual[__pyx_v_newQualIndex]) = ((__pyx_v_qual[__pyx_v_i]) + 33); /* "samtoolsWrapper.pyx":1105 * if i == 0: * newQual[newQualIndex] = qual[i] + 33 * newQualIndex += 1 # <<<<<<<<<<<<<< * lastChar = qual[i] * lastCount = 1 */ __pyx_v_newQualIndex = (__pyx_v_newQualIndex + 1); /* "samtoolsWrapper.pyx":1106 * newQual[newQualIndex] = qual[i] + 33 * newQualIndex += 1 * lastChar = qual[i] # <<<<<<<<<<<<<< * lastCount = 1 * else: */ __pyx_v_lastChar = (__pyx_v_qual[__pyx_v_i]); /* "samtoolsWrapper.pyx":1107 * newQualIndex += 1 * lastChar = qual[i] * lastCount = 1 # <<<<<<<<<<<<<< * else: * if qual[i] == lastChar: */ __pyx_v_lastCount = 1; goto __pyx_L8; } /*else*/ { /* "samtoolsWrapper.pyx":1109 * lastCount = 1 * else: * if qual[i] == lastChar: # <<<<<<<<<<<<<< * lastCount += 1 * else: */ __pyx_t_2 = ((__pyx_v_qual[__pyx_v_i]) == __pyx_v_lastChar); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":1110 * else: * if qual[i] == lastChar: * lastCount += 1 # <<<<<<<<<<<<<< * else: * newQual[newQualIndex] = lastCount */ __pyx_v_lastCount = (__pyx_v_lastCount + 1); goto __pyx_L9; } /*else*/ { /* "samtoolsWrapper.pyx":1112 * lastCount += 1 * else: * newQual[newQualIndex] = lastCount # <<<<<<<<<<<<<< * newQualIndex += 1 * newQual[newQualIndex] = qual[i] + 33 */ (__pyx_v_newQual[__pyx_v_newQualIndex]) = __pyx_v_lastCount; /* "samtoolsWrapper.pyx":1113 * else: * newQual[newQualIndex] = lastCount * newQualIndex += 1 # <<<<<<<<<<<<<< * newQual[newQualIndex] = qual[i] + 33 * newQualIndex += 1 */ __pyx_v_newQualIndex = (__pyx_v_newQualIndex + 1); /* "samtoolsWrapper.pyx":1114 * newQual[newQualIndex] = lastCount * newQualIndex += 1 * newQual[newQualIndex] = qual[i] + 33 # <<<<<<<<<<<<<< * newQualIndex += 1 * lastChar = qual[i] */ (__pyx_v_newQual[__pyx_v_newQualIndex]) = ((__pyx_v_qual[__pyx_v_i]) + 33); /* "samtoolsWrapper.pyx":1115 * newQualIndex += 1 * newQual[newQualIndex] = qual[i] + 33 * newQualIndex += 1 # <<<<<<<<<<<<<< * lastChar = qual[i] * lastCount = 1 */ __pyx_v_newQualIndex = (__pyx_v_newQualIndex + 1); /* "samtoolsWrapper.pyx":1116 * newQual[newQualIndex] = qual[i] + 33 * newQualIndex += 1 * lastChar = qual[i] # <<<<<<<<<<<<<< * lastCount = 1 * */ __pyx_v_lastChar = (__pyx_v_qual[__pyx_v_i]); /* "samtoolsWrapper.pyx":1117 * newQualIndex += 1 * lastChar = qual[i] * lastCount = 1 # <<<<<<<<<<<<<< * * if lastCount > 0: */ __pyx_v_lastCount = 1; } __pyx_L9:; } __pyx_L8:; } /* "samtoolsWrapper.pyx":1119 * lastCount = 1 * * if lastCount > 0: # <<<<<<<<<<<<<< * newQual[newQualIndex] = lastCount * newQualIndex += 1 */ __pyx_t_2 = (__pyx_v_lastCount > 0); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":1120 * * if lastCount > 0: * newQual[newQualIndex] = lastCount # <<<<<<<<<<<<<< * newQualIndex += 1 * */ (__pyx_v_newQual[__pyx_v_newQualIndex]) = __pyx_v_lastCount; /* "samtoolsWrapper.pyx":1121 * if lastCount > 0: * newQual[newQualIndex] = lastCount * newQualIndex += 1 # <<<<<<<<<<<<<< * * finalQual = malloc(sizeof(char)*(newQualIndex+1)) */ __pyx_v_newQualIndex = (__pyx_v_newQualIndex + 1); goto __pyx_L10; } __pyx_L10:; /* "samtoolsWrapper.pyx":1123 * newQualIndex += 1 * * finalQual = malloc(sizeof(char)*(newQualIndex+1)) # <<<<<<<<<<<<<< * newQual[newQualIndex] = 0 * strcpy(finalQual, newQual) */ __pyx_v_finalQual = ((char *)malloc(((sizeof(char)) * (__pyx_v_newQualIndex + 1)))); /* "samtoolsWrapper.pyx":1124 * * finalQual = malloc(sizeof(char)*(newQualIndex+1)) * newQual[newQualIndex] = 0 # <<<<<<<<<<<<<< * strcpy(finalQual, newQual) * finalQual[newQualIndex] = 0 */ (__pyx_v_newQual[__pyx_v_newQualIndex]) = 0; /* "samtoolsWrapper.pyx":1125 * finalQual = malloc(sizeof(char)*(newQualIndex+1)) * newQual[newQualIndex] = 0 * strcpy(finalQual, newQual) # <<<<<<<<<<<<<< * finalQual[newQualIndex] = 0 * #free(newQual) */ strcpy(__pyx_v_finalQual, __pyx_v_newQual); /* "samtoolsWrapper.pyx":1126 * newQual[newQualIndex] = 0 * strcpy(finalQual, newQual) * finalQual[newQualIndex] = 0 # <<<<<<<<<<<<<< * #free(newQual) * free(read.qual) */ (__pyx_v_finalQual[__pyx_v_newQualIndex]) = 0; /* "samtoolsWrapper.pyx":1128 * finalQual[newQualIndex] = 0 * #free(newQual) * free(read.qual) # <<<<<<<<<<<<<< * read.qual = finalQual * */ free(__pyx_v_read->qual); /* "samtoolsWrapper.pyx":1129 * #free(newQual) * free(read.qual) * read.qual = finalQual # <<<<<<<<<<<<<< * * ################################################################################################### */ __pyx_v_read->qual = __pyx_v_finalQual; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_WriteUnraisable("samtoolsWrapper.compressQual", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":1133 * ################################################################################################### * * cdef void uncompressSeq(cAlignedRead* read, char* refSeq): # <<<<<<<<<<<<<< * """ * Does exactly what it says on the tin. */ static void __pyx_f_15samtoolsWrapper_uncompressSeq(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_read, char *__pyx_v_refSeq) { int __pyx_v_refIndex; int __pyx_v_newSeqIndex; int __pyx_v_i; int __pyx_v_j; int __pyx_v_seqLen; char *__pyx_v_seq; char *__pyx_v_newSeq; __Pyx_RefNannyDeclarations char *__pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; char __pyx_t_5; int __pyx_t_6; __Pyx_RefNannySetupContext("uncompressSeq", 0); /* "samtoolsWrapper.pyx":1137 * Does exactly what it says on the tin. * """ * cdef int refIndex = 0 # <<<<<<<<<<<<<< * cdef int newSeqIndex = 0 * cdef int i = 0 */ __pyx_v_refIndex = 0; /* "samtoolsWrapper.pyx":1138 * """ * cdef int refIndex = 0 * cdef int newSeqIndex = 0 # <<<<<<<<<<<<<< * cdef int i = 0 * cdef int j = 0 */ __pyx_v_newSeqIndex = 0; /* "samtoolsWrapper.pyx":1139 * cdef int refIndex = 0 * cdef int newSeqIndex = 0 * cdef int i = 0 # <<<<<<<<<<<<<< * cdef int j = 0 * cdef int seqLen = strlen(read.seq) */ __pyx_v_i = 0; /* "samtoolsWrapper.pyx":1140 * cdef int newSeqIndex = 0 * cdef int i = 0 * cdef int j = 0 # <<<<<<<<<<<<<< * cdef int seqLen = strlen(read.seq) * cdef char* seq = read.seq */ __pyx_v_j = 0; /* "samtoolsWrapper.pyx":1141 * cdef int i = 0 * cdef int j = 0 * cdef int seqLen = strlen(read.seq) # <<<<<<<<<<<<<< * cdef char* seq = read.seq * cdef char* newSeq = (malloc(sizeof(char*)*(read.rlen+1))) */ __pyx_v_seqLen = strlen(__pyx_v_read->seq); /* "samtoolsWrapper.pyx":1142 * cdef int j = 0 * cdef int seqLen = strlen(read.seq) * cdef char* seq = read.seq # <<<<<<<<<<<<<< * cdef char* newSeq = (malloc(sizeof(char*)*(read.rlen+1))) * */ __pyx_t_1 = __pyx_v_read->seq; __pyx_v_seq = __pyx_t_1; /* "samtoolsWrapper.pyx":1143 * cdef int seqLen = strlen(read.seq) * cdef char* seq = read.seq * cdef char* newSeq = (malloc(sizeof(char*)*(read.rlen+1))) # <<<<<<<<<<<<<< * * for i in range(seqLen): */ __pyx_v_newSeq = ((char *)malloc(((sizeof(char *)) * (__pyx_v_read->rlen + 1)))); /* "samtoolsWrapper.pyx":1145 * cdef char* newSeq = (malloc(sizeof(char*)*(read.rlen+1))) * * for i in range(seqLen): # <<<<<<<<<<<<<< * if seq[i] <= 40: * for j in range(seq[i]): */ __pyx_t_2 = __pyx_v_seqLen; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; /* "samtoolsWrapper.pyx":1146 * * for i in range(seqLen): * if seq[i] <= 40: # <<<<<<<<<<<<<< * for j in range(seq[i]): * newSeq[newSeqIndex] = refSeq[j + refIndex] */ __pyx_t_4 = ((__pyx_v_seq[__pyx_v_i]) <= 40); if (__pyx_t_4) { /* "samtoolsWrapper.pyx":1147 * for i in range(seqLen): * if seq[i] <= 40: * for j in range(seq[i]): # <<<<<<<<<<<<<< * newSeq[newSeqIndex] = refSeq[j + refIndex] * newSeqIndex += 1 */ __pyx_t_5 = (__pyx_v_seq[__pyx_v_i]); for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_j = __pyx_t_6; /* "samtoolsWrapper.pyx":1148 * if seq[i] <= 40: * for j in range(seq[i]): * newSeq[newSeqIndex] = refSeq[j + refIndex] # <<<<<<<<<<<<<< * newSeqIndex += 1 * refIndex += seq[i] */ (__pyx_v_newSeq[__pyx_v_newSeqIndex]) = (__pyx_v_refSeq[(__pyx_v_j + __pyx_v_refIndex)]); /* "samtoolsWrapper.pyx":1149 * for j in range(seq[i]): * newSeq[newSeqIndex] = refSeq[j + refIndex] * newSeqIndex += 1 # <<<<<<<<<<<<<< * refIndex += seq[i] * else: */ __pyx_v_newSeqIndex = (__pyx_v_newSeqIndex + 1); } /* "samtoolsWrapper.pyx":1150 * newSeq[newSeqIndex] = refSeq[j + refIndex] * newSeqIndex += 1 * refIndex += seq[i] # <<<<<<<<<<<<<< * else: * newSeq[newSeqIndex] = seq[i] */ __pyx_v_refIndex = (__pyx_v_refIndex + (__pyx_v_seq[__pyx_v_i])); goto __pyx_L5; } /*else*/ { /* "samtoolsWrapper.pyx":1152 * refIndex += seq[i] * else: * newSeq[newSeqIndex] = seq[i] # <<<<<<<<<<<<<< * refIndex += 1 * newSeqIndex += 1 */ (__pyx_v_newSeq[__pyx_v_newSeqIndex]) = (__pyx_v_seq[__pyx_v_i]); /* "samtoolsWrapper.pyx":1153 * else: * newSeq[newSeqIndex] = seq[i] * refIndex += 1 # <<<<<<<<<<<<<< * newSeqIndex += 1 * */ __pyx_v_refIndex = (__pyx_v_refIndex + 1); /* "samtoolsWrapper.pyx":1154 * newSeq[newSeqIndex] = seq[i] * refIndex += 1 * newSeqIndex += 1 # <<<<<<<<<<<<<< * * free(read.seq) */ __pyx_v_newSeqIndex = (__pyx_v_newSeqIndex + 1); } __pyx_L5:; } /* "samtoolsWrapper.pyx":1156 * newSeqIndex += 1 * * free(read.seq) # <<<<<<<<<<<<<< * read.seq = newSeq * read.seq[read.rlen] = 0 */ free(__pyx_v_read->seq); /* "samtoolsWrapper.pyx":1157 * * free(read.seq) * read.seq = newSeq # <<<<<<<<<<<<<< * read.seq[read.rlen] = 0 * */ __pyx_v_read->seq = __pyx_v_newSeq; /* "samtoolsWrapper.pyx":1158 * free(read.seq) * read.seq = newSeq * read.seq[read.rlen] = 0 # <<<<<<<<<<<<<< * * ################################################################################################### */ (__pyx_v_read->seq[__pyx_v_read->rlen]) = 0; __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":1162 * ################################################################################################### * * cdef void uncompressQual(cAlignedRead* read): # <<<<<<<<<<<<<< * """ * Does exactly what it says on the tin. */ static void __pyx_f_15samtoolsWrapper_uncompressQual(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_read) { char *__pyx_v_newQual; char *__pyx_v_qual; int __pyx_v_lenQual; int __pyx_v_i; CYTHON_UNUSED int __pyx_v_j; int __pyx_v_newQualIndex; __Pyx_RefNannyDeclarations char *__pyx_t_1; long __pyx_t_2; int __pyx_t_3; char __pyx_t_4; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("uncompressQual", 0); /* "samtoolsWrapper.pyx":1166 * Does exactly what it says on the tin. * """ * cdef char* newQual = (malloc(sizeof(char)*(read.rlen+1))) # <<<<<<<<<<<<<< * cdef char* qual = read.qual * */ __pyx_v_newQual = ((char *)malloc(((sizeof(char)) * (__pyx_v_read->rlen + 1)))); /* "samtoolsWrapper.pyx":1167 * """ * cdef char* newQual = (malloc(sizeof(char)*(read.rlen+1))) * cdef char* qual = read.qual # <<<<<<<<<<<<<< * * cdef int lenQual = strlen(read.qual) */ __pyx_t_1 = __pyx_v_read->qual; __pyx_v_qual = __pyx_t_1; /* "samtoolsWrapper.pyx":1169 * cdef char* qual = read.qual * * cdef int lenQual = strlen(read.qual) # <<<<<<<<<<<<<< * cdef int i = 0 * cdef int j = 0 */ __pyx_v_lenQual = strlen(__pyx_v_read->qual); /* "samtoolsWrapper.pyx":1170 * * cdef int lenQual = strlen(read.qual) * cdef int i = 0 # <<<<<<<<<<<<<< * cdef int j = 0 * cdef int newQualIndex = 0 */ __pyx_v_i = 0; /* "samtoolsWrapper.pyx":1171 * cdef int lenQual = strlen(read.qual) * cdef int i = 0 * cdef int j = 0 # <<<<<<<<<<<<<< * cdef int newQualIndex = 0 * */ __pyx_v_j = 0; /* "samtoolsWrapper.pyx":1172 * cdef int i = 0 * cdef int j = 0 * cdef int newQualIndex = 0 # <<<<<<<<<<<<<< * * #logger.info("Length = %s or %s" %(lenQual, len([x for x in qual]))) */ __pyx_v_newQualIndex = 0; /* "samtoolsWrapper.pyx":1177 * #logger.info(",".join( [str(x) for x in qual] ) ) * * for i in range(0, lenQual-1, 2): # <<<<<<<<<<<<<< * for j in range(qual[i+1]): * newQual[newQualIndex] = qual[i] - 33 */ __pyx_t_2 = (__pyx_v_lenQual - 1); for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=2) { __pyx_v_i = __pyx_t_3; /* "samtoolsWrapper.pyx":1178 * * for i in range(0, lenQual-1, 2): * for j in range(qual[i+1]): # <<<<<<<<<<<<<< * newQual[newQualIndex] = qual[i] - 33 * assert qual[i] - 33 >= 0, "Shit 1. Qual = %s. Count = %s!" %(qual[i], qual[i+1]) */ __pyx_t_4 = (__pyx_v_qual[(__pyx_v_i + 1)]); for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_j = __pyx_t_5; /* "samtoolsWrapper.pyx":1179 * for i in range(0, lenQual-1, 2): * for j in range(qual[i+1]): * newQual[newQualIndex] = qual[i] - 33 # <<<<<<<<<<<<<< * assert qual[i] - 33 >= 0, "Shit 1. Qual = %s. Count = %s!" %(qual[i], qual[i+1]) * assert qual[i] - 33 <= 93, "Shit 2!. Qual = %s. Count = %s" %(qual[i], qual[i+1]) */ (__pyx_v_newQual[__pyx_v_newQualIndex]) = ((__pyx_v_qual[__pyx_v_i]) - 33); /* "samtoolsWrapper.pyx":1180 * for j in range(qual[i+1]): * newQual[newQualIndex] = qual[i] - 33 * assert qual[i] - 33 >= 0, "Shit 1. Qual = %s. Count = %s!" %(qual[i], qual[i+1]) # <<<<<<<<<<<<<< * assert qual[i] - 33 <= 93, "Shit 2!. Qual = %s. Count = %s" %(qual[i], qual[i+1]) * newQualIndex += 1 */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!(((__pyx_v_qual[__pyx_v_i]) - 33) >= 0))) { __pyx_t_6 = PyInt_FromLong((__pyx_v_qual[__pyx_v_i])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PyInt_FromLong((__pyx_v_qual[(__pyx_v_i + 1)])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_7)); __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "samtoolsWrapper.pyx":1181 * newQual[newQualIndex] = qual[i] - 33 * assert qual[i] - 33 >= 0, "Shit 1. Qual = %s. Count = %s!" %(qual[i], qual[i+1]) * assert qual[i] - 33 <= 93, "Shit 2!. Qual = %s. Count = %s" %(qual[i], qual[i+1]) # <<<<<<<<<<<<<< * newQualIndex += 1 * */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!(((__pyx_v_qual[__pyx_v_i]) - 33) <= 93))) { __pyx_t_7 = PyInt_FromLong((__pyx_v_qual[__pyx_v_i])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyInt_FromLong((__pyx_v_qual[(__pyx_v_i + 1)])); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_8)); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "samtoolsWrapper.pyx":1182 * assert qual[i] - 33 >= 0, "Shit 1. Qual = %s. Count = %s!" %(qual[i], qual[i+1]) * assert qual[i] - 33 <= 93, "Shit 2!. Qual = %s. Count = %s" %(qual[i], qual[i+1]) * newQualIndex += 1 # <<<<<<<<<<<<<< * * assert read.rlen == newQualIndex */ __pyx_v_newQualIndex = (__pyx_v_newQualIndex + 1); } } /* "samtoolsWrapper.pyx":1184 * newQualIndex += 1 * * assert read.rlen == newQualIndex # <<<<<<<<<<<<<< * * free(read.qual) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!(__pyx_v_read->rlen == __pyx_v_newQualIndex))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "samtoolsWrapper.pyx":1186 * assert read.rlen == newQualIndex * * free(read.qual) # <<<<<<<<<<<<<< * read.qual = newQual * read.qual[read.rlen] = 0 */ free(__pyx_v_read->qual); /* "samtoolsWrapper.pyx":1187 * * free(read.qual) * read.qual = newQual # <<<<<<<<<<<<<< * read.qual[read.rlen] = 0 * */ __pyx_v_read->qual = __pyx_v_newQual; /* "samtoolsWrapper.pyx":1188 * free(read.qual) * read.qual = newQual * read.qual[read.rlen] = 0 # <<<<<<<<<<<<<< * * ################################################################################################### */ (__pyx_v_read->qual[__pyx_v_read->rlen]) = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_WriteUnraisable("samtoolsWrapper.uncompressQual", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":1192 * ################################################################################################### * * cdef void compressRead(cAlignedRead* read, char* refSeq, int refStart, int refEnd, int qualBinSize, int fullComp): # <<<<<<<<<<<<<< * """ * To save memory use, we compress reads. The sequence is compressed using reference-based */ static void __pyx_f_15samtoolsWrapper_compressRead(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_read, char *__pyx_v_refSeq, int __pyx_v_refStart, CYTHON_UNUSED int __pyx_v_refEnd, int __pyx_v_qualBinSize, CYTHON_UNUSED int __pyx_v_fullComp) { __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; __Pyx_RefNannySetupContext("compressRead", 0); /* "samtoolsWrapper.pyx":1199 * for candidate generation). A bit is set in the bit-field to label the read as compressed or uncompressed. * """ * if Read_IsCompressed(read): # <<<<<<<<<<<<<< * return * */ __pyx_t_1 = __pyx_f_15samtoolsWrapper_Read_IsCompressed(__pyx_v_read); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":1200 * """ * if Read_IsCompressed(read): * return # <<<<<<<<<<<<<< * * if read.seq != NULL: */ goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":1202 * return * * if read.seq != NULL: # <<<<<<<<<<<<<< * compressSeq(read, refSeq + (read.pos - refStart)) * */ __pyx_t_2 = (__pyx_v_read->seq != NULL); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":1203 * * if read.seq != NULL: * compressSeq(read, refSeq + (read.pos - refStart)) # <<<<<<<<<<<<<< * * if read.qual != NULL: */ __pyx_f_15samtoolsWrapper_compressSeq(__pyx_v_read, (__pyx_v_refSeq + (__pyx_v_read->pos - __pyx_v_refStart))); goto __pyx_L4; } __pyx_L4:; /* "samtoolsWrapper.pyx":1205 * compressSeq(read, refSeq + (read.pos - refStart)) * * if read.qual != NULL: # <<<<<<<<<<<<<< * compressQual(read, qualBinSize) * */ __pyx_t_2 = (__pyx_v_read->qual != NULL); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":1206 * * if read.qual != NULL: * compressQual(read, qualBinSize) # <<<<<<<<<<<<<< * * #if fullComp == 1 and read.cigarOps != NULL: */ __pyx_f_15samtoolsWrapper_compressQual(__pyx_v_read, __pyx_v_qualBinSize); goto __pyx_L5; } __pyx_L5:; /* "samtoolsWrapper.pyx":1212 * # read.cigarOps = NULL * * if read.hash != NULL: # <<<<<<<<<<<<<< * free(read.hash) * read.hash = NULL */ __pyx_t_2 = (__pyx_v_read->hash != NULL); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":1213 * * if read.hash != NULL: * free(read.hash) # <<<<<<<<<<<<<< * read.hash = NULL * */ free(__pyx_v_read->hash); /* "samtoolsWrapper.pyx":1214 * if read.hash != NULL: * free(read.hash) * read.hash = NULL # <<<<<<<<<<<<<< * * Read_SetCompressed(read) */ __pyx_v_read->hash = NULL; goto __pyx_L6; } __pyx_L6:; /* "samtoolsWrapper.pyx":1216 * read.hash = NULL * * Read_SetCompressed(read) # <<<<<<<<<<<<<< * * ################################################################################################### */ __pyx_f_15samtoolsWrapper_Read_SetCompressed(__pyx_v_read); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":1220 * ################################################################################################### * * cdef void uncompressRead(cAlignedRead* read, char* refSeq, int refStart, int refEnd, int qualBinSize): # <<<<<<<<<<<<<< * """ * Un-compress the read. */ static void __pyx_f_15samtoolsWrapper_uncompressRead(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_read, char *__pyx_v_refSeq, int __pyx_v_refStart, CYTHON_UNUSED int __pyx_v_refEnd, CYTHON_UNUSED int __pyx_v_qualBinSize) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("uncompressRead", 0); /* "samtoolsWrapper.pyx":1224 * Un-compress the read. * """ * if not Read_IsCompressed(read): # <<<<<<<<<<<<<< * return * */ __pyx_t_1 = (!__pyx_f_15samtoolsWrapper_Read_IsCompressed(__pyx_v_read)); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":1225 * """ * if not Read_IsCompressed(read): * return # <<<<<<<<<<<<<< * * if read.seq != NULL: */ goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":1227 * return * * if read.seq != NULL: # <<<<<<<<<<<<<< * uncompressSeq(read, refSeq + (read.pos - refStart)) * */ __pyx_t_1 = (__pyx_v_read->seq != NULL); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":1228 * * if read.seq != NULL: * uncompressSeq(read, refSeq + (read.pos - refStart)) # <<<<<<<<<<<<<< * * if read.qual != NULL: */ __pyx_f_15samtoolsWrapper_uncompressSeq(__pyx_v_read, (__pyx_v_refSeq + (__pyx_v_read->pos - __pyx_v_refStart))); goto __pyx_L4; } __pyx_L4:; /* "samtoolsWrapper.pyx":1230 * uncompressSeq(read, refSeq + (read.pos - refStart)) * * if read.qual != NULL: # <<<<<<<<<<<<<< * uncompressQual(read) * */ __pyx_t_1 = (__pyx_v_read->qual != NULL); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":1231 * * if read.qual != NULL: * uncompressQual(read) # <<<<<<<<<<<<<< * * Read_SetUnCompressed(read) */ __pyx_f_15samtoolsWrapper_uncompressQual(__pyx_v_read); goto __pyx_L5; } __pyx_L5:; /* "samtoolsWrapper.pyx":1233 * uncompressQual(read) * * Read_SetUnCompressed(read) # <<<<<<<<<<<<<< * * ################################################################################################### */ __pyx_f_15samtoolsWrapper_Read_SetUnCompressed(__pyx_v_read); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ static int __pyx_pw_15samtoolsWrapper_11AlignedRead_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_15samtoolsWrapper_11AlignedRead_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; __pyx_r = __pyx_pf_15samtoolsWrapper_11AlignedRead___cinit__(((struct __pyx_obj_15samtoolsWrapper_AlignedRead *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1259 * also erase any quality scores that were set previously. * ''' * def __cinit__(self): # <<<<<<<<<<<<<< * self.hashValue = -1 * self.readEnd = -1 */ static int __pyx_pf_15samtoolsWrapper_11AlignedRead___cinit__(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); /* "samtoolsWrapper.pyx":1260 * ''' * def __cinit__(self): * self.hashValue = -1 # <<<<<<<<<<<<<< * self.readEnd = -1 * */ __pyx_v_self->hashValue = -1; /* "samtoolsWrapper.pyx":1261 * def __cinit__(self): * self.hashValue = -1 * self.readEnd = -1 # <<<<<<<<<<<<<< * * def __dealloc__(self): */ __pyx_v_self->readEnd = -1; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static void __pyx_pw_15samtoolsWrapper_11AlignedRead_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_15samtoolsWrapper_11AlignedRead_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_15samtoolsWrapper_11AlignedRead_2__dealloc__(((struct __pyx_obj_15samtoolsWrapper_AlignedRead *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pyx":1263 * self.readEnd = -1 * * def __dealloc__(self): # <<<<<<<<<<<<<< * ''' * clear up memory. */ static void __pyx_pf_15samtoolsWrapper_11AlignedRead_2__dealloc__(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); /* "samtoolsWrapper.pyx":1267 * clear up memory. * ''' * if self._delegate: # <<<<<<<<<<<<<< * pysam_bam_destroy1(self._delegate) * */ __pyx_t_1 = (__pyx_v_self->_delegate != 0); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":1268 * ''' * if self._delegate: * pysam_bam_destroy1(self._delegate) # <<<<<<<<<<<<<< * * if self._seq: */ pysam_bam_destroy1(__pyx_v_self->_delegate); goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":1270 * pysam_bam_destroy1(self._delegate) * * if self._seq: # <<<<<<<<<<<<<< * free(self._seq) * */ __pyx_t_1 = (__pyx_v_self->_seq != 0); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":1271 * * if self._seq: * free(self._seq) # <<<<<<<<<<<<<< * * if self._qual: */ free(__pyx_v_self->_seq); goto __pyx_L4; } __pyx_L4:; /* "samtoolsWrapper.pyx":1273 * free(self._seq) * * if self._qual: # <<<<<<<<<<<<<< * free(self._qual) * */ __pyx_t_1 = (__pyx_v_self->_qual != 0); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":1274 * * if self._qual: * free(self._qual) # <<<<<<<<<<<<<< * * def __str__(self): */ free(__pyx_v_self->_qual); goto __pyx_L5; } __pyx_L5:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_11AlignedRead_5__str__(PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_15samtoolsWrapper_11AlignedRead_4__str__[] = "todo"; #if CYTHON_COMPILING_IN_CPYTHON struct wrapperbase __pyx_wrapperbase_15samtoolsWrapper_11AlignedRead_4__str__; #endif static PyObject *__pyx_pw_15samtoolsWrapper_11AlignedRead_5__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_r = __pyx_pf_15samtoolsWrapper_11AlignedRead_4__str__(((struct __pyx_obj_15samtoolsWrapper_AlignedRead *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1276 * free(self._qual) * * def __str__(self): # <<<<<<<<<<<<<< * """todo""" * return "\t".join(map(str, (self.qname(), */ static PyObject *__pyx_pf_15samtoolsWrapper_11AlignedRead_4__str__(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); /* "samtoolsWrapper.pyx":1278 * def __str__(self): * """todo""" * return "\t".join(map(str, (self.qname(), # <<<<<<<<<<<<<< * self.rname(), * self.pos(), */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_32), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = ((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->qname(__pyx_v_self, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); /* "samtoolsWrapper.pyx":1279 * """todo""" * return "\t".join(map(str, (self.qname(), * self.rname(), # <<<<<<<<<<<<<< * self.pos(), * self.cigar(), */ __pyx_t_3 = PyInt_FromLong(((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->rname(__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); /* "samtoolsWrapper.pyx":1280 * return "\t".join(map(str, (self.qname(), * self.rname(), * self.pos(), # <<<<<<<<<<<<<< * self.cigar(), * self.seq(), */ __pyx_t_4 = PyInt_FromLong(((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->pos(__pyx_v_self)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); /* "samtoolsWrapper.pyx":1281 * self.rname(), * self.pos(), * self.cigar(), # <<<<<<<<<<<<<< * self.seq(), * self.qual(), */ __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__cigar); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "samtoolsWrapper.pyx":1282 * self.pos(), * self.cigar(), * self.seq(), # <<<<<<<<<<<<<< * self.qual(), * self.mapq()))) */ __pyx_t_5 = PyBytes_FromString(((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->seq(__pyx_v_self)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); /* "samtoolsWrapper.pyx":1283 * self.cigar(), * self.seq(), * self.qual(), # <<<<<<<<<<<<<< * self.mapq()))) * */ __pyx_t_7 = PyBytes_FromString(((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->qual(__pyx_v_self)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); /* "samtoolsWrapper.pyx":1284 * self.seq(), * self.qual(), * self.mapq()))) # <<<<<<<<<<<<<< * * def __richcmp__(AlignedRead self, AlignedRead other, int opCode): */ __pyx_t_8 = PyInt_FromLong(((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->mapq(__pyx_v_self, 0)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = PyTuple_New(7); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 4, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); PyTuple_SET_ITEM(__pyx_t_9, 5, ((PyObject *)__pyx_t_7)); __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); PyTuple_SET_ITEM(__pyx_t_9, 6, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)((PyObject*)(&PyString_Type)))); __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_t_9)); __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; __pyx_t_9 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_r = __pyx_t_9; __pyx_t_9 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("samtoolsWrapper.AlignedRead.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_11AlignedRead_7__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_opCode); /*proto*/ static PyObject *__pyx_pw_15samtoolsWrapper_11AlignedRead_7__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_opCode) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_self), __pyx_ptype_15samtoolsWrapper_AlignedRead, 1, "self", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_15samtoolsWrapper_AlignedRead, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_15samtoolsWrapper_11AlignedRead_6__richcmp__(((struct __pyx_obj_15samtoolsWrapper_AlignedRead *)__pyx_v_self), ((struct __pyx_obj_15samtoolsWrapper_AlignedRead *)__pyx_v_other), ((int)__pyx_v_opCode)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1286 * self.mapq()))) * * def __richcmp__(AlignedRead self, AlignedRead other, int opCode): # <<<<<<<<<<<<<< * """ * Cython's rich comparison method. All comparison operators (<, >, <=, >=, ==) are */ static PyObject *__pyx_pf_15samtoolsWrapper_11AlignedRead_6__richcmp__(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self, struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_other, int __pyx_v_opCode) { int __pyx_v_thisChr; int __pyx_v_otherChr; int __pyx_v_thisPos; int __pyx_v_otherPos; int __pyx_v_thisLen; int __pyx_v_otherLen; char *__pyx_v_thisSeq; char *__pyx_v_otherSeq; char *__pyx_v_thisQual; char *__pyx_v_otherQual; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); /* "samtoolsWrapper.pyx":1291 * defined in this function. * """ * cdef int thisChr = self.rname() # <<<<<<<<<<<<<< * cdef int otherChr = other.rname() * cdef int thisPos = self.pos() */ __pyx_v_thisChr = ((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->rname(__pyx_v_self); /* "samtoolsWrapper.pyx":1292 * """ * cdef int thisChr = self.rname() * cdef int otherChr = other.rname() # <<<<<<<<<<<<<< * cdef int thisPos = self.pos() * cdef int otherPos = other.pos() */ __pyx_v_otherChr = ((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_other->__pyx_vtab)->rname(__pyx_v_other); /* "samtoolsWrapper.pyx":1293 * cdef int thisChr = self.rname() * cdef int otherChr = other.rname() * cdef int thisPos = self.pos() # <<<<<<<<<<<<<< * cdef int otherPos = other.pos() * cdef int thisLen = self.rlen() */ __pyx_v_thisPos = ((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->pos(__pyx_v_self); /* "samtoolsWrapper.pyx":1294 * cdef int otherChr = other.rname() * cdef int thisPos = self.pos() * cdef int otherPos = other.pos() # <<<<<<<<<<<<<< * cdef int thisLen = self.rlen() * cdef int otherLen = other.rlen() */ __pyx_v_otherPos = ((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_other->__pyx_vtab)->pos(__pyx_v_other); /* "samtoolsWrapper.pyx":1295 * cdef int thisPos = self.pos() * cdef int otherPos = other.pos() * cdef int thisLen = self.rlen() # <<<<<<<<<<<<<< * cdef int otherLen = other.rlen() * cdef char* thisSeq = self.seq() */ __pyx_v_thisLen = ((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->rlen(__pyx_v_self); /* "samtoolsWrapper.pyx":1296 * cdef int otherPos = other.pos() * cdef int thisLen = self.rlen() * cdef int otherLen = other.rlen() # <<<<<<<<<<<<<< * cdef char* thisSeq = self.seq() * cdef char* otherSeq = other.seq() */ __pyx_v_otherLen = ((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_other->__pyx_vtab)->rlen(__pyx_v_other); /* "samtoolsWrapper.pyx":1297 * cdef int thisLen = self.rlen() * cdef int otherLen = other.rlen() * cdef char* thisSeq = self.seq() # <<<<<<<<<<<<<< * cdef char* otherSeq = other.seq() * cdef char* thisQual = self.qual() */ __pyx_v_thisSeq = ((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->seq(__pyx_v_self); /* "samtoolsWrapper.pyx":1298 * cdef int otherLen = other.rlen() * cdef char* thisSeq = self.seq() * cdef char* otherSeq = other.seq() # <<<<<<<<<<<<<< * cdef char* thisQual = self.qual() * cdef char* otherQual = other.qual() */ __pyx_v_otherSeq = ((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_other->__pyx_vtab)->seq(__pyx_v_other); /* "samtoolsWrapper.pyx":1299 * cdef char* thisSeq = self.seq() * cdef char* otherSeq = other.seq() * cdef char* thisQual = self.qual() # <<<<<<<<<<<<<< * cdef char* otherQual = other.qual() * */ __pyx_v_thisQual = ((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->qual(__pyx_v_self); /* "samtoolsWrapper.pyx":1300 * cdef char* otherSeq = other.seq() * cdef char* thisQual = self.qual() * cdef char* otherQual = other.qual() # <<<<<<<<<<<<<< * * # == */ __pyx_v_otherQual = ((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_other->__pyx_vtab)->qual(__pyx_v_other); /* "samtoolsWrapper.pyx":1306 * return thisChr == otherChr and thisPos == otherPos and thisLen == otherLen and thisSeq == otherSeq and thisQual == otherQual * # < * elif opCode == 0: # <<<<<<<<<<<<<< * if thisChr < otherChr: * return True */ switch (__pyx_v_opCode) { /* "samtoolsWrapper.pyx":1303 * * # == * if opCode == 2: # <<<<<<<<<<<<<< * return thisChr == otherChr and thisPos == otherPos and thisLen == otherLen and thisSeq == otherSeq and thisQual == otherQual * # < */ case 2: /* "samtoolsWrapper.pyx":1304 * # == * if opCode == 2: * return thisChr == otherChr and thisPos == otherPos and thisLen == otherLen and thisSeq == otherSeq and thisQual == otherQual # <<<<<<<<<<<<<< * # < * elif opCode == 0: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = (__pyx_v_thisChr == __pyx_v_otherChr); if (__pyx_t_1) { __pyx_t_2 = (__pyx_v_thisPos == __pyx_v_otherPos); if (__pyx_t_2) { __pyx_t_3 = (__pyx_v_thisLen == __pyx_v_otherLen); if (__pyx_t_3) { __pyx_t_4 = (__pyx_v_thisSeq == __pyx_v_otherSeq); if (__pyx_t_4) { __pyx_t_5 = (__pyx_v_thisQual == __pyx_v_otherQual); __pyx_t_6 = __pyx_t_5; } else { __pyx_t_6 = __pyx_t_4; } __pyx_t_4 = __pyx_t_6; } else { __pyx_t_4 = __pyx_t_3; } __pyx_t_3 = __pyx_t_4; } else { __pyx_t_3 = __pyx_t_2; } __pyx_t_2 = __pyx_t_3; } else { __pyx_t_2 = __pyx_t_1; } __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_r = __pyx_t_7; __pyx_t_7 = 0; goto __pyx_L0; break; /* "samtoolsWrapper.pyx":1306 * return thisChr == otherChr and thisPos == otherPos and thisLen == otherLen and thisSeq == otherSeq and thisQual == otherQual * # < * elif opCode == 0: # <<<<<<<<<<<<<< * if thisChr < otherChr: * return True */ case 0: /* "samtoolsWrapper.pyx":1307 * # < * elif opCode == 0: * if thisChr < otherChr: # <<<<<<<<<<<<<< * return True * elif thisChr == otherChr and thisPos < otherPos: */ __pyx_t_2 = (__pyx_v_thisChr < __pyx_v_otherChr); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":1308 * elif opCode == 0: * if thisChr < otherChr: * return True # <<<<<<<<<<<<<< * elif thisChr == otherChr and thisPos < otherPos: * return True */ __Pyx_XDECREF(__pyx_r); __pyx_t_7 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_r = __pyx_t_7; __pyx_t_7 = 0; goto __pyx_L0; goto __pyx_L3; } /* "samtoolsWrapper.pyx":1309 * if thisChr < otherChr: * return True * elif thisChr == otherChr and thisPos < otherPos: # <<<<<<<<<<<<<< * return True * elif thisChr == otherChr and thisPos == otherPos and thisLen < otherLen: */ __pyx_t_2 = (__pyx_v_thisChr == __pyx_v_otherChr); if (__pyx_t_2) { __pyx_t_1 = (__pyx_v_thisPos < __pyx_v_otherPos); __pyx_t_3 = __pyx_t_1; } else { __pyx_t_3 = __pyx_t_2; } if (__pyx_t_3) { /* "samtoolsWrapper.pyx":1310 * return True * elif thisChr == otherChr and thisPos < otherPos: * return True # <<<<<<<<<<<<<< * elif thisChr == otherChr and thisPos == otherPos and thisLen < otherLen: * return True */ __Pyx_XDECREF(__pyx_r); __pyx_t_7 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_r = __pyx_t_7; __pyx_t_7 = 0; goto __pyx_L0; goto __pyx_L3; } /* "samtoolsWrapper.pyx":1311 * elif thisChr == otherChr and thisPos < otherPos: * return True * elif thisChr == otherChr and thisPos == otherPos and thisLen < otherLen: # <<<<<<<<<<<<<< * return True * else: */ __pyx_t_3 = (__pyx_v_thisChr == __pyx_v_otherChr); if (__pyx_t_3) { __pyx_t_2 = (__pyx_v_thisPos == __pyx_v_otherPos); if (__pyx_t_2) { __pyx_t_1 = (__pyx_v_thisLen < __pyx_v_otherLen); __pyx_t_4 = __pyx_t_1; } else { __pyx_t_4 = __pyx_t_2; } __pyx_t_2 = __pyx_t_4; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { /* "samtoolsWrapper.pyx":1312 * return True * elif thisChr == otherChr and thisPos == otherPos and thisLen < otherLen: * return True # <<<<<<<<<<<<<< * else: * return False */ __Pyx_XDECREF(__pyx_r); __pyx_t_7 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_r = __pyx_t_7; __pyx_t_7 = 0; goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "samtoolsWrapper.pyx":1314 * return True * else: * return False # <<<<<<<<<<<<<< * else: * raise StandardError, "Argh. cmp code = %s" %(opCode) */ __Pyx_XDECREF(__pyx_r); __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_r = __pyx_t_7; __pyx_t_7 = 0; goto __pyx_L0; } __pyx_L3:; break; default: /* "samtoolsWrapper.pyx":1316 * return False * else: * raise StandardError, "Argh. cmp code = %s" %(opCode) # <<<<<<<<<<<<<< * * def __hash__(self): */ __pyx_t_7 = PyInt_FromLong(__pyx_v_opCode); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_55), __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_Raise(__pyx_builtin_StandardError, ((PyObject *)__pyx_t_8), 0, 0); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("samtoolsWrapper.AlignedRead.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static Py_hash_t __pyx_pw_15samtoolsWrapper_11AlignedRead_9__hash__(PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_15samtoolsWrapper_11AlignedRead_8__hash__[] = "\n Hash method for bam-file read object.\n "; #if CYTHON_COMPILING_IN_CPYTHON struct wrapperbase __pyx_wrapperbase_15samtoolsWrapper_11AlignedRead_8__hash__; #endif static Py_hash_t __pyx_pw_15samtoolsWrapper_11AlignedRead_9__hash__(PyObject *__pyx_v_self) { Py_hash_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0); __pyx_r = __pyx_pf_15samtoolsWrapper_11AlignedRead_8__hash__(((struct __pyx_obj_15samtoolsWrapper_AlignedRead *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1318 * raise StandardError, "Argh. cmp code = %s" %(opCode) * * def __hash__(self): # <<<<<<<<<<<<<< * """ * Hash method for bam-file read object. */ static Py_hash_t __pyx_pf_15samtoolsWrapper_11AlignedRead_8__hash__(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { Py_hash_t __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; Py_hash_t __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__hash__", 0); /* "samtoolsWrapper.pyx":1322 * Hash method for bam-file read object. * """ * if self.hashValue == -1: # <<<<<<<<<<<<<< * self.hashValue = hash("%s_%s_%s_%s_%s_%s" %(self.pos(),self.mapq(),str(self.fastQName()),self.is_read1(),str(self.qual()),str(self.seq()))) * */ __pyx_t_1 = (__pyx_v_self->hashValue == -1); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":1323 * """ * if self.hashValue == -1: * self.hashValue = hash("%s_%s_%s_%s_%s_%s" %(self.pos(),self.mapq(),str(self.fastQName()),self.is_read1(),str(self.qual()),str(self.seq()))) # <<<<<<<<<<<<<< * * return self.hashValue */ __pyx_t_2 = PyInt_FromLong(((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->pos(__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyInt_FromLong(((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->mapq(__pyx_v_self, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyBytes_FromString(((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->fastQName(__pyx_v_self)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyInt_FromLong(((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->is_read1(__pyx_v_self)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyBytes_FromString(((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->qual(__pyx_v_self)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6)); __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __pyx_t_7 = PyBytes_FromString(((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->seq(__pyx_v_self)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7)); __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_56), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_9 = PyObject_Hash(((PyObject *)__pyx_t_7)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __pyx_v_self->hashValue = __pyx_t_9; goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":1325 * self.hashValue = hash("%s_%s_%s_%s_%s_%s" %(self.pos(),self.mapq(),str(self.fastQName()),self.is_read1(),str(self.qual()),str(self.seq()))) * * return self.hashValue # <<<<<<<<<<<<<< * * cpdef object qname(AlignedRead self): */ __pyx_r = __pyx_v_self->hashValue; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("samtoolsWrapper.AlignedRead.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1327 * return self.hashValue * * cpdef object qname(AlignedRead self): # <<<<<<<<<<<<<< * """ * the query name (None if not present) */ static PyObject *__pyx_pw_15samtoolsWrapper_11AlignedRead_11qname(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_15samtoolsWrapper_11AlignedRead_qname(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self, int __pyx_skip_dispatch) { bam1_t *__pyx_v_src; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; bam1_t *__pyx_t_3; int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("qname", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__qname); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_15samtoolsWrapper_11AlignedRead_11qname)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "samtoolsWrapper.pyx":1331 * the query name (None if not present) * """ * cdef bam1_t* src = self._delegate # <<<<<<<<<<<<<< * * if src.core.l_qname == 0: */ __pyx_t_3 = __pyx_v_self->_delegate; __pyx_v_src = __pyx_t_3; /* "samtoolsWrapper.pyx":1333 * cdef bam1_t* src = self._delegate * * if src.core.l_qname == 0: # <<<<<<<<<<<<<< * return None * */ __pyx_t_4 = (__pyx_v_src->core.l_qname == 0); if (__pyx_t_4) { /* "samtoolsWrapper.pyx":1334 * * if src.core.l_qname == 0: * return None # <<<<<<<<<<<<<< * * return pysam_bam1_qname(src) */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":1336 * return None * * return pysam_bam1_qname(src) # <<<<<<<<<<<<<< * * cdef char* fastQName(AlignedRead self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyBytes_FromString(pysam_bam1_qname(__pyx_v_src)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("samtoolsWrapper.AlignedRead.qname", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_11AlignedRead_11qname(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_15samtoolsWrapper_11AlignedRead_10qname[] = "\n the query name (None if not present)\n "; static PyObject *__pyx_pw_15samtoolsWrapper_11AlignedRead_11qname(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("qname (wrapper)", 0); __pyx_r = __pyx_pf_15samtoolsWrapper_11AlignedRead_10qname(((struct __pyx_obj_15samtoolsWrapper_AlignedRead *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1327 * return self.hashValue * * cpdef object qname(AlignedRead self): # <<<<<<<<<<<<<< * """ * the query name (None if not present) */ static PyObject *__pyx_pf_15samtoolsWrapper_11AlignedRead_10qname(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("qname", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->qname(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("samtoolsWrapper.AlignedRead.qname", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1338 * return pysam_bam1_qname(src) * * cdef char* fastQName(AlignedRead self): # <<<<<<<<<<<<<< * """ * the query name (None if not present) */ static char *__pyx_f_15samtoolsWrapper_11AlignedRead_fastQName(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { bam1_t *__pyx_v_src; char *__pyx_r; __Pyx_RefNannyDeclarations bam1_t *__pyx_t_1; int __pyx_t_2; char *__pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fastQName", 0); /* "samtoolsWrapper.pyx":1342 * the query name (None if not present) * """ * cdef bam1_t* src = self._delegate # <<<<<<<<<<<<<< * * if src.core.l_qname == 0: */ __pyx_t_1 = __pyx_v_self->_delegate; __pyx_v_src = __pyx_t_1; /* "samtoolsWrapper.pyx":1344 * cdef bam1_t* src = self._delegate * * if src.core.l_qname == 0: # <<<<<<<<<<<<<< * return None * */ __pyx_t_2 = (__pyx_v_src->core.l_qname == 0); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":1345 * * if src.core.l_qname == 0: * return None # <<<<<<<<<<<<<< * * return pysam_bam1_qname(src) */ __pyx_t_3 = PyBytes_AsString(Py_None); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_t_3; goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":1347 * return None * * return pysam_bam1_qname(src) # <<<<<<<<<<<<<< * * cdef int getCigarOpCode(AlignedRead self, int index): */ __pyx_r = pysam_bam1_qname(__pyx_v_src); goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_WriteUnraisable("samtoolsWrapper.AlignedRead.fastQName", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1349 * return pysam_bam1_qname(src) * * cdef int getCigarOpCode(AlignedRead self, int index): # <<<<<<<<<<<<<< * """ * Return the operation code at the specified index in the */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_getCigarOpCode(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self, int __pyx_v_index) { bam1_t *__pyx_v_src; uint32_t *__pyx_v_cigar_p; int __pyx_r; __Pyx_RefNannyDeclarations bam1_t *__pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("getCigarOpCode", 0); /* "samtoolsWrapper.pyx":1354 * CIGAR string. * """ * cdef bam1_t* src = self._delegate # <<<<<<<<<<<<<< * cdef uint32_t* cigar_p = pysam_bam1_cigar(src) * */ __pyx_t_1 = __pyx_v_self->_delegate; __pyx_v_src = __pyx_t_1; /* "samtoolsWrapper.pyx":1355 * """ * cdef bam1_t* src = self._delegate * cdef uint32_t* cigar_p = pysam_bam1_cigar(src) # <<<<<<<<<<<<<< * * if index < src.core.n_cigar: */ __pyx_v_cigar_p = pysam_bam1_cigar(__pyx_v_src); /* "samtoolsWrapper.pyx":1357 * cdef uint32_t* cigar_p = pysam_bam1_cigar(src) * * if index < src.core.n_cigar: # <<<<<<<<<<<<<< * return cigar_p[index] & BAM_CIGAR_MASK * else: */ __pyx_t_2 = (__pyx_v_index < __pyx_v_src->core.n_cigar); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":1358 * * if index < src.core.n_cigar: * return cigar_p[index] & BAM_CIGAR_MASK # <<<<<<<<<<<<<< * else: * raise StandardError, "Index %s is >= cigar length (%s)" %(index, src.core.n_cigar) */ __pyx_r = ((__pyx_v_cigar_p[__pyx_v_index]) & 15); goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "samtoolsWrapper.pyx":1360 * return cigar_p[index] & BAM_CIGAR_MASK * else: * raise StandardError, "Index %s is >= cigar length (%s)" %(index, src.core.n_cigar) # <<<<<<<<<<<<<< * * cdef int getCigarOpLength(AlignedRead self, int index): */ __pyx_t_3 = PyInt_FromLong(__pyx_v_index); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_src->core.n_cigar); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_57), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_Raise(__pyx_builtin_StandardError, ((PyObject *)__pyx_t_4), 0, 0); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("samtoolsWrapper.AlignedRead.getCigarOpCode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1362 * raise StandardError, "Index %s is >= cigar length (%s)" %(index, src.core.n_cigar) * * cdef int getCigarOpLength(AlignedRead self, int index): # <<<<<<<<<<<<<< * """ * Return the operation length at the specified index in the */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_getCigarOpLength(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self, int __pyx_v_index) { bam1_t *__pyx_v_src; uint32_t *__pyx_v_cigar_p; int __pyx_r; __Pyx_RefNannyDeclarations bam1_t *__pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("getCigarOpLength", 0); /* "samtoolsWrapper.pyx":1367 * CIGAR string. * """ * cdef bam1_t* src = self._delegate # <<<<<<<<<<<<<< * cdef uint32_t* cigar_p = pysam_bam1_cigar(src) * */ __pyx_t_1 = __pyx_v_self->_delegate; __pyx_v_src = __pyx_t_1; /* "samtoolsWrapper.pyx":1368 * """ * cdef bam1_t* src = self._delegate * cdef uint32_t* cigar_p = pysam_bam1_cigar(src) # <<<<<<<<<<<<<< * * if index < src.core.n_cigar: */ __pyx_v_cigar_p = pysam_bam1_cigar(__pyx_v_src); /* "samtoolsWrapper.pyx":1370 * cdef uint32_t* cigar_p = pysam_bam1_cigar(src) * * if index < src.core.n_cigar: # <<<<<<<<<<<<<< * return cigar_p[index] >> BAM_CIGAR_SHIFT * else: */ __pyx_t_2 = (__pyx_v_index < __pyx_v_src->core.n_cigar); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":1371 * * if index < src.core.n_cigar: * return cigar_p[index] >> BAM_CIGAR_SHIFT # <<<<<<<<<<<<<< * else: * raise StandardError, "Index %s is >= cigar length (%s)" %(index, src.core.n_cigar) */ __pyx_r = ((__pyx_v_cigar_p[__pyx_v_index]) >> 4); goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "samtoolsWrapper.pyx":1373 * return cigar_p[index] >> BAM_CIGAR_SHIFT * else: * raise StandardError, "Index %s is >= cigar length (%s)" %(index, src.core.n_cigar) # <<<<<<<<<<<<<< * * cdef int getCigarLength(AlignedRead self): */ __pyx_t_3 = PyInt_FromLong(__pyx_v_index); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_src->core.n_cigar); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_57), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_Raise(__pyx_builtin_StandardError, ((PyObject *)__pyx_t_4), 0, 0); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("samtoolsWrapper.AlignedRead.getCigarOpLength", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1375 * raise StandardError, "Index %s is >= cigar length (%s)" %(index, src.core.n_cigar) * * cdef int getCigarLength(AlignedRead self): # <<<<<<<<<<<<<< * """ * Return the length of the cigar string for this read. */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_getCigarLength(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getCigarLength", 0); /* "samtoolsWrapper.pyx":1379 * Return the length of the cigar string for this read. * """ * return self._delegate.core.n_cigar # <<<<<<<<<<<<<< * * cdef char* seq(AlignedRead self): */ __pyx_r = __pyx_v_self->_delegate->core.n_cigar; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1381 * return self._delegate.core.n_cigar * * cdef char* seq(AlignedRead self): # <<<<<<<<<<<<<< * """ * the query sequence (None if not present) */ static char *__pyx_f_15samtoolsWrapper_11AlignedRead_seq(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { uint8_t *__pyx_v_p; int __pyx_v_k; char *__pyx_v_bamTable; bam1_t *__pyx_v_src; int __pyx_v_characterIndex; char *__pyx_r; __Pyx_RefNannyDeclarations bam1_t *__pyx_t_1; int __pyx_t_2; char *__pyx_t_3; int32_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("seq", 0); /* "samtoolsWrapper.pyx":1386 * """ * cdef uint8_t* p * cdef int k = 0 # <<<<<<<<<<<<<< * cdef char* bamTable = "=ACMGRSVTWYHKDBN" * cdef bam1_t* src = self._delegate */ __pyx_v_k = 0; /* "samtoolsWrapper.pyx":1387 * cdef uint8_t* p * cdef int k = 0 * cdef char* bamTable = "=ACMGRSVTWYHKDBN" # <<<<<<<<<<<<<< * cdef bam1_t* src = self._delegate * cdef int characterIndex = 0 */ __pyx_v_bamTable = __pyx_k_50; /* "samtoolsWrapper.pyx":1388 * cdef int k = 0 * cdef char* bamTable = "=ACMGRSVTWYHKDBN" * cdef bam1_t* src = self._delegate # <<<<<<<<<<<<<< * cdef int characterIndex = 0 * */ __pyx_t_1 = __pyx_v_self->_delegate; __pyx_v_src = __pyx_t_1; /* "samtoolsWrapper.pyx":1389 * cdef char* bamTable = "=ACMGRSVTWYHKDBN" * cdef bam1_t* src = self._delegate * cdef int characterIndex = 0 # <<<<<<<<<<<<<< * * if not self._seq: */ __pyx_v_characterIndex = 0; /* "samtoolsWrapper.pyx":1391 * cdef int characterIndex = 0 * * if not self._seq: # <<<<<<<<<<<<<< * * # Parse qseq (bam1_seq) */ __pyx_t_2 = (!(__pyx_v_self->_seq != 0)); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":1394 * * # Parse qseq (bam1_seq) * if src.core.l_qseq == 0: # <<<<<<<<<<<<<< * return None * */ __pyx_t_2 = (__pyx_v_src->core.l_qseq == 0); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":1395 * # Parse qseq (bam1_seq) * if src.core.l_qseq == 0: * return None # <<<<<<<<<<<<<< * * self._seq = calloc(src.core.l_qseq + 1 , sizeof(char)) */ __pyx_t_3 = PyBytes_AsString(Py_None); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_t_3; goto __pyx_L0; goto __pyx_L4; } __pyx_L4:; /* "samtoolsWrapper.pyx":1397 * return None * * self._seq = calloc(src.core.l_qseq + 1 , sizeof(char)) # <<<<<<<<<<<<<< * p = pysam_bam1_seq(src) * */ __pyx_v_self->_seq = ((char *)calloc((__pyx_v_src->core.l_qseq + 1), (sizeof(char)))); /* "samtoolsWrapper.pyx":1398 * * self._seq = calloc(src.core.l_qseq + 1 , sizeof(char)) * p = pysam_bam1_seq(src) # <<<<<<<<<<<<<< * * # Equivalent to bam_nt16_rev_table[bam1_seqi(s, i)] (see bam.c) */ __pyx_v_p = pysam_bam1_seq(__pyx_v_src); /* "samtoolsWrapper.pyx":1401 * * # Equivalent to bam_nt16_rev_table[bam1_seqi(s, i)] (see bam.c) * for k from 0 <= k < src.core.l_qseq: # <<<<<<<<<<<<<< * characterIndex = ((p)[(k) / 2] >> 4 * (1 - (k) % 2) & 0xf) * self._seq[k] = bamTable[characterIndex] */ __pyx_t_4 = __pyx_v_src->core.l_qseq; for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_4; __pyx_v_k++) { /* "samtoolsWrapper.pyx":1402 * # Equivalent to bam_nt16_rev_table[bam1_seqi(s, i)] (see bam.c) * for k from 0 <= k < src.core.l_qseq: * characterIndex = ((p)[(k) / 2] >> 4 * (1 - (k) % 2) & 0xf) # <<<<<<<<<<<<<< * self._seq[k] = bamTable[characterIndex] * */ __pyx_v_characterIndex = (((__pyx_v_p[(__pyx_v_k / 2)]) >> (4 * (1 - (__pyx_v_k % 2)))) & 0xf); /* "samtoolsWrapper.pyx":1403 * for k from 0 <= k < src.core.l_qseq: * characterIndex = ((p)[(k) / 2] >> 4 * (1 - (k) % 2) & 0xf) * self._seq[k] = bamTable[characterIndex] # <<<<<<<<<<<<<< * * return self._seq */ (__pyx_v_self->_seq[__pyx_v_k]) = (__pyx_v_bamTable[__pyx_v_characterIndex]); } goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":1405 * self._seq[k] = bamTable[characterIndex] * * return self._seq # <<<<<<<<<<<<<< * * cdef char* qual(AlignedRead self): */ __pyx_r = __pyx_v_self->_seq; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_WriteUnraisable("samtoolsWrapper.AlignedRead.seq", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1407 * return self._seq * * cdef char* qual(AlignedRead self): # <<<<<<<<<<<<<< * """ * the base quality (None if not present) */ static char *__pyx_f_15samtoolsWrapper_11AlignedRead_qual(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { bam1_t *__pyx_v_src; uint8_t *__pyx_v_p; long __pyx_v_k; char *__pyx_r; __Pyx_RefNannyDeclarations bam1_t *__pyx_t_1; int __pyx_t_2; char *__pyx_t_3; int32_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("qual", 0); /* "samtoolsWrapper.pyx":1411 * the base quality (None if not present) * """ * cdef bam1_t* src = self._delegate # <<<<<<<<<<<<<< * cdef uint8_t* p * */ __pyx_t_1 = __pyx_v_self->_delegate; __pyx_v_src = __pyx_t_1; /* "samtoolsWrapper.pyx":1414 * cdef uint8_t* p * * if not self._qual: # <<<<<<<<<<<<<< * * if src.core.l_qseq == 0: */ __pyx_t_2 = (!(__pyx_v_self->_qual != 0)); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":1416 * if not self._qual: * * if src.core.l_qseq == 0: # <<<<<<<<<<<<<< * return None * */ __pyx_t_2 = (__pyx_v_src->core.l_qseq == 0); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":1417 * * if src.core.l_qseq == 0: * return None # <<<<<<<<<<<<<< * * p = pysam_bam1_qual(src) */ __pyx_t_3 = PyBytes_AsString(Py_None); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_t_3; goto __pyx_L0; goto __pyx_L4; } __pyx_L4:; /* "samtoolsWrapper.pyx":1419 * return None * * p = pysam_bam1_qual(src) # <<<<<<<<<<<<<< * * if p[0] == 0xff: */ __pyx_v_p = pysam_bam1_qual(__pyx_v_src); /* "samtoolsWrapper.pyx":1421 * p = pysam_bam1_qual(src) * * if p[0] == 0xff: # <<<<<<<<<<<<<< * return None * */ __pyx_t_2 = ((__pyx_v_p[0]) == 0xff); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":1422 * * if p[0] == 0xff: * return None # <<<<<<<<<<<<<< * * self._qual = calloc(src.core.l_qseq + 1 , sizeof(char)) */ __pyx_t_3 = PyBytes_AsString(Py_None); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_t_3; goto __pyx_L0; goto __pyx_L5; } __pyx_L5:; /* "samtoolsWrapper.pyx":1424 * return None * * self._qual = calloc(src.core.l_qseq + 1 , sizeof(char)) # <<<<<<<<<<<<<< * * for k from 0 <= k < src.core.l_qseq: */ __pyx_v_self->_qual = ((char *)calloc((__pyx_v_src->core.l_qseq + 1), (sizeof(char)))); /* "samtoolsWrapper.pyx":1426 * self._qual = calloc(src.core.l_qseq + 1 , sizeof(char)) * * for k from 0 <= k < src.core.l_qseq: # <<<<<<<<<<<<<< * ## equivalent to t[i] + 33 (see bam.c) * self._qual[k] = p[k] + 33 */ __pyx_t_4 = __pyx_v_src->core.l_qseq; for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_4; __pyx_v_k++) { /* "samtoolsWrapper.pyx":1428 * for k from 0 <= k < src.core.l_qseq: * ## equivalent to t[i] + 33 (see bam.c) * self._qual[k] = p[k] + 33 # <<<<<<<<<<<<<< * * return self._qual */ (__pyx_v_self->_qual[__pyx_v_k]) = ((__pyx_v_p[__pyx_v_k]) + 33); } goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":1430 * self._qual[k] = p[k] + 33 * * return self._qual # <<<<<<<<<<<<<< * * cdef dict tags(AlignedRead self): */ __pyx_r = __pyx_v_self->_qual; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_WriteUnraisable("samtoolsWrapper.AlignedRead.qual", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1432 * return self._qual * * cdef dict tags(AlignedRead self): # <<<<<<<<<<<<<< * """ * the tags in the AUX field. */ static PyObject *__pyx_f_15samtoolsWrapper_11AlignedRead_tags(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { char *__pyx_v_ctag; bam1_t *__pyx_v_src; uint8_t *__pyx_v_s; char __pyx_v_tpe; PyObject *__pyx_v_result = 0; char *__pyx_v_pytag; PyObject *__pyx_v_value = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; bam1_t *__pyx_t_2; int __pyx_t_3; int __pyx_t_4; int __pyx_t_5; Py_ssize_t __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("tags", 0); /* "samtoolsWrapper.pyx":1440 * cdef uint8_t* s * cdef char tpe * cdef dict result = dict() # <<<<<<<<<<<<<< * * src = self._delegate */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":1442 * cdef dict result = dict() * * src = self._delegate # <<<<<<<<<<<<<< * * if src.l_aux == 0: */ __pyx_t_2 = __pyx_v_self->_delegate; __pyx_v_src = __pyx_t_2; /* "samtoolsWrapper.pyx":1444 * src = self._delegate * * if src.l_aux == 0: # <<<<<<<<<<<<<< * return None * */ __pyx_t_3 = (__pyx_v_src->l_aux == 0); if (__pyx_t_3) { /* "samtoolsWrapper.pyx":1445 * * if src.l_aux == 0: * return None # <<<<<<<<<<<<<< * * s = pysam_bam1_aux( src ) */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __Pyx_INCREF(Py_None); __pyx_r = ((PyObject*)Py_None); goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":1447 * return None * * s = pysam_bam1_aux( src ) # <<<<<<<<<<<<<< * ctag = calloc( 3, sizeof(char) ) * cdef int x */ __pyx_v_s = pysam_bam1_aux(__pyx_v_src); /* "samtoolsWrapper.pyx":1448 * * s = pysam_bam1_aux( src ) * ctag = calloc( 3, sizeof(char) ) # <<<<<<<<<<<<<< * cdef int x * */ __pyx_v_ctag = ((char *)calloc(3, (sizeof(char)))); /* "samtoolsWrapper.pyx":1451 * cdef int x * * while s < (src.data + src.data_len): # <<<<<<<<<<<<<< * # get tag * ctag[0] = s[0] */ while (1) { __pyx_t_3 = (__pyx_v_s < (__pyx_v_src->data + __pyx_v_src->data_len)); if (!__pyx_t_3) break; /* "samtoolsWrapper.pyx":1453 * while s < (src.data + src.data_len): * # get tag * ctag[0] = s[0] # <<<<<<<<<<<<<< * ctag[1] = s[1] * ctag[2] = 0 */ (__pyx_v_ctag[0]) = (__pyx_v_s[0]); /* "samtoolsWrapper.pyx":1454 * # get tag * ctag[0] = s[0] * ctag[1] = s[1] # <<<<<<<<<<<<<< * ctag[2] = 0 * pytag = ctag */ (__pyx_v_ctag[1]) = (__pyx_v_s[1]); /* "samtoolsWrapper.pyx":1455 * ctag[0] = s[0] * ctag[1] = s[1] * ctag[2] = 0 # <<<<<<<<<<<<<< * pytag = ctag * s += 2 */ (__pyx_v_ctag[2]) = 0; /* "samtoolsWrapper.pyx":1456 * ctag[1] = s[1] * ctag[2] = 0 * pytag = ctag # <<<<<<<<<<<<<< * s += 2 * */ __pyx_v_pytag = __pyx_v_ctag; /* "samtoolsWrapper.pyx":1457 * ctag[2] = 0 * pytag = ctag * s += 2 # <<<<<<<<<<<<<< * * # get type and value */ __pyx_v_s = (__pyx_v_s + 2); /* "samtoolsWrapper.pyx":1462 * # how do I do char literal comparison in cython? * # the code below works (i.e, is C comparison) * tpe = toupper(s[0]) # <<<<<<<<<<<<<< * if tpe == 'S': * value = bam_aux2i(s) */ __pyx_v_tpe = toupper((__pyx_v_s[0])); /* "samtoolsWrapper.pyx":1463 * # the code below works (i.e, is C comparison) * tpe = toupper(s[0]) * if tpe == 'S': # <<<<<<<<<<<<<< * value = bam_aux2i(s) * s += 2 */ __pyx_t_3 = (__pyx_v_tpe == ((char)'S')); if (__pyx_t_3) { /* "samtoolsWrapper.pyx":1464 * tpe = toupper(s[0]) * if tpe == 'S': * value = bam_aux2i(s) # <<<<<<<<<<<<<< * s += 2 * elif tpe == 'I': */ __pyx_t_1 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_value); __pyx_v_value = __pyx_t_1; __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":1465 * if tpe == 'S': * value = bam_aux2i(s) * s += 2 # <<<<<<<<<<<<<< * elif tpe == 'I': * value = bam_aux2i(s) */ __pyx_v_s = (__pyx_v_s + 2); goto __pyx_L6; } /* "samtoolsWrapper.pyx":1466 * value = bam_aux2i(s) * s += 2 * elif tpe == 'I': # <<<<<<<<<<<<<< * value = bam_aux2i(s) * s += 4 */ __pyx_t_3 = (__pyx_v_tpe == ((char)'I')); if (__pyx_t_3) { /* "samtoolsWrapper.pyx":1467 * s += 2 * elif tpe == 'I': * value = bam_aux2i(s) # <<<<<<<<<<<<<< * s += 4 * elif tpe == 'F': */ __pyx_t_1 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_value); __pyx_v_value = __pyx_t_1; __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":1468 * elif tpe == 'I': * value = bam_aux2i(s) * s += 4 # <<<<<<<<<<<<<< * elif tpe == 'F': * value = bam_aux2f(s) */ __pyx_v_s = (__pyx_v_s + 4); goto __pyx_L6; } /* "samtoolsWrapper.pyx":1469 * value = bam_aux2i(s) * s += 4 * elif tpe == 'F': # <<<<<<<<<<<<<< * value = bam_aux2f(s) * s += 4 */ __pyx_t_3 = (__pyx_v_tpe == ((char)'F')); if (__pyx_t_3) { /* "samtoolsWrapper.pyx":1470 * s += 4 * elif tpe == 'F': * value = bam_aux2f(s) # <<<<<<<<<<<<<< * s += 4 * elif tpe == 'D': */ __pyx_t_1 = PyFloat_FromDouble(((float)bam_aux2f(__pyx_v_s))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_value); __pyx_v_value = __pyx_t_1; __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":1471 * elif tpe == 'F': * value = bam_aux2f(s) * s += 4 # <<<<<<<<<<<<<< * elif tpe == 'D': * value = bam_aux2d(s) */ __pyx_v_s = (__pyx_v_s + 4); goto __pyx_L6; } /* "samtoolsWrapper.pyx":1472 * value = bam_aux2f(s) * s += 4 * elif tpe == 'D': # <<<<<<<<<<<<<< * value = bam_aux2d(s) * s += 8 */ __pyx_t_3 = (__pyx_v_tpe == ((char)'D')); if (__pyx_t_3) { /* "samtoolsWrapper.pyx":1473 * s += 4 * elif tpe == 'D': * value = bam_aux2d(s) # <<<<<<<<<<<<<< * s += 8 * elif tpe == 'C': */ __pyx_t_1 = PyFloat_FromDouble(((double)bam_aux2d(__pyx_v_s))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_value); __pyx_v_value = __pyx_t_1; __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":1474 * elif tpe == 'D': * value = bam_aux2d(s) * s += 8 # <<<<<<<<<<<<<< * elif tpe == 'C': * value = bam_aux2i(s) */ __pyx_v_s = (__pyx_v_s + 8); goto __pyx_L6; } /* "samtoolsWrapper.pyx":1475 * value = bam_aux2d(s) * s += 8 * elif tpe == 'C': # <<<<<<<<<<<<<< * value = bam_aux2i(s) * s += 1 */ __pyx_t_3 = (__pyx_v_tpe == ((char)'C')); if (__pyx_t_3) { /* "samtoolsWrapper.pyx":1476 * s += 8 * elif tpe == 'C': * value = bam_aux2i(s) # <<<<<<<<<<<<<< * s += 1 * elif tpe == 'A': */ __pyx_t_1 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_value); __pyx_v_value = __pyx_t_1; __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":1477 * elif tpe == 'C': * value = bam_aux2i(s) * s += 1 # <<<<<<<<<<<<<< * elif tpe == 'A': * # there might a more efficient way */ __pyx_v_s = (__pyx_v_s + 1); goto __pyx_L6; } /* "samtoolsWrapper.pyx":1478 * value = bam_aux2i(s) * s += 1 * elif tpe == 'A': # <<<<<<<<<<<<<< * # there might a more efficient way * # to convert a char into a string */ __pyx_t_3 = (__pyx_v_tpe == ((char)'A')); if (__pyx_t_3) { /* "samtoolsWrapper.pyx":1482 * # to convert a char into a string * # yes there is: * value = bam_aux2A(s) # <<<<<<<<<<<<<< * s += 1 * elif tpe == 'Z' or tpe == 'H': */ __pyx_t_1 = PyInt_FromLong(((char)bam_aux2A(__pyx_v_s))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_value); __pyx_v_value = __pyx_t_1; __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":1483 * # yes there is: * value = bam_aux2A(s) * s += 1 # <<<<<<<<<<<<<< * elif tpe == 'Z' or tpe == 'H': * value = bam_aux2Z(s) */ __pyx_v_s = (__pyx_v_s + 1); goto __pyx_L6; } /* "samtoolsWrapper.pyx":1484 * value = bam_aux2A(s) * s += 1 * elif tpe == 'Z' or tpe == 'H': # <<<<<<<<<<<<<< * value = bam_aux2Z(s) * # +1 for NULL terminated string */ __pyx_t_3 = (__pyx_v_tpe == ((char)'Z')); if (!__pyx_t_3) { __pyx_t_4 = (__pyx_v_tpe == ((char)'H')); __pyx_t_5 = __pyx_t_4; } else { __pyx_t_5 = __pyx_t_3; } if (__pyx_t_5) { /* "samtoolsWrapper.pyx":1485 * s += 1 * elif tpe == 'Z' or tpe == 'H': * value = bam_aux2Z(s) # <<<<<<<<<<<<<< * # +1 for NULL terminated string * s += len(value) + 1 */ __pyx_t_1 = PyBytes_FromString(((char *)bam_aux2Z(__pyx_v_s))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_XDECREF(__pyx_v_value); __pyx_v_value = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":1487 * value = bam_aux2Z(s) * # +1 for NULL terminated string * s += len(value) + 1 # <<<<<<<<<<<<<< * else: * print "Unrecognized type ",tpe */ __pyx_t_6 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_s = (__pyx_v_s + (__pyx_t_6 + 1)); goto __pyx_L6; } /*else*/ { /* "samtoolsWrapper.pyx":1489 * s += len(value) + 1 * else: * print "Unrecognized type ",tpe # <<<<<<<<<<<<<< * s += 1 * */ __pyx_t_1 = PyInt_FromLong(__pyx_v_tpe); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)__pyx_kp_s_58)); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_58)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_58)); PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; if (__Pyx_Print(0, ((PyObject *)__pyx_t_7), 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; } __pyx_L6:; /* "samtoolsWrapper.pyx":1490 * else: * print "Unrecognized type ",tpe * s += 1 # <<<<<<<<<<<<<< * * # ignore type */ __pyx_v_s = (__pyx_v_s + 1); /* "samtoolsWrapper.pyx":1493 * * # ignore type * result[pytag] = value # <<<<<<<<<<<<<< * * free( ctag ) */ if (unlikely(!__pyx_v_value)) { __Pyx_RaiseUnboundLocalError("value"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_7 = PyBytes_FromString(__pyx_v_pytag); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); if (PyDict_SetItem(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_7), __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; } /* "samtoolsWrapper.pyx":1495 * result[pytag] = value * * free( ctag ) # <<<<<<<<<<<<<< * return result * */ free(__pyx_v_ctag); /* "samtoolsWrapper.pyx":1496 * * free( ctag ) * return result # <<<<<<<<<<<<<< * * cdef int flag(AlignedRead self): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = __pyx_v_result; goto __pyx_L0; __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("samtoolsWrapper.AlignedRead.tags", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); __Pyx_XDECREF(__pyx_v_value); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1498 * return result * * cdef int flag(AlignedRead self): # <<<<<<<<<<<<<< * """ * properties flag */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_flag(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("flag", 0); /* "samtoolsWrapper.pyx":1502 * properties flag * """ * return self._delegate.core.flag # <<<<<<<<<<<<<< * * cdef int rname(AlignedRead self): */ __pyx_r = __pyx_v_self->_delegate->core.flag; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1504 * return self._delegate.core.flag * * cdef int rname(AlignedRead self): # <<<<<<<<<<<<<< * """ * :term:`target` ID */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_rname(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rname", 0); /* "samtoolsWrapper.pyx":1515 * * """ * return self._delegate.core.tid # <<<<<<<<<<<<<< * * cdef int pos(AlignedRead self): */ __pyx_r = __pyx_v_self->_delegate->core.tid; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1517 * return self._delegate.core.tid * * cdef int pos(AlignedRead self): # <<<<<<<<<<<<<< * """ * 0-based leftmost coordinate */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_pos(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("pos", 0); /* "samtoolsWrapper.pyx":1521 * 0-based leftmost coordinate * """ * return self._delegate.core.pos # <<<<<<<<<<<<<< * * cdef int end(AlignedRead self): */ __pyx_r = __pyx_v_self->_delegate->core.pos; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1523 * return self._delegate.core.pos * * cdef int end(AlignedRead self): # <<<<<<<<<<<<<< * """ * 0-based right-tmost coordinate, including */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_end(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_v_cigarLength; int __pyx_v_cigarIndex; int __pyx_v_flag; int __pyx_v_length; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; __Pyx_RefNannySetupContext("end", 0); /* "samtoolsWrapper.pyx":1528 * cigar shifts (deletions, skips etc). * """ * cdef int cigarLength = 0 # <<<<<<<<<<<<<< * cdef int cigarIndex = 0 * cdef int flag = 0 */ __pyx_v_cigarLength = 0; /* "samtoolsWrapper.pyx":1529 * """ * cdef int cigarLength = 0 * cdef int cigarIndex = 0 # <<<<<<<<<<<<<< * cdef int flag = 0 * cdef int length = 0 */ __pyx_v_cigarIndex = 0; /* "samtoolsWrapper.pyx":1530 * cdef int cigarLength = 0 * cdef int cigarIndex = 0 * cdef int flag = 0 # <<<<<<<<<<<<<< * cdef int length = 0 * */ __pyx_v_flag = 0; /* "samtoolsWrapper.pyx":1531 * cdef int cigarIndex = 0 * cdef int flag = 0 * cdef int length = 0 # <<<<<<<<<<<<<< * * if self.readEnd == -1: */ __pyx_v_length = 0; /* "samtoolsWrapper.pyx":1533 * cdef int length = 0 * * if self.readEnd == -1: # <<<<<<<<<<<<<< * self.readEnd = self.pos() * cigarLength = self.getCigarLength() */ __pyx_t_1 = (__pyx_v_self->readEnd == -1); if (__pyx_t_1) { /* "samtoolsWrapper.pyx":1534 * * if self.readEnd == -1: * self.readEnd = self.pos() # <<<<<<<<<<<<<< * cigarLength = self.getCigarLength() * */ __pyx_v_self->readEnd = ((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->pos(__pyx_v_self); /* "samtoolsWrapper.pyx":1535 * if self.readEnd == -1: * self.readEnd = self.pos() * cigarLength = self.getCigarLength() # <<<<<<<<<<<<<< * * for cigarIndex from 0 <= cigarIndex < cigarLength: */ __pyx_v_cigarLength = ((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->getCigarLength(__pyx_v_self); /* "samtoolsWrapper.pyx":1537 * cigarLength = self.getCigarLength() * * for cigarIndex from 0 <= cigarIndex < cigarLength: # <<<<<<<<<<<<<< * flag = self.getCigarOpCode(cigarIndex) * length = self.getCigarOpLength(cigarIndex) */ __pyx_t_2 = __pyx_v_cigarLength; for (__pyx_v_cigarIndex = 0; __pyx_v_cigarIndex < __pyx_t_2; __pyx_v_cigarIndex++) { /* "samtoolsWrapper.pyx":1538 * * for cigarIndex from 0 <= cigarIndex < cigarLength: * flag = self.getCigarOpCode(cigarIndex) # <<<<<<<<<<<<<< * length = self.getCigarOpLength(cigarIndex) * */ __pyx_v_flag = ((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->getCigarOpCode(__pyx_v_self, __pyx_v_cigarIndex); /* "samtoolsWrapper.pyx":1539 * for cigarIndex from 0 <= cigarIndex < cigarLength: * flag = self.getCigarOpCode(cigarIndex) * length = self.getCigarOpLength(cigarIndex) # <<<<<<<<<<<<<< * * if flag == 0 or flag == 2 or flag == 3: */ __pyx_v_length = ((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->getCigarOpLength(__pyx_v_self, __pyx_v_cigarIndex); /* "samtoolsWrapper.pyx":1541 * length = self.getCigarOpLength(cigarIndex) * * if flag == 0 or flag == 2 or flag == 3: # <<<<<<<<<<<<<< * self.readEnd += length * */ switch (__pyx_v_flag) { case 0: case 2: case 3: /* "samtoolsWrapper.pyx":1542 * * if flag == 0 or flag == 2 or flag == 3: * self.readEnd += length # <<<<<<<<<<<<<< * * return self.readEnd */ __pyx_v_self->readEnd = (__pyx_v_self->readEnd + __pyx_v_length); break; } } goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":1544 * self.readEnd += length * * return self.readEnd # <<<<<<<<<<<<<< * * cdef bin(AlignedRead self): */ __pyx_r = __pyx_v_self->readEnd; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1546 * return self.readEnd * * cdef bin(AlignedRead self): # <<<<<<<<<<<<<< * """ * properties bin */ static PyObject *__pyx_f_15samtoolsWrapper_11AlignedRead_bin(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("bin", 0); /* "samtoolsWrapper.pyx":1550 * properties bin * """ * return self._delegate.core.bin # <<<<<<<<<<<<<< * * cdef int rlen(AlignedRead self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_self->_delegate->core.bin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("samtoolsWrapper.AlignedRead.bin", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1552 * return self._delegate.core.bin * * cdef int rlen(AlignedRead self): # <<<<<<<<<<<<<< * ''' * length of the read (read only). Returns 0 if not given. */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_rlen(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rlen", 0); /* "samtoolsWrapper.pyx":1556 * length of the read (read only). Returns 0 if not given. * ''' * return self._delegate.core.l_qseq # <<<<<<<<<<<<<< * * cpdef int mapq(AlignedRead self): */ __pyx_r = __pyx_v_self->_delegate->core.l_qseq; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1558 * return self._delegate.core.l_qseq * * cpdef int mapq(AlignedRead self): # <<<<<<<<<<<<<< * """ * mapping quality */ static PyObject *__pyx_pw_15samtoolsWrapper_11AlignedRead_13mapq(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_15samtoolsWrapper_11AlignedRead_mapq(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("mapq", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__mapq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_15samtoolsWrapper_11AlignedRead_13mapq)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "samtoolsWrapper.pyx":1562 * mapping quality * """ * return self._delegate.core.qual # <<<<<<<<<<<<<< * * cdef int mrnm(AlignedRead self): */ __pyx_r = __pyx_v_self->_delegate->core.qual; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_WriteUnraisable("samtoolsWrapper.AlignedRead.mapq", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_15samtoolsWrapper_11AlignedRead_13mapq(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_15samtoolsWrapper_11AlignedRead_12mapq[] = "\n mapping quality\n "; static PyObject *__pyx_pw_15samtoolsWrapper_11AlignedRead_13mapq(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("mapq (wrapper)", 0); __pyx_r = __pyx_pf_15samtoolsWrapper_11AlignedRead_12mapq(((struct __pyx_obj_15samtoolsWrapper_AlignedRead *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1558 * return self._delegate.core.l_qseq * * cpdef int mapq(AlignedRead self): # <<<<<<<<<<<<<< * """ * mapping quality */ static PyObject *__pyx_pf_15samtoolsWrapper_11AlignedRead_12mapq(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("mapq", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->mapq(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("samtoolsWrapper.AlignedRead.mapq", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1564 * return self._delegate.core.qual * * cdef int mrnm(AlignedRead self): # <<<<<<<<<<<<<< * """ * the :term:`reference` id of the mate */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_mrnm(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("mrnm", 0); /* "samtoolsWrapper.pyx":1568 * the :term:`reference` id of the mate * """ * return self._delegate.core.mtid # <<<<<<<<<<<<<< * * cdef int mpos(AlignedRead self): */ __pyx_r = __pyx_v_self->_delegate->core.mtid; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1570 * return self._delegate.core.mtid * * cdef int mpos(AlignedRead self): # <<<<<<<<<<<<<< * """ * the position of the mate */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_mpos(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("mpos", 0); /* "samtoolsWrapper.pyx":1574 * the position of the mate * """ * return self._delegate.core.mpos # <<<<<<<<<<<<<< * * cdef int isize(AlignedRead self): */ __pyx_r = __pyx_v_self->_delegate->core.mpos; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1576 * return self._delegate.core.mpos * * cdef int isize(AlignedRead self): # <<<<<<<<<<<<<< * """ * the insert size */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_isize(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("isize", 0); /* "samtoolsWrapper.pyx":1580 * the insert size * """ * return self._delegate.core.isize # <<<<<<<<<<<<<< * * cdef int is_paired(AlignedRead self): */ __pyx_r = __pyx_v_self->_delegate->core.isize; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1582 * return self._delegate.core.isize * * cdef int is_paired(AlignedRead self): # <<<<<<<<<<<<<< * """ * true if read is paired in sequencing */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_is_paired(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_paired", 0); /* "samtoolsWrapper.pyx":1586 * true if read is paired in sequencing * """ * return (self._delegate.core.flag & BAM_FPAIRED) != 0 # <<<<<<<<<<<<<< * * cdef int is_proper_pair(AlignedRead self): */ __pyx_r = ((__pyx_v_self->_delegate->core.flag & 1) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1588 * return (self._delegate.core.flag & BAM_FPAIRED) != 0 * * cdef int is_proper_pair(AlignedRead self): # <<<<<<<<<<<<<< * """ * true if read is mapped in a proper pair */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_is_proper_pair(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_proper_pair", 0); /* "samtoolsWrapper.pyx":1592 * true if read is mapped in a proper pair * """ * return (self.flag() & BAM_FPROPER_PAIR) != 0 # <<<<<<<<<<<<<< * * cdef int is_unmapped(AlignedRead self): */ __pyx_r = ((((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->flag(__pyx_v_self) & 2) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1594 * return (self.flag() & BAM_FPROPER_PAIR) != 0 * * cdef int is_unmapped(AlignedRead self): # <<<<<<<<<<<<<< * """ * true if read itself is unmapped */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_is_unmapped(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_unmapped", 0); /* "samtoolsWrapper.pyx":1598 * true if read itself is unmapped * """ * return (self.flag() & BAM_FUNMAP) != 0 # <<<<<<<<<<<<<< * * cdef int mate_is_unmapped(AlignedRead self): */ __pyx_r = ((((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->flag(__pyx_v_self) & 4) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1600 * return (self.flag() & BAM_FUNMAP) != 0 * * cdef int mate_is_unmapped(AlignedRead self): # <<<<<<<<<<<<<< * """ * true if the mate is unmapped */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_mate_is_unmapped(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("mate_is_unmapped", 0); /* "samtoolsWrapper.pyx":1604 * true if the mate is unmapped * """ * return (self.flag() & BAM_FMUNMAP) != 0 # <<<<<<<<<<<<<< * * cdef int is_reverse(AlignedRead self): */ __pyx_r = ((((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->flag(__pyx_v_self) & 8) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1606 * return (self.flag() & BAM_FMUNMAP) != 0 * * cdef int is_reverse(AlignedRead self): # <<<<<<<<<<<<<< * """ * true if read is mapped to reverse strand */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_is_reverse(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_reverse", 0); /* "samtoolsWrapper.pyx":1610 * true if read is mapped to reverse strand * """ * return (self.flag() & BAM_FREVERSE) != 0 # <<<<<<<<<<<<<< * * cdef int mate_is_reverse(AlignedRead self): */ __pyx_r = ((((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->flag(__pyx_v_self) & 16) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1612 * return (self.flag() & BAM_FREVERSE) != 0 * * cdef int mate_is_reverse(AlignedRead self): # <<<<<<<<<<<<<< * """ * true is read is mapped to reverse strand */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_mate_is_reverse(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("mate_is_reverse", 0); /* "samtoolsWrapper.pyx":1616 * true is read is mapped to reverse strand * """ * return (self.flag() & BAM_FMREVERSE) != 0 # <<<<<<<<<<<<<< * * cdef int is_read1(AlignedRead self): */ __pyx_r = ((((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->flag(__pyx_v_self) & 32) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1618 * return (self.flag() & BAM_FMREVERSE) != 0 * * cdef int is_read1(AlignedRead self): # <<<<<<<<<<<<<< * """ * true if this is read1 */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_is_read1(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_read1", 0); /* "samtoolsWrapper.pyx":1622 * true if this is read1 * """ * return (self.flag() & BAM_FREAD1) != 0 # <<<<<<<<<<<<<< * * cdef int is_read2(AlignedRead self): */ __pyx_r = ((((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->flag(__pyx_v_self) & 64) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1624 * return (self.flag() & BAM_FREAD1) != 0 * * cdef int is_read2(AlignedRead self): # <<<<<<<<<<<<<< * """ * true if this is read2 */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_is_read2(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_read2", 0); /* "samtoolsWrapper.pyx":1628 * true if this is read2 * """ * return (self.flag() & BAM_FREAD2) != 0 # <<<<<<<<<<<<<< * * cdef int is_secondary(AlignedRead self): */ __pyx_r = ((((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->flag(__pyx_v_self) & 128) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1630 * return (self.flag() & BAM_FREAD2) != 0 * * cdef int is_secondary(AlignedRead self): # <<<<<<<<<<<<<< * """ * true if not primary alignment */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_is_secondary(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_secondary", 0); /* "samtoolsWrapper.pyx":1634 * true if not primary alignment * """ * return (self.flag() & BAM_FSECONDARY) != 0 # <<<<<<<<<<<<<< * * cdef int is_qcfail(AlignedRead self): */ __pyx_r = ((((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->flag(__pyx_v_self) & 256) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1636 * return (self.flag() & BAM_FSECONDARY) != 0 * * cdef int is_qcfail(AlignedRead self): # <<<<<<<<<<<<<< * """ * true if QC failure */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_is_qcfail(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_qcfail", 0); /* "samtoolsWrapper.pyx":1640 * true if QC failure * """ * return (self.flag() & BAM_FQCFAIL) != 0 # <<<<<<<<<<<<<< * * cdef int is_duplicate(AlignedRead self): */ __pyx_r = ((((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->flag(__pyx_v_self) & 512) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1642 * return (self.flag() & BAM_FQCFAIL) != 0 * * cdef int is_duplicate(AlignedRead self): # <<<<<<<<<<<<<< * """ * true if optical or PCR duplicate */ static int __pyx_f_15samtoolsWrapper_11AlignedRead_is_duplicate(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_duplicate", 0); /* "samtoolsWrapper.pyx":1646 * true if optical or PCR duplicate * """ * return (self.flag() & BAM_FDUP) != 0 # <<<<<<<<<<<<<< * * cdef opt(AlignedRead self, tag): */ __pyx_r = ((((struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead *)__pyx_v_self->__pyx_vtab)->flag(__pyx_v_self) & 1024) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1648 * return (self.flag() & BAM_FDUP) != 0 * * cdef opt(AlignedRead self, tag): # <<<<<<<<<<<<<< * """ * retrieves optional data given a two-letter *tag* */ static PyObject *__pyx_f_15samtoolsWrapper_11AlignedRead_opt(struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tag) { uint8_t *__pyx_v_v; PyObject *__pyx_v_type = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations char *__pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("opt", 0); /* "samtoolsWrapper.pyx":1654 * #see bam_aux.c: bam_aux_get() and bam_aux2i() etc * cdef uint8_t * v * v = bam_aux_get(self._delegate, tag) # <<<<<<<<<<<<<< * * if v == NULL: */ __pyx_t_1 = PyBytes_AsString(__pyx_v_tag); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_v = bam_aux_get(__pyx_v_self->_delegate, __pyx_t_1); /* "samtoolsWrapper.pyx":1656 * v = bam_aux_get(self._delegate, tag) * * if v == NULL: # <<<<<<<<<<<<<< * raise KeyError( "tag '%s' not present" % tag ) * */ __pyx_t_2 = (__pyx_v_v == NULL); if (__pyx_t_2) { /* "samtoolsWrapper.pyx":1657 * * if v == NULL: * raise KeyError( "tag '%s' not present" % tag ) # <<<<<<<<<<<<<< * * type = chr(v[0]) */ __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_59), __pyx_v_tag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "samtoolsWrapper.pyx":1659 * raise KeyError( "tag '%s' not present" % tag ) * * type = chr(v[0]) # <<<<<<<<<<<<<< * * if type == 'c' or type == 'C' or type == 's' or type == 'S' or type == 'i': */ __pyx_t_3 = __Pyx_PyInt_to_py_uint8_t((__pyx_v_v[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_builtin_chr, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_v_type = __pyx_t_3; __pyx_t_3 = 0; /* "samtoolsWrapper.pyx":1661 * type = chr(v[0]) * * if type == 'c' or type == 'C' or type == 's' or type == 'S' or type == 'i': # <<<<<<<<<<<<<< * return bam_aux2i(v) * elif type == 'f': */ __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__c), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_2) { __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__C), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_5) { __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__s), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_6) { __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__S), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_7) { __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__i), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = __pyx_t_8; } else { __pyx_t_9 = __pyx_t_7; } __pyx_t_7 = __pyx_t_9; } else { __pyx_t_7 = __pyx_t_6; } __pyx_t_6 = __pyx_t_7; } else { __pyx_t_6 = __pyx_t_5; } __pyx_t_5 = __pyx_t_6; } else { __pyx_t_5 = __pyx_t_2; } if (__pyx_t_5) { /* "samtoolsWrapper.pyx":1662 * * if type == 'c' or type == 'C' or type == 's' or type == 'S' or type == 'i': * return bam_aux2i(v) # <<<<<<<<<<<<<< * elif type == 'f': * return bam_aux2f(v) */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_v))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; goto __pyx_L4; } /* "samtoolsWrapper.pyx":1663 * if type == 'c' or type == 'C' or type == 's' or type == 'S' or type == 'i': * return bam_aux2i(v) * elif type == 'f': # <<<<<<<<<<<<<< * return bam_aux2f(v) * elif type == 'd': */ __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__f), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { /* "samtoolsWrapper.pyx":1664 * return bam_aux2i(v) * elif type == 'f': * return bam_aux2f(v) # <<<<<<<<<<<<<< * elif type == 'd': * return bam_aux2d(v) */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = PyFloat_FromDouble(((float)bam_aux2f(__pyx_v_v))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; goto __pyx_L4; } /* "samtoolsWrapper.pyx":1665 * elif type == 'f': * return bam_aux2f(v) * elif type == 'd': # <<<<<<<<<<<<<< * return bam_aux2d(v) * elif type == 'A': */ __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__d), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { /* "samtoolsWrapper.pyx":1666 * return bam_aux2f(v) * elif type == 'd': * return bam_aux2d(v) # <<<<<<<<<<<<<< * elif type == 'A': * # there might a more efficient way */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = PyFloat_FromDouble(((double)bam_aux2d(__pyx_v_v))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; goto __pyx_L4; } /* "samtoolsWrapper.pyx":1667 * elif type == 'd': * return bam_aux2d(v) * elif type == 'A': # <<<<<<<<<<<<<< * # there might a more efficient way * # to convert a char into a string */ __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__A), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { /* "samtoolsWrapper.pyx":1670 * # there might a more efficient way * # to convert a char into a string * return '%c' % bam_aux2A(v) # <<<<<<<<<<<<<< * elif type == 'Z': * return bam_aux2Z(v) */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = PyInt_FromLong(((char)bam_aux2A(__pyx_v_v))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_60), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = ((PyObject *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0; goto __pyx_L4; } /* "samtoolsWrapper.pyx":1671 * # to convert a char into a string * return '%c' % bam_aux2A(v) * elif type == 'Z': # <<<<<<<<<<<<<< * return bam_aux2Z(v) * */ __pyx_t_4 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__Z), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_5) { /* "samtoolsWrapper.pyx":1672 * return '%c' % bam_aux2A(v) * elif type == 'Z': * return bam_aux2Z(v) # <<<<<<<<<<<<<< * * ################################################################################################### */ __Pyx_XDECREF(__pyx_r); __pyx_t_4 = PyBytes_FromString(((char *)bam_aux2Z(__pyx_v_v))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_r = ((PyObject *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0; goto __pyx_L4; } __pyx_L4:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("samtoolsWrapper.AlignedRead.opt", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_type); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pyx":1676 * ################################################################################################### * * cdef AlignedRead makeAlignedRead(bam1_t * src): # <<<<<<<<<<<<<< * ''' * enter src into AlignedRead. */ static struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_f_15samtoolsWrapper_makeAlignedRead(bam1_t *__pyx_v_src) { struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_v_dest = 0; struct __pyx_obj_15samtoolsWrapper_AlignedRead *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("makeAlignedRead", 0); /* "samtoolsWrapper.pyx":1680 * enter src into AlignedRead. * ''' * cdef AlignedRead dest = AlignedRead() # <<<<<<<<<<<<<< * dest._delegate = bam_dup1(src) * return dest */ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_15samtoolsWrapper_AlignedRead)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_dest = ((struct __pyx_obj_15samtoolsWrapper_AlignedRead *)__pyx_t_1); __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":1681 * ''' * cdef AlignedRead dest = AlignedRead() * dest._delegate = bam_dup1(src) # <<<<<<<<<<<<<< * return dest * */ __pyx_v_dest->_delegate = bam_dup1(__pyx_v_src); /* "samtoolsWrapper.pyx":1682 * cdef AlignedRead dest = AlignedRead() * dest._delegate = bam_dup1(src) * return dest # <<<<<<<<<<<<<< * * ##################################################################### */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __Pyx_INCREF(((PyObject *)__pyx_v_dest)); __pyx_r = __pyx_v_dest; goto __pyx_L0; __pyx_r = ((struct __pyx_obj_15samtoolsWrapper_AlignedRead *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("samtoolsWrapper.makeAlignedRead", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_dest); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pxd":346 * * # And here are accessor functions for the bit-fields * cdef inline int Read_IsReverse(cAlignedRead* theRead): # <<<<<<<<<<<<<< * return ( (theRead.bitFlag & BAM_FREVERSE) != 0) * */ static CYTHON_INLINE int __pyx_f_15samtoolsWrapper_Read_IsReverse(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_theRead) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("Read_IsReverse", 0); /* "samtoolsWrapper.pxd":347 * # And here are accessor functions for the bit-fields * cdef inline int Read_IsReverse(cAlignedRead* theRead): * return ( (theRead.bitFlag & BAM_FREVERSE) != 0) # <<<<<<<<<<<<<< * * cdef inline int Read_IsPaired(cAlignedRead* theRead): */ __pyx_r = ((__pyx_v_theRead->bitFlag & 16) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pxd":349 * return ( (theRead.bitFlag & BAM_FREVERSE) != 0) * * cdef inline int Read_IsPaired(cAlignedRead* theRead): # <<<<<<<<<<<<<< * return ( (theRead.bitFlag & BAM_FPAIRED) != 0) * */ static CYTHON_INLINE int __pyx_f_15samtoolsWrapper_Read_IsPaired(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_theRead) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("Read_IsPaired", 0); /* "samtoolsWrapper.pxd":350 * * cdef inline int Read_IsPaired(cAlignedRead* theRead): * return ( (theRead.bitFlag & BAM_FPAIRED) != 0) # <<<<<<<<<<<<<< * * cdef inline int Read_IsProperPair(cAlignedRead* theRead): */ __pyx_r = ((__pyx_v_theRead->bitFlag & 1) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pxd":352 * return ( (theRead.bitFlag & BAM_FPAIRED) != 0) * * cdef inline int Read_IsProperPair(cAlignedRead* theRead): # <<<<<<<<<<<<<< * return ( (theRead.bitFlag & BAM_FPROPER_PAIR) != 0) * */ static CYTHON_INLINE int __pyx_f_15samtoolsWrapper_Read_IsProperPair(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_theRead) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("Read_IsProperPair", 0); /* "samtoolsWrapper.pxd":353 * * cdef inline int Read_IsProperPair(cAlignedRead* theRead): * return ( (theRead.bitFlag & BAM_FPROPER_PAIR) != 0) # <<<<<<<<<<<<<< * * cdef inline int Read_IsDuplicate(cAlignedRead* theRead): */ __pyx_r = ((__pyx_v_theRead->bitFlag & 2) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pxd":355 * return ( (theRead.bitFlag & BAM_FPROPER_PAIR) != 0) * * cdef inline int Read_IsDuplicate(cAlignedRead* theRead): # <<<<<<<<<<<<<< * return ( (theRead.bitFlag & BAM_FDUP) != 0) * */ static CYTHON_INLINE int __pyx_f_15samtoolsWrapper_Read_IsDuplicate(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_theRead) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("Read_IsDuplicate", 0); /* "samtoolsWrapper.pxd":356 * * cdef inline int Read_IsDuplicate(cAlignedRead* theRead): * return ( (theRead.bitFlag & BAM_FDUP) != 0) # <<<<<<<<<<<<<< * * cdef inline int Read_IsUnmapped(cAlignedRead* theRead): */ __pyx_r = ((__pyx_v_theRead->bitFlag & 1024) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pxd":358 * return ( (theRead.bitFlag & BAM_FDUP) != 0) * * cdef inline int Read_IsUnmapped(cAlignedRead* theRead): # <<<<<<<<<<<<<< * return ( (theRead.bitFlag & BAM_FUNMAP) != 0) * */ static CYTHON_INLINE int __pyx_f_15samtoolsWrapper_Read_IsUnmapped(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_theRead) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("Read_IsUnmapped", 0); /* "samtoolsWrapper.pxd":359 * * cdef inline int Read_IsUnmapped(cAlignedRead* theRead): * return ( (theRead.bitFlag & BAM_FUNMAP) != 0) # <<<<<<<<<<<<<< * * cdef inline int Read_MateIsUnmapped(cAlignedRead* theRead): */ __pyx_r = ((__pyx_v_theRead->bitFlag & 4) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pxd":361 * return ( (theRead.bitFlag & BAM_FUNMAP) != 0) * * cdef inline int Read_MateIsUnmapped(cAlignedRead* theRead): # <<<<<<<<<<<<<< * return ( (theRead.bitFlag & BAM_FMUNMAP) != 0) * */ static CYTHON_INLINE int __pyx_f_15samtoolsWrapper_Read_MateIsUnmapped(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_theRead) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("Read_MateIsUnmapped", 0); /* "samtoolsWrapper.pxd":362 * * cdef inline int Read_MateIsUnmapped(cAlignedRead* theRead): * return ( (theRead.bitFlag & BAM_FMUNMAP) != 0) # <<<<<<<<<<<<<< * * cdef inline int Read_MateIsReverse(cAlignedRead* theRead): */ __pyx_r = ((__pyx_v_theRead->bitFlag & 8) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pxd":364 * return ( (theRead.bitFlag & BAM_FMUNMAP) != 0) * * cdef inline int Read_MateIsReverse(cAlignedRead* theRead): # <<<<<<<<<<<<<< * return ( (theRead.bitFlag & BAM_FMREVERSE) != 0) * */ static CYTHON_INLINE int __pyx_f_15samtoolsWrapper_Read_MateIsReverse(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_theRead) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("Read_MateIsReverse", 0); /* "samtoolsWrapper.pxd":365 * * cdef inline int Read_MateIsReverse(cAlignedRead* theRead): * return ( (theRead.bitFlag & BAM_FMREVERSE) != 0) # <<<<<<<<<<<<<< * * cdef inline int Read_IsQCFail(cAlignedRead* theRead): */ __pyx_r = ((__pyx_v_theRead->bitFlag & 32) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pxd":367 * return ( (theRead.bitFlag & BAM_FMREVERSE) != 0) * * cdef inline int Read_IsQCFail(cAlignedRead* theRead): # <<<<<<<<<<<<<< * return ( (theRead.bitFlag & BAM_FQCFAIL) != 0) * */ static CYTHON_INLINE int __pyx_f_15samtoolsWrapper_Read_IsQCFail(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_theRead) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("Read_IsQCFail", 0); /* "samtoolsWrapper.pxd":368 * * cdef inline int Read_IsQCFail(cAlignedRead* theRead): * return ( (theRead.bitFlag & BAM_FQCFAIL) != 0) # <<<<<<<<<<<<<< * * cdef inline int Read_IsReadOne(cAlignedRead* theRead): */ __pyx_r = ((__pyx_v_theRead->bitFlag & 512) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pxd":370 * return ( (theRead.bitFlag & BAM_FQCFAIL) != 0) * * cdef inline int Read_IsReadOne(cAlignedRead* theRead): # <<<<<<<<<<<<<< * return ( (theRead.bitFlag & BAM_FREAD1) != 0) * */ static CYTHON_INLINE int __pyx_f_15samtoolsWrapper_Read_IsReadOne(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_theRead) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("Read_IsReadOne", 0); /* "samtoolsWrapper.pxd":371 * * cdef inline int Read_IsReadOne(cAlignedRead* theRead): * return ( (theRead.bitFlag & BAM_FREAD1) != 0) # <<<<<<<<<<<<<< * * cdef inline int Read_IsSecondaryAlignment(cAlignedRead* theRead): */ __pyx_r = ((__pyx_v_theRead->bitFlag & 64) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pxd":373 * return ( (theRead.bitFlag & BAM_FREAD1) != 0) * * cdef inline int Read_IsSecondaryAlignment(cAlignedRead* theRead): # <<<<<<<<<<<<<< * return ( (theRead.bitFlag & BAM_FSECONDARY) != 0) * */ static CYTHON_INLINE int __pyx_f_15samtoolsWrapper_Read_IsSecondaryAlignment(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_theRead) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("Read_IsSecondaryAlignment", 0); /* "samtoolsWrapper.pxd":374 * * cdef inline int Read_IsSecondaryAlignment(cAlignedRead* theRead): * return ( (theRead.bitFlag & BAM_FSECONDARY) != 0) # <<<<<<<<<<<<<< * * cdef inline int Read_IsCompressed(cAlignedRead* theRead): */ __pyx_r = ((__pyx_v_theRead->bitFlag & 256) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pxd":376 * return ( (theRead.bitFlag & BAM_FSECONDARY) != 0) * * cdef inline int Read_IsCompressed(cAlignedRead* theRead): # <<<<<<<<<<<<<< * return ( (theRead.bitFlag & BAM_FCOMPRESSED) != 0) * */ static CYTHON_INLINE int __pyx_f_15samtoolsWrapper_Read_IsCompressed(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_theRead) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("Read_IsCompressed", 0); /* "samtoolsWrapper.pxd":377 * * cdef inline int Read_IsCompressed(cAlignedRead* theRead): * return ( (theRead.bitFlag & BAM_FCOMPRESSED) != 0) # <<<<<<<<<<<<<< * * cdef inline void Read_SetQCFail(cAlignedRead* theRead): */ __pyx_r = ((__pyx_v_theRead->bitFlag & 2048) != 0); goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "samtoolsWrapper.pxd":379 * return ( (theRead.bitFlag & BAM_FCOMPRESSED) != 0) * * cdef inline void Read_SetQCFail(cAlignedRead* theRead): # <<<<<<<<<<<<<< * theRead.bitFlag |= BAM_FQCFAIL * */ static CYTHON_INLINE void __pyx_f_15samtoolsWrapper_Read_SetQCFail(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_theRead) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("Read_SetQCFail", 0); /* "samtoolsWrapper.pxd":380 * * cdef inline void Read_SetQCFail(cAlignedRead* theRead): * theRead.bitFlag |= BAM_FQCFAIL # <<<<<<<<<<<<<< * * cdef inline void Read_SetCompressed(cAlignedRead* theRead): */ __pyx_v_theRead->bitFlag = (__pyx_v_theRead->bitFlag | 512); __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pxd":382 * theRead.bitFlag |= BAM_FQCFAIL * * cdef inline void Read_SetCompressed(cAlignedRead* theRead): # <<<<<<<<<<<<<< * theRead.bitFlag |= BAM_FCOMPRESSED * */ static CYTHON_INLINE void __pyx_f_15samtoolsWrapper_Read_SetCompressed(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_theRead) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("Read_SetCompressed", 0); /* "samtoolsWrapper.pxd":383 * * cdef inline void Read_SetCompressed(cAlignedRead* theRead): * theRead.bitFlag |= BAM_FCOMPRESSED # <<<<<<<<<<<<<< * * cdef inline void Read_SetUnCompressed(cAlignedRead* theRead): */ __pyx_v_theRead->bitFlag = (__pyx_v_theRead->bitFlag | 2048); __Pyx_RefNannyFinishContext(); } /* "samtoolsWrapper.pxd":385 * theRead.bitFlag |= BAM_FCOMPRESSED * * cdef inline void Read_SetUnCompressed(cAlignedRead* theRead): # <<<<<<<<<<<<<< * theRead.bitFlag &= (~BAM_FCOMPRESSED) * */ static CYTHON_INLINE void __pyx_f_15samtoolsWrapper_Read_SetUnCompressed(__pyx_t_15samtoolsWrapper_cAlignedRead *__pyx_v_theRead) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("Read_SetUnCompressed", 0); /* "samtoolsWrapper.pxd":386 * * cdef inline void Read_SetUnCompressed(cAlignedRead* theRead): * theRead.bitFlag &= (~BAM_FCOMPRESSED) # <<<<<<<<<<<<<< * * ################################################################################################### */ __pyx_v_theRead->bitFlag = (__pyx_v_theRead->bitFlag & (~2048)); __Pyx_RefNannyFinishContext(); } static struct __pyx_vtabstruct_15samtoolsWrapper_Samfile __pyx_vtable_15samtoolsWrapper_Samfile; static PyObject *__pyx_tp_new_15samtoolsWrapper_Samfile(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_15samtoolsWrapper_Samfile *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_15samtoolsWrapper_Samfile *)o); p->__pyx_vtab = __pyx_vtabptr_15samtoolsWrapper_Samfile; p->indexesByRegion = ((PyObject*)Py_None); Py_INCREF(Py_None); p->lock = Py_None; Py_INCREF(Py_None); if (__pyx_pw_15samtoolsWrapper_7Samfile_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } static void __pyx_tp_dealloc_15samtoolsWrapper_Samfile(PyObject *o) { struct __pyx_obj_15samtoolsWrapper_Samfile *p = (struct __pyx_obj_15samtoolsWrapper_Samfile *)o; { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pw_15samtoolsWrapper_7Samfile_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->indexesByRegion); Py_CLEAR(p->lock); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_15samtoolsWrapper_Samfile(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_15samtoolsWrapper_Samfile *p = (struct __pyx_obj_15samtoolsWrapper_Samfile *)o; if (p->indexesByRegion) { e = (*v)(p->indexesByRegion, a); if (e) return e; } if (p->lock) { e = (*v)(p->lock, a); if (e) return e; } return 0; } static int __pyx_tp_clear_15samtoolsWrapper_Samfile(PyObject *o) { struct __pyx_obj_15samtoolsWrapper_Samfile *p = (struct __pyx_obj_15samtoolsWrapper_Samfile *)o; PyObject* tmp; tmp = ((PyObject*)p->indexesByRegion); p->indexesByRegion = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->lock); p->lock = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyObject *__pyx_getprop_15samtoolsWrapper_7Samfile_nreferences(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_15samtoolsWrapper_7Samfile_11nreferences_1__get__(o); } static PyObject *__pyx_getprop_15samtoolsWrapper_7Samfile_references(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_15samtoolsWrapper_7Samfile_10references_1__get__(o); } static PyObject *__pyx_getprop_15samtoolsWrapper_7Samfile_lengths(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_15samtoolsWrapper_7Samfile_7lengths_1__get__(o); } static PyObject *__pyx_getprop_15samtoolsWrapper_7Samfile_text(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_15samtoolsWrapper_7Samfile_4text_1__get__(o); } static PyObject *__pyx_getprop_15samtoolsWrapper_7Samfile_header(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_15samtoolsWrapper_7Samfile_6header_1__get__(o); } static PyMethodDef __pyx_methods_15samtoolsWrapper_Samfile[] = { {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_15samtoolsWrapper_7Samfile_5__reduce__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_15samtoolsWrapper_7Samfile_4__reduce__)}, {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pw_15samtoolsWrapper_7Samfile_7_open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_15samtoolsWrapper_7Samfile_6_open)}, {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pw_15samtoolsWrapper_7Samfile_9fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_15samtoolsWrapper_7Samfile_8fetch)}, {__Pyx_NAMESTR("fetchAllReads"), (PyCFunction)__pyx_pw_15samtoolsWrapper_7Samfile_11fetchAllReads, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_15samtoolsWrapper_7Samfile_10fetchAllReads)}, {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_15samtoolsWrapper_7Samfile_13close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_15samtoolsWrapper_7Samfile_12close)}, {0, 0, 0, 0} }; static struct PyGetSetDef __pyx_getsets_15samtoolsWrapper_Samfile[] = { {(char *)"nreferences", __pyx_getprop_15samtoolsWrapper_7Samfile_nreferences, 0, __Pyx_DOCSTR(__pyx_k_61), 0}, {(char *)"references", __pyx_getprop_15samtoolsWrapper_7Samfile_references, 0, __Pyx_DOCSTR(__pyx_k_62), 0}, {(char *)"lengths", __pyx_getprop_15samtoolsWrapper_7Samfile_lengths, 0, __Pyx_DOCSTR(__pyx_k_63), 0}, {(char *)"text", __pyx_getprop_15samtoolsWrapper_7Samfile_text, 0, __Pyx_DOCSTR(__pyx_k_64), 0}, {(char *)"header", __pyx_getprop_15samtoolsWrapper_7Samfile_header, 0, __Pyx_DOCSTR(__pyx_k_65), 0}, {0, 0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_Samfile = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ #if PY_MAJOR_VERSION < 3 0, /*nb_long*/ #else 0, /*reserved*/ #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if PY_VERSION_HEX >= 0x02050000 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_Samfile = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_Samfile = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_Samfile = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; static PyTypeObject __pyx_type_15samtoolsWrapper_Samfile = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("samtoolsWrapper.Samfile"), /*tp_name*/ sizeof(struct __pyx_obj_15samtoolsWrapper_Samfile), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_15samtoolsWrapper_Samfile, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ &__pyx_tp_as_number_Samfile, /*tp_as_number*/ &__pyx_tp_as_sequence_Samfile, /*tp_as_sequence*/ &__pyx_tp_as_mapping_Samfile, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_Samfile, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ __Pyx_DOCSTR("\n *(filename, mode='r', referencenames = None, referencelengths = None, text = NULL, header = None)*\n\n A *SAM* file. The file is automatically opened.\n\n *mode* should be ``r`` for reading or ``w`` for writing. The default is text mode so for binary\n (:term:`BAM`) I/O you should append ``b`` for compressed or ``u`` for uncompressed :term:`BAM` output.\n Use ``h`` to output header information in text (:term:`TAM`) mode.\n\n If ``b`` is present, it must immediately follow ``r`` or ``w``.\n Currently valid modes are ``r``, ``w``, ``wh``, ``rb``, ``wb`` and ``wbu``.\n\n so to open a :term:`BAM` file for reading::\n\n f=Samfile('ex1.bam','rb')\n\n\n For writing, the header of a :term:`TAM` file/:term:`BAM` file can be constituted from several\n sources:\n\n 2. If *header* is given, the header is build from a multi-level dictionary. The first level are the four types ('HD', 'SQ', ...). The second level is then a list of lines, with each line being a list of tag-value pairs.\n\n 3. If *text* is given, new header text is copied from raw text.\n\n 4. The names (*referencenames*) and lengths (*referencelengths*) are supplied directly as lists.\n\n If an index for a BAM file exists (.bai), it will be opened automatically. Without an index random\n access to reads via :meth:`fetch` and :meth:`pileup` is disabled.\n "), /*tp_doc*/ __pyx_tp_traverse_15samtoolsWrapper_Samfile, /*tp_traverse*/ __pyx_tp_clear_15samtoolsWrapper_Samfile, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_15samtoolsWrapper_Samfile, /*tp_methods*/ 0, /*tp_members*/ __pyx_getsets_15samtoolsWrapper_Samfile, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_15samtoolsWrapper_Samfile, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif }; static struct __pyx_vtabstruct_15samtoolsWrapper_IteratorRow __pyx_vtable_15samtoolsWrapper_IteratorRow; static PyObject *__pyx_tp_new_15samtoolsWrapper_IteratorRow(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_15samtoolsWrapper_IteratorRow *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_15samtoolsWrapper_IteratorRow *)o); p->__pyx_vtab = __pyx_vtabptr_15samtoolsWrapper_IteratorRow; if (__pyx_pw_15samtoolsWrapper_11IteratorRow_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } static void __pyx_tp_dealloc_15samtoolsWrapper_IteratorRow(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pw_15samtoolsWrapper_11IteratorRow_5__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_15samtoolsWrapper_IteratorRow[] = { {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_15samtoolsWrapper_11IteratorRow_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_15samtoolsWrapper_11IteratorRow_2__reduce__)}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_IteratorRow = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ #if PY_MAJOR_VERSION < 3 0, /*nb_long*/ #else 0, /*reserved*/ #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if PY_VERSION_HEX >= 0x02050000 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_IteratorRow = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_IteratorRow = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_IteratorRow = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; static PyTypeObject __pyx_type_15samtoolsWrapper_IteratorRow = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("samtoolsWrapper.IteratorRow"), /*tp_name*/ sizeof(struct __pyx_obj_15samtoolsWrapper_IteratorRow), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_15samtoolsWrapper_IteratorRow, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ &__pyx_tp_as_number_IteratorRow, /*tp_as_number*/ &__pyx_tp_as_sequence_IteratorRow, /*tp_as_sequence*/ &__pyx_tp_as_mapping_IteratorRow, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_IteratorRow, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ __Pyx_DOCSTR("\n Iterates over mapped reads in a region.\n "), /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_15samtoolsWrapper_IteratorRow, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_15samtoolsWrapper_IteratorRow, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif }; static struct __pyx_vtabstruct_15samtoolsWrapper_IteratorRowAll __pyx_vtable_15samtoolsWrapper_IteratorRowAll; static PyObject *__pyx_tp_new_15samtoolsWrapper_IteratorRowAll(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *)o); p->__pyx_vtab = __pyx_vtabptr_15samtoolsWrapper_IteratorRowAll; if (__pyx_pw_15samtoolsWrapper_14IteratorRowAll_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; } static void __pyx_tp_dealloc_15samtoolsWrapper_IteratorRowAll(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pw_15samtoolsWrapper_14IteratorRowAll_7__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_15samtoolsWrapper_IteratorRowAll[] = { {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_15samtoolsWrapper_14IteratorRowAll_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_15samtoolsWrapper_14IteratorRowAll_4__next__)}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_IteratorRowAll = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ #if PY_MAJOR_VERSION < 3 0, /*nb_long*/ #else 0, /*reserved*/ #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if PY_VERSION_HEX >= 0x02050000 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_IteratorRowAll = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_IteratorRowAll = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_IteratorRowAll = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; static PyTypeObject __pyx_type_15samtoolsWrapper_IteratorRowAll = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("samtoolsWrapper.IteratorRowAll"), /*tp_name*/ sizeof(struct __pyx_obj_15samtoolsWrapper_IteratorRowAll), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_15samtoolsWrapper_IteratorRowAll, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ &__pyx_tp_as_number_IteratorRowAll, /*tp_as_number*/ &__pyx_tp_as_sequence_IteratorRowAll, /*tp_as_sequence*/ &__pyx_tp_as_mapping_IteratorRowAll, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_IteratorRowAll, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ __Pyx_DOCSTR("\n iterates over all mapped reads\n "), /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ __pyx_pw_15samtoolsWrapper_14IteratorRowAll_3__iter__, /*tp_iter*/ __pyx_pw_15samtoolsWrapper_14IteratorRowAll_5__next__, /*tp_iternext*/ __pyx_methods_15samtoolsWrapper_IteratorRowAll, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_15samtoolsWrapper_IteratorRowAll, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif }; static struct __pyx_vtabstruct_15samtoolsWrapper_AlignedRead __pyx_vtable_15samtoolsWrapper_AlignedRead; static PyObject *__pyx_tp_new_15samtoolsWrapper_AlignedRead(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_15samtoolsWrapper_AlignedRead *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_15samtoolsWrapper_AlignedRead *)o); p->__pyx_vtab = __pyx_vtabptr_15samtoolsWrapper_AlignedRead; if (__pyx_pw_15samtoolsWrapper_11AlignedRead_1__cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } return o; } static void __pyx_tp_dealloc_15samtoolsWrapper_AlignedRead(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pw_15samtoolsWrapper_11AlignedRead_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_15samtoolsWrapper_AlignedRead[] = { {__Pyx_NAMESTR("qname"), (PyCFunction)__pyx_pw_15samtoolsWrapper_11AlignedRead_11qname, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_15samtoolsWrapper_11AlignedRead_10qname)}, {__Pyx_NAMESTR("mapq"), (PyCFunction)__pyx_pw_15samtoolsWrapper_11AlignedRead_13mapq, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_15samtoolsWrapper_11AlignedRead_12mapq)}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_AlignedRead = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ #if PY_MAJOR_VERSION < 3 0, /*nb_long*/ #else 0, /*reserved*/ #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if PY_VERSION_HEX >= 0x02050000 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_AlignedRead = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_AlignedRead = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_AlignedRead = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; static PyTypeObject __pyx_type_15samtoolsWrapper_AlignedRead = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("samtoolsWrapper.AlignedRead"), /*tp_name*/ sizeof(struct __pyx_obj_15samtoolsWrapper_AlignedRead), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_15samtoolsWrapper_AlignedRead, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ &__pyx_tp_as_number_AlignedRead, /*tp_as_number*/ &__pyx_tp_as_sequence_AlignedRead, /*tp_as_sequence*/ &__pyx_tp_as_mapping_AlignedRead, /*tp_as_mapping*/ __pyx_pw_15samtoolsWrapper_11AlignedRead_9__hash__, /*tp_hash*/ 0, /*tp_call*/ __pyx_pw_15samtoolsWrapper_11AlignedRead_5__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_AlignedRead, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ __Pyx_DOCSTR("\n Class representing an aligned read. see SAM format specification for meaning of\n fields (http://samtools.sourceforge.net/).\n\n This class stores a handle to the samtools C-structure representing\n an aligned read. Member read access is forwarded to the C-structure\n and converted into python objects. This implementation should be fast,\n as only the data needed is converted.\n\n For write access, the C-structure is updated in-place. This is\n not the most efficient way to build BAM entries, as the variable\n length data is concatenated and thus needs to resized if\n a field is updated. Furthermore, the BAM entry might be\n in an inconsistent state. The :meth:`~validate` method can\n be used to check if an entry is consistent.\n\n One issue to look out for is that the sequence should always\n be set *before* the quality scores. Setting the sequence will\n also erase any quality scores that were set previously.\n "), /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ __pyx_pw_15samtoolsWrapper_11AlignedRead_7__richcmp__, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_15samtoolsWrapper_AlignedRead, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_15samtoolsWrapper_AlignedRead, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif }; static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("samtoolsWrapper"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0}, {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0}, {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0}, {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0}, {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0}, {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0}, {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0}, {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0}, {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0}, {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0}, {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0}, {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0}, {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0}, {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0}, {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0}, {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0}, {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0}, {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0}, {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0}, {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0}, {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0}, {&__pyx_kp_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 0}, {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0}, {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0}, {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0}, {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0}, {&__pyx_kp_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 0}, {&__pyx_kp_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0}, {&__pyx_kp_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 0}, {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0}, {&__pyx_kp_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 0}, {&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0}, {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0}, {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0}, {&__pyx_kp_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 0}, {&__pyx_kp_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 0}, {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, {&__pyx_kp_s_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 0, 1, 0}, {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, {&__pyx_n_s__A, __pyx_k__A, sizeof(__pyx_k__A), 0, 0, 1, 1}, {&__pyx_n_s__AS, __pyx_k__AS, sizeof(__pyx_k__AS), 0, 0, 1, 1}, {&__pyx_n_s__C, __pyx_k__C, sizeof(__pyx_k__C), 0, 0, 1, 1}, {&__pyx_n_s__CL, __pyx_k__CL, sizeof(__pyx_k__CL), 0, 0, 1, 1}, {&__pyx_n_s__CN, __pyx_k__CN, sizeof(__pyx_k__CN), 0, 0, 1, 1}, {&__pyx_n_s__CO, __pyx_k__CO, sizeof(__pyx_k__CO), 0, 0, 1, 1}, {&__pyx_n_s__DS, __pyx_k__DS, sizeof(__pyx_k__DS), 0, 0, 1, 1}, {&__pyx_n_s__DT, __pyx_k__DT, sizeof(__pyx_k__DT), 0, 0, 1, 1}, {&__pyx_n_s__GO, __pyx_k__GO, sizeof(__pyx_k__GO), 0, 0, 1, 1}, {&__pyx_n_s__HD, __pyx_k__HD, sizeof(__pyx_k__HD), 0, 0, 1, 1}, {&__pyx_n_s__ID, __pyx_k__ID, sizeof(__pyx_k__ID), 0, 0, 1, 1}, {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1}, {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1}, {&__pyx_n_s__LB, __pyx_k__LB, sizeof(__pyx_k__LB), 0, 0, 1, 1}, {&__pyx_n_s__LN, __pyx_k__LN, sizeof(__pyx_k__LN), 0, 0, 1, 1}, {&__pyx_n_s__Log, __pyx_k__Log, sizeof(__pyx_k__Log), 0, 0, 1, 1}, {&__pyx_n_s__M5, __pyx_k__M5, sizeof(__pyx_k__M5), 0, 0, 1, 1}, {&__pyx_n_s__PG, __pyx_k__PG, sizeof(__pyx_k__PG), 0, 0, 1, 1}, {&__pyx_n_s__PI, __pyx_k__PI, sizeof(__pyx_k__PI), 0, 0, 1, 1}, {&__pyx_n_s__PL, __pyx_k__PL, sizeof(__pyx_k__PL), 0, 0, 1, 1}, {&__pyx_n_s__PN, __pyx_k__PN, sizeof(__pyx_k__PN), 0, 0, 1, 1}, {&__pyx_n_s__PP, __pyx_k__PP, sizeof(__pyx_k__PP), 0, 0, 1, 1}, {&__pyx_n_s__PU, __pyx_k__PU, sizeof(__pyx_k__PU), 0, 0, 1, 1}, {&__pyx_n_s__RG, __pyx_k__RG, sizeof(__pyx_k__RG), 0, 0, 1, 1}, {&__pyx_n_s__S, __pyx_k__S, sizeof(__pyx_k__S), 0, 0, 1, 1}, {&__pyx_n_s__SM, __pyx_k__SM, sizeof(__pyx_k__SM), 0, 0, 1, 1}, {&__pyx_n_s__SN, __pyx_k__SN, sizeof(__pyx_k__SN), 0, 0, 1, 1}, {&__pyx_n_s__SO, __pyx_k__SO, sizeof(__pyx_k__SO), 0, 0, 1, 1}, {&__pyx_n_s__SP, __pyx_k__SP, sizeof(__pyx_k__SP), 0, 0, 1, 1}, {&__pyx_n_s__SQ, __pyx_k__SQ, sizeof(__pyx_k__SQ), 0, 0, 1, 1}, {&__pyx_n_s__StandardError, __pyx_k__StandardError, sizeof(__pyx_k__StandardError), 0, 0, 1, 1}, {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1}, {&__pyx_n_s__UR, __pyx_k__UR, sizeof(__pyx_k__UR), 0, 0, 1, 1}, {&__pyx_n_s__VALID_HEADERS, __pyx_k__VALID_HEADERS, sizeof(__pyx_k__VALID_HEADERS), 0, 0, 1, 1}, {&__pyx_n_s__VALID_HEADER_FIELDS, __pyx_k__VALID_HEADER_FIELDS, sizeof(__pyx_k__VALID_HEADER_FIELDS), 0, 0, 1, 1}, {&__pyx_n_s__VALID_HEADER_ORDER, __pyx_k__VALID_HEADER_ORDER, sizeof(__pyx_k__VALID_HEADER_ORDER), 0, 0, 1, 1}, {&__pyx_n_s__VALID_HEADER_TYPES, __pyx_k__VALID_HEADER_TYPES, sizeof(__pyx_k__VALID_HEADER_TYPES), 0, 0, 1, 1}, {&__pyx_n_s__VN, __pyx_k__VN, sizeof(__pyx_k__VN), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s__Z, __pyx_k__Z, sizeof(__pyx_k__Z), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s___open, __pyx_k___open, sizeof(__pyx_k___open), 0, 0, 1, 1}, {&__pyx_n_s__b, __pyx_k__b, sizeof(__pyx_k__b), 0, 0, 1, 1}, {&__pyx_n_s__bamIterPointer, __pyx_k__bamIterPointer, sizeof(__pyx_k__bamIterPointer), 0, 0, 1, 1}, {&__pyx_n_s__beg, __pyx_k__beg, sizeof(__pyx_k__beg), 0, 0, 1, 1}, {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1}, {&__pyx_n_s__chr, __pyx_k__chr, sizeof(__pyx_k__chr), 0, 0, 1, 1}, {&__pyx_n_s__cigar, __pyx_k__cigar, sizeof(__pyx_k__cigar), 0, 0, 1, 1}, {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1}, {&__pyx_n_s__d, __pyx_k__d, sizeof(__pyx_k__d), 0, 0, 1, 1}, {&__pyx_n_s__debug, __pyx_k__debug, sizeof(__pyx_k__debug), 0, 0, 1, 1}, {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1}, {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1}, {&__pyx_n_s__error, __pyx_k__error, sizeof(__pyx_k__error), 0, 0, 1, 1}, {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1}, {&__pyx_n_s__fetch, __pyx_k__fetch, sizeof(__pyx_k__fetch), 0, 0, 1, 1}, {&__pyx_n_s__fetchAllReads, __pyx_k__fetchAllReads, sizeof(__pyx_k__fetchAllReads), 0, 0, 1, 1}, {&__pyx_n_s__fileName, __pyx_k__fileName, sizeof(__pyx_k__fileName), 0, 0, 1, 1}, {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1}, {&__pyx_n_s__getLogger, __pyx_k__getLogger, sizeof(__pyx_k__getLogger), 0, 0, 1, 1}, {&__pyx_n_s__h, __pyx_k__h, sizeof(__pyx_k__h), 0, 0, 1, 1}, {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__indexFilePointer, __pyx_k__indexFilePointer, sizeof(__pyx_k__indexFilePointer), 0, 0, 1, 1}, {&__pyx_n_s__indexesByRegion, __pyx_k__indexesByRegion, sizeof(__pyx_k__indexesByRegion), 0, 0, 1, 1}, {&__pyx_n_s__isbam, __pyx_k__isbam, sizeof(__pyx_k__isbam), 0, 0, 1, 1}, {&__pyx_n_s__itertools, __pyx_k__itertools, sizeof(__pyx_k__itertools), 0, 0, 1, 1}, {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1}, {&__pyx_n_s__loadIndex, __pyx_k__loadIndex, sizeof(__pyx_k__loadIndex), 0, 0, 1, 1}, {&__pyx_n_s__logger, __pyx_k__logger, sizeof(__pyx_k__logger), 0, 0, 1, 1}, {&__pyx_n_s__logging, __pyx_k__logging, sizeof(__pyx_k__logging), 0, 0, 1, 1}, {&__pyx_n_s__map, __pyx_k__map, sizeof(__pyx_k__map), 0, 0, 1, 1}, {&__pyx_n_s__mapq, __pyx_k__mapq, sizeof(__pyx_k__mapq), 0, 0, 1, 1}, {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1}, {&__pyx_n_s__os, __pyx_k__os, sizeof(__pyx_k__os), 0, 0, 1, 1}, {&__pyx_n_s__qname, __pyx_k__qname, sizeof(__pyx_k__qname), 0, 0, 1, 1}, {&__pyx_n_s__r, __pyx_k__r, sizeof(__pyx_k__r), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__rb, __pyx_k__rb, sizeof(__pyx_k__rb), 0, 0, 1, 1}, {&__pyx_n_s__rbh, __pyx_k__rbh, sizeof(__pyx_k__rbh), 0, 0, 1, 1}, {&__pyx_n_s__reference, __pyx_k__reference, sizeof(__pyx_k__reference), 0, 0, 1, 1}, {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1}, {&__pyx_n_s__samFilePointer, __pyx_k__samFilePointer, sizeof(__pyx_k__samFilePointer), 0, 0, 1, 1}, {&__pyx_n_s__samfile, __pyx_k__samfile, sizeof(__pyx_k__samfile), 0, 0, 1, 1}, {&__pyx_n_s__samtoolsWrapper, __pyx_k__samtoolsWrapper, sizeof(__pyx_k__samtoolsWrapper), 0, 0, 1, 1}, {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, {&__pyx_n_s__startswith, __pyx_k__startswith, sizeof(__pyx_k__startswith), 0, 0, 1, 1}, {&__pyx_n_s__strip, __pyx_k__strip, sizeof(__pyx_k__strip), 0, 0, 1, 1}, {&__pyx_n_s__text, __pyx_k__text, sizeof(__pyx_k__text), 0, 0, 1, 1}, {&__pyx_n_s__theFile, __pyx_k__theFile, sizeof(__pyx_k__theFile), 0, 0, 1, 1}, {&__pyx_n_s__theIt, __pyx_k__theIt, sizeof(__pyx_k__theIt), 0, 0, 1, 1}, {&__pyx_n_s__tid, __pyx_k__tid, sizeof(__pyx_k__tid), 0, 0, 1, 1}, {&__pyx_n_s__types, __pyx_k__types, sizeof(__pyx_k__types), 0, 0, 1, 1}, {&__pyx_n_s__unpickleIteratorRow, __pyx_k__unpickleIteratorRow, sizeof(__pyx_k__unpickleIteratorRow), 0, 0, 1, 1}, {&__pyx_n_s__unpickleSamfile, __pyx_k__unpickleSamfile, sizeof(__pyx_k__unpickleSamfile), 0, 0, 1, 1}, {&__pyx_n_s__useIndex, __pyx_k__useIndex, sizeof(__pyx_k__useIndex), 0, 0, 1, 1}, {&__pyx_n_s__zlib, __pyx_k__zlib, sizeof(__pyx_k__zlib), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_StandardError = __Pyx_GetName(__pyx_b, __pyx_n_s__StandardError); if (!__pyx_builtin_StandardError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_map = __Pyx_GetName(__pyx_b, __pyx_n_s__map); if (!__pyx_builtin_map) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_chr = __Pyx_GetName(__pyx_b, __pyx_n_s__chr); if (!__pyx_builtin_chr) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "samtoolsWrapper.pyx":423 * * if self.samfile.x.bam.uncompressed_block == NULL: * logger.error("Could not allocate BAM BGZF buffer in Samfile.createCache()") # <<<<<<<<<<<<<< * raise StandardError, "Out of memory" * */ __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); /* "samtoolsWrapper.pyx":430 * * if self.samfile.x.bam.compressed_block == NULL: * logger.error("Could not allocate BAM BGZF buffer in Samfile.createCache()") # <<<<<<<<<<<<<< * raise StandardError, "Out of memory" * */ __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); /* "samtoolsWrapper.pyx":446 * * if self.samfile == NULL: * data = (None,) + data[1:] # <<<<<<<<<<<<<< * * if self.index == NULL: */ __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_5); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); /* "samtoolsWrapper.pyx":449 * * if self.index == NULL: * data = data[0:1] + (None,) + data[2:] # <<<<<<<<<<<<<< * * #logger.debug("Done Calling Samfile reduce") */ __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); /* "samtoolsWrapper.pyx":536 * * if not self._isOpen(): * self._open('rbh', loadIndex=True) # Change to False # <<<<<<<<<<<<<< * * if self.index == NULL: */ __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_INCREF(((PyObject *)__pyx_n_s__rbh)); PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_n_s__rbh)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rbh)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); /* "samtoolsWrapper.pyx":626 * # Don't need to load the index, since we already have the pre-computed offsets * if not self._isOpen(): * self._open('rb', loadIndex=False) # <<<<<<<<<<<<<< * * # Re-create cache for BGZF file, if required. */ __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_22); __Pyx_INCREF(((PyObject *)__pyx_n_s__rb)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_n_s__rb)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rb)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); /* "samtoolsWrapper.pyx":641 * # Need to load the index for new queries. * if not self._isOpen(): * self._open('rbh', loadIndex=True) # Change to False # <<<<<<<<<<<<<< * * # Re-create cache for BGZF file, if required. */ __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_24); __Pyx_INCREF(((PyObject *)__pyx_n_s__rbh)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_n_s__rbh)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rbh)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); /* "samtoolsWrapper.pyx":657 * ''' * if not self._isOpen(): * raise ValueError("BAM file is not open. Cannot return reads.") # <<<<<<<<<<<<<< * * if self.isbam: */ __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_26); __Pyx_INCREF(((PyObject *)__pyx_kp_s_25)); PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_25)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); /* "samtoolsWrapper.pyx":717 * # convert to python string (note: call self.text to create 0-terminated string) * t = self.text * for line in t.split("\n"): # <<<<<<<<<<<<<< * if not line.strip(): continue * */ __pyx_k_tuple_28 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_28); __Pyx_INCREF(((PyObject *)__pyx_kp_s_27)); PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_kp_s_27)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_27)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); /* "samtoolsWrapper.pyx":720 * if not line.strip(): continue * * if not line.startswith("@"): # <<<<<<<<<<<<<< * raise StandardError, "Header line without '@': '%s. Total header text is %s'" % (line,t) * */ __pyx_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_30); __Pyx_INCREF(((PyObject *)__pyx_kp_s_29)); PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_kp_s_29)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); /* "samtoolsWrapper.pyx":723 * raise StandardError, "Header line without '@': '%s. Total header text is %s'" % (line,t) * * fields = line[1:].split("\t") # <<<<<<<<<<<<<< * record = fields[0] * assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line) */ __pyx_k_tuple_33 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_33); __Pyx_INCREF(((PyObject *)__pyx_kp_s_32)); PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_kp_s_32)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_32)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33)); /* "samtoolsWrapper.pyx":736 * x = {} * for field in fields[1:]: * key, value = field.split(":",1) # <<<<<<<<<<<<<< * if key not in VALID_HEADER_FIELDS[record]: * raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) ) */ __pyx_k_tuple_36 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_36); __Pyx_INCREF(((PyObject *)__pyx_kp_s_35)); PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_kp_s_35)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_35)); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_36, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36)); /* "samtoolsWrapper.pyx":762 * """ * """ * logger.debug("Calling IteratorRow unpickle") # <<<<<<<<<<<<<< * * cdef IteratorRow theIt = IteratorRow(samfile, 0, 0, 0, 0) */ __pyx_k_tuple_40 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_40); __Pyx_INCREF(((PyObject *)__pyx_kp_s_39)); PyTuple_SET_ITEM(__pyx_k_tuple_40, 0, ((PyObject *)__pyx_kp_s_39)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_39)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40)); /* "samtoolsWrapper.pyx":772 * * theIt.useIndex = useIndex * logger.debug("Done Calling IteratorRow unpickle") # <<<<<<<<<<<<<< * * return theIt */ __pyx_k_tuple_42 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_42); __Pyx_INCREF(((PyObject *)__pyx_kp_s_41)); PyTuple_SET_ITEM(__pyx_k_tuple_42, 0, ((PyObject *)__pyx_kp_s_41)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42)); /* "samtoolsWrapper.pyx":812 * object. * """ * logger.debug("Calling IteratorRow reduce") # <<<<<<<<<<<<<< * * cdef int bamIter = (self.bam_iter) */ __pyx_k_tuple_46 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_46); __Pyx_INCREF(((PyObject *)__pyx_kp_s_45)); PyTuple_SET_ITEM(__pyx_k_tuple_46, 0, ((PyObject *)__pyx_kp_s_45)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_45)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46)); /* "samtoolsWrapper.pyx":820 * * if self.bam_iter == NULL: * data = data[0:1] + (None,) + data[2:] # <<<<<<<<<<<<<< * * logger.debug("Done Calling IteratorRow reduce") */ __pyx_k_tuple_47 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_47); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47)); /* "samtoolsWrapper.pyx":822 * data = data[0:1] + (None,) + data[2:] * * logger.debug("Done Calling IteratorRow reduce") # <<<<<<<<<<<<<< * return (unpickleIteratorRow, data) * */ __pyx_k_tuple_49 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_49); __Pyx_INCREF(((PyObject *)__pyx_kp_s_48)); PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, ((PyObject *)__pyx_kp_s_48)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49)); /* "samtoolsWrapper.pyx":10 * ################################################################################################### * * logger = logging.getLogger("Log") # <<<<<<<<<<<<<< * * ################################################################################################### */ __pyx_k_tuple_66 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_66); __Pyx_INCREF(((PyObject *)__pyx_n_s__Log)); PyTuple_SET_ITEM(__pyx_k_tuple_66, 0, ((PyObject *)__pyx_n_s__Log)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Log)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66)); /* "samtoolsWrapper.pyx":274 * * # order of records within sam headers * VALID_HEADERS = ("HD", "SQ", "RG", "PG", "CO" ) # <<<<<<<<<<<<<< * * # type conversions within sam header records */ __pyx_k_tuple_67 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_67); __Pyx_INCREF(((PyObject *)__pyx_n_s__HD)); PyTuple_SET_ITEM(__pyx_k_tuple_67, 0, ((PyObject *)__pyx_n_s__HD)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__HD)); __Pyx_INCREF(((PyObject *)__pyx_n_s__SQ)); PyTuple_SET_ITEM(__pyx_k_tuple_67, 1, ((PyObject *)__pyx_n_s__SQ)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SQ)); __Pyx_INCREF(((PyObject *)__pyx_n_s__RG)); PyTuple_SET_ITEM(__pyx_k_tuple_67, 2, ((PyObject *)__pyx_n_s__RG)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RG)); __Pyx_INCREF(((PyObject *)__pyx_n_s__PG)); PyTuple_SET_ITEM(__pyx_k_tuple_67, 3, ((PyObject *)__pyx_n_s__PG)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PG)); __Pyx_INCREF(((PyObject *)__pyx_n_s__CO)); PyTuple_SET_ITEM(__pyx_k_tuple_67, 4, ((PyObject *)__pyx_n_s__CO)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CO)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67)); /* "samtoolsWrapper.pyx":283 * * # output order of fields within records * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ), # <<<<<<<<<<<<<< * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), */ __pyx_k_tuple_68 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_68); __Pyx_INCREF(((PyObject *)__pyx_n_s__VN)); PyTuple_SET_ITEM(__pyx_k_tuple_68, 0, ((PyObject *)__pyx_n_s__VN)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VN)); __Pyx_INCREF(((PyObject *)__pyx_n_s__SO)); PyTuple_SET_ITEM(__pyx_k_tuple_68, 1, ((PyObject *)__pyx_n_s__SO)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SO)); __Pyx_INCREF(((PyObject *)__pyx_n_s__GO)); PyTuple_SET_ITEM(__pyx_k_tuple_68, 2, ((PyObject *)__pyx_n_s__GO)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__GO)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68)); /* "samtoolsWrapper.pyx":284 * # output order of fields within records * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ), * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), # <<<<<<<<<<<<<< * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), * "PG" : ( "ID", "VN", "CL" ), } */ __pyx_k_tuple_69 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_69); __Pyx_INCREF(((PyObject *)__pyx_n_s__SN)); PyTuple_SET_ITEM(__pyx_k_tuple_69, 0, ((PyObject *)__pyx_n_s__SN)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SN)); __Pyx_INCREF(((PyObject *)__pyx_n_s__LN)); PyTuple_SET_ITEM(__pyx_k_tuple_69, 1, ((PyObject *)__pyx_n_s__LN)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LN)); __Pyx_INCREF(((PyObject *)__pyx_n_s__AS)); PyTuple_SET_ITEM(__pyx_k_tuple_69, 2, ((PyObject *)__pyx_n_s__AS)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__AS)); __Pyx_INCREF(((PyObject *)__pyx_n_s__M5)); PyTuple_SET_ITEM(__pyx_k_tuple_69, 3, ((PyObject *)__pyx_n_s__M5)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__M5)); __Pyx_INCREF(((PyObject *)__pyx_n_s__UR)); PyTuple_SET_ITEM(__pyx_k_tuple_69, 4, ((PyObject *)__pyx_n_s__UR)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__UR)); __Pyx_INCREF(((PyObject *)__pyx_n_s__SP)); PyTuple_SET_ITEM(__pyx_k_tuple_69, 5, ((PyObject *)__pyx_n_s__SP)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SP)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_69)); /* "samtoolsWrapper.pyx":285 * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ), * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), # <<<<<<<<<<<<<< * "PG" : ( "ID", "VN", "CL" ), } * */ __pyx_k_tuple_70 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_70); __Pyx_INCREF(((PyObject *)__pyx_n_s__ID)); PyTuple_SET_ITEM(__pyx_k_tuple_70, 0, ((PyObject *)__pyx_n_s__ID)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ID)); __Pyx_INCREF(((PyObject *)__pyx_n_s__SM)); PyTuple_SET_ITEM(__pyx_k_tuple_70, 1, ((PyObject *)__pyx_n_s__SM)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SM)); __Pyx_INCREF(((PyObject *)__pyx_n_s__LB)); PyTuple_SET_ITEM(__pyx_k_tuple_70, 2, ((PyObject *)__pyx_n_s__LB)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LB)); __Pyx_INCREF(((PyObject *)__pyx_n_s__DS)); PyTuple_SET_ITEM(__pyx_k_tuple_70, 3, ((PyObject *)__pyx_n_s__DS)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DS)); __Pyx_INCREF(((PyObject *)__pyx_n_s__PU)); PyTuple_SET_ITEM(__pyx_k_tuple_70, 4, ((PyObject *)__pyx_n_s__PU)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PU)); __Pyx_INCREF(((PyObject *)__pyx_n_s__PI)); PyTuple_SET_ITEM(__pyx_k_tuple_70, 5, ((PyObject *)__pyx_n_s__PI)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PI)); __Pyx_INCREF(((PyObject *)__pyx_n_s__CN)); PyTuple_SET_ITEM(__pyx_k_tuple_70, 6, ((PyObject *)__pyx_n_s__CN)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CN)); __Pyx_INCREF(((PyObject *)__pyx_n_s__DT)); PyTuple_SET_ITEM(__pyx_k_tuple_70, 7, ((PyObject *)__pyx_n_s__DT)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DT)); __Pyx_INCREF(((PyObject *)__pyx_n_s__PL)); PyTuple_SET_ITEM(__pyx_k_tuple_70, 8, ((PyObject *)__pyx_n_s__PL)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PL)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70)); /* "samtoolsWrapper.pyx":286 * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), * "PG" : ( "ID", "VN", "CL" ), } # <<<<<<<<<<<<<< * * ###################################################################### */ __pyx_k_tuple_71 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_71); __Pyx_INCREF(((PyObject *)__pyx_n_s__ID)); PyTuple_SET_ITEM(__pyx_k_tuple_71, 0, ((PyObject *)__pyx_n_s__ID)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ID)); __Pyx_INCREF(((PyObject *)__pyx_n_s__VN)); PyTuple_SET_ITEM(__pyx_k_tuple_71, 1, ((PyObject *)__pyx_n_s__VN)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VN)); __Pyx_INCREF(((PyObject *)__pyx_n_s__CL)); PyTuple_SET_ITEM(__pyx_k_tuple_71, 2, ((PyObject *)__pyx_n_s__CL)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CL)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_71)); /* "samtoolsWrapper.pyx":292 * ###################################################################### * * def unpickleSamfile(samFilePointer, indexFilePointer, indexesByRegion, isbam, filename): # <<<<<<<<<<<<<< * """ * """ */ __pyx_k_tuple_72 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_72); __Pyx_INCREF(((PyObject *)__pyx_n_s__samFilePointer)); PyTuple_SET_ITEM(__pyx_k_tuple_72, 0, ((PyObject *)__pyx_n_s__samFilePointer)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__samFilePointer)); __Pyx_INCREF(((PyObject *)__pyx_n_s__indexFilePointer)); PyTuple_SET_ITEM(__pyx_k_tuple_72, 1, ((PyObject *)__pyx_n_s__indexFilePointer)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexFilePointer)); __Pyx_INCREF(((PyObject *)__pyx_n_s__indexesByRegion)); PyTuple_SET_ITEM(__pyx_k_tuple_72, 2, ((PyObject *)__pyx_n_s__indexesByRegion)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexesByRegion)); __Pyx_INCREF(((PyObject *)__pyx_n_s__isbam)); PyTuple_SET_ITEM(__pyx_k_tuple_72, 3, ((PyObject *)__pyx_n_s__isbam)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__isbam)); __Pyx_INCREF(((PyObject *)__pyx_n_s__filename)); PyTuple_SET_ITEM(__pyx_k_tuple_72, 4, ((PyObject *)__pyx_n_s__filename)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filename)); __Pyx_INCREF(((PyObject *)__pyx_n_s__theFile)); PyTuple_SET_ITEM(__pyx_k_tuple_72, 5, ((PyObject *)__pyx_n_s__theFile)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__theFile)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_72)); __pyx_k_codeobj_73 = (PyObject*)__Pyx_PyCode_New(5, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_74, __pyx_n_s__unpickleSamfile, 292, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "samtoolsWrapper.pyx":759 * ################################################################################################### * * def unpickleIteratorRow(samfile, bamIterPointer, useIndex): # <<<<<<<<<<<<<< * """ * """ */ __pyx_k_tuple_75 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_75); __Pyx_INCREF(((PyObject *)__pyx_n_s__samfile)); PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, ((PyObject *)__pyx_n_s__samfile)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__samfile)); __Pyx_INCREF(((PyObject *)__pyx_n_s__bamIterPointer)); PyTuple_SET_ITEM(__pyx_k_tuple_75, 1, ((PyObject *)__pyx_n_s__bamIterPointer)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bamIterPointer)); __Pyx_INCREF(((PyObject *)__pyx_n_s__useIndex)); PyTuple_SET_ITEM(__pyx_k_tuple_75, 2, ((PyObject *)__pyx_n_s__useIndex)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__useIndex)); __Pyx_INCREF(((PyObject *)__pyx_n_s__theIt)); PyTuple_SET_ITEM(__pyx_k_tuple_75, 3, ((PyObject *)__pyx_n_s__theIt)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__theIt)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75)); __pyx_k_codeobj_76 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_74, __pyx_n_s__unpickleIteratorRow, 759, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC initsamtoolsWrapper(void); /*proto*/ PyMODINIT_FUNC initsamtoolsWrapper(void) #else PyMODINIT_FUNC PyInit_samtoolsWrapper(void); /*proto*/ PyMODINIT_FUNC PyInit_samtoolsWrapper(void) #endif { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_samtoolsWrapper(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __Pyx_CyFunction_USED if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("samtoolsWrapper"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!PyDict_GetItemString(modules, "samtoolsWrapper")) { if (unlikely(PyDict_SetItemString(modules, "samtoolsWrapper", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_samtoolsWrapper) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ if (__Pyx_ExportFunction("makeAlignedRead", (void (*)(void))__pyx_f_15samtoolsWrapper_makeAlignedRead, "struct __pyx_obj_15samtoolsWrapper_AlignedRead *(bam1_t *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ExportFunction("createRead", (void (*)(void))__pyx_f_15samtoolsWrapper_createRead, "__pyx_t_15samtoolsWrapper_cAlignedRead *(bam1_t *, int, char **)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ExportFunction("destroyRead", (void (*)(void))__pyx_f_15samtoolsWrapper_destroyRead, "void (__pyx_t_15samtoolsWrapper_cAlignedRead *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ExportFunction("compressRead", (void (*)(void))__pyx_f_15samtoolsWrapper_compressRead, "void (__pyx_t_15samtoolsWrapper_cAlignedRead *, char *, int, int, int, int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ExportFunction("uncompressRead", (void (*)(void))__pyx_f_15samtoolsWrapper_uncompressRead, "void (__pyx_t_15samtoolsWrapper_cAlignedRead *, char *, int, int, int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Type init code ---*/ __pyx_vtabptr_15samtoolsWrapper_Samfile = &__pyx_vtable_15samtoolsWrapper_Samfile; __pyx_vtable_15samtoolsWrapper_Samfile.clearHeader = (void (*)(struct __pyx_obj_15samtoolsWrapper_Samfile *))__pyx_f_15samtoolsWrapper_7Samfile_clearHeader; __pyx_vtable_15samtoolsWrapper_Samfile.clearIndex = (void (*)(struct __pyx_obj_15samtoolsWrapper_Samfile *))__pyx_f_15samtoolsWrapper_7Samfile_clearIndex; __pyx_vtable_15samtoolsWrapper_Samfile.createCache = (void (*)(struct __pyx_obj_15samtoolsWrapper_Samfile *))__pyx_f_15samtoolsWrapper_7Samfile_createCache; __pyx_vtable_15samtoolsWrapper_Samfile.clearCache = (void (*)(struct __pyx_obj_15samtoolsWrapper_Samfile *))__pyx_f_15samtoolsWrapper_7Samfile_clearCache; __pyx_vtable_15samtoolsWrapper_Samfile._isOpen = (int (*)(struct __pyx_obj_15samtoolsWrapper_Samfile *))__pyx_f_15samtoolsWrapper_7Samfile__isOpen; __pyx_vtable_15samtoolsWrapper_Samfile._hasIndex = (PyObject *(*)(struct __pyx_obj_15samtoolsWrapper_Samfile *))__pyx_f_15samtoolsWrapper_7Samfile__hasIndex; __pyx_vtable_15samtoolsWrapper_Samfile._open = (PyObject *(*)(struct __pyx_obj_15samtoolsWrapper_Samfile *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_15samtoolsWrapper_7Samfile__open *__pyx_optional_args))__pyx_f_15samtoolsWrapper_7Samfile__open; __pyx_vtable_15samtoolsWrapper_Samfile.getrname = (char *(*)(struct __pyx_obj_15samtoolsWrapper_Samfile *, int))__pyx_f_15samtoolsWrapper_7Samfile_getrname; __pyx_vtable_15samtoolsWrapper_Samfile._parseRegion = (PyObject *(*)(struct __pyx_obj_15samtoolsWrapper_Samfile *, struct __pyx_opt_args_15samtoolsWrapper_7Samfile__parseRegion *__pyx_optional_args))__pyx_f_15samtoolsWrapper_7Samfile__parseRegion; __pyx_vtable_15samtoolsWrapper_Samfile.fetch = (struct __pyx_obj_15samtoolsWrapper_IteratorRow *(*)(struct __pyx_obj_15samtoolsWrapper_Samfile *, char *, int, int, int __pyx_skip_dispatch))__pyx_f_15samtoolsWrapper_7Samfile_fetch; __pyx_vtable_15samtoolsWrapper_Samfile.fetchAllReads = (struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *(*)(struct __pyx_obj_15samtoolsWrapper_Samfile *, int __pyx_skip_dispatch))__pyx_f_15samtoolsWrapper_7Samfile_fetchAllReads; __pyx_vtable_15samtoolsWrapper_Samfile.close = (PyObject *(*)(struct __pyx_obj_15samtoolsWrapper_Samfile *, int __pyx_skip_dispatch))__pyx_f_15samtoolsWrapper_7Samfile_close; __pyx_vtable_15samtoolsWrapper_Samfile.loadOffsetsForRegions = (void (*)(struct __pyx_obj_15samtoolsWrapper_Samfile *, PyObject *))__pyx_f_15samtoolsWrapper_7Samfile_loadOffsetsForRegions; __pyx_vtable_15samtoolsWrapper_Samfile.openBAMFile = (void (*)(struct __pyx_obj_15samtoolsWrapper_Samfile *, PyObject *))__pyx_f_15samtoolsWrapper_7Samfile_openBAMFile; if (PyType_Ready(&__pyx_type_15samtoolsWrapper_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetVtable(__pyx_type_15samtoolsWrapper_Samfile.tp_dict, __pyx_vtabptr_15samtoolsWrapper_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "Samfile", (PyObject *)&__pyx_type_15samtoolsWrapper_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_15samtoolsWrapper_Samfile = &__pyx_type_15samtoolsWrapper_Samfile; __pyx_vtabptr_15samtoolsWrapper_IteratorRow = &__pyx_vtable_15samtoolsWrapper_IteratorRow; __pyx_vtable_15samtoolsWrapper_IteratorRow.cnext = (int (*)(struct __pyx_obj_15samtoolsWrapper_IteratorRow *))__pyx_f_15samtoolsWrapper_11IteratorRow_cnext; if (PyType_Ready(&__pyx_type_15samtoolsWrapper_IteratorRow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetVtable(__pyx_type_15samtoolsWrapper_IteratorRow.tp_dict, __pyx_vtabptr_15samtoolsWrapper_IteratorRow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "IteratorRow", (PyObject *)&__pyx_type_15samtoolsWrapper_IteratorRow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_15samtoolsWrapper_IteratorRow = &__pyx_type_15samtoolsWrapper_IteratorRow; __pyx_vtabptr_15samtoolsWrapper_IteratorRowAll = &__pyx_vtable_15samtoolsWrapper_IteratorRowAll; __pyx_vtable_15samtoolsWrapper_IteratorRowAll.getCurrent = (bam1_t *(*)(struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *))__pyx_f_15samtoolsWrapper_14IteratorRowAll_getCurrent; __pyx_vtable_15samtoolsWrapper_IteratorRowAll.cnext = (int (*)(struct __pyx_obj_15samtoolsWrapper_IteratorRowAll *))__pyx_f_15samtoolsWrapper_14IteratorRowAll_cnext; if (PyType_Ready(&__pyx_type_15samtoolsWrapper_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_CPYTHON { PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_15samtoolsWrapper_IteratorRowAll, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_15samtoolsWrapper_14IteratorRowAll_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_15samtoolsWrapper_14IteratorRowAll_4__next__.doc = __pyx_doc_15samtoolsWrapper_14IteratorRowAll_4__next__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_15samtoolsWrapper_14IteratorRowAll_4__next__; } } #endif if (__Pyx_SetVtable(__pyx_type_15samtoolsWrapper_IteratorRowAll.tp_dict, __pyx_vtabptr_15samtoolsWrapper_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "IteratorRowAll", (PyObject *)&__pyx_type_15samtoolsWrapper_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_15samtoolsWrapper_IteratorRowAll = &__pyx_type_15samtoolsWrapper_IteratorRowAll; __pyx_vtabptr_15samtoolsWrapper_AlignedRead = &__pyx_vtable_15samtoolsWrapper_AlignedRead; __pyx_vtable_15samtoolsWrapper_AlignedRead.qname = (PyObject *(*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *, int __pyx_skip_dispatch))__pyx_f_15samtoolsWrapper_11AlignedRead_qname; __pyx_vtable_15samtoolsWrapper_AlignedRead.fastQName = (char *(*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_fastQName; __pyx_vtable_15samtoolsWrapper_AlignedRead.seq = (char *(*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_seq; __pyx_vtable_15samtoolsWrapper_AlignedRead.qual = (char *(*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_qual; __pyx_vtable_15samtoolsWrapper_AlignedRead.tags = (PyObject *(*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_tags; __pyx_vtable_15samtoolsWrapper_AlignedRead.flag = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_flag; __pyx_vtable_15samtoolsWrapper_AlignedRead.rname = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_rname; __pyx_vtable_15samtoolsWrapper_AlignedRead.getCigarLength = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_getCigarLength; __pyx_vtable_15samtoolsWrapper_AlignedRead.pos = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_pos; __pyx_vtable_15samtoolsWrapper_AlignedRead.end = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_end; __pyx_vtable_15samtoolsWrapper_AlignedRead.bin = (PyObject *(*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_bin; __pyx_vtable_15samtoolsWrapper_AlignedRead.getCigarOpCode = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *, int))__pyx_f_15samtoolsWrapper_11AlignedRead_getCigarOpCode; __pyx_vtable_15samtoolsWrapper_AlignedRead.getCigarOpLength = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *, int))__pyx_f_15samtoolsWrapper_11AlignedRead_getCigarOpLength; __pyx_vtable_15samtoolsWrapper_AlignedRead.rlen = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_rlen; __pyx_vtable_15samtoolsWrapper_AlignedRead.mapq = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *, int __pyx_skip_dispatch))__pyx_f_15samtoolsWrapper_11AlignedRead_mapq; __pyx_vtable_15samtoolsWrapper_AlignedRead.mrnm = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_mrnm; __pyx_vtable_15samtoolsWrapper_AlignedRead.mpos = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_mpos; __pyx_vtable_15samtoolsWrapper_AlignedRead.isize = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_isize; __pyx_vtable_15samtoolsWrapper_AlignedRead.is_paired = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_is_paired; __pyx_vtable_15samtoolsWrapper_AlignedRead.is_proper_pair = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_is_proper_pair; __pyx_vtable_15samtoolsWrapper_AlignedRead.is_unmapped = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_is_unmapped; __pyx_vtable_15samtoolsWrapper_AlignedRead.mate_is_unmapped = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_mate_is_unmapped; __pyx_vtable_15samtoolsWrapper_AlignedRead.is_reverse = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_is_reverse; __pyx_vtable_15samtoolsWrapper_AlignedRead.mate_is_reverse = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_mate_is_reverse; __pyx_vtable_15samtoolsWrapper_AlignedRead.is_read1 = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_is_read1; __pyx_vtable_15samtoolsWrapper_AlignedRead.is_read2 = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_is_read2; __pyx_vtable_15samtoolsWrapper_AlignedRead.is_secondary = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_is_secondary; __pyx_vtable_15samtoolsWrapper_AlignedRead.is_qcfail = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_is_qcfail; __pyx_vtable_15samtoolsWrapper_AlignedRead.is_duplicate = (int (*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *))__pyx_f_15samtoolsWrapper_11AlignedRead_is_duplicate; __pyx_vtable_15samtoolsWrapper_AlignedRead.opt = (PyObject *(*)(struct __pyx_obj_15samtoolsWrapper_AlignedRead *, PyObject *))__pyx_f_15samtoolsWrapper_11AlignedRead_opt; if (PyType_Ready(&__pyx_type_15samtoolsWrapper_AlignedRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_CPYTHON { PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_15samtoolsWrapper_AlignedRead, "__str__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_15samtoolsWrapper_11AlignedRead_4__str__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_15samtoolsWrapper_11AlignedRead_4__str__.doc = __pyx_doc_15samtoolsWrapper_11AlignedRead_4__str__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_15samtoolsWrapper_11AlignedRead_4__str__; } } #endif #if CYTHON_COMPILING_IN_CPYTHON { PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_15samtoolsWrapper_AlignedRead, "__hash__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_15samtoolsWrapper_11AlignedRead_8__hash__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_15samtoolsWrapper_11AlignedRead_8__hash__.doc = __pyx_doc_15samtoolsWrapper_11AlignedRead_8__hash__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_15samtoolsWrapper_11AlignedRead_8__hash__; } } #endif if (__Pyx_SetVtable(__pyx_type_15samtoolsWrapper_AlignedRead.tp_dict, __pyx_vtabptr_15samtoolsWrapper_AlignedRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "AlignedRead", (PyObject *)&__pyx_type_15samtoolsWrapper_AlignedRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_15samtoolsWrapper_AlignedRead = &__pyx_type_15samtoolsWrapper_AlignedRead; /*--- Type import code ---*/ /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "samtoolsWrapper.pyx":1 * import os # <<<<<<<<<<<<<< * import types * import itertools */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":2 * import os * import types # <<<<<<<<<<<<<< * import itertools * import logging */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__types), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__types, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":3 * import os * import types * import itertools # <<<<<<<<<<<<<< * import logging * cimport cython */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__itertools), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__itertools, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":4 * import types * import itertools * import logging # <<<<<<<<<<<<<< * cimport cython * import zlib */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__logging), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__logging, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":6 * import logging * cimport cython * import zlib # <<<<<<<<<<<<<< * * ################################################################################################### */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__zlib), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__zlib, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":10 * ################################################################################################### * * logger = logging.getLogger("Log") # <<<<<<<<<<<<<< * * ################################################################################################### */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__getLogger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_66), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s__logger, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":196 * ################################################################################################### * * cdef int TYPE_BAM = 1 # <<<<<<<<<<<<<< * cdef int TYPE_READ = 2 * */ __pyx_v_15samtoolsWrapper_TYPE_BAM = 1; /* "samtoolsWrapper.pyx":197 * * cdef int TYPE_BAM = 1 * cdef int TYPE_READ = 2 # <<<<<<<<<<<<<< * * ################################################################################################### */ __pyx_v_15samtoolsWrapper_TYPE_READ = 2; /* "samtoolsWrapper.pyx":267 * ###################################################################### * # valid types for sam headers * VALID_HEADER_TYPES = { "HD" : dict, # <<<<<<<<<<<<<< * "SQ" : list, * "RG" : list, */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__HD), ((PyObject *)((PyObject*)(&PyDict_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "samtoolsWrapper.pyx":268 * # valid types for sam headers * VALID_HEADER_TYPES = { "HD" : dict, * "SQ" : list, # <<<<<<<<<<<<<< * "RG" : list, * "PG" : list, */ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "samtoolsWrapper.pyx":269 * VALID_HEADER_TYPES = { "HD" : dict, * "SQ" : list, * "RG" : list, # <<<<<<<<<<<<<< * "PG" : list, * "CO" : list } */ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__RG), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "samtoolsWrapper.pyx":270 * "SQ" : list, * "RG" : list, * "PG" : list, # <<<<<<<<<<<<<< * "CO" : list } * */ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PG), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "samtoolsWrapper.pyx":271 * "RG" : list, * "PG" : list, * "CO" : list } # <<<<<<<<<<<<<< * * # order of records within sam headers */ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__CO), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":274 * * # order of records within sam headers * VALID_HEADERS = ("HD", "SQ", "RG", "PG", "CO" ) # <<<<<<<<<<<<<< * * # type conversions within sam header records */ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADERS, ((PyObject *)__pyx_k_tuple_67)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "samtoolsWrapper.pyx":277 * * # type conversions within sam header records * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str }, # <<<<<<<<<<<<<< * "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str }, * "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, }, */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__VN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__SO), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__GO), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__HD), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; /* "samtoolsWrapper.pyx":278 * # type conversions within sam header records * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str }, * "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str }, # <<<<<<<<<<<<<< * "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, }, * "PG" : { "ID" : str, "VN" : str, "CL" : str , "PN" : str, "PP" : str}, } */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__SN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__LN), ((PyObject *)((PyObject*)(&PyInt_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__AS), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__M5), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__UR), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__SP), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; /* "samtoolsWrapper.pyx":279 * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str }, * "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str }, * "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, }, # <<<<<<<<<<<<<< * "PG" : { "ID" : str, "VN" : str, "CL" : str , "PN" : str, "PP" : str}, } * */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__ID), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__SM), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__LB), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__DS), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__PU), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__PI), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__CN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__DT), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__PL), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__RG), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; /* "samtoolsWrapper.pyx":280 * "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str }, * "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, }, * "PG" : { "ID" : str, "VN" : str, "CL" : str , "PN" : str, "PP" : str}, } # <<<<<<<<<<<<<< * * # output order of fields within records */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__ID), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__VN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__CL), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__PN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__PP), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PG), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":283 * * # output order of fields within records * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ), # <<<<<<<<<<<<<< * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__HD), ((PyObject *)__pyx_k_tuple_68)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "samtoolsWrapper.pyx":284 * # output order of fields within records * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ), * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), # <<<<<<<<<<<<<< * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), * "PG" : ( "ID", "VN", "CL" ), } */ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)__pyx_k_tuple_69)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "samtoolsWrapper.pyx":285 * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ), * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), # <<<<<<<<<<<<<< * "PG" : ( "ID", "VN", "CL" ), } * */ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__RG), ((PyObject *)__pyx_k_tuple_70)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "samtoolsWrapper.pyx":286 * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), * "PG" : ( "ID", "VN", "CL" ), } # <<<<<<<<<<<<<< * * ###################################################################### */ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PG), ((PyObject *)__pyx_k_tuple_71)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_ORDER, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":292 * ###################################################################### * * def unpickleSamfile(samFilePointer, indexFilePointer, indexesByRegion, isbam, filename): # <<<<<<<<<<<<<< * """ * """ */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15samtoolsWrapper_1unpickleSamfile, NULL, __pyx_n_s__samtoolsWrapper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__unpickleSamfile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":484 * self.samfile.header = NULL * * cpdef _open(self, mode, loadIndex=True): # <<<<<<<<<<<<<< * """ * open a sam/bam file. */ __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_k_9 = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":759 * ################################################################################################### * * def unpickleIteratorRow(samfile, bamIterPointer, useIndex): # <<<<<<<<<<<<<< * """ * """ */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15samtoolsWrapper_3unpickleIteratorRow, NULL, __pyx_n_s__samtoolsWrapper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__unpickleIteratorRow, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "samtoolsWrapper.pyx":1 * import os # <<<<<<<<<<<<<< * import types * import itertools */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; /* "samtoolsWrapper.pxd":385 * theRead.bitFlag |= BAM_FCOMPRESSED * * cdef inline void Read_SetUnCompressed(cAlignedRead* theRead): # <<<<<<<<<<<<<< * theRead.bitFlag &= (~BAM_FCOMPRESSED) * */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { __Pyx_AddTraceback("init samtoolsWrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init samtoolsWrapper"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* Runtime support code */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) { if (dict != __pyx_b) { PyErr_Clear(); result = PyObject_GetAttr(__pyx_b, name); } if (!result) { PyErr_SetObject(PyExc_NameError, name); } } return result; } static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AsString(kw_name)); #endif } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; continue; } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { if ((**argname == key) || ( (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) && _PyString_Eq(**argname, key))) { goto arg_passed_twice; } argname++; } } } else #endif if (likely(PyUnicode_Check(key))) { while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; argname++; } } } else goto invalid_keyword_type; if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { #if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #else PyErr_Restore(type, value, tb); #endif } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; #else PyErr_Fetch(type, value, tb); #endif } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); if (!value || value == Py_None) value = NULL; else Py_INCREF(value); if (!tb || tb == Py_None) tb = NULL; else { Py_INCREF(tb); if (!PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } } #if PY_VERSION_HEX < 0x02050000 if (PyClass_Check(type)) { #else if (PyType_Check(type)) { #endif #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); value = Py_None; } #endif PyErr_NormalizeException(&type, &value, &tb); } else { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyEval_CallObject(type, args); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } } bad: Py_XDECREF(owned_instance); return; } #endif static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", index, (index == 1) ? "" : "s"); } static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); PyObject* exc_type = tstate->curexc_type; if (unlikely(exc_type)) { if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { PyObject *exc_value, *exc_tb; exc_value = tstate->curexc_value; exc_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; Py_DECREF(exc_type); Py_XDECREF(exc_value); Py_XDECREF(exc_tb); return 0; } else { return -1; } } return 0; #else if (unlikely(PyErr_Occurred())) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { PyErr_Clear(); return 0; } else { return -1; } } return 0; #endif } static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; } else { return __Pyx_IterFinish(); } return 0; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (!type) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (Py_TYPE(obj) == type) return 1; } else { if (PyObject_TypeCheck(obj, type)) return 1; } PyErr_Format(PyExc_TypeError, "Argument '%s' has incorrect type (expected %s, got %s)", name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } static CYTHON_INLINE int __Pyx_CheckKeywordStrings( PyObject *kwdict, const char* function_name, int kw_allowed) { PyObject* key = 0; Py_ssize_t pos = 0; #if CPYTHON_COMPILING_IN_PYPY if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) goto invalid_keyword; return 1; #else while (PyDict_Next(kwdict, &pos, &key, 0)) { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) #endif if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type; } if ((!kw_allowed) && unlikely(key)) goto invalid_keyword; return 1; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); return 0; #endif invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif return 0; } static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!py_import) goto bad; if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; #if PY_VERSION_HEX >= 0x02050000 { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { /* try package relative import first */ PyObject *py_level = PyInt_FromLong(1); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; PyErr_Clear(); } } level = 0; /* try absolute import on failure */ } #endif if (!module) { PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); } } #else if (level>0) { PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); #endif bad: Py_XDECREF(empty_list); Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int32_t(int32_t val) { const int32_t neg_one = (int32_t)-1, const_zero = (int32_t)0; const int is_unsigned = const_zero < neg_one; if ((sizeof(int32_t) == sizeof(char)) || (sizeof(int32_t) == sizeof(short))) { return PyInt_FromLong((long)val); } else if ((sizeof(int32_t) == sizeof(int)) || (sizeof(int32_t) == sizeof(long))) { if (is_unsigned) return PyLong_FromUnsignedLong((unsigned long)val); else return PyInt_FromLong((long)val); } else if (sizeof(int32_t) == sizeof(PY_LONG_LONG)) { if (is_unsigned) return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); else return PyLong_FromLongLong((PY_LONG_LONG)val); } else { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; return _PyLong_FromByteArray(bytes, sizeof(int32_t), little, !is_unsigned); } } static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t val) { const uint32_t neg_one = (uint32_t)-1, const_zero = (uint32_t)0; const int is_unsigned = const_zero < neg_one; if ((sizeof(uint32_t) == sizeof(char)) || (sizeof(uint32_t) == sizeof(short))) { return PyInt_FromLong((long)val); } else if ((sizeof(uint32_t) == sizeof(int)) || (sizeof(uint32_t) == sizeof(long))) { if (is_unsigned) return PyLong_FromUnsignedLong((unsigned long)val); else return PyInt_FromLong((long)val); } else if (sizeof(uint32_t) == sizeof(PY_LONG_LONG)) { if (is_unsigned) return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); else return PyLong_FromLongLong((PY_LONG_LONG)val); } else { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; return _PyLong_FromByteArray(bytes, sizeof(uint32_t), little, !is_unsigned); } } #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 static PyObject *__Pyx_GetStdout(void) { PyObject *f = PySys_GetObject((char *)"stdout"); if (!f) { PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); } return f; } static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { int i; if (!f) { if (!(f = __Pyx_GetStdout())) return -1; } Py_INCREF(f); for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { PyObject* v; if (PyFile_SoftSpace(f, 1)) { if (PyFile_WriteString(" ", f) < 0) goto error; } v = PyTuple_GET_ITEM(arg_tuple, i); if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) goto error; if (PyString_Check(v)) { char *s = PyString_AsString(v); Py_ssize_t len = PyString_Size(v); if (len > 0 && isspace(Py_CHARMASK(s[len-1])) && s[len-1] != ' ') PyFile_SoftSpace(f, 0); } } if (newline) { if (PyFile_WriteString("\n", f) < 0) goto error; PyFile_SoftSpace(f, 0); } Py_DECREF(f); return 0; error: Py_DECREF(f); return -1; } #else /* Python 3 has a print function */ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { PyObject* kwargs = 0; PyObject* result = 0; PyObject* end_string; if (unlikely(!__pyx_print)) { __pyx_print = __Pyx_GetAttrString(__pyx_b, "print"); if (!__pyx_print) return -1; } if (stream) { kwargs = PyDict_New(); if (unlikely(!kwargs)) return -1; if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0)) goto bad; if (!newline) { end_string = PyUnicode_FromStringAndSize(" ", 1); if (unlikely(!end_string)) goto bad; if (PyDict_SetItemString(kwargs, "end", end_string) < 0) { Py_DECREF(end_string); goto bad; } Py_DECREF(end_string); } } else if (!newline) { if (unlikely(!__pyx_print_kwargs)) { __pyx_print_kwargs = PyDict_New(); if (unlikely(!__pyx_print_kwargs)) return -1; end_string = PyUnicode_FromStringAndSize(" ", 1); if (unlikely(!end_string)) return -1; if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) { Py_DECREF(end_string); return -1; } Py_DECREF(end_string); } kwargs = __pyx_print_kwargs; } result = PyObject_Call(__pyx_print, arg_tuple, kwargs); if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs)) Py_DECREF(kwargs); if (!result) return -1; Py_DECREF(result); return 0; bad: if (kwargs != __pyx_print_kwargs) Py_XDECREF(kwargs); return -1; } #endif static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint8_t(uint8_t val) { const uint8_t neg_one = (uint8_t)-1, const_zero = (uint8_t)0; const int is_unsigned = const_zero < neg_one; if ((sizeof(uint8_t) == sizeof(char)) || (sizeof(uint8_t) == sizeof(short))) { return PyInt_FromLong((long)val); } else if ((sizeof(uint8_t) == sizeof(int)) || (sizeof(uint8_t) == sizeof(long))) { if (is_unsigned) return PyLong_FromUnsignedLong((unsigned long)val); else return PyInt_FromLong((long)val); } else if (sizeof(uint8_t) == sizeof(PY_LONG_LONG)) { if (is_unsigned) return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); else return PyLong_FromLongLong((PY_LONG_LONG)val); } else { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; return _PyLong_FromByteArray(bytes, sizeof(uint8_t), little, !is_unsigned); } } static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)PyLong_AsUnsignedLong(x); } else { return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)PyLong_AsUnsignedLong(x); } else { return (long)PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)PyLong_AsUnsignedLong(x); } else { return (signed long)PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); #if PY_MAJOR_VERSION < 3 ctx = PyString_FromString(name); #else ctx = PyUnicode_FromString(name); #endif __Pyx_ErrRestore(old_exc, old_val, old_tb); if (!ctx) { PyErr_WriteUnraisable(Py_None); } else { PyErr_WriteUnraisable(ctx); Py_DECREF(ctx); } } static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); #if PY_VERSION_HEX < 0x02050000 return PyErr_Warn(NULL, message); #else return PyErr_WarnEx(NULL, message, 1); #endif } return 0; } static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) { PyObject *d = 0; PyObject *cobj = 0; union { void (*fp)(void); void *p; } tmp; d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__"); if (!d) { PyErr_Clear(); d = PyDict_New(); if (!d) goto bad; Py_INCREF(d); if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0) goto bad; } tmp.fp = f; #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) cobj = PyCapsule_New(tmp.p, sig, 0); #else cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0); #endif if (!cobj) goto bad; if (PyDict_SetItemString(d, name, cobj) < 0) goto bad; Py_DECREF(cobj); Py_DECREF(d); return 0; bad: Py_XDECREF(cobj); Py_XDECREF(d); return -1; } static int __Pyx_SetVtable(PyObject *dict, void *vtable) { #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) PyObject *ob = PyCapsule_New(vtable, 0, 0); #else PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); #endif if (!ob) goto bad; if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) goto bad; Py_DECREF(ob); return 0; bad: Py_XDECREF(ob); return -1; } static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; } while (start < end) { mid = (start + end) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { start = mid + 1; } else { return mid; } } if (code_line <= entries[mid].code_line) { return mid; } else { return mid + 1; } } static PyCodeObject *__pyx_find_code_object(int code_line) { PyCodeObject* code_object; int pos; if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { return NULL; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { return NULL; } code_object = __pyx_code_cache.entries[pos].code_object; Py_INCREF(code_object); return code_object; } static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = 64; __pyx_code_cache.count = 1; entries[0].code_line = code_line; entries[0].code_object = code_object; Py_INCREF(code_object); } return; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { PyCodeObject* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_DECREF(tmp); return; } if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = new_max; } for (i=__pyx_code_cache.count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; __pyx_code_cache.count++; Py_INCREF(code_object); } #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(filename); #else py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ 0, /*int kwonlyargcount,*/ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); Py_DECREF(py_funcname); return py_code; bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_globals = 0; PyFrameObject *py_frame = 0; py_code = __pyx_find_code_object(c_line ? c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; __pyx_insert_code_object(c_line ? c_line : py_line, py_code); } py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; #if PY_VERSION_HEX < 0x03000000 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_VERSION_HEX < 0x03000000 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */