1 /* Generated by Cython 0.16 on Thu Nov 22 15:20:54 2012 */
3 #define PY_SSIZE_T_CLEAN
6 #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02040000
8 #error Cython requires Python 2.4+.
10 #include <stddef.h> /* For offsetof */
12 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
15 #if !defined(WIN32) && !defined(MS_WINDOWS)
28 #define DL_IMPORT(t) t
31 #define DL_EXPORT(t) t
35 #define PY_LONG_LONG LONG_LONG
39 #define Py_HUGE_VAL HUGE_VAL
43 #define CYTHON_COMPILING_IN_PYPY 1
44 #define CYTHON_COMPILING_IN_CPYTHON 0
46 #define CYTHON_COMPILING_IN_PYPY 0
47 #define CYTHON_COMPILING_IN_CPYTHON 1
50 #if CYTHON_COMPILING_IN_PYPY
51 #define __Pyx_PyCFunction_Call PyObject_Call
53 #define __Pyx_PyCFunction_Call PyCFunction_Call
56 #if PY_VERSION_HEX < 0x02050000
57 typedef int Py_ssize_t;
58 #define PY_SSIZE_T_MAX INT_MAX
59 #define PY_SSIZE_T_MIN INT_MIN
60 #define PY_FORMAT_SIZE_T ""
61 #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
62 #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o)
63 #define PyNumber_Index(o) PyNumber_Int(o)
64 #define PyIndex_Check(o) PyNumber_Check(o)
65 #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
66 #define __PYX_BUILD_PY_SSIZE_T "i"
68 #define __PYX_BUILD_PY_SSIZE_T "n"
71 #if PY_VERSION_HEX < 0x02060000
72 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
73 #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
74 #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
75 #define PyVarObject_HEAD_INIT(type, size) \
76 PyObject_HEAD_INIT(type) size,
77 #define PyType_Modified(t)
89 Py_ssize_t *suboffsets;
93 #define PyBUF_SIMPLE 0
94 #define PyBUF_WRITABLE 0x0001
95 #define PyBUF_FORMAT 0x0004
96 #define PyBUF_ND 0x0008
97 #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
98 #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
99 #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
100 #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
101 #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
102 #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
103 #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
105 typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
106 typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
109 #if PY_MAJOR_VERSION < 3
110 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
111 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
112 PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
114 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
115 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
116 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
119 #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
120 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
123 #if PY_MAJOR_VERSION >= 3
124 #define Py_TPFLAGS_CHECKTYPES 0
125 #define Py_TPFLAGS_HAVE_INDEX 0
128 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
129 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
133 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH)
134 #define CYTHON_PEP393_ENABLED 1
135 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
136 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
138 #define CYTHON_PEP393_ENABLED 0
139 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
140 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
143 #if PY_MAJOR_VERSION >= 3
144 #define PyBaseString_Type PyUnicode_Type
145 #define PyStringObject PyUnicodeObject
146 #define PyString_Type PyUnicode_Type
147 #define PyString_Check PyUnicode_Check
148 #define PyString_CheckExact PyUnicode_CheckExact
151 #if PY_VERSION_HEX < 0x02060000
152 #define PyBytesObject PyStringObject
153 #define PyBytes_Type PyString_Type
154 #define PyBytes_Check PyString_Check
155 #define PyBytes_CheckExact PyString_CheckExact
156 #define PyBytes_FromString PyString_FromString
157 #define PyBytes_FromStringAndSize PyString_FromStringAndSize
158 #define PyBytes_FromFormat PyString_FromFormat
159 #define PyBytes_DecodeEscape PyString_DecodeEscape
160 #define PyBytes_AsString PyString_AsString
161 #define PyBytes_AsStringAndSize PyString_AsStringAndSize
162 #define PyBytes_Size PyString_Size
163 #define PyBytes_AS_STRING PyString_AS_STRING
164 #define PyBytes_GET_SIZE PyString_GET_SIZE
165 #define PyBytes_Repr PyString_Repr
166 #define PyBytes_Concat PyString_Concat
167 #define PyBytes_ConcatAndDel PyString_ConcatAndDel
170 #if PY_VERSION_HEX < 0x02060000
171 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
172 #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
174 #ifndef PySet_CheckExact
175 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
178 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
180 #if PY_MAJOR_VERSION >= 3
181 #define PyIntObject PyLongObject
182 #define PyInt_Type PyLong_Type
183 #define PyInt_Check(op) PyLong_Check(op)
184 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
185 #define PyInt_FromString PyLong_FromString
186 #define PyInt_FromUnicode PyLong_FromUnicode
187 #define PyInt_FromLong PyLong_FromLong
188 #define PyInt_FromSize_t PyLong_FromSize_t
189 #define PyInt_FromSsize_t PyLong_FromSsize_t
190 #define PyInt_AsLong PyLong_AsLong
191 #define PyInt_AS_LONG PyLong_AS_LONG
192 #define PyInt_AsSsize_t PyLong_AsSsize_t
193 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
194 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
197 #if PY_MAJOR_VERSION >= 3
198 #define PyBoolObject PyLongObject
201 #if PY_VERSION_HEX < 0x03020000
202 typedef long Py_hash_t;
203 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
204 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
206 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
207 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
210 #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
211 #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
212 #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
213 #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
215 #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
216 (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
217 (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
218 (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
219 #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
220 (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
221 (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
222 (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
223 #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
224 (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
225 (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
226 (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
229 #if PY_MAJOR_VERSION >= 3
230 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
233 #if PY_VERSION_HEX < 0x02050000
234 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
235 #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
236 #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
238 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
239 #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
240 #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
243 #if PY_VERSION_HEX < 0x02050000
244 #define __Pyx_NAMESTR(n) ((char *)(n))
245 #define __Pyx_DOCSTR(n) ((char *)(n))
247 #define __Pyx_NAMESTR(n) (n)
248 #define __Pyx_DOCSTR(n) (n)
251 #if PY_MAJOR_VERSION >= 3
252 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
253 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
255 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
256 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
259 #ifndef __PYX_EXTERN_C
261 #define __PYX_EXTERN_C extern "C"
263 #define __PYX_EXTERN_C extern
267 #if defined(WIN32) || defined(MS_WINDOWS)
268 #define _USE_MATH_DEFINES
271 #define __PYX_HAVE__csamtools
272 #define __PYX_HAVE_API__csamtools
284 #include "pysam_util.h"
285 #include "pythread.h"
290 #ifdef PYREX_WITHOUT_ASSERTIONS
291 #define CYTHON_WITHOUT_ASSERTIONS
295 /* inline attribute */
296 #ifndef CYTHON_INLINE
297 #if defined(__GNUC__)
298 #define CYTHON_INLINE __inline__
299 #elif defined(_MSC_VER)
300 #define CYTHON_INLINE __inline
301 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
302 #define CYTHON_INLINE inline
304 #define CYTHON_INLINE
308 /* unused attribute */
309 #ifndef CYTHON_UNUSED
310 # if defined(__GNUC__)
311 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
312 # define CYTHON_UNUSED __attribute__ ((__unused__))
314 # define CYTHON_UNUSED
316 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
317 # define CYTHON_UNUSED __attribute__ ((__unused__))
319 # define CYTHON_UNUSED
323 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*/
326 /* Type Conversion Predeclarations */
328 #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
329 #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
331 #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
332 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
333 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
334 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
336 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
337 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
338 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
340 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
341 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
344 /* Test for GCC > 2.95 */
345 #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
346 #define likely(x) __builtin_expect(!!(x), 1)
347 #define unlikely(x) __builtin_expect(!!(x), 0)
348 #else /* __GNUC__ > 2 ... */
349 #define likely(x) (x)
350 #define unlikely(x) (x)
351 #endif /* __GNUC__ > 2 ... */
353 #define likely(x) (x)
354 #define unlikely(x) (x)
355 #endif /* __GNUC__ */
357 static PyObject *__pyx_m;
358 static PyObject *__pyx_b;
359 static PyObject *__pyx_empty_tuple;
360 static PyObject *__pyx_empty_bytes;
361 static int __pyx_lineno;
362 static int __pyx_clineno = 0;
363 static const char * __pyx_cfilenm= __FILE__;
364 static const char *__pyx_filename;
367 static const char *__pyx_f[] = {
373 /*--- Type declarations ---*/
374 struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr;
375 struct __pyx_obj_9csamtools_IteratorRow;
376 struct __pyx_obj_9csamtools_IteratorRowAllRefs;
377 struct __pyx_obj_9csamtools_IteratorRowAll;
378 struct __pyx_obj_9csamtools_PileupProxy;
379 struct __pyx_obj_9csamtools_AlignedRead;
380 struct __pyx_obj_9csamtools_Fastafile;
381 struct __pyx_obj_9csamtools_IteratorRowSelection;
382 struct __pyx_obj_9csamtools_IteratorColumn;
383 struct __pyx_obj_9csamtools_IteratorColumnAllRefs;
384 struct __pyx_obj_9csamtools_IteratorRowRegion;
385 struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr;
386 struct __pyx_obj_9csamtools_Samfile;
387 struct __pyx_obj_9csamtools_SNPCall;
388 struct __pyx_obj_9csamtools_IndexedReads;
389 struct __pyx_obj_9csamtools_IteratorColumnRegion;
390 struct __pyx_obj_9csamtools_PileupRead;
391 struct __pyx_t_9csamtools___iterdata;
392 typedef struct __pyx_t_9csamtools___iterdata __pyx_t_9csamtools___iterdata;
393 struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData;
394 struct __pyx_t_9csamtools_MateData;
395 typedef struct __pyx_t_9csamtools_MateData __pyx_t_9csamtools_MateData;
397 /* "csamtools.pxd":394
400 * ctypedef struct __iterdata: # <<<<<<<<<<<<<<
401 * samfile_t * samfile
404 struct __pyx_t_9csamtools___iterdata {
413 /* "csamtools.pxd":523
414 * cdef char * getSequence( self )
415 * cdef setMask( self, mask )
416 * cdef setupIteratorData( self, # <<<<<<<<<<<<<<
420 struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData {
425 /* "csamtools.pyx":518
428 * ctypedef struct MateData: # <<<<<<<<<<<<<<
432 struct __pyx_t_9csamtools_MateData {
438 /* "csamtools.pyx":140
439 * cdef char* CODE2CIGAR= "MIDNSHP=X"
441 * CIGAR2CODE = dict( [y,x] for x,y in enumerate( CODE2CIGAR) ) # <<<<<<<<<<<<<<
443 * CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) )
445 struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr {
451 PyObject *(*__pyx_t_2)(PyObject *);
455 /* "csamtools.pxd":464
456 * cdef uint32_t _is_tail
458 * cdef class IteratorRow: # <<<<<<<<<<<<<<
462 struct __pyx_obj_9csamtools_IteratorRow {
467 /* "csamtools.pxd":487
468 * cdef int cnext(self)
470 * cdef class IteratorRowAllRefs(IteratorRow): # <<<<<<<<<<<<<<
471 * cdef Samfile samfile
474 struct __pyx_obj_9csamtools_IteratorRowAllRefs {
475 struct __pyx_obj_9csamtools_IteratorRow __pyx_base;
476 struct __pyx_obj_9csamtools_Samfile *samfile;
478 struct __pyx_obj_9csamtools_IteratorRowRegion *rowiter;
482 /* "csamtools.pxd":480
483 * cdef int cnext(self)
485 * cdef class IteratorRowAll(IteratorRow): # <<<<<<<<<<<<<<
487 * cdef samfile_t * fp
489 struct __pyx_obj_9csamtools_IteratorRowAll {
490 struct __pyx_obj_9csamtools_IteratorRow __pyx_base;
491 struct __pyx_vtabstruct_9csamtools_IteratorRowAll *__pyx_vtab;
498 /* "csamtools.pxd":449
499 * cdef char * _getrname( self, int tid )
501 * cdef class PileupProxy: # <<<<<<<<<<<<<<
502 * cdef bam_pileup1_t ** plp
505 struct __pyx_obj_9csamtools_PileupProxy {
514 /* "csamtools.pxd":415
515 * cdef char * _fetch( self, char * reference, int start, int end, int * length )
517 * cdef class AlignedRead: # <<<<<<<<<<<<<<
519 * # object that this AlignedRead represents
521 struct __pyx_obj_9csamtools_AlignedRead {
527 /* "csamtools.pxd":408
528 * # Note: need to declare all C fields and methods here
530 * cdef class Fastafile: # <<<<<<<<<<<<<<
531 * cdef char * _filename
532 * # pointer to fastafile
534 struct __pyx_obj_9csamtools_Fastafile {
536 struct __pyx_vtabstruct_9csamtools_Fastafile *__pyx_vtab;
542 /* "csamtools.pxd":492
543 * cdef IteratorRowRegion rowiter
545 * cdef class IteratorRowSelection(IteratorRow): # <<<<<<<<<<<<<<
547 * cdef int current_pos
549 struct __pyx_obj_9csamtools_IteratorRowSelection {
550 struct __pyx_obj_9csamtools_IteratorRow __pyx_base;
551 struct __pyx_vtabstruct_9csamtools_IteratorRowSelection *__pyx_vtab;
560 /* "csamtools.pxd":504
561 * cdef int cnext(self)
563 * cdef class IteratorColumn: # <<<<<<<<<<<<<<
565 * # result of the last plbuf_push
567 struct __pyx_obj_9csamtools_IteratorColumn {
569 struct __pyx_vtabstruct_9csamtools_IteratorColumn *__pyx_vtab;
570 struct __pyx_obj_9csamtools_IteratorRowRegion *iter;
575 const bam_pileup1_t * plp;
576 bam_plp_t pileup_iter;
577 __pyx_t_9csamtools___iterdata iterdata;
578 struct __pyx_obj_9csamtools_Samfile *samfile;
579 struct __pyx_obj_9csamtools_Fastafile *fastafile;
585 /* "csamtools.pxd":536
588 * cdef class IteratorColumnAllRefs(IteratorColumn): # <<<<<<<<<<<<<<
592 struct __pyx_obj_9csamtools_IteratorColumnAllRefs {
593 struct __pyx_obj_9csamtools_IteratorColumn __pyx_base;
597 /* "csamtools.pxd":467
600 * cdef class IteratorRowRegion(IteratorRow): # <<<<<<<<<<<<<<
601 * cdef bam_iter_t iter # iterator state object
604 struct __pyx_obj_9csamtools_IteratorRowRegion {
605 struct __pyx_obj_9csamtools_IteratorRow __pyx_base;
606 struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *__pyx_vtab;
610 struct __pyx_obj_9csamtools_Samfile *samfile;
616 /* "csamtools.pyx":142
617 * CIGAR2CODE = dict( [y,x] for x,y in enumerate( CODE2CIGAR) )
619 * CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) ) # <<<<<<<<<<<<<<
620 * CIGAR_REGEX = re.compile( "([MIDNSHP=X])(\d+)" )
623 struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr {
629 PyObject *(*__pyx_t_2)(PyObject *);
633 /* "csamtools.pxd":420
634 * cdef bam1_t * _delegate
636 * cdef class Samfile: # <<<<<<<<<<<<<<
637 * cdef char * _filename
638 * # pointer to samfile
640 struct __pyx_obj_9csamtools_Samfile {
642 struct __pyx_vtabstruct_9csamtools_Samfile *__pyx_vtab;
651 int64_t start_offset;
655 /* "csamtools.pyx":3222
656 * return retval, out_stderr, out_stdout
658 * cdef class SNPCall: # <<<<<<<<<<<<<<
659 * '''the results of a SNP call.'''
662 struct __pyx_obj_9csamtools_SNPCall {
666 char _reference_base;
668 int _consensus_quality;
670 int _rms_mapping_quality;
675 /* "csamtools.pxd":539
678 * cdef class IndexedReads: # <<<<<<<<<<<<<<
679 * cdef Samfile samfile
680 * cdef samfile_t * fp
682 struct __pyx_obj_9csamtools_IndexedReads {
684 struct __pyx_obj_9csamtools_Samfile *samfile;
691 /* "csamtools.pxd":531
692 * cdef reset( self, tid, start, end )
694 * cdef class IteratorColumnRegion(IteratorColumn): # <<<<<<<<<<<<<<
698 struct __pyx_obj_9csamtools_IteratorColumnRegion {
699 struct __pyx_obj_9csamtools_IteratorColumn __pyx_base;
706 /* "csamtools.pxd":455
709 * cdef class PileupRead: # <<<<<<<<<<<<<<
710 * cdef AlignedRead _alignment
713 struct __pyx_obj_9csamtools_PileupRead {
715 struct __pyx_obj_9csamtools_AlignedRead *_alignment;
726 /* "csamtools.pyx":1766
729 * cdef class IteratorColumn: # <<<<<<<<<<<<<<
730 * '''abstract base class for iterators over columns.
734 struct __pyx_vtabstruct_9csamtools_IteratorColumn {
735 int (*cnext)(struct __pyx_obj_9csamtools_IteratorColumn *);
736 char *(*getSequence)(struct __pyx_obj_9csamtools_IteratorColumn *);
737 PyObject *(*setMask)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *);
738 PyObject *(*setupIteratorData)(struct __pyx_obj_9csamtools_IteratorColumn *, int, int, int, struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData *__pyx_optional_args);
739 PyObject *(*reset)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *, PyObject *, PyObject *);
741 static struct __pyx_vtabstruct_9csamtools_IteratorColumn *__pyx_vtabptr_9csamtools_IteratorColumn;
744 /* "csamtools.pyx":1931
745 * self.iterdata.seq = NULL
747 * cdef class IteratorColumnRegion(IteratorColumn): # <<<<<<<<<<<<<<
748 * '''iterates over a region only.
752 struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion {
753 struct __pyx_vtabstruct_9csamtools_IteratorColumn __pyx_base;
755 static struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion *__pyx_vtabptr_9csamtools_IteratorColumnRegion;
758 /* "csamtools.pyx":1461
761 * cdef class IteratorRowRegion(IteratorRow): # <<<<<<<<<<<<<<
762 * """*(Samfile samfile, int tid, int beg, int end, int reopen = True )*
766 struct __pyx_vtabstruct_9csamtools_IteratorRowRegion {
767 bam1_t *(*getCurrent)(struct __pyx_obj_9csamtools_IteratorRowRegion *);
768 int (*cnext)(struct __pyx_obj_9csamtools_IteratorRowRegion *);
770 static struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *__pyx_vtabptr_9csamtools_IteratorRowRegion;
773 /* "csamtools.pyx":1641
774 * raise StopIteration
776 * cdef class IteratorRowSelection(IteratorRow): # <<<<<<<<<<<<<<
777 * """*(Samfile samfile)*
781 struct __pyx_vtabstruct_9csamtools_IteratorRowSelection {
782 bam1_t *(*getCurrent)(struct __pyx_obj_9csamtools_IteratorRowSelection *);
783 int (*cnext)(struct __pyx_obj_9csamtools_IteratorRowSelection *);
785 static struct __pyx_vtabstruct_9csamtools_IteratorRowSelection *__pyx_vtabptr_9csamtools_IteratorRowSelection;
788 /* "csamtools.pyx":1968
791 * cdef class IteratorColumnAllRefs(IteratorColumn): # <<<<<<<<<<<<<<
792 * """iterates over all columns by chaining iterators over each reference
796 struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs {
797 struct __pyx_vtabstruct_9csamtools_IteratorColumn __pyx_base;
799 static struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *__pyx_vtabptr_9csamtools_IteratorColumnAllRefs;
802 /* "csamtools.pyx":545
805 * cdef class Samfile: # <<<<<<<<<<<<<<
806 * '''*(filename, mode=None, template = None, referencenames = None, referencelengths = None, text = NULL, header = None,
807 * add_sq_text = False, check_header = True, check_sq = True )*
810 struct __pyx_vtabstruct_9csamtools_Samfile {
811 bam_header_t *(*_buildHeader)(struct __pyx_obj_9csamtools_Samfile *, PyObject *);
812 bam1_t *(*getCurrent)(struct __pyx_obj_9csamtools_Samfile *);
813 int (*cnext)(struct __pyx_obj_9csamtools_Samfile *);
814 int (*write)(struct __pyx_obj_9csamtools_Samfile *, struct __pyx_obj_9csamtools_AlignedRead *, int __pyx_skip_dispatch);
815 char *(*_getrname)(struct __pyx_obj_9csamtools_Samfile *, int);
817 static struct __pyx_vtabstruct_9csamtools_Samfile *__pyx_vtabptr_9csamtools_Samfile;
820 /* "csamtools.pyx":375
822 * ######################################################################
823 * cdef class Fastafile: # <<<<<<<<<<<<<<
828 struct __pyx_vtabstruct_9csamtools_Fastafile {
829 char *(*_fetch)(struct __pyx_obj_9csamtools_Fastafile *, char *, int, int, int *);
831 static struct __pyx_vtabstruct_9csamtools_Fastafile *__pyx_vtabptr_9csamtools_Fastafile;
834 /* "csamtools.pyx":1540
835 * if self.owns_samfile: samclose( self.fp )
837 * cdef class IteratorRowAll(IteratorRow): # <<<<<<<<<<<<<<
838 * """*(Samfile samfile, int reopen = True)*
842 struct __pyx_vtabstruct_9csamtools_IteratorRowAll {
843 bam1_t *(*getCurrent)(struct __pyx_obj_9csamtools_IteratorRowAll *);
844 int (*cnext)(struct __pyx_obj_9csamtools_IteratorRowAll *);
846 static struct __pyx_vtabstruct_9csamtools_IteratorRowAll *__pyx_vtabptr_9csamtools_IteratorRowAll;
847 #ifndef CYTHON_REFNANNY
848 #define CYTHON_REFNANNY 0
852 void (*INCREF)(void*, PyObject*, int);
853 void (*DECREF)(void*, PyObject*, int);
854 void (*GOTREF)(void*, PyObject*, int);
855 void (*GIVEREF)(void*, PyObject*, int);
856 void* (*SetupContext)(const char*, int, const char*);
857 void (*FinishContext)(void**);
858 } __Pyx_RefNannyAPIStruct;
859 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
860 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
861 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
863 #define __Pyx_RefNannySetupContext(name, acquire_gil) \
865 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
866 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
867 PyGILState_Release(__pyx_gilstate_save); \
869 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
872 #define __Pyx_RefNannySetupContext(name, acquire_gil) \
873 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
875 #define __Pyx_RefNannyFinishContext() \
876 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
877 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
878 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
879 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
880 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
881 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
882 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
883 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
884 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
886 #define __Pyx_RefNannyDeclarations
887 #define __Pyx_RefNannySetupContext(name, acquire_gil)
888 #define __Pyx_RefNannyFinishContext()
889 #define __Pyx_INCREF(r) Py_INCREF(r)
890 #define __Pyx_DECREF(r) Py_DECREF(r)
891 #define __Pyx_GOTREF(r)
892 #define __Pyx_GIVEREF(r)
893 #define __Pyx_XINCREF(r) Py_XINCREF(r)
894 #define __Pyx_XDECREF(r) Py_XDECREF(r)
895 #define __Pyx_XGOTREF(r)
896 #define __Pyx_XGIVEREF(r)
897 #endif /* CYTHON_REFNANNY */
898 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
899 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
901 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
903 #ifndef CYTHON_PROFILE
904 #define CYTHON_PROFILE 1
906 #ifndef CYTHON_PROFILE_REUSE_FRAME
907 #define CYTHON_PROFILE_REUSE_FRAME 0
911 #include "frameobject.h"
912 #include "traceback.h"
913 #if CYTHON_PROFILE_REUSE_FRAME
914 #define CYTHON_FRAME_MODIFIER static
915 #define CYTHON_FRAME_DEL
917 #define CYTHON_FRAME_MODIFIER
918 #define CYTHON_FRAME_DEL Py_DECREF(__pyx_frame)
920 #define __Pyx_TraceDeclarations \
921 static PyCodeObject *__pyx_frame_code = NULL; \
922 CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL; \
923 int __Pyx_use_tracing = 0;
924 #define __Pyx_TraceCall(funcname, srcfile, firstlineno) \
925 if (unlikely(PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc)) { \
926 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, funcname, srcfile, firstlineno); \
928 #define __Pyx_TraceException() \
929 if (unlikely(__Pyx_use_tracing( && PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc) { \
930 PyObject *exc_info = __Pyx_GetExceptionTuple(); \
932 PyThreadState_GET()->c_profilefunc( \
933 PyThreadState_GET()->c_profileobj, __pyx_frame, PyTrace_EXCEPTION, exc_info); \
934 Py_DECREF(exc_info); \
937 #define __Pyx_TraceReturn(result) \
938 if (unlikely(__Pyx_use_tracing) && PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc) { \
939 PyThreadState_GET()->c_profilefunc( \
940 PyThreadState_GET()->c_profileobj, __pyx_frame, PyTrace_RETURN, (PyObject*)result); \
943 static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno); /*proto*/
944 static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, const char *funcname, const char *srcfile, int firstlineno); /*proto*/
946 #define __Pyx_TraceDeclarations
947 #define __Pyx_TraceCall(funcname, srcfile, firstlineno)
948 #define __Pyx_TraceException()
949 #define __Pyx_TraceReturn(result)
950 #endif /* CYTHON_PROFILE */
952 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
953 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
955 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
959 static CYTHON_INLINE PyObject* __Pyx_tp_new(PyObject* type_obj) {
960 return (PyObject*) (((PyTypeObject*)(type_obj))->tp_new(
961 (PyTypeObject*)(type_obj), __pyx_empty_tuple, NULL));
964 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
966 static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/
968 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
970 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
971 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
972 const char* function_name); /*proto*/
974 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
975 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
977 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
978 const char *name, int exact); /*proto*/
980 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
982 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
985 r = PyObject_GetItem(o, j);
989 #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
990 __Pyx_GetItemInt_List_Fast(o, i) : \
991 __Pyx_GetItemInt_Generic(o, to_py_func(i)))
992 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
993 if (likely(o != Py_None)) {
994 if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
995 PyObject *r = PyList_GET_ITEM(o, i);
999 else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
1000 PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
1005 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
1007 #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
1008 __Pyx_GetItemInt_Tuple_Fast(o, i) : \
1009 __Pyx_GetItemInt_Generic(o, to_py_func(i)))
1010 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
1011 if (likely(o != Py_None)) {
1012 if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
1013 PyObject *r = PyTuple_GET_ITEM(o, i);
1017 else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
1018 PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
1023 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
1025 #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
1026 __Pyx_GetItemInt_Fast(o, i) : \
1027 __Pyx_GetItemInt_Generic(o, to_py_func(i)))
1028 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
1029 if (PyList_CheckExact(o)) {
1030 Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
1031 if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
1032 PyObject *r = PyList_GET_ITEM(o, n);
1037 else if (PyTuple_CheckExact(o)) {
1038 Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
1039 if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
1040 PyObject *r = PyTuple_GET_ITEM(o, n);
1045 else if (likely(i >= 0)) {
1046 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
1047 if (likely(m && m->sq_item)) {
1048 return m->sq_item(o, i);
1051 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
1054 static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
1055 if (likely(PyList_CheckExact(L))) {
1056 if (PyList_Append(L, x) < 0) return NULL;
1058 return Py_None; /* this is just to have an accurate signature */
1062 m = __Pyx_GetAttrString(L, "append");
1063 if (!m) return NULL;
1064 r = PyObject_CallFunctionObjArgs(m, x, NULL);
1070 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1072 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1074 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
1076 static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) {
1077 return unlikely(b < 0) ? b : !b;
1079 static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
1080 return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
1083 static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);
1085 #if PY_MAJOR_VERSION >= 3
1086 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
1088 if (unlikely(d == Py_None)) {
1089 __Pyx_RaiseNoneIndexingError();
1092 value = PyDict_GetItemWithError(d, key);
1093 if (unlikely(!value)) {
1094 if (!PyErr_Occurred())
1095 PyErr_SetObject(PyExc_KeyError, key);
1102 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1105 static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
1107 #if PY_MAJOR_VERSION >= 3
1108 value = PyDict_GetItemWithError(d, key);
1109 if (unlikely(!value)) {
1110 if (unlikely(PyErr_Occurred()))
1112 value = default_value;
1116 if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
1117 value = PyDict_GetItem(d, key);
1118 if (unlikely(!value)) {
1119 value = default_value;
1124 m = __Pyx_GetAttrString(d, "get");
1125 if (!m) return NULL;
1126 value = PyObject_CallFunctionObjArgs(m, key,
1127 (default_value == Py_None) ? NULL : default_value, NULL);
1134 static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
1136 static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */
1138 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
1140 #define __Pyx_DelItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
1141 __Pyx_DelItemInt_Fast(o, i) : \
1142 __Pyx_DelItem_Generic(o, to_py_func(i)))
1143 static CYTHON_INLINE int __Pyx_DelItem_Generic(PyObject *o, PyObject *j) {
1146 r = PyObject_DelItem(o, j);
1150 static CYTHON_INLINE int __Pyx_DelItemInt_Fast(PyObject *o, Py_ssize_t i) {
1151 if (likely(i >= 0)) {
1152 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
1153 if (likely(m && m->sq_ass_item)) {
1154 return m->sq_ass_item(o, i, (PyObject *)NULL);
1157 return __Pyx_DelItem_Generic(o, PyInt_FromSsize_t(i));
1160 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
1161 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
1163 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
1165 static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
1167 static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
1168 PyObject *modname); /*proto*/
1170 #define __Pyx_CyFunction_USED 1
1171 #include <structmember.h>
1172 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
1173 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
1174 #define __Pyx_CYFUNCTION_CCLASS 0x04
1175 #define __Pyx_CyFunction_GetClosure(f) \
1176 (((__pyx_CyFunctionObject *) (f))->func_closure)
1177 #define __Pyx_CyFunction_GetClassObj(f) \
1178 (((__pyx_CyFunctionObject *) (f))->func_classobj)
1179 #define __Pyx_CyFunction_Defaults(type, f) \
1180 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
1181 #define __Pyx_CyFunction_SetDefaultsGetter(f, g) \
1182 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
1184 PyCFunctionObject func;
1186 PyObject *func_dict;
1187 PyObject *func_weakreflist;
1188 PyObject *func_name;
1190 PyObject *func_code;
1191 PyObject *func_closure;
1192 PyObject *func_classobj; /* No-args super() class cell */
1194 int defaults_pyobjects;
1195 PyObject *defaults_tuple; /* Const defaults tuple */
1196 PyObject *(*defaults_getter)(PyObject *);
1197 } __pyx_CyFunctionObject;
1198 static PyTypeObject *__pyx_CyFunctionType = 0;
1199 #define __Pyx_CyFunction_NewEx(ml, flags, self, module, code) \
1200 __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, self, module, code)
1201 static PyObject *__Pyx_CyFunction_New(PyTypeObject *,
1202 PyMethodDef *ml, int flags,
1203 PyObject *self, PyObject *module,
1205 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1208 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1210 static int __Pyx_CyFunction_init(void);
1212 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
1214 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
1216 #if PY_MAJOR_VERSION >= 3
1217 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1219 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1222 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int8_t(int8_t);
1224 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint8_t(uint8_t);
1226 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int16_t(int16_t);
1228 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint16_t(uint16_t);
1230 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int32_t(int32_t);
1232 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t);
1234 static CYTHON_INLINE uint32_t __Pyx_PyInt_from_py_uint32_t(PyObject *);
1236 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int64_t(int64_t);
1238 static CYTHON_INLINE uint64_t __Pyx_PyInt_from_py_uint64_t(PyObject *);
1240 static CYTHON_INLINE uint8_t __Pyx_PyInt_from_py_uint8_t(PyObject *);
1242 static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject *);
1244 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint64_t(uint64_t);
1246 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
1248 static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
1250 static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
1252 static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
1254 static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
1256 static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
1258 static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
1260 static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
1262 static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
1264 static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
1266 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
1268 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
1270 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
1272 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
1274 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
1276 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
1278 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
1280 #define __Pyx_Generator_USED
1281 #include <structmember.h>
1282 typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *);
1285 __pyx_generator_body_t body;
1290 PyObject *exc_value;
1291 PyObject *exc_traceback;
1292 PyObject *gi_weakreflist;
1294 } __pyx_GeneratorObject;
1295 static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
1297 static int __pyx_Generator_init(void);
1299 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1300 int lineno, const char *filename); /*proto*/
1302 static int __Pyx_check_binary_version(void);
1304 static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
1306 #if !defined(__Pyx_PyIdentifier_FromString)
1307 #if PY_MAJOR_VERSION < 3
1308 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
1310 #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
1314 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/
1316 static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
1320 PyCodeObject* code_object;
1321 } __Pyx_CodeObjectCacheEntry;
1322 struct __Pyx_CodeObjectCache {
1325 __Pyx_CodeObjectCacheEntry* entries;
1327 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1328 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1329 static PyCodeObject *__pyx_find_code_object(int code_line);
1330 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1332 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1333 int py_line, const char *filename); /*proto*/
1335 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
1338 /* Module declarations from 'cpython.version' */
1340 /* Module declarations from 'cpython.ref' */
1342 /* Module declarations from 'cpython.exc' */
1344 /* Module declarations from 'cpython.module' */
1346 /* Module declarations from 'cpython.mem' */
1348 /* Module declarations from 'cpython.tuple' */
1350 /* Module declarations from 'cpython.list' */
1352 /* Module declarations from 'libc.stdio' */
1354 /* Module declarations from 'cpython.object' */
1356 /* Module declarations from 'cpython.sequence' */
1358 /* Module declarations from 'cpython.mapping' */
1360 /* Module declarations from 'cpython.iterator' */
1362 /* Module declarations from 'cpython.type' */
1364 /* Module declarations from 'cpython.number' */
1366 /* Module declarations from 'cpython.int' */
1368 /* Module declarations from '__builtin__' */
1370 /* Module declarations from 'cpython.bool' */
1371 static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
1373 /* Module declarations from 'cpython.long' */
1375 /* Module declarations from 'cpython.float' */
1377 /* Module declarations from '__builtin__' */
1379 /* Module declarations from 'cpython.complex' */
1380 static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
1382 /* Module declarations from 'cpython.string' */
1384 /* Module declarations from 'cpython.unicode' */
1386 /* Module declarations from 'cpython.dict' */
1388 /* Module declarations from 'cpython.instance' */
1390 /* Module declarations from 'cpython.function' */
1392 /* Module declarations from 'cpython.method' */
1394 /* Module declarations from 'cpython.weakref' */
1396 /* Module declarations from 'cpython.getargs' */
1398 /* Module declarations from 'cpython.pythread' */
1400 /* Module declarations from 'cpython.pystate' */
1402 /* Module declarations from 'cpython.cobject' */
1404 /* Module declarations from 'cpython.oldbuffer' */
1406 /* Module declarations from 'cpython.set' */
1408 /* Module declarations from 'cpython.buffer' */
1410 /* Module declarations from 'cpython.bytes' */
1412 /* Module declarations from 'cpython.pycapsule' */
1414 /* Module declarations from 'cpython' */
1416 /* Module declarations from 'csamtools' */
1417 static PyTypeObject *__pyx_ptype_9csamtools_Fastafile = 0;
1418 static PyTypeObject *__pyx_ptype_9csamtools_AlignedRead = 0;
1419 static PyTypeObject *__pyx_ptype_9csamtools_Samfile = 0;
1420 static PyTypeObject *__pyx_ptype_9csamtools_PileupProxy = 0;
1421 static PyTypeObject *__pyx_ptype_9csamtools_PileupRead = 0;
1422 static PyTypeObject *__pyx_ptype_9csamtools_IteratorRow = 0;
1423 static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowRegion = 0;
1424 static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowAll = 0;
1425 static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowAllRefs = 0;
1426 static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowSelection = 0;
1427 static PyTypeObject *__pyx_ptype_9csamtools_IteratorColumn = 0;
1428 static PyTypeObject *__pyx_ptype_9csamtools_IteratorColumnRegion = 0;
1429 static PyTypeObject *__pyx_ptype_9csamtools_IteratorColumnAllRefs = 0;
1430 static PyTypeObject *__pyx_ptype_9csamtools_IndexedReads = 0;
1431 static PyTypeObject *__pyx_ptype_9csamtools_SNPCall = 0;
1432 static PyTypeObject *__pyx_ptype_9csamtools___pyx_scope_struct__genexpr = 0;
1433 static PyTypeObject *__pyx_ptype_9csamtools___pyx_scope_struct_1_genexpr = 0;
1434 static PyObject *__pyx_v_9csamtools__FILENAME_ENCODING = 0;
1435 static char *__pyx_v_9csamtools_CODE2CIGAR;
1436 static char *__pyx_v_9csamtools_bam_nt16_rev_table;
1437 static int __pyx_v_9csamtools_max_pos;
1438 static PyObject *__pyx_f_9csamtools_from_string_and_size(char *, size_t); /*proto*/
1439 static PyObject *__pyx_f_9csamtools__my_encodeFilename(PyObject *); /*proto*/
1440 static PyObject *__pyx_f_9csamtools__force_bytes(PyObject *); /*proto*/
1441 static CYTHON_INLINE PyObject *__pyx_f_9csamtools__force_cmdline_bytes(PyObject *); /*proto*/
1442 static PyObject *__pyx_f_9csamtools__charptr_to_str(char *); /*proto*/
1443 static PyObject *__pyx_f_9csamtools__force_str(PyObject *); /*proto*/
1444 static PyObject *__pyx_f_9csamtools_makeAlignedRead(bam1_t *); /*proto*/
1445 static PyObject *__pyx_f_9csamtools_makePileupProxy(bam_pileup1_t **, int, int, int); /*proto*/
1446 static PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *); /*proto*/
1447 static PyObject *__pyx_f_9csamtools_convertBinaryTagToList(uint8_t *); /*proto*/
1448 static int __pyx_f_9csamtools_fetch_callback(bam1_t *, void *); /*proto*/
1449 static int __pyx_f_9csamtools_pileup_callback(uint32_t, uint32_t, int, bam_pileup1_t *, void *); /*proto*/
1450 static int __pyx_f_9csamtools_pileup_fetch_callback(bam1_t *, void *); /*proto*/
1451 static int __pyx_f_9csamtools_count_callback(bam1_t *, void *); /*proto*/
1452 static int __pyx_f_9csamtools_mate_callback(bam1_t *, void *); /*proto*/
1453 static int __pyx_f_9csamtools___advance_all(void *, bam1_t *); /*proto*/
1454 static int __pyx_f_9csamtools___advance_snpcalls(void *, bam1_t *); /*proto*/
1455 static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *); /*proto*/
1456 static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *); /*proto*/
1457 static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_seq_range(bam1_t *, uint32_t, uint32_t); /*proto*/
1458 static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_qual_range(bam1_t *, uint32_t, uint32_t); /*proto*/
1459 #define __Pyx_MODULE_NAME "csamtools"
1460 int __pyx_module_is_main_csamtools = 0;
1462 /* Implementation of 'csamtools' */
1463 static PyObject *__pyx_builtin_object;
1464 static PyObject *__pyx_builtin_TypeError;
1465 static PyObject *__pyx_builtin_enumerate;
1466 static PyObject *__pyx_builtin_ord;
1467 static PyObject *__pyx_builtin_map;
1468 static PyObject *__pyx_builtin_ValueError;
1469 static PyObject *__pyx_builtin_IOError;
1470 static PyObject *__pyx_builtin_OverflowError;
1471 static PyObject *__pyx_builtin_NotImplementedError;
1472 static PyObject *__pyx_builtin_OSError;
1473 static PyObject *__pyx_builtin_AttributeError;
1474 static PyObject *__pyx_builtin_zip;
1475 static PyObject *__pyx_builtin_sorted;
1476 static PyObject *__pyx_builtin_KeyError;
1477 static PyObject *__pyx_builtin_StopIteration;
1478 static PyObject *__pyx_builtin_min;
1479 static PyObject *__pyx_builtin_max;
1480 static PyObject *__pyx_builtin_chr;
1481 static PyObject *__pyx_builtin_open;
1482 static PyObject *__pyx_builtin_UnicodeDecodeError;
1483 static PyObject *__pyx_pf_9csamtools_2genexpr(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1484 static PyObject *__pyx_pf_9csamtools_5genexpr(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1485 static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
1486 static PyObject *__pyx_pf_9csamtools_11StderrStore___init__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
1487 static PyObject *__pyx_pf_9csamtools_11StderrStore_2readAndRelease(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
1488 static PyObject *__pyx_pf_9csamtools_11StderrStore_4release(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
1489 static PyObject *__pyx_pf_9csamtools_11StderrStore_6__del__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
1490 static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows___init__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
1491 static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_2readAndRelease(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
1492 static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_4release(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
1493 static int __pyx_pf_9csamtools_9Fastafile___cinit__(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
1494 static PyObject *__pyx_pf_9csamtools_9Fastafile_2_isOpen(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self); /* proto */
1495 static Py_ssize_t __pyx_pf_9csamtools_9Fastafile_4__len__(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self); /* proto */
1496 static PyObject *__pyx_pf_9csamtools_9Fastafile_6_open(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
1497 static PyObject *__pyx_pf_9csamtools_9Fastafile_8close(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self); /* proto */
1498 static void __pyx_pf_9csamtools_9Fastafile_10__dealloc__(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self); /* proto */
1499 static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self); /* proto */
1500 static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region); /* proto */
1501 static int __pyx_pf_9csamtools_7Samfile___cinit__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
1502 static PyObject *__pyx_pf_9csamtools_7Samfile_2_isOpen(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
1503 static PyObject *__pyx_pf_9csamtools_7Samfile_4_hasIndex(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
1504 static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, struct __pyx_obj_9csamtools_Samfile *__pyx_v_template, PyObject *__pyx_v_referencenames, PyObject *__pyx_v_referencelengths, PyObject *__pyx_v_text, PyObject *__pyx_v_header, PyObject *__pyx_v_port, PyObject *__pyx_v_add_sq_text, PyObject *__pyx_v_check_header, PyObject *__pyx_v_check_sq); /* proto */
1505 static PyObject *__pyx_pf_9csamtools_7Samfile_8gettid(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference); /* proto */
1506 static PyObject *__pyx_pf_9csamtools_7Samfile_10getrname(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_tid); /* proto */
1507 static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region); /* proto */
1508 static PyObject *__pyx_pf_9csamtools_7Samfile_14reset(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
1509 static PyObject *__pyx_pf_9csamtools_7Samfile_16seek(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, uint64_t __pyx_v_offset, int __pyx_v_where); /* proto */
1510 static PyObject *__pyx_pf_9csamtools_7Samfile_18tell(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
1511 static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region, PyObject *__pyx_v_callback, PyObject *__pyx_v_until_eof); /* proto */
1512 static PyObject *__pyx_pf_9csamtools_7Samfile_22mate(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_read); /* proto */
1513 static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region, PyObject *__pyx_v_until_eof); /* proto */
1514 static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region, PyObject *__pyx_v_callback, PyObject *__pyx_v_kwargs); /* proto */
1515 static PyObject *__pyx_pf_9csamtools_7Samfile_28close(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
1516 static void __pyx_pf_9csamtools_7Samfile_30__dealloc__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
1517 static PyObject *__pyx_pf_9csamtools_7Samfile_32write(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_read); /* proto */
1518 static PyObject *__pyx_pf_9csamtools_7Samfile_34__enter__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
1519 static PyObject *__pyx_pf_9csamtools_7Samfile_36__exit__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_value, CYTHON_UNUSED PyObject *__pyx_v_traceback); /* proto */
1520 static PyObject *__pyx_pf_9csamtools_7Samfile_8filename___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
1521 static PyObject *__pyx_pf_9csamtools_7Samfile_11nreferences___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
1522 static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
1523 static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
1524 static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
1525 static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
1526 static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
1527 static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
1528 static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_fields, PyObject *__pyx_v_record); /* proto */
1529 static PyObject *__pyx_pf_9csamtools_7Samfile_40__iter__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
1530 static PyObject *__pyx_pf_9csamtools_7Samfile_42__next__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self); /* proto */
1531 static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, int __pyx_v_tid, int __pyx_v_beg, int __pyx_v_end, int __pyx_v_reopen); /* proto */
1532 static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_2__iter__(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self); /* proto */
1533 static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_4__next__(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self); /* proto */
1534 static void __pyx_pf_9csamtools_17IteratorRowRegion_6__dealloc__(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self); /* proto */
1535 static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, int __pyx_v_reopen); /* proto */
1536 static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_2__iter__(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self); /* proto */
1537 static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_4__next__(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self); /* proto */
1538 static void __pyx_pf_9csamtools_14IteratorRowAll_6__dealloc__(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self); /* proto */
1539 static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(struct __pyx_obj_9csamtools_IteratorRowAllRefs *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile); /* proto */
1540 static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_2nextiter(struct __pyx_obj_9csamtools_IteratorRowAllRefs *__pyx_v_self); /* proto */
1541 static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_4__iter__(struct __pyx_obj_9csamtools_IteratorRowAllRefs *__pyx_v_self); /* proto */
1542 static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx_obj_9csamtools_IteratorRowAllRefs *__pyx_v_self); /* proto */
1543 static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, PyObject *__pyx_v_positions, int __pyx_v_reopen); /* proto */
1544 static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_2__iter__(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self); /* proto */
1545 static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_4__next__(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self); /* proto */
1546 static void __pyx_pf_9csamtools_20IteratorRowSelection_6__dealloc__(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self); /* proto */
1547 static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, PyObject *__pyx_v_kwargs); /* proto */
1548 static PyObject *__pyx_pf_9csamtools_14IteratorColumn_2__iter__(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self); /* proto */
1549 static PyObject *__pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self); /* proto */
1550 static PyObject *__pyx_pf_9csamtools_14IteratorColumn_4addReference(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self, struct __pyx_obj_9csamtools_Fastafile *__pyx_v_fastafile); /* proto */
1551 static PyObject *__pyx_pf_9csamtools_14IteratorColumn_6hasReference(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self); /* proto */
1552 static void __pyx_pf_9csamtools_14IteratorColumn_8__dealloc__(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self); /* proto */
1553 static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(struct __pyx_obj_9csamtools_IteratorColumnRegion *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end, int __pyx_v_truncate, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
1554 static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_2__next__(struct __pyx_obj_9csamtools_IteratorColumnRegion *__pyx_v_self); /* proto */
1555 static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(struct __pyx_obj_9csamtools_IteratorColumnAllRefs *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
1556 static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_2__next__(struct __pyx_obj_9csamtools_IteratorColumnAllRefs *__pyx_v_self); /* proto */
1557 static int __pyx_pf_9csamtools_11AlignedRead___init__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1558 static void __pyx_pf_9csamtools_11AlignedRead_2__dealloc__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1559 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1560 static PyObject *__pyx_pf_9csamtools_11AlignedRead_6compare(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_other); /* proto */
1561 static Py_hash_t __pyx_pf_9csamtools_11AlignedRead_8__hash__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1562 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1563 static int __pyx_pf_9csamtools_11AlignedRead_5qname_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_qname); /* proto */
1564 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1565 static int __pyx_pf_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_values); /* proto */
1566 static PyObject *__pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1567 static int __pyx_pf_9csamtools_11AlignedRead_11cigarstring_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_cigar); /* proto */
1568 static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1569 static int __pyx_pf_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_seq); /* proto */
1570 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1571 static int __pyx_pf_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_qual); /* proto */
1572 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1573 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1574 static PyObject *__pyx_pf_9csamtools_11AlignedRead_6qstart___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1575 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qend___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1576 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qlen___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1577 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1578 static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tags); /* proto */
1579 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4flag___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1580 static int __pyx_pf_9csamtools_11AlignedRead_4flag_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */
1581 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rname___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1582 static int __pyx_pf_9csamtools_11AlignedRead_5rname_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tid); /* proto */
1583 static PyObject *__pyx_pf_9csamtools_11AlignedRead_3tid___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1584 static int __pyx_pf_9csamtools_11AlignedRead_3tid_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tid); /* proto */
1585 static PyObject *__pyx_pf_9csamtools_11AlignedRead_3pos___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1586 static int __pyx_pf_9csamtools_11AlignedRead_3pos_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_pos); /* proto */
1587 static PyObject *__pyx_pf_9csamtools_11AlignedRead_3bin___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1588 static int __pyx_pf_9csamtools_11AlignedRead_3bin_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_bin); /* proto */
1589 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4rlen___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1590 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1591 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1592 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mapq___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1593 static int __pyx_pf_9csamtools_11AlignedRead_4mapq_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_qual); /* proto */
1594 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1595 static int __pyx_pf_9csamtools_11AlignedRead_4mrnm_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mtid); /* proto */
1596 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rnext___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1597 static int __pyx_pf_9csamtools_11AlignedRead_5rnext_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mtid); /* proto */
1598 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mpos___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1599 static int __pyx_pf_9csamtools_11AlignedRead_4mpos_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mpos); /* proto */
1600 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5pnext___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1601 static int __pyx_pf_9csamtools_11AlignedRead_5pnext_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mpos); /* proto */
1602 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5isize___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1603 static int __pyx_pf_9csamtools_11AlignedRead_5isize_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_isize); /* proto */
1604 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tlen___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1605 static int __pyx_pf_9csamtools_11AlignedRead_4tlen_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_isize); /* proto */
1606 static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1607 static int __pyx_pf_9csamtools_11AlignedRead_9is_paired_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
1608 static PyObject *__pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1609 static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
1610 static PyObject *__pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1611 static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
1612 static PyObject *__pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1613 static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
1614 static PyObject *__pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1615 static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
1616 static PyObject *__pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1617 static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
1618 static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1619 static int __pyx_pf_9csamtools_11AlignedRead_8is_read1_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
1620 static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1621 static int __pyx_pf_9csamtools_11AlignedRead_8is_read2_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
1622 static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1623 static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
1624 static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1625 static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
1626 static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1627 static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val); /* proto */
1628 static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1629 static PyObject *__pyx_pf_9csamtools_11AlignedRead_13aligned_pairs___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1630 static PyObject *__pyx_pf_9csamtools_11AlignedRead_10overlap(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, uint32_t __pyx_v_start, uint32_t __pyx_v_end); /* proto */
1631 static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tag); /* proto */
1632 static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self); /* proto */
1633 static int __pyx_pf_9csamtools_11PileupProxy___init__(CYTHON_UNUSED struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self); /* proto */
1634 static PyObject *__pyx_pf_9csamtools_11PileupProxy_2__str__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self); /* proto */
1635 static PyObject *__pyx_pf_9csamtools_11PileupProxy_3tid___get__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self); /* proto */
1636 static PyObject *__pyx_pf_9csamtools_11PileupProxy_1n___get__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self); /* proto */
1637 static int __pyx_pf_9csamtools_11PileupProxy_1n_2__set__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
1638 static PyObject *__pyx_pf_9csamtools_11PileupProxy_3pos___get__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self); /* proto */
1639 static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self); /* proto */
1640 static int __pyx_pf_9csamtools_10PileupRead___init__(CYTHON_UNUSED struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self); /* proto */
1641 static PyObject *__pyx_pf_9csamtools_10PileupRead_2__str__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self); /* proto */
1642 static PyObject *__pyx_pf_9csamtools_10PileupRead_9alignment___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self); /* proto */
1643 static PyObject *__pyx_pf_9csamtools_10PileupRead_4qpos___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self); /* proto */
1644 static PyObject *__pyx_pf_9csamtools_10PileupRead_5indel___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self); /* proto */
1645 static PyObject *__pyx_pf_9csamtools_10PileupRead_6is_del___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self); /* proto */
1646 static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_head___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self); /* proto */
1647 static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_tail___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self); /* proto */
1648 static PyObject *__pyx_pf_9csamtools_10PileupRead_5level___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self); /* proto */
1649 static PyObject *__pyx_pf_9csamtools_4Outs___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_id); /* proto */
1650 static PyObject *__pyx_pf_9csamtools_4Outs_2setdevice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
1651 static PyObject *__pyx_pf_9csamtools_4Outs_4setfile(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
1652 static PyObject *__pyx_pf_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fd); /* proto */
1653 static PyObject *__pyx_pf_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
1654 static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_method, PyObject *__pyx_v_args, PyObject *__pyx_v_catch_stdout); /* proto */
1655 static PyObject *__pyx_pf_9csamtools_7SNPCall_3tid___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self); /* proto */
1656 static PyObject *__pyx_pf_9csamtools_7SNPCall_3pos___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self); /* proto */
1657 static PyObject *__pyx_pf_9csamtools_7SNPCall_14reference_base___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self); /* proto */
1658 static PyObject *__pyx_pf_9csamtools_7SNPCall_8genotype___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self); /* proto */
1659 static PyObject *__pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self); /* proto */
1660 static PyObject *__pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self); /* proto */
1661 static PyObject *__pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self); /* proto */
1662 static PyObject *__pyx_pf_9csamtools_7SNPCall_8coverage___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self); /* proto */
1663 static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self); /* proto */
1664 static int __pyx_pf_9csamtools_12IndexedReads___init__(struct __pyx_obj_9csamtools_IndexedReads *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, int __pyx_v_reopen); /* proto */
1665 static PyObject *__pyx_pf_9csamtools_12IndexedReads_2build(struct __pyx_obj_9csamtools_IndexedReads *__pyx_v_self); /* proto */
1666 static PyObject *__pyx_pf_9csamtools_12IndexedReads_4find(struct __pyx_obj_9csamtools_IndexedReads *__pyx_v_self, PyObject *__pyx_v_qname); /* proto */
1667 static void __pyx_pf_9csamtools_12IndexedReads_6__dealloc__(struct __pyx_obj_9csamtools_IndexedReads *__pyx_v_self); /* proto */
1668 static char __pyx_k_1[] = "Argument must be string or unicode.";
1669 static char __pyx_k_3[] = "Argument must be string, bytes or unicode.";
1670 static char __pyx_k_5[] = "\t";
1671 static char __pyx_k_6[] = "\n";
1672 static char __pyx_k_7[] = "calling len() on closed file";
1673 static char __pyx_k_9[] = "could not open file `%s`";
1674 static char __pyx_k_10[] = "I/O operation on closed file";
1675 static char __pyx_k_13[] = "no sequence/region supplied.";
1676 static char __pyx_k_15[] = "invalid region: start (%i) > end (%i)";
1677 static char __pyx_k_16[] = "";
1678 static char __pyx_k_17[] = "start out of range (%i)";
1679 static char __pyx_k_18[] = "end out of range (%i)";
1680 static char __pyx_k_19[] = "%s:%i-%i";
1681 static char __pyx_k_24[] = "invalid file opening mode `%s`";
1682 static char __pyx_k_26[] = "-";
1683 static char __pyx_k_27[] = "http:";
1684 static char __pyx_k_28[] = "ftp:";
1685 static char __pyx_k_29[] = "either supply options `template`, `header` or both `referencenames` and `referencelengths` for writing";
1686 static char __pyx_k_30[] = "unequal names and lengths of reference sequences";
1687 static char __pyx_k_31[] = "@SQ\tSN:%s\tLN:%s\n";
1688 static char __pyx_k_32[] = "file `%s` not found";
1689 static char __pyx_k_33[] = "could not open file (mode='%s') - is it SAM/BAM format?";
1690 static char __pyx_k_34[] = "file does not have valid header (mode='%s') - is it BAM format?";
1691 static char __pyx_k_35[] = "file does not have valid header (mode='%s') - is it SAM format?";
1692 static char __pyx_k_36[] = "file header is empty (mode='%s') - is it SAM/BAM format?";
1693 static char __pyx_k_37[] = ".bai";
1694 static char __pyx_k_38[] = "error while opening index `%s` ";
1695 static char __pyx_k_41[] = "tid %i out of range 0<=tid<%i";
1696 static char __pyx_k_43[] = "[:-]";
1697 static char __pyx_k_45[] = "invalid reference `%s`";
1698 static char __pyx_k_46[] = "invalid coordinates: start (%i) > end (%i)";
1699 static char __pyx_k_48[] = "seek only available in bam files";
1700 static char __pyx_k_50[] = "seek no available in streams";
1701 static char __pyx_k_56[] = "fetch called on bamfile without index";
1702 static char __pyx_k_58[] = "callback functionality requires a region/reference";
1703 static char __pyx_k_60[] = "no index available for fetch";
1704 static char __pyx_k_62[] = "fetching by region is not available for sam files";
1705 static char __pyx_k_64[] = "callback not implemented yet";
1706 static char __pyx_k_66[] = "fetch called for samfile without header";
1707 static char __pyx_k_69[] = "read %s: is unpaired";
1708 static char __pyx_k_70[] = "mate %s: is unmapped";
1709 static char __pyx_k_71[] = "mate not found";
1710 static char __pyx_k_76[] = "counting functionality requires a region/reference";
1711 static char __pyx_k_79[] = "count for a region is not available for sam files";
1712 static char __pyx_k_82[] = "no index available for pileup";
1713 static char __pyx_k_85[] = "pileup of samfiles not implemented yet";
1714 static char __pyx_k_92[] = "Samfile.mapped only available in bam files";
1715 static char __pyx_k_95[] = "Samfile.unmapped only available in bam files";
1716 static char __pyx_k__A[] = "A";
1717 static char __pyx_k__B[] = "B";
1718 static char __pyx_k__C[] = "C";
1719 static char __pyx_k__D[] = "D";
1720 static char __pyx_k__F[] = "F";
1721 static char __pyx_k__H[] = "H";
1722 static char __pyx_k__I[] = "I";
1723 static char __pyx_k__S[] = "S";
1724 static char __pyx_k__Z[] = "Z";
1725 static char __pyx_k__a[] = "a";
1726 static char __pyx_k__b[] = "b";
1727 static char __pyx_k__c[] = "c";
1728 static char __pyx_k__d[] = "d";
1729 static char __pyx_k__f[] = "f";
1730 static char __pyx_k__h[] = "h";
1731 static char __pyx_k__i[] = "i";
1732 static char __pyx_k__n[] = "n";
1733 static char __pyx_k__r[] = "r";
1734 static char __pyx_k__s[] = "s";
1735 static char __pyx_k__w[] = "w";
1736 static char __pyx_k_100[] = "@";
1737 static char __pyx_k_102[] = "header line without '@': '%s'";
1738 static char __pyx_k_104[] = "header line with invalid type '%s': '%s'";
1739 static char __pyx_k_105[] = ":";
1740 static char __pyx_k_107[] = "unknown field code '%s' in record '%s'";
1741 static char __pyx_k_108[] = "multiple '%s' lines are not permitted";
1742 static char __pyx_k_109[] = "@%s";
1743 static char __pyx_k_110[] = "%s:%s";
1744 static char __pyx_k_111[] = "invalid type for record %s: %s, expected %s";
1745 static char __pyx_k_113[] = "incomplete sequence information in '%s'";
1746 static char __pyx_k_116[] = "can not iterate over samfile without header";
1747 static char __pyx_k_119[] = "no index available for iteration";
1748 static char __pyx_k_125[] = "can only use this iterator on bam files";
1749 static char __pyx_k_126[] = "reference sequence for '%s' (tid=%i) not found";
1750 static char __pyx_k_127[] = "unknown stepper option `%s` in IteratorColumn";
1751 static char __pyx_k_129[] = "error during iteration";
1752 static char __pyx_k_132[] = "Invalid clipping in CIGAR string";
1753 static char __pyx_k_135[] = "%c%i";
1754 static char __pyx_k_136[] = "quality and sequence mismatch: %i != %i";
1755 static char __pyx_k_137[] = "%c";
1756 static char __pyx_k_138[] = "<";
1757 static char __pyx_k_140[] = "integer %i out of range of BAM/SAM specification";
1758 static char __pyx_k_141[] = "2sccI%i%s";
1759 static char __pyx_k_145[] = "2sc%is";
1760 static char __pyx_k_147[] = "create_string_buffer";
1761 static char __pyx_k_148[] = "tag '%s' not present";
1762 static char __pyx_k_149[] = "unknown auxilliary type '%s'";
1763 static char __pyx_k_150[] = "Contig index";
1764 static char __pyx_k_151[] = "Mapped position on contig";
1765 static char __pyx_k_152[] = "Contig index for mate pair";
1766 static char __pyx_k_153[] = "Position of mate pair";
1767 static char __pyx_k_154[] = "Insert size";
1768 static char __pyx_k_155[] = "Binary flag";
1769 static char __pyx_k_156[] = "Count of cigar entries";
1770 static char __pyx_k_157[] = "Cigar entries";
1771 static char __pyx_k_158[] = "Mapping quality";
1772 static char __pyx_k_159[] = "Bam index bin number";
1773 static char __pyx_k_160[] = "Length of query name";
1774 static char __pyx_k_161[] = "Query name";
1775 static char __pyx_k_162[] = "Length of query sequence";
1776 static char __pyx_k_163[] = "Query sequence";
1777 static char __pyx_k_164[] = "Quality scores";
1778 static char __pyx_k_165[] = "Length of auxilary data";
1779 static char __pyx_k_166[] = "Maximum data length";
1780 static char __pyx_k_167[] = "Current data length";
1781 static char __pyx_k_168[] = "%-30s %-10s= %s";
1782 static char __pyx_k_169[] = "(";
1783 static char __pyx_k_170[] = ")";
1784 static char __pyx_k_171[] = "This class cannot be instantiated from Python";
1785 static char __pyx_k_173[] = "PileupProxy accessed after iterator finished";
1786 static char __pyx_k_177[] = "No such file or directory: '%s'";
1787 static char __pyx_k_178[] = "-o";
1788 static char __pyx_k_179[] = "option -o is forbidden in samtools view";
1789 static char __pyx_k_185[] = "can only IndexReads on bam files";
1790 static char __pyx_k_186[] = "read %s not found";
1791 static char __pyx_k_187[] = "number of :term:`filename` associated with this object.";
1792 static char __pyx_k_188[] = "the query name (None if not present)";
1793 static char __pyx_k_189[] = "the :term:`cigar` alignment (None if not present). The alignment\n is returned as a list of operations. The operations are:\n\n +-----+--------------+-----+\n |M |BAM_CMATCH |0 |\n +-----+--------------+-----+\n |I |BAM_CINS |1 |\n +-----+--------------+-----+\n |D |BAM_CDEL |2 |\n +-----+--------------+-----+\n |N |BAM_CREF_SKIP |3 |\n +-----+--------------+-----+\n |S |BAM_CSOFT_CLIP|4 |\n +-----+--------------+-----+\n |H |BAM_CHARD_CLIP|5 |\n +-----+--------------+-----+\n |P |BAM_CPAD |6 |\n +-----+--------------+-----+\n |= |BAM_CEQUAL |7 |\n +-----+--------------+-----+\n |X |BAM_CDIFF |8 |\n +-----+--------------+-----+\n\n ";
1794 static char __pyx_k_190[] = "the :term:`cigar` alignment as a string.\n \n Returns the empty string if not present.\n ";
1795 static char __pyx_k_191[] = "read sequence bases, including :term:`soft clipped` bases (None if not present).\n\n In Python 3, this property is of type bytes and assigning a unicode string to it consisting of ASCII characters only will work, but is inefficient.";
1796 static char __pyx_k_192[] = "read sequence base qualities, including :term:`soft clipped` bases (None if not present).\n\n In Python 3, this property is of type bytes and assigning a unicode string to it consisting of ASCII characters only will work, but is inefficient.";
1797 static char __pyx_k_193[] = "aligned portion of the read and excludes any flanking bases that were :term:`soft clipped` (None if not present).\n\n In Python 3, this property is of type bytes. Assigning a unicode string to it consisting of ASCII characters only will work, but is inefficient.\n\n SAM/BAM files may included extra flanking bases sequences that were\n not part of the alignment. These bases may be the result of the\n Smith-Waterman or other algorithms, which may not require alignments\n that begin at the first residue or end at the last. In addition,\n extra sequencing adapters, multiplex identifiers, and low-quality bases that\n were not considered for alignment may have been retained.";
1798 static char __pyx_k_194[] = "aligned query sequence quality values (None if not present). This property is read-only.\n\n In Python 3, this property is of type bytes.";
1799 static char __pyx_k_195[] = "start index of the aligned query portion of the sequence (0-based, inclusive)";
1800 static char __pyx_k_196[] = "end index of the aligned query portion of the sequence (0-based, exclusive)";
1801 static char __pyx_k_197[] = "Length of the aligned query sequence";
1802 static char __pyx_k_198[] = "the tags in the AUX field.\n\n This property permits convenience access to\n the tags. Changes it the returned list will\n not update the tags automatically. Instead,\n the following is required for adding a\n new tag::\n\n read.tags = read.tags + [(\"RG\",0)]\n\n\n This method will happily write the same tag\n multiple times.\n ";
1803 static char __pyx_k_199[] = "properties flag";
1804 static char __pyx_k_200[] = "\n :term:`target` ID\n\n DEPRECATED from pysam-0.4 - use tid in the future.\n The rname field caused a lot of confusion as it returns\n the :term:`target` ID instead of the reference sequence\n name.\n\n .. note::\n\n This field contains the index of the reference sequence\n in the sequence dictionary. To obtain the name\n of the reference sequence, use :meth:`pysam.Samfile.getrname()`\n\n ";
1805 static char __pyx_k_201[] = "\n :term:`target` ID\n\n .. note::\n\n This field contains the index of the reference sequence\n in the sequence dictionary. To obtain the name\n of the reference sequence, use :meth:`pysam.Samfile.getrname()`\n\n ";
1806 static char __pyx_k_202[] = "0-based leftmost coordinate";
1807 static char __pyx_k_203[] = "properties bin";
1808 static char __pyx_k_204[] = "length of the read (read only). Returns 0 if not given.";
1809 static char __pyx_k_205[] = "aligned reference position of the read on the reference genome. \n \n aend points to one past the last aligned residue.\n Returns None if not available.";
1810 static char __pyx_k_206[] = "aligned length of the read on the reference genome. Returns None if\n not available.";
1811 static char __pyx_k_207[] = "mapping quality";
1812 static char __pyx_k_208[] = "the :term:`reference` id of the mate\n deprecated, use RNEXT instead.\n ";
1813 static char __pyx_k_209[] = "the :term:`reference` id of the mate ";
1814 static char __pyx_k_210[] = "the position of the mate\n deprecated, use PNEXT instead.";
1815 static char __pyx_k_211[] = "the position of the mate";
1816 static char __pyx_k_212[] = "the insert size\n deprecated: use tlen instead";
1817 static char __pyx_k_213[] = "the insert size";
1818 static char __pyx_k_214[] = "true if read is paired in sequencing";
1819 static char __pyx_k_215[] = "true if read is mapped in a proper pair";
1820 static char __pyx_k_216[] = "true if read itself is unmapped";
1821 static char __pyx_k_217[] = "true if the mate is unmapped";
1822 static char __pyx_k_218[] = "true if read is mapped to reverse strand";
1823 static char __pyx_k_219[] = "true is read is mapped to reverse strand";
1824 static char __pyx_k_220[] = "true if this is read1";
1825 static char __pyx_k_221[] = "true if this is read2";
1826 static char __pyx_k_222[] = "true if not primary alignment";
1827 static char __pyx_k_223[] = "true if QC failure";
1828 static char __pyx_k_224[] = "true if optical or PCR duplicate";
1829 static char __pyx_k_225[] = "a list of reference positions that this read aligns to.";
1830 static char __pyx_k_226[] = "a list of aligned read and reference positions.\n\n Unaligned position are marked by None.\n ";
1831 static char __pyx_k_227[] = "number of :term:`reference` sequences in the file.";
1832 static char __pyx_k_228[] = "tuple with the names of :term:`reference` sequences.";
1833 static char __pyx_k_229[] = "tuple of the lengths of the :term:`reference` sequences. The lengths are in the same order as\n :attr:`pysam.Samfile.references`\n ";
1834 static char __pyx_k_230[] = "total number of mapped reads in file.\n ";
1835 static char __pyx_k_231[] = "total number of unmapped reads in file.\n ";
1836 static char __pyx_k_232[] = "full contents of the :term:`sam file` header as a string.";
1837 static char __pyx_k_233[] = "header information within the :term:`sam file`. The records and fields are returned as\n a two-level dictionary.\n ";
1838 static char __pyx_k_234[] = "the chromosome ID as is defined in the header";
1839 static char __pyx_k_235[] = "number of reads mapping to this column.";
1840 static char __pyx_k_236[] = "list of reads (:class:`pysam.PileupRead`) aligned to this column";
1841 static char __pyx_k_237[] = "a :class:`pysam.AlignedRead` object of the aligned read";
1842 static char __pyx_k_238[] = "position of the read base at the pileup site, 0-based";
1843 static char __pyx_k_239[] = "indel length; 0 for no indel, positive for ins and negative for del";
1844 static char __pyx_k_240[] = "1 iff the base on the padded read is a deletion";
1845 static char __pyx_k_241[] = "current sequence length.";
1846 static char __pyx_k_242[] = "nucleotide position of SNP.";
1847 static char __pyx_k_243[] = "reference base at pos. ``N`` if no reference sequence supplied.";
1848 static char __pyx_k_244[] = "the genotype called.";
1849 static char __pyx_k_245[] = "the genotype quality (Phred-scaled).";
1850 static char __pyx_k_246[] = "the snp quality (Phred scaled) - probability of consensus being identical to reference sequence.";
1851 static char __pyx_k_247[] = "the root mean square (rms) of the mapping quality of all reads involved in the call.";
1852 static char __pyx_k_248[] = "coverage or read depth - the number of reads involved in the call.";
1853 static char __pyx_k_249[] = "getfilesystemencoding";
1854 static char __pyx_k_250[] = "MIDNSHP=X";
1855 static char __pyx_k_251[] = "([MIDNSHP=X])(\\d+)";
1856 static char __pyx_k_253[] = "=ACMGRSVTWYHKDBN";
1857 static char __pyx_k_256[] = "/ifs/devel/pysam/pysam/csamtools.pyx";
1858 static char __pyx_k_257[] = "A pileup column. A pileup column contains\n all the reads that map to a certain target base.\n\n tid\n chromosome ID as is defined in the header\n pos\n the target base coordinate (0-based)\n n\n number of reads mapping to this column\n pileups\n list of reads (:class:`pysam.PileupRead`) aligned to this column\n ";
1859 static char __pyx_k_266[] = "\n stderr is captured.\n ";
1860 static char __pyx_k_273[] = "does nothing. stderr can't be redirected on windows";
1861 static char __pyx_k_290[] = "http://mail.python.org/pipermail/python-list/2000-June/038406.html";
1862 static char __pyx_k__AS[] = "AS";
1863 static char __pyx_k__CL[] = "CL";
1864 static char __pyx_k__CN[] = "CN";
1865 static char __pyx_k__CO[] = "CO";
1866 static char __pyx_k__DS[] = "DS";
1867 static char __pyx_k__DT[] = "DT";
1868 static char __pyx_k__FO[] = "FO";
1869 static char __pyx_k__GO[] = "GO";
1870 static char __pyx_k__HD[] = "HD";
1871 static char __pyx_k__ID[] = "ID";
1872 static char __pyx_k__KS[] = "KS";
1873 static char __pyx_k__LB[] = "LB";
1874 static char __pyx_k__LN[] = "LN";
1875 static char __pyx_k__M5[] = "M5";
1876 static char __pyx_k__PG[] = "PG";
1877 static char __pyx_k__PI[] = "PI";
1878 static char __pyx_k__PL[] = "PL";
1879 static char __pyx_k__PN[] = "PN";
1880 static char __pyx_k__PU[] = "PU";
1881 static char __pyx_k__RG[] = "RG";
1882 static char __pyx_k__SM[] = "SM";
1883 static char __pyx_k__SN[] = "SN";
1884 static char __pyx_k__SO[] = "SO";
1885 static char __pyx_k__SP[] = "SP";
1886 static char __pyx_k__SQ[] = "SQ";
1887 static char __pyx_k__UR[] = "UR";
1888 static char __pyx_k__VN[] = "VN";
1889 static char __pyx_k__fd[] = "fd";
1890 static char __pyx_k__id[] = "id";
1891 static char __pyx_k__os[] = "os";
1892 static char __pyx_k__rU[] = "rU";
1893 static char __pyx_k__rb[] = "rb";
1894 static char __pyx_k__re[] = "re";
1895 static char __pyx_k__wb[] = "wb";
1896 static char __pyx_k__wh[] = "wh";
1897 static char __pyx_k__all[] = "all";
1898 static char __pyx_k__beg[] = "beg";
1899 static char __pyx_k__bin[] = "bin";
1900 static char __pyx_k__chr[] = "chr";
1901 static char __pyx_k__dup[] = "dup";
1902 static char __pyx_k__end[] = "end";
1903 static char __pyx_k__inf[] = "inf";
1904 static char __pyx_k__map[] = "map";
1905 static char __pyx_k__max[] = "max";
1906 static char __pyx_k__min[] = "min";
1907 static char __pyx_k__ofd[] = "ofd";
1908 static char __pyx_k__ord[] = "ord";
1909 static char __pyx_k__pos[] = "pos";
1910 static char __pyx_k__raw[] = "raw";
1911 static char __pyx_k__seq[] = "seq";
1912 static char __pyx_k__sys[] = "sys";
1913 static char __pyx_k__tid[] = "tid";
1914 static char __pyx_k__wbu[] = "wbu";
1915 static char __pyx_k__zip[] = "zip";
1916 static char __pyx_k__2scB[] = "2scB";
1917 static char __pyx_k__2scH[] = "2scH";
1918 static char __pyx_k__2scI[] = "2scI";
1919 static char __pyx_k__2scb[] = "2scb";
1920 static char __pyx_k__2scc[] = "2scc";
1921 static char __pyx_k__2scf[] = "2scf";
1922 static char __pyx_k__2sch[] = "2sch";
1923 static char __pyx_k__2sci[] = "2sci";
1924 static char __pyx_k__Outs[] = "Outs";
1925 static char __pyx_k__args[] = "args";
1926 static char __pyx_k__dup2[] = "dup2";
1927 static char __pyx_k__flag[] = "flag";
1928 static char __pyx_k__join[] = "join";
1929 static char __pyx_k__mapq[] = "mapq";
1930 static char __pyx_k__mask[] = "mask";
1931 static char __pyx_k__mode[] = "mode";
1932 static char __pyx_k__mpos[] = "mpos";
1933 static char __pyx_k__mrnm[] = "mrnm";
1934 static char __pyx_k__mtid[] = "mtid";
1935 static char __pyx_k__open[] = "open";
1936 static char __pyx_k__path[] = "path";
1937 static char __pyx_k__port[] = "port";
1938 static char __pyx_k__qpos[] = "qpos";
1939 static char __pyx_k__qseq[] = "qseq";
1940 static char __pyx_k__qual[] = "qual";
1941 static char __pyx_k__read[] = "read";
1942 static char __pyx_k__rlen[] = "rlen";
1943 static char __pyx_k__seek[] = "seek";
1944 static char __pyx_k__self[] = "self";
1945 static char __pyx_k__tags[] = "tags";
1946 static char __pyx_k__text[] = "text";
1947 static char __pyx_k__view[] = "view";
1948 static char __pyx_k__warn[] = "warn";
1949 static char __pyx_k___open[] = "_open";
1950 static char __pyx_k__ascii[] = "ascii";
1951 static char __pyx_k__bqual[] = "bqual";
1952 static char __pyx_k__cargs[] = "cargs";
1953 static char __pyx_k__cigar[] = "cigar";
1954 static char __pyx_k__close[] = "close";
1955 static char __pyx_k__flush[] = "flush";
1956 static char __pyx_k__indel[] = "indel";
1957 static char __pyx_k__index[] = "index";
1958 static char __pyx_k__isize[] = "isize";
1959 static char __pyx_k__items[] = "items";
1960 static char __pyx_k__l_aux[] = "l_aux";
1961 static char __pyx_k__level[] = "level";
1962 static char __pyx_k__qname[] = "qname";
1963 static char __pyx_k__rname[] = "rname";
1964 static char __pyx_k__setfd[] = "setfd";
1965 static char __pyx_k__split[] = "split";
1966 static char __pyx_k__start[] = "start";
1967 static char __pyx_k__strip[] = "strip";
1968 static char __pyx_k__types[] = "types";
1969 static char __pyx_k__where[] = "where";
1970 static char __pyx_k__write[] = "write";
1971 static char __pyx_k__ctypes[] = "ctypes";
1972 static char __pyx_k__decode[] = "decode";
1973 static char __pyx_k__encode[] = "encode";
1974 static char __pyx_k__exists[] = "exists";
1975 static char __pyx_k__extend[] = "extend";
1976 static char __pyx_k__fields[] = "fields";
1977 static char __pyx_k__fileno[] = "fileno";
1978 static char __pyx_k__gettid[] = "gettid";
1979 static char __pyx_k__header[] = "header";
1980 static char __pyx_k__is_del[] = "is_del";
1981 static char __pyx_k__l_qseq[] = "l_qseq";
1982 static char __pyx_k__m_data[] = "m_data";
1983 static char __pyx_k__method[] = "method";
1984 static char __pyx_k__object[] = "object";
1985 static char __pyx_k__offset[] = "offset";
1986 static char __pyx_k__record[] = "record";
1987 static char __pyx_k__region[] = "region";
1988 static char __pyx_k__remove[] = "remove";
1989 static char __pyx_k__reopen[] = "reopen";
1990 static char __pyx_k__retval[] = "retval";
1991 static char __pyx_k__sorted[] = "sorted";
1992 static char __pyx_k__stderr[] = "stderr";
1993 static char __pyx_k__stdout[] = "stdout";
1994 static char __pyx_k__struct[] = "struct";
1995 static char __pyx_k__system[] = "system";
1996 static char __pyx_k__IOError[] = "IOError";
1997 static char __pyx_k__OSError[] = "OSError";
1998 static char __pyx_k__O_CREAT[] = "O_CREAT";
1999 static char __pyx_k__Samfile[] = "Samfile";
2000 static char __pyx_k__Windows[] = "Windows";
2001 static char __pyx_k____all__[] = "__all__";
2002 static char __pyx_k____del__[] = "__del__";
2003 static char __pyx_k____str__[] = "__str__";
2004 static char __pyx_k___isOpen[] = "_isOpen";
2005 static char __pyx_k__compile[] = "compile";
2006 static char __pyx_k__findall[] = "findall";
2007 static char __pyx_k__is_head[] = "is_head";
2008 static char __pyx_k__is_tail[] = "is_tail";
2009 static char __pyx_k__islower[] = "islower";
2010 static char __pyx_k__isupper[] = "isupper";
2011 static char __pyx_k__l_qname[] = "l_qname";
2012 static char __pyx_k__lengths[] = "lengths";
2013 static char __pyx_k__mkstemp[] = "mkstemp";
2014 static char __pyx_k__n_cigar[] = "n_cigar";
2015 static char __pyx_k__pileups[] = "pileups";
2016 static char __pyx_k__release[] = "release";
2017 static char __pyx_k__restore[] = "restore";
2018 static char __pyx_k__samfile[] = "samfile";
2019 static char __pyx_k__setfile[] = "setfile";
2020 static char __pyx_k__stepper[] = "stepper";
2021 static char __pyx_k__streams[] = "streams";
2022 static char __pyx_k__KeyError[] = "KeyError";
2023 static char __pyx_k__O_WRONLY[] = "O_WRONLY";
2024 static char __pyx_k____dict__[] = "__dict__";
2025 static char __pyx_k____exit__[] = "__exit__";
2026 static char __pyx_k____init__[] = "__init__";
2027 static char __pyx_k____main__[] = "__main__";
2028 static char __pyx_k____test__[] = "__test__";
2029 static char __pyx_k__calcsize[] = "calcsize";
2030 static char __pyx_k__callback[] = "callback";
2031 static char __pyx_k__check_sq[] = "check_sq";
2032 static char __pyx_k__coverage[] = "coverage";
2033 static char __pyx_k__data_len[] = "data_len";
2034 static char __pyx_k__exc_type[] = "exc_type";
2035 static char __pyx_k__filename[] = "filename";
2036 static char __pyx_k__genotype[] = "genotype";
2037 static char __pyx_k__nextiter[] = "nextiter";
2038 static char __pyx_k__platform[] = "platform";
2039 static char __pyx_k__samtools[] = "samtools";
2040 static char __pyx_k__stderr_f[] = "stderr_f";
2041 static char __pyx_k__stderr_h[] = "stderr_h";
2042 static char __pyx_k__stdout_f[] = "stdout_f";
2043 static char __pyx_k__stdout_h[] = "stdout_h";
2044 static char __pyx_k__tempfile[] = "tempfile";
2045 static char __pyx_k__template[] = "template";
2046 static char __pyx_k__truncate[] = "truncate";
2047 static char __pyx_k__warnings[] = "warnings";
2048 static char __pyx_k__Fastafile[] = "Fastafile";
2049 static char __pyx_k__TypeError[] = "TypeError";
2050 static char __pyx_k____enter__[] = "__enter__";
2051 static char __pyx_k___hasIndex[] = "_hasIndex";
2052 static char __pyx_k__alignment[] = "alignment";
2053 static char __pyx_k__csamtools[] = "csamtools";
2054 static char __pyx_k__enumerate[] = "enumerate";
2055 static char __pyx_k__exc_value[] = "exc_value";
2056 static char __pyx_k__fastafile[] = "fastafile";
2057 static char __pyx_k__itertools[] = "itertools";
2058 static char __pyx_k__max_depth[] = "max_depth";
2059 static char __pyx_k__pack_into[] = "pack_into";
2060 static char __pyx_k__positions[] = "positions";
2061 static char __pyx_k__readlines[] = "readlines";
2062 static char __pyx_k__reference[] = "reference";
2063 static char __pyx_k__setdevice[] = "setdevice";
2064 static char __pyx_k__traceback[] = "traceback";
2065 static char __pyx_k__until_eof[] = "until_eof";
2066 static char __pyx_k__CIGAR2CODE[] = "CIGAR2CODE";
2067 static char __pyx_k__IS_PYTHON3[] = "IS_PYTHON3";
2068 static char __pyx_k__PileupRead[] = "PileupRead";
2069 static char __pyx_k__ValueError[] = "ValueError";
2070 static char __pyx_k___buildLine[] = "_buildLine";
2071 static char __pyx_k__out_stderr[] = "out_stderr";
2072 static char __pyx_k__out_stdout[] = "out_stdout";
2073 static char __pyx_k__references[] = "references";
2074 static char __pyx_k__startswith[] = "startswith";
2075 static char __pyx_k__AlignedRead[] = "AlignedRead";
2076 static char __pyx_k__CIGAR_REGEX[] = "CIGAR_REGEX";
2077 static char __pyx_k__IteratorRow[] = "IteratorRow";
2078 static char __pyx_k__PileupProxy[] = "PileupProxy";
2079 static char __pyx_k__StderrStore[] = "StderrStore";
2080 static char __pyx_k__add_sq_text[] = "add_sq_text";
2081 static char __pyx_k__collections[] = "collections";
2082 static char __pyx_k__defaultdict[] = "defaultdict";
2083 static char __pyx_k__nreferences[] = "nreferences";
2084 static char __pyx_k__snp_quality[] = "snp_quality";
2085 static char __pyx_k__stdout_save[] = "stdout_save";
2086 static char __pyx_k__IndexedReads[] = "IndexedReads";
2087 static char __pyx_k__PileupColumn[] = "PileupColumn";
2088 static char __pyx_k___parseRegion[] = "_parseRegion";
2089 static char __pyx_k__catch_stdout[] = "catch_stdout";
2090 static char __pyx_k__check_header[] = "check_header";
2091 static char __pyx_k__version_info[] = "version_info";
2092 static char __pyx_k__OverflowError[] = "OverflowError";
2093 static char __pyx_k__StopIteration[] = "StopIteration";
2094 static char __pyx_k__VALID_HEADERS[] = "VALID_HEADERS";
2095 static char __pyx_k__AttributeError[] = "AttributeError";
2096 static char __pyx_k__IteratorColumn[] = "IteratorColumn";
2097 static char __pyx_k__readAndRelease[] = "readAndRelease";
2098 static char __pyx_k__reference_base[] = "reference_base";
2099 static char __pyx_k__referencenames[] = "referencenames";
2100 static char __pyx_k__mapping_quality[] = "mapping_quality";
2101 static char __pyx_k____getattribute__[] = "__getattribute__";
2102 static char __pyx_k__referencelengths[] = "referencelengths";
2103 static char __pyx_k__consensus_quality[] = "consensus_quality";
2104 static char __pyx_k__StderrStoreWindows[] = "StderrStoreWindows";
2105 static char __pyx_k__UnicodeDecodeError[] = "UnicodeDecodeError";
2106 static char __pyx_k__VALID_HEADER_ORDER[] = "VALID_HEADER_ORDER";
2107 static char __pyx_k__VALID_HEADER_TYPES[] = "VALID_HEADER_TYPES";
2108 static char __pyx_k___samtools_dispatch[] = "_samtools_dispatch";
2109 static char __pyx_k__getdefaultencoding[] = "getdefaultencoding";
2110 static char __pyx_k__NotImplementedError[] = "NotImplementedError";
2111 static char __pyx_k__VALID_HEADER_FIELDS[] = "VALID_HEADER_FIELDS";
2112 static PyObject *__pyx_kp_u_1;
2113 static PyObject *__pyx_kp_s_10;
2114 static PyObject *__pyx_kp_s_100;
2115 static PyObject *__pyx_kp_s_102;
2116 static PyObject *__pyx_kp_s_104;
2117 static PyObject *__pyx_kp_s_105;
2118 static PyObject *__pyx_kp_s_107;
2119 static PyObject *__pyx_kp_s_108;
2120 static PyObject *__pyx_kp_s_109;
2121 static PyObject *__pyx_kp_s_110;
2122 static PyObject *__pyx_kp_s_111;
2123 static PyObject *__pyx_kp_s_113;
2124 static PyObject *__pyx_kp_s_116;
2125 static PyObject *__pyx_kp_s_119;
2126 static PyObject *__pyx_kp_s_125;
2127 static PyObject *__pyx_kp_s_126;
2128 static PyObject *__pyx_kp_s_127;
2129 static PyObject *__pyx_kp_s_129;
2130 static PyObject *__pyx_kp_s_13;
2131 static PyObject *__pyx_kp_s_135;
2132 static PyObject *__pyx_kp_s_136;
2133 static PyObject *__pyx_kp_s_137;
2134 static PyObject *__pyx_kp_s_138;
2135 static PyObject *__pyx_kp_s_140;
2136 static PyObject *__pyx_kp_s_141;
2137 static PyObject *__pyx_kp_s_145;
2138 static PyObject *__pyx_n_s_147;
2139 static PyObject *__pyx_kp_s_148;
2140 static PyObject *__pyx_kp_s_149;
2141 static PyObject *__pyx_kp_s_15;
2142 static PyObject *__pyx_kp_s_150;
2143 static PyObject *__pyx_kp_s_151;
2144 static PyObject *__pyx_kp_s_152;
2145 static PyObject *__pyx_kp_s_153;
2146 static PyObject *__pyx_kp_s_154;
2147 static PyObject *__pyx_kp_s_155;
2148 static PyObject *__pyx_kp_s_156;
2149 static PyObject *__pyx_kp_s_157;
2150 static PyObject *__pyx_kp_s_158;
2151 static PyObject *__pyx_kp_s_159;
2152 static PyObject *__pyx_kp_b_16;
2153 static PyObject *__pyx_kp_s_16;
2154 static PyObject *__pyx_kp_s_160;
2155 static PyObject *__pyx_kp_s_161;
2156 static PyObject *__pyx_kp_s_162;
2157 static PyObject *__pyx_kp_s_163;
2158 static PyObject *__pyx_kp_s_164;
2159 static PyObject *__pyx_kp_s_165;
2160 static PyObject *__pyx_kp_s_166;
2161 static PyObject *__pyx_kp_s_167;
2162 static PyObject *__pyx_kp_s_168;
2163 static PyObject *__pyx_kp_s_169;
2164 static PyObject *__pyx_kp_s_17;
2165 static PyObject *__pyx_kp_s_170;
2166 static PyObject *__pyx_kp_s_171;
2167 static PyObject *__pyx_kp_s_173;
2168 static PyObject *__pyx_kp_s_177;
2169 static PyObject *__pyx_kp_s_178;
2170 static PyObject *__pyx_kp_s_179;
2171 static PyObject *__pyx_kp_s_18;
2172 static PyObject *__pyx_kp_s_185;
2173 static PyObject *__pyx_kp_s_186;
2174 static PyObject *__pyx_kp_s_19;
2175 static PyObject *__pyx_kp_s_24;
2176 static PyObject *__pyx_n_s_249;
2177 static PyObject *__pyx_kp_s_251;
2178 static PyObject *__pyx_kp_s_256;
2179 static PyObject *__pyx_kp_s_257;
2180 static PyObject *__pyx_kp_s_266;
2181 static PyObject *__pyx_kp_s_273;
2182 static PyObject *__pyx_kp_s_29;
2183 static PyObject *__pyx_kp_s_290;
2184 static PyObject *__pyx_kp_u_3;
2185 static PyObject *__pyx_kp_s_30;
2186 static PyObject *__pyx_kp_s_31;
2187 static PyObject *__pyx_kp_s_32;
2188 static PyObject *__pyx_kp_s_33;
2189 static PyObject *__pyx_kp_s_34;
2190 static PyObject *__pyx_kp_s_35;
2191 static PyObject *__pyx_kp_s_36;
2192 static PyObject *__pyx_kp_b_37;
2193 static PyObject *__pyx_kp_s_38;
2194 static PyObject *__pyx_kp_s_41;
2195 static PyObject *__pyx_kp_s_43;
2196 static PyObject *__pyx_kp_s_45;
2197 static PyObject *__pyx_kp_s_46;
2198 static PyObject *__pyx_kp_s_48;
2199 static PyObject *__pyx_kp_s_5;
2200 static PyObject *__pyx_kp_s_50;
2201 static PyObject *__pyx_kp_s_56;
2202 static PyObject *__pyx_kp_s_58;
2203 static PyObject *__pyx_kp_s_6;
2204 static PyObject *__pyx_kp_s_60;
2205 static PyObject *__pyx_kp_s_62;
2206 static PyObject *__pyx_kp_s_64;
2207 static PyObject *__pyx_kp_s_66;
2208 static PyObject *__pyx_kp_s_69;
2209 static PyObject *__pyx_kp_s_7;
2210 static PyObject *__pyx_kp_s_70;
2211 static PyObject *__pyx_kp_s_71;
2212 static PyObject *__pyx_kp_s_76;
2213 static PyObject *__pyx_kp_s_79;
2214 static PyObject *__pyx_kp_s_82;
2215 static PyObject *__pyx_kp_s_85;
2216 static PyObject *__pyx_kp_s_9;
2217 static PyObject *__pyx_kp_s_92;
2218 static PyObject *__pyx_kp_s_95;
2219 static PyObject *__pyx_kp_s__2scB;
2220 static PyObject *__pyx_kp_s__2scH;
2221 static PyObject *__pyx_kp_s__2scI;
2222 static PyObject *__pyx_kp_s__2scb;
2223 static PyObject *__pyx_kp_s__2scc;
2224 static PyObject *__pyx_kp_s__2scf;
2225 static PyObject *__pyx_kp_s__2sch;
2226 static PyObject *__pyx_kp_s__2sci;
2227 static PyObject *__pyx_n_s__A;
2228 static PyObject *__pyx_n_s__AS;
2229 static PyObject *__pyx_n_s__AlignedRead;
2230 static PyObject *__pyx_n_s__AttributeError;
2231 static PyObject *__pyx_n_s__B;
2232 static PyObject *__pyx_n_s__C;
2233 static PyObject *__pyx_n_s__CIGAR2CODE;
2234 static PyObject *__pyx_n_s__CIGAR_REGEX;
2235 static PyObject *__pyx_n_s__CL;
2236 static PyObject *__pyx_n_s__CN;
2237 static PyObject *__pyx_n_s__CO;
2238 static PyObject *__pyx_n_s__D;
2239 static PyObject *__pyx_n_s__DS;
2240 static PyObject *__pyx_n_s__DT;
2241 static PyObject *__pyx_n_s__F;
2242 static PyObject *__pyx_n_s__FO;
2243 static PyObject *__pyx_n_s__Fastafile;
2244 static PyObject *__pyx_n_s__GO;
2245 static PyObject *__pyx_n_s__H;
2246 static PyObject *__pyx_n_s__HD;
2247 static PyObject *__pyx_n_s__I;
2248 static PyObject *__pyx_n_s__ID;
2249 static PyObject *__pyx_n_s__IOError;
2250 static PyObject *__pyx_n_s__IS_PYTHON3;
2251 static PyObject *__pyx_n_s__IndexedReads;
2252 static PyObject *__pyx_n_s__IteratorColumn;
2253 static PyObject *__pyx_n_s__IteratorRow;
2254 static PyObject *__pyx_n_s__KS;
2255 static PyObject *__pyx_n_s__KeyError;
2256 static PyObject *__pyx_n_s__LB;
2257 static PyObject *__pyx_n_s__LN;
2258 static PyObject *__pyx_n_s__M5;
2259 static PyObject *__pyx_n_s__NotImplementedError;
2260 static PyObject *__pyx_n_s__OSError;
2261 static PyObject *__pyx_n_s__O_CREAT;
2262 static PyObject *__pyx_n_s__O_WRONLY;
2263 static PyObject *__pyx_n_s__Outs;
2264 static PyObject *__pyx_n_s__OverflowError;
2265 static PyObject *__pyx_n_s__PG;
2266 static PyObject *__pyx_n_s__PI;
2267 static PyObject *__pyx_n_s__PL;
2268 static PyObject *__pyx_n_s__PN;
2269 static PyObject *__pyx_n_s__PU;
2270 static PyObject *__pyx_n_s__PileupColumn;
2271 static PyObject *__pyx_n_s__PileupProxy;
2272 static PyObject *__pyx_n_s__PileupRead;
2273 static PyObject *__pyx_n_s__RG;
2274 static PyObject *__pyx_n_s__S;
2275 static PyObject *__pyx_n_s__SM;
2276 static PyObject *__pyx_n_s__SN;
2277 static PyObject *__pyx_n_s__SO;
2278 static PyObject *__pyx_n_s__SP;
2279 static PyObject *__pyx_n_s__SQ;
2280 static PyObject *__pyx_n_s__Samfile;
2281 static PyObject *__pyx_n_s__StderrStore;
2282 static PyObject *__pyx_n_s__StderrStoreWindows;
2283 static PyObject *__pyx_n_s__StopIteration;
2284 static PyObject *__pyx_n_s__TypeError;
2285 static PyObject *__pyx_n_s__UR;
2286 static PyObject *__pyx_n_s__UnicodeDecodeError;
2287 static PyObject *__pyx_n_s__VALID_HEADERS;
2288 static PyObject *__pyx_n_s__VALID_HEADER_FIELDS;
2289 static PyObject *__pyx_n_s__VALID_HEADER_ORDER;
2290 static PyObject *__pyx_n_s__VALID_HEADER_TYPES;
2291 static PyObject *__pyx_n_s__VN;
2292 static PyObject *__pyx_n_s__ValueError;
2293 static PyObject *__pyx_n_s__Windows;
2294 static PyObject *__pyx_n_s__Z;
2295 static PyObject *__pyx_n_s____all__;
2296 static PyObject *__pyx_n_s____del__;
2297 static PyObject *__pyx_n_s____dict__;
2298 static PyObject *__pyx_n_s____enter__;
2299 static PyObject *__pyx_n_s____exit__;
2300 static PyObject *__pyx_n_s____getattribute__;
2301 static PyObject *__pyx_n_s____init__;
2302 static PyObject *__pyx_n_s____main__;
2303 static PyObject *__pyx_n_s____str__;
2304 static PyObject *__pyx_n_s____test__;
2305 static PyObject *__pyx_n_s___buildLine;
2306 static PyObject *__pyx_n_s___hasIndex;
2307 static PyObject *__pyx_n_s___isOpen;
2308 static PyObject *__pyx_n_s___open;
2309 static PyObject *__pyx_n_s___parseRegion;
2310 static PyObject *__pyx_n_s___samtools_dispatch;
2311 static PyObject *__pyx_n_s__a;
2312 static PyObject *__pyx_n_s__add_sq_text;
2313 static PyObject *__pyx_n_s__alignment;
2314 static PyObject *__pyx_n_s__all;
2315 static PyObject *__pyx_n_s__args;
2316 static PyObject *__pyx_n_s__ascii;
2317 static PyObject *__pyx_n_s__b;
2318 static PyObject *__pyx_n_s__beg;
2319 static PyObject *__pyx_n_s__bin;
2320 static PyObject *__pyx_n_s__bqual;
2321 static PyObject *__pyx_n_s__c;
2322 static PyObject *__pyx_n_s__calcsize;
2323 static PyObject *__pyx_n_s__callback;
2324 static PyObject *__pyx_n_s__cargs;
2325 static PyObject *__pyx_n_s__catch_stdout;
2326 static PyObject *__pyx_n_s__check_header;
2327 static PyObject *__pyx_n_s__check_sq;
2328 static PyObject *__pyx_n_s__chr;
2329 static PyObject *__pyx_n_s__cigar;
2330 static PyObject *__pyx_n_s__close;
2331 static PyObject *__pyx_n_s__collections;
2332 static PyObject *__pyx_n_s__compile;
2333 static PyObject *__pyx_n_s__consensus_quality;
2334 static PyObject *__pyx_n_s__coverage;
2335 static PyObject *__pyx_n_s__csamtools;
2336 static PyObject *__pyx_n_s__ctypes;
2337 static PyObject *__pyx_n_s__d;
2338 static PyObject *__pyx_n_s__data_len;
2339 static PyObject *__pyx_n_s__decode;
2340 static PyObject *__pyx_n_s__defaultdict;
2341 static PyObject *__pyx_n_s__dup;
2342 static PyObject *__pyx_n_s__dup2;
2343 static PyObject *__pyx_n_s__encode;
2344 static PyObject *__pyx_n_s__end;
2345 static PyObject *__pyx_n_s__enumerate;
2346 static PyObject *__pyx_n_s__exc_type;
2347 static PyObject *__pyx_n_s__exc_value;
2348 static PyObject *__pyx_n_s__exists;
2349 static PyObject *__pyx_n_s__extend;
2350 static PyObject *__pyx_n_s__f;
2351 static PyObject *__pyx_n_s__fastafile;
2352 static PyObject *__pyx_n_s__fd;
2353 static PyObject *__pyx_n_s__fields;
2354 static PyObject *__pyx_n_s__filename;
2355 static PyObject *__pyx_n_s__fileno;
2356 static PyObject *__pyx_n_s__findall;
2357 static PyObject *__pyx_n_s__flag;
2358 static PyObject *__pyx_n_s__flush;
2359 static PyObject *__pyx_n_s__genotype;
2360 static PyObject *__pyx_n_s__getdefaultencoding;
2361 static PyObject *__pyx_n_s__gettid;
2362 static PyObject *__pyx_n_s__h;
2363 static PyObject *__pyx_n_s__header;
2364 static PyObject *__pyx_n_s__i;
2365 static PyObject *__pyx_n_s__id;
2366 static PyObject *__pyx_n_s__indel;
2367 static PyObject *__pyx_n_s__index;
2368 static PyObject *__pyx_n_s__inf;
2369 static PyObject *__pyx_n_s__is_del;
2370 static PyObject *__pyx_n_s__is_head;
2371 static PyObject *__pyx_n_s__is_tail;
2372 static PyObject *__pyx_n_s__isize;
2373 static PyObject *__pyx_n_s__islower;
2374 static PyObject *__pyx_n_s__isupper;
2375 static PyObject *__pyx_n_s__items;
2376 static PyObject *__pyx_n_s__itertools;
2377 static PyObject *__pyx_n_s__join;
2378 static PyObject *__pyx_n_s__l_aux;
2379 static PyObject *__pyx_n_s__l_qname;
2380 static PyObject *__pyx_n_s__l_qseq;
2381 static PyObject *__pyx_n_s__lengths;
2382 static PyObject *__pyx_n_s__level;
2383 static PyObject *__pyx_n_s__m_data;
2384 static PyObject *__pyx_n_s__map;
2385 static PyObject *__pyx_n_s__mapping_quality;
2386 static PyObject *__pyx_n_s__mapq;
2387 static PyObject *__pyx_n_s__mask;
2388 static PyObject *__pyx_n_s__max;
2389 static PyObject *__pyx_n_s__max_depth;
2390 static PyObject *__pyx_n_s__method;
2391 static PyObject *__pyx_n_s__min;
2392 static PyObject *__pyx_n_s__mkstemp;
2393 static PyObject *__pyx_n_s__mode;
2394 static PyObject *__pyx_n_s__mpos;
2395 static PyObject *__pyx_n_s__mrnm;
2396 static PyObject *__pyx_n_s__mtid;
2397 static PyObject *__pyx_n_s__n;
2398 static PyObject *__pyx_n_s__n_cigar;
2399 static PyObject *__pyx_n_s__nextiter;
2400 static PyObject *__pyx_n_s__nreferences;
2401 static PyObject *__pyx_n_s__object;
2402 static PyObject *__pyx_n_s__ofd;
2403 static PyObject *__pyx_n_s__offset;
2404 static PyObject *__pyx_n_s__open;
2405 static PyObject *__pyx_n_s__ord;
2406 static PyObject *__pyx_n_s__os;
2407 static PyObject *__pyx_n_s__out_stderr;
2408 static PyObject *__pyx_n_s__out_stdout;
2409 static PyObject *__pyx_n_s__pack_into;
2410 static PyObject *__pyx_n_s__path;
2411 static PyObject *__pyx_n_s__pileups;
2412 static PyObject *__pyx_n_s__platform;
2413 static PyObject *__pyx_n_s__port;
2414 static PyObject *__pyx_n_s__pos;
2415 static PyObject *__pyx_n_s__positions;
2416 static PyObject *__pyx_n_s__qname;
2417 static PyObject *__pyx_n_s__qpos;
2418 static PyObject *__pyx_n_s__qseq;
2419 static PyObject *__pyx_n_s__qual;
2420 static PyObject *__pyx_n_b__r;
2421 static PyObject *__pyx_n_s__r;
2422 static PyObject *__pyx_n_s__rU;
2423 static PyObject *__pyx_n_s__raw;
2424 static PyObject *__pyx_n_b__rb;
2425 static PyObject *__pyx_n_s__rb;
2426 static PyObject *__pyx_n_s__re;
2427 static PyObject *__pyx_n_s__read;
2428 static PyObject *__pyx_n_s__readAndRelease;
2429 static PyObject *__pyx_n_s__readlines;
2430 static PyObject *__pyx_n_s__record;
2431 static PyObject *__pyx_n_s__reference;
2432 static PyObject *__pyx_n_s__reference_base;
2433 static PyObject *__pyx_n_s__referencelengths;
2434 static PyObject *__pyx_n_s__referencenames;
2435 static PyObject *__pyx_n_s__references;
2436 static PyObject *__pyx_n_s__region;
2437 static PyObject *__pyx_n_s__release;
2438 static PyObject *__pyx_n_s__remove;
2439 static PyObject *__pyx_n_s__reopen;
2440 static PyObject *__pyx_n_s__restore;
2441 static PyObject *__pyx_n_s__retval;
2442 static PyObject *__pyx_n_s__rlen;
2443 static PyObject *__pyx_n_s__rname;
2444 static PyObject *__pyx_n_s__s;
2445 static PyObject *__pyx_n_s__samfile;
2446 static PyObject *__pyx_n_s__samtools;
2447 static PyObject *__pyx_n_s__seek;
2448 static PyObject *__pyx_n_s__self;
2449 static PyObject *__pyx_n_s__seq;
2450 static PyObject *__pyx_n_s__setdevice;
2451 static PyObject *__pyx_n_s__setfd;
2452 static PyObject *__pyx_n_s__setfile;
2453 static PyObject *__pyx_n_s__snp_quality;
2454 static PyObject *__pyx_n_s__sorted;
2455 static PyObject *__pyx_n_s__split;
2456 static PyObject *__pyx_n_s__start;
2457 static PyObject *__pyx_n_s__startswith;
2458 static PyObject *__pyx_n_s__stderr;
2459 static PyObject *__pyx_n_s__stderr_f;
2460 static PyObject *__pyx_n_s__stderr_h;
2461 static PyObject *__pyx_n_s__stdout;
2462 static PyObject *__pyx_n_s__stdout_f;
2463 static PyObject *__pyx_n_s__stdout_h;
2464 static PyObject *__pyx_n_s__stdout_save;
2465 static PyObject *__pyx_n_s__stepper;
2466 static PyObject *__pyx_n_s__streams;
2467 static PyObject *__pyx_n_s__strip;
2468 static PyObject *__pyx_n_s__struct;
2469 static PyObject *__pyx_n_s__sys;
2470 static PyObject *__pyx_n_s__system;
2471 static PyObject *__pyx_n_s__tags;
2472 static PyObject *__pyx_n_s__tempfile;
2473 static PyObject *__pyx_n_s__template;
2474 static PyObject *__pyx_n_s__text;
2475 static PyObject *__pyx_n_s__tid;
2476 static PyObject *__pyx_n_s__traceback;
2477 static PyObject *__pyx_n_s__truncate;
2478 static PyObject *__pyx_n_s__types;
2479 static PyObject *__pyx_n_s__until_eof;
2480 static PyObject *__pyx_n_s__version_info;
2481 static PyObject *__pyx_n_s__view;
2482 static PyObject *__pyx_n_s__w;
2483 static PyObject *__pyx_n_s__warn;
2484 static PyObject *__pyx_n_s__warnings;
2485 static PyObject *__pyx_n_s__wb;
2486 static PyObject *__pyx_n_s__wbu;
2487 static PyObject *__pyx_n_s__wh;
2488 static PyObject *__pyx_n_s__where;
2489 static PyObject *__pyx_n_s__write;
2490 static PyObject *__pyx_n_s__zip;
2491 static PyObject *__pyx_int_0;
2492 static PyObject *__pyx_int_1;
2493 static PyObject *__pyx_int_2;
2494 static PyObject *__pyx_int_3;
2495 static PyObject *__pyx_int_4;
2496 static PyObject *__pyx_int_8;
2497 static PyObject *__pyx_int_16;
2498 static PyObject *__pyx_int_32;
2499 static PyObject *__pyx_int_64;
2500 static PyObject *__pyx_int_128;
2501 static PyObject *__pyx_int_255;
2502 static PyObject *__pyx_int_256;
2503 static PyObject *__pyx_int_512;
2504 static PyObject *__pyx_int_neg_127;
2505 static PyObject *__pyx_int_0660;
2506 static PyObject *__pyx_int_1024;
2507 static PyObject *__pyx_int_8000;
2508 static PyObject *__pyx_int_65535;
2509 static PyObject *__pyx_int_neg_32767;
2510 static PyObject *__pyx_int_536870912;
2511 static PyObject *__pyx_int_4294967295;
2512 static PyObject *__pyx_int_neg_2147483648;
2513 static PyObject *__pyx_k_21;
2514 static PyObject *__pyx_k_22;
2515 static PyObject *__pyx_k_23;
2516 static PyObject *__pyx_k_54;
2517 static PyObject *__pyx_k_73;
2518 static int __pyx_k_128;
2519 static PyObject *__pyx_k_176;
2520 static PyObject *__pyx_k_tuple_2;
2521 static PyObject *__pyx_k_tuple_4;
2522 static PyObject *__pyx_k_tuple_8;
2523 static PyObject *__pyx_k_tuple_11;
2524 static PyObject *__pyx_k_tuple_12;
2525 static PyObject *__pyx_k_tuple_14;
2526 static PyObject *__pyx_k_tuple_20;
2527 static PyObject *__pyx_k_tuple_25;
2528 static PyObject *__pyx_k_tuple_39;
2529 static PyObject *__pyx_k_tuple_40;
2530 static PyObject *__pyx_k_tuple_42;
2531 static PyObject *__pyx_k_tuple_44;
2532 static PyObject *__pyx_k_tuple_47;
2533 static PyObject *__pyx_k_tuple_49;
2534 static PyObject *__pyx_k_tuple_51;
2535 static PyObject *__pyx_k_tuple_52;
2536 static PyObject *__pyx_k_tuple_53;
2537 static PyObject *__pyx_k_tuple_55;
2538 static PyObject *__pyx_k_tuple_57;
2539 static PyObject *__pyx_k_tuple_59;
2540 static PyObject *__pyx_k_tuple_61;
2541 static PyObject *__pyx_k_tuple_63;
2542 static PyObject *__pyx_k_tuple_65;
2543 static PyObject *__pyx_k_tuple_67;
2544 static PyObject *__pyx_k_tuple_68;
2545 static PyObject *__pyx_k_tuple_72;
2546 static PyObject *__pyx_k_tuple_74;
2547 static PyObject *__pyx_k_tuple_75;
2548 static PyObject *__pyx_k_tuple_77;
2549 static PyObject *__pyx_k_tuple_78;
2550 static PyObject *__pyx_k_tuple_80;
2551 static PyObject *__pyx_k_tuple_81;
2552 static PyObject *__pyx_k_tuple_83;
2553 static PyObject *__pyx_k_tuple_84;
2554 static PyObject *__pyx_k_tuple_86;
2555 static PyObject *__pyx_k_tuple_87;
2556 static PyObject *__pyx_k_tuple_88;
2557 static PyObject *__pyx_k_tuple_89;
2558 static PyObject *__pyx_k_tuple_90;
2559 static PyObject *__pyx_k_tuple_91;
2560 static PyObject *__pyx_k_tuple_93;
2561 static PyObject *__pyx_k_tuple_94;
2562 static PyObject *__pyx_k_tuple_96;
2563 static PyObject *__pyx_k_tuple_97;
2564 static PyObject *__pyx_k_tuple_98;
2565 static PyObject *__pyx_k_tuple_99;
2566 static PyObject *__pyx_k_tuple_101;
2567 static PyObject *__pyx_k_tuple_103;
2568 static PyObject *__pyx_k_tuple_106;
2569 static PyObject *__pyx_k_tuple_112;
2570 static PyObject *__pyx_k_tuple_114;
2571 static PyObject *__pyx_k_tuple_115;
2572 static PyObject *__pyx_k_tuple_117;
2573 static PyObject *__pyx_k_tuple_118;
2574 static PyObject *__pyx_k_tuple_120;
2575 static PyObject *__pyx_k_tuple_121;
2576 static PyObject *__pyx_k_tuple_122;
2577 static PyObject *__pyx_k_tuple_123;
2578 static PyObject *__pyx_k_tuple_124;
2579 static PyObject *__pyx_k_tuple_130;
2580 static PyObject *__pyx_k_tuple_131;
2581 static PyObject *__pyx_k_tuple_133;
2582 static PyObject *__pyx_k_tuple_134;
2583 static PyObject *__pyx_k_tuple_139;
2584 static PyObject *__pyx_k_tuple_142;
2585 static PyObject *__pyx_k_tuple_143;
2586 static PyObject *__pyx_k_tuple_144;
2587 static PyObject *__pyx_k_tuple_146;
2588 static PyObject *__pyx_k_tuple_172;
2589 static PyObject *__pyx_k_tuple_174;
2590 static PyObject *__pyx_k_tuple_175;
2591 static PyObject *__pyx_k_tuple_180;
2592 static PyObject *__pyx_k_tuple_181;
2593 static PyObject *__pyx_k_tuple_182;
2594 static PyObject *__pyx_k_tuple_183;
2595 static PyObject *__pyx_k_tuple_184;
2596 static PyObject *__pyx_k_tuple_252;
2597 static PyObject *__pyx_k_tuple_254;
2598 static PyObject *__pyx_k_tuple_258;
2599 static PyObject *__pyx_k_tuple_260;
2600 static PyObject *__pyx_k_tuple_262;
2601 static PyObject *__pyx_k_tuple_264;
2602 static PyObject *__pyx_k_tuple_267;
2603 static PyObject *__pyx_k_tuple_269;
2604 static PyObject *__pyx_k_tuple_271;
2605 static PyObject *__pyx_k_tuple_274;
2606 static PyObject *__pyx_k_tuple_275;
2607 static PyObject *__pyx_k_tuple_276;
2608 static PyObject *__pyx_k_tuple_277;
2609 static PyObject *__pyx_k_tuple_278;
2610 static PyObject *__pyx_k_tuple_279;
2611 static PyObject *__pyx_k_tuple_281;
2612 static PyObject *__pyx_k_tuple_282;
2613 static PyObject *__pyx_k_tuple_284;
2614 static PyObject *__pyx_k_tuple_286;
2615 static PyObject *__pyx_k_tuple_288;
2616 static PyObject *__pyx_k_tuple_291;
2617 static PyObject *__pyx_k_codeobj_255;
2618 static PyObject *__pyx_k_codeobj_259;
2619 static PyObject *__pyx_k_codeobj_261;
2620 static PyObject *__pyx_k_codeobj_263;
2621 static PyObject *__pyx_k_codeobj_265;
2622 static PyObject *__pyx_k_codeobj_268;
2623 static PyObject *__pyx_k_codeobj_270;
2624 static PyObject *__pyx_k_codeobj_272;
2625 static PyObject *__pyx_k_codeobj_280;
2626 static PyObject *__pyx_k_codeobj_283;
2627 static PyObject *__pyx_k_codeobj_285;
2628 static PyObject *__pyx_k_codeobj_287;
2629 static PyObject *__pyx_k_codeobj_289;
2630 static PyObject *__pyx_k_codeobj_292;
2631 static PyObject *__pyx_gb_9csamtools_4generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
2633 /* "csamtools.pyx":140
2634 * cdef char* CODE2CIGAR= "MIDNSHP=X"
2636 * CIGAR2CODE = dict( [y,x] for x,y in enumerate( CODE2CIGAR) ) # <<<<<<<<<<<<<<
2638 * CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) )
2641 static PyObject *__pyx_pf_9csamtools_2genexpr(CYTHON_UNUSED PyObject *__pyx_self) {
2642 struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *__pyx_cur_scope;
2643 PyObject *__pyx_r = NULL;
2644 __Pyx_RefNannyDeclarations
2645 int __pyx_lineno = 0;
2646 const char *__pyx_filename = NULL;
2647 int __pyx_clineno = 0;
2648 __Pyx_TraceDeclarations
2649 __Pyx_RefNannySetupContext("genexpr", 0);
2650 __pyx_cur_scope = (struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *)__pyx_ptype_9csamtools___pyx_scope_struct__genexpr->tp_new(__pyx_ptype_9csamtools___pyx_scope_struct__genexpr, __pyx_empty_tuple, NULL);
2651 if (unlikely(!__pyx_cur_scope)) {
2652 __Pyx_RefNannyFinishContext();
2655 __Pyx_GOTREF(__pyx_cur_scope);
2656 __Pyx_TraceCall("genexpr", __pyx_f[0], 140);
2658 __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_9csamtools_4generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2659 __Pyx_DECREF(__pyx_cur_scope);
2660 __Pyx_RefNannyFinishContext();
2661 return (PyObject *) gen;
2664 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2667 __Pyx_AddTraceback("csamtools.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
2670 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
2671 __Pyx_XGIVEREF(__pyx_r);
2672 __Pyx_TraceReturn(__pyx_r);
2673 __Pyx_RefNannyFinishContext();
2677 static PyObject *__pyx_gb_9csamtools_4generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
2679 struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *__pyx_cur_scope = ((struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *)__pyx_generator->closure);
2680 PyObject *__pyx_r = NULL;
2681 PyObject *__pyx_t_1 = NULL;
2682 PyObject *__pyx_t_2 = NULL;
2683 PyObject *__pyx_t_3 = NULL;
2684 PyObject *(*__pyx_t_4)(PyObject *);
2685 __Pyx_RefNannyDeclarations
2686 __Pyx_RefNannySetupContext("None", 0);
2687 switch (__pyx_generator->resume_label) {
2688 case 0: goto __pyx_L3_first_run;
2689 case 1: goto __pyx_L6_resume_from_yield;
2690 default: /* CPython raises the right error here */
2691 __Pyx_RefNannyFinishContext();
2694 __pyx_L3_first_run:;
2695 if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2696 __Pyx_INCREF(__pyx_int_0);
2697 __pyx_t_1 = __pyx_int_0;
2698 __pyx_t_2 = PyBytes_FromString(__pyx_v_9csamtools_CODE2CIGAR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2699 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
2700 __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2701 __Pyx_GOTREF(__pyx_t_3);
2702 __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
2703 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
2706 __pyx_t_2 = __pyx_t_4(__pyx_t_3);
2707 if (unlikely(!__pyx_t_2)) {
2708 if (PyErr_Occurred()) {
2709 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
2710 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2714 __Pyx_GOTREF(__pyx_t_2);
2716 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_y);
2717 __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_y);
2718 __Pyx_GIVEREF(__pyx_t_2);
2719 __pyx_cur_scope->__pyx_v_y = __pyx_t_2;
2721 __Pyx_INCREF(__pyx_t_1);
2722 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x);
2723 __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_x);
2724 __Pyx_GIVEREF(__pyx_t_1);
2725 __pyx_cur_scope->__pyx_v_x = __pyx_t_1;
2726 __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2727 __Pyx_GOTREF(__pyx_t_2);
2728 __Pyx_DECREF(__pyx_t_1);
2729 __pyx_t_1 = __pyx_t_2;
2731 __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2732 __Pyx_GOTREF(__pyx_t_2);
2733 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_y);
2734 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_y);
2735 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_y);
2736 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_x);
2737 PyList_SET_ITEM(__pyx_t_2, 1, __pyx_cur_scope->__pyx_v_x);
2738 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_x);
2739 __pyx_r = ((PyObject *)__pyx_t_2);
2741 __Pyx_XGIVEREF(__pyx_t_1);
2742 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
2743 __Pyx_XGIVEREF(__pyx_t_3);
2744 __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
2745 __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
2746 __Pyx_XGIVEREF(__pyx_r);
2747 __Pyx_RefNannyFinishContext();
2748 /* return from generator, yielding value */
2749 __pyx_generator->resume_label = 1;
2751 __pyx_L6_resume_from_yield:;
2752 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
2753 __pyx_cur_scope->__pyx_t_0 = 0;
2754 __Pyx_XGOTREF(__pyx_t_1);
2755 __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
2756 __pyx_cur_scope->__pyx_t_1 = 0;
2757 __Pyx_XGOTREF(__pyx_t_3);
2758 __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
2759 if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2761 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2762 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2763 PyErr_SetNone(PyExc_StopIteration);
2766 __Pyx_XDECREF(__pyx_t_1);
2767 __Pyx_XDECREF(__pyx_t_2);
2768 __Pyx_XDECREF(__pyx_t_3);
2769 __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
2771 __Pyx_XDECREF(__pyx_r);
2772 __pyx_generator->resume_label = -1;
2773 __Pyx_RefNannyFinishContext();
2776 static PyObject *__pyx_gb_9csamtools_7generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
2778 /* "csamtools.pyx":142
2779 * CIGAR2CODE = dict( [y,x] for x,y in enumerate( CODE2CIGAR) )
2781 * CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) ) # <<<<<<<<<<<<<<
2782 * CIGAR_REGEX = re.compile( "([MIDNSHP=X])(\d+)" )
2786 static PyObject *__pyx_pf_9csamtools_5genexpr(CYTHON_UNUSED PyObject *__pyx_self) {
2787 struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
2788 PyObject *__pyx_r = NULL;
2789 __Pyx_RefNannyDeclarations
2790 int __pyx_lineno = 0;
2791 const char *__pyx_filename = NULL;
2792 int __pyx_clineno = 0;
2793 __Pyx_TraceDeclarations
2794 __Pyx_RefNannySetupContext("genexpr", 0);
2795 __pyx_cur_scope = (struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *)__pyx_ptype_9csamtools___pyx_scope_struct_1_genexpr->tp_new(__pyx_ptype_9csamtools___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
2796 if (unlikely(!__pyx_cur_scope)) {
2797 __Pyx_RefNannyFinishContext();
2800 __Pyx_GOTREF(__pyx_cur_scope);
2801 __Pyx_TraceCall("genexpr", __pyx_f[0], 142);
2803 __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_9csamtools_7generator1, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2804 __Pyx_DECREF(__pyx_cur_scope);
2805 __Pyx_RefNannyFinishContext();
2806 return (PyObject *) gen;
2809 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2812 __Pyx_AddTraceback("csamtools.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
2815 __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
2816 __Pyx_XGIVEREF(__pyx_r);
2817 __Pyx_TraceReturn(__pyx_r);
2818 __Pyx_RefNannyFinishContext();
2822 static PyObject *__pyx_gb_9csamtools_7generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
2824 struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
2825 PyObject *__pyx_r = NULL;
2826 PyObject *__pyx_t_1 = NULL;
2827 PyObject *__pyx_t_2 = NULL;
2828 PyObject *__pyx_t_3 = NULL;
2829 PyObject *(*__pyx_t_4)(PyObject *);
2830 PyObject *__pyx_t_5 = NULL;
2831 __Pyx_RefNannyDeclarations
2832 __Pyx_RefNannySetupContext("None", 0);
2833 switch (__pyx_generator->resume_label) {
2834 case 0: goto __pyx_L3_first_run;
2835 case 1: goto __pyx_L6_resume_from_yield;
2836 default: /* CPython raises the right error here */
2837 __Pyx_RefNannyFinishContext();
2840 __pyx_L3_first_run:;
2841 if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2842 __Pyx_INCREF(__pyx_int_0);
2843 __pyx_t_1 = __pyx_int_0;
2844 __pyx_t_2 = PyBytes_FromString(__pyx_v_9csamtools_CODE2CIGAR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2845 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
2846 __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2847 __Pyx_GOTREF(__pyx_t_3);
2848 __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
2849 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
2852 __pyx_t_2 = __pyx_t_4(__pyx_t_3);
2853 if (unlikely(!__pyx_t_2)) {
2854 if (PyErr_Occurred()) {
2855 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
2856 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2860 __Pyx_GOTREF(__pyx_t_2);
2862 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_y);
2863 __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_y);
2864 __Pyx_GIVEREF(__pyx_t_2);
2865 __pyx_cur_scope->__pyx_v_y = __pyx_t_2;
2867 __Pyx_INCREF(__pyx_t_1);
2868 __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x);
2869 __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_x);
2870 __Pyx_GIVEREF(__pyx_t_1);
2871 __pyx_cur_scope->__pyx_v_x = __pyx_t_1;
2872 __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2873 __Pyx_GOTREF(__pyx_t_2);
2874 __Pyx_DECREF(__pyx_t_1);
2875 __pyx_t_1 = __pyx_t_2;
2877 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2878 __Pyx_GOTREF(__pyx_t_2);
2879 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_y);
2880 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_y);
2881 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_y);
2882 __pyx_t_5 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2883 __Pyx_GOTREF(__pyx_t_5);
2884 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
2885 __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2886 __Pyx_GOTREF(__pyx_t_2);
2887 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
2888 __Pyx_GIVEREF(__pyx_t_5);
2889 __Pyx_INCREF(__pyx_cur_scope->__pyx_v_x);
2890 PyList_SET_ITEM(__pyx_t_2, 1, __pyx_cur_scope->__pyx_v_x);
2891 __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_x);
2893 __pyx_r = ((PyObject *)__pyx_t_2);
2895 __Pyx_XGIVEREF(__pyx_t_1);
2896 __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
2897 __Pyx_XGIVEREF(__pyx_t_3);
2898 __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
2899 __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
2900 __Pyx_XGIVEREF(__pyx_r);
2901 __Pyx_RefNannyFinishContext();
2902 /* return from generator, yielding value */
2903 __pyx_generator->resume_label = 1;
2905 __pyx_L6_resume_from_yield:;
2906 __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
2907 __pyx_cur_scope->__pyx_t_0 = 0;
2908 __Pyx_XGOTREF(__pyx_t_1);
2909 __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
2910 __pyx_cur_scope->__pyx_t_1 = 0;
2911 __Pyx_XGOTREF(__pyx_t_3);
2912 __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
2913 if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2915 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2916 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2917 PyErr_SetNone(PyExc_StopIteration);
2920 __Pyx_XDECREF(__pyx_t_1);
2921 __Pyx_XDECREF(__pyx_t_2);
2922 __Pyx_XDECREF(__pyx_t_3);
2923 __Pyx_XDECREF(__pyx_t_5);
2924 __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
2926 __Pyx_XDECREF(__pyx_r);
2927 __pyx_generator->resume_label = -1;
2928 __Pyx_RefNannyFinishContext();
2932 /* "csamtools.pyx":24
2933 * ########################################################################
2934 * IS_PYTHON3 = PY_MAJOR_VERSION >= 3
2935 * cdef from_string_and_size(char* s, size_t length): # <<<<<<<<<<<<<<
2936 * if PY_MAJOR_VERSION < 3:
2940 static PyObject *__pyx_f_9csamtools_from_string_and_size(char *__pyx_v_s, size_t __pyx_v_length) {
2941 PyObject *__pyx_r = NULL;
2942 __Pyx_RefNannyDeclarations
2944 PyObject *__pyx_t_2 = NULL;
2945 int __pyx_lineno = 0;
2946 const char *__pyx_filename = NULL;
2947 int __pyx_clineno = 0;
2948 __Pyx_TraceDeclarations
2949 __Pyx_RefNannySetupContext("from_string_and_size", 0);
2950 __Pyx_TraceCall("from_string_and_size", __pyx_f[0], 24);
2952 /* "csamtools.pyx":25
2953 * IS_PYTHON3 = PY_MAJOR_VERSION >= 3
2954 * cdef from_string_and_size(char* s, size_t length):
2955 * if PY_MAJOR_VERSION < 3: # <<<<<<<<<<<<<<
2959 __pyx_t_1 = (PY_MAJOR_VERSION < 3);
2962 /* "csamtools.pyx":26
2963 * cdef from_string_and_size(char* s, size_t length):
2964 * if PY_MAJOR_VERSION < 3:
2965 * return s[:length] # <<<<<<<<<<<<<<
2967 * return s[:length].decode("ascii")
2969 __Pyx_XDECREF(__pyx_r);
2970 __pyx_t_2 = PyBytes_FromStringAndSize(__pyx_v_s + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2971 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
2972 __pyx_r = ((PyObject *)__pyx_t_2);
2979 /* "csamtools.pyx":28
2982 * return s[:length].decode("ascii") # <<<<<<<<<<<<<<
2984 * # filename encoding (copied from lxml.etree.pyx)
2986 __Pyx_XDECREF(__pyx_r);
2987 __pyx_t_2 = ((PyObject *)PyUnicode_DecodeASCII(__pyx_v_s, __pyx_v_length, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2988 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
2989 __pyx_r = ((PyObject *)__pyx_t_2);
2995 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2998 __Pyx_XDECREF(__pyx_t_2);
2999 __Pyx_AddTraceback("csamtools.from_string_and_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
3002 __Pyx_XGIVEREF(__pyx_r);
3003 __Pyx_TraceReturn(__pyx_r);
3004 __Pyx_RefNannyFinishContext();
3008 /* "csamtools.pyx":41
3009 * #_C_FILENAME_ENCODING = <char*>_FILENAME_ENCODING
3011 * cdef bytes _my_encodeFilename(object filename): # <<<<<<<<<<<<<<
3012 * u"""Make sure a filename is 8-bit encoded (or None).
3016 static PyObject *__pyx_f_9csamtools__my_encodeFilename(PyObject *__pyx_v_filename) {
3017 PyObject *__pyx_r = NULL;
3018 __Pyx_RefNannyDeclarations
3020 PyObject *__pyx_t_2 = NULL;
3021 PyObject *__pyx_t_3 = NULL;
3022 PyObject *__pyx_t_4 = NULL;
3023 int __pyx_lineno = 0;
3024 const char *__pyx_filename = NULL;
3025 int __pyx_clineno = 0;
3026 __Pyx_TraceDeclarations
3027 __Pyx_RefNannySetupContext("_my_encodeFilename", 0);
3028 __Pyx_TraceCall("_my_encodeFilename", __pyx_f[0], 41);
3030 /* "csamtools.pyx":44
3031 * u"""Make sure a filename is 8-bit encoded (or None).
3033 * if filename is None: # <<<<<<<<<<<<<<
3035 * elif PyBytes_Check(filename):
3037 __pyx_t_1 = (__pyx_v_filename == Py_None);
3040 /* "csamtools.pyx":45
3042 * if filename is None:
3043 * return None # <<<<<<<<<<<<<<
3044 * elif PyBytes_Check(filename):
3047 __Pyx_XDECREF(((PyObject *)__pyx_r));
3048 __Pyx_INCREF(Py_None);
3049 __pyx_r = ((PyObject*)Py_None);
3054 /* "csamtools.pyx":46
3055 * if filename is None:
3057 * elif PyBytes_Check(filename): # <<<<<<<<<<<<<<
3059 * elif PyUnicode_Check(filename):
3061 __pyx_t_1 = PyBytes_Check(__pyx_v_filename);
3064 /* "csamtools.pyx":47
3066 * elif PyBytes_Check(filename):
3067 * return filename # <<<<<<<<<<<<<<
3068 * elif PyUnicode_Check(filename):
3069 * return filename.encode(_FILENAME_ENCODING)
3071 __Pyx_XDECREF(((PyObject *)__pyx_r));
3072 if (!(likely(PyBytes_CheckExact(__pyx_v_filename))||((__pyx_v_filename) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_filename)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3073 __Pyx_INCREF(__pyx_v_filename);
3074 __pyx_r = ((PyObject*)__pyx_v_filename);
3079 /* "csamtools.pyx":48
3080 * elif PyBytes_Check(filename):
3082 * elif PyUnicode_Check(filename): # <<<<<<<<<<<<<<
3083 * return filename.encode(_FILENAME_ENCODING)
3086 __pyx_t_1 = PyUnicode_Check(__pyx_v_filename);
3089 /* "csamtools.pyx":49
3091 * elif PyUnicode_Check(filename):
3092 * return filename.encode(_FILENAME_ENCODING) # <<<<<<<<<<<<<<
3094 * raise TypeError, u"Argument must be string or unicode."
3096 __Pyx_XDECREF(((PyObject *)__pyx_r));
3097 __pyx_t_2 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3098 __Pyx_GOTREF(__pyx_t_2);
3099 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3100 __Pyx_GOTREF(__pyx_t_3);
3101 __Pyx_INCREF(((PyObject *)__pyx_v_9csamtools__FILENAME_ENCODING));
3102 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_9csamtools__FILENAME_ENCODING));
3103 __Pyx_GIVEREF(((PyObject *)__pyx_v_9csamtools__FILENAME_ENCODING));
3104 __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3105 __Pyx_GOTREF(__pyx_t_4);
3106 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3107 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
3108 if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3109 __pyx_r = ((PyObject*)__pyx_t_4);
3116 /* "csamtools.pyx":51
3117 * return filename.encode(_FILENAME_ENCODING)
3119 * raise TypeError, u"Argument must be string or unicode." # <<<<<<<<<<<<<<
3123 __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_1), 0, 0);
3124 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3128 __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
3131 __Pyx_XDECREF(__pyx_t_2);
3132 __Pyx_XDECREF(__pyx_t_3);
3133 __Pyx_XDECREF(__pyx_t_4);
3134 __Pyx_AddTraceback("csamtools._my_encodeFilename", __pyx_clineno, __pyx_lineno, __pyx_filename);
3137 __Pyx_XGIVEREF(__pyx_r);
3138 __Pyx_TraceReturn(__pyx_r);
3139 __Pyx_RefNannyFinishContext();
3143 /* "csamtools.pyx":54
3146 * cdef bytes _force_bytes(object s): # <<<<<<<<<<<<<<
3147 * u"""convert string or unicode object to bytes, assuming ascii encoding.
3151 static PyObject *__pyx_f_9csamtools__force_bytes(PyObject *__pyx_v_s) {
3152 PyObject *__pyx_r = NULL;
3153 __Pyx_RefNannyDeclarations
3155 PyObject *__pyx_t_2 = NULL;
3156 PyObject *__pyx_t_3 = NULL;
3157 int __pyx_lineno = 0;
3158 const char *__pyx_filename = NULL;
3159 int __pyx_clineno = 0;
3160 __Pyx_TraceDeclarations
3161 __Pyx_RefNannySetupContext("_force_bytes", 0);
3162 __Pyx_TraceCall("_force_bytes", __pyx_f[0], 54);
3164 /* "csamtools.pyx":57
3165 * u"""convert string or unicode object to bytes, assuming ascii encoding.
3167 * if PY_MAJOR_VERSION < 3: # <<<<<<<<<<<<<<
3171 __pyx_t_1 = (PY_MAJOR_VERSION < 3);
3174 /* "csamtools.pyx":58
3176 * if PY_MAJOR_VERSION < 3:
3177 * return s # <<<<<<<<<<<<<<
3181 __Pyx_XDECREF(((PyObject *)__pyx_r));
3182 if (!(likely(PyBytes_CheckExact(__pyx_v_s))||((__pyx_v_s) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_s)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3183 __Pyx_INCREF(__pyx_v_s);
3184 __pyx_r = ((PyObject*)__pyx_v_s);
3189 /* "csamtools.pyx":59
3190 * if PY_MAJOR_VERSION < 3:
3192 * elif s is None: # <<<<<<<<<<<<<<
3194 * elif PyBytes_Check(s):
3196 __pyx_t_1 = (__pyx_v_s == Py_None);
3199 /* "csamtools.pyx":60
3202 * return None # <<<<<<<<<<<<<<
3203 * elif PyBytes_Check(s):
3206 __Pyx_XDECREF(((PyObject *)__pyx_r));
3207 __Pyx_INCREF(Py_None);
3208 __pyx_r = ((PyObject*)Py_None);
3213 /* "csamtools.pyx":61
3216 * elif PyBytes_Check(s): # <<<<<<<<<<<<<<
3218 * elif PyUnicode_Check(s):
3220 __pyx_t_1 = PyBytes_Check(__pyx_v_s);
3223 /* "csamtools.pyx":62
3225 * elif PyBytes_Check(s):
3226 * return s # <<<<<<<<<<<<<<
3227 * elif PyUnicode_Check(s):
3228 * return s.encode('ascii')
3230 __Pyx_XDECREF(((PyObject *)__pyx_r));
3231 if (!(likely(PyBytes_CheckExact(__pyx_v_s))||((__pyx_v_s) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_s)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3232 __Pyx_INCREF(__pyx_v_s);
3233 __pyx_r = ((PyObject*)__pyx_v_s);
3238 /* "csamtools.pyx":63
3239 * elif PyBytes_Check(s):
3241 * elif PyUnicode_Check(s): # <<<<<<<<<<<<<<
3242 * return s.encode('ascii')
3245 __pyx_t_1 = PyUnicode_Check(__pyx_v_s);
3248 /* "csamtools.pyx":64
3250 * elif PyUnicode_Check(s):
3251 * return s.encode('ascii') # <<<<<<<<<<<<<<
3253 * raise TypeError, u"Argument must be string, bytes or unicode."
3255 __Pyx_XDECREF(((PyObject *)__pyx_r));
3256 __pyx_t_2 = PyObject_GetAttr(__pyx_v_s, __pyx_n_s__encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3257 __Pyx_GOTREF(__pyx_t_2);
3258 __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3259 __Pyx_GOTREF(__pyx_t_3);
3260 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3261 if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3262 __pyx_r = ((PyObject*)__pyx_t_3);
3269 /* "csamtools.pyx":66
3270 * return s.encode('ascii')
3272 * raise TypeError, u"Argument must be string, bytes or unicode." # <<<<<<<<<<<<<<
3274 * cdef inline bytes _force_cmdline_bytes(object s):
3276 __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_3), 0, 0);
3277 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3281 __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
3284 __Pyx_XDECREF(__pyx_t_2);
3285 __Pyx_XDECREF(__pyx_t_3);
3286 __Pyx_AddTraceback("csamtools._force_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
3289 __Pyx_XGIVEREF(__pyx_r);
3290 __Pyx_TraceReturn(__pyx_r);
3291 __Pyx_RefNannyFinishContext();
3295 /* "csamtools.pyx":68
3296 * raise TypeError, u"Argument must be string, bytes or unicode."
3298 * cdef inline bytes _force_cmdline_bytes(object s): # <<<<<<<<<<<<<<
3299 * return _force_bytes(s)
3303 static CYTHON_INLINE PyObject *__pyx_f_9csamtools__force_cmdline_bytes(PyObject *__pyx_v_s) {
3304 PyObject *__pyx_r = NULL;
3305 __Pyx_RefNannyDeclarations
3306 PyObject *__pyx_t_1 = NULL;
3307 int __pyx_lineno = 0;
3308 const char *__pyx_filename = NULL;
3309 int __pyx_clineno = 0;
3310 __Pyx_TraceDeclarations
3311 __Pyx_RefNannySetupContext("_force_cmdline_bytes", 0);
3312 __Pyx_TraceCall("_force_cmdline_bytes", __pyx_f[0], 68);
3314 /* "csamtools.pyx":69
3316 * cdef inline bytes _force_cmdline_bytes(object s):
3317 * return _force_bytes(s) # <<<<<<<<<<<<<<
3319 * cdef _charptr_to_str(char* s):
3321 __Pyx_XDECREF(((PyObject *)__pyx_r));
3322 __pyx_t_1 = ((PyObject *)__pyx_f_9csamtools__force_bytes(__pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3323 __Pyx_GOTREF(__pyx_t_1);
3324 __pyx_r = ((PyObject*)__pyx_t_1);
3328 __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
3331 __Pyx_XDECREF(__pyx_t_1);
3332 __Pyx_AddTraceback("csamtools._force_cmdline_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
3335 __Pyx_XGIVEREF(__pyx_r);
3336 __Pyx_TraceReturn(__pyx_r);
3337 __Pyx_RefNannyFinishContext();
3341 /* "csamtools.pyx":71
3342 * return _force_bytes(s)
3344 * cdef _charptr_to_str(char* s): # <<<<<<<<<<<<<<
3345 * if PY_MAJOR_VERSION < 3:
3349 static PyObject *__pyx_f_9csamtools__charptr_to_str(char *__pyx_v_s) {
3350 PyObject *__pyx_r = NULL;
3351 __Pyx_RefNannyDeclarations
3353 PyObject *__pyx_t_2 = NULL;
3354 int __pyx_lineno = 0;
3355 const char *__pyx_filename = NULL;
3356 int __pyx_clineno = 0;
3357 __Pyx_TraceDeclarations
3358 __Pyx_RefNannySetupContext("_charptr_to_str", 0);
3359 __Pyx_TraceCall("_charptr_to_str", __pyx_f[0], 71);
3361 /* "csamtools.pyx":72
3363 * cdef _charptr_to_str(char* s):
3364 * if PY_MAJOR_VERSION < 3: # <<<<<<<<<<<<<<
3368 __pyx_t_1 = (PY_MAJOR_VERSION < 3);
3371 /* "csamtools.pyx":73
3372 * cdef _charptr_to_str(char* s):
3373 * if PY_MAJOR_VERSION < 3:
3374 * return s # <<<<<<<<<<<<<<
3376 * return s.decode("ascii")
3378 __Pyx_XDECREF(__pyx_r);
3379 __pyx_t_2 = PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3380 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
3381 __pyx_r = ((PyObject *)__pyx_t_2);
3388 /* "csamtools.pyx":75
3391 * return s.decode("ascii") # <<<<<<<<<<<<<<
3393 * cdef _force_str(object s):
3395 __Pyx_XDECREF(__pyx_r);
3396 __pyx_t_2 = ((PyObject *)PyUnicode_DecodeASCII(__pyx_v_s, strlen(__pyx_v_s), NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3397 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
3398 __pyx_r = ((PyObject *)__pyx_t_2);
3404 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3407 __Pyx_XDECREF(__pyx_t_2);
3408 __Pyx_AddTraceback("csamtools._charptr_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
3411 __Pyx_XGIVEREF(__pyx_r);
3412 __Pyx_TraceReturn(__pyx_r);
3413 __Pyx_RefNannyFinishContext();
3417 /* "csamtools.pyx":77
3418 * return s.decode("ascii")
3420 * cdef _force_str(object s): # <<<<<<<<<<<<<<
3421 * """Return s converted to str type of current Python (bytes in Py2, unicode in Py3)"""
3425 static PyObject *__pyx_f_9csamtools__force_str(PyObject *__pyx_v_s) {
3426 PyObject *__pyx_r = NULL;
3427 __Pyx_RefNannyDeclarations
3429 PyObject *__pyx_t_2 = NULL;
3430 PyObject *__pyx_t_3 = NULL;
3431 int __pyx_lineno = 0;
3432 const char *__pyx_filename = NULL;
3433 int __pyx_clineno = 0;
3434 __Pyx_TraceDeclarations
3435 __Pyx_RefNannySetupContext("_force_str", 0);
3436 __Pyx_TraceCall("_force_str", __pyx_f[0], 77);
3438 /* "csamtools.pyx":79
3439 * cdef _force_str(object s):
3440 * """Return s converted to str type of current Python (bytes in Py2, unicode in Py3)"""
3441 * if s is None: # <<<<<<<<<<<<<<
3443 * if PY_MAJOR_VERSION < 3:
3445 __pyx_t_1 = (__pyx_v_s == Py_None);
3448 /* "csamtools.pyx":80
3449 * """Return s converted to str type of current Python (bytes in Py2, unicode in Py3)"""
3451 * return None # <<<<<<<<<<<<<<
3452 * if PY_MAJOR_VERSION < 3:
3455 __Pyx_XDECREF(__pyx_r);
3456 __Pyx_INCREF(Py_None);
3463 /* "csamtools.pyx":81
3466 * if PY_MAJOR_VERSION < 3: # <<<<<<<<<<<<<<
3468 * elif PyBytes_Check(s):
3470 __pyx_t_1 = (PY_MAJOR_VERSION < 3);
3473 /* "csamtools.pyx":82
3475 * if PY_MAJOR_VERSION < 3:
3476 * return s # <<<<<<<<<<<<<<
3477 * elif PyBytes_Check(s):
3478 * return s.decode('ascii')
3480 __Pyx_XDECREF(__pyx_r);
3481 __Pyx_INCREF(__pyx_v_s);
3482 __pyx_r = __pyx_v_s;
3487 /* "csamtools.pyx":83
3488 * if PY_MAJOR_VERSION < 3:
3490 * elif PyBytes_Check(s): # <<<<<<<<<<<<<<
3491 * return s.decode('ascii')
3494 __pyx_t_1 = PyBytes_Check(__pyx_v_s);
3497 /* "csamtools.pyx":84
3499 * elif PyBytes_Check(s):
3500 * return s.decode('ascii') # <<<<<<<<<<<<<<
3504 __Pyx_XDECREF(__pyx_r);
3505 __pyx_t_2 = PyObject_GetAttr(__pyx_v_s, __pyx_n_s__decode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3506 __Pyx_GOTREF(__pyx_t_2);
3507 __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3508 __Pyx_GOTREF(__pyx_t_3);
3509 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3510 __pyx_r = __pyx_t_3;
3517 /* "csamtools.pyx":87
3520 * return s # <<<<<<<<<<<<<<
3521 * ########################################################################
3522 * ########################################################################
3524 __Pyx_XDECREF(__pyx_r);
3525 __Pyx_INCREF(__pyx_v_s);
3526 __pyx_r = __pyx_v_s;
3531 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3534 __Pyx_XDECREF(__pyx_t_2);
3535 __Pyx_XDECREF(__pyx_t_3);
3536 __Pyx_AddTraceback("csamtools._force_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
3539 __Pyx_XGIVEREF(__pyx_r);
3540 __Pyx_TraceReturn(__pyx_r);
3541 __Pyx_RefNannyFinishContext();
3545 /* "csamtools.pyx":160
3546 * #####################################################################
3547 * cdef class AlignedRead
3548 * cdef makeAlignedRead(bam1_t * src): # <<<<<<<<<<<<<<
3549 * '''enter src into AlignedRead.'''
3550 * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
3553 static PyObject *__pyx_f_9csamtools_makeAlignedRead(bam1_t *__pyx_v_src) {
3554 struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_dest = 0;
3555 PyObject *__pyx_r = NULL;
3556 __Pyx_RefNannyDeclarations
3557 PyObject *__pyx_t_1 = NULL;
3558 int __pyx_lineno = 0;
3559 const char *__pyx_filename = NULL;
3560 int __pyx_clineno = 0;
3561 __Pyx_TraceDeclarations
3562 __Pyx_RefNannySetupContext("makeAlignedRead", 0);
3563 __Pyx_TraceCall("makeAlignedRead", __pyx_f[0], 160);
3565 /* "csamtools.pyx":162
3566 * cdef makeAlignedRead(bam1_t * src):
3567 * '''enter src into AlignedRead.'''
3568 * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead) # <<<<<<<<<<<<<<
3569 * dest._delegate = bam_dup1(src)
3572 __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_9csamtools_AlignedRead)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3573 __Pyx_GOTREF(__pyx_t_1);
3574 if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_9csamtools_AlignedRead)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3575 __pyx_v_dest = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_t_1);
3578 /* "csamtools.pyx":163
3579 * '''enter src into AlignedRead.'''
3580 * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
3581 * dest._delegate = bam_dup1(src) # <<<<<<<<<<<<<<
3585 __pyx_v_dest->_delegate = bam_dup1(__pyx_v_src);
3587 /* "csamtools.pyx":164
3588 * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
3589 * dest._delegate = bam_dup1(src)
3590 * return dest # <<<<<<<<<<<<<<
3592 * cdef class PileupProxy
3594 __Pyx_XDECREF(__pyx_r);
3595 __Pyx_INCREF(((PyObject *)__pyx_v_dest));
3596 __pyx_r = ((PyObject *)__pyx_v_dest);
3599 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3602 __Pyx_XDECREF(__pyx_t_1);
3603 __Pyx_AddTraceback("csamtools.makeAlignedRead", __pyx_clineno, __pyx_lineno, __pyx_filename);
3606 __Pyx_XDECREF((PyObject *)__pyx_v_dest);
3607 __Pyx_XGIVEREF(__pyx_r);
3608 __Pyx_TraceReturn(__pyx_r);
3609 __Pyx_RefNannyFinishContext();
3613 /* "csamtools.pyx":167
3615 * cdef class PileupProxy
3616 * cdef makePileupProxy( bam_pileup1_t ** plp, int tid, int pos, int n ): # <<<<<<<<<<<<<<
3617 * cdef PileupProxy dest = PileupProxy.__new__(PileupProxy)
3621 static PyObject *__pyx_f_9csamtools_makePileupProxy(bam_pileup1_t **__pyx_v_plp, int __pyx_v_tid, int __pyx_v_pos, int __pyx_v_n) {
3622 struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_dest = 0;
3623 PyObject *__pyx_r = NULL;
3624 __Pyx_RefNannyDeclarations
3625 PyObject *__pyx_t_1 = NULL;
3626 int __pyx_lineno = 0;
3627 const char *__pyx_filename = NULL;
3628 int __pyx_clineno = 0;
3629 __Pyx_TraceDeclarations
3630 __Pyx_RefNannySetupContext("makePileupProxy", 0);
3631 __Pyx_TraceCall("makePileupProxy", __pyx_f[0], 167);
3633 /* "csamtools.pyx":168
3634 * cdef class PileupProxy
3635 * cdef makePileupProxy( bam_pileup1_t ** plp, int tid, int pos, int n ):
3636 * cdef PileupProxy dest = PileupProxy.__new__(PileupProxy) # <<<<<<<<<<<<<<
3640 __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_9csamtools_PileupProxy)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3641 __Pyx_GOTREF(__pyx_t_1);
3642 if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_9csamtools_PileupProxy)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3643 __pyx_v_dest = ((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_t_1);
3646 /* "csamtools.pyx":169
3647 * cdef makePileupProxy( bam_pileup1_t ** plp, int tid, int pos, int n ):
3648 * cdef PileupProxy dest = PileupProxy.__new__(PileupProxy)
3649 * dest.plp = plp # <<<<<<<<<<<<<<
3653 __pyx_v_dest->plp = __pyx_v_plp;
3655 /* "csamtools.pyx":170
3656 * cdef PileupProxy dest = PileupProxy.__new__(PileupProxy)
3658 * dest.tid = tid # <<<<<<<<<<<<<<
3662 __pyx_v_dest->tid = __pyx_v_tid;
3664 /* "csamtools.pyx":171
3667 * dest.pos = pos # <<<<<<<<<<<<<<
3671 __pyx_v_dest->pos = __pyx_v_pos;
3673 /* "csamtools.pyx":172
3676 * dest.n = n # <<<<<<<<<<<<<<
3680 __pyx_t_1 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3681 __Pyx_GOTREF(__pyx_t_1);
3682 if (PyObject_SetAttr(((PyObject *)__pyx_v_dest), __pyx_n_s__n, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3683 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3685 /* "csamtools.pyx":173
3688 * return dest # <<<<<<<<<<<<<<
3690 * cdef class PileupRead
3692 __Pyx_XDECREF(__pyx_r);
3693 __Pyx_INCREF(((PyObject *)__pyx_v_dest));
3694 __pyx_r = ((PyObject *)__pyx_v_dest);
3697 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3700 __Pyx_XDECREF(__pyx_t_1);
3701 __Pyx_AddTraceback("csamtools.makePileupProxy", __pyx_clineno, __pyx_lineno, __pyx_filename);
3704 __Pyx_XDECREF((PyObject *)__pyx_v_dest);
3705 __Pyx_XGIVEREF(__pyx_r);
3706 __Pyx_TraceReturn(__pyx_r);
3707 __Pyx_RefNannyFinishContext();
3711 /* "csamtools.pyx":176
3713 * cdef class PileupRead
3714 * cdef makePileupRead( bam_pileup1_t * src ): # <<<<<<<<<<<<<<
3715 * '''fill a PileupRead object from a bam_pileup1_t * object.'''
3716 * cdef PileupRead dest = PileupRead.__new__(PileupRead)
3719 static PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v_src) {
3720 struct __pyx_obj_9csamtools_PileupRead *__pyx_v_dest = 0;
3721 PyObject *__pyx_r = NULL;
3722 __Pyx_RefNannyDeclarations
3723 PyObject *__pyx_t_1 = NULL;
3724 int __pyx_lineno = 0;
3725 const char *__pyx_filename = NULL;
3726 int __pyx_clineno = 0;
3727 __Pyx_TraceDeclarations
3728 __Pyx_RefNannySetupContext("makePileupRead", 0);
3729 __Pyx_TraceCall("makePileupRead", __pyx_f[0], 176);
3731 /* "csamtools.pyx":178
3732 * cdef makePileupRead( bam_pileup1_t * src ):
3733 * '''fill a PileupRead object from a bam_pileup1_t * object.'''
3734 * cdef PileupRead dest = PileupRead.__new__(PileupRead) # <<<<<<<<<<<<<<
3735 * dest._alignment = makeAlignedRead( src.b )
3736 * dest._qpos = src.qpos
3738 __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_9csamtools_PileupRead)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3739 __Pyx_GOTREF(__pyx_t_1);
3740 if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_9csamtools_PileupRead)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3741 __pyx_v_dest = ((struct __pyx_obj_9csamtools_PileupRead *)__pyx_t_1);
3744 /* "csamtools.pyx":179
3745 * '''fill a PileupRead object from a bam_pileup1_t * object.'''
3746 * cdef PileupRead dest = PileupRead.__new__(PileupRead)
3747 * dest._alignment = makeAlignedRead( src.b ) # <<<<<<<<<<<<<<
3748 * dest._qpos = src.qpos
3749 * dest._indel = src.indel
3751 __pyx_t_1 = __pyx_f_9csamtools_makeAlignedRead(__pyx_v_src->b); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3752 __Pyx_GOTREF(__pyx_t_1);
3753 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_9csamtools_AlignedRead))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3754 __Pyx_GIVEREF(__pyx_t_1);
3755 __Pyx_GOTREF(__pyx_v_dest->_alignment);
3756 __Pyx_DECREF(((PyObject *)__pyx_v_dest->_alignment));
3757 __pyx_v_dest->_alignment = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_t_1);
3760 /* "csamtools.pyx":180
3761 * cdef PileupRead dest = PileupRead.__new__(PileupRead)
3762 * dest._alignment = makeAlignedRead( src.b )
3763 * dest._qpos = src.qpos # <<<<<<<<<<<<<<
3764 * dest._indel = src.indel
3765 * dest._level = src.level
3767 __pyx_v_dest->_qpos = __pyx_v_src->qpos;
3769 /* "csamtools.pyx":181
3770 * dest._alignment = makeAlignedRead( src.b )
3771 * dest._qpos = src.qpos
3772 * dest._indel = src.indel # <<<<<<<<<<<<<<
3773 * dest._level = src.level
3774 * dest._is_del = src.is_del
3776 __pyx_v_dest->_indel = __pyx_v_src->indel;
3778 /* "csamtools.pyx":182
3779 * dest._qpos = src.qpos
3780 * dest._indel = src.indel
3781 * dest._level = src.level # <<<<<<<<<<<<<<
3782 * dest._is_del = src.is_del
3783 * dest._is_head = src.is_head
3785 __pyx_v_dest->_level = __pyx_v_src->level;
3787 /* "csamtools.pyx":183
3788 * dest._indel = src.indel
3789 * dest._level = src.level
3790 * dest._is_del = src.is_del # <<<<<<<<<<<<<<
3791 * dest._is_head = src.is_head
3792 * dest._is_tail = src.is_tail
3794 __pyx_v_dest->_is_del = __pyx_v_src->is_del;
3796 /* "csamtools.pyx":184
3797 * dest._level = src.level
3798 * dest._is_del = src.is_del
3799 * dest._is_head = src.is_head # <<<<<<<<<<<<<<
3800 * dest._is_tail = src.is_tail
3803 __pyx_v_dest->_is_head = __pyx_v_src->is_head;
3805 /* "csamtools.pyx":185
3806 * dest._is_del = src.is_del
3807 * dest._is_head = src.is_head
3808 * dest._is_tail = src.is_tail # <<<<<<<<<<<<<<
3812 __pyx_v_dest->_is_tail = __pyx_v_src->is_tail;
3814 /* "csamtools.pyx":186
3815 * dest._is_head = src.is_head
3816 * dest._is_tail = src.is_tail
3817 * return dest # <<<<<<<<<<<<<<
3819 * cdef convertBinaryTagToList( uint8_t * s ):
3821 __Pyx_XDECREF(__pyx_r);
3822 __Pyx_INCREF(((PyObject *)__pyx_v_dest));
3823 __pyx_r = ((PyObject *)__pyx_v_dest);
3826 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3829 __Pyx_XDECREF(__pyx_t_1);
3830 __Pyx_AddTraceback("csamtools.makePileupRead", __pyx_clineno, __pyx_lineno, __pyx_filename);
3833 __Pyx_XDECREF((PyObject *)__pyx_v_dest);
3834 __Pyx_XGIVEREF(__pyx_r);
3835 __Pyx_TraceReturn(__pyx_r);
3836 __Pyx_RefNannyFinishContext();
3840 /* "csamtools.pyx":188
3843 * cdef convertBinaryTagToList( uint8_t * s ): # <<<<<<<<<<<<<<
3844 * """return bytesize, number of values list of values in s."""
3848 static PyObject *__pyx_f_9csamtools_convertBinaryTagToList(uint8_t *__pyx_v_s) {
3849 char __pyx_v_auxtype;
3850 uint8_t __pyx_v_byte_size;
3851 int32_t __pyx_v_nvalues;
3852 PyObject *__pyx_v_values = NULL;
3853 CYTHON_UNUSED long __pyx_v_x;
3854 PyObject *__pyx_r = NULL;
3855 __Pyx_RefNannyDeclarations
3856 PyObject *__pyx_t_1 = NULL;
3860 PyObject *__pyx_t_5 = NULL;
3861 PyObject *__pyx_t_6 = NULL;
3862 int __pyx_lineno = 0;
3863 const char *__pyx_filename = NULL;
3864 int __pyx_clineno = 0;
3865 __Pyx_TraceDeclarations
3866 __Pyx_RefNannySetupContext("convertBinaryTagToList", 0);
3867 __Pyx_TraceCall("convertBinaryTagToList", __pyx_f[0], 188);
3869 /* "csamtools.pyx":195
3872 * auxtype = s[0] # <<<<<<<<<<<<<<
3873 * byte_size = bam_aux_type2size( auxtype )
3876 __pyx_v_auxtype = (__pyx_v_s[0]);
3878 /* "csamtools.pyx":196
3881 * byte_size = bam_aux_type2size( auxtype ) # <<<<<<<<<<<<<<
3883 * # get number of values in array
3885 __pyx_v_byte_size = bam_aux_type2size(__pyx_v_auxtype);
3887 /* "csamtools.pyx":197
3889 * byte_size = bam_aux_type2size( auxtype )
3890 * s += 1 # <<<<<<<<<<<<<<
3891 * # get number of values in array
3892 * nvalues = (<int32_t*>s)[0]
3894 __pyx_v_s = (__pyx_v_s + 1);
3896 /* "csamtools.pyx":199
3898 * # get number of values in array
3899 * nvalues = (<int32_t*>s)[0] # <<<<<<<<<<<<<<
3903 __pyx_v_nvalues = (((int32_t *)__pyx_v_s)[0]);
3905 /* "csamtools.pyx":200
3906 * # get number of values in array
3907 * nvalues = (<int32_t*>s)[0]
3908 * s += 4 # <<<<<<<<<<<<<<
3912 __pyx_v_s = (__pyx_v_s + 4);
3914 /* "csamtools.pyx":202
3917 * values = [] # <<<<<<<<<<<<<<
3918 * if auxtype == 'c':
3919 * for x from 0 <= x < nvalues:
3921 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3922 __Pyx_GOTREF(__pyx_t_1);
3923 __pyx_v_values = __pyx_t_1;
3926 /* "csamtools.pyx":203
3929 * if auxtype == 'c': # <<<<<<<<<<<<<<
3930 * for x from 0 <= x < nvalues:
3931 * values.append((<int8_t*>s)[0])
3933 __pyx_t_2 = (__pyx_v_auxtype == 'c');
3936 /* "csamtools.pyx":204
3938 * if auxtype == 'c':
3939 * for x from 0 <= x < nvalues: # <<<<<<<<<<<<<<
3940 * values.append((<int8_t*>s)[0])
3943 __pyx_t_3 = __pyx_v_nvalues;
3944 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
3946 /* "csamtools.pyx":205
3947 * if auxtype == 'c':
3948 * for x from 0 <= x < nvalues:
3949 * values.append((<int8_t*>s)[0]) # <<<<<<<<<<<<<<
3951 * elif auxtype == 'C':
3953 __pyx_t_1 = __Pyx_PyInt_to_py_int8_t((((int8_t *)__pyx_v_s)[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3954 __Pyx_GOTREF(__pyx_t_1);
3955 __pyx_t_4 = PyList_Append(__pyx_v_values, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3956 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3958 /* "csamtools.pyx":206
3959 * for x from 0 <= x < nvalues:
3960 * values.append((<int8_t*>s)[0])
3961 * s += 1 # <<<<<<<<<<<<<<
3962 * elif auxtype == 'C':
3963 * for x from 0 <= x < nvalues:
3965 __pyx_v_s = (__pyx_v_s + 1);
3970 /* "csamtools.pyx":207
3971 * values.append((<int8_t*>s)[0])
3973 * elif auxtype == 'C': # <<<<<<<<<<<<<<
3974 * for x from 0 <= x < nvalues:
3975 * values.append((<uint8_t*>s)[0])
3977 __pyx_t_2 = (__pyx_v_auxtype == 'C');
3980 /* "csamtools.pyx":208
3982 * elif auxtype == 'C':
3983 * for x from 0 <= x < nvalues: # <<<<<<<<<<<<<<
3984 * values.append((<uint8_t*>s)[0])
3987 __pyx_t_3 = __pyx_v_nvalues;
3988 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
3990 /* "csamtools.pyx":209
3991 * elif auxtype == 'C':
3992 * for x from 0 <= x < nvalues:
3993 * values.append((<uint8_t*>s)[0]) # <<<<<<<<<<<<<<
3995 * elif auxtype == 's':
3997 __pyx_t_1 = __Pyx_PyInt_to_py_uint8_t((((uint8_t *)__pyx_v_s)[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3998 __Pyx_GOTREF(__pyx_t_1);
3999 __pyx_t_4 = PyList_Append(__pyx_v_values, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4000 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4002 /* "csamtools.pyx":210
4003 * for x from 0 <= x < nvalues:
4004 * values.append((<uint8_t*>s)[0])
4005 * s += 1 # <<<<<<<<<<<<<<
4006 * elif auxtype == 's':
4007 * for x from 0 <= x < nvalues:
4009 __pyx_v_s = (__pyx_v_s + 1);
4014 /* "csamtools.pyx":211
4015 * values.append((<uint8_t*>s)[0])
4017 * elif auxtype == 's': # <<<<<<<<<<<<<<
4018 * for x from 0 <= x < nvalues:
4019 * values.append((<int16_t*>s)[0])
4021 __pyx_t_2 = (__pyx_v_auxtype == 's');
4024 /* "csamtools.pyx":212
4026 * elif auxtype == 's':
4027 * for x from 0 <= x < nvalues: # <<<<<<<<<<<<<<
4028 * values.append((<int16_t*>s)[0])
4031 __pyx_t_3 = __pyx_v_nvalues;
4032 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
4034 /* "csamtools.pyx":213
4035 * elif auxtype == 's':
4036 * for x from 0 <= x < nvalues:
4037 * values.append((<int16_t*>s)[0]) # <<<<<<<<<<<<<<
4039 * elif auxtype == 'S':
4041 __pyx_t_1 = __Pyx_PyInt_to_py_int16_t((((int16_t *)__pyx_v_s)[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4042 __Pyx_GOTREF(__pyx_t_1);
4043 __pyx_t_4 = PyList_Append(__pyx_v_values, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4044 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4046 /* "csamtools.pyx":214
4047 * for x from 0 <= x < nvalues:
4048 * values.append((<int16_t*>s)[0])
4049 * s += 2 # <<<<<<<<<<<<<<
4050 * elif auxtype == 'S':
4051 * for x from 0 <= x < nvalues:
4053 __pyx_v_s = (__pyx_v_s + 2);
4058 /* "csamtools.pyx":215
4059 * values.append((<int16_t*>s)[0])
4061 * elif auxtype == 'S': # <<<<<<<<<<<<<<
4062 * for x from 0 <= x < nvalues:
4063 * values.append((<uint16_t*>s)[0])
4065 __pyx_t_2 = (__pyx_v_auxtype == 'S');
4068 /* "csamtools.pyx":216
4070 * elif auxtype == 'S':
4071 * for x from 0 <= x < nvalues: # <<<<<<<<<<<<<<
4072 * values.append((<uint16_t*>s)[0])
4075 __pyx_t_3 = __pyx_v_nvalues;
4076 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
4078 /* "csamtools.pyx":217
4079 * elif auxtype == 'S':
4080 * for x from 0 <= x < nvalues:
4081 * values.append((<uint16_t*>s)[0]) # <<<<<<<<<<<<<<
4083 * elif auxtype == 'i':
4085 __pyx_t_1 = __Pyx_PyInt_to_py_uint16_t((((uint16_t *)__pyx_v_s)[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4086 __Pyx_GOTREF(__pyx_t_1);
4087 __pyx_t_4 = PyList_Append(__pyx_v_values, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4088 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4090 /* "csamtools.pyx":218
4091 * for x from 0 <= x < nvalues:
4092 * values.append((<uint16_t*>s)[0])
4093 * s += 2 # <<<<<<<<<<<<<<
4094 * elif auxtype == 'i':
4095 * for x from 0 <= x < nvalues:
4097 __pyx_v_s = (__pyx_v_s + 2);
4102 /* "csamtools.pyx":219
4103 * values.append((<uint16_t*>s)[0])
4105 * elif auxtype == 'i': # <<<<<<<<<<<<<<
4106 * for x from 0 <= x < nvalues:
4107 * values.append((<int32_t*>s)[0])
4109 __pyx_t_2 = (__pyx_v_auxtype == 'i');
4112 /* "csamtools.pyx":220
4114 * elif auxtype == 'i':
4115 * for x from 0 <= x < nvalues: # <<<<<<<<<<<<<<
4116 * values.append((<int32_t*>s)[0])
4119 __pyx_t_3 = __pyx_v_nvalues;
4120 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
4122 /* "csamtools.pyx":221
4123 * elif auxtype == 'i':
4124 * for x from 0 <= x < nvalues:
4125 * values.append((<int32_t*>s)[0]) # <<<<<<<<<<<<<<
4127 * elif auxtype == 'I':
4129 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t((((int32_t *)__pyx_v_s)[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4130 __Pyx_GOTREF(__pyx_t_1);
4131 __pyx_t_4 = PyList_Append(__pyx_v_values, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4132 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4134 /* "csamtools.pyx":222
4135 * for x from 0 <= x < nvalues:
4136 * values.append((<int32_t*>s)[0])
4137 * s += 4 # <<<<<<<<<<<<<<
4138 * elif auxtype == 'I':
4139 * for x from 0 <= x < nvalues:
4141 __pyx_v_s = (__pyx_v_s + 4);
4146 /* "csamtools.pyx":223
4147 * values.append((<int32_t*>s)[0])
4149 * elif auxtype == 'I': # <<<<<<<<<<<<<<
4150 * for x from 0 <= x < nvalues:
4151 * values.append((<uint32_t*>s)[0])
4153 __pyx_t_2 = (__pyx_v_auxtype == 'I');
4156 /* "csamtools.pyx":224
4158 * elif auxtype == 'I':
4159 * for x from 0 <= x < nvalues: # <<<<<<<<<<<<<<
4160 * values.append((<uint32_t*>s)[0])
4163 __pyx_t_3 = __pyx_v_nvalues;
4164 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
4166 /* "csamtools.pyx":225
4167 * elif auxtype == 'I':
4168 * for x from 0 <= x < nvalues:
4169 * values.append((<uint32_t*>s)[0]) # <<<<<<<<<<<<<<
4171 * elif auxtype == 'f':
4173 __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t((((uint32_t *)__pyx_v_s)[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4174 __Pyx_GOTREF(__pyx_t_1);
4175 __pyx_t_4 = PyList_Append(__pyx_v_values, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4176 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4178 /* "csamtools.pyx":226
4179 * for x from 0 <= x < nvalues:
4180 * values.append((<uint32_t*>s)[0])
4181 * s += 4 # <<<<<<<<<<<<<<
4182 * elif auxtype == 'f':
4183 * for x from 0 <= x < nvalues:
4185 __pyx_v_s = (__pyx_v_s + 4);
4190 /* "csamtools.pyx":227
4191 * values.append((<uint32_t*>s)[0])
4193 * elif auxtype == 'f': # <<<<<<<<<<<<<<
4194 * for x from 0 <= x < nvalues:
4195 * values.append((<float*>s)[0])
4197 __pyx_t_2 = (__pyx_v_auxtype == 'f');
4200 /* "csamtools.pyx":228
4202 * elif auxtype == 'f':
4203 * for x from 0 <= x < nvalues: # <<<<<<<<<<<<<<
4204 * values.append((<float*>s)[0])
4207 __pyx_t_3 = __pyx_v_nvalues;
4208 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
4210 /* "csamtools.pyx":229
4211 * elif auxtype == 'f':
4212 * for x from 0 <= x < nvalues:
4213 * values.append((<float*>s)[0]) # <<<<<<<<<<<<<<
4217 __pyx_t_1 = PyFloat_FromDouble((((float *)__pyx_v_s)[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4218 __Pyx_GOTREF(__pyx_t_1);
4219 __pyx_t_4 = PyList_Append(__pyx_v_values, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4220 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4222 /* "csamtools.pyx":230
4223 * for x from 0 <= x < nvalues:
4224 * values.append((<float*>s)[0])
4225 * s += 4 # <<<<<<<<<<<<<<
4227 * return byte_size, nvalues, values
4229 __pyx_v_s = (__pyx_v_s + 4);
4235 /* "csamtools.pyx":232
4238 * return byte_size, nvalues, values # <<<<<<<<<<<<<<
4240 * #####################################################################
4242 __Pyx_XDECREF(__pyx_r);
4243 __pyx_t_1 = __Pyx_PyInt_to_py_uint8_t(__pyx_v_byte_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4244 __Pyx_GOTREF(__pyx_t_1);
4245 __pyx_t_5 = __Pyx_PyInt_to_py_int32_t(__pyx_v_nvalues); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4246 __Pyx_GOTREF(__pyx_t_5);
4247 __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4248 __Pyx_GOTREF(__pyx_t_6);
4249 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
4250 __Pyx_GIVEREF(__pyx_t_1);
4251 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
4252 __Pyx_GIVEREF(__pyx_t_5);
4253 __Pyx_INCREF(((PyObject *)__pyx_v_values));
4254 PyTuple_SET_ITEM(__pyx_t_6, 2, ((PyObject *)__pyx_v_values));
4255 __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
4258 __pyx_r = ((PyObject *)__pyx_t_6);
4262 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4265 __Pyx_XDECREF(__pyx_t_1);
4266 __Pyx_XDECREF(__pyx_t_5);
4267 __Pyx_XDECREF(__pyx_t_6);
4268 __Pyx_AddTraceback("csamtools.convertBinaryTagToList", __pyx_clineno, __pyx_lineno, __pyx_filename);
4271 __Pyx_XDECREF(__pyx_v_values);
4272 __Pyx_XGIVEREF(__pyx_r);
4273 __Pyx_TraceReturn(__pyx_r);
4274 __Pyx_RefNannyFinishContext();
4278 /* "csamtools.pyx":239
4279 * ## Generic callbacks for inserting python callbacks.
4280 * #####################################################################
4281 * cdef int fetch_callback( bam1_t *alignment, void *f): # <<<<<<<<<<<<<<
4282 * '''callback for bam_fetch.
4286 static int __pyx_f_9csamtools_fetch_callback(bam1_t *__pyx_v_alignment, void *__pyx_v_f) {
4287 PyObject *__pyx_v_a = NULL;
4289 __Pyx_RefNannyDeclarations
4290 PyObject *__pyx_t_1 = NULL;
4291 PyObject *__pyx_t_2 = NULL;
4292 int __pyx_lineno = 0;
4293 const char *__pyx_filename = NULL;
4294 int __pyx_clineno = 0;
4295 __Pyx_TraceDeclarations
4296 __Pyx_RefNannySetupContext("fetch_callback", 0);
4297 __Pyx_TraceCall("fetch_callback", __pyx_f[0], 239);
4299 /* "csamtools.pyx":244
4300 * calls function in *f* with a new :class:`AlignedRead` object as parameter.
4302 * a = makeAlignedRead( alignment ) # <<<<<<<<<<<<<<
4306 __pyx_t_1 = __pyx_f_9csamtools_makeAlignedRead(__pyx_v_alignment); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4307 __Pyx_GOTREF(__pyx_t_1);
4308 __pyx_v_a = __pyx_t_1;
4311 /* "csamtools.pyx":245
4313 * a = makeAlignedRead( alignment )
4314 * (<object>f)(a) # <<<<<<<<<<<<<<
4316 * class PileupColumn(object):
4318 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4319 __Pyx_GOTREF(__pyx_t_1);
4320 __Pyx_INCREF(__pyx_v_a);
4321 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_a);
4322 __Pyx_GIVEREF(__pyx_v_a);
4323 __pyx_t_2 = PyObject_Call(((PyObject *)__pyx_v_f), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4324 __Pyx_GOTREF(__pyx_t_2);
4325 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
4326 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4331 __Pyx_XDECREF(__pyx_t_1);
4332 __Pyx_XDECREF(__pyx_t_2);
4333 __Pyx_WriteUnraisable("csamtools.fetch_callback", __pyx_clineno, __pyx_lineno, __pyx_filename);
4336 __Pyx_XDECREF(__pyx_v_a);
4337 __Pyx_TraceReturn(Py_None);
4338 __Pyx_RefNannyFinishContext();
4342 /* Python wrapper */
4343 static PyObject *__pyx_pw_9csamtools_12PileupColumn_1__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
4344 static char __pyx_doc_9csamtools_12PileupColumn___str__[] = "PileupColumn.__str__(self)";
4345 static PyMethodDef __pyx_mdef_9csamtools_12PileupColumn_1__str__ = {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pw_9csamtools_12PileupColumn_1__str__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_12PileupColumn___str__)};
4346 static PyObject *__pyx_pw_9csamtools_12PileupColumn_1__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
4347 PyObject *__pyx_r = 0;
4348 __Pyx_RefNannyDeclarations
4349 __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
4350 __pyx_self = __pyx_self;
4351 __pyx_r = __pyx_pf_9csamtools_12PileupColumn___str__(__pyx_self, ((PyObject *)__pyx_v_self));
4352 __Pyx_RefNannyFinishContext();
4356 /* "csamtools.pyx":260
4357 * list of reads (:class:`pysam.PileupRead`) aligned to this column
4359 * def __str__(self): # <<<<<<<<<<<<<<
4360 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
4361 * "\n" + "\n".join( map(str, self.pileups) )
4364 static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
4365 PyObject *__pyx_r = NULL;
4366 __Pyx_RefNannyDeclarations
4367 PyObject *__pyx_t_1 = NULL;
4368 PyObject *__pyx_t_2 = NULL;
4369 PyObject *__pyx_t_3 = NULL;
4370 PyObject *__pyx_t_4 = NULL;
4371 PyObject *__pyx_t_5 = NULL;
4372 int __pyx_lineno = 0;
4373 const char *__pyx_filename = NULL;
4374 int __pyx_clineno = 0;
4375 __Pyx_TraceDeclarations
4376 __Pyx_RefNannySetupContext("__str__", 0);
4377 __Pyx_TraceCall("__str__", __pyx_f[0], 260);
4379 /* "csamtools.pyx":261
4381 * def __str__(self):
4382 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ # <<<<<<<<<<<<<<
4383 * "\n" + "\n".join( map(str, self.pileups) )
4386 __Pyx_XDECREF(__pyx_r);
4388 /* "csamtools.pyx":262
4389 * def __str__(self):
4390 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
4391 * "\n" + "\n".join( map(str, self.pileups) ) # <<<<<<<<<<<<<<
4393 * cdef int pileup_callback( uint32_t tid, uint32_t pos, int n, bam_pileup1_t *pl, void *f):
4395 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_5), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4396 __Pyx_GOTREF(__pyx_t_1);
4398 /* "csamtools.pyx":261
4400 * def __str__(self):
4401 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ # <<<<<<<<<<<<<<
4402 * "\n" + "\n".join( map(str, self.pileups) )
4405 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4406 __Pyx_GOTREF(__pyx_t_2);
4407 __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4408 __Pyx_GOTREF(__pyx_t_3);
4409 __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4410 __Pyx_GOTREF(__pyx_t_4);
4411 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4412 __Pyx_GOTREF(__pyx_t_5);
4413 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
4414 __Pyx_GIVEREF(__pyx_t_2);
4415 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
4416 __Pyx_GIVEREF(__pyx_t_3);
4417 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
4418 __Pyx_GIVEREF(__pyx_t_4);
4422 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4423 __Pyx_GOTREF(__pyx_t_4);
4424 __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
4425 PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
4426 __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
4427 PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_5));
4428 __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
4430 __pyx_t_5 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4431 __Pyx_GOTREF(__pyx_t_5);
4432 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
4433 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4434 __Pyx_GOTREF(__pyx_t_4);
4435 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
4436 __Pyx_GIVEREF(__pyx_t_5);
4438 __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4439 __Pyx_GOTREF(__pyx_t_5);
4440 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4441 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
4442 __pyx_t_4 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4443 __Pyx_GOTREF(__pyx_t_4);
4444 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4446 /* "csamtools.pyx":262
4447 * def __str__(self):
4448 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
4449 * "\n" + "\n".join( map(str, self.pileups) ) # <<<<<<<<<<<<<<
4451 * cdef int pileup_callback( uint32_t tid, uint32_t pos, int n, bam_pileup1_t *pl, void *f):
4453 __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_6), __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4454 __Pyx_GOTREF(__pyx_t_5);
4455 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pileups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4456 __Pyx_GOTREF(__pyx_t_1);
4457 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4458 __Pyx_GOTREF(__pyx_t_3);
4459 __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
4460 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
4461 __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
4462 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
4463 __Pyx_GIVEREF(__pyx_t_1);
4465 __pyx_t_1 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4466 __Pyx_GOTREF(__pyx_t_1);
4467 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
4468 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4469 __Pyx_GOTREF(__pyx_t_3);
4470 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
4471 __Pyx_GIVEREF(__pyx_t_1);
4473 __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4474 __Pyx_GOTREF(__pyx_t_1);
4475 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4476 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
4477 __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4478 __Pyx_GOTREF(__pyx_t_3);
4479 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4480 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4481 __pyx_r = __pyx_t_3;
4485 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4488 __Pyx_XDECREF(__pyx_t_1);
4489 __Pyx_XDECREF(__pyx_t_2);
4490 __Pyx_XDECREF(__pyx_t_3);
4491 __Pyx_XDECREF(__pyx_t_4);
4492 __Pyx_XDECREF(__pyx_t_5);
4493 __Pyx_AddTraceback("csamtools.PileupColumn.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4496 __Pyx_XGIVEREF(__pyx_r);
4497 __Pyx_TraceReturn(__pyx_r);
4498 __Pyx_RefNannyFinishContext();
4502 /* "csamtools.pyx":264
4503 * "\n" + "\n".join( map(str, self.pileups) )
4505 * cdef int pileup_callback( uint32_t tid, uint32_t pos, int n, bam_pileup1_t *pl, void *f): # <<<<<<<<<<<<<<
4506 * '''callback for pileup.
4510 static int __pyx_f_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __pyx_v_pos, int __pyx_v_n, bam_pileup1_t *__pyx_v_pl, void *__pyx_v_f) {
4511 PyObject *__pyx_v_p = NULL;
4512 PyObject *__pyx_v_pileups = NULL;
4515 __Pyx_RefNannyDeclarations
4516 PyObject *__pyx_t_1 = NULL;
4517 PyObject *__pyx_t_2 = NULL;
4520 int __pyx_lineno = 0;
4521 const char *__pyx_filename = NULL;
4522 int __pyx_clineno = 0;
4523 __Pyx_TraceDeclarations
4524 __Pyx_RefNannySetupContext("pileup_callback", 0);
4525 __Pyx_TraceCall("pileup_callback", __pyx_f[0], 264);
4527 /* "csamtools.pyx":281
4530 * p = PileupColumn() # <<<<<<<<<<<<<<
4534 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__PileupColumn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4535 __Pyx_GOTREF(__pyx_t_1);
4536 __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 = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4537 __Pyx_GOTREF(__pyx_t_2);
4538 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4539 __pyx_v_p = __pyx_t_2;
4542 /* "csamtools.pyx":282
4544 * p = PileupColumn()
4545 * p.tid = tid # <<<<<<<<<<<<<<
4549 __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4550 __Pyx_GOTREF(__pyx_t_2);
4551 if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__tid, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4552 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4554 /* "csamtools.pyx":283
4555 * p = PileupColumn()
4557 * p.pos = pos # <<<<<<<<<<<<<<
4561 __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4562 __Pyx_GOTREF(__pyx_t_2);
4563 if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__pos, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4564 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4566 /* "csamtools.pyx":284
4569 * p.n = n # <<<<<<<<<<<<<<
4573 __pyx_t_2 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4574 __Pyx_GOTREF(__pyx_t_2);
4575 if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__n, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4576 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4578 /* "csamtools.pyx":285
4581 * pileups = [] # <<<<<<<<<<<<<<
4585 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4586 __Pyx_GOTREF(__pyx_t_2);
4587 __pyx_v_pileups = __pyx_t_2;
4590 /* "csamtools.pyx":288
4593 * for x from 0 <= x < n: # <<<<<<<<<<<<<<
4594 * pileups.append( makePileupRead( &(pl[x]) ) )
4595 * p.pileups = pileups
4597 __pyx_t_3 = __pyx_v_n;
4598 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
4600 /* "csamtools.pyx":289
4602 * for x from 0 <= x < n:
4603 * pileups.append( makePileupRead( &(pl[x]) ) ) # <<<<<<<<<<<<<<
4604 * p.pileups = pileups
4607 __pyx_t_2 = __pyx_f_9csamtools_makePileupRead((&(__pyx_v_pl[__pyx_v_x]))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4608 __Pyx_GOTREF(__pyx_t_2);
4609 __pyx_t_4 = PyList_Append(__pyx_v_pileups, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4610 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4613 /* "csamtools.pyx":290
4614 * for x from 0 <= x < n:
4615 * pileups.append( makePileupRead( &(pl[x]) ) )
4616 * p.pileups = pileups # <<<<<<<<<<<<<<
4620 if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__pileups, ((PyObject *)__pyx_v_pileups)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4622 /* "csamtools.pyx":292
4623 * p.pileups = pileups
4625 * (<object>f)(p) # <<<<<<<<<<<<<<
4627 * cdef int pileup_fetch_callback( bam1_t *b, void *data):
4629 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4630 __Pyx_GOTREF(__pyx_t_2);
4631 __Pyx_INCREF(__pyx_v_p);
4632 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_p);
4633 __Pyx_GIVEREF(__pyx_v_p);
4634 __pyx_t_1 = PyObject_Call(((PyObject *)__pyx_v_f), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4635 __Pyx_GOTREF(__pyx_t_1);
4636 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
4637 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4642 __Pyx_XDECREF(__pyx_t_1);
4643 __Pyx_XDECREF(__pyx_t_2);
4644 __Pyx_WriteUnraisable("csamtools.pileup_callback", __pyx_clineno, __pyx_lineno, __pyx_filename);
4647 __Pyx_XDECREF(__pyx_v_p);
4648 __Pyx_XDECREF(__pyx_v_pileups);
4649 __Pyx_TraceReturn(Py_None);
4650 __Pyx_RefNannyFinishContext();
4654 /* "csamtools.pyx":294
4657 * cdef int pileup_fetch_callback( bam1_t *b, void *data): # <<<<<<<<<<<<<<
4658 * '''callback for bam_fetch.
4662 static int __pyx_f_9csamtools_pileup_fetch_callback(bam1_t *__pyx_v_b, void *__pyx_v_data) {
4663 bam_plbuf_t *__pyx_v_buf;
4665 __Pyx_RefNannyDeclarations
4666 __Pyx_TraceDeclarations
4667 __Pyx_RefNannySetupContext("pileup_fetch_callback", 0);
4668 __Pyx_TraceCall("pileup_fetch_callback", __pyx_f[0], 294);
4670 /* "csamtools.pyx":300
4672 * cdef bam_plbuf_t * buf
4673 * buf = <bam_plbuf_t*>data # <<<<<<<<<<<<<<
4674 * bam_plbuf_push(b, buf)
4677 __pyx_v_buf = ((bam_plbuf_t *)__pyx_v_data);
4679 /* "csamtools.pyx":301
4680 * cdef bam_plbuf_t * buf
4681 * buf = <bam_plbuf_t*>data
4682 * bam_plbuf_push(b, buf) # <<<<<<<<<<<<<<
4686 bam_plbuf_push(__pyx_v_b, __pyx_v_buf);
4688 /* "csamtools.pyx":302
4689 * buf = <bam_plbuf_t*>data
4690 * bam_plbuf_push(b, buf)
4691 * return 0 # <<<<<<<<<<<<<<
4693 * class StderrStore():
4700 __Pyx_TraceReturn(Py_None);
4701 __Pyx_RefNannyFinishContext();
4705 /* Python wrapper */
4706 static PyObject *__pyx_pw_9csamtools_11StderrStore_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
4707 static char __pyx_doc_9csamtools_11StderrStore___init__[] = "StderrStore.__init__(self)";
4708 static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_9csamtools_11StderrStore_1__init__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore___init__)};
4709 static PyObject *__pyx_pw_9csamtools_11StderrStore_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
4710 PyObject *__pyx_r = 0;
4711 __Pyx_RefNannyDeclarations
4712 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
4713 __pyx_self = __pyx_self;
4714 __pyx_r = __pyx_pf_9csamtools_11StderrStore___init__(__pyx_self, ((PyObject *)__pyx_v_self));
4715 __Pyx_RefNannyFinishContext();
4719 /* "csamtools.pyx":308
4720 * stderr is captured.
4722 * def __init__(self): # <<<<<<<<<<<<<<
4724 * self.stderr_h, self.stderr_f = tempfile.mkstemp()
4727 static PyObject *__pyx_pf_9csamtools_11StderrStore___init__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
4728 PyObject *__pyx_r = NULL;
4729 __Pyx_RefNannyDeclarations
4730 __Pyx_TraceDeclarations
4731 __Pyx_RefNannySetupContext("__init__", 0);
4732 __Pyx_TraceCall("__init__", __pyx_f[0], 308);
4734 /* "csamtools.pyx":309
4736 * def __init__(self):
4737 * return # <<<<<<<<<<<<<<
4738 * self.stderr_h, self.stderr_f = tempfile.mkstemp()
4739 * self.stderr_save = Outs( sys.stderr.fileno() )
4741 __Pyx_XDECREF(__pyx_r);
4742 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4745 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4747 __Pyx_XGIVEREF(__pyx_r);
4748 __Pyx_TraceReturn(__pyx_r);
4749 __Pyx_RefNannyFinishContext();
4753 /* Python wrapper */
4754 static PyObject *__pyx_pw_9csamtools_11StderrStore_3readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
4755 static char __pyx_doc_9csamtools_11StderrStore_2readAndRelease[] = "StderrStore.readAndRelease(self)";
4756 static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_3readAndRelease = {__Pyx_NAMESTR("readAndRelease"), (PyCFunction)__pyx_pw_9csamtools_11StderrStore_3readAndRelease, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_2readAndRelease)};
4757 static PyObject *__pyx_pw_9csamtools_11StderrStore_3readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self) {
4758 PyObject *__pyx_r = 0;
4759 __Pyx_RefNannyDeclarations
4760 __Pyx_RefNannySetupContext("readAndRelease (wrapper)", 0);
4761 __pyx_self = __pyx_self;
4762 __pyx_r = __pyx_pf_9csamtools_11StderrStore_2readAndRelease(__pyx_self, ((PyObject *)__pyx_v_self));
4763 __Pyx_RefNannyFinishContext();
4767 /* "csamtools.pyx":314
4768 * self.stderr_save.setfd( self.stderr_h )
4770 * def readAndRelease( self ): # <<<<<<<<<<<<<<
4772 * self.stderr_save.restore()
4775 static PyObject *__pyx_pf_9csamtools_11StderrStore_2readAndRelease(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
4776 PyObject *__pyx_r = NULL;
4777 __Pyx_RefNannyDeclarations
4778 PyObject *__pyx_t_1 = NULL;
4779 int __pyx_lineno = 0;
4780 const char *__pyx_filename = NULL;
4781 int __pyx_clineno = 0;
4782 __Pyx_TraceDeclarations
4783 __Pyx_RefNannySetupContext("readAndRelease", 0);
4784 __Pyx_TraceCall("readAndRelease", __pyx_f[0], 314);
4786 /* "csamtools.pyx":315
4788 * def readAndRelease( self ):
4789 * return [] # <<<<<<<<<<<<<<
4790 * self.stderr_save.restore()
4793 __Pyx_XDECREF(__pyx_r);
4794 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4795 __Pyx_GOTREF(__pyx_t_1);
4796 __pyx_r = ((PyObject *)__pyx_t_1);
4800 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4803 __Pyx_XDECREF(__pyx_t_1);
4804 __Pyx_AddTraceback("csamtools.StderrStore.readAndRelease", __pyx_clineno, __pyx_lineno, __pyx_filename);
4807 __Pyx_XGIVEREF(__pyx_r);
4808 __Pyx_TraceReturn(__pyx_r);
4809 __Pyx_RefNannyFinishContext();
4813 /* Python wrapper */
4814 static PyObject *__pyx_pw_9csamtools_11StderrStore_5release(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
4815 static char __pyx_doc_9csamtools_11StderrStore_4release[] = "StderrStore.release(self)";
4816 static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_5release = {__Pyx_NAMESTR("release"), (PyCFunction)__pyx_pw_9csamtools_11StderrStore_5release, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_4release)};
4817 static PyObject *__pyx_pw_9csamtools_11StderrStore_5release(PyObject *__pyx_self, PyObject *__pyx_v_self) {
4818 PyObject *__pyx_r = 0;
4819 __Pyx_RefNannyDeclarations
4820 __Pyx_RefNannySetupContext("release (wrapper)", 0);
4821 __pyx_self = __pyx_self;
4822 __pyx_r = __pyx_pf_9csamtools_11StderrStore_4release(__pyx_self, ((PyObject *)__pyx_v_self));
4823 __Pyx_RefNannyFinishContext();
4827 /* "csamtools.pyx":323
4830 * def release(self): # <<<<<<<<<<<<<<
4832 * self.stderr_save.restore()
4835 static PyObject *__pyx_pf_9csamtools_11StderrStore_4release(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
4836 PyObject *__pyx_r = NULL;
4837 __Pyx_RefNannyDeclarations
4838 __Pyx_TraceDeclarations
4839 __Pyx_RefNannySetupContext("release", 0);
4840 __Pyx_TraceCall("release", __pyx_f[0], 323);
4842 /* "csamtools.pyx":324
4844 * def release(self):
4845 * return # <<<<<<<<<<<<<<
4846 * self.stderr_save.restore()
4847 * if os.path.exists(self.stderr_f):
4849 __Pyx_XDECREF(__pyx_r);
4850 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4853 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4855 __Pyx_XGIVEREF(__pyx_r);
4856 __Pyx_TraceReturn(__pyx_r);
4857 __Pyx_RefNannyFinishContext();
4861 /* Python wrapper */
4862 static PyObject *__pyx_pw_9csamtools_11StderrStore_7__del__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
4863 static char __pyx_doc_9csamtools_11StderrStore_6__del__[] = "StderrStore.__del__(self)";
4864 static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_7__del__ = {__Pyx_NAMESTR("__del__"), (PyCFunction)__pyx_pw_9csamtools_11StderrStore_7__del__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_6__del__)};
4865 static PyObject *__pyx_pw_9csamtools_11StderrStore_7__del__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
4866 PyObject *__pyx_r = 0;
4867 __Pyx_RefNannyDeclarations
4868 __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
4869 __pyx_self = __pyx_self;
4870 __pyx_r = __pyx_pf_9csamtools_11StderrStore_6__del__(__pyx_self, ((PyObject *)__pyx_v_self));
4871 __Pyx_RefNannyFinishContext();
4875 /* "csamtools.pyx":329
4876 * os.remove( self.stderr_f )
4878 * def __del__(self): # <<<<<<<<<<<<<<
4883 static PyObject *__pyx_pf_9csamtools_11StderrStore_6__del__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
4884 PyObject *__pyx_r = NULL;
4885 __Pyx_RefNannyDeclarations
4886 PyObject *__pyx_t_1 = NULL;
4887 PyObject *__pyx_t_2 = NULL;
4888 int __pyx_lineno = 0;
4889 const char *__pyx_filename = NULL;
4890 int __pyx_clineno = 0;
4891 __Pyx_TraceDeclarations
4892 __Pyx_RefNannySetupContext("__del__", 0);
4893 __Pyx_TraceCall("__del__", __pyx_f[0], 329);
4895 /* "csamtools.pyx":330
4897 * def __del__(self):
4898 * self.release() # <<<<<<<<<<<<<<
4900 * class StderrStoreWindows():
4902 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__release); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4903 __Pyx_GOTREF(__pyx_t_1);
4904 __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 = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4905 __Pyx_GOTREF(__pyx_t_2);
4906 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4907 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4909 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4912 __Pyx_XDECREF(__pyx_t_1);
4913 __Pyx_XDECREF(__pyx_t_2);
4914 __Pyx_AddTraceback("csamtools.StderrStore.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4917 __Pyx_XGIVEREF(__pyx_r);
4918 __Pyx_TraceReturn(__pyx_r);
4919 __Pyx_RefNannyFinishContext();
4923 /* Python wrapper */
4924 static PyObject *__pyx_pw_9csamtools_18StderrStoreWindows_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
4925 static char __pyx_doc_9csamtools_18StderrStoreWindows___init__[] = "StderrStoreWindows.__init__(self)";
4926 static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_9csamtools_18StderrStoreWindows_1__init__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows___init__)};
4927 static PyObject *__pyx_pw_9csamtools_18StderrStoreWindows_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
4928 PyObject *__pyx_r = 0;
4929 __Pyx_RefNannyDeclarations
4930 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
4931 __pyx_self = __pyx_self;
4932 __pyx_r = __pyx_pf_9csamtools_18StderrStoreWindows___init__(__pyx_self, ((PyObject *)__pyx_v_self));
4933 __Pyx_RefNannyFinishContext();
4937 /* "csamtools.pyx":334
4938 * class StderrStoreWindows():
4939 * '''does nothing. stderr can't be redirected on windows'''
4940 * def __init__(self): pass # <<<<<<<<<<<<<<
4941 * def readAndRelease(self): return []
4942 * def release(self): pass
4945 static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows___init__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
4946 PyObject *__pyx_r = NULL;
4947 __Pyx_RefNannyDeclarations
4948 __Pyx_TraceDeclarations
4949 __Pyx_RefNannySetupContext("__init__", 0);
4950 __Pyx_TraceCall("__init__", __pyx_f[0], 334);
4952 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4953 __Pyx_XGIVEREF(__pyx_r);
4954 __Pyx_TraceReturn(__pyx_r);
4955 __Pyx_RefNannyFinishContext();
4959 /* Python wrapper */
4960 static PyObject *__pyx_pw_9csamtools_18StderrStoreWindows_3readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
4961 static char __pyx_doc_9csamtools_18StderrStoreWindows_2readAndRelease[] = "StderrStoreWindows.readAndRelease(self)";
4962 static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows_3readAndRelease = {__Pyx_NAMESTR("readAndRelease"), (PyCFunction)__pyx_pw_9csamtools_18StderrStoreWindows_3readAndRelease, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows_2readAndRelease)};
4963 static PyObject *__pyx_pw_9csamtools_18StderrStoreWindows_3readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self) {
4964 PyObject *__pyx_r = 0;
4965 __Pyx_RefNannyDeclarations
4966 __Pyx_RefNannySetupContext("readAndRelease (wrapper)", 0);
4967 __pyx_self = __pyx_self;
4968 __pyx_r = __pyx_pf_9csamtools_18StderrStoreWindows_2readAndRelease(__pyx_self, ((PyObject *)__pyx_v_self));
4969 __Pyx_RefNannyFinishContext();
4973 /* "csamtools.pyx":335
4974 * '''does nothing. stderr can't be redirected on windows'''
4975 * def __init__(self): pass
4976 * def readAndRelease(self): return [] # <<<<<<<<<<<<<<
4977 * def release(self): pass
4981 static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_2readAndRelease(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
4982 PyObject *__pyx_r = NULL;
4983 __Pyx_RefNannyDeclarations
4984 PyObject *__pyx_t_1 = NULL;
4985 int __pyx_lineno = 0;
4986 const char *__pyx_filename = NULL;
4987 int __pyx_clineno = 0;
4988 __Pyx_TraceDeclarations
4989 __Pyx_RefNannySetupContext("readAndRelease", 0);
4990 __Pyx_TraceCall("readAndRelease", __pyx_f[0], 335);
4991 __Pyx_XDECREF(__pyx_r);
4992 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4993 __Pyx_GOTREF(__pyx_t_1);
4994 __pyx_r = ((PyObject *)__pyx_t_1);
4998 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5001 __Pyx_XDECREF(__pyx_t_1);
5002 __Pyx_AddTraceback("csamtools.StderrStoreWindows.readAndRelease", __pyx_clineno, __pyx_lineno, __pyx_filename);
5005 __Pyx_XGIVEREF(__pyx_r);
5006 __Pyx_TraceReturn(__pyx_r);
5007 __Pyx_RefNannyFinishContext();
5011 /* Python wrapper */
5012 static PyObject *__pyx_pw_9csamtools_18StderrStoreWindows_5release(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
5013 static char __pyx_doc_9csamtools_18StderrStoreWindows_4release[] = "StderrStoreWindows.release(self)";
5014 static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows_5release = {__Pyx_NAMESTR("release"), (PyCFunction)__pyx_pw_9csamtools_18StderrStoreWindows_5release, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows_4release)};
5015 static PyObject *__pyx_pw_9csamtools_18StderrStoreWindows_5release(PyObject *__pyx_self, PyObject *__pyx_v_self) {
5016 PyObject *__pyx_r = 0;
5017 __Pyx_RefNannyDeclarations
5018 __Pyx_RefNannySetupContext("release (wrapper)", 0);
5019 __pyx_self = __pyx_self;
5020 __pyx_r = __pyx_pf_9csamtools_18StderrStoreWindows_4release(__pyx_self, ((PyObject *)__pyx_v_self));
5021 __Pyx_RefNannyFinishContext();
5025 /* "csamtools.pyx":336
5026 * def __init__(self): pass
5027 * def readAndRelease(self): return []
5028 * def release(self): pass # <<<<<<<<<<<<<<
5030 * if platform.system()=='Windows':
5033 static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_4release(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
5034 PyObject *__pyx_r = NULL;
5035 __Pyx_RefNannyDeclarations
5036 __Pyx_TraceDeclarations
5037 __Pyx_RefNannySetupContext("release", 0);
5038 __Pyx_TraceCall("release", __pyx_f[0], 336);
5040 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5041 __Pyx_XGIVEREF(__pyx_r);
5042 __Pyx_TraceReturn(__pyx_r);
5043 __Pyx_RefNannyFinishContext();
5047 /* Python wrapper */
5048 static int __pyx_pw_9csamtools_9Fastafile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5049 static int __pyx_pw_9csamtools_9Fastafile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5050 PyObject *__pyx_v_args = 0;
5051 PyObject *__pyx_v_kwargs = 0;
5053 __Pyx_RefNannyDeclarations
5054 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
5055 if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
5056 __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
5057 if (unlikely(!__pyx_v_kwargs)) return -1;
5058 __Pyx_GOTREF(__pyx_v_kwargs);
5059 __Pyx_INCREF(__pyx_args);
5060 __pyx_v_args = __pyx_args;
5061 __pyx_r = __pyx_pf_9csamtools_9Fastafile___cinit__(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);
5062 __Pyx_XDECREF(__pyx_v_args);
5063 __Pyx_XDECREF(__pyx_v_kwargs);
5064 __Pyx_RefNannyFinishContext();
5068 /* "csamtools.pyx":387
5071 * def __cinit__(self, *args, **kwargs ): # <<<<<<<<<<<<<<
5072 * self.fastafile = NULL
5073 * self._filename = NULL
5076 static int __pyx_pf_9csamtools_9Fastafile___cinit__(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
5078 __Pyx_RefNannyDeclarations
5079 PyObject *__pyx_t_1 = NULL;
5080 PyObject *__pyx_t_2 = NULL;
5081 PyObject *__pyx_t_3 = NULL;
5082 PyObject *__pyx_t_4 = NULL;
5083 int __pyx_lineno = 0;
5084 const char *__pyx_filename = NULL;
5085 int __pyx_clineno = 0;
5086 __Pyx_TraceDeclarations
5087 __Pyx_RefNannySetupContext("__cinit__", 0);
5088 __Pyx_TraceCall("__cinit__", __pyx_f[0], 387);
5090 /* "csamtools.pyx":388
5092 * def __cinit__(self, *args, **kwargs ):
5093 * self.fastafile = NULL # <<<<<<<<<<<<<<
5094 * self._filename = NULL
5095 * self._open( *args, **kwargs )
5097 __pyx_v_self->fastafile = NULL;
5099 /* "csamtools.pyx":389
5100 * def __cinit__(self, *args, **kwargs ):
5101 * self.fastafile = NULL
5102 * self._filename = NULL # <<<<<<<<<<<<<<
5103 * self._open( *args, **kwargs )
5106 __pyx_v_self->_filename = NULL;
5108 /* "csamtools.pyx":390
5109 * self.fastafile = NULL
5110 * self._filename = NULL
5111 * self._open( *args, **kwargs ) # <<<<<<<<<<<<<<
5113 * def _isOpen( self ):
5115 __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 = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5116 __Pyx_GOTREF(__pyx_t_1);
5117 __pyx_t_2 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5118 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
5119 __pyx_t_3 = ((PyObject *)__pyx_v_kwargs);
5120 __Pyx_INCREF(__pyx_t_3);
5121 __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5122 __Pyx_GOTREF(__pyx_t_4);
5123 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5124 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
5125 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
5126 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5131 __Pyx_XDECREF(__pyx_t_1);
5132 __Pyx_XDECREF(__pyx_t_2);
5133 __Pyx_XDECREF(__pyx_t_3);
5134 __Pyx_XDECREF(__pyx_t_4);
5135 __Pyx_AddTraceback("csamtools.Fastafile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5138 __Pyx_TraceReturn(Py_None);
5139 __Pyx_RefNannyFinishContext();
5143 /* Python wrapper */
5144 static PyObject *__pyx_pw_9csamtools_9Fastafile_3_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5145 static char __pyx_doc_9csamtools_9Fastafile_2_isOpen[] = "Fastafile._isOpen(self)\nreturn true if samfile has been opened.";
5146 static PyObject *__pyx_pw_9csamtools_9Fastafile_3_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5147 PyObject *__pyx_r = 0;
5148 __Pyx_RefNannyDeclarations
5149 __Pyx_RefNannySetupContext("_isOpen (wrapper)", 0);
5150 __pyx_r = __pyx_pf_9csamtools_9Fastafile_2_isOpen(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self));
5151 __Pyx_RefNannyFinishContext();
5155 /* "csamtools.pyx":392
5156 * self._open( *args, **kwargs )
5158 * def _isOpen( self ): # <<<<<<<<<<<<<<
5159 * '''return true if samfile has been opened.'''
5160 * return self.fastafile != NULL
5163 static PyObject *__pyx_pf_9csamtools_9Fastafile_2_isOpen(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self) {
5164 PyObject *__pyx_r = NULL;
5165 __Pyx_RefNannyDeclarations
5166 PyObject *__pyx_t_1 = NULL;
5167 int __pyx_lineno = 0;
5168 const char *__pyx_filename = NULL;
5169 int __pyx_clineno = 0;
5170 __Pyx_TraceDeclarations
5171 __Pyx_RefNannySetupContext("_isOpen", 0);
5172 __Pyx_TraceCall("_isOpen", __pyx_f[0], 392);
5174 /* "csamtools.pyx":394
5175 * def _isOpen( self ):
5176 * '''return true if samfile has been opened.'''
5177 * return self.fastafile != NULL # <<<<<<<<<<<<<<
5179 * def __len__(self):
5181 __Pyx_XDECREF(__pyx_r);
5182 __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->fastafile != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5183 __Pyx_GOTREF(__pyx_t_1);
5184 __pyx_r = __pyx_t_1;
5188 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5191 __Pyx_XDECREF(__pyx_t_1);
5192 __Pyx_AddTraceback("csamtools.Fastafile._isOpen", __pyx_clineno, __pyx_lineno, __pyx_filename);
5195 __Pyx_XGIVEREF(__pyx_r);
5196 __Pyx_TraceReturn(__pyx_r);
5197 __Pyx_RefNannyFinishContext();
5201 /* Python wrapper */
5202 static Py_ssize_t __pyx_pw_9csamtools_9Fastafile_5__len__(PyObject *__pyx_v_self); /*proto*/
5203 static Py_ssize_t __pyx_pw_9csamtools_9Fastafile_5__len__(PyObject *__pyx_v_self) {
5205 __Pyx_RefNannyDeclarations
5206 __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
5207 __pyx_r = __pyx_pf_9csamtools_9Fastafile_4__len__(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self));
5208 __Pyx_RefNannyFinishContext();
5212 /* "csamtools.pyx":396
5213 * return self.fastafile != NULL
5215 * def __len__(self): # <<<<<<<<<<<<<<
5216 * if self.fastafile == NULL:
5217 * raise ValueError( "calling len() on closed file" )
5220 static Py_ssize_t __pyx_pf_9csamtools_9Fastafile_4__len__(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self) {
5222 __Pyx_RefNannyDeclarations
5224 PyObject *__pyx_t_2 = NULL;
5225 int __pyx_lineno = 0;
5226 const char *__pyx_filename = NULL;
5227 int __pyx_clineno = 0;
5228 __Pyx_TraceDeclarations
5229 __Pyx_RefNannySetupContext("__len__", 0);
5230 __Pyx_TraceCall("__len__", __pyx_f[0], 396);
5232 /* "csamtools.pyx":397
5234 * def __len__(self):
5235 * if self.fastafile == NULL: # <<<<<<<<<<<<<<
5236 * raise ValueError( "calling len() on closed file" )
5239 __pyx_t_1 = (__pyx_v_self->fastafile == NULL);
5242 /* "csamtools.pyx":398
5243 * def __len__(self):
5244 * if self.fastafile == NULL:
5245 * raise ValueError( "calling len() on closed file" ) # <<<<<<<<<<<<<<
5247 * return faidx_fetch_nseq(self.fastafile)
5249 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5250 __Pyx_GOTREF(__pyx_t_2);
5251 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5252 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5253 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5258 /* "csamtools.pyx":400
5259 * raise ValueError( "calling len() on closed file" )
5261 * return faidx_fetch_nseq(self.fastafile) # <<<<<<<<<<<<<<
5265 __pyx_r = faidx_fetch_nseq(__pyx_v_self->fastafile);
5271 __Pyx_XDECREF(__pyx_t_2);
5272 __Pyx_AddTraceback("csamtools.Fastafile.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5275 __Pyx_TraceReturn(Py_None);
5276 __Pyx_RefNannyFinishContext();
5280 /* Python wrapper */
5281 static PyObject *__pyx_pw_9csamtools_9Fastafile_7_open(PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /*proto*/
5282 static char __pyx_doc_9csamtools_9Fastafile_6_open[] = "Fastafile._open(self, filename)\nopen an indexed fasta file.\n\n This method expects an indexed fasta file.\n ";
5283 static PyObject *__pyx_pw_9csamtools_9Fastafile_7_open(PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
5284 PyObject *__pyx_r = 0;
5285 __Pyx_RefNannyDeclarations
5286 __Pyx_RefNannySetupContext("_open (wrapper)", 0);
5287 __pyx_r = __pyx_pf_9csamtools_9Fastafile_6_open(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self), ((PyObject *)__pyx_v_filename));
5288 __Pyx_RefNannyFinishContext();
5292 /* "csamtools.pyx":402
5293 * return faidx_fetch_nseq(self.fastafile)
5295 * def _open( self, # <<<<<<<<<<<<<<
5297 * '''open an indexed fasta file.
5300 static PyObject *__pyx_pf_9csamtools_9Fastafile_6_open(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self, PyObject *__pyx_v_filename) {
5301 PyObject *__pyx_r = NULL;
5302 __Pyx_RefNannyDeclarations
5304 PyObject *__pyx_t_2 = NULL;
5305 PyObject *__pyx_t_3 = NULL;
5307 int __pyx_lineno = 0;
5308 const char *__pyx_filename = NULL;
5309 int __pyx_clineno = 0;
5310 __Pyx_TraceDeclarations
5311 __Pyx_RefNannySetupContext("_open", 0);
5312 __Pyx_TraceCall("_open", __pyx_f[0], 402);
5313 __Pyx_INCREF(__pyx_v_filename);
5315 /* "csamtools.pyx":410
5317 * # close a previously opened file
5318 * if self.fastafile != NULL: self.close() # <<<<<<<<<<<<<<
5319 * if self._filename != NULL: free(self._filename)
5320 * filename = _my_encodeFilename(filename)
5322 __pyx_t_1 = (__pyx_v_self->fastafile != NULL);
5324 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5325 __Pyx_GOTREF(__pyx_t_2);
5326 __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5327 __Pyx_GOTREF(__pyx_t_3);
5328 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5329 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5334 /* "csamtools.pyx":411
5335 * # close a previously opened file
5336 * if self.fastafile != NULL: self.close()
5337 * if self._filename != NULL: free(self._filename) # <<<<<<<<<<<<<<
5338 * filename = _my_encodeFilename(filename)
5339 * self._filename = strdup(filename)
5341 __pyx_t_1 = (__pyx_v_self->_filename != NULL);
5343 free(__pyx_v_self->_filename);
5348 /* "csamtools.pyx":412
5349 * if self.fastafile != NULL: self.close()
5350 * if self._filename != NULL: free(self._filename)
5351 * filename = _my_encodeFilename(filename) # <<<<<<<<<<<<<<
5352 * self._filename = strdup(filename)
5353 * self.fastafile = fai_load( filename )
5355 __pyx_t_3 = ((PyObject *)__pyx_f_9csamtools__my_encodeFilename(__pyx_v_filename)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5356 __Pyx_GOTREF(__pyx_t_3);
5357 __Pyx_DECREF(__pyx_v_filename);
5358 __pyx_v_filename = __pyx_t_3;
5361 /* "csamtools.pyx":413
5362 * if self._filename != NULL: free(self._filename)
5363 * filename = _my_encodeFilename(filename)
5364 * self._filename = strdup(filename) # <<<<<<<<<<<<<<
5365 * self.fastafile = fai_load( filename )
5368 __pyx_t_4 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5369 __pyx_v_self->_filename = strdup(__pyx_t_4);
5371 /* "csamtools.pyx":414
5372 * filename = _my_encodeFilename(filename)
5373 * self._filename = strdup(filename)
5374 * self.fastafile = fai_load( filename ) # <<<<<<<<<<<<<<
5376 * if self.fastafile == NULL:
5378 __pyx_t_4 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5379 __pyx_v_self->fastafile = fai_load(__pyx_t_4);
5381 /* "csamtools.pyx":416
5382 * self.fastafile = fai_load( filename )
5384 * if self.fastafile == NULL: # <<<<<<<<<<<<<<
5385 * raise IOError("could not open file `%s`" % filename )
5388 __pyx_t_1 = (__pyx_v_self->fastafile == NULL);
5391 /* "csamtools.pyx":417
5393 * if self.fastafile == NULL:
5394 * raise IOError("could not open file `%s`" % filename ) # <<<<<<<<<<<<<<
5396 * def close( self ):
5398 __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5399 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
5400 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5401 __Pyx_GOTREF(__pyx_t_2);
5402 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
5403 __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
5405 __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5406 __Pyx_GOTREF(__pyx_t_3);
5407 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
5408 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5409 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5410 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5415 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5418 __Pyx_XDECREF(__pyx_t_2);
5419 __Pyx_XDECREF(__pyx_t_3);
5420 __Pyx_AddTraceback("csamtools.Fastafile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
5423 __Pyx_XDECREF(__pyx_v_filename);
5424 __Pyx_XGIVEREF(__pyx_r);
5425 __Pyx_TraceReturn(__pyx_r);
5426 __Pyx_RefNannyFinishContext();
5430 /* Python wrapper */
5431 static PyObject *__pyx_pw_9csamtools_9Fastafile_9close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5432 static char __pyx_doc_9csamtools_9Fastafile_8close[] = "Fastafile.close(self)";
5433 static PyObject *__pyx_pw_9csamtools_9Fastafile_9close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5434 PyObject *__pyx_r = 0;
5435 __Pyx_RefNannyDeclarations
5436 __Pyx_RefNannySetupContext("close (wrapper)", 0);
5437 __pyx_r = __pyx_pf_9csamtools_9Fastafile_8close(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self));
5438 __Pyx_RefNannyFinishContext();
5442 /* "csamtools.pyx":419
5443 * raise IOError("could not open file `%s`" % filename )
5445 * def close( self ): # <<<<<<<<<<<<<<
5446 * if self.fastafile != NULL:
5447 * fai_destroy( self.fastafile )
5450 static PyObject *__pyx_pf_9csamtools_9Fastafile_8close(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self) {
5451 PyObject *__pyx_r = NULL;
5452 __Pyx_RefNannyDeclarations
5454 __Pyx_TraceDeclarations
5455 __Pyx_RefNannySetupContext("close", 0);
5456 __Pyx_TraceCall("close", __pyx_f[0], 419);
5458 /* "csamtools.pyx":420
5460 * def close( self ):
5461 * if self.fastafile != NULL: # <<<<<<<<<<<<<<
5462 * fai_destroy( self.fastafile )
5463 * self.fastafile = NULL
5465 __pyx_t_1 = (__pyx_v_self->fastafile != NULL);
5468 /* "csamtools.pyx":421
5469 * def close( self ):
5470 * if self.fastafile != NULL:
5471 * fai_destroy( self.fastafile ) # <<<<<<<<<<<<<<
5472 * self.fastafile = NULL
5475 fai_destroy(__pyx_v_self->fastafile);
5477 /* "csamtools.pyx":422
5478 * if self.fastafile != NULL:
5479 * fai_destroy( self.fastafile )
5480 * self.fastafile = NULL # <<<<<<<<<<<<<<
5482 * def __dealloc__(self):
5484 __pyx_v_self->fastafile = NULL;
5489 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5490 __Pyx_XGIVEREF(__pyx_r);
5491 __Pyx_TraceReturn(__pyx_r);
5492 __Pyx_RefNannyFinishContext();
5496 /* Python wrapper */
5497 static void __pyx_pw_9csamtools_9Fastafile_11__dealloc__(PyObject *__pyx_v_self); /*proto*/
5498 static void __pyx_pw_9csamtools_9Fastafile_11__dealloc__(PyObject *__pyx_v_self) {
5499 __Pyx_RefNannyDeclarations
5500 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
5501 __pyx_pf_9csamtools_9Fastafile_10__dealloc__(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self));
5502 __Pyx_RefNannyFinishContext();
5505 /* "csamtools.pyx":424
5506 * self.fastafile = NULL
5508 * def __dealloc__(self): # <<<<<<<<<<<<<<
5510 * if self._filename != NULL: free(self._filename)
5513 static void __pyx_pf_9csamtools_9Fastafile_10__dealloc__(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self) {
5514 __Pyx_RefNannyDeclarations
5515 PyObject *__pyx_t_1 = NULL;
5516 PyObject *__pyx_t_2 = NULL;
5518 int __pyx_lineno = 0;
5519 const char *__pyx_filename = NULL;
5520 int __pyx_clineno = 0;
5521 __Pyx_TraceDeclarations
5522 __Pyx_RefNannySetupContext("__dealloc__", 0);
5523 __Pyx_TraceCall("__dealloc__", __pyx_f[0], 424);
5525 /* "csamtools.pyx":425
5527 * def __dealloc__(self):
5528 * self.close() # <<<<<<<<<<<<<<
5529 * if self._filename != NULL: free(self._filename)
5532 __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 = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5533 __Pyx_GOTREF(__pyx_t_1);
5534 __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 = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5535 __Pyx_GOTREF(__pyx_t_2);
5536 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5537 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5539 /* "csamtools.pyx":426
5540 * def __dealloc__(self):
5542 * if self._filename != NULL: free(self._filename) # <<<<<<<<<<<<<<
5544 * property filename:
5546 __pyx_t_3 = (__pyx_v_self->_filename != NULL);
5548 free(__pyx_v_self->_filename);
5555 __Pyx_XDECREF(__pyx_t_1);
5556 __Pyx_XDECREF(__pyx_t_2);
5557 __Pyx_AddTraceback("csamtools.Fastafile.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5559 __Pyx_TraceReturn(Py_None);
5560 __Pyx_RefNannyFinishContext();
5563 /* Python wrapper */
5564 static PyObject *__pyx_pw_9csamtools_9Fastafile_8filename_1__get__(PyObject *__pyx_v_self); /*proto*/
5565 static PyObject *__pyx_pw_9csamtools_9Fastafile_8filename_1__get__(PyObject *__pyx_v_self) {
5566 PyObject *__pyx_r = 0;
5567 __Pyx_RefNannyDeclarations
5568 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
5569 __pyx_r = __pyx_pf_9csamtools_9Fastafile_8filename___get__(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self));
5570 __Pyx_RefNannyFinishContext();
5574 /* "csamtools.pyx":430
5575 * property filename:
5576 * '''number of :term:`filename` associated with this object.'''
5577 * def __get__(self): # <<<<<<<<<<<<<<
5578 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
5579 * return self._filename
5582 static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self) {
5583 PyObject *__pyx_r = NULL;
5584 __Pyx_RefNannyDeclarations
5585 PyObject *__pyx_t_1 = NULL;
5586 PyObject *__pyx_t_2 = NULL;
5589 int __pyx_lineno = 0;
5590 const char *__pyx_filename = NULL;
5591 int __pyx_clineno = 0;
5592 __Pyx_TraceDeclarations
5593 __Pyx_RefNannySetupContext("__get__", 0);
5594 __Pyx_TraceCall("__get__", __pyx_f[0], 430);
5596 /* "csamtools.pyx":431
5597 * '''number of :term:`filename` associated with this object.'''
5598 * def __get__(self):
5599 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
5600 * return self._filename
5603 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5604 __Pyx_GOTREF(__pyx_t_1);
5605 __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 = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5606 __Pyx_GOTREF(__pyx_t_2);
5607 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5608 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5609 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5610 __pyx_t_4 = (!__pyx_t_3);
5612 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5613 __Pyx_GOTREF(__pyx_t_2);
5614 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5615 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5616 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5621 /* "csamtools.pyx":432
5622 * def __get__(self):
5623 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
5624 * return self._filename # <<<<<<<<<<<<<<
5628 __Pyx_XDECREF(__pyx_r);
5629 __pyx_t_2 = PyBytes_FromString(__pyx_v_self->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5630 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
5631 __pyx_r = ((PyObject *)__pyx_t_2);
5635 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5638 __Pyx_XDECREF(__pyx_t_1);
5639 __Pyx_XDECREF(__pyx_t_2);
5640 __Pyx_AddTraceback("csamtools.Fastafile.filename.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5643 __Pyx_XGIVEREF(__pyx_r);
5644 __Pyx_TraceReturn(__pyx_r);
5645 __Pyx_RefNannyFinishContext();
5649 /* Python wrapper */
5650 static PyObject *__pyx_pw_9csamtools_9Fastafile_13fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5651 static char __pyx_doc_9csamtools_9Fastafile_12fetch[] = "Fastafile.fetch(self, reference=None, start=None, end=None, region=None)\n*(reference = None, start = None, end = None, region = None)*\n\n fetch :meth:`AlignedRead` objects in a :term:`region` using 0-based indexing.\n\n The region is specified by :term:`reference`, *start* and *end*.\n\n fetch returns an empty string if the region is out of range or addresses an unknown *reference*.\n\n If *reference* is given and *start* is None, the sequence from the\n first base is returned. Similarly, if *end* is None, the sequence\n until the last base is returned.\n\n Alternatively, a samtools :term:`region` string can be supplied.\n ";
5652 static PyObject *__pyx_pw_9csamtools_9Fastafile_13fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5653 PyObject *__pyx_v_reference = 0;
5654 PyObject *__pyx_v_start = 0;
5655 PyObject *__pyx_v_end = 0;
5656 PyObject *__pyx_v_region = 0;
5657 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
5658 PyObject *__pyx_r = 0;
5659 __Pyx_RefNannyDeclarations
5660 __Pyx_RefNannySetupContext("fetch (wrapper)", 0);
5662 PyObject* values[4] = {0,0,0,0};
5664 /* "csamtools.pyx":435
5667 * reference = None, # <<<<<<<<<<<<<<
5671 values[0] = ((PyObject *)Py_None);
5673 /* "csamtools.pyx":436
5676 * start = None, # <<<<<<<<<<<<<<
5680 values[1] = ((PyObject *)Py_None);
5682 /* "csamtools.pyx":437
5685 * end = None, # <<<<<<<<<<<<<<
5689 values[2] = ((PyObject *)Py_None);
5691 /* "csamtools.pyx":438
5694 * region = None): # <<<<<<<<<<<<<<
5696 * '''*(reference = None, start = None, end = None, region = None)*
5698 values[3] = ((PyObject *)Py_None);
5699 if (unlikely(__pyx_kwds)) {
5701 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5703 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5704 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5705 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5706 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5708 default: goto __pyx_L5_argtuple_error;
5710 kw_args = PyDict_Size(__pyx_kwds);
5714 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
5715 if (value) { values[0] = value; kw_args--; }
5719 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
5720 if (value) { values[1] = value; kw_args--; }
5724 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
5725 if (value) { values[2] = value; kw_args--; }
5729 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region);
5730 if (value) { values[3] = value; kw_args--; }
5733 if (unlikely(kw_args > 0)) {
5734 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5737 switch (PyTuple_GET_SIZE(__pyx_args)) {
5738 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5739 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5740 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5741 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5743 default: goto __pyx_L5_argtuple_error;
5746 __pyx_v_reference = values[0];
5747 __pyx_v_start = values[1];
5748 __pyx_v_end = values[2];
5749 __pyx_v_region = values[3];
5751 goto __pyx_L4_argument_unpacking_done;
5752 __pyx_L5_argtuple_error:;
5753 __Pyx_RaiseArgtupleInvalid("fetch", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5755 __Pyx_AddTraceback("csamtools.Fastafile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
5756 __Pyx_RefNannyFinishContext();
5758 __pyx_L4_argument_unpacking_done:;
5759 __pyx_r = __pyx_pf_9csamtools_9Fastafile_12fetch(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region);
5760 __Pyx_RefNannyFinishContext();
5764 /* "csamtools.pyx":434
5765 * return self._filename
5767 * def fetch( self, # <<<<<<<<<<<<<<
5772 static PyObject *__pyx_pf_9csamtools_9Fastafile_12fetch(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region) {
5775 PyObject *__pyx_v_py_seq = NULL;
5776 PyObject *__pyx_r = NULL;
5777 __Pyx_RefNannyDeclarations
5778 PyObject *__pyx_t_1 = NULL;
5779 PyObject *__pyx_t_2 = NULL;
5783 int __pyx_lineno = 0;
5784 const char *__pyx_filename = NULL;
5785 int __pyx_clineno = 0;
5786 __Pyx_TraceDeclarations
5787 __Pyx_RefNannySetupContext("fetch", 0);
5788 __Pyx_TraceCall("fetch", __pyx_f[0], 434);
5789 __Pyx_INCREF(__pyx_v_start);
5790 __Pyx_INCREF(__pyx_v_end);
5791 __Pyx_INCREF(__pyx_v_region);
5793 /* "csamtools.pyx":455
5796 * if not self._isOpen(): # <<<<<<<<<<<<<<
5797 * raise ValueError( "I/O operation on closed file" )
5800 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5801 __Pyx_GOTREF(__pyx_t_1);
5802 __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 = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5803 __Pyx_GOTREF(__pyx_t_2);
5804 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5805 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5806 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5807 __pyx_t_4 = (!__pyx_t_3);
5810 /* "csamtools.pyx":456
5812 * if not self._isOpen():
5813 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
5817 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5818 __Pyx_GOTREF(__pyx_t_2);
5819 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5820 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5821 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5826 /* "csamtools.pyx":461
5829 * if not region: # <<<<<<<<<<<<<<
5830 * if reference is None: raise ValueError( 'no sequence/region supplied.' )
5831 * if start is None: start = 0
5833 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5834 __pyx_t_3 = (!__pyx_t_4);
5837 /* "csamtools.pyx":462
5840 * if reference is None: raise ValueError( 'no sequence/region supplied.' ) # <<<<<<<<<<<<<<
5841 * if start is None: start = 0
5842 * if end is None: end = max_pos -1
5844 __pyx_t_3 = (__pyx_v_reference == Py_None);
5846 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5847 __Pyx_GOTREF(__pyx_t_2);
5848 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5849 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5850 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5855 /* "csamtools.pyx":463
5857 * if reference is None: raise ValueError( 'no sequence/region supplied.' )
5858 * if start is None: start = 0 # <<<<<<<<<<<<<<
5859 * if end is None: end = max_pos -1
5862 __pyx_t_3 = (__pyx_v_start == Py_None);
5864 __Pyx_INCREF(__pyx_int_0);
5865 __Pyx_DECREF(__pyx_v_start);
5866 __pyx_v_start = __pyx_int_0;
5871 /* "csamtools.pyx":464
5872 * if reference is None: raise ValueError( 'no sequence/region supplied.' )
5873 * if start is None: start = 0
5874 * if end is None: end = max_pos -1 # <<<<<<<<<<<<<<
5876 * if start > end: raise ValueError( 'invalid region: start (%i) > end (%i)' % (start, end) )
5878 __pyx_t_3 = (__pyx_v_end == Py_None);
5880 __pyx_t_2 = PyInt_FromLong((__pyx_v_9csamtools_max_pos - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5881 __Pyx_GOTREF(__pyx_t_2);
5882 __Pyx_DECREF(__pyx_v_end);
5883 __pyx_v_end = __pyx_t_2;
5889 /* "csamtools.pyx":466
5890 * if end is None: end = max_pos -1
5892 * if start > end: raise ValueError( 'invalid region: start (%i) > end (%i)' % (start, end) ) # <<<<<<<<<<<<<<
5893 * if start == end: return b""
5894 * # valid ranges are from 0 to 2^29-1
5896 __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, __pyx_v_end, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5897 __Pyx_GOTREF(__pyx_t_2);
5898 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5899 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5901 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5902 __Pyx_GOTREF(__pyx_t_2);
5903 __Pyx_INCREF(__pyx_v_start);
5904 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_start);
5905 __Pyx_GIVEREF(__pyx_v_start);
5906 __Pyx_INCREF(__pyx_v_end);
5907 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_end);
5908 __Pyx_GIVEREF(__pyx_v_end);
5909 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5910 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
5911 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
5912 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5913 __Pyx_GOTREF(__pyx_t_2);
5914 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
5915 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
5917 __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5918 __Pyx_GOTREF(__pyx_t_1);
5919 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
5920 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5921 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5922 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5927 /* "csamtools.pyx":467
5929 * if start > end: raise ValueError( 'invalid region: start (%i) > end (%i)' % (start, end) )
5930 * if start == end: return b"" # <<<<<<<<<<<<<<
5931 * # valid ranges are from 0 to 2^29-1
5932 * if not 0 <= start < max_pos: raise ValueError( 'start out of range (%i)' % start )
5934 __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, __pyx_v_end, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5935 __Pyx_GOTREF(__pyx_t_1);
5936 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5937 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5939 __Pyx_XDECREF(__pyx_r);
5940 __Pyx_INCREF(((PyObject *)__pyx_kp_b_16));
5941 __pyx_r = ((PyObject *)__pyx_kp_b_16);
5947 /* "csamtools.pyx":469
5948 * if start == end: return b""
5949 * # valid ranges are from 0 to 2^29-1
5950 * if not 0 <= start < max_pos: raise ValueError( 'start out of range (%i)' % start ) # <<<<<<<<<<<<<<
5951 * if not 0 <= end < max_pos: raise ValueError( 'end out of range (%i)' % end )
5952 * # note: faidx_fetch_seq has a bug such that out-of-range access
5954 __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_start, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5955 __Pyx_GOTREF(__pyx_t_1);
5956 if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
5957 __Pyx_DECREF(__pyx_t_1);
5958 __pyx_t_2 = PyInt_FromLong(__pyx_v_9csamtools_max_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5959 __Pyx_GOTREF(__pyx_t_2);
5960 __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5961 __Pyx_GOTREF(__pyx_t_1);
5962 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5964 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5965 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5966 __pyx_t_4 = (!__pyx_t_3);
5968 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5969 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
5970 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5971 __Pyx_GOTREF(__pyx_t_2);
5972 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
5973 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
5975 __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5976 __Pyx_GOTREF(__pyx_t_1);
5977 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
5978 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5979 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5980 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5985 /* "csamtools.pyx":470
5986 * # valid ranges are from 0 to 2^29-1
5987 * if not 0 <= start < max_pos: raise ValueError( 'start out of range (%i)' % start )
5988 * if not 0 <= end < max_pos: raise ValueError( 'end out of range (%i)' % end ) # <<<<<<<<<<<<<<
5989 * # note: faidx_fetch_seq has a bug such that out-of-range access
5990 * # always returns the last residue. Hence do not use faidx_fetch_seq,
5992 __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_end, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5993 __Pyx_GOTREF(__pyx_t_1);
5994 if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
5995 __Pyx_DECREF(__pyx_t_1);
5996 __pyx_t_2 = PyInt_FromLong(__pyx_v_9csamtools_max_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5997 __Pyx_GOTREF(__pyx_t_2);
5998 __pyx_t_1 = PyObject_RichCompare(__pyx_v_end, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5999 __Pyx_GOTREF(__pyx_t_1);
6000 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6002 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6003 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6004 __pyx_t_3 = (!__pyx_t_4);
6006 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_18), __pyx_v_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6007 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
6008 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6009 __Pyx_GOTREF(__pyx_t_2);
6010 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
6011 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
6013 __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6014 __Pyx_GOTREF(__pyx_t_1);
6015 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
6016 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
6017 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6018 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6023 /* "csamtools.pyx":479
6026 * region = "%s:%i-%i" % (reference, start+1, end) # <<<<<<<<<<<<<<
6027 * if PY_MAJOR_VERSION >= 3:
6028 * region = region.encode('ascii')
6030 __pyx_t_1 = PyNumber_Add(__pyx_v_start, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6031 __Pyx_GOTREF(__pyx_t_1);
6032 __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6033 __Pyx_GOTREF(__pyx_t_2);
6034 __Pyx_INCREF(__pyx_v_reference);
6035 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_reference);
6036 __Pyx_GIVEREF(__pyx_v_reference);
6037 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
6038 __Pyx_GIVEREF(__pyx_t_1);
6039 __Pyx_INCREF(__pyx_v_end);
6040 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_end);
6041 __Pyx_GIVEREF(__pyx_v_end);
6043 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6044 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
6045 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
6046 __Pyx_DECREF(__pyx_v_region);
6047 __pyx_v_region = ((PyObject *)__pyx_t_1);
6050 /* "csamtools.pyx":480
6052 * region = "%s:%i-%i" % (reference, start+1, end)
6053 * if PY_MAJOR_VERSION >= 3: # <<<<<<<<<<<<<<
6054 * region = region.encode('ascii')
6055 * seq = fai_fetch( self.fastafile,
6057 __pyx_t_3 = (PY_MAJOR_VERSION >= 3);
6060 /* "csamtools.pyx":481
6061 * region = "%s:%i-%i" % (reference, start+1, end)
6062 * if PY_MAJOR_VERSION >= 3:
6063 * region = region.encode('ascii') # <<<<<<<<<<<<<<
6064 * seq = fai_fetch( self.fastafile,
6067 __pyx_t_1 = PyObject_GetAttr(__pyx_v_region, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6068 __Pyx_GOTREF(__pyx_t_1);
6069 __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6070 __Pyx_GOTREF(__pyx_t_2);
6071 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6072 __Pyx_DECREF(__pyx_v_region);
6073 __pyx_v_region = __pyx_t_2;
6079 /* "csamtools.pyx":483
6080 * region = region.encode('ascii')
6081 * seq = fai_fetch( self.fastafile,
6082 * region, # <<<<<<<<<<<<<<
6086 __pyx_t_5 = PyBytes_AsString(__pyx_v_region); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6088 /* "csamtools.pyx":484
6089 * seq = fai_fetch( self.fastafile,
6091 * &length ) # <<<<<<<<<<<<<<
6093 * # samtools adds a '\0' at the end
6095 __pyx_v_seq = fai_fetch(__pyx_v_self->fastafile, __pyx_t_5, (&__pyx_v_length));
6100 /* "csamtools.pyx":487
6102 * # samtools adds a '\0' at the end
6103 * seq = fai_fetch( self.fastafile, region, &length ) # <<<<<<<<<<<<<<
6107 __pyx_t_5 = PyBytes_AsString(__pyx_v_region); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6108 __pyx_v_seq = fai_fetch(__pyx_v_self->fastafile, __pyx_t_5, (&__pyx_v_length));
6112 /* "csamtools.pyx":490
6115 * if seq == NULL: # <<<<<<<<<<<<<<
6119 __pyx_t_3 = (__pyx_v_seq == NULL);
6122 /* "csamtools.pyx":491
6125 * return b"" # <<<<<<<<<<<<<<
6129 __Pyx_XDECREF(__pyx_r);
6130 __Pyx_INCREF(((PyObject *)__pyx_kp_b_16));
6131 __pyx_r = ((PyObject *)__pyx_kp_b_16);
6137 /* "csamtools.pyx":493
6140 * try: # <<<<<<<<<<<<<<
6141 * py_seq = seq[:length]
6146 /* "csamtools.pyx":494
6149 * py_seq = seq[:length] # <<<<<<<<<<<<<<
6153 __pyx_t_2 = PyBytes_FromStringAndSize(__pyx_v_seq + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L15;}
6154 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
6155 __pyx_v_py_seq = __pyx_t_2;
6159 /* "csamtools.pyx":496
6160 * py_seq = seq[:length]
6162 * free(seq) # <<<<<<<<<<<<<<
6168 PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
6169 int __pyx_exc_lineno;
6170 __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
6171 __pyx_why = 0; goto __pyx_L16;
6174 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6175 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6176 __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
6177 __pyx_exc_lineno = __pyx_lineno;
6182 switch (__pyx_why) {
6184 __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
6185 __pyx_lineno = __pyx_exc_lineno;
6187 __pyx_exc_value = 0;
6189 goto __pyx_L1_error;
6196 /* "csamtools.pyx":498
6199 * return py_seq # <<<<<<<<<<<<<<
6201 * cdef char * _fetch( self, char * reference, int start, int end, int * length ):
6203 __Pyx_XDECREF(__pyx_r);
6204 __Pyx_INCREF(((PyObject *)__pyx_v_py_seq));
6205 __pyx_r = ((PyObject *)__pyx_v_py_seq);
6208 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6211 __Pyx_XDECREF(__pyx_t_1);
6212 __Pyx_XDECREF(__pyx_t_2);
6213 __Pyx_AddTraceback("csamtools.Fastafile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
6216 __Pyx_XDECREF(__pyx_v_py_seq);
6217 __Pyx_XDECREF(__pyx_v_start);
6218 __Pyx_XDECREF(__pyx_v_end);
6219 __Pyx_XDECREF(__pyx_v_region);
6220 __Pyx_XGIVEREF(__pyx_r);
6221 __Pyx_TraceReturn(__pyx_r);
6222 __Pyx_RefNannyFinishContext();
6226 /* "csamtools.pyx":500
6229 * cdef char * _fetch( self, char * reference, int start, int end, int * length ): # <<<<<<<<<<<<<<
6230 * '''fetch sequence for reference, start and end'''
6234 static char *__pyx_f_9csamtools_9Fastafile__fetch(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self, char *__pyx_v_reference, int __pyx_v_start, int __pyx_v_end, int *__pyx_v_length) {
6236 __Pyx_RefNannyDeclarations
6237 __Pyx_TraceDeclarations
6238 __Pyx_RefNannySetupContext("_fetch", 0);
6239 __Pyx_TraceCall("_fetch", __pyx_f[0], 500);
6241 /* "csamtools.pyx":507
6244 * length ) # <<<<<<<<<<<<<<
6246 * #------------------------------------------------------------------------
6248 __pyx_r = faidx_fetch_seq(__pyx_v_self->fastafile, __pyx_v_reference, __pyx_v_start, (__pyx_v_end - 1), __pyx_v_length);
6253 __Pyx_TraceReturn(Py_None);
6254 __Pyx_RefNannyFinishContext();
6258 /* "csamtools.pyx":512
6259 * #------------------------------------------------------------------------
6260 * #------------------------------------------------------------------------
6261 * cdef int count_callback( bam1_t *alignment, void *f): # <<<<<<<<<<<<<<
6262 * '''callback for bam_fetch - count number of reads.
6266 static int __pyx_f_9csamtools_count_callback(CYTHON_UNUSED bam1_t *__pyx_v_alignment, void *__pyx_v_f) {
6267 int *__pyx_v_counter;
6269 __Pyx_RefNannyDeclarations
6271 __Pyx_TraceDeclarations
6272 __Pyx_RefNannySetupContext("count_callback", 0);
6273 __Pyx_TraceCall("count_callback", __pyx_f[0], 512);
6275 /* "csamtools.pyx":515
6276 * '''callback for bam_fetch - count number of reads.
6278 * cdef int* counter = (<int*>f) # <<<<<<<<<<<<<<
6282 __pyx_v_counter = ((int *)__pyx_v_f);
6284 /* "csamtools.pyx":516
6286 * cdef int* counter = (<int*>f)
6287 * counter[0] += 1; # <<<<<<<<<<<<<<
6289 * ctypedef struct MateData:
6292 (__pyx_v_counter[__pyx_t_1]) = ((__pyx_v_counter[__pyx_t_1]) + 1);
6295 __Pyx_TraceReturn(Py_None);
6296 __Pyx_RefNannyFinishContext();
6300 /* "csamtools.pyx":526
6301 * #------------------------------------------------------------------------
6302 * #------------------------------------------------------------------------
6303 * cdef int mate_callback( bam1_t *alignment, void *f): # <<<<<<<<<<<<<<
6304 * '''callback for bam_fetch = filter mate
6308 static int __pyx_f_9csamtools_mate_callback(bam1_t *__pyx_v_alignment, void *__pyx_v_f) {
6309 __pyx_t_9csamtools_MateData *__pyx_v_d;
6311 __Pyx_RefNannyDeclarations
6315 __Pyx_TraceDeclarations
6316 __Pyx_RefNannySetupContext("mate_callback", 0);
6317 __Pyx_TraceCall("mate_callback", __pyx_f[0], 526);
6319 /* "csamtools.pyx":529
6320 * '''callback for bam_fetch = filter mate
6322 * cdef MateData * d = (<MateData*>f) # <<<<<<<<<<<<<<
6323 * # printf("mate = %p, name1 = %s, name2=%s\t%i\t%i\t%i\n",
6324 * # d.mate, d.name, bam1_qname(alignment),
6326 __pyx_v_d = ((__pyx_t_9csamtools_MateData *)__pyx_v_f);
6328 /* "csamtools.pyx":534
6329 * # d.flag, alignment.core.flag, alignment.core.flag & d.flag)
6331 * if d.mate == NULL: # <<<<<<<<<<<<<<
6332 * # could be sped up by comparing the lengths of query strings first
6335 __pyx_t_1 = (__pyx_v_d->mate == NULL);
6338 /* "csamtools.pyx":540
6339 * # also, make sure that we get the other read by comparing
6341 * if alignment.core.flag & d.flag != 0 and \ # <<<<<<<<<<<<<<
6342 * strcmp( bam1_qname( alignment ), d.name ) == 0:
6343 * d.mate = bam_dup1( alignment )
6345 __pyx_t_1 = ((__pyx_v_alignment->core.flag & __pyx_v_d->flag) != 0);
6348 /* "csamtools.pyx":541
6350 * if alignment.core.flag & d.flag != 0 and \
6351 * strcmp( bam1_qname( alignment ), d.name ) == 0: # <<<<<<<<<<<<<<
6352 * d.mate = bam_dup1( alignment )
6355 __pyx_t_2 = (strcmp(bam1_qname(__pyx_v_alignment), __pyx_v_d->name) == 0);
6356 __pyx_t_3 = __pyx_t_2;
6358 __pyx_t_3 = __pyx_t_1;
6362 /* "csamtools.pyx":542
6363 * if alignment.core.flag & d.flag != 0 and \
6364 * strcmp( bam1_qname( alignment ), d.name ) == 0:
6365 * d.mate = bam_dup1( alignment ) # <<<<<<<<<<<<<<
6369 __pyx_v_d->mate = bam_dup1(__pyx_v_alignment);
6378 __Pyx_TraceReturn(Py_None);
6379 __Pyx_RefNannyFinishContext();
6383 /* Python wrapper */
6384 static int __pyx_pw_9csamtools_7Samfile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6385 static int __pyx_pw_9csamtools_7Samfile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6386 PyObject *__pyx_v_args = 0;
6387 PyObject *__pyx_v_kwargs = 0;
6389 __Pyx_RefNannyDeclarations
6390 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
6391 if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
6392 __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
6393 if (unlikely(!__pyx_v_kwargs)) return -1;
6394 __Pyx_GOTREF(__pyx_v_kwargs);
6395 __Pyx_INCREF(__pyx_args);
6396 __pyx_v_args = __pyx_args;
6397 __pyx_r = __pyx_pf_9csamtools_7Samfile___cinit__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);
6398 __Pyx_XDECREF(__pyx_v_args);
6399 __Pyx_XDECREF(__pyx_v_kwargs);
6400 __Pyx_RefNannyFinishContext();
6404 /* "csamtools.pyx":592
6407 * def __cinit__(self, *args, **kwargs ): # <<<<<<<<<<<<<<
6408 * self.samfile = NULL
6409 * self._filename = NULL
6412 static int __pyx_pf_9csamtools_7Samfile___cinit__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
6414 __Pyx_RefNannyDeclarations
6415 PyObject *__pyx_t_1 = NULL;
6416 PyObject *__pyx_t_2 = NULL;
6417 PyObject *__pyx_t_3 = NULL;
6418 PyObject *__pyx_t_4 = NULL;
6419 int __pyx_lineno = 0;
6420 const char *__pyx_filename = NULL;
6421 int __pyx_clineno = 0;
6422 __Pyx_TraceDeclarations
6423 __Pyx_RefNannySetupContext("__cinit__", 0);
6424 __Pyx_TraceCall("__cinit__", __pyx_f[0], 592);
6426 /* "csamtools.pyx":593
6428 * def __cinit__(self, *args, **kwargs ):
6429 * self.samfile = NULL # <<<<<<<<<<<<<<
6430 * self._filename = NULL
6431 * self.isbam = False
6433 __pyx_v_self->samfile = NULL;
6435 /* "csamtools.pyx":594
6436 * def __cinit__(self, *args, **kwargs ):
6437 * self.samfile = NULL
6438 * self._filename = NULL # <<<<<<<<<<<<<<
6439 * self.isbam = False
6440 * self.isstream = False
6442 __pyx_v_self->_filename = NULL;
6444 /* "csamtools.pyx":595
6445 * self.samfile = NULL
6446 * self._filename = NULL
6447 * self.isbam = False # <<<<<<<<<<<<<<
6448 * self.isstream = False
6449 * self._open( *args, **kwargs )
6451 __pyx_v_self->isbam = 0;
6453 /* "csamtools.pyx":596
6454 * self._filename = NULL
6455 * self.isbam = False
6456 * self.isstream = False # <<<<<<<<<<<<<<
6457 * self._open( *args, **kwargs )
6460 __pyx_v_self->isstream = 0;
6462 /* "csamtools.pyx":597
6463 * self.isbam = False
6464 * self.isstream = False
6465 * self._open( *args, **kwargs ) # <<<<<<<<<<<<<<
6467 * # allocate memory for iterator
6469 __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 = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6470 __Pyx_GOTREF(__pyx_t_1);
6471 __pyx_t_2 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6472 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
6473 __pyx_t_3 = ((PyObject *)__pyx_v_kwargs);
6474 __Pyx_INCREF(__pyx_t_3);
6475 __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6476 __Pyx_GOTREF(__pyx_t_4);
6477 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6478 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
6479 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
6480 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6482 /* "csamtools.pyx":600
6484 * # allocate memory for iterator
6485 * self.b = <bam1_t*>calloc(1, sizeof(bam1_t)) # <<<<<<<<<<<<<<
6487 * def _isOpen( self ):
6489 __pyx_v_self->b = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
6494 __Pyx_XDECREF(__pyx_t_1);
6495 __Pyx_XDECREF(__pyx_t_2);
6496 __Pyx_XDECREF(__pyx_t_3);
6497 __Pyx_XDECREF(__pyx_t_4);
6498 __Pyx_AddTraceback("csamtools.Samfile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6501 __Pyx_TraceReturn(Py_None);
6502 __Pyx_RefNannyFinishContext();
6506 /* Python wrapper */
6507 static PyObject *__pyx_pw_9csamtools_7Samfile_3_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
6508 static char __pyx_doc_9csamtools_7Samfile_2_isOpen[] = "Samfile._isOpen(self)\nreturn true if samfile has been opened.";
6509 static PyObject *__pyx_pw_9csamtools_7Samfile_3_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6510 PyObject *__pyx_r = 0;
6511 __Pyx_RefNannyDeclarations
6512 __Pyx_RefNannySetupContext("_isOpen (wrapper)", 0);
6513 __pyx_r = __pyx_pf_9csamtools_7Samfile_2_isOpen(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
6514 __Pyx_RefNannyFinishContext();
6518 /* "csamtools.pyx":602
6519 * self.b = <bam1_t*>calloc(1, sizeof(bam1_t))
6521 * def _isOpen( self ): # <<<<<<<<<<<<<<
6522 * '''return true if samfile has been opened.'''
6523 * return self.samfile != NULL
6526 static PyObject *__pyx_pf_9csamtools_7Samfile_2_isOpen(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
6527 PyObject *__pyx_r = NULL;
6528 __Pyx_RefNannyDeclarations
6529 PyObject *__pyx_t_1 = NULL;
6530 int __pyx_lineno = 0;
6531 const char *__pyx_filename = NULL;
6532 int __pyx_clineno = 0;
6533 __Pyx_TraceDeclarations
6534 __Pyx_RefNannySetupContext("_isOpen", 0);
6535 __Pyx_TraceCall("_isOpen", __pyx_f[0], 602);
6537 /* "csamtools.pyx":604
6538 * def _isOpen( self ):
6539 * '''return true if samfile has been opened.'''
6540 * return self.samfile != NULL # <<<<<<<<<<<<<<
6542 * def _hasIndex( self ):
6544 __Pyx_XDECREF(__pyx_r);
6545 __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->samfile != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6546 __Pyx_GOTREF(__pyx_t_1);
6547 __pyx_r = __pyx_t_1;
6551 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6554 __Pyx_XDECREF(__pyx_t_1);
6555 __Pyx_AddTraceback("csamtools.Samfile._isOpen", __pyx_clineno, __pyx_lineno, __pyx_filename);
6558 __Pyx_XGIVEREF(__pyx_r);
6559 __Pyx_TraceReturn(__pyx_r);
6560 __Pyx_RefNannyFinishContext();
6564 /* Python wrapper */
6565 static PyObject *__pyx_pw_9csamtools_7Samfile_5_hasIndex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
6566 static char __pyx_doc_9csamtools_7Samfile_4_hasIndex[] = "Samfile._hasIndex(self)\nreturn true if samfile has an existing (and opened) index.";
6567 static PyObject *__pyx_pw_9csamtools_7Samfile_5_hasIndex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6568 PyObject *__pyx_r = 0;
6569 __Pyx_RefNannyDeclarations
6570 __Pyx_RefNannySetupContext("_hasIndex (wrapper)", 0);
6571 __pyx_r = __pyx_pf_9csamtools_7Samfile_4_hasIndex(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
6572 __Pyx_RefNannyFinishContext();
6576 /* "csamtools.pyx":606
6577 * return self.samfile != NULL
6579 * def _hasIndex( self ): # <<<<<<<<<<<<<<
6580 * '''return true if samfile has an existing (and opened) index.'''
6581 * return self.index != NULL
6584 static PyObject *__pyx_pf_9csamtools_7Samfile_4_hasIndex(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
6585 PyObject *__pyx_r = NULL;
6586 __Pyx_RefNannyDeclarations
6587 PyObject *__pyx_t_1 = NULL;
6588 int __pyx_lineno = 0;
6589 const char *__pyx_filename = NULL;
6590 int __pyx_clineno = 0;
6591 __Pyx_TraceDeclarations
6592 __Pyx_RefNannySetupContext("_hasIndex", 0);
6593 __Pyx_TraceCall("_hasIndex", __pyx_f[0], 606);
6595 /* "csamtools.pyx":608
6596 * def _hasIndex( self ):
6597 * '''return true if samfile has an existing (and opened) index.'''
6598 * return self.index != NULL # <<<<<<<<<<<<<<
6602 __Pyx_XDECREF(__pyx_r);
6603 __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->index != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6604 __Pyx_GOTREF(__pyx_t_1);
6605 __pyx_r = __pyx_t_1;
6609 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6612 __Pyx_XDECREF(__pyx_t_1);
6613 __Pyx_AddTraceback("csamtools.Samfile._hasIndex", __pyx_clineno, __pyx_lineno, __pyx_filename);
6616 __Pyx_XGIVEREF(__pyx_r);
6617 __Pyx_TraceReturn(__pyx_r);
6618 __Pyx_RefNannyFinishContext();
6622 /* Python wrapper */
6623 static PyObject *__pyx_pw_9csamtools_7Samfile_7_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6624 static char __pyx_doc_9csamtools_7Samfile_6_open[] = "Samfile._open(self, filename, mode=None, Samfile template=None, referencenames=None, referencelengths=None, text=None, header=None, port=None, add_sq_text=True, check_header=True, check_sq=True)\nopen 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 ";
6625 static PyObject *__pyx_pw_9csamtools_7Samfile_7_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6626 PyObject *__pyx_v_filename = 0;
6627 PyObject *__pyx_v_mode = 0;
6628 struct __pyx_obj_9csamtools_Samfile *__pyx_v_template = 0;
6629 PyObject *__pyx_v_referencenames = 0;
6630 PyObject *__pyx_v_referencelengths = 0;
6631 PyObject *__pyx_v_text = 0;
6632 PyObject *__pyx_v_header = 0;
6633 PyObject *__pyx_v_port = 0;
6634 PyObject *__pyx_v_add_sq_text = 0;
6635 PyObject *__pyx_v_check_header = 0;
6636 PyObject *__pyx_v_check_sq = 0;
6637 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,&__pyx_n_s__template,&__pyx_n_s__referencenames,&__pyx_n_s__referencelengths,&__pyx_n_s__text,&__pyx_n_s__header,&__pyx_n_s__port,&__pyx_n_s__add_sq_text,&__pyx_n_s__check_header,&__pyx_n_s__check_sq,0};
6638 PyObject *__pyx_r = 0;
6639 __Pyx_RefNannyDeclarations
6640 __Pyx_RefNannySetupContext("_open (wrapper)", 0);
6642 PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
6644 /* "csamtools.pyx":612
6647 * mode = None, # <<<<<<<<<<<<<<
6648 * Samfile template = None,
6649 * referencenames = None,
6651 values[1] = ((PyObject *)Py_None);
6653 /* "csamtools.pyx":613
6656 * Samfile template = None, # <<<<<<<<<<<<<<
6657 * referencenames = None,
6658 * referencelengths = None,
6660 values[2] = (PyObject *)((struct __pyx_obj_9csamtools_Samfile *)Py_None);
6662 /* "csamtools.pyx":614
6664 * Samfile template = None,
6665 * referencenames = None, # <<<<<<<<<<<<<<
6666 * referencelengths = None,
6669 values[3] = ((PyObject *)Py_None);
6671 /* "csamtools.pyx":615
6672 * Samfile template = None,
6673 * referencenames = None,
6674 * referencelengths = None, # <<<<<<<<<<<<<<
6678 values[4] = ((PyObject *)Py_None);
6680 /* "csamtools.pyx":616
6681 * referencenames = None,
6682 * referencelengths = None,
6683 * text = None, # <<<<<<<<<<<<<<
6687 values[5] = ((PyObject *)Py_None);
6689 /* "csamtools.pyx":617
6690 * referencelengths = None,
6692 * header = None, # <<<<<<<<<<<<<<
6694 * add_sq_text = True,
6696 values[6] = ((PyObject *)Py_None);
6698 /* "csamtools.pyx":618
6701 * port = None, # <<<<<<<<<<<<<<
6702 * add_sq_text = True,
6703 * check_header = True,
6705 values[7] = ((PyObject *)Py_None);
6706 values[8] = __pyx_k_21;
6707 values[9] = __pyx_k_22;
6708 values[10] = __pyx_k_23;
6709 if (unlikely(__pyx_kwds)) {
6711 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6713 case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
6714 case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
6715 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
6716 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
6717 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6718 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6719 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6720 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6721 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6722 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6723 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6725 default: goto __pyx_L5_argtuple_error;
6727 kw_args = PyDict_Size(__pyx_kwds);
6730 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
6731 if (likely(values[0])) kw_args--;
6732 else goto __pyx_L5_argtuple_error;
6735 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode);
6736 if (value) { values[1] = value; kw_args--; }
6740 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__template);
6741 if (value) { values[2] = value; kw_args--; }
6745 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__referencenames);
6746 if (value) { values[3] = value; kw_args--; }
6750 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__referencelengths);
6751 if (value) { values[4] = value; kw_args--; }
6755 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__text);
6756 if (value) { values[5] = value; kw_args--; }
6760 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__header);
6761 if (value) { values[6] = value; kw_args--; }
6765 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__port);
6766 if (value) { values[7] = value; kw_args--; }
6770 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__add_sq_text);
6771 if (value) { values[8] = value; kw_args--; }
6775 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__check_header);
6776 if (value) { values[9] = value; kw_args--; }
6780 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__check_sq);
6781 if (value) { values[10] = value; kw_args--; }
6784 if (unlikely(kw_args > 0)) {
6785 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_open") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
6788 switch (PyTuple_GET_SIZE(__pyx_args)) {
6789 case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
6790 case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
6791 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
6792 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
6793 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6794 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6795 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6796 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6797 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6798 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6799 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6801 default: goto __pyx_L5_argtuple_error;
6804 __pyx_v_filename = values[0];
6805 __pyx_v_mode = values[1];
6806 __pyx_v_template = ((struct __pyx_obj_9csamtools_Samfile *)values[2]);
6807 __pyx_v_referencenames = values[3];
6808 __pyx_v_referencelengths = values[4];
6809 __pyx_v_text = values[5];
6810 __pyx_v_header = values[6];
6811 __pyx_v_port = values[7];
6812 __pyx_v_add_sq_text = values[8];
6813 __pyx_v_check_header = values[9];
6814 __pyx_v_check_sq = values[10];
6816 goto __pyx_L4_argument_unpacking_done;
6817 __pyx_L5_argtuple_error:;
6818 __Pyx_RaiseArgtupleInvalid("_open", 0, 1, 11, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
6820 __Pyx_AddTraceback("csamtools.Samfile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
6821 __Pyx_RefNannyFinishContext();
6823 __pyx_L4_argument_unpacking_done:;
6824 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_template), __pyx_ptype_9csamtools_Samfile, 1, "template", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6825 __pyx_r = __pyx_pf_9csamtools_7Samfile_6_open(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_filename, __pyx_v_mode, __pyx_v_template, __pyx_v_referencenames, __pyx_v_referencelengths, __pyx_v_text, __pyx_v_header, __pyx_v_port, __pyx_v_add_sq_text, __pyx_v_check_header, __pyx_v_check_sq);
6830 __Pyx_RefNannyFinishContext();
6834 /* "csamtools.pyx":610
6835 * return self.index != NULL
6837 * def _open( self, # <<<<<<<<<<<<<<
6842 static PyObject *__pyx_pf_9csamtools_7Samfile_6_open(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, struct __pyx_obj_9csamtools_Samfile *__pyx_v_template, PyObject *__pyx_v_referencenames, PyObject *__pyx_v_referencelengths, PyObject *__pyx_v_text, PyObject *__pyx_v_header, PyObject *__pyx_v_port, PyObject *__pyx_v_add_sq_text, PyObject *__pyx_v_check_header, PyObject *__pyx_v_check_sq) {
6843 CYTHON_UNUSED PyObject *__pyx_v_msg = NULL;
6844 bam_header_t *__pyx_v_header_to_write;
6845 PyObject *__pyx_v_bmode = 0;
6846 char *__pyx_v_ctext;
6847 PyObject *__pyx_v_n = NULL;
6848 PyObject *__pyx_v_x = NULL;
6849 PyObject *__pyx_v_name = NULL;
6850 PyObject *__pyx_v_store = NULL;
6851 PyObject *__pyx_v_ref = NULL;
6852 PyObject *__pyx_r = NULL;
6853 __Pyx_RefNannyDeclarations
6855 PyObject *__pyx_t_2 = NULL;
6856 PyObject *__pyx_t_3 = NULL;
6857 PyObject *__pyx_t_4 = NULL;
6858 PyObject *__pyx_t_5 = NULL;
6859 PyObject *__pyx_t_6 = NULL;
6860 PyObject *__pyx_t_7 = NULL;
6861 PyObject *__pyx_t_8 = NULL;
6866 Py_ssize_t __pyx_t_13;
6867 Py_ssize_t __pyx_t_14;
6868 PyObject *(*__pyx_t_15)(PyObject *);
6872 uint32_t __pyx_t_19;
6873 const char* __pyx_t_20;
6875 int __pyx_lineno = 0;
6876 const char *__pyx_filename = NULL;
6877 int __pyx_clineno = 0;
6878 __Pyx_TraceDeclarations
6879 __Pyx_RefNannySetupContext("_open", 0);
6880 __Pyx_TraceCall("_open", __pyx_f[0], 610);
6881 __Pyx_INCREF(__pyx_v_filename);
6882 __Pyx_INCREF(__pyx_v_referencenames);
6883 __Pyx_INCREF(__pyx_v_text);
6885 /* "csamtools.pyx":630
6887 * # read mode autodetection
6888 * if mode is None: # <<<<<<<<<<<<<<
6890 * self._open(filename, 'rb', template=template,
6892 __pyx_t_1 = (__pyx_v_mode == Py_None);
6895 /* "csamtools.pyx":631
6896 * # read mode autodetection
6898 * try: # <<<<<<<<<<<<<<
6899 * self._open(filename, 'rb', template=template,
6900 * referencenames=referencenames,
6903 __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
6904 __Pyx_XGOTREF(__pyx_t_2);
6905 __Pyx_XGOTREF(__pyx_t_3);
6906 __Pyx_XGOTREF(__pyx_t_4);
6909 /* "csamtools.pyx":632
6912 * self._open(filename, 'rb', template=template, # <<<<<<<<<<<<<<
6913 * referencenames=referencenames,
6914 * referencelengths=referencelengths,
6916 __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___open); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
6917 __Pyx_GOTREF(__pyx_t_5);
6918 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
6919 __Pyx_GOTREF(__pyx_t_6);
6920 __Pyx_INCREF(__pyx_v_filename);
6921 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_filename);
6922 __Pyx_GIVEREF(__pyx_v_filename);
6923 __Pyx_INCREF(((PyObject *)__pyx_n_s__rb));
6924 PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_n_s__rb));
6925 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rb));
6926 __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
6927 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
6928 if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__template), ((PyObject *)__pyx_v_template)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
6930 /* "csamtools.pyx":633
6932 * self._open(filename, 'rb', template=template,
6933 * referencenames=referencenames, # <<<<<<<<<<<<<<
6934 * referencelengths=referencelengths,
6935 * text=text, header=header, port=port,
6937 if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__referencenames), __pyx_v_referencenames) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
6939 /* "csamtools.pyx":634
6940 * self._open(filename, 'rb', template=template,
6941 * referencenames=referencenames,
6942 * referencelengths=referencelengths, # <<<<<<<<<<<<<<
6943 * text=text, header=header, port=port,
6944 * check_header=check_header,
6946 if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__referencelengths), __pyx_v_referencelengths) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
6948 /* "csamtools.pyx":635
6949 * referencenames=referencenames,
6950 * referencelengths=referencelengths,
6951 * text=text, header=header, port=port, # <<<<<<<<<<<<<<
6952 * check_header=check_header,
6953 * check_sq=check_sq)
6955 if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__text), __pyx_v_text) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
6956 if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__header), __pyx_v_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
6957 if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__port), __pyx_v_port) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
6959 /* "csamtools.pyx":636
6960 * referencelengths=referencelengths,
6961 * text=text, header=header, port=port,
6962 * check_header=check_header, # <<<<<<<<<<<<<<
6963 * check_sq=check_sq)
6966 if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__check_header), __pyx_v_check_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
6968 /* "csamtools.pyx":637
6969 * text=text, header=header, port=port,
6970 * check_header=check_header,
6971 * check_sq=check_sq) # <<<<<<<<<<<<<<
6973 * except ValueError, msg:
6975 if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__check_sq), __pyx_v_check_sq) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
6976 __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
6977 __Pyx_GOTREF(__pyx_t_8);
6978 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6979 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
6980 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
6981 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6983 /* "csamtools.pyx":638
6984 * check_header=check_header,
6985 * check_sq=check_sq)
6986 * return # <<<<<<<<<<<<<<
6987 * except ValueError, msg:
6990 __Pyx_XDECREF(__pyx_r);
6991 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6992 goto __pyx_L8_try_return;
6994 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6995 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6996 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
6997 goto __pyx_L11_try_end;
6998 __pyx_L8_try_return:;
6999 __Pyx_XGIVEREF(__pyx_t_2);
7000 __Pyx_XGIVEREF(__pyx_t_3);
7001 __Pyx_XGIVEREF(__pyx_t_4);
7002 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
7005 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
7006 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7007 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
7008 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
7010 /* "csamtools.pyx":639
7011 * check_sq=check_sq)
7013 * except ValueError, msg: # <<<<<<<<<<<<<<
7017 __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
7019 __Pyx_AddTraceback("csamtools.Samfile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
7020 if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
7021 __Pyx_GOTREF(__pyx_t_8);
7022 __Pyx_GOTREF(__pyx_t_7);
7023 __Pyx_GOTREF(__pyx_t_6);
7024 __Pyx_INCREF(__pyx_t_7);
7025 __pyx_v_msg = __pyx_t_7;
7026 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7027 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7028 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7029 goto __pyx_L5_exception_handled;
7031 __pyx_L6_except_error:;
7032 __Pyx_XGIVEREF(__pyx_t_2);
7033 __Pyx_XGIVEREF(__pyx_t_3);
7034 __Pyx_XGIVEREF(__pyx_t_4);
7035 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
7036 goto __pyx_L1_error;
7037 __pyx_L5_exception_handled:;
7038 __Pyx_XGIVEREF(__pyx_t_2);
7039 __Pyx_XGIVEREF(__pyx_t_3);
7040 __Pyx_XGIVEREF(__pyx_t_4);
7041 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
7045 /* "csamtools.pyx":642
7048 * self._open(filename, 'r', template=template, # <<<<<<<<<<<<<<
7049 * referencenames=referencenames,
7050 * referencelengths=referencelengths,
7052 __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___open); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7053 __Pyx_GOTREF(__pyx_t_6);
7054 __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7055 __Pyx_GOTREF(__pyx_t_7);
7056 __Pyx_INCREF(__pyx_v_filename);
7057 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_filename);
7058 __Pyx_GIVEREF(__pyx_v_filename);
7059 __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
7060 PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__r));
7061 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
7062 __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7063 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
7064 if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__template), ((PyObject *)__pyx_v_template)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7066 /* "csamtools.pyx":643
7068 * self._open(filename, 'r', template=template,
7069 * referencenames=referencenames, # <<<<<<<<<<<<<<
7070 * referencelengths=referencelengths,
7071 * text=text, header=header, port=port,
7073 if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__referencenames), __pyx_v_referencenames) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7075 /* "csamtools.pyx":644
7076 * self._open(filename, 'r', template=template,
7077 * referencenames=referencenames,
7078 * referencelengths=referencelengths, # <<<<<<<<<<<<<<
7079 * text=text, header=header, port=port,
7080 * check_header=check_header,
7082 if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__referencelengths), __pyx_v_referencelengths) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7084 /* "csamtools.pyx":645
7085 * referencenames=referencenames,
7086 * referencelengths=referencelengths,
7087 * text=text, header=header, port=port, # <<<<<<<<<<<<<<
7088 * check_header=check_header,
7089 * check_sq=check_sq)
7091 if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__text), __pyx_v_text) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7092 if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__header), __pyx_v_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7093 if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__port), __pyx_v_port) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7095 /* "csamtools.pyx":646
7096 * referencelengths=referencelengths,
7097 * text=text, header=header, port=port,
7098 * check_header=check_header, # <<<<<<<<<<<<<<
7099 * check_sq=check_sq)
7102 if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__check_header), __pyx_v_check_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7104 /* "csamtools.pyx":647
7105 * text=text, header=header, port=port,
7106 * check_header=check_header,
7107 * check_sq=check_sq) # <<<<<<<<<<<<<<
7111 if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__check_sq), __pyx_v_check_sq) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7112 __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7113 __Pyx_GOTREF(__pyx_t_5);
7114 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7115 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
7116 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
7117 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7119 /* "csamtools.pyx":648
7120 * check_header=check_header,
7121 * check_sq=check_sq)
7122 * return # <<<<<<<<<<<<<<
7124 * assert mode in ( "r","w","rb","wb", "wh", "wbu", "rU" ), "invalid file opening mode `%s`" % mode
7126 __Pyx_XDECREF(__pyx_r);
7127 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7133 /* "csamtools.pyx":650
7136 * assert mode in ( "r","w","rb","wb", "wh", "wbu", "rU" ), "invalid file opening mode `%s`" % mode # <<<<<<<<<<<<<<
7138 * #assert filename != NULL
7140 #ifndef CYTHON_WITHOUT_ASSERTIONS
7141 __Pyx_INCREF(__pyx_v_mode);
7142 __pyx_t_5 = __pyx_v_mode;
7143 __pyx_t_1 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7144 if (!((int)__pyx_t_1)) {
7145 __pyx_t_10 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__w), Py_EQ); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7146 __pyx_t_11 = ((int)__pyx_t_10);
7148 __pyx_t_11 = ((int)__pyx_t_1);
7151 __pyx_t_1 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__rb), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7152 __pyx_t_10 = ((int)__pyx_t_1);
7154 __pyx_t_10 = __pyx_t_11;
7157 __pyx_t_11 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__wb), Py_EQ); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7158 __pyx_t_1 = ((int)__pyx_t_11);
7160 __pyx_t_1 = __pyx_t_10;
7163 __pyx_t_10 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__wh), Py_EQ); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7164 __pyx_t_11 = ((int)__pyx_t_10);
7166 __pyx_t_11 = __pyx_t_1;
7169 __pyx_t_1 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__wbu), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7170 __pyx_t_10 = ((int)__pyx_t_1);
7172 __pyx_t_10 = __pyx_t_11;
7175 __pyx_t_11 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__rU), Py_EQ); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7176 __pyx_t_1 = ((int)__pyx_t_11);
7178 __pyx_t_1 = __pyx_t_10;
7180 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7181 if (unlikely(!__pyx_t_1)) {
7182 __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_24), __pyx_v_mode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7183 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
7184 PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_5));
7185 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
7186 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7190 /* "csamtools.pyx":655
7192 * # close a previously opened file
7193 * if self.samfile != NULL: self.close() # <<<<<<<<<<<<<<
7194 * self.samfile = NULL
7197 __pyx_t_1 = (__pyx_v_self->samfile != NULL);
7199 __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7200 __Pyx_GOTREF(__pyx_t_5);
7201 __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7202 __Pyx_GOTREF(__pyx_t_8);
7203 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7204 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7209 /* "csamtools.pyx":656
7210 * # close a previously opened file
7211 * if self.samfile != NULL: self.close()
7212 * self.samfile = NULL # <<<<<<<<<<<<<<
7214 * cdef bam_header_t * header_to_write
7216 __pyx_v_self->samfile = NULL;
7218 /* "csamtools.pyx":659
7220 * cdef bam_header_t * header_to_write
7221 * header_to_write = NULL # <<<<<<<<<<<<<<
7223 * if self._filename != NULL: free(self._filename )
7225 __pyx_v_header_to_write = NULL;
7227 /* "csamtools.pyx":661
7228 * header_to_write = NULL
7230 * if self._filename != NULL: free(self._filename ) # <<<<<<<<<<<<<<
7231 * filename = _my_encodeFilename(filename)
7232 * cdef bytes bmode = mode.encode('ascii')
7234 __pyx_t_1 = (__pyx_v_self->_filename != NULL);
7236 free(__pyx_v_self->_filename);
7241 /* "csamtools.pyx":662
7243 * if self._filename != NULL: free(self._filename )
7244 * filename = _my_encodeFilename(filename) # <<<<<<<<<<<<<<
7245 * cdef bytes bmode = mode.encode('ascii')
7246 * #cdef char* cfilename
7248 __pyx_t_8 = ((PyObject *)__pyx_f_9csamtools__my_encodeFilename(__pyx_v_filename)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7249 __Pyx_GOTREF(__pyx_t_8);
7250 __Pyx_DECREF(__pyx_v_filename);
7251 __pyx_v_filename = __pyx_t_8;
7254 /* "csamtools.pyx":663
7255 * if self._filename != NULL: free(self._filename )
7256 * filename = _my_encodeFilename(filename)
7257 * cdef bytes bmode = mode.encode('ascii') # <<<<<<<<<<<<<<
7258 * #cdef char* cfilename
7259 * #cfilename = filename.encode(_FILENAME_ENCODING)
7261 __pyx_t_8 = PyObject_GetAttr(__pyx_v_mode, __pyx_n_s__encode); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7262 __Pyx_GOTREF(__pyx_t_8);
7263 __pyx_t_5 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7264 __Pyx_GOTREF(__pyx_t_5);
7265 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7266 if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7267 __pyx_v_bmode = ((PyObject*)__pyx_t_5);
7270 /* "csamtools.pyx":666
7271 * #cdef char* cfilename
7272 * #cfilename = filename.encode(_FILENAME_ENCODING)
7273 * self._filename = strdup(filename) # <<<<<<<<<<<<<<
7274 * self.isstream = strcmp( filename, "-" ) == 0
7277 __pyx_t_12 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7278 __pyx_v_self->_filename = strdup(__pyx_t_12);
7280 /* "csamtools.pyx":667
7281 * #cfilename = filename.encode(_FILENAME_ENCODING)
7282 * self._filename = strdup(filename)
7283 * self.isstream = strcmp( filename, "-" ) == 0 # <<<<<<<<<<<<<<
7285 * self.isbam = len(mode) > 1 and mode[1] == 'b'
7287 __pyx_t_12 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7288 __pyx_v_self->isstream = (strcmp(__pyx_t_12, __pyx_k_26) == 0);
7290 /* "csamtools.pyx":669
7291 * self.isstream = strcmp( filename, "-" ) == 0
7293 * self.isbam = len(mode) > 1 and mode[1] == 'b' # <<<<<<<<<<<<<<
7295 * self.isremote = strncmp(filename,"http:",5) == 0 or \
7297 __pyx_t_13 = PyObject_Length(__pyx_v_mode); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7298 __pyx_t_1 = (__pyx_t_13 > 1);
7300 __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_mode, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7301 __Pyx_GOTREF(__pyx_t_5);
7302 __pyx_t_10 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__b), Py_EQ); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7303 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7304 __pyx_t_11 = __pyx_t_10;
7306 __pyx_t_11 = __pyx_t_1;
7308 __pyx_v_self->isbam = __pyx_t_11;
7310 /* "csamtools.pyx":671
7311 * self.isbam = len(mode) > 1 and mode[1] == 'b'
7313 * self.isremote = strncmp(filename,"http:",5) == 0 or \ # <<<<<<<<<<<<<<
7314 * strncmp(filename,"ftp:",4) == 0
7317 __pyx_t_12 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7318 __pyx_t_11 = (strncmp(__pyx_t_12, __pyx_k_27, 5) == 0);
7321 /* "csamtools.pyx":672
7323 * self.isremote = strncmp(filename,"http:",5) == 0 or \
7324 * strncmp(filename,"ftp:",4) == 0 # <<<<<<<<<<<<<<
7328 __pyx_t_12 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7329 __pyx_t_1 = (strncmp(__pyx_t_12, __pyx_k_28, 4) == 0);
7330 __pyx_t_10 = __pyx_t_1;
7332 __pyx_t_10 = __pyx_t_11;
7335 /* "csamtools.pyx":671
7336 * self.isbam = len(mode) > 1 and mode[1] == 'b'
7338 * self.isremote = strncmp(filename,"http:",5) == 0 or \ # <<<<<<<<<<<<<<
7339 * strncmp(filename,"ftp:",4) == 0
7342 __pyx_v_self->isremote = __pyx_t_10;
7344 /* "csamtools.pyx":675
7347 * ctext = NULL # <<<<<<<<<<<<<<
7349 * if mode[0] == 'w':
7351 __pyx_v_ctext = NULL;
7353 /* "csamtools.pyx":677
7356 * if mode[0] == 'w': # <<<<<<<<<<<<<<
7357 * # open file for writing
7360 __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7361 __Pyx_GOTREF(__pyx_t_5);
7362 __pyx_t_10 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__w), Py_EQ); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7363 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7366 /* "csamtools.pyx":681
7368 * # header structure (used for writing)
7369 * if template: # <<<<<<<<<<<<<<
7370 * # copy header from another file
7371 * header_to_write = template.samfile.header
7373 __pyx_t_10 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_template)); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7376 /* "csamtools.pyx":683
7378 * # copy header from another file
7379 * header_to_write = template.samfile.header # <<<<<<<<<<<<<<
7383 __pyx_v_header_to_write = __pyx_v_template->samfile->header;
7387 /* "csamtools.pyx":685
7388 * header_to_write = template.samfile.header
7390 * elif header: # <<<<<<<<<<<<<<
7391 * header_to_write = self._buildHeader( header )
7394 __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_header); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7397 /* "csamtools.pyx":686
7400 * header_to_write = self._buildHeader( header ) # <<<<<<<<<<<<<<
7404 __pyx_v_header_to_write = ((struct __pyx_vtabstruct_9csamtools_Samfile *)__pyx_v_self->__pyx_vtab)->_buildHeader(__pyx_v_self, __pyx_v_header);
7409 /* "csamtools.pyx":690
7411 * # build header from a target names and lengths
7412 * assert referencenames and referencelengths, "either supply options `template`, `header` or both `referencenames` and `referencelengths` for writing" # <<<<<<<<<<<<<<
7413 * assert len(referencenames) == len(referencelengths), "unequal names and lengths of reference sequences"
7416 #ifndef CYTHON_WITHOUT_ASSERTIONS
7417 __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_referencenames); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7419 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_referencelengths); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7420 __pyx_t_1 = __pyx_t_11;
7422 __pyx_t_1 = __pyx_t_10;
7424 if (unlikely(!__pyx_t_1)) {
7425 PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_29));
7426 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7430 /* "csamtools.pyx":691
7431 * # build header from a target names and lengths
7432 * assert referencenames and referencelengths, "either supply options `template`, `header` or both `referencenames` and `referencelengths` for writing"
7433 * assert len(referencenames) == len(referencelengths), "unequal names and lengths of reference sequences" # <<<<<<<<<<<<<<
7435 * # allocate and fill header
7437 #ifndef CYTHON_WITHOUT_ASSERTIONS
7438 __pyx_t_13 = PyObject_Length(__pyx_v_referencenames); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7439 __pyx_t_14 = PyObject_Length(__pyx_v_referencelengths); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7440 if (unlikely(!(__pyx_t_13 == __pyx_t_14))) {
7441 PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_30));
7442 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7446 /* "csamtools.pyx":694
7448 * # allocate and fill header
7449 * referencenames = [ _force_bytes(ref) for ref in referencenames ] # <<<<<<<<<<<<<<
7450 * header_to_write = bam_header_init()
7451 * header_to_write.n_targets = len(referencenames)
7453 __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7454 __Pyx_GOTREF(__pyx_t_5);
7455 if (PyList_CheckExact(__pyx_v_referencenames) || PyTuple_CheckExact(__pyx_v_referencenames)) {
7456 __pyx_t_8 = __pyx_v_referencenames; __Pyx_INCREF(__pyx_t_8); __pyx_t_14 = 0;
7459 __pyx_t_14 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_referencenames); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7460 __Pyx_GOTREF(__pyx_t_8);
7461 __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
7464 if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) {
7465 if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_8)) break;
7466 __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_7); __pyx_t_14++;
7467 } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) {
7468 if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
7469 __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_7); __pyx_t_14++;
7471 __pyx_t_7 = __pyx_t_15(__pyx_t_8);
7472 if (unlikely(!__pyx_t_7)) {
7473 if (PyErr_Occurred()) {
7474 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
7475 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7479 __Pyx_GOTREF(__pyx_t_7);
7481 __Pyx_XDECREF(__pyx_v_ref);
7482 __pyx_v_ref = __pyx_t_7;
7484 __pyx_t_7 = ((PyObject *)__pyx_f_9csamtools__force_bytes(__pyx_v_ref)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7485 __Pyx_GOTREF(__pyx_t_7);
7486 if (unlikely(PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7487 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7489 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7490 __Pyx_INCREF(((PyObject *)__pyx_t_5));
7491 __Pyx_DECREF(__pyx_v_referencenames);
7492 __pyx_v_referencenames = ((PyObject *)__pyx_t_5);
7493 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
7495 /* "csamtools.pyx":695
7496 * # allocate and fill header
7497 * referencenames = [ _force_bytes(ref) for ref in referencenames ]
7498 * header_to_write = bam_header_init() # <<<<<<<<<<<<<<
7499 * header_to_write.n_targets = len(referencenames)
7502 __pyx_v_header_to_write = bam_header_init();
7504 /* "csamtools.pyx":696
7505 * referencenames = [ _force_bytes(ref) for ref in referencenames ]
7506 * header_to_write = bam_header_init()
7507 * header_to_write.n_targets = len(referencenames) # <<<<<<<<<<<<<<
7509 * for x in referencenames: n += len(x) + 1
7511 __pyx_t_14 = PyObject_Length(__pyx_v_referencenames); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7512 __pyx_v_header_to_write->n_targets = __pyx_t_14;
7514 /* "csamtools.pyx":697
7515 * header_to_write = bam_header_init()
7516 * header_to_write.n_targets = len(referencenames)
7517 * n = 0 # <<<<<<<<<<<<<<
7518 * for x in referencenames: n += len(x) + 1
7519 * header_to_write.target_name = <char**>calloc(n, sizeof(char*))
7521 __Pyx_INCREF(__pyx_int_0);
7522 __pyx_v_n = __pyx_int_0;
7524 /* "csamtools.pyx":698
7525 * header_to_write.n_targets = len(referencenames)
7527 * for x in referencenames: n += len(x) + 1 # <<<<<<<<<<<<<<
7528 * header_to_write.target_name = <char**>calloc(n, sizeof(char*))
7529 * header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
7531 if (PyList_CheckExact(__pyx_v_referencenames) || PyTuple_CheckExact(__pyx_v_referencenames)) {
7532 __pyx_t_5 = __pyx_v_referencenames; __Pyx_INCREF(__pyx_t_5); __pyx_t_14 = 0;
7535 __pyx_t_14 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_referencenames); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7536 __Pyx_GOTREF(__pyx_t_5);
7537 __pyx_t_15 = Py_TYPE(__pyx_t_5)->tp_iternext;
7540 if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_5)) {
7541 if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_5)) break;
7542 __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_14); __Pyx_INCREF(__pyx_t_8); __pyx_t_14++;
7543 } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_5)) {
7544 if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
7545 __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_14); __Pyx_INCREF(__pyx_t_8); __pyx_t_14++;
7547 __pyx_t_8 = __pyx_t_15(__pyx_t_5);
7548 if (unlikely(!__pyx_t_8)) {
7549 if (PyErr_Occurred()) {
7550 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
7551 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7555 __Pyx_GOTREF(__pyx_t_8);
7557 __Pyx_XDECREF(__pyx_v_x);
7558 __pyx_v_x = __pyx_t_8;
7560 __pyx_t_13 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7561 __pyx_t_8 = PyInt_FromSsize_t((__pyx_t_13 + 1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7562 __Pyx_GOTREF(__pyx_t_8);
7563 __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_n, __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7564 __Pyx_GOTREF(__pyx_t_7);
7565 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7566 __Pyx_DECREF(__pyx_v_n);
7567 __pyx_v_n = __pyx_t_7;
7570 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7572 /* "csamtools.pyx":699
7574 * for x in referencenames: n += len(x) + 1
7575 * header_to_write.target_name = <char**>calloc(n, sizeof(char*)) # <<<<<<<<<<<<<<
7576 * header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
7577 * for x from 0 <= x < header_to_write.n_targets:
7579 __pyx_t_16 = __Pyx_PyInt_AsSize_t(__pyx_v_n); if (unlikely((__pyx_t_16 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7580 __pyx_v_header_to_write->target_name = ((char **)calloc(__pyx_t_16, (sizeof(char *))));
7582 /* "csamtools.pyx":700
7583 * for x in referencenames: n += len(x) + 1
7584 * header_to_write.target_name = <char**>calloc(n, sizeof(char*))
7585 * header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t)) # <<<<<<<<<<<<<<
7586 * for x from 0 <= x < header_to_write.n_targets:
7587 * header_to_write.target_len[x] = referencelengths[x]
7589 __pyx_t_16 = __Pyx_PyInt_AsSize_t(__pyx_v_n); if (unlikely((__pyx_t_16 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7590 __pyx_v_header_to_write->target_len = ((uint32_t *)calloc(__pyx_t_16, (sizeof(uint32_t))));
7592 /* "csamtools.pyx":701
7593 * header_to_write.target_name = <char**>calloc(n, sizeof(char*))
7594 * header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
7595 * for x from 0 <= x < header_to_write.n_targets: # <<<<<<<<<<<<<<
7596 * header_to_write.target_len[x] = referencelengths[x]
7597 * name = referencenames[x]
7599 __pyx_t_17 = __pyx_v_header_to_write->n_targets;
7600 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18++) {
7601 __pyx_t_5 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7602 __Pyx_GOTREF(__pyx_t_5);
7603 __Pyx_XDECREF(__pyx_v_x);
7604 __pyx_v_x = __pyx_t_5;
7607 /* "csamtools.pyx":702
7608 * header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
7609 * for x from 0 <= x < header_to_write.n_targets:
7610 * header_to_write.target_len[x] = referencelengths[x] # <<<<<<<<<<<<<<
7611 * name = referencenames[x]
7612 * header_to_write.target_name[x] = <char*>calloc(len(name)+1, sizeof(char))
7614 __pyx_t_5 = PyObject_GetItem(__pyx_v_referencelengths, __pyx_v_x); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7615 __Pyx_GOTREF(__pyx_t_5);
7616 __pyx_t_19 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_5); if (unlikely((__pyx_t_19 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7617 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7618 __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7619 (__pyx_v_header_to_write->target_len[__pyx_t_14]) = __pyx_t_19;
7621 /* "csamtools.pyx":703
7622 * for x from 0 <= x < header_to_write.n_targets:
7623 * header_to_write.target_len[x] = referencelengths[x]
7624 * name = referencenames[x] # <<<<<<<<<<<<<<
7625 * header_to_write.target_name[x] = <char*>calloc(len(name)+1, sizeof(char))
7626 * strncpy( header_to_write.target_name[x], name, len(name) )
7628 __pyx_t_5 = PyObject_GetItem(__pyx_v_referencenames, __pyx_v_x); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7629 __Pyx_GOTREF(__pyx_t_5);
7630 __Pyx_XDECREF(__pyx_v_name);
7631 __pyx_v_name = __pyx_t_5;
7634 /* "csamtools.pyx":704
7635 * header_to_write.target_len[x] = referencelengths[x]
7636 * name = referencenames[x]
7637 * header_to_write.target_name[x] = <char*>calloc(len(name)+1, sizeof(char)) # <<<<<<<<<<<<<<
7638 * strncpy( header_to_write.target_name[x], name, len(name) )
7641 __pyx_t_14 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7642 __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7643 (__pyx_v_header_to_write->target_name[__pyx_t_13]) = ((char *)calloc((__pyx_t_14 + 1), (sizeof(char))));
7645 /* "csamtools.pyx":705
7646 * name = referencenames[x]
7647 * header_to_write.target_name[x] = <char*>calloc(len(name)+1, sizeof(char))
7648 * strncpy( header_to_write.target_name[x], name, len(name) ) # <<<<<<<<<<<<<<
7650 * # Optionally, if there is no text, add a SAM compatible header to output
7652 __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7653 __pyx_t_12 = PyBytes_AsString(__pyx_v_name); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7654 __pyx_t_13 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7655 strncpy((__pyx_v_header_to_write->target_name[__pyx_t_14]), __pyx_t_12, __pyx_t_13);
7656 __pyx_t_18 = __Pyx_PyInt_AsLong(__pyx_v_x); if (unlikely((__pyx_t_18 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7659 /* "csamtools.pyx":701
7660 * header_to_write.target_name = <char**>calloc(n, sizeof(char*))
7661 * header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
7662 * for x from 0 <= x < header_to_write.n_targets: # <<<<<<<<<<<<<<
7663 * header_to_write.target_len[x] = referencelengths[x]
7664 * name = referencenames[x]
7666 __pyx_t_5 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7667 __Pyx_GOTREF(__pyx_t_5);
7668 __Pyx_XDECREF(__pyx_v_x);
7669 __pyx_v_x = __pyx_t_5;
7672 /* "csamtools.pyx":709
7673 * # Optionally, if there is no text, add a SAM compatible header to output
7675 * if text is None and add_sq_text: # <<<<<<<<<<<<<<
7677 * for x from 0 <= x < header_to_write.n_targets:
7679 __pyx_t_1 = (__pyx_v_text == Py_None);
7681 __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_add_sq_text); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7682 __pyx_t_11 = __pyx_t_10;
7684 __pyx_t_11 = __pyx_t_1;
7688 /* "csamtools.pyx":710
7690 * if text is None and add_sq_text:
7691 * text = [] # <<<<<<<<<<<<<<
7692 * for x from 0 <= x < header_to_write.n_targets:
7693 * text.append( "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] ) )
7695 __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7696 __Pyx_GOTREF(__pyx_t_5);
7697 __Pyx_DECREF(__pyx_v_text);
7698 __pyx_v_text = ((PyObject *)__pyx_t_5);
7701 /* "csamtools.pyx":711
7702 * if text is None and add_sq_text:
7704 * for x from 0 <= x < header_to_write.n_targets: # <<<<<<<<<<<<<<
7705 * text.append( "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] ) )
7706 * text = ''.join(text)
7708 __pyx_t_17 = __pyx_v_header_to_write->n_targets;
7709 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18++) {
7710 __pyx_t_5 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7711 __Pyx_GOTREF(__pyx_t_5);
7712 __Pyx_XDECREF(__pyx_v_x);
7713 __pyx_v_x = __pyx_t_5;
7716 /* "csamtools.pyx":712
7718 * for x from 0 <= x < header_to_write.n_targets:
7719 * text.append( "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] ) ) # <<<<<<<<<<<<<<
7720 * text = ''.join(text)
7723 __pyx_t_5 = PyObject_GetItem(__pyx_v_referencenames, __pyx_v_x); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7724 __Pyx_GOTREF(__pyx_t_5);
7725 __pyx_t_7 = PyObject_GetItem(__pyx_v_referencelengths, __pyx_v_x); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7726 __Pyx_GOTREF(__pyx_t_7);
7727 __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7728 __Pyx_GOTREF(__pyx_t_8);
7729 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5);
7730 __Pyx_GIVEREF(__pyx_t_5);
7731 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
7732 __Pyx_GIVEREF(__pyx_t_7);
7735 __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7736 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
7737 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
7738 __pyx_t_8 = __Pyx_PyObject_Append(__pyx_v_text, ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7739 __Pyx_GOTREF(__pyx_t_8);
7740 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
7741 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7742 __pyx_t_18 = __Pyx_PyInt_AsLong(__pyx_v_x); if (unlikely((__pyx_t_18 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7745 /* "csamtools.pyx":711
7746 * if text is None and add_sq_text:
7748 * for x from 0 <= x < header_to_write.n_targets: # <<<<<<<<<<<<<<
7749 * text.append( "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] ) )
7750 * text = ''.join(text)
7752 __pyx_t_8 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7753 __Pyx_GOTREF(__pyx_t_8);
7754 __Pyx_XDECREF(__pyx_v_x);
7755 __pyx_v_x = __pyx_t_8;
7758 /* "csamtools.pyx":713
7759 * for x from 0 <= x < header_to_write.n_targets:
7760 * text.append( "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] ) )
7761 * text = ''.join(text) # <<<<<<<<<<<<<<
7765 __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_16), __pyx_n_s__join); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7766 __Pyx_GOTREF(__pyx_t_8);
7767 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7768 __Pyx_GOTREF(__pyx_t_7);
7769 __Pyx_INCREF(__pyx_v_text);
7770 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_text);
7771 __Pyx_GIVEREF(__pyx_v_text);
7772 __pyx_t_5 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7773 __Pyx_GOTREF(__pyx_t_5);
7774 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7775 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
7776 __Pyx_DECREF(__pyx_v_text);
7777 __pyx_v_text = __pyx_t_5;
7783 /* "csamtools.pyx":715
7784 * text = ''.join(text)
7786 * if text != None: # <<<<<<<<<<<<<<
7788 * text = _force_bytes(text)
7790 __pyx_t_5 = PyObject_RichCompare(__pyx_v_text, Py_None, Py_NE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7791 __Pyx_GOTREF(__pyx_t_5);
7792 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7793 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7796 /* "csamtools.pyx":717
7799 * text = _force_bytes(text) # <<<<<<<<<<<<<<
7801 * header_to_write.l_text = strlen(ctext)
7803 __pyx_t_5 = ((PyObject *)__pyx_f_9csamtools__force_bytes(__pyx_v_text)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7804 __Pyx_GOTREF(__pyx_t_5);
7805 __Pyx_DECREF(__pyx_v_text);
7806 __pyx_v_text = __pyx_t_5;
7809 /* "csamtools.pyx":718
7811 * text = _force_bytes(text)
7812 * ctext = text # <<<<<<<<<<<<<<
7813 * header_to_write.l_text = strlen(ctext)
7814 * header_to_write.text = <char*>calloc( strlen(ctext), sizeof(char) )
7816 __pyx_t_12 = PyBytes_AsString(__pyx_v_text); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7817 __pyx_v_ctext = __pyx_t_12;
7819 /* "csamtools.pyx":719
7820 * text = _force_bytes(text)
7822 * header_to_write.l_text = strlen(ctext) # <<<<<<<<<<<<<<
7823 * header_to_write.text = <char*>calloc( strlen(ctext), sizeof(char) )
7824 * memcpy( header_to_write.text, ctext, strlen(ctext) )
7826 __pyx_v_header_to_write->l_text = strlen(__pyx_v_ctext);
7828 /* "csamtools.pyx":720
7830 * header_to_write.l_text = strlen(ctext)
7831 * header_to_write.text = <char*>calloc( strlen(ctext), sizeof(char) ) # <<<<<<<<<<<<<<
7832 * memcpy( header_to_write.text, ctext, strlen(ctext) )
7835 __pyx_v_header_to_write->text = ((char *)calloc(strlen(__pyx_v_ctext), (sizeof(char))));
7837 /* "csamtools.pyx":721
7838 * header_to_write.l_text = strlen(ctext)
7839 * header_to_write.text = <char*>calloc( strlen(ctext), sizeof(char) )
7840 * memcpy( header_to_write.text, ctext, strlen(ctext) ) # <<<<<<<<<<<<<<
7842 * header_to_write.hash = NULL
7844 memcpy(__pyx_v_header_to_write->text, __pyx_v_ctext, strlen(__pyx_v_ctext));
7849 /* "csamtools.pyx":723
7850 * memcpy( header_to_write.text, ctext, strlen(ctext) )
7852 * header_to_write.hash = NULL # <<<<<<<<<<<<<<
7853 * header_to_write.rg2lib = NULL
7856 __pyx_v_header_to_write->hash = NULL;
7858 /* "csamtools.pyx":724
7860 * header_to_write.hash = NULL
7861 * header_to_write.rg2lib = NULL # <<<<<<<<<<<<<<
7863 * # open file. Header gets written to file at the same time for bam files
7865 __pyx_v_header_to_write->rg2lib = NULL;
7869 /* "csamtools.pyx":728
7870 * # open file. Header gets written to file at the same time for bam files
7871 * # and sam files (in the latter case, the mode needs to be wh)
7872 * store = StderrStore() # <<<<<<<<<<<<<<
7873 * self.samfile = samopen( filename, bmode, header_to_write )
7876 __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7877 __Pyx_GOTREF(__pyx_t_5);
7878 __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7879 __Pyx_GOTREF(__pyx_t_7);
7880 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7881 __pyx_v_store = __pyx_t_7;
7884 /* "csamtools.pyx":729
7885 * # and sam files (in the latter case, the mode needs to be wh)
7886 * store = StderrStore()
7887 * self.samfile = samopen( filename, bmode, header_to_write ) # <<<<<<<<<<<<<<
7891 __pyx_t_20 = PyBytes_AsString(__pyx_v_filename); if (unlikely((__pyx_t_20 == (const char*)NULL) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7892 __pyx_t_12 = PyBytes_AsString(((PyObject *)__pyx_v_bmode)); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7893 __pyx_v_self->samfile = samopen(__pyx_t_20, __pyx_t_12, __pyx_v_header_to_write);
7895 /* "csamtools.pyx":730
7896 * store = StderrStore()
7897 * self.samfile = samopen( filename, bmode, header_to_write )
7898 * store.release() # <<<<<<<<<<<<<<
7900 * # bam_header_destroy takes care of cleaning up of all the members
7902 __pyx_t_7 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7903 __Pyx_GOTREF(__pyx_t_7);
7904 __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7905 __Pyx_GOTREF(__pyx_t_5);
7906 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7907 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7909 /* "csamtools.pyx":733
7911 * # bam_header_destroy takes care of cleaning up of all the members
7912 * if not template and header_to_write != NULL: # <<<<<<<<<<<<<<
7913 * bam_header_destroy( header_to_write )
7916 __pyx_t_11 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_template)); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7917 __pyx_t_1 = (!__pyx_t_11);
7919 __pyx_t_11 = (__pyx_v_header_to_write != NULL);
7920 __pyx_t_10 = __pyx_t_11;
7922 __pyx_t_10 = __pyx_t_1;
7926 /* "csamtools.pyx":734
7927 * # bam_header_destroy takes care of cleaning up of all the members
7928 * if not template and header_to_write != NULL:
7929 * bam_header_destroy( header_to_write ) # <<<<<<<<<<<<<<
7931 * elif mode[0] == "r":
7933 bam_header_destroy(__pyx_v_header_to_write);
7940 /* "csamtools.pyx":736
7941 * bam_header_destroy( header_to_write )
7943 * elif mode[0] == "r": # <<<<<<<<<<<<<<
7944 * # open file for reading
7945 * if strncmp( filename, "-", 1) != 0 and \
7947 __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7948 __Pyx_GOTREF(__pyx_t_5);
7949 __pyx_t_10 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7950 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7953 /* "csamtools.pyx":738
7954 * elif mode[0] == "r":
7955 * # open file for reading
7956 * if strncmp( filename, "-", 1) != 0 and \ # <<<<<<<<<<<<<<
7957 * not self.isremote and \
7958 * not os.path.exists( filename ):
7960 __pyx_t_12 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7961 __pyx_t_10 = (strncmp(__pyx_t_12, __pyx_k_26, 1) != 0);
7964 /* "csamtools.pyx":739
7965 * # open file for reading
7966 * if strncmp( filename, "-", 1) != 0 and \
7967 * not self.isremote and \ # <<<<<<<<<<<<<<
7968 * not os.path.exists( filename ):
7969 * raise IOError( "file `%s` not found" % filename)
7971 __pyx_t_1 = (!__pyx_v_self->isremote);
7974 /* "csamtools.pyx":740
7975 * if strncmp( filename, "-", 1) != 0 and \
7976 * not self.isremote and \
7977 * not os.path.exists( filename ): # <<<<<<<<<<<<<<
7978 * raise IOError( "file `%s` not found" % filename)
7981 __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7982 __Pyx_GOTREF(__pyx_t_5);
7983 __pyx_t_7 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__path); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7984 __Pyx_GOTREF(__pyx_t_7);
7985 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7986 __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__exists); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7987 __Pyx_GOTREF(__pyx_t_5);
7988 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7989 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7990 __Pyx_GOTREF(__pyx_t_7);
7991 __Pyx_INCREF(__pyx_v_filename);
7992 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_filename);
7993 __Pyx_GIVEREF(__pyx_v_filename);
7994 __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7995 __Pyx_GOTREF(__pyx_t_8);
7996 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7997 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
7998 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7999 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8000 __pyx_t_21 = (!__pyx_t_11);
8001 __pyx_t_11 = __pyx_t_21;
8003 __pyx_t_11 = __pyx_t_1;
8005 __pyx_t_1 = __pyx_t_11;
8007 __pyx_t_1 = __pyx_t_10;
8011 /* "csamtools.pyx":741
8012 * not self.isremote and \
8013 * not os.path.exists( filename ):
8014 * raise IOError( "file `%s` not found" % filename) # <<<<<<<<<<<<<<
8016 * # try to detect errors
8018 __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_32), __pyx_v_filename); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8019 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
8020 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8021 __Pyx_GOTREF(__pyx_t_7);
8022 PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_8));
8023 __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
8025 __pyx_t_8 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8026 __Pyx_GOTREF(__pyx_t_8);
8027 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
8028 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
8029 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8030 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8035 /* "csamtools.pyx":744
8037 * # try to detect errors
8038 * self.samfile = samopen( filename, bmode, NULL ) # <<<<<<<<<<<<<<
8039 * if self.samfile == NULL:
8040 * raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode)
8042 __pyx_t_20 = PyBytes_AsString(__pyx_v_filename); if (unlikely((__pyx_t_20 == (const char*)NULL) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8043 __pyx_t_12 = PyBytes_AsString(((PyObject *)__pyx_v_bmode)); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8044 __pyx_v_self->samfile = samopen(__pyx_t_20, __pyx_t_12, NULL);
8046 /* "csamtools.pyx":745
8047 * # try to detect errors
8048 * self.samfile = samopen( filename, bmode, NULL )
8049 * if self.samfile == NULL: # <<<<<<<<<<<<<<
8050 * raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode)
8053 __pyx_t_1 = (__pyx_v_self->samfile == NULL);
8056 /* "csamtools.pyx":746
8057 * self.samfile = samopen( filename, bmode, NULL )
8058 * if self.samfile == NULL:
8059 * raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode) # <<<<<<<<<<<<<<
8061 * # bam files require a valid header
8063 __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_33), __pyx_v_mode); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8064 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
8065 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8066 __Pyx_GOTREF(__pyx_t_7);
8067 PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_8));
8068 __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
8070 __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8071 __Pyx_GOTREF(__pyx_t_8);
8072 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
8073 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
8074 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8075 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8080 /* "csamtools.pyx":749
8082 * # bam files require a valid header
8083 * if self.isbam: # <<<<<<<<<<<<<<
8084 * if self.samfile.header == NULL:
8085 * raise ValueError( "file does not have valid header (mode='%s') - is it BAM format?" % mode )
8087 if (__pyx_v_self->isbam) {
8089 /* "csamtools.pyx":750
8090 * # bam files require a valid header
8092 * if self.samfile.header == NULL: # <<<<<<<<<<<<<<
8093 * raise ValueError( "file does not have valid header (mode='%s') - is it BAM format?" % mode )
8096 __pyx_t_1 = (__pyx_v_self->samfile->header == NULL);
8099 /* "csamtools.pyx":751
8101 * if self.samfile.header == NULL:
8102 * raise ValueError( "file does not have valid header (mode='%s') - is it BAM format?" % mode ) # <<<<<<<<<<<<<<
8104 * # in sam files it is optional (samfile full of unmapped reads)
8106 __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_34), __pyx_v_mode); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8107 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
8108 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8109 __Pyx_GOTREF(__pyx_t_7);
8110 PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_8));
8111 __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
8113 __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8114 __Pyx_GOTREF(__pyx_t_8);
8115 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
8116 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
8117 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8118 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8126 /* "csamtools.pyx":754
8128 * # in sam files it is optional (samfile full of unmapped reads)
8129 * if check_header and self.samfile.header == NULL: # <<<<<<<<<<<<<<
8130 * raise ValueError( "file does not have valid header (mode='%s') - is it SAM format?" % mode )
8133 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_check_header); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8135 __pyx_t_10 = (__pyx_v_self->samfile->header == NULL);
8136 __pyx_t_11 = __pyx_t_10;
8138 __pyx_t_11 = __pyx_t_1;
8142 /* "csamtools.pyx":755
8143 * # in sam files it is optional (samfile full of unmapped reads)
8144 * if check_header and self.samfile.header == NULL:
8145 * raise ValueError( "file does not have valid header (mode='%s') - is it SAM format?" % mode ) # <<<<<<<<<<<<<<
8147 * # disabled for autodetection to work
8149 __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_35), __pyx_v_mode); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8150 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
8151 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8152 __Pyx_GOTREF(__pyx_t_7);
8153 PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_8));
8154 __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
8156 __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8157 __Pyx_GOTREF(__pyx_t_8);
8158 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
8159 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
8160 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8161 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8168 /* "csamtools.pyx":759
8169 * # disabled for autodetection to work
8170 * # needs to be disabled so that reading from sam-files without headers works
8171 * if check_sq and self.samfile.header.n_targets == 0: # <<<<<<<<<<<<<<
8172 * raise ValueError( "file header is empty (mode='%s') - is it SAM/BAM format?" % mode)
8175 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_check_sq); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8177 __pyx_t_1 = (__pyx_v_self->samfile->header->n_targets == 0);
8178 __pyx_t_10 = __pyx_t_1;
8180 __pyx_t_10 = __pyx_t_11;
8184 /* "csamtools.pyx":760
8185 * # needs to be disabled so that reading from sam-files without headers works
8186 * if check_sq and self.samfile.header.n_targets == 0:
8187 * raise ValueError( "file header is empty (mode='%s') - is it SAM/BAM format?" % mode) # <<<<<<<<<<<<<<
8189 * if self.samfile == NULL:
8191 __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_36), __pyx_v_mode); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8192 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
8193 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8194 __Pyx_GOTREF(__pyx_t_7);
8195 PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_8));
8196 __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
8198 __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8199 __Pyx_GOTREF(__pyx_t_8);
8200 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
8201 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
8202 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8203 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8211 /* "csamtools.pyx":762
8212 * raise ValueError( "file header is empty (mode='%s') - is it SAM/BAM format?" % mode)
8214 * if self.samfile == NULL: # <<<<<<<<<<<<<<
8215 * raise IOError("could not open file `%s`" % filename )
8218 __pyx_t_10 = (__pyx_v_self->samfile == NULL);
8221 /* "csamtools.pyx":763
8223 * if self.samfile == NULL:
8224 * raise IOError("could not open file `%s`" % filename ) # <<<<<<<<<<<<<<
8226 * # check for index and open if present
8228 __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_v_filename); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8229 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
8230 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8231 __Pyx_GOTREF(__pyx_t_7);
8232 PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_8));
8233 __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
8235 __pyx_t_8 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8236 __Pyx_GOTREF(__pyx_t_8);
8237 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
8238 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
8239 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8240 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8245 /* "csamtools.pyx":766
8247 * # check for index and open if present
8248 * if mode[0] == "r" and self.isbam: # <<<<<<<<<<<<<<
8250 * if not self.isremote:
8252 __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8253 __Pyx_GOTREF(__pyx_t_8);
8254 __pyx_t_10 = __Pyx_PyString_Equals(__pyx_t_8, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8255 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8257 __pyx_t_11 = __pyx_v_self->isbam;
8259 __pyx_t_11 = __pyx_t_10;
8263 /* "csamtools.pyx":768
8264 * if mode[0] == "r" and self.isbam:
8266 * if not self.isremote: # <<<<<<<<<<<<<<
8267 * if not os.path.exists(filename + b".bai"):
8270 __pyx_t_11 = (!__pyx_v_self->isremote);
8273 /* "csamtools.pyx":769
8275 * if not self.isremote:
8276 * if not os.path.exists(filename + b".bai"): # <<<<<<<<<<<<<<
8280 __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8281 __Pyx_GOTREF(__pyx_t_8);
8282 __pyx_t_7 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__path); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8283 __Pyx_GOTREF(__pyx_t_7);
8284 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8285 __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__exists); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8286 __Pyx_GOTREF(__pyx_t_8);
8287 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8288 __pyx_t_7 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_b_37)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8289 __Pyx_GOTREF(__pyx_t_7);
8290 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8291 __Pyx_GOTREF(__pyx_t_5);
8292 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7);
8293 __Pyx_GIVEREF(__pyx_t_7);
8295 __pyx_t_7 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8296 __Pyx_GOTREF(__pyx_t_7);
8297 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8298 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
8299 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8300 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8301 __pyx_t_10 = (!__pyx_t_11);
8304 /* "csamtools.pyx":770
8305 * if not self.isremote:
8306 * if not os.path.exists(filename + b".bai"):
8307 * self.index = NULL # <<<<<<<<<<<<<<
8309 * # returns NULL if there is no index or index could not be opened
8311 __pyx_v_self->index = NULL;
8316 /* "csamtools.pyx":773
8318 * # returns NULL if there is no index or index could not be opened
8319 * self.index = bam_index_load(filename) # <<<<<<<<<<<<<<
8320 * if self.index == NULL:
8321 * raise IOError("error while opening index `%s` " % filename )
8323 __pyx_t_12 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8324 __pyx_v_self->index = bam_index_load(__pyx_t_12);
8326 /* "csamtools.pyx":774
8327 * # returns NULL if there is no index or index could not be opened
8328 * self.index = bam_index_load(filename)
8329 * if self.index == NULL: # <<<<<<<<<<<<<<
8330 * raise IOError("error while opening index `%s` " % filename )
8333 __pyx_t_10 = (__pyx_v_self->index == NULL);
8336 /* "csamtools.pyx":775
8337 * self.index = bam_index_load(filename)
8338 * if self.index == NULL:
8339 * raise IOError("error while opening index `%s` " % filename ) # <<<<<<<<<<<<<<
8341 * self.index = bam_index_load(filename)
8343 __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_38), __pyx_v_filename); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8344 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
8345 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8346 __Pyx_GOTREF(__pyx_t_5);
8347 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_7));
8348 __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
8350 __pyx_t_7 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8351 __Pyx_GOTREF(__pyx_t_7);
8352 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
8353 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
8354 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8355 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8365 /* "csamtools.pyx":777
8366 * raise IOError("error while opening index `%s` " % filename )
8368 * self.index = bam_index_load(filename) # <<<<<<<<<<<<<<
8369 * if self.index == NULL:
8370 * raise IOError("error while opening index `%s` " % filename )
8372 __pyx_t_12 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8373 __pyx_v_self->index = bam_index_load(__pyx_t_12);
8375 /* "csamtools.pyx":778
8377 * self.index = bam_index_load(filename)
8378 * if self.index == NULL: # <<<<<<<<<<<<<<
8379 * raise IOError("error while opening index `%s` " % filename )
8382 __pyx_t_10 = (__pyx_v_self->index == NULL);
8385 /* "csamtools.pyx":779
8386 * self.index = bam_index_load(filename)
8387 * if self.index == NULL:
8388 * raise IOError("error while opening index `%s` " % filename ) # <<<<<<<<<<<<<<
8390 * if not self.isstream:
8392 __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_38), __pyx_v_filename); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8393 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
8394 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8395 __Pyx_GOTREF(__pyx_t_5);
8396 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_7));
8397 __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
8399 __pyx_t_7 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8400 __Pyx_GOTREF(__pyx_t_7);
8401 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
8402 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
8403 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8404 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8411 /* "csamtools.pyx":781
8412 * raise IOError("error while opening index `%s` " % filename )
8414 * if not self.isstream: # <<<<<<<<<<<<<<
8415 * self.start_offset = bam_tell( self.samfile.x.bam )
8418 __pyx_t_10 = (!__pyx_v_self->isstream);
8421 /* "csamtools.pyx":782
8423 * if not self.isstream:
8424 * self.start_offset = bam_tell( self.samfile.x.bam ) # <<<<<<<<<<<<<<
8426 * def gettid( self, reference ):
8428 __pyx_v_self->start_offset = bam_tell(__pyx_v_self->samfile->x.bam);
8436 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8439 __Pyx_XDECREF(__pyx_t_5);
8440 __Pyx_XDECREF(__pyx_t_6);
8441 __Pyx_XDECREF(__pyx_t_7);
8442 __Pyx_XDECREF(__pyx_t_8);
8443 __Pyx_AddTraceback("csamtools.Samfile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
8446 __Pyx_XDECREF(__pyx_v_msg);
8447 __Pyx_XDECREF(__pyx_v_bmode);
8448 __Pyx_XDECREF(__pyx_v_n);
8449 __Pyx_XDECREF(__pyx_v_x);
8450 __Pyx_XDECREF(__pyx_v_name);
8451 __Pyx_XDECREF(__pyx_v_store);
8452 __Pyx_XDECREF(__pyx_v_ref);
8453 __Pyx_XDECREF(__pyx_v_filename);
8454 __Pyx_XDECREF(__pyx_v_referencenames);
8455 __Pyx_XDECREF(__pyx_v_text);
8456 __Pyx_XGIVEREF(__pyx_r);
8457 __Pyx_TraceReturn(__pyx_r);
8458 __Pyx_RefNannyFinishContext();
8462 /* Python wrapper */
8463 static PyObject *__pyx_pw_9csamtools_7Samfile_9gettid(PyObject *__pyx_v_self, PyObject *__pyx_v_reference); /*proto*/
8464 static char __pyx_doc_9csamtools_7Samfile_8gettid[] = "Samfile.gettid(self, reference)\n\n convert :term:`reference` name into numerical :term:`tid`\n\n returns -1 if reference is not known.\n ";
8465 static PyObject *__pyx_pw_9csamtools_7Samfile_9gettid(PyObject *__pyx_v_self, PyObject *__pyx_v_reference) {
8466 PyObject *__pyx_r = 0;
8467 __Pyx_RefNannyDeclarations
8468 __Pyx_RefNannySetupContext("gettid (wrapper)", 0);
8469 __pyx_r = __pyx_pf_9csamtools_7Samfile_8gettid(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), ((PyObject *)__pyx_v_reference));
8470 __Pyx_RefNannyFinishContext();
8474 /* "csamtools.pyx":784
8475 * self.start_offset = bam_tell( self.samfile.x.bam )
8477 * def gettid( self, reference ): # <<<<<<<<<<<<<<
8479 * convert :term:`reference` name into numerical :term:`tid`
8482 static PyObject *__pyx_pf_9csamtools_7Samfile_8gettid(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference) {
8483 PyObject *__pyx_r = NULL;
8484 __Pyx_RefNannyDeclarations
8485 PyObject *__pyx_t_1 = NULL;
8486 PyObject *__pyx_t_2 = NULL;
8490 int __pyx_lineno = 0;
8491 const char *__pyx_filename = NULL;
8492 int __pyx_clineno = 0;
8493 __Pyx_TraceDeclarations
8494 __Pyx_RefNannySetupContext("gettid", 0);
8495 __Pyx_TraceCall("gettid", __pyx_f[0], 784);
8496 __Pyx_INCREF(__pyx_v_reference);
8498 /* "csamtools.pyx":790
8499 * returns -1 if reference is not known.
8501 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
8502 * reference = _force_bytes(reference)
8503 * return pysam_reference2tid( self.samfile.header, reference )
8505 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8506 __Pyx_GOTREF(__pyx_t_1);
8507 __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 = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8508 __Pyx_GOTREF(__pyx_t_2);
8509 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8510 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8511 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8512 __pyx_t_4 = (!__pyx_t_3);
8514 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_39), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8515 __Pyx_GOTREF(__pyx_t_2);
8516 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
8517 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8518 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8523 /* "csamtools.pyx":791
8525 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
8526 * reference = _force_bytes(reference) # <<<<<<<<<<<<<<
8527 * return pysam_reference2tid( self.samfile.header, reference )
8530 __pyx_t_2 = ((PyObject *)__pyx_f_9csamtools__force_bytes(__pyx_v_reference)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8531 __Pyx_GOTREF(__pyx_t_2);
8532 __Pyx_DECREF(__pyx_v_reference);
8533 __pyx_v_reference = __pyx_t_2;
8536 /* "csamtools.pyx":792
8537 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
8538 * reference = _force_bytes(reference)
8539 * return pysam_reference2tid( self.samfile.header, reference ) # <<<<<<<<<<<<<<
8541 * def getrname( self, tid ):
8543 __Pyx_XDECREF(__pyx_r);
8544 __pyx_t_5 = PyBytes_AsString(__pyx_v_reference); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8545 __pyx_t_2 = PyInt_FromLong(pysam_reference2tid(__pyx_v_self->samfile->header, __pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8546 __Pyx_GOTREF(__pyx_t_2);
8547 __pyx_r = __pyx_t_2;
8551 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8554 __Pyx_XDECREF(__pyx_t_1);
8555 __Pyx_XDECREF(__pyx_t_2);
8556 __Pyx_AddTraceback("csamtools.Samfile.gettid", __pyx_clineno, __pyx_lineno, __pyx_filename);
8559 __Pyx_XDECREF(__pyx_v_reference);
8560 __Pyx_XGIVEREF(__pyx_r);
8561 __Pyx_TraceReturn(__pyx_r);
8562 __Pyx_RefNannyFinishContext();
8566 /* Python wrapper */
8567 static PyObject *__pyx_pw_9csamtools_7Samfile_11getrname(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
8568 static char __pyx_doc_9csamtools_7Samfile_10getrname[] = "Samfile.getrname(self, tid)\n\n convert numerical :term:`tid` into :term:`reference` name.";
8569 static PyObject *__pyx_pw_9csamtools_7Samfile_11getrname(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) {
8570 PyObject *__pyx_r = 0;
8571 __Pyx_RefNannyDeclarations
8572 __Pyx_RefNannySetupContext("getrname (wrapper)", 0);
8573 __pyx_r = __pyx_pf_9csamtools_7Samfile_10getrname(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), ((PyObject *)__pyx_v_tid));
8574 __Pyx_RefNannyFinishContext();
8578 /* "csamtools.pyx":794
8579 * return pysam_reference2tid( self.samfile.header, reference )
8581 * def getrname( self, tid ): # <<<<<<<<<<<<<<
8583 * convert numerical :term:`tid` into :term:`reference` name.'''
8586 static PyObject *__pyx_pf_9csamtools_7Samfile_10getrname(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_tid) {
8587 PyObject *__pyx_r = NULL;
8588 __Pyx_RefNannyDeclarations
8589 PyObject *__pyx_t_1 = NULL;
8590 PyObject *__pyx_t_2 = NULL;
8593 Py_ssize_t __pyx_t_5;
8594 int __pyx_lineno = 0;
8595 const char *__pyx_filename = NULL;
8596 int __pyx_clineno = 0;
8597 __Pyx_TraceDeclarations
8598 __Pyx_RefNannySetupContext("getrname", 0);
8599 __Pyx_TraceCall("getrname", __pyx_f[0], 794);
8601 /* "csamtools.pyx":797
8603 * convert numerical :term:`tid` into :term:`reference` name.'''
8604 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
8605 * if not 0 <= tid < self.samfile.header.n_targets:
8606 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
8608 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8609 __Pyx_GOTREF(__pyx_t_1);
8610 __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 = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8611 __Pyx_GOTREF(__pyx_t_2);
8612 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8613 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8614 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8615 __pyx_t_4 = (!__pyx_t_3);
8617 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8618 __Pyx_GOTREF(__pyx_t_2);
8619 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
8620 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8621 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8626 /* "csamtools.pyx":798
8627 * convert numerical :term:`tid` into :term:`reference` name.'''
8628 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
8629 * if not 0 <= tid < self.samfile.header.n_targets: # <<<<<<<<<<<<<<
8630 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
8631 * return _charptr_to_str(self.samfile.header.target_name[tid])
8633 __pyx_t_2 = PyObject_RichCompare(__pyx_int_0, __pyx_v_tid, Py_LE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8634 __Pyx_GOTREF(__pyx_t_2);
8635 if (__Pyx_PyObject_IsTrue(__pyx_t_2)) {
8636 __Pyx_DECREF(__pyx_t_2);
8637 __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 = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8638 __Pyx_GOTREF(__pyx_t_1);
8639 __pyx_t_2 = PyObject_RichCompare(__pyx_v_tid, __pyx_t_1, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8640 __Pyx_GOTREF(__pyx_t_2);
8641 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8643 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8644 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8645 __pyx_t_3 = (!__pyx_t_4);
8648 /* "csamtools.pyx":799
8649 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
8650 * if not 0 <= tid < self.samfile.header.n_targets:
8651 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) ) # <<<<<<<<<<<<<<
8652 * return _charptr_to_str(self.samfile.header.target_name[tid])
8655 __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->samfile->header->n_targets); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8656 __Pyx_GOTREF(__pyx_t_2);
8657 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8658 __Pyx_GOTREF(__pyx_t_1);
8659 __Pyx_INCREF(__pyx_v_tid);
8660 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tid);
8661 __Pyx_GIVEREF(__pyx_v_tid);
8662 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
8663 __Pyx_GIVEREF(__pyx_t_2);
8665 __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_41), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8666 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
8667 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
8668 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8669 __Pyx_GOTREF(__pyx_t_1);
8670 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
8671 __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
8673 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8674 __Pyx_GOTREF(__pyx_t_2);
8675 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
8676 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
8677 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8678 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8683 /* "csamtools.pyx":800
8684 * if not 0 <= tid < self.samfile.header.n_targets:
8685 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
8686 * return _charptr_to_str(self.samfile.header.target_name[tid]) # <<<<<<<<<<<<<<
8688 * cdef char * _getrname( self, int tid ): # TODO unused
8690 __Pyx_XDECREF(__pyx_r);
8691 __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_tid); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8692 __pyx_t_2 = __pyx_f_9csamtools__charptr_to_str((__pyx_v_self->samfile->header->target_name[__pyx_t_5])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8693 __Pyx_GOTREF(__pyx_t_2);
8694 __pyx_r = __pyx_t_2;
8698 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8701 __Pyx_XDECREF(__pyx_t_1);
8702 __Pyx_XDECREF(__pyx_t_2);
8703 __Pyx_AddTraceback("csamtools.Samfile.getrname", __pyx_clineno, __pyx_lineno, __pyx_filename);
8706 __Pyx_XGIVEREF(__pyx_r);
8707 __Pyx_TraceReturn(__pyx_r);
8708 __Pyx_RefNannyFinishContext();
8712 /* "csamtools.pyx":802
8713 * return _charptr_to_str(self.samfile.header.target_name[tid])
8715 * cdef char * _getrname( self, int tid ): # TODO unused # <<<<<<<<<<<<<<
8717 * convert numerical :term:`tid` into :term:`reference` name.'''
8720 static char *__pyx_f_9csamtools_7Samfile__getrname(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, int __pyx_v_tid) {
8722 __Pyx_RefNannyDeclarations
8723 PyObject *__pyx_t_1 = NULL;
8724 PyObject *__pyx_t_2 = NULL;
8727 PyObject *__pyx_t_5 = NULL;
8728 int __pyx_lineno = 0;
8729 const char *__pyx_filename = NULL;
8730 int __pyx_clineno = 0;
8731 __Pyx_TraceDeclarations
8732 __Pyx_RefNannySetupContext("_getrname", 0);
8733 __Pyx_TraceCall("_getrname", __pyx_f[0], 802);
8735 /* "csamtools.pyx":805
8737 * convert numerical :term:`tid` into :term:`reference` name.'''
8738 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
8739 * if not 0 <= tid < self.samfile.header.n_targets:
8740 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
8742 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8743 __Pyx_GOTREF(__pyx_t_1);
8744 __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 = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8745 __Pyx_GOTREF(__pyx_t_2);
8746 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8747 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8748 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8749 __pyx_t_4 = (!__pyx_t_3);
8751 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_42), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8752 __Pyx_GOTREF(__pyx_t_2);
8753 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
8754 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8755 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8760 /* "csamtools.pyx":806
8761 * convert numerical :term:`tid` into :term:`reference` name.'''
8762 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
8763 * if not 0 <= tid < self.samfile.header.n_targets: # <<<<<<<<<<<<<<
8764 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
8765 * return self.samfile.header.target_name[tid]
8767 __pyx_t_4 = (0 <= __pyx_v_tid);
8769 __pyx_t_4 = (__pyx_v_tid < __pyx_v_self->samfile->header->n_targets);
8771 __pyx_t_3 = (!__pyx_t_4);
8774 /* "csamtools.pyx":807
8775 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
8776 * if not 0 <= tid < self.samfile.header.n_targets:
8777 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) ) # <<<<<<<<<<<<<<
8778 * return self.samfile.header.target_name[tid]
8781 __pyx_t_2 = PyInt_FromLong(__pyx_v_tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8782 __Pyx_GOTREF(__pyx_t_2);
8783 __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 = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8784 __Pyx_GOTREF(__pyx_t_1);
8785 __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8786 __Pyx_GOTREF(__pyx_t_5);
8787 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
8788 __Pyx_GIVEREF(__pyx_t_2);
8789 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
8790 __Pyx_GIVEREF(__pyx_t_1);
8793 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_41), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8794 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
8795 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
8796 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8797 __Pyx_GOTREF(__pyx_t_5);
8798 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1));
8799 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
8801 __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8802 __Pyx_GOTREF(__pyx_t_1);
8803 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
8804 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8805 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8806 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8811 /* "csamtools.pyx":808
8812 * if not 0 <= tid < self.samfile.header.n_targets:
8813 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
8814 * return self.samfile.header.target_name[tid] # <<<<<<<<<<<<<<
8816 * def _parseRegion( self,
8818 __pyx_r = (__pyx_v_self->samfile->header->target_name[__pyx_v_tid]);
8824 __Pyx_XDECREF(__pyx_t_1);
8825 __Pyx_XDECREF(__pyx_t_2);
8826 __Pyx_XDECREF(__pyx_t_5);
8827 __Pyx_WriteUnraisable("csamtools.Samfile._getrname", __pyx_clineno, __pyx_lineno, __pyx_filename);
8830 __Pyx_TraceReturn(Py_None);
8831 __Pyx_RefNannyFinishContext();
8835 /* Python wrapper */
8836 static PyObject *__pyx_pw_9csamtools_7Samfile_13_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8837 static char __pyx_doc_9csamtools_7Samfile_12_parseRegion[] = "Samfile._parseRegion(self, reference=None, start=None, end=None, region=None)\n\n parse region information.\n\n raise ValueError for for invalid regions.\n\n returns a tuple of flag, tid, start and end. Flag indicates\n whether some coordinates were supplied.\n\n Note that regions are 1-based, while start,end are python coordinates.\n ";
8838 static PyObject *__pyx_pw_9csamtools_7Samfile_13_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8839 PyObject *__pyx_v_reference = 0;
8840 PyObject *__pyx_v_start = 0;
8841 PyObject *__pyx_v_end = 0;
8842 PyObject *__pyx_v_region = 0;
8843 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
8844 PyObject *__pyx_r = 0;
8845 __Pyx_RefNannyDeclarations
8846 __Pyx_RefNannySetupContext("_parseRegion (wrapper)", 0);
8848 PyObject* values[4] = {0,0,0,0};
8850 /* "csamtools.pyx":811
8852 * def _parseRegion( self,
8853 * reference = None, # <<<<<<<<<<<<<<
8857 values[0] = ((PyObject *)Py_None);
8859 /* "csamtools.pyx":812
8860 * def _parseRegion( self,
8862 * start = None, # <<<<<<<<<<<<<<
8866 values[1] = ((PyObject *)Py_None);
8868 /* "csamtools.pyx":813
8871 * end = None, # <<<<<<<<<<<<<<
8875 values[2] = ((PyObject *)Py_None);
8877 /* "csamtools.pyx":814
8880 * region = None ): # <<<<<<<<<<<<<<
8882 * parse region information.
8884 values[3] = ((PyObject *)Py_None);
8885 if (unlikely(__pyx_kwds)) {
8887 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8889 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8890 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8891 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8892 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8894 default: goto __pyx_L5_argtuple_error;
8896 kw_args = PyDict_Size(__pyx_kwds);
8900 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
8901 if (value) { values[0] = value; kw_args--; }
8905 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
8906 if (value) { values[1] = value; kw_args--; }
8910 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
8911 if (value) { values[2] = value; kw_args--; }
8915 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region);
8916 if (value) { values[3] = value; kw_args--; }
8919 if (unlikely(kw_args > 0)) {
8920 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_parseRegion") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8923 switch (PyTuple_GET_SIZE(__pyx_args)) {
8924 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8925 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8926 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8927 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8929 default: goto __pyx_L5_argtuple_error;
8932 __pyx_v_reference = values[0];
8933 __pyx_v_start = values[1];
8934 __pyx_v_end = values[2];
8935 __pyx_v_region = values[3];
8937 goto __pyx_L4_argument_unpacking_done;
8938 __pyx_L5_argtuple_error:;
8939 __Pyx_RaiseArgtupleInvalid("_parseRegion", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8941 __Pyx_AddTraceback("csamtools.Samfile._parseRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
8942 __Pyx_RefNannyFinishContext();
8944 __pyx_L4_argument_unpacking_done:;
8945 __pyx_r = __pyx_pf_9csamtools_7Samfile_12_parseRegion(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region);
8946 __Pyx_RefNannyFinishContext();
8950 /* "csamtools.pyx":810
8951 * return self.samfile.header.target_name[tid]
8953 * def _parseRegion( self, # <<<<<<<<<<<<<<
8958 static PyObject *__pyx_pf_9csamtools_7Samfile_12_parseRegion(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region) {
8960 PY_LONG_LONG __pyx_v_rstart;
8961 PY_LONG_LONG __pyx_v_rend;
8962 PyObject *__pyx_v_parts = NULL;
8963 PyObject *__pyx_r = NULL;
8964 __Pyx_RefNannyDeclarations
8965 PyObject *__pyx_t_1 = NULL;
8967 PyObject *__pyx_t_3 = NULL;
8968 PyObject *__pyx_t_4 = NULL;
8969 PyObject *__pyx_t_5 = NULL;
8970 PY_LONG_LONG __pyx_t_6;
8972 PyObject *__pyx_t_8 = NULL;
8973 PyObject *__pyx_t_9 = NULL;
8974 PyObject *__pyx_t_10 = NULL;
8975 PyObject *__pyx_t_11 = NULL;
8976 Py_ssize_t __pyx_t_12;
8978 int __pyx_lineno = 0;
8979 const char *__pyx_filename = NULL;
8980 int __pyx_clineno = 0;
8981 __Pyx_TraceDeclarations
8982 __Pyx_RefNannySetupContext("_parseRegion", 0);
8983 __Pyx_TraceCall("_parseRegion", __pyx_f[0], 810);
8984 __Pyx_INCREF(__pyx_v_reference);
8985 __Pyx_INCREF(__pyx_v_region);
8987 /* "csamtools.pyx":833
8988 * cdef long long rend
8990 * rtid = -1 # <<<<<<<<<<<<<<
8996 /* "csamtools.pyx":834
8999 * rstart = 0 # <<<<<<<<<<<<<<
9005 /* "csamtools.pyx":835
9008 * rend = max_pos # <<<<<<<<<<<<<<
9012 __pyx_v_rend = __pyx_v_9csamtools_max_pos;
9014 /* "csamtools.pyx":836
9017 * if start != None: # <<<<<<<<<<<<<<
9021 __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9022 __Pyx_GOTREF(__pyx_t_1);
9023 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9024 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9027 /* "csamtools.pyx":837
9030 * try: # <<<<<<<<<<<<<<
9032 * except OverflowError:
9035 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
9036 __Pyx_XGOTREF(__pyx_t_3);
9037 __Pyx_XGOTREF(__pyx_t_4);
9038 __Pyx_XGOTREF(__pyx_t_5);
9041 /* "csamtools.pyx":838
9044 * rstart = start # <<<<<<<<<<<<<<
9045 * except OverflowError:
9046 * raise ValueError( 'start out of range (%i)' % start )
9048 __pyx_t_6 = __Pyx_PyInt_AsLongLong(__pyx_v_start); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
9049 __pyx_v_rstart = __pyx_t_6;
9051 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9052 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9053 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9054 goto __pyx_L11_try_end;
9056 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9058 /* "csamtools.pyx":839
9061 * except OverflowError: # <<<<<<<<<<<<<<
9062 * raise ValueError( 'start out of range (%i)' % start )
9065 __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
9067 __Pyx_AddTraceback("csamtools.Samfile._parseRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
9068 if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_8, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
9069 __Pyx_GOTREF(__pyx_t_1);
9070 __Pyx_GOTREF(__pyx_t_8);
9071 __Pyx_GOTREF(__pyx_t_9);
9073 /* "csamtools.pyx":840
9075 * except OverflowError:
9076 * raise ValueError( 'start out of range (%i)' % start ) # <<<<<<<<<<<<<<
9080 __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_v_start); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
9081 __Pyx_GOTREF(((PyObject *)__pyx_t_10));
9082 __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
9083 __Pyx_GOTREF(__pyx_t_11);
9084 PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_t_10));
9085 __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
9087 __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
9088 __Pyx_GOTREF(__pyx_t_10);
9089 __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
9090 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
9091 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
9092 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
9093 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9094 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9095 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9096 goto __pyx_L5_exception_handled;
9098 __pyx_L6_except_error:;
9099 __Pyx_XGIVEREF(__pyx_t_3);
9100 __Pyx_XGIVEREF(__pyx_t_4);
9101 __Pyx_XGIVEREF(__pyx_t_5);
9102 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
9103 goto __pyx_L1_error;
9104 __pyx_L5_exception_handled:;
9105 __Pyx_XGIVEREF(__pyx_t_3);
9106 __Pyx_XGIVEREF(__pyx_t_4);
9107 __Pyx_XGIVEREF(__pyx_t_5);
9108 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
9115 /* "csamtools.pyx":842
9116 * raise ValueError( 'start out of range (%i)' % start )
9118 * if end != None: # <<<<<<<<<<<<<<
9122 __pyx_t_9 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9123 __Pyx_GOTREF(__pyx_t_9);
9124 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9125 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9128 /* "csamtools.pyx":843
9131 * try: # <<<<<<<<<<<<<<
9133 * except OverflowError:
9136 __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
9137 __Pyx_XGOTREF(__pyx_t_5);
9138 __Pyx_XGOTREF(__pyx_t_4);
9139 __Pyx_XGOTREF(__pyx_t_3);
9142 /* "csamtools.pyx":844
9145 * rend = end # <<<<<<<<<<<<<<
9146 * except OverflowError:
9147 * raise ValueError( 'end out of range (%i)' % end )
9149 __pyx_t_6 = __Pyx_PyInt_AsLongLong(__pyx_v_end); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L15_error;}
9150 __pyx_v_rend = __pyx_t_6;
9152 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9153 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9154 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9155 goto __pyx_L22_try_end;
9157 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
9158 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
9159 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9160 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
9161 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
9163 /* "csamtools.pyx":845
9166 * except OverflowError: # <<<<<<<<<<<<<<
9167 * raise ValueError( 'end out of range (%i)' % end )
9170 __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
9172 __Pyx_AddTraceback("csamtools.Samfile._parseRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
9173 if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_8, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
9174 __Pyx_GOTREF(__pyx_t_9);
9175 __Pyx_GOTREF(__pyx_t_8);
9176 __Pyx_GOTREF(__pyx_t_1);
9178 /* "csamtools.pyx":846
9180 * except OverflowError:
9181 * raise ValueError( 'end out of range (%i)' % end ) # <<<<<<<<<<<<<<
9185 __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_18), __pyx_v_end); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
9186 __Pyx_GOTREF(((PyObject *)__pyx_t_10));
9187 __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
9188 __Pyx_GOTREF(__pyx_t_11);
9189 PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_t_10));
9190 __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
9192 __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
9193 __Pyx_GOTREF(__pyx_t_10);
9194 __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
9195 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
9196 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
9197 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L17_except_error;}
9198 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9199 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9200 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9201 goto __pyx_L16_exception_handled;
9203 __pyx_L17_except_error:;
9204 __Pyx_XGIVEREF(__pyx_t_5);
9205 __Pyx_XGIVEREF(__pyx_t_4);
9206 __Pyx_XGIVEREF(__pyx_t_3);
9207 __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
9208 goto __pyx_L1_error;
9209 __pyx_L16_exception_handled:;
9210 __Pyx_XGIVEREF(__pyx_t_5);
9211 __Pyx_XGIVEREF(__pyx_t_4);
9212 __Pyx_XGIVEREF(__pyx_t_3);
9213 __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
9220 /* "csamtools.pyx":848
9221 * raise ValueError( 'end out of range (%i)' % end )
9223 * if region: # <<<<<<<<<<<<<<
9224 * region = _force_str(region)
9225 * parts = re.split( "[:-]", region )
9227 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9230 /* "csamtools.pyx":849
9233 * region = _force_str(region) # <<<<<<<<<<<<<<
9234 * parts = re.split( "[:-]", region )
9235 * reference = parts[0]
9237 __pyx_t_1 = __pyx_f_9csamtools__force_str(__pyx_v_region); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9238 __Pyx_GOTREF(__pyx_t_1);
9239 __Pyx_DECREF(__pyx_v_region);
9240 __pyx_v_region = __pyx_t_1;
9243 /* "csamtools.pyx":850
9245 * region = _force_str(region)
9246 * parts = re.split( "[:-]", region ) # <<<<<<<<<<<<<<
9247 * reference = parts[0]
9248 * if len(parts) >= 2: rstart = int(parts[1]) - 1
9250 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__re); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9251 __Pyx_GOTREF(__pyx_t_1);
9252 __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9253 __Pyx_GOTREF(__pyx_t_8);
9254 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9255 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9256 __Pyx_GOTREF(__pyx_t_1);
9257 __Pyx_INCREF(((PyObject *)__pyx_kp_s_43));
9258 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_43));
9259 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43));
9260 __Pyx_INCREF(__pyx_v_region);
9261 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_region);
9262 __Pyx_GIVEREF(__pyx_v_region);
9263 __pyx_t_9 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9264 __Pyx_GOTREF(__pyx_t_9);
9265 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9266 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
9267 __pyx_v_parts = __pyx_t_9;
9270 /* "csamtools.pyx":851
9271 * region = _force_str(region)
9272 * parts = re.split( "[:-]", region )
9273 * reference = parts[0] # <<<<<<<<<<<<<<
9274 * if len(parts) >= 2: rstart = int(parts[1]) - 1
9275 * if len(parts) >= 3: rend = int(parts[2])
9277 __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_parts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9278 __Pyx_GOTREF(__pyx_t_9);
9279 __Pyx_DECREF(__pyx_v_reference);
9280 __pyx_v_reference = __pyx_t_9;
9283 /* "csamtools.pyx":852
9284 * parts = re.split( "[:-]", region )
9285 * reference = parts[0]
9286 * if len(parts) >= 2: rstart = int(parts[1]) - 1 # <<<<<<<<<<<<<<
9287 * if len(parts) >= 3: rend = int(parts[2])
9290 __pyx_t_12 = PyObject_Length(__pyx_v_parts); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9291 __pyx_t_2 = (__pyx_t_12 >= 2);
9293 __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_parts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9294 __Pyx_GOTREF(__pyx_t_9);
9295 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9296 __Pyx_GOTREF(__pyx_t_1);
9297 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
9298 __Pyx_GIVEREF(__pyx_t_9);
9300 __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9301 __Pyx_GOTREF(__pyx_t_9);
9302 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
9303 __pyx_t_1 = PyNumber_Subtract(__pyx_t_9, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9304 __Pyx_GOTREF(__pyx_t_1);
9305 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9306 __pyx_t_6 = __Pyx_PyInt_AsLongLong(__pyx_t_1); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9307 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9308 __pyx_v_rstart = __pyx_t_6;
9313 /* "csamtools.pyx":853
9314 * reference = parts[0]
9315 * if len(parts) >= 2: rstart = int(parts[1]) - 1
9316 * if len(parts) >= 3: rend = int(parts[2]) # <<<<<<<<<<<<<<
9318 * if not reference: return 0, 0, 0, 0
9320 __pyx_t_12 = PyObject_Length(__pyx_v_parts); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9321 __pyx_t_2 = (__pyx_t_12 >= 3);
9323 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_parts, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9324 __Pyx_GOTREF(__pyx_t_1);
9325 __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9326 __Pyx_GOTREF(__pyx_t_9);
9327 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
9328 __Pyx_GIVEREF(__pyx_t_1);
9330 __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9331 __Pyx_GOTREF(__pyx_t_1);
9332 __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
9333 __pyx_t_6 = __Pyx_PyInt_AsLongLong(__pyx_t_1); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9334 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9335 __pyx_v_rend = __pyx_t_6;
9343 /* "csamtools.pyx":855
9344 * if len(parts) >= 3: rend = int(parts[2])
9346 * if not reference: return 0, 0, 0, 0 # <<<<<<<<<<<<<<
9348 * rtid = self.gettid( reference )
9350 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_reference); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9351 __pyx_t_13 = (!__pyx_t_2);
9353 __Pyx_XDECREF(__pyx_r);
9354 __Pyx_INCREF(((PyObject *)__pyx_k_tuple_44));
9355 __pyx_r = ((PyObject *)__pyx_k_tuple_44);
9361 /* "csamtools.pyx":857
9362 * if not reference: return 0, 0, 0, 0
9364 * rtid = self.gettid( reference ) # <<<<<<<<<<<<<<
9365 * if rtid < 0: raise ValueError( "invalid reference `%s`" % reference )
9366 * if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) )
9368 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__gettid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9369 __Pyx_GOTREF(__pyx_t_1);
9370 __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9371 __Pyx_GOTREF(__pyx_t_9);
9372 __Pyx_INCREF(__pyx_v_reference);
9373 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_reference);
9374 __Pyx_GIVEREF(__pyx_v_reference);
9375 __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9376 __Pyx_GOTREF(__pyx_t_8);
9377 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9378 __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
9379 __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_8); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9380 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9381 __pyx_v_rtid = __pyx_t_7;
9383 /* "csamtools.pyx":858
9385 * rtid = self.gettid( reference )
9386 * if rtid < 0: raise ValueError( "invalid reference `%s`" % reference ) # <<<<<<<<<<<<<<
9387 * if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) )
9388 * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart )
9390 __pyx_t_13 = (__pyx_v_rtid < 0);
9392 __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_45), __pyx_v_reference); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9393 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
9394 __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9395 __Pyx_GOTREF(__pyx_t_9);
9396 PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8));
9397 __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
9399 __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 = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9400 __Pyx_GOTREF(__pyx_t_8);
9401 __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
9402 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
9403 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9404 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9409 /* "csamtools.pyx":859
9410 * rtid = self.gettid( reference )
9411 * if rtid < 0: raise ValueError( "invalid reference `%s`" % reference )
9412 * if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) ) # <<<<<<<<<<<<<<
9413 * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart )
9414 * if not 0 <= rend <= max_pos: raise ValueError( 'end out of range (%i)' % rend )
9416 __pyx_t_13 = (__pyx_v_rstart > __pyx_v_rend);
9418 __pyx_t_8 = PyLong_FromLongLong(__pyx_v_rstart); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9419 __Pyx_GOTREF(__pyx_t_8);
9420 __pyx_t_9 = PyLong_FromLongLong(__pyx_v_rend); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9421 __Pyx_GOTREF(__pyx_t_9);
9422 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9423 __Pyx_GOTREF(__pyx_t_1);
9424 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
9425 __Pyx_GIVEREF(__pyx_t_8);
9426 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9);
9427 __Pyx_GIVEREF(__pyx_t_9);
9430 __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_46), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9431 __Pyx_GOTREF(((PyObject *)__pyx_t_9));
9432 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
9433 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9434 __Pyx_GOTREF(__pyx_t_1);
9435 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_9));
9436 __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
9438 __pyx_t_9 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9439 __Pyx_GOTREF(__pyx_t_9);
9440 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
9441 __Pyx_Raise(__pyx_t_9, 0, 0, 0);
9442 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9443 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9448 /* "csamtools.pyx":860
9449 * if rtid < 0: raise ValueError( "invalid reference `%s`" % reference )
9450 * if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) )
9451 * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart ) # <<<<<<<<<<<<<<
9452 * if not 0 <= rend <= max_pos: raise ValueError( 'end out of range (%i)' % rend )
9455 __pyx_t_13 = (0 <= __pyx_v_rstart);
9457 __pyx_t_13 = (__pyx_v_rstart < __pyx_v_9csamtools_max_pos);
9459 __pyx_t_2 = (!__pyx_t_13);
9461 __pyx_t_9 = PyLong_FromLongLong(__pyx_v_rstart); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9462 __Pyx_GOTREF(__pyx_t_9);
9463 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9464 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
9465 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9466 __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9467 __Pyx_GOTREF(__pyx_t_9);
9468 PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_1));
9469 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
9471 __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9472 __Pyx_GOTREF(__pyx_t_1);
9473 __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
9474 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
9475 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9476 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9481 /* "csamtools.pyx":861
9482 * if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) )
9483 * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart )
9484 * if not 0 <= rend <= max_pos: raise ValueError( 'end out of range (%i)' % rend ) # <<<<<<<<<<<<<<
9486 * return 1, rtid, rstart, rend
9488 __pyx_t_2 = (0 <= __pyx_v_rend);
9490 __pyx_t_2 = (__pyx_v_rend <= __pyx_v_9csamtools_max_pos);
9492 __pyx_t_13 = (!__pyx_t_2);
9494 __pyx_t_1 = PyLong_FromLongLong(__pyx_v_rend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9495 __Pyx_GOTREF(__pyx_t_1);
9496 __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_18), __pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9497 __Pyx_GOTREF(((PyObject *)__pyx_t_9));
9498 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9499 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9500 __Pyx_GOTREF(__pyx_t_1);
9501 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_9));
9502 __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
9504 __pyx_t_9 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9505 __Pyx_GOTREF(__pyx_t_9);
9506 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
9507 __Pyx_Raise(__pyx_t_9, 0, 0, 0);
9508 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9509 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9514 /* "csamtools.pyx":863
9515 * if not 0 <= rend <= max_pos: raise ValueError( 'end out of range (%i)' % rend )
9517 * return 1, rtid, rstart, rend # <<<<<<<<<<<<<<
9519 * def reset( self ):
9521 __Pyx_XDECREF(__pyx_r);
9522 __pyx_t_9 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9523 __Pyx_GOTREF(__pyx_t_9);
9524 __pyx_t_1 = PyLong_FromLongLong(__pyx_v_rstart); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9525 __Pyx_GOTREF(__pyx_t_1);
9526 __pyx_t_8 = PyLong_FromLongLong(__pyx_v_rend); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9527 __Pyx_GOTREF(__pyx_t_8);
9528 __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9529 __Pyx_GOTREF(__pyx_t_10);
9530 __Pyx_INCREF(__pyx_int_1);
9531 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_int_1);
9532 __Pyx_GIVEREF(__pyx_int_1);
9533 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
9534 __Pyx_GIVEREF(__pyx_t_9);
9535 PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_1);
9536 __Pyx_GIVEREF(__pyx_t_1);
9537 PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_8);
9538 __Pyx_GIVEREF(__pyx_t_8);
9542 __pyx_r = ((PyObject *)__pyx_t_10);
9546 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9549 __Pyx_XDECREF(__pyx_t_1);
9550 __Pyx_XDECREF(__pyx_t_8);
9551 __Pyx_XDECREF(__pyx_t_9);
9552 __Pyx_XDECREF(__pyx_t_10);
9553 __Pyx_XDECREF(__pyx_t_11);
9554 __Pyx_AddTraceback("csamtools.Samfile._parseRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
9557 __Pyx_XDECREF(__pyx_v_parts);
9558 __Pyx_XDECREF(__pyx_v_reference);
9559 __Pyx_XDECREF(__pyx_v_region);
9560 __Pyx_XGIVEREF(__pyx_r);
9561 __Pyx_TraceReturn(__pyx_r);
9562 __Pyx_RefNannyFinishContext();
9566 /* Python wrapper */
9567 static PyObject *__pyx_pw_9csamtools_7Samfile_15reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
9568 static char __pyx_doc_9csamtools_7Samfile_14reset[] = "Samfile.reset(self)\nreset file position to beginning of read section.";
9569 static PyObject *__pyx_pw_9csamtools_7Samfile_15reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9570 PyObject *__pyx_r = 0;
9571 __Pyx_RefNannyDeclarations
9572 __Pyx_RefNannySetupContext("reset (wrapper)", 0);
9573 __pyx_r = __pyx_pf_9csamtools_7Samfile_14reset(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
9574 __Pyx_RefNannyFinishContext();
9578 /* "csamtools.pyx":865
9579 * return 1, rtid, rstart, rend
9581 * def reset( self ): # <<<<<<<<<<<<<<
9582 * '''reset file position to beginning of read section.'''
9583 * return self.seek( self.start_offset, 0 )
9586 static PyObject *__pyx_pf_9csamtools_7Samfile_14reset(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
9587 PyObject *__pyx_r = NULL;
9588 __Pyx_RefNannyDeclarations
9589 PyObject *__pyx_t_1 = NULL;
9590 PyObject *__pyx_t_2 = NULL;
9591 PyObject *__pyx_t_3 = NULL;
9592 int __pyx_lineno = 0;
9593 const char *__pyx_filename = NULL;
9594 int __pyx_clineno = 0;
9595 __Pyx_TraceDeclarations
9596 __Pyx_RefNannySetupContext("reset", 0);
9597 __Pyx_TraceCall("reset", __pyx_f[0], 865);
9599 /* "csamtools.pyx":867
9600 * def reset( self ):
9601 * '''reset file position to beginning of read section.'''
9602 * return self.seek( self.start_offset, 0 ) # <<<<<<<<<<<<<<
9604 * def seek( self, uint64_t offset, int where = 0):
9606 __Pyx_XDECREF(__pyx_r);
9607 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9608 __Pyx_GOTREF(__pyx_t_1);
9609 __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(__pyx_v_self->start_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9610 __Pyx_GOTREF(__pyx_t_2);
9611 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9612 __Pyx_GOTREF(__pyx_t_3);
9613 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
9614 __Pyx_GIVEREF(__pyx_t_2);
9615 __Pyx_INCREF(__pyx_int_0);
9616 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
9617 __Pyx_GIVEREF(__pyx_int_0);
9619 __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9620 __Pyx_GOTREF(__pyx_t_2);
9621 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9622 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
9623 __pyx_r = __pyx_t_2;
9627 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9630 __Pyx_XDECREF(__pyx_t_1);
9631 __Pyx_XDECREF(__pyx_t_2);
9632 __Pyx_XDECREF(__pyx_t_3);
9633 __Pyx_AddTraceback("csamtools.Samfile.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
9636 __Pyx_XGIVEREF(__pyx_r);
9637 __Pyx_TraceReturn(__pyx_r);
9638 __Pyx_RefNannyFinishContext();
9642 /* Python wrapper */
9643 static PyObject *__pyx_pw_9csamtools_7Samfile_17seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9644 static char __pyx_doc_9csamtools_7Samfile_16seek[] = "Samfile.seek(self, uint64_t offset, int where=0)\n\n move file pointer to position *offset*, see :meth:`pysam.Samfile.tell`.\n ";
9645 static PyObject *__pyx_pw_9csamtools_7Samfile_17seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9646 uint64_t __pyx_v_offset;
9648 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__offset,&__pyx_n_s__where,0};
9649 PyObject *__pyx_r = 0;
9650 __Pyx_RefNannyDeclarations
9651 __Pyx_RefNannySetupContext("seek (wrapper)", 0);
9653 PyObject* values[2] = {0,0};
9654 if (unlikely(__pyx_kwds)) {
9656 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9658 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9659 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9661 default: goto __pyx_L5_argtuple_error;
9663 kw_args = PyDict_Size(__pyx_kwds);
9666 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset);
9667 if (likely(values[0])) kw_args--;
9668 else goto __pyx_L5_argtuple_error;
9671 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__where);
9672 if (value) { values[1] = value; kw_args--; }
9675 if (unlikely(kw_args > 0)) {
9676 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "seek") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
9680 __pyx_v_where = ((int)0);
9683 switch (PyTuple_GET_SIZE(__pyx_args)) {
9684 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9685 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9687 default: goto __pyx_L5_argtuple_error;
9690 __pyx_v_offset = __Pyx_PyInt_from_py_uint64_t(values[0]); if (unlikely((__pyx_v_offset == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
9692 __pyx_v_where = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_where == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
9694 __pyx_v_where = ((int)0);
9697 goto __pyx_L4_argument_unpacking_done;
9698 __pyx_L5_argtuple_error:;
9699 __Pyx_RaiseArgtupleInvalid("seek", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
9701 __Pyx_AddTraceback("csamtools.Samfile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
9702 __Pyx_RefNannyFinishContext();
9704 __pyx_L4_argument_unpacking_done:;
9705 __pyx_r = __pyx_pf_9csamtools_7Samfile_16seek(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_offset, __pyx_v_where);
9706 __Pyx_RefNannyFinishContext();
9710 /* "csamtools.pyx":869
9711 * return self.seek( self.start_offset, 0 )
9713 * def seek( self, uint64_t offset, int where = 0): # <<<<<<<<<<<<<<
9715 * move file pointer to position *offset*, see :meth:`pysam.Samfile.tell`.
9718 static PyObject *__pyx_pf_9csamtools_7Samfile_16seek(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, uint64_t __pyx_v_offset, int __pyx_v_where) {
9719 PyObject *__pyx_r = NULL;
9720 __Pyx_RefNannyDeclarations
9721 PyObject *__pyx_t_1 = NULL;
9722 PyObject *__pyx_t_2 = NULL;
9725 int __pyx_lineno = 0;
9726 const char *__pyx_filename = NULL;
9727 int __pyx_clineno = 0;
9728 __Pyx_TraceDeclarations
9729 __Pyx_RefNannySetupContext("seek", 0);
9730 __Pyx_TraceCall("seek", __pyx_f[0], 869);
9732 /* "csamtools.pyx":874
9735 * if not self._isOpen(): # <<<<<<<<<<<<<<
9736 * raise ValueError( "I/O operation on closed file" )
9737 * if not self.isbam:
9739 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9740 __Pyx_GOTREF(__pyx_t_1);
9741 __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 = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9742 __Pyx_GOTREF(__pyx_t_2);
9743 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9744 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9745 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9746 __pyx_t_4 = (!__pyx_t_3);
9749 /* "csamtools.pyx":875
9751 * if not self._isOpen():
9752 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
9753 * if not self.isbam:
9754 * raise NotImplementedError("seek only available in bam files")
9756 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_47), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9757 __Pyx_GOTREF(__pyx_t_2);
9758 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
9759 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9760 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9765 /* "csamtools.pyx":876
9766 * if not self._isOpen():
9767 * raise ValueError( "I/O operation on closed file" )
9768 * if not self.isbam: # <<<<<<<<<<<<<<
9769 * raise NotImplementedError("seek only available in bam files")
9772 __pyx_t_4 = (!__pyx_v_self->isbam);
9775 /* "csamtools.pyx":877
9776 * raise ValueError( "I/O operation on closed file" )
9777 * if not self.isbam:
9778 * raise NotImplementedError("seek only available in bam files") # <<<<<<<<<<<<<<
9780 * raise OSError("seek no available in streams")
9782 __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9783 __Pyx_GOTREF(__pyx_t_2);
9784 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
9785 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9786 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9791 /* "csamtools.pyx":878
9792 * if not self.isbam:
9793 * raise NotImplementedError("seek only available in bam files")
9794 * if self.isstream: # <<<<<<<<<<<<<<
9795 * raise OSError("seek no available in streams")
9798 if (__pyx_v_self->isstream) {
9800 /* "csamtools.pyx":879
9801 * raise NotImplementedError("seek only available in bam files")
9803 * raise OSError("seek no available in streams") # <<<<<<<<<<<<<<
9805 * return bam_seek( self.samfile.x.bam, offset, where )
9807 __pyx_t_2 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9808 __Pyx_GOTREF(__pyx_t_2);
9809 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
9810 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9811 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9816 /* "csamtools.pyx":881
9817 * raise OSError("seek no available in streams")
9819 * return bam_seek( self.samfile.x.bam, offset, where ) # <<<<<<<<<<<<<<
9823 __Pyx_XDECREF(__pyx_r);
9824 __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(bam_seek(__pyx_v_self->samfile->x.bam, __pyx_v_offset, __pyx_v_where)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9825 __Pyx_GOTREF(__pyx_t_2);
9826 __pyx_r = __pyx_t_2;
9830 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9833 __Pyx_XDECREF(__pyx_t_1);
9834 __Pyx_XDECREF(__pyx_t_2);
9835 __Pyx_AddTraceback("csamtools.Samfile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
9838 __Pyx_XGIVEREF(__pyx_r);
9839 __Pyx_TraceReturn(__pyx_r);
9840 __Pyx_RefNannyFinishContext();
9844 /* Python wrapper */
9845 static PyObject *__pyx_pw_9csamtools_7Samfile_19tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
9846 static char __pyx_doc_9csamtools_7Samfile_18tell[] = "Samfile.tell(self)\n\n return current file position\n ";
9847 static PyObject *__pyx_pw_9csamtools_7Samfile_19tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9848 PyObject *__pyx_r = 0;
9849 __Pyx_RefNannyDeclarations
9850 __Pyx_RefNannySetupContext("tell (wrapper)", 0);
9851 __pyx_r = __pyx_pf_9csamtools_7Samfile_18tell(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
9852 __Pyx_RefNannyFinishContext();
9856 /* "csamtools.pyx":883
9857 * return bam_seek( self.samfile.x.bam, offset, where )
9859 * def tell( self ): # <<<<<<<<<<<<<<
9861 * return current file position
9864 static PyObject *__pyx_pf_9csamtools_7Samfile_18tell(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
9865 PyObject *__pyx_r = NULL;
9866 __Pyx_RefNannyDeclarations
9867 PyObject *__pyx_t_1 = NULL;
9868 PyObject *__pyx_t_2 = NULL;
9871 int __pyx_lineno = 0;
9872 const char *__pyx_filename = NULL;
9873 int __pyx_clineno = 0;
9874 __Pyx_TraceDeclarations
9875 __Pyx_RefNannySetupContext("tell", 0);
9876 __Pyx_TraceCall("tell", __pyx_f[0], 883);
9878 /* "csamtools.pyx":887
9879 * return current file position
9881 * if not self._isOpen(): # <<<<<<<<<<<<<<
9882 * raise ValueError( "I/O operation on closed file" )
9883 * if not self.isbam:
9885 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9886 __Pyx_GOTREF(__pyx_t_1);
9887 __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 = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9888 __Pyx_GOTREF(__pyx_t_2);
9889 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9890 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9891 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9892 __pyx_t_4 = (!__pyx_t_3);
9895 /* "csamtools.pyx":888
9897 * if not self._isOpen():
9898 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
9899 * if not self.isbam:
9900 * raise NotImplementedError("seek only available in bam files")
9902 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_52), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9903 __Pyx_GOTREF(__pyx_t_2);
9904 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
9905 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9906 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9911 /* "csamtools.pyx":889
9912 * if not self._isOpen():
9913 * raise ValueError( "I/O operation on closed file" )
9914 * if not self.isbam: # <<<<<<<<<<<<<<
9915 * raise NotImplementedError("seek only available in bam files")
9918 __pyx_t_4 = (!__pyx_v_self->isbam);
9921 /* "csamtools.pyx":890
9922 * raise ValueError( "I/O operation on closed file" )
9923 * if not self.isbam:
9924 * raise NotImplementedError("seek only available in bam files") # <<<<<<<<<<<<<<
9926 * return bam_tell( self.samfile.x.bam )
9928 __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9929 __Pyx_GOTREF(__pyx_t_2);
9930 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
9931 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9932 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9937 /* "csamtools.pyx":892
9938 * raise NotImplementedError("seek only available in bam files")
9940 * return bam_tell( self.samfile.x.bam ) # <<<<<<<<<<<<<<
9944 __Pyx_XDECREF(__pyx_r);
9945 __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(bam_tell(__pyx_v_self->samfile->x.bam)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9946 __Pyx_GOTREF(__pyx_t_2);
9947 __pyx_r = __pyx_t_2;
9951 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9954 __Pyx_XDECREF(__pyx_t_1);
9955 __Pyx_XDECREF(__pyx_t_2);
9956 __Pyx_AddTraceback("csamtools.Samfile.tell", __pyx_clineno, __pyx_lineno, __pyx_filename);
9959 __Pyx_XGIVEREF(__pyx_r);
9960 __Pyx_TraceReturn(__pyx_r);
9961 __Pyx_RefNannyFinishContext();
9965 /* Python wrapper */
9966 static PyObject *__pyx_pw_9csamtools_7Samfile_21fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9967 static char __pyx_doc_9csamtools_7Samfile_20fetch[] = "Samfile.fetch(self, reference=None, start=None, end=None, region=None, callback=None, until_eof=False)\n\n fetch aligned reads in a :term:`region` using 0-based indexing. The region is specified by\n :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can\n be supplied.\n\n Without *reference* or *region* all mapped reads will be fetched. The reads will be returned\n ordered by reference sequence, which will not necessarily be the order within the file.\n\n If *until_eof* is given, all reads from the current file position will be returned\n in order as they are within the file. Using this option will also fetch unmapped reads.\n\n If only *reference* is set, all reads aligned to *reference* will be fetched.\n\n The method returns an iterator of type :class:`pysam.IteratorRow` unless\n a *callback is provided. If *callback* is given, the callback will be executed\n for each position within the :term:`region`. Note that callbacks currently work\n only, if *region* or *reference* is given.\n\n Note that a :term:`SAM` file does not allow random access. If *region* or *reference* are given,\n an exception is raised.\n ";
9968 static PyObject *__pyx_pw_9csamtools_7Samfile_21fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9969 PyObject *__pyx_v_reference = 0;
9970 PyObject *__pyx_v_start = 0;
9971 PyObject *__pyx_v_end = 0;
9972 PyObject *__pyx_v_region = 0;
9973 PyObject *__pyx_v_callback = 0;
9974 PyObject *__pyx_v_until_eof = 0;
9975 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__callback,&__pyx_n_s__until_eof,0};
9976 PyObject *__pyx_r = 0;
9977 __Pyx_RefNannyDeclarations
9978 __Pyx_RefNannySetupContext("fetch (wrapper)", 0);
9980 PyObject* values[6] = {0,0,0,0,0,0};
9982 /* "csamtools.pyx":895
9985 * reference = None, # <<<<<<<<<<<<<<
9989 values[0] = ((PyObject *)Py_None);
9991 /* "csamtools.pyx":896
9994 * start = None, # <<<<<<<<<<<<<<
9998 values[1] = ((PyObject *)Py_None);
10000 /* "csamtools.pyx":897
10001 * reference = None,
10003 * end = None, # <<<<<<<<<<<<<<
10007 values[2] = ((PyObject *)Py_None);
10009 /* "csamtools.pyx":898
10012 * region = None, # <<<<<<<<<<<<<<
10014 * until_eof = False ):
10016 values[3] = ((PyObject *)Py_None);
10018 /* "csamtools.pyx":899
10021 * callback = None, # <<<<<<<<<<<<<<
10022 * until_eof = False ):
10025 values[4] = ((PyObject *)Py_None);
10026 values[5] = __pyx_k_54;
10027 if (unlikely(__pyx_kwds)) {
10028 Py_ssize_t kw_args;
10029 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10030 switch (pos_args) {
10031 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
10032 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
10033 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10034 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10035 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10036 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10038 default: goto __pyx_L5_argtuple_error;
10040 kw_args = PyDict_Size(__pyx_kwds);
10041 switch (pos_args) {
10044 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
10045 if (value) { values[0] = value; kw_args--; }
10049 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
10050 if (value) { values[1] = value; kw_args--; }
10054 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
10055 if (value) { values[2] = value; kw_args--; }
10059 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region);
10060 if (value) { values[3] = value; kw_args--; }
10064 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback);
10065 if (value) { values[4] = value; kw_args--; }
10069 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__until_eof);
10070 if (value) { values[5] = value; kw_args--; }
10073 if (unlikely(kw_args > 0)) {
10074 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10077 switch (PyTuple_GET_SIZE(__pyx_args)) {
10078 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
10079 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
10080 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10081 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10082 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10083 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10085 default: goto __pyx_L5_argtuple_error;
10088 __pyx_v_reference = values[0];
10089 __pyx_v_start = values[1];
10090 __pyx_v_end = values[2];
10091 __pyx_v_region = values[3];
10092 __pyx_v_callback = values[4];
10093 __pyx_v_until_eof = values[5];
10095 goto __pyx_L4_argument_unpacking_done;
10096 __pyx_L5_argtuple_error:;
10097 __Pyx_RaiseArgtupleInvalid("fetch", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10099 __Pyx_AddTraceback("csamtools.Samfile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
10100 __Pyx_RefNannyFinishContext();
10102 __pyx_L4_argument_unpacking_done:;
10103 __pyx_r = __pyx_pf_9csamtools_7Samfile_20fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region, __pyx_v_callback, __pyx_v_until_eof);
10104 __Pyx_RefNannyFinishContext();
10108 /* "csamtools.pyx":894
10109 * return bam_tell( self.samfile.x.bam )
10111 * def fetch( self, # <<<<<<<<<<<<<<
10112 * reference = None,
10116 static PyObject *__pyx_pf_9csamtools_7Samfile_20fetch(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region, PyObject *__pyx_v_callback, PyObject *__pyx_v_until_eof) {
10118 int __pyx_v_rstart;
10120 int __pyx_v_has_coord;
10121 int __pyx_v_reopen;
10122 PyObject *__pyx_r = NULL;
10123 __Pyx_RefNannyDeclarations
10124 PyObject *__pyx_t_1 = NULL;
10125 PyObject *__pyx_t_2 = NULL;
10128 PyObject *__pyx_t_5 = NULL;
10129 PyObject *__pyx_t_6 = NULL;
10130 PyObject *__pyx_t_7 = NULL;
10131 PyObject *__pyx_t_8 = NULL;
10132 PyObject *(*__pyx_t_9)(PyObject *);
10139 int __pyx_lineno = 0;
10140 const char *__pyx_filename = NULL;
10141 int __pyx_clineno = 0;
10142 __Pyx_TraceDeclarations
10143 __Pyx_RefNannySetupContext("fetch", 0);
10144 __Pyx_TraceCall("fetch", __pyx_f[0], 894);
10146 /* "csamtools.pyx":924
10147 * cdef int rtid, rstart, rend, has_coord
10149 * if not self._isOpen(): # <<<<<<<<<<<<<<
10150 * raise ValueError( "I/O operation on closed file" )
10153 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10154 __Pyx_GOTREF(__pyx_t_1);
10155 __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 = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10156 __Pyx_GOTREF(__pyx_t_2);
10157 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10158 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10159 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10160 __pyx_t_4 = (!__pyx_t_3);
10163 /* "csamtools.pyx":925
10165 * if not self._isOpen():
10166 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
10168 * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
10170 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10171 __Pyx_GOTREF(__pyx_t_2);
10172 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
10173 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10174 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10179 /* "csamtools.pyx":927
10180 * raise ValueError( "I/O operation on closed file" )
10182 * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) # <<<<<<<<<<<<<<
10184 * if self.isstream: reopen = False
10186 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10187 __Pyx_GOTREF(__pyx_t_2);
10188 __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10189 __Pyx_GOTREF(__pyx_t_1);
10190 __Pyx_INCREF(__pyx_v_reference);
10191 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference);
10192 __Pyx_GIVEREF(__pyx_v_reference);
10193 __Pyx_INCREF(__pyx_v_start);
10194 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start);
10195 __Pyx_GIVEREF(__pyx_v_start);
10196 __Pyx_INCREF(__pyx_v_end);
10197 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end);
10198 __Pyx_GIVEREF(__pyx_v_end);
10199 __Pyx_INCREF(__pyx_v_region);
10200 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_region);
10201 __Pyx_GIVEREF(__pyx_v_region);
10202 __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10203 __Pyx_GOTREF(__pyx_t_5);
10204 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10205 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
10206 if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
10207 PyObject* sequence = __pyx_t_5;
10208 if (likely(PyTuple_CheckExact(sequence))) {
10209 if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) {
10210 if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
10211 else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
10212 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10214 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
10215 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
10216 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2);
10217 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 3);
10219 if (unlikely(PyList_GET_SIZE(sequence) != 4)) {
10220 if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
10221 else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
10222 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10224 __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
10225 __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
10226 __pyx_t_6 = PyList_GET_ITEM(sequence, 2);
10227 __pyx_t_7 = PyList_GET_ITEM(sequence, 3);
10229 __Pyx_INCREF(__pyx_t_1);
10230 __Pyx_INCREF(__pyx_t_2);
10231 __Pyx_INCREF(__pyx_t_6);
10232 __Pyx_INCREF(__pyx_t_7);
10233 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10235 Py_ssize_t index = -1;
10236 __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10237 __Pyx_GOTREF(__pyx_t_8);
10238 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10239 __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
10240 index = 0; __pyx_t_1 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
10241 __Pyx_GOTREF(__pyx_t_1);
10242 index = 1; __pyx_t_2 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
10243 __Pyx_GOTREF(__pyx_t_2);
10244 index = 2; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed;
10245 __Pyx_GOTREF(__pyx_t_6);
10246 index = 3; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L4_unpacking_failed;
10247 __Pyx_GOTREF(__pyx_t_7);
10248 if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10249 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10250 goto __pyx_L5_unpacking_done;
10251 __pyx_L4_unpacking_failed:;
10252 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10253 if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
10254 if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
10255 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10256 __pyx_L5_unpacking_done:;
10258 __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10259 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10260 __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10261 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10262 __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10263 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10264 __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10265 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10266 __pyx_v_has_coord = __pyx_t_10;
10267 __pyx_v_rtid = __pyx_t_11;
10268 __pyx_v_rstart = __pyx_t_12;
10269 __pyx_v_rend = __pyx_t_13;
10271 /* "csamtools.pyx":929
10272 * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
10274 * if self.isstream: reopen = False # <<<<<<<<<<<<<<
10275 * else: reopen = True
10278 if (__pyx_v_self->isstream) {
10279 __pyx_v_reopen = 0;
10284 /* "csamtools.pyx":930
10286 * if self.isstream: reopen = False
10287 * else: reopen = True # <<<<<<<<<<<<<<
10291 __pyx_v_reopen = 1;
10295 /* "csamtools.pyx":932
10296 * else: reopen = True
10298 * if self.isbam: # <<<<<<<<<<<<<<
10299 * if not until_eof and not self._hasIndex() and not self.isremote:
10300 * raise ValueError( "fetch called on bamfile without index" )
10302 if (__pyx_v_self->isbam) {
10304 /* "csamtools.pyx":933
10307 * if not until_eof and not self._hasIndex() and not self.isremote: # <<<<<<<<<<<<<<
10308 * raise ValueError( "fetch called on bamfile without index" )
10311 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_until_eof); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10312 __pyx_t_3 = (!__pyx_t_4);
10314 __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10315 __Pyx_GOTREF(__pyx_t_5);
10316 __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10317 __Pyx_GOTREF(__pyx_t_7);
10318 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10319 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10320 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10321 __pyx_t_14 = (!__pyx_t_4);
10323 __pyx_t_4 = (!__pyx_v_self->isremote);
10324 __pyx_t_15 = __pyx_t_4;
10326 __pyx_t_15 = __pyx_t_14;
10328 __pyx_t_14 = __pyx_t_15;
10330 __pyx_t_14 = __pyx_t_3;
10334 /* "csamtools.pyx":934
10336 * if not until_eof and not self._hasIndex() and not self.isremote:
10337 * raise ValueError( "fetch called on bamfile without index" ) # <<<<<<<<<<<<<<
10341 __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_57), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10342 __Pyx_GOTREF(__pyx_t_7);
10343 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
10344 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10345 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10350 /* "csamtools.pyx":936
10351 * raise ValueError( "fetch called on bamfile without index" )
10353 * if callback: # <<<<<<<<<<<<<<
10354 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
10355 * if not self._hasIndex(): raise ValueError( "no index available for fetch" )
10357 __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_callback); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10360 /* "csamtools.pyx":937
10363 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) # <<<<<<<<<<<<<<
10364 * if not self._hasIndex(): raise ValueError( "no index available for fetch" )
10365 * return bam_fetch(self.samfile.x.bam,
10367 __pyx_t_14 = (!__pyx_v_has_coord);
10369 __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10370 __Pyx_GOTREF(__pyx_t_7);
10371 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
10372 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10373 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10378 /* "csamtools.pyx":938
10380 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
10381 * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) # <<<<<<<<<<<<<<
10382 * return bam_fetch(self.samfile.x.bam,
10385 __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10386 __Pyx_GOTREF(__pyx_t_7);
10387 __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10388 __Pyx_GOTREF(__pyx_t_5);
10389 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10390 __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10391 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10392 __pyx_t_3 = (!__pyx_t_14);
10394 __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10395 __Pyx_GOTREF(__pyx_t_5);
10396 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
10397 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10398 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10403 /* "csamtools.pyx":939
10404 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
10405 * if not self._hasIndex(): raise ValueError( "no index available for fetch" )
10406 * return bam_fetch(self.samfile.x.bam, # <<<<<<<<<<<<<<
10410 __Pyx_XDECREF(__pyx_r);
10412 /* "csamtools.pyx":945
10415 * fetch_callback ) # <<<<<<<<<<<<<<
10419 __pyx_t_5 = PyInt_FromLong(bam_fetch(__pyx_v_self->samfile->x.bam, __pyx_v_self->index, __pyx_v_rtid, __pyx_v_rstart, __pyx_v_rend, ((void *)__pyx_v_callback), __pyx_f_9csamtools_fetch_callback)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10420 __Pyx_GOTREF(__pyx_t_5);
10421 __pyx_r = __pyx_t_5;
10428 /* "csamtools.pyx":947
10431 * if has_coord: # <<<<<<<<<<<<<<
10432 * return IteratorRowRegion( self, rtid, rstart, rend, reopen=reopen )
10435 if (__pyx_v_has_coord) {
10437 /* "csamtools.pyx":948
10440 * return IteratorRowRegion( self, rtid, rstart, rend, reopen=reopen ) # <<<<<<<<<<<<<<
10444 __Pyx_XDECREF(__pyx_r);
10445 __pyx_t_5 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10446 __Pyx_GOTREF(__pyx_t_5);
10447 __pyx_t_7 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10448 __Pyx_GOTREF(__pyx_t_7);
10449 __pyx_t_6 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10450 __Pyx_GOTREF(__pyx_t_6);
10451 __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10452 __Pyx_GOTREF(__pyx_t_2);
10453 __Pyx_INCREF(((PyObject *)__pyx_v_self));
10454 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
10455 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
10456 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
10457 __Pyx_GIVEREF(__pyx_t_5);
10458 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_7);
10459 __Pyx_GIVEREF(__pyx_t_7);
10460 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_6);
10461 __Pyx_GIVEREF(__pyx_t_6);
10465 __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10466 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
10467 __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10468 __Pyx_GOTREF(__pyx_t_7);
10469 if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__reopen), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10470 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10471 __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10472 __Pyx_GOTREF(__pyx_t_7);
10473 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
10474 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
10475 __pyx_r = __pyx_t_7;
10482 /* "csamtools.pyx":950
10483 * return IteratorRowRegion( self, rtid, rstart, rend, reopen=reopen )
10485 * if until_eof: # <<<<<<<<<<<<<<
10486 * return IteratorRowAll( self, reopen=reopen )
10489 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_until_eof); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10492 /* "csamtools.pyx":951
10495 * return IteratorRowAll( self, reopen=reopen ) # <<<<<<<<<<<<<<
10497 * # AH: check - reason why no reopen for AllRefs?
10499 __Pyx_XDECREF(__pyx_r);
10500 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10501 __Pyx_GOTREF(__pyx_t_7);
10502 __Pyx_INCREF(((PyObject *)__pyx_v_self));
10503 PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_self));
10504 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
10505 __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10506 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
10507 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10508 __Pyx_GOTREF(__pyx_t_2);
10509 if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__reopen), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10510 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10511 __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowAll)), ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10512 __Pyx_GOTREF(__pyx_t_2);
10513 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
10514 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
10515 __pyx_r = __pyx_t_2;
10522 /* "csamtools.pyx":954
10524 * # AH: check - reason why no reopen for AllRefs?
10525 * return IteratorRowAllRefs(self ) # , reopen=reopen ) # <<<<<<<<<<<<<<
10529 __Pyx_XDECREF(__pyx_r);
10530 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10531 __Pyx_GOTREF(__pyx_t_2);
10532 __Pyx_INCREF(((PyObject *)__pyx_v_self));
10533 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
10534 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
10535 __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowAllRefs)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10536 __Pyx_GOTREF(__pyx_t_6);
10537 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
10538 __pyx_r = __pyx_t_6;
10551 /* "csamtools.pyx":956
10552 * return IteratorRowAllRefs(self ) # , reopen=reopen )
10554 * if has_coord: # <<<<<<<<<<<<<<
10555 * raise ValueError ("fetching by region is not available for sam files" )
10558 if (__pyx_v_has_coord) {
10560 /* "csamtools.pyx":957
10563 * raise ValueError ("fetching by region is not available for sam files" ) # <<<<<<<<<<<<<<
10567 __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_63), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10568 __Pyx_GOTREF(__pyx_t_6);
10569 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
10570 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10571 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10576 /* "csamtools.pyx":959
10577 * raise ValueError ("fetching by region is not available for sam files" )
10579 * if callback: # <<<<<<<<<<<<<<
10580 * raise NotImplementedError( "callback not implemented yet" )
10583 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_callback); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10586 /* "csamtools.pyx":960
10589 * raise NotImplementedError( "callback not implemented yet" ) # <<<<<<<<<<<<<<
10591 * if self.samfile.header == NULL:
10593 __pyx_t_6 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_65), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10594 __Pyx_GOTREF(__pyx_t_6);
10595 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
10596 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10597 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10602 /* "csamtools.pyx":962
10603 * raise NotImplementedError( "callback not implemented yet" )
10605 * if self.samfile.header == NULL: # <<<<<<<<<<<<<<
10606 * raise ValueError( "fetch called for samfile without header")
10609 __pyx_t_3 = (__pyx_v_self->samfile->header == NULL);
10612 /* "csamtools.pyx":963
10614 * if self.samfile.header == NULL:
10615 * raise ValueError( "fetch called for samfile without header") # <<<<<<<<<<<<<<
10617 * # check if targets are defined
10619 __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_67), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10620 __Pyx_GOTREF(__pyx_t_6);
10621 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
10622 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10623 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10628 /* "csamtools.pyx":967
10629 * # check if targets are defined
10630 * # give warning, sam_read1 segfaults
10631 * if self.samfile.header.n_targets == 0: # <<<<<<<<<<<<<<
10632 * warnings.warn( "fetch called for samfile without header")
10635 __pyx_t_3 = (__pyx_v_self->samfile->header->n_targets == 0);
10638 /* "csamtools.pyx":968
10639 * # give warning, sam_read1 segfaults
10640 * if self.samfile.header.n_targets == 0:
10641 * warnings.warn( "fetch called for samfile without header") # <<<<<<<<<<<<<<
10643 * return IteratorRowAll( self, reopen=reopen )
10645 __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10646 __Pyx_GOTREF(__pyx_t_6);
10647 __pyx_t_2 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__warn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10648 __Pyx_GOTREF(__pyx_t_2);
10649 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10650 __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_68), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10651 __Pyx_GOTREF(__pyx_t_6);
10652 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10653 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10658 /* "csamtools.pyx":970
10659 * warnings.warn( "fetch called for samfile without header")
10661 * return IteratorRowAll( self, reopen=reopen ) # <<<<<<<<<<<<<<
10665 __Pyx_XDECREF(__pyx_r);
10666 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10667 __Pyx_GOTREF(__pyx_t_6);
10668 __Pyx_INCREF(((PyObject *)__pyx_v_self));
10669 PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_self));
10670 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
10671 __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10672 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
10673 __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10674 __Pyx_GOTREF(__pyx_t_7);
10675 if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reopen), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10676 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10677 __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowAll)), ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10678 __Pyx_GOTREF(__pyx_t_7);
10679 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
10680 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
10681 __pyx_r = __pyx_t_7;
10687 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10690 __Pyx_XDECREF(__pyx_t_1);
10691 __Pyx_XDECREF(__pyx_t_2);
10692 __Pyx_XDECREF(__pyx_t_5);
10693 __Pyx_XDECREF(__pyx_t_6);
10694 __Pyx_XDECREF(__pyx_t_7);
10695 __Pyx_XDECREF(__pyx_t_8);
10696 __Pyx_AddTraceback("csamtools.Samfile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
10699 __Pyx_XGIVEREF(__pyx_r);
10700 __Pyx_TraceReturn(__pyx_r);
10701 __Pyx_RefNannyFinishContext();
10705 /* Python wrapper */
10706 static PyObject *__pyx_pw_9csamtools_7Samfile_23mate(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
10707 static char __pyx_doc_9csamtools_7Samfile_22mate[] = "Samfile.mate(self, AlignedRead read)\nreturn the mate of :class:`AlignedRead` *read*.\n\n Throws a ValueError if read is unpaired or the mate\n is unmapped.\n\n .. note::\n Calling this method will change the file position.\n This might interfere with any iterators that have\n not re-opened the file.\n\n ";
10708 static PyObject *__pyx_pw_9csamtools_7Samfile_23mate(PyObject *__pyx_v_self, PyObject *__pyx_v_read) {
10709 PyObject *__pyx_r = 0;
10710 __Pyx_RefNannyDeclarations
10711 __Pyx_RefNannySetupContext("mate (wrapper)", 0);
10712 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_read), __pyx_ptype_9csamtools_AlignedRead, 1, "read", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10713 __pyx_r = __pyx_pf_9csamtools_7Samfile_22mate(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read));
10718 __Pyx_RefNannyFinishContext();
10722 /* "csamtools.pyx":972
10723 * return IteratorRowAll( self, reopen=reopen )
10725 * def mate( self, # <<<<<<<<<<<<<<
10726 * AlignedRead read ):
10727 * '''return the mate of :class:`AlignedRead` *read*.
10730 static PyObject *__pyx_pf_9csamtools_7Samfile_22mate(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_read) {
10731 uint32_t __pyx_v_flag;
10732 __pyx_t_9csamtools_MateData __pyx_v_mate_data;
10734 struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_dest = 0;
10735 PyObject *__pyx_r = NULL;
10736 __Pyx_RefNannyDeclarations
10738 PyObject *__pyx_t_2 = NULL;
10739 PyObject *__pyx_t_3 = NULL;
10740 int __pyx_lineno = 0;
10741 const char *__pyx_filename = NULL;
10742 int __pyx_clineno = 0;
10743 __Pyx_TraceDeclarations
10744 __Pyx_RefNannySetupContext("mate", 0);
10745 __Pyx_TraceCall("mate", __pyx_f[0], 972);
10747 /* "csamtools.pyx":985
10750 * cdef uint32_t flag = read._delegate.core.flag # <<<<<<<<<<<<<<
10752 * if flag & BAM_FPAIRED == 0:
10754 __pyx_v_flag = __pyx_v_read->_delegate->core.flag;
10756 /* "csamtools.pyx":987
10757 * cdef uint32_t flag = read._delegate.core.flag
10759 * if flag & BAM_FPAIRED == 0: # <<<<<<<<<<<<<<
10760 * raise ValueError( "read %s: is unpaired" % (read.qname))
10761 * if flag & BAM_FMUNMAP != 0:
10763 __pyx_t_1 = ((__pyx_v_flag & 1) == 0);
10766 /* "csamtools.pyx":988
10768 * if flag & BAM_FPAIRED == 0:
10769 * raise ValueError( "read %s: is unpaired" % (read.qname)) # <<<<<<<<<<<<<<
10770 * if flag & BAM_FMUNMAP != 0:
10771 * raise ValueError( "mate %s: is unmapped" % (read.qname))
10773 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_read), __pyx_n_s__qname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10774 __Pyx_GOTREF(__pyx_t_2);
10775 __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_69), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10776 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
10777 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10778 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10779 __Pyx_GOTREF(__pyx_t_2);
10780 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
10781 __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
10783 __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10784 __Pyx_GOTREF(__pyx_t_3);
10785 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
10786 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
10787 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10788 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10793 /* "csamtools.pyx":989
10794 * if flag & BAM_FPAIRED == 0:
10795 * raise ValueError( "read %s: is unpaired" % (read.qname))
10796 * if flag & BAM_FMUNMAP != 0: # <<<<<<<<<<<<<<
10797 * raise ValueError( "mate %s: is unmapped" % (read.qname))
10800 __pyx_t_1 = ((__pyx_v_flag & 8) != 0);
10803 /* "csamtools.pyx":990
10804 * raise ValueError( "read %s: is unpaired" % (read.qname))
10805 * if flag & BAM_FMUNMAP != 0:
10806 * raise ValueError( "mate %s: is unmapped" % (read.qname)) # <<<<<<<<<<<<<<
10808 * cdef MateData mate_data
10810 __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_read), __pyx_n_s__qname); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10811 __Pyx_GOTREF(__pyx_t_3);
10812 __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_70), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10813 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
10814 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10815 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10816 __Pyx_GOTREF(__pyx_t_3);
10817 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
10818 __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
10820 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10821 __Pyx_GOTREF(__pyx_t_2);
10822 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
10823 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
10824 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10825 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10830 /* "csamtools.pyx":994
10831 * cdef MateData mate_data
10833 * mate_data.name = <char *>bam1_qname(read._delegate) # <<<<<<<<<<<<<<
10834 * mate_data.mate = NULL
10835 * # xor flags to get the other mate
10837 __pyx_v_mate_data.name = ((char *)bam1_qname(__pyx_v_read->_delegate));
10839 /* "csamtools.pyx":995
10841 * mate_data.name = <char *>bam1_qname(read._delegate)
10842 * mate_data.mate = NULL # <<<<<<<<<<<<<<
10843 * # xor flags to get the other mate
10844 * cdef int x = BAM_FREAD1 + BAM_FREAD2
10846 __pyx_v_mate_data.mate = NULL;
10848 /* "csamtools.pyx":997
10849 * mate_data.mate = NULL
10850 * # xor flags to get the other mate
10851 * cdef int x = BAM_FREAD1 + BAM_FREAD2 # <<<<<<<<<<<<<<
10852 * mate_data.flag = ( flag ^ x) & x
10857 /* "csamtools.pyx":998
10858 * # xor flags to get the other mate
10859 * cdef int x = BAM_FREAD1 + BAM_FREAD2
10860 * mate_data.flag = ( flag ^ x) & x # <<<<<<<<<<<<<<
10862 * bam_fetch(self.samfile.x.bam,
10864 __pyx_v_mate_data.flag = ((__pyx_v_flag ^ __pyx_v_x) & __pyx_v_x);
10866 /* "csamtools.pyx":1006
10867 * read._delegate.core.mpos + 1,
10868 * <void*>&mate_data,
10869 * mate_callback ) # <<<<<<<<<<<<<<
10871 * if mate_data.mate == NULL:
10873 bam_fetch(__pyx_v_self->samfile->x.bam, __pyx_v_self->index, __pyx_v_read->_delegate->core.mtid, __pyx_v_read->_delegate->core.mpos, (__pyx_v_read->_delegate->core.mpos + 1), ((void *)(&__pyx_v_mate_data)), __pyx_f_9csamtools_mate_callback);
10875 /* "csamtools.pyx":1008
10878 * if mate_data.mate == NULL: # <<<<<<<<<<<<<<
10879 * raise ValueError( "mate not found" )
10882 __pyx_t_1 = (__pyx_v_mate_data.mate == NULL);
10885 /* "csamtools.pyx":1009
10887 * if mate_data.mate == NULL:
10888 * raise ValueError( "mate not found" ) # <<<<<<<<<<<<<<
10890 * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
10892 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_72), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10893 __Pyx_GOTREF(__pyx_t_2);
10894 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
10895 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10896 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10901 /* "csamtools.pyx":1011
10902 * raise ValueError( "mate not found" )
10904 * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead) # <<<<<<<<<<<<<<
10905 * dest._delegate = mate_data.mate
10908 __pyx_t_2 = __Pyx_tp_new(((PyObject*)__pyx_ptype_9csamtools_AlignedRead)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10909 __Pyx_GOTREF(__pyx_t_2);
10910 if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9csamtools_AlignedRead)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10911 __pyx_v_dest = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_t_2);
10914 /* "csamtools.pyx":1012
10916 * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
10917 * dest._delegate = mate_data.mate # <<<<<<<<<<<<<<
10921 __pyx_v_dest->_delegate = __pyx_v_mate_data.mate;
10923 /* "csamtools.pyx":1013
10924 * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
10925 * dest._delegate = mate_data.mate
10926 * return dest # <<<<<<<<<<<<<<
10930 __Pyx_XDECREF(__pyx_r);
10931 __Pyx_INCREF(((PyObject *)__pyx_v_dest));
10932 __pyx_r = ((PyObject *)__pyx_v_dest);
10935 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10938 __Pyx_XDECREF(__pyx_t_2);
10939 __Pyx_XDECREF(__pyx_t_3);
10940 __Pyx_AddTraceback("csamtools.Samfile.mate", __pyx_clineno, __pyx_lineno, __pyx_filename);
10943 __Pyx_XDECREF((PyObject *)__pyx_v_dest);
10944 __Pyx_XGIVEREF(__pyx_r);
10945 __Pyx_TraceReturn(__pyx_r);
10946 __Pyx_RefNannyFinishContext();
10950 /* Python wrapper */
10951 static PyObject *__pyx_pw_9csamtools_7Samfile_25count(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
10952 static char __pyx_doc_9csamtools_7Samfile_24count[] = "Samfile.count(self, reference=None, start=None, end=None, region=None, until_eof=False)\n*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)*\n\n count reads :term:`region` using 0-based indexing. The region is specified by\n :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can be supplied.\n\n Note that a :term:`TAM` file does not allow random access. If *region* or *reference* are given,\n an exception is raised.\n ";
10953 static PyObject *__pyx_pw_9csamtools_7Samfile_25count(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10954 PyObject *__pyx_v_reference = 0;
10955 PyObject *__pyx_v_start = 0;
10956 PyObject *__pyx_v_end = 0;
10957 PyObject *__pyx_v_region = 0;
10958 PyObject *__pyx_v_until_eof = 0;
10959 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__until_eof,0};
10960 PyObject *__pyx_r = 0;
10961 __Pyx_RefNannyDeclarations
10962 __Pyx_RefNannySetupContext("count (wrapper)", 0);
10964 PyObject* values[5] = {0,0,0,0,0};
10966 /* "csamtools.pyx":1016
10969 * reference = None, # <<<<<<<<<<<<<<
10973 values[0] = ((PyObject *)Py_None);
10975 /* "csamtools.pyx":1017
10977 * reference = None,
10978 * start = None, # <<<<<<<<<<<<<<
10982 values[1] = ((PyObject *)Py_None);
10984 /* "csamtools.pyx":1018
10985 * reference = None,
10987 * end = None, # <<<<<<<<<<<<<<
10989 * until_eof = False ):
10991 values[2] = ((PyObject *)Py_None);
10993 /* "csamtools.pyx":1019
10996 * region = None, # <<<<<<<<<<<<<<
10997 * until_eof = False ):
10998 * '''*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)*
11000 values[3] = ((PyObject *)Py_None);
11001 values[4] = __pyx_k_73;
11002 if (unlikely(__pyx_kwds)) {
11003 Py_ssize_t kw_args;
11004 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11005 switch (pos_args) {
11006 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11007 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11008 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11009 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11010 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11012 default: goto __pyx_L5_argtuple_error;
11014 kw_args = PyDict_Size(__pyx_kwds);
11015 switch (pos_args) {
11018 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
11019 if (value) { values[0] = value; kw_args--; }
11023 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
11024 if (value) { values[1] = value; kw_args--; }
11028 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
11029 if (value) { values[2] = value; kw_args--; }
11033 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region);
11034 if (value) { values[3] = value; kw_args--; }
11038 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__until_eof);
11039 if (value) { values[4] = value; kw_args--; }
11042 if (unlikely(kw_args > 0)) {
11043 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "count") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
11046 switch (PyTuple_GET_SIZE(__pyx_args)) {
11047 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11048 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11049 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11050 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11051 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11053 default: goto __pyx_L5_argtuple_error;
11056 __pyx_v_reference = values[0];
11057 __pyx_v_start = values[1];
11058 __pyx_v_end = values[2];
11059 __pyx_v_region = values[3];
11060 __pyx_v_until_eof = values[4];
11062 goto __pyx_L4_argument_unpacking_done;
11063 __pyx_L5_argtuple_error:;
11064 __Pyx_RaiseArgtupleInvalid("count", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
11066 __Pyx_AddTraceback("csamtools.Samfile.count", __pyx_clineno, __pyx_lineno, __pyx_filename);
11067 __Pyx_RefNannyFinishContext();
11069 __pyx_L4_argument_unpacking_done:;
11070 __pyx_r = __pyx_pf_9csamtools_7Samfile_24count(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region, __pyx_v_until_eof);
11071 __Pyx_RefNannyFinishContext();
11075 /* "csamtools.pyx":1015
11078 * def count( self, # <<<<<<<<<<<<<<
11079 * reference = None,
11083 static PyObject *__pyx_pf_9csamtools_7Samfile_24count(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region, PyObject *__pyx_v_until_eof) {
11085 int __pyx_v_rstart;
11087 int __pyx_v_counter;
11088 PyObject *__pyx_r = NULL;
11089 __Pyx_RefNannyDeclarations
11090 PyObject *__pyx_t_1 = NULL;
11091 PyObject *__pyx_t_2 = NULL;
11094 PyObject *__pyx_t_5 = NULL;
11095 PyObject *__pyx_t_6 = NULL;
11096 PyObject *__pyx_t_7 = NULL;
11097 PyObject *__pyx_t_8 = NULL;
11098 PyObject *(*__pyx_t_9)(PyObject *);
11104 int __pyx_lineno = 0;
11105 const char *__pyx_filename = NULL;
11106 int __pyx_clineno = 0;
11107 __Pyx_TraceDeclarations
11108 __Pyx_RefNannySetupContext("count", 0);
11109 __Pyx_TraceCall("count", __pyx_f[0], 1015);
11110 __Pyx_INCREF(__pyx_v_region);
11112 /* "csamtools.pyx":1033
11115 * if not self._isOpen(): # <<<<<<<<<<<<<<
11116 * raise ValueError( "I/O operation on closed file" )
11119 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11120 __Pyx_GOTREF(__pyx_t_1);
11121 __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 = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11122 __Pyx_GOTREF(__pyx_t_2);
11123 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11124 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11125 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11126 __pyx_t_4 = (!__pyx_t_3);
11129 /* "csamtools.pyx":1034
11131 * if not self._isOpen():
11132 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
11134 * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
11136 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_74), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11137 __Pyx_GOTREF(__pyx_t_2);
11138 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
11139 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11140 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11145 /* "csamtools.pyx":1036
11146 * raise ValueError( "I/O operation on closed file" )
11148 * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) # <<<<<<<<<<<<<<
11152 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11153 __Pyx_GOTREF(__pyx_t_2);
11154 __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11155 __Pyx_GOTREF(__pyx_t_1);
11156 __Pyx_INCREF(__pyx_v_reference);
11157 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference);
11158 __Pyx_GIVEREF(__pyx_v_reference);
11159 __Pyx_INCREF(__pyx_v_start);
11160 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start);
11161 __Pyx_GIVEREF(__pyx_v_start);
11162 __Pyx_INCREF(__pyx_v_end);
11163 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end);
11164 __Pyx_GIVEREF(__pyx_v_end);
11165 __Pyx_INCREF(__pyx_v_region);
11166 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_region);
11167 __Pyx_GIVEREF(__pyx_v_region);
11168 __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11169 __Pyx_GOTREF(__pyx_t_5);
11170 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11171 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
11172 if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
11173 PyObject* sequence = __pyx_t_5;
11174 if (likely(PyTuple_CheckExact(sequence))) {
11175 if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) {
11176 if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
11177 else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
11178 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11180 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
11181 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
11182 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2);
11183 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 3);
11185 if (unlikely(PyList_GET_SIZE(sequence) != 4)) {
11186 if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
11187 else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
11188 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11190 __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
11191 __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
11192 __pyx_t_6 = PyList_GET_ITEM(sequence, 2);
11193 __pyx_t_7 = PyList_GET_ITEM(sequence, 3);
11195 __Pyx_INCREF(__pyx_t_1);
11196 __Pyx_INCREF(__pyx_t_2);
11197 __Pyx_INCREF(__pyx_t_6);
11198 __Pyx_INCREF(__pyx_t_7);
11199 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11201 Py_ssize_t index = -1;
11202 __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11203 __Pyx_GOTREF(__pyx_t_8);
11204 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11205 __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
11206 index = 0; __pyx_t_1 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
11207 __Pyx_GOTREF(__pyx_t_1);
11208 index = 1; __pyx_t_2 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
11209 __Pyx_GOTREF(__pyx_t_2);
11210 index = 2; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed;
11211 __Pyx_GOTREF(__pyx_t_6);
11212 index = 3; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L4_unpacking_failed;
11213 __Pyx_GOTREF(__pyx_t_7);
11214 if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11215 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11216 goto __pyx_L5_unpacking_done;
11217 __pyx_L4_unpacking_failed:;
11218 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11219 if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
11220 if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
11221 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11222 __pyx_L5_unpacking_done:;
11224 __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11225 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11226 __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11227 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11228 __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11229 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11230 __Pyx_DECREF(__pyx_v_region);
11231 __pyx_v_region = __pyx_t_1;
11233 __pyx_v_rtid = __pyx_t_10;
11234 __pyx_v_rstart = __pyx_t_11;
11235 __pyx_v_rend = __pyx_t_12;
11237 /* "csamtools.pyx":1039
11240 * counter = 0; # <<<<<<<<<<<<<<
11244 __pyx_v_counter = 0;
11246 /* "csamtools.pyx":1041
11249 * if self.isbam: # <<<<<<<<<<<<<<
11250 * if not until_eof and not self._hasIndex() and not self.isremote:
11251 * raise ValueError( "fetch called on bamfile without index" )
11253 if (__pyx_v_self->isbam) {
11255 /* "csamtools.pyx":1042
11258 * if not until_eof and not self._hasIndex() and not self.isremote: # <<<<<<<<<<<<<<
11259 * raise ValueError( "fetch called on bamfile without index" )
11262 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_until_eof); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11263 __pyx_t_3 = (!__pyx_t_4);
11265 __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11266 __Pyx_GOTREF(__pyx_t_5);
11267 __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11268 __Pyx_GOTREF(__pyx_t_7);
11269 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11270 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11271 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11272 __pyx_t_13 = (!__pyx_t_4);
11274 __pyx_t_4 = (!__pyx_v_self->isremote);
11275 __pyx_t_14 = __pyx_t_4;
11277 __pyx_t_14 = __pyx_t_13;
11279 __pyx_t_13 = __pyx_t_14;
11281 __pyx_t_13 = __pyx_t_3;
11285 /* "csamtools.pyx":1043
11287 * if not until_eof and not self._hasIndex() and not self.isremote:
11288 * raise ValueError( "fetch called on bamfile without index" ) # <<<<<<<<<<<<<<
11292 __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_75), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11293 __Pyx_GOTREF(__pyx_t_7);
11294 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
11295 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11296 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11301 /* "csamtools.pyx":1045
11302 * raise ValueError( "fetch called on bamfile without index" )
11304 * if not region: # <<<<<<<<<<<<<<
11305 * raise ValueError( "counting functionality requires a region/reference" )
11306 * if not self._hasIndex(): raise ValueError( "no index available for fetch" )
11308 __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11309 __pyx_t_3 = (!__pyx_t_13);
11312 /* "csamtools.pyx":1046
11315 * raise ValueError( "counting functionality requires a region/reference" ) # <<<<<<<<<<<<<<
11316 * if not self._hasIndex(): raise ValueError( "no index available for fetch" )
11317 * bam_fetch(self.samfile.x.bam,
11319 __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_77), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11320 __Pyx_GOTREF(__pyx_t_7);
11321 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
11322 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11323 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11328 /* "csamtools.pyx":1047
11330 * raise ValueError( "counting functionality requires a region/reference" )
11331 * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) # <<<<<<<<<<<<<<
11332 * bam_fetch(self.samfile.x.bam,
11335 __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11336 __Pyx_GOTREF(__pyx_t_7);
11337 __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11338 __Pyx_GOTREF(__pyx_t_5);
11339 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11340 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11341 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11342 __pyx_t_13 = (!__pyx_t_3);
11344 __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_78), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11345 __Pyx_GOTREF(__pyx_t_5);
11346 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
11347 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11348 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11353 /* "csamtools.pyx":1054
11356 * count_callback ) # <<<<<<<<<<<<<<
11360 bam_fetch(__pyx_v_self->samfile->x.bam, __pyx_v_self->index, __pyx_v_rtid, __pyx_v_rstart, __pyx_v_rend, ((void *)(&__pyx_v_counter)), __pyx_f_9csamtools_count_callback);
11362 /* "csamtools.pyx":1055
11365 * return counter # <<<<<<<<<<<<<<
11367 * raise ValueError ("count for a region is not available for sam files" )
11369 __Pyx_XDECREF(__pyx_r);
11370 __pyx_t_5 = PyInt_FromLong(__pyx_v_counter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11371 __Pyx_GOTREF(__pyx_t_5);
11372 __pyx_r = __pyx_t_5;
11379 /* "csamtools.pyx":1057
11382 * raise ValueError ("count for a region is not available for sam files" ) # <<<<<<<<<<<<<<
11384 * def pileup( self,
11386 __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_80), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11387 __Pyx_GOTREF(__pyx_t_5);
11388 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
11389 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11390 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11394 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11397 __Pyx_XDECREF(__pyx_t_1);
11398 __Pyx_XDECREF(__pyx_t_2);
11399 __Pyx_XDECREF(__pyx_t_5);
11400 __Pyx_XDECREF(__pyx_t_6);
11401 __Pyx_XDECREF(__pyx_t_7);
11402 __Pyx_XDECREF(__pyx_t_8);
11403 __Pyx_AddTraceback("csamtools.Samfile.count", __pyx_clineno, __pyx_lineno, __pyx_filename);
11406 __Pyx_XDECREF(__pyx_v_region);
11407 __Pyx_XGIVEREF(__pyx_r);
11408 __Pyx_TraceReturn(__pyx_r);
11409 __Pyx_RefNannyFinishContext();
11413 /* Python wrapper */
11414 static PyObject *__pyx_pw_9csamtools_7Samfile_27pileup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11415 static char __pyx_doc_9csamtools_7Samfile_26pileup[] = "Samfile.pileup(self, reference=None, start=None, end=None, region=None, callback=None, **kwargs)\n\n perform a :term:`pileup` within a :term:`region`. The region is specified by\n :term:`reference`, *start* and *end* (using 0-based indexing).\n Alternatively, a samtools *region* string can be supplied.\n\n Without *reference* or *region* all reads will be used for the pileup. The reads will be returned\n ordered by :term:`reference` sequence, which will not necessarily be the order within the file.\n\n The method returns an iterator of type :class:`pysam.IteratorColumn` unless\n a *callback is provided. If a *callback* is given, the callback will be executed\n for each column within the :term:`region`.\n\n Note that :term:`SAM` formatted files do not allow random access.\n In these files, if a *region* or *reference* are given an exception is raised.\n\n Optional *kwargs* to the iterator:\n\n stepper\n The stepper controlls how the iterator advances.\n Possible options for the stepper are\n\n ``all``\n use all reads for pileup.\n ``samtools``\n same filter and read processing as in :term:`csamtools` pileup\n\n fastafile\n A :class:`FastaFile` object\n\n mask\n Skip all reads with bits set in mask if mask=True.\n\n max_depth\n Maximum read depth permitted. The default limit is *8000*.\n\n truncate\n By default, the samtools pileup engine outputs all reads overlapping a region (see note below).\n If truncate is True and a region is given, only output columns in the exact region\n specificied.\n\n .. note::\n\n *all* reads which overlap the region are returned. The first base returned will be the\n first base of the first read *not* necessarily the first base of the region used in the query.\n\n ";
11416 static PyObject *__pyx_pw_9csamtools_7Samfile_27pileup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11417 PyObject *__pyx_v_reference = 0;
11418 PyObject *__pyx_v_start = 0;
11419 PyObject *__pyx_v_end = 0;
11420 PyObject *__pyx_v_region = 0;
11421 PyObject *__pyx_v_callback = 0;
11422 PyObject *__pyx_v_kwargs = 0;
11423 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__callback,0};
11424 PyObject *__pyx_r = 0;
11425 __Pyx_RefNannyDeclarations
11426 __Pyx_RefNannySetupContext("pileup (wrapper)", 0);
11427 __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
11428 __Pyx_GOTREF(__pyx_v_kwargs);
11430 PyObject* values[5] = {0,0,0,0,0};
11432 /* "csamtools.pyx":1060
11434 * def pileup( self,
11435 * reference = None, # <<<<<<<<<<<<<<
11439 values[0] = ((PyObject *)Py_None);
11441 /* "csamtools.pyx":1061
11442 * def pileup( self,
11443 * reference = None,
11444 * start = None, # <<<<<<<<<<<<<<
11448 values[1] = ((PyObject *)Py_None);
11450 /* "csamtools.pyx":1062
11451 * reference = None,
11453 * end = None, # <<<<<<<<<<<<<<
11457 values[2] = ((PyObject *)Py_None);
11459 /* "csamtools.pyx":1063
11462 * region = None, # <<<<<<<<<<<<<<
11466 values[3] = ((PyObject *)Py_None);
11468 /* "csamtools.pyx":1064
11471 * callback = None, # <<<<<<<<<<<<<<
11475 values[4] = ((PyObject *)Py_None);
11476 if (unlikely(__pyx_kwds)) {
11477 Py_ssize_t kw_args;
11478 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11479 switch (pos_args) {
11480 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11481 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11482 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11483 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11484 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11486 default: goto __pyx_L5_argtuple_error;
11488 kw_args = PyDict_Size(__pyx_kwds);
11489 switch (pos_args) {
11492 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
11493 if (value) { values[0] = value; kw_args--; }
11497 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
11498 if (value) { values[1] = value; kw_args--; }
11502 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
11503 if (value) { values[2] = value; kw_args--; }
11507 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region);
11508 if (value) { values[3] = value; kw_args--; }
11512 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback);
11513 if (value) { values[4] = value; kw_args--; }
11516 if (unlikely(kw_args > 0)) {
11517 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "pileup") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
11520 switch (PyTuple_GET_SIZE(__pyx_args)) {
11521 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11522 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11523 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11524 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11525 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11527 default: goto __pyx_L5_argtuple_error;
11530 __pyx_v_reference = values[0];
11531 __pyx_v_start = values[1];
11532 __pyx_v_end = values[2];
11533 __pyx_v_region = values[3];
11534 __pyx_v_callback = values[4];
11536 goto __pyx_L4_argument_unpacking_done;
11537 __pyx_L5_argtuple_error:;
11538 __Pyx_RaiseArgtupleInvalid("pileup", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
11540 __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
11541 __Pyx_AddTraceback("csamtools.Samfile.pileup", __pyx_clineno, __pyx_lineno, __pyx_filename);
11542 __Pyx_RefNannyFinishContext();
11544 __pyx_L4_argument_unpacking_done:;
11545 __pyx_r = __pyx_pf_9csamtools_7Samfile_26pileup(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region, __pyx_v_callback, __pyx_v_kwargs);
11546 __Pyx_XDECREF(__pyx_v_kwargs);
11547 __Pyx_RefNannyFinishContext();
11551 /* "csamtools.pyx":1059
11552 * raise ValueError ("count for a region is not available for sam files" )
11554 * def pileup( self, # <<<<<<<<<<<<<<
11555 * reference = None,
11559 static PyObject *__pyx_pf_9csamtools_7Samfile_26pileup(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region, PyObject *__pyx_v_callback, PyObject *__pyx_v_kwargs) {
11561 int __pyx_v_rstart;
11563 int __pyx_v_has_coord;
11564 bam_plbuf_t *__pyx_v_buf;
11565 PyObject *__pyx_r = NULL;
11566 __Pyx_RefNannyDeclarations
11567 PyObject *__pyx_t_1 = NULL;
11568 PyObject *__pyx_t_2 = NULL;
11571 PyObject *__pyx_t_5 = NULL;
11572 PyObject *__pyx_t_6 = NULL;
11573 PyObject *__pyx_t_7 = NULL;
11574 PyObject *__pyx_t_8 = NULL;
11575 PyObject *(*__pyx_t_9)(PyObject *);
11580 int __pyx_lineno = 0;
11581 const char *__pyx_filename = NULL;
11582 int __pyx_clineno = 0;
11583 __Pyx_TraceDeclarations
11584 __Pyx_RefNannySetupContext("pileup", 0);
11585 __Pyx_TraceCall("pileup", __pyx_f[0], 1059);
11587 /* "csamtools.pyx":1115
11588 * cdef bam_plbuf_t *buf
11590 * if not self._isOpen(): # <<<<<<<<<<<<<<
11591 * raise ValueError( "I/O operation on closed file" )
11594 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11595 __Pyx_GOTREF(__pyx_t_1);
11596 __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 = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11597 __Pyx_GOTREF(__pyx_t_2);
11598 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11599 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11600 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11601 __pyx_t_4 = (!__pyx_t_3);
11604 /* "csamtools.pyx":1116
11606 * if not self._isOpen():
11607 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
11609 * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
11611 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_81), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11612 __Pyx_GOTREF(__pyx_t_2);
11613 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
11614 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11615 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11620 /* "csamtools.pyx":1118
11621 * raise ValueError( "I/O operation on closed file" )
11623 * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) # <<<<<<<<<<<<<<
11627 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11628 __Pyx_GOTREF(__pyx_t_2);
11629 __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11630 __Pyx_GOTREF(__pyx_t_1);
11631 __Pyx_INCREF(__pyx_v_reference);
11632 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference);
11633 __Pyx_GIVEREF(__pyx_v_reference);
11634 __Pyx_INCREF(__pyx_v_start);
11635 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start);
11636 __Pyx_GIVEREF(__pyx_v_start);
11637 __Pyx_INCREF(__pyx_v_end);
11638 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end);
11639 __Pyx_GIVEREF(__pyx_v_end);
11640 __Pyx_INCREF(__pyx_v_region);
11641 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_region);
11642 __Pyx_GIVEREF(__pyx_v_region);
11643 __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11644 __Pyx_GOTREF(__pyx_t_5);
11645 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11646 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
11647 if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
11648 PyObject* sequence = __pyx_t_5;
11649 if (likely(PyTuple_CheckExact(sequence))) {
11650 if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) {
11651 if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
11652 else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
11653 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11655 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
11656 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
11657 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2);
11658 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 3);
11660 if (unlikely(PyList_GET_SIZE(sequence) != 4)) {
11661 if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
11662 else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
11663 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11665 __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
11666 __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
11667 __pyx_t_6 = PyList_GET_ITEM(sequence, 2);
11668 __pyx_t_7 = PyList_GET_ITEM(sequence, 3);
11670 __Pyx_INCREF(__pyx_t_1);
11671 __Pyx_INCREF(__pyx_t_2);
11672 __Pyx_INCREF(__pyx_t_6);
11673 __Pyx_INCREF(__pyx_t_7);
11674 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11676 Py_ssize_t index = -1;
11677 __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11678 __Pyx_GOTREF(__pyx_t_8);
11679 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11680 __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
11681 index = 0; __pyx_t_1 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
11682 __Pyx_GOTREF(__pyx_t_1);
11683 index = 1; __pyx_t_2 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
11684 __Pyx_GOTREF(__pyx_t_2);
11685 index = 2; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed;
11686 __Pyx_GOTREF(__pyx_t_6);
11687 index = 3; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L4_unpacking_failed;
11688 __Pyx_GOTREF(__pyx_t_7);
11689 if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11690 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11691 goto __pyx_L5_unpacking_done;
11692 __pyx_L4_unpacking_failed:;
11693 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11694 if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
11695 if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
11696 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11697 __pyx_L5_unpacking_done:;
11699 __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11700 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11701 __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11702 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11703 __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11704 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11705 __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11706 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11707 __pyx_v_has_coord = __pyx_t_10;
11708 __pyx_v_rtid = __pyx_t_11;
11709 __pyx_v_rstart = __pyx_t_12;
11710 __pyx_v_rend = __pyx_t_13;
11712 /* "csamtools.pyx":1120
11713 * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
11715 * if self.isbam: # <<<<<<<<<<<<<<
11716 * if not self._hasIndex(): raise ValueError( "no index available for pileup" )
11719 if (__pyx_v_self->isbam) {
11721 /* "csamtools.pyx":1121
11724 * if not self._hasIndex(): raise ValueError( "no index available for pileup" ) # <<<<<<<<<<<<<<
11728 __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11729 __Pyx_GOTREF(__pyx_t_5);
11730 __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11731 __Pyx_GOTREF(__pyx_t_7);
11732 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11733 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11734 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11735 __pyx_t_3 = (!__pyx_t_4);
11737 __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_83), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11738 __Pyx_GOTREF(__pyx_t_7);
11739 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
11740 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11741 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11746 /* "csamtools.pyx":1123
11747 * if not self._hasIndex(): raise ValueError( "no index available for pileup" )
11749 * if callback: # <<<<<<<<<<<<<<
11750 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
11753 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_callback); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11756 /* "csamtools.pyx":1124
11759 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) # <<<<<<<<<<<<<<
11761 * buf = bam_plbuf_init( <bam_pileup_f>pileup_callback, <void*>callback )
11763 __pyx_t_3 = (!__pyx_v_has_coord);
11765 __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_84), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11766 __Pyx_GOTREF(__pyx_t_7);
11767 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
11768 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11769 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11774 /* "csamtools.pyx":1126
11775 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
11777 * buf = bam_plbuf_init( <bam_pileup_f>pileup_callback, <void*>callback ) # <<<<<<<<<<<<<<
11778 * bam_fetch(self.samfile.x.bam,
11779 * self.index, rtid, rstart, rend,
11781 __pyx_v_buf = bam_plbuf_init(((bam_pileup_f)__pyx_f_9csamtools_pileup_callback), ((void *)__pyx_v_callback));
11783 /* "csamtools.pyx":1129
11784 * bam_fetch(self.samfile.x.bam,
11785 * self.index, rtid, rstart, rend,
11786 * buf, pileup_fetch_callback ) # <<<<<<<<<<<<<<
11788 * # finalize pileup
11790 bam_fetch(__pyx_v_self->samfile->x.bam, __pyx_v_self->index, __pyx_v_rtid, __pyx_v_rstart, __pyx_v_rend, __pyx_v_buf, __pyx_f_9csamtools_pileup_fetch_callback);
11792 /* "csamtools.pyx":1132
11794 * # finalize pileup
11795 * bam_plbuf_push( NULL, buf) # <<<<<<<<<<<<<<
11796 * bam_plbuf_destroy(buf)
11799 bam_plbuf_push(NULL, __pyx_v_buf);
11801 /* "csamtools.pyx":1133
11802 * # finalize pileup
11803 * bam_plbuf_push( NULL, buf)
11804 * bam_plbuf_destroy(buf) # <<<<<<<<<<<<<<
11808 bam_plbuf_destroy(__pyx_v_buf);
11813 /* "csamtools.pyx":1135
11814 * bam_plbuf_destroy(buf)
11816 * if has_coord: # <<<<<<<<<<<<<<
11817 * return IteratorColumnRegion( self,
11820 if (__pyx_v_has_coord) {
11822 /* "csamtools.pyx":1136
11825 * return IteratorColumnRegion( self, # <<<<<<<<<<<<<<
11829 __Pyx_XDECREF(__pyx_r);
11830 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11831 __Pyx_GOTREF(__pyx_t_7);
11832 __Pyx_INCREF(((PyObject *)__pyx_v_self));
11833 PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_self));
11834 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
11836 /* "csamtools.pyx":1140
11839 * **kwargs ) # <<<<<<<<<<<<<<
11841 * return IteratorColumnAllRefs(self, **kwargs )
11843 __pyx_t_5 = PyDict_Copy(((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11844 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
11846 /* "csamtools.pyx":1137
11848 * return IteratorColumnRegion( self,
11849 * tid = rtid, # <<<<<<<<<<<<<<
11853 __pyx_t_6 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11854 __Pyx_GOTREF(__pyx_t_6);
11855 if (unlikely(PyDict_GetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__tid)))) {
11856 __Pyx_RaiseDoubleKeywordsError("function", ((PyObject *)__pyx_n_s__tid)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11858 if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__tid), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11859 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11861 /* "csamtools.pyx":1138
11862 * return IteratorColumnRegion( self,
11864 * start = rstart, # <<<<<<<<<<<<<<
11868 __pyx_t_6 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11869 __Pyx_GOTREF(__pyx_t_6);
11870 if (unlikely(PyDict_GetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__start)))) {
11871 __Pyx_RaiseDoubleKeywordsError("function", ((PyObject *)__pyx_n_s__start)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11873 if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__start), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11874 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11876 /* "csamtools.pyx":1139
11879 * end = rend, # <<<<<<<<<<<<<<
11883 __pyx_t_6 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11884 __Pyx_GOTREF(__pyx_t_6);
11885 if (unlikely(PyDict_GetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__end)))) {
11886 __Pyx_RaiseDoubleKeywordsError("function", ((PyObject *)__pyx_n_s__end)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11888 if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__end), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11889 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11890 __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorColumnRegion)), ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11891 __Pyx_GOTREF(__pyx_t_6);
11892 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
11893 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
11894 __pyx_r = __pyx_t_6;
11901 /* "csamtools.pyx":1142
11904 * return IteratorColumnAllRefs(self, **kwargs ) # <<<<<<<<<<<<<<
11908 __Pyx_XDECREF(__pyx_r);
11909 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11910 __Pyx_GOTREF(__pyx_t_6);
11911 __Pyx_INCREF(((PyObject *)__pyx_v_self));
11912 PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_self));
11913 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
11914 __pyx_t_5 = ((PyObject *)__pyx_v_kwargs);
11915 __Pyx_INCREF(__pyx_t_5);
11916 __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorColumnAllRefs)), ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11917 __Pyx_GOTREF(__pyx_t_7);
11918 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
11919 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
11920 __pyx_r = __pyx_t_7;
11931 /* "csamtools.pyx":1145
11934 * raise NotImplementedError( "pileup of samfiles not implemented yet" ) # <<<<<<<<<<<<<<
11936 * def close( self ):
11938 __pyx_t_7 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_86), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11939 __Pyx_GOTREF(__pyx_t_7);
11940 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
11941 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11942 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11946 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11949 __Pyx_XDECREF(__pyx_t_1);
11950 __Pyx_XDECREF(__pyx_t_2);
11951 __Pyx_XDECREF(__pyx_t_5);
11952 __Pyx_XDECREF(__pyx_t_6);
11953 __Pyx_XDECREF(__pyx_t_7);
11954 __Pyx_XDECREF(__pyx_t_8);
11955 __Pyx_AddTraceback("csamtools.Samfile.pileup", __pyx_clineno, __pyx_lineno, __pyx_filename);
11958 __Pyx_XGIVEREF(__pyx_r);
11959 __Pyx_TraceReturn(__pyx_r);
11960 __Pyx_RefNannyFinishContext();
11964 /* Python wrapper */
11965 static PyObject *__pyx_pw_9csamtools_7Samfile_29close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
11966 static char __pyx_doc_9csamtools_7Samfile_28close[] = "Samfile.close(self)\n\n closes the :class:`pysam.Samfile`.";
11967 static PyObject *__pyx_pw_9csamtools_7Samfile_29close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11968 PyObject *__pyx_r = 0;
11969 __Pyx_RefNannyDeclarations
11970 __Pyx_RefNannySetupContext("close (wrapper)", 0);
11971 __pyx_r = __pyx_pf_9csamtools_7Samfile_28close(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
11972 __Pyx_RefNannyFinishContext();
11976 /* "csamtools.pyx":1147
11977 * raise NotImplementedError( "pileup of samfiles not implemented yet" )
11979 * def close( self ): # <<<<<<<<<<<<<<
11981 * closes the :class:`pysam.Samfile`.'''
11984 static PyObject *__pyx_pf_9csamtools_7Samfile_28close(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
11985 PyObject *__pyx_r = NULL;
11986 __Pyx_RefNannyDeclarations
11988 __Pyx_TraceDeclarations
11989 __Pyx_RefNannySetupContext("close", 0);
11990 __Pyx_TraceCall("close", __pyx_f[0], 1147);
11992 /* "csamtools.pyx":1150
11994 * closes the :class:`pysam.Samfile`.'''
11995 * if self.samfile != NULL: # <<<<<<<<<<<<<<
11996 * samclose( self.samfile )
11997 * bam_index_destroy(self.index);
11999 __pyx_t_1 = (__pyx_v_self->samfile != NULL);
12002 /* "csamtools.pyx":1151
12003 * closes the :class:`pysam.Samfile`.'''
12004 * if self.samfile != NULL:
12005 * samclose( self.samfile ) # <<<<<<<<<<<<<<
12006 * bam_index_destroy(self.index);
12007 * self.samfile = NULL
12009 samclose(__pyx_v_self->samfile);
12011 /* "csamtools.pyx":1152
12012 * if self.samfile != NULL:
12013 * samclose( self.samfile )
12014 * bam_index_destroy(self.index); # <<<<<<<<<<<<<<
12015 * self.samfile = NULL
12018 bam_index_destroy(__pyx_v_self->index);
12020 /* "csamtools.pyx":1153
12021 * samclose( self.samfile )
12022 * bam_index_destroy(self.index);
12023 * self.samfile = NULL # <<<<<<<<<<<<<<
12025 * def __dealloc__( self ):
12027 __pyx_v_self->samfile = NULL;
12032 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12033 __Pyx_XGIVEREF(__pyx_r);
12034 __Pyx_TraceReturn(__pyx_r);
12035 __Pyx_RefNannyFinishContext();
12039 /* Python wrapper */
12040 static void __pyx_pw_9csamtools_7Samfile_31__dealloc__(PyObject *__pyx_v_self); /*proto*/
12041 static void __pyx_pw_9csamtools_7Samfile_31__dealloc__(PyObject *__pyx_v_self) {
12042 __Pyx_RefNannyDeclarations
12043 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
12044 __pyx_pf_9csamtools_7Samfile_30__dealloc__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
12045 __Pyx_RefNannyFinishContext();
12048 /* "csamtools.pyx":1155
12049 * self.samfile = NULL
12051 * def __dealloc__( self ): # <<<<<<<<<<<<<<
12052 * # remember: dealloc cannot call other methods
12053 * # note: no doc string
12056 static void __pyx_pf_9csamtools_7Samfile_30__dealloc__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
12057 __Pyx_RefNannyDeclarations
12058 PyObject *__pyx_t_1 = NULL;
12059 PyObject *__pyx_t_2 = NULL;
12061 int __pyx_lineno = 0;
12062 const char *__pyx_filename = NULL;
12063 int __pyx_clineno = 0;
12064 __Pyx_TraceDeclarations
12065 __Pyx_RefNannySetupContext("__dealloc__", 0);
12066 __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1155);
12068 /* "csamtools.pyx":1159
12069 * # note: no doc string
12070 * # note: __del__ is not called.
12071 * self.close() # <<<<<<<<<<<<<<
12072 * bam_destroy1(self.b)
12073 * if self._filename != NULL: free( self._filename )
12075 __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 = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12076 __Pyx_GOTREF(__pyx_t_1);
12077 __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 = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12078 __Pyx_GOTREF(__pyx_t_2);
12079 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12080 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12082 /* "csamtools.pyx":1160
12083 * # note: __del__ is not called.
12085 * bam_destroy1(self.b) # <<<<<<<<<<<<<<
12086 * if self._filename != NULL: free( self._filename )
12089 bam_destroy1(__pyx_v_self->b);
12091 /* "csamtools.pyx":1161
12093 * bam_destroy1(self.b)
12094 * if self._filename != NULL: free( self._filename ) # <<<<<<<<<<<<<<
12096 * cpdef int write( self, AlignedRead read ) except -1:
12098 __pyx_t_3 = (__pyx_v_self->_filename != NULL);
12100 free(__pyx_v_self->_filename);
12107 __Pyx_XDECREF(__pyx_t_1);
12108 __Pyx_XDECREF(__pyx_t_2);
12109 __Pyx_AddTraceback("csamtools.Samfile.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12111 __Pyx_TraceReturn(Py_None);
12112 __Pyx_RefNannyFinishContext();
12115 /* "csamtools.pyx":1163
12116 * if self._filename != NULL: free( self._filename )
12118 * cpdef int write( self, AlignedRead read ) except -1: # <<<<<<<<<<<<<<
12120 * write a single :class:`pysam.AlignedRead` to disk.
12123 static PyObject *__pyx_pw_9csamtools_7Samfile_33write(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
12124 static int __pyx_f_9csamtools_7Samfile_write(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_read, int __pyx_skip_dispatch) {
12126 __Pyx_RefNannyDeclarations
12127 PyObject *__pyx_t_1 = NULL;
12128 PyObject *__pyx_t_2 = NULL;
12129 PyObject *__pyx_t_3 = NULL;
12133 int __pyx_lineno = 0;
12134 const char *__pyx_filename = NULL;
12135 int __pyx_clineno = 0;
12136 __Pyx_TraceDeclarations
12137 __Pyx_RefNannySetupContext("write", 0);
12138 __Pyx_TraceCall("write", __pyx_f[0], 1163);
12139 /* Check if called by wrapper */
12140 if (unlikely(__pyx_skip_dispatch)) ;
12141 /* Check if overriden in Python */
12142 else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
12143 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12144 __Pyx_GOTREF(__pyx_t_1);
12145 if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_9csamtools_7Samfile_33write)) {
12146 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12147 __Pyx_GOTREF(__pyx_t_2);
12148 __Pyx_INCREF(((PyObject *)__pyx_v_read));
12149 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_read));
12150 __Pyx_GIVEREF(((PyObject *)__pyx_v_read));
12151 __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 = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12152 __Pyx_GOTREF(__pyx_t_3);
12153 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
12154 __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12155 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12156 __pyx_r = __pyx_t_4;
12157 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12160 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12163 /* "csamtools.pyx":1169
12164 * returns the number of bytes written.
12166 * if not self._isOpen(): # <<<<<<<<<<<<<<
12170 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12171 __Pyx_GOTREF(__pyx_t_1);
12172 __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12173 __Pyx_GOTREF(__pyx_t_3);
12174 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12175 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12176 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12177 __pyx_t_6 = (!__pyx_t_5);
12180 /* "csamtools.pyx":1170
12182 * if not self._isOpen():
12183 * return 0 # <<<<<<<<<<<<<<
12185 * return samwrite( self.samfile, read._delegate )
12193 /* "csamtools.pyx":1172
12196 * return samwrite( self.samfile, read._delegate ) # <<<<<<<<<<<<<<
12198 * def __enter__(self):
12200 __pyx_r = samwrite(__pyx_v_self->samfile, __pyx_v_read->_delegate);
12206 __Pyx_XDECREF(__pyx_t_1);
12207 __Pyx_XDECREF(__pyx_t_2);
12208 __Pyx_XDECREF(__pyx_t_3);
12209 __Pyx_WriteUnraisable("csamtools.Samfile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
12212 __Pyx_TraceReturn(Py_None);
12213 __Pyx_RefNannyFinishContext();
12217 /* Python wrapper */
12218 static PyObject *__pyx_pw_9csamtools_7Samfile_33write(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
12219 static char __pyx_doc_9csamtools_7Samfile_32write[] = "Samfile.write(self, AlignedRead read) -> int\n\n write a single :class:`pysam.AlignedRead` to disk.\n\n returns the number of bytes written.\n ";
12220 static PyObject *__pyx_pw_9csamtools_7Samfile_33write(PyObject *__pyx_v_self, PyObject *__pyx_v_read) {
12221 PyObject *__pyx_r = 0;
12222 __Pyx_RefNannyDeclarations
12223 __Pyx_RefNannySetupContext("write (wrapper)", 0);
12224 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_read), __pyx_ptype_9csamtools_AlignedRead, 1, "read", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12225 __pyx_r = __pyx_pf_9csamtools_7Samfile_32write(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read));
12230 __Pyx_RefNannyFinishContext();
12234 /* "csamtools.pyx":1163
12235 * if self._filename != NULL: free( self._filename )
12237 * cpdef int write( self, AlignedRead read ) except -1: # <<<<<<<<<<<<<<
12239 * write a single :class:`pysam.AlignedRead` to disk.
12242 static PyObject *__pyx_pf_9csamtools_7Samfile_32write(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_read) {
12243 PyObject *__pyx_r = NULL;
12244 __Pyx_RefNannyDeclarations
12245 PyObject *__pyx_t_1 = NULL;
12246 int __pyx_lineno = 0;
12247 const char *__pyx_filename = NULL;
12248 int __pyx_clineno = 0;
12249 __Pyx_TraceDeclarations
12250 __Pyx_RefNannySetupContext("write", 0);
12251 __Pyx_TraceCall("write", __pyx_f[0], 1163);
12252 __Pyx_XDECREF(__pyx_r);
12253 __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_9csamtools_Samfile *)__pyx_v_self->__pyx_vtab)->write(__pyx_v_self, __pyx_v_read, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12254 __Pyx_GOTREF(__pyx_t_1);
12255 __pyx_r = __pyx_t_1;
12259 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12262 __Pyx_XDECREF(__pyx_t_1);
12263 __Pyx_AddTraceback("csamtools.Samfile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
12266 __Pyx_XGIVEREF(__pyx_r);
12267 __Pyx_TraceReturn(__pyx_r);
12268 __Pyx_RefNannyFinishContext();
12272 /* Python wrapper */
12273 static PyObject *__pyx_pw_9csamtools_7Samfile_35__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
12274 static char __pyx_doc_9csamtools_7Samfile_34__enter__[] = "Samfile.__enter__(self)";
12275 static PyObject *__pyx_pw_9csamtools_7Samfile_35__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12276 PyObject *__pyx_r = 0;
12277 __Pyx_RefNannyDeclarations
12278 __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
12279 __pyx_r = __pyx_pf_9csamtools_7Samfile_34__enter__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
12280 __Pyx_RefNannyFinishContext();
12284 /* "csamtools.pyx":1174
12285 * return samwrite( self.samfile, read._delegate )
12287 * def __enter__(self): # <<<<<<<<<<<<<<
12292 static PyObject *__pyx_pf_9csamtools_7Samfile_34__enter__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
12293 PyObject *__pyx_r = NULL;
12294 __Pyx_RefNannyDeclarations
12295 __Pyx_TraceDeclarations
12296 __Pyx_RefNannySetupContext("__enter__", 0);
12297 __Pyx_TraceCall("__enter__", __pyx_f[0], 1174);
12299 /* "csamtools.pyx":1175
12301 * def __enter__(self):
12302 * return self # <<<<<<<<<<<<<<
12304 * def __exit__(self, exc_type, exc_value, traceback):
12306 __Pyx_XDECREF(__pyx_r);
12307 __Pyx_INCREF(((PyObject *)__pyx_v_self));
12308 __pyx_r = ((PyObject *)__pyx_v_self);
12311 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12313 __Pyx_XGIVEREF(__pyx_r);
12314 __Pyx_TraceReturn(__pyx_r);
12315 __Pyx_RefNannyFinishContext();
12319 /* Python wrapper */
12320 static PyObject *__pyx_pw_9csamtools_7Samfile_37__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
12321 static char __pyx_doc_9csamtools_7Samfile_36__exit__[] = "Samfile.__exit__(self, exc_type, exc_value, traceback)";
12322 static PyObject *__pyx_pw_9csamtools_7Samfile_37__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
12323 CYTHON_UNUSED PyObject *__pyx_v_exc_type = 0;
12324 CYTHON_UNUSED PyObject *__pyx_v_exc_value = 0;
12325 CYTHON_UNUSED PyObject *__pyx_v_traceback = 0;
12326 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__exc_type,&__pyx_n_s__exc_value,&__pyx_n_s__traceback,0};
12327 PyObject *__pyx_r = 0;
12328 __Pyx_RefNannyDeclarations
12329 __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
12331 PyObject* values[3] = {0,0,0};
12332 if (unlikely(__pyx_kwds)) {
12333 Py_ssize_t kw_args;
12334 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
12335 switch (pos_args) {
12336 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
12337 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12338 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12340 default: goto __pyx_L5_argtuple_error;
12342 kw_args = PyDict_Size(__pyx_kwds);
12343 switch (pos_args) {
12345 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exc_type);
12346 if (likely(values[0])) kw_args--;
12347 else goto __pyx_L5_argtuple_error;
12349 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exc_value);
12350 if (likely(values[1])) kw_args--;
12352 __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12355 values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__traceback);
12356 if (likely(values[2])) kw_args--;
12358 __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12361 if (unlikely(kw_args > 0)) {
12362 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12364 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
12365 goto __pyx_L5_argtuple_error;
12367 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12368 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12369 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
12371 __pyx_v_exc_type = values[0];
12372 __pyx_v_exc_value = values[1];
12373 __pyx_v_traceback = values[2];
12375 goto __pyx_L4_argument_unpacking_done;
12376 __pyx_L5_argtuple_error:;
12377 __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
12379 __Pyx_AddTraceback("csamtools.Samfile.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12380 __Pyx_RefNannyFinishContext();
12382 __pyx_L4_argument_unpacking_done:;
12383 __pyx_r = __pyx_pf_9csamtools_7Samfile_36__exit__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_value, __pyx_v_traceback);
12384 __Pyx_RefNannyFinishContext();
12388 /* "csamtools.pyx":1177
12391 * def __exit__(self, exc_type, exc_value, traceback): # <<<<<<<<<<<<<<
12396 static PyObject *__pyx_pf_9csamtools_7Samfile_36__exit__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) {
12397 PyObject *__pyx_r = NULL;
12398 __Pyx_RefNannyDeclarations
12399 PyObject *__pyx_t_1 = NULL;
12400 PyObject *__pyx_t_2 = NULL;
12401 int __pyx_lineno = 0;
12402 const char *__pyx_filename = NULL;
12403 int __pyx_clineno = 0;
12404 __Pyx_TraceDeclarations
12405 __Pyx_RefNannySetupContext("__exit__", 0);
12406 __Pyx_TraceCall("__exit__", __pyx_f[0], 1177);
12408 /* "csamtools.pyx":1178
12410 * def __exit__(self, exc_type, exc_value, traceback):
12411 * self.close() # <<<<<<<<<<<<<<
12415 __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 = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12416 __Pyx_GOTREF(__pyx_t_1);
12417 __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 = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12418 __Pyx_GOTREF(__pyx_t_2);
12419 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12420 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12422 /* "csamtools.pyx":1179
12423 * def __exit__(self, exc_type, exc_value, traceback):
12425 * return False # <<<<<<<<<<<<<<
12427 * ###############################################################
12429 __Pyx_XDECREF(__pyx_r);
12430 __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12431 __Pyx_GOTREF(__pyx_t_2);
12432 __pyx_r = __pyx_t_2;
12436 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12439 __Pyx_XDECREF(__pyx_t_1);
12440 __Pyx_XDECREF(__pyx_t_2);
12441 __Pyx_AddTraceback("csamtools.Samfile.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12444 __Pyx_XGIVEREF(__pyx_r);
12445 __Pyx_TraceReturn(__pyx_r);
12446 __Pyx_RefNannyFinishContext();
12450 /* Python wrapper */
12451 static PyObject *__pyx_pw_9csamtools_7Samfile_8filename_1__get__(PyObject *__pyx_v_self); /*proto*/
12452 static PyObject *__pyx_pw_9csamtools_7Samfile_8filename_1__get__(PyObject *__pyx_v_self) {
12453 PyObject *__pyx_r = 0;
12454 __Pyx_RefNannyDeclarations
12455 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12456 __pyx_r = __pyx_pf_9csamtools_7Samfile_8filename___get__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
12457 __Pyx_RefNannyFinishContext();
12461 /* "csamtools.pyx":1188
12462 * property filename:
12463 * '''number of :term:`filename` associated with this object.'''
12464 * def __get__(self): # <<<<<<<<<<<<<<
12465 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
12466 * return self._filename
12469 static PyObject *__pyx_pf_9csamtools_7Samfile_8filename___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
12470 PyObject *__pyx_r = NULL;
12471 __Pyx_RefNannyDeclarations
12472 PyObject *__pyx_t_1 = NULL;
12473 PyObject *__pyx_t_2 = NULL;
12476 int __pyx_lineno = 0;
12477 const char *__pyx_filename = NULL;
12478 int __pyx_clineno = 0;
12479 __Pyx_TraceDeclarations
12480 __Pyx_RefNannySetupContext("__get__", 0);
12481 __Pyx_TraceCall("__get__", __pyx_f[0], 1188);
12483 /* "csamtools.pyx":1189
12484 * '''number of :term:`filename` associated with this object.'''
12485 * def __get__(self):
12486 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
12487 * return self._filename
12490 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12491 __Pyx_GOTREF(__pyx_t_1);
12492 __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 = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12493 __Pyx_GOTREF(__pyx_t_2);
12494 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12495 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12496 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12497 __pyx_t_4 = (!__pyx_t_3);
12499 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_87), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12500 __Pyx_GOTREF(__pyx_t_2);
12501 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
12502 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12503 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12508 /* "csamtools.pyx":1190
12509 * def __get__(self):
12510 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
12511 * return self._filename # <<<<<<<<<<<<<<
12513 * property nreferences:
12515 __Pyx_XDECREF(__pyx_r);
12516 __pyx_t_2 = PyBytes_FromString(__pyx_v_self->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12517 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
12518 __pyx_r = ((PyObject *)__pyx_t_2);
12522 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12525 __Pyx_XDECREF(__pyx_t_1);
12526 __Pyx_XDECREF(__pyx_t_2);
12527 __Pyx_AddTraceback("csamtools.Samfile.filename.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12530 __Pyx_XGIVEREF(__pyx_r);
12531 __Pyx_TraceReturn(__pyx_r);
12532 __Pyx_RefNannyFinishContext();
12536 /* Python wrapper */
12537 static PyObject *__pyx_pw_9csamtools_7Samfile_11nreferences_1__get__(PyObject *__pyx_v_self); /*proto*/
12538 static PyObject *__pyx_pw_9csamtools_7Samfile_11nreferences_1__get__(PyObject *__pyx_v_self) {
12539 PyObject *__pyx_r = 0;
12540 __Pyx_RefNannyDeclarations
12541 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12542 __pyx_r = __pyx_pf_9csamtools_7Samfile_11nreferences___get__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
12543 __Pyx_RefNannyFinishContext();
12547 /* "csamtools.pyx":1194
12548 * property nreferences:
12549 * '''number of :term:`reference` sequences in the file.'''
12550 * def __get__(self): # <<<<<<<<<<<<<<
12551 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
12552 * return self.samfile.header.n_targets
12555 static PyObject *__pyx_pf_9csamtools_7Samfile_11nreferences___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
12556 PyObject *__pyx_r = NULL;
12557 __Pyx_RefNannyDeclarations
12558 PyObject *__pyx_t_1 = NULL;
12559 PyObject *__pyx_t_2 = NULL;
12562 int __pyx_lineno = 0;
12563 const char *__pyx_filename = NULL;
12564 int __pyx_clineno = 0;
12565 __Pyx_TraceDeclarations
12566 __Pyx_RefNannySetupContext("__get__", 0);
12567 __Pyx_TraceCall("__get__", __pyx_f[0], 1194);
12569 /* "csamtools.pyx":1195
12570 * '''number of :term:`reference` sequences in the file.'''
12571 * def __get__(self):
12572 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
12573 * return self.samfile.header.n_targets
12576 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12577 __Pyx_GOTREF(__pyx_t_1);
12578 __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 = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12579 __Pyx_GOTREF(__pyx_t_2);
12580 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12581 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12582 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12583 __pyx_t_4 = (!__pyx_t_3);
12585 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_88), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12586 __Pyx_GOTREF(__pyx_t_2);
12587 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
12588 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12589 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12594 /* "csamtools.pyx":1196
12595 * def __get__(self):
12596 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
12597 * return self.samfile.header.n_targets # <<<<<<<<<<<<<<
12599 * property references:
12601 __Pyx_XDECREF(__pyx_r);
12602 __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->samfile->header->n_targets); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12603 __Pyx_GOTREF(__pyx_t_2);
12604 __pyx_r = __pyx_t_2;
12608 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12611 __Pyx_XDECREF(__pyx_t_1);
12612 __Pyx_XDECREF(__pyx_t_2);
12613 __Pyx_AddTraceback("csamtools.Samfile.nreferences.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12616 __Pyx_XGIVEREF(__pyx_r);
12617 __Pyx_TraceReturn(__pyx_r);
12618 __Pyx_RefNannyFinishContext();
12622 /* Python wrapper */
12623 static PyObject *__pyx_pw_9csamtools_7Samfile_10references_1__get__(PyObject *__pyx_v_self); /*proto*/
12624 static PyObject *__pyx_pw_9csamtools_7Samfile_10references_1__get__(PyObject *__pyx_v_self) {
12625 PyObject *__pyx_r = 0;
12626 __Pyx_RefNannyDeclarations
12627 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12628 __pyx_r = __pyx_pf_9csamtools_7Samfile_10references___get__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
12629 __Pyx_RefNannyFinishContext();
12633 /* "csamtools.pyx":1200
12634 * property references:
12635 * """tuple with the names of :term:`reference` sequences."""
12636 * def __get__(self): # <<<<<<<<<<<<<<
12637 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
12641 static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
12642 PyObject *__pyx_v_t = NULL;
12644 PyObject *__pyx_r = NULL;
12645 __Pyx_RefNannyDeclarations
12646 PyObject *__pyx_t_1 = NULL;
12647 PyObject *__pyx_t_2 = NULL;
12652 int __pyx_lineno = 0;
12653 const char *__pyx_filename = NULL;
12654 int __pyx_clineno = 0;
12655 __Pyx_TraceDeclarations
12656 __Pyx_RefNannySetupContext("__get__", 0);
12657 __Pyx_TraceCall("__get__", __pyx_f[0], 1200);
12659 /* "csamtools.pyx":1201
12660 * """tuple with the names of :term:`reference` sequences."""
12661 * def __get__(self):
12662 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
12664 * for x from 0 <= x < self.samfile.header.n_targets:
12666 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12667 __Pyx_GOTREF(__pyx_t_1);
12668 __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 = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12669 __Pyx_GOTREF(__pyx_t_2);
12670 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12671 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12672 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12673 __pyx_t_4 = (!__pyx_t_3);
12675 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_89), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12676 __Pyx_GOTREF(__pyx_t_2);
12677 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
12678 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12679 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12684 /* "csamtools.pyx":1202
12685 * def __get__(self):
12686 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
12687 * t = [] # <<<<<<<<<<<<<<
12688 * for x from 0 <= x < self.samfile.header.n_targets:
12689 * t.append( _charptr_to_str(self.samfile.header.target_name[x]) )
12691 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12692 __Pyx_GOTREF(__pyx_t_2);
12693 __pyx_v_t = __pyx_t_2;
12696 /* "csamtools.pyx":1203
12697 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
12699 * for x from 0 <= x < self.samfile.header.n_targets: # <<<<<<<<<<<<<<
12700 * t.append( _charptr_to_str(self.samfile.header.target_name[x]) )
12703 __pyx_t_5 = __pyx_v_self->samfile->header->n_targets;
12704 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_5; __pyx_v_x++) {
12706 /* "csamtools.pyx":1204
12708 * for x from 0 <= x < self.samfile.header.n_targets:
12709 * t.append( _charptr_to_str(self.samfile.header.target_name[x]) ) # <<<<<<<<<<<<<<
12713 __pyx_t_2 = __pyx_f_9csamtools__charptr_to_str((__pyx_v_self->samfile->header->target_name[__pyx_v_x])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12714 __Pyx_GOTREF(__pyx_t_2);
12715 __pyx_t_6 = PyList_Append(__pyx_v_t, __pyx_t_2); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12716 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12719 /* "csamtools.pyx":1205
12720 * for x from 0 <= x < self.samfile.header.n_targets:
12721 * t.append( _charptr_to_str(self.samfile.header.target_name[x]) )
12722 * return tuple(t) # <<<<<<<<<<<<<<
12724 * property lengths:
12726 __Pyx_XDECREF(__pyx_r);
12727 __pyx_t_2 = ((PyObject *)PyList_AsTuple(__pyx_v_t)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12728 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
12729 __pyx_r = ((PyObject *)__pyx_t_2);
12733 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12736 __Pyx_XDECREF(__pyx_t_1);
12737 __Pyx_XDECREF(__pyx_t_2);
12738 __Pyx_AddTraceback("csamtools.Samfile.references.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12741 __Pyx_XDECREF(__pyx_v_t);
12742 __Pyx_XGIVEREF(__pyx_r);
12743 __Pyx_TraceReturn(__pyx_r);
12744 __Pyx_RefNannyFinishContext();
12748 /* Python wrapper */
12749 static PyObject *__pyx_pw_9csamtools_7Samfile_7lengths_1__get__(PyObject *__pyx_v_self); /*proto*/
12750 static PyObject *__pyx_pw_9csamtools_7Samfile_7lengths_1__get__(PyObject *__pyx_v_self) {
12751 PyObject *__pyx_r = 0;
12752 __Pyx_RefNannyDeclarations
12753 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12754 __pyx_r = __pyx_pf_9csamtools_7Samfile_7lengths___get__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
12755 __Pyx_RefNannyFinishContext();
12759 /* "csamtools.pyx":1211
12760 * :attr:`pysam.Samfile.references`
12762 * def __get__(self): # <<<<<<<<<<<<<<
12763 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
12767 static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
12768 PyObject *__pyx_v_t = NULL;
12770 PyObject *__pyx_r = NULL;
12771 __Pyx_RefNannyDeclarations
12772 PyObject *__pyx_t_1 = NULL;
12773 PyObject *__pyx_t_2 = NULL;
12778 int __pyx_lineno = 0;
12779 const char *__pyx_filename = NULL;
12780 int __pyx_clineno = 0;
12781 __Pyx_TraceDeclarations
12782 __Pyx_RefNannySetupContext("__get__", 0);
12783 __Pyx_TraceCall("__get__", __pyx_f[0], 1211);
12785 /* "csamtools.pyx":1212
12787 * def __get__(self):
12788 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
12790 * for x from 0 <= x < self.samfile.header.n_targets:
12792 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12793 __Pyx_GOTREF(__pyx_t_1);
12794 __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 = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12795 __Pyx_GOTREF(__pyx_t_2);
12796 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12797 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12798 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12799 __pyx_t_4 = (!__pyx_t_3);
12801 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_90), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12802 __Pyx_GOTREF(__pyx_t_2);
12803 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
12804 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12805 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12810 /* "csamtools.pyx":1213
12811 * def __get__(self):
12812 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
12813 * t = [] # <<<<<<<<<<<<<<
12814 * for x from 0 <= x < self.samfile.header.n_targets:
12815 * t.append( self.samfile.header.target_len[x] )
12817 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12818 __Pyx_GOTREF(__pyx_t_2);
12819 __pyx_v_t = __pyx_t_2;
12822 /* "csamtools.pyx":1214
12823 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
12825 * for x from 0 <= x < self.samfile.header.n_targets: # <<<<<<<<<<<<<<
12826 * t.append( self.samfile.header.target_len[x] )
12829 __pyx_t_5 = __pyx_v_self->samfile->header->n_targets;
12830 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_5; __pyx_v_x++) {
12832 /* "csamtools.pyx":1215
12834 * for x from 0 <= x < self.samfile.header.n_targets:
12835 * t.append( self.samfile.header.target_len[x] ) # <<<<<<<<<<<<<<
12839 __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t((__pyx_v_self->samfile->header->target_len[__pyx_v_x])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12840 __Pyx_GOTREF(__pyx_t_2);
12841 __pyx_t_6 = PyList_Append(__pyx_v_t, __pyx_t_2); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12842 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12845 /* "csamtools.pyx":1216
12846 * for x from 0 <= x < self.samfile.header.n_targets:
12847 * t.append( self.samfile.header.target_len[x] )
12848 * return tuple(t) # <<<<<<<<<<<<<<
12852 __Pyx_XDECREF(__pyx_r);
12853 __pyx_t_2 = ((PyObject *)PyList_AsTuple(__pyx_v_t)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12854 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
12855 __pyx_r = ((PyObject *)__pyx_t_2);
12859 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12862 __Pyx_XDECREF(__pyx_t_1);
12863 __Pyx_XDECREF(__pyx_t_2);
12864 __Pyx_AddTraceback("csamtools.Samfile.lengths.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12867 __Pyx_XDECREF(__pyx_v_t);
12868 __Pyx_XGIVEREF(__pyx_r);
12869 __Pyx_TraceReturn(__pyx_r);
12870 __Pyx_RefNannyFinishContext();
12874 /* Python wrapper */
12875 static PyObject *__pyx_pw_9csamtools_7Samfile_6mapped_1__get__(PyObject *__pyx_v_self); /*proto*/
12876 static PyObject *__pyx_pw_9csamtools_7Samfile_6mapped_1__get__(PyObject *__pyx_v_self) {
12877 PyObject *__pyx_r = 0;
12878 __Pyx_RefNannyDeclarations
12879 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12880 __pyx_r = __pyx_pf_9csamtools_7Samfile_6mapped___get__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
12881 __Pyx_RefNannyFinishContext();
12885 /* "csamtools.pyx":1221
12886 * """total number of mapped reads in file.
12888 * def __get__(self): # <<<<<<<<<<<<<<
12889 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
12890 * if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" )
12893 static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
12895 uint32_t __pyx_v_total;
12896 PyObject *__pyx_r = NULL;
12897 __Pyx_RefNannyDeclarations
12898 PyObject *__pyx_t_1 = NULL;
12899 PyObject *__pyx_t_2 = NULL;
12903 int __pyx_lineno = 0;
12904 const char *__pyx_filename = NULL;
12905 int __pyx_clineno = 0;
12906 __Pyx_TraceDeclarations
12907 __Pyx_RefNannySetupContext("__get__", 0);
12908 __Pyx_TraceCall("__get__", __pyx_f[0], 1221);
12910 /* "csamtools.pyx":1222
12912 * def __get__(self):
12913 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
12914 * if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" )
12917 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12918 __Pyx_GOTREF(__pyx_t_1);
12919 __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 = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12920 __Pyx_GOTREF(__pyx_t_2);
12921 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12922 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12923 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12924 __pyx_t_4 = (!__pyx_t_3);
12926 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_91), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12927 __Pyx_GOTREF(__pyx_t_2);
12928 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
12929 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12930 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12935 /* "csamtools.pyx":1223
12936 * def __get__(self):
12937 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
12938 * if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" ) # <<<<<<<<<<<<<<
12942 __pyx_t_4 = (!__pyx_v_self->isbam);
12944 __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_93), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12945 __Pyx_GOTREF(__pyx_t_2);
12946 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
12947 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12948 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12953 /* "csamtools.pyx":1226
12956 * cdef uint32_t total = 0 # <<<<<<<<<<<<<<
12957 * for tid from 0 <= tid < self.samfile.header.n_targets:
12958 * total += pysam_get_mapped( self.index, tid )
12962 /* "csamtools.pyx":1227
12964 * cdef uint32_t total = 0
12965 * for tid from 0 <= tid < self.samfile.header.n_targets: # <<<<<<<<<<<<<<
12966 * total += pysam_get_mapped( self.index, tid )
12969 __pyx_t_5 = __pyx_v_self->samfile->header->n_targets;
12970 for (__pyx_v_tid = 0; __pyx_v_tid < __pyx_t_5; __pyx_v_tid++) {
12972 /* "csamtools.pyx":1228
12973 * cdef uint32_t total = 0
12974 * for tid from 0 <= tid < self.samfile.header.n_targets:
12975 * total += pysam_get_mapped( self.index, tid ) # <<<<<<<<<<<<<<
12979 __pyx_v_total = (__pyx_v_total + pysam_get_mapped(__pyx_v_self->index, __pyx_v_tid));
12982 /* "csamtools.pyx":1229
12983 * for tid from 0 <= tid < self.samfile.header.n_targets:
12984 * total += pysam_get_mapped( self.index, tid )
12985 * return total # <<<<<<<<<<<<<<
12987 * property unmapped:
12989 __Pyx_XDECREF(__pyx_r);
12990 __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_total); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12991 __Pyx_GOTREF(__pyx_t_2);
12992 __pyx_r = __pyx_t_2;
12996 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12999 __Pyx_XDECREF(__pyx_t_1);
13000 __Pyx_XDECREF(__pyx_t_2);
13001 __Pyx_AddTraceback("csamtools.Samfile.mapped.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13004 __Pyx_XGIVEREF(__pyx_r);
13005 __Pyx_TraceReturn(__pyx_r);
13006 __Pyx_RefNannyFinishContext();
13010 /* Python wrapper */
13011 static PyObject *__pyx_pw_9csamtools_7Samfile_8unmapped_1__get__(PyObject *__pyx_v_self); /*proto*/
13012 static PyObject *__pyx_pw_9csamtools_7Samfile_8unmapped_1__get__(PyObject *__pyx_v_self) {
13013 PyObject *__pyx_r = 0;
13014 __Pyx_RefNannyDeclarations
13015 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13016 __pyx_r = __pyx_pf_9csamtools_7Samfile_8unmapped___get__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
13017 __Pyx_RefNannyFinishContext();
13021 /* "csamtools.pyx":1234
13022 * """total number of unmapped reads in file.
13024 * def __get__(self): # <<<<<<<<<<<<<<
13025 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
13026 * if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )
13029 static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
13031 uint32_t __pyx_v_total;
13032 PyObject *__pyx_r = NULL;
13033 __Pyx_RefNannyDeclarations
13034 PyObject *__pyx_t_1 = NULL;
13035 PyObject *__pyx_t_2 = NULL;
13039 int __pyx_lineno = 0;
13040 const char *__pyx_filename = NULL;
13041 int __pyx_clineno = 0;
13042 __Pyx_TraceDeclarations
13043 __Pyx_RefNannySetupContext("__get__", 0);
13044 __Pyx_TraceCall("__get__", __pyx_f[0], 1234);
13046 /* "csamtools.pyx":1235
13048 * def __get__(self):
13049 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
13050 * if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )
13053 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13054 __Pyx_GOTREF(__pyx_t_1);
13055 __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 = 1235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13056 __Pyx_GOTREF(__pyx_t_2);
13057 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13058 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13059 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13060 __pyx_t_4 = (!__pyx_t_3);
13062 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_94), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13063 __Pyx_GOTREF(__pyx_t_2);
13064 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
13065 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13066 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13071 /* "csamtools.pyx":1236
13072 * def __get__(self):
13073 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
13074 * if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" ) # <<<<<<<<<<<<<<
13076 * cdef uint32_t total = 0
13078 __pyx_t_4 = (!__pyx_v_self->isbam);
13080 __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_96), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13081 __Pyx_GOTREF(__pyx_t_2);
13082 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
13083 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13084 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13089 /* "csamtools.pyx":1238
13090 * if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )
13092 * cdef uint32_t total = 0 # <<<<<<<<<<<<<<
13093 * for tid from 0 <= tid < self.samfile.header.n_targets:
13094 * total += pysam_get_unmapped( self.index, tid )
13098 /* "csamtools.pyx":1239
13100 * cdef uint32_t total = 0
13101 * for tid from 0 <= tid < self.samfile.header.n_targets: # <<<<<<<<<<<<<<
13102 * total += pysam_get_unmapped( self.index, tid )
13103 * # get unmapped reads without coordinates
13105 __pyx_t_5 = __pyx_v_self->samfile->header->n_targets;
13106 for (__pyx_v_tid = 0; __pyx_v_tid < __pyx_t_5; __pyx_v_tid++) {
13108 /* "csamtools.pyx":1240
13109 * cdef uint32_t total = 0
13110 * for tid from 0 <= tid < self.samfile.header.n_targets:
13111 * total += pysam_get_unmapped( self.index, tid ) # <<<<<<<<<<<<<<
13112 * # get unmapped reads without coordinates
13113 * total += pysam_get_unmapped( self.index, -1 )
13115 __pyx_v_total = (__pyx_v_total + pysam_get_unmapped(__pyx_v_self->index, __pyx_v_tid));
13118 /* "csamtools.pyx":1242
13119 * total += pysam_get_unmapped( self.index, tid )
13120 * # get unmapped reads without coordinates
13121 * total += pysam_get_unmapped( self.index, -1 ) # <<<<<<<<<<<<<<
13125 __pyx_v_total = (__pyx_v_total + pysam_get_unmapped(__pyx_v_self->index, -1));
13127 /* "csamtools.pyx":1243
13128 * # get unmapped reads without coordinates
13129 * total += pysam_get_unmapped( self.index, -1 )
13130 * return total # <<<<<<<<<<<<<<
13134 __Pyx_XDECREF(__pyx_r);
13135 __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_total); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13136 __Pyx_GOTREF(__pyx_t_2);
13137 __pyx_r = __pyx_t_2;
13141 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13144 __Pyx_XDECREF(__pyx_t_1);
13145 __Pyx_XDECREF(__pyx_t_2);
13146 __Pyx_AddTraceback("csamtools.Samfile.unmapped.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13149 __Pyx_XGIVEREF(__pyx_r);
13150 __Pyx_TraceReturn(__pyx_r);
13151 __Pyx_RefNannyFinishContext();
13155 /* Python wrapper */
13156 static PyObject *__pyx_pw_9csamtools_7Samfile_4text_1__get__(PyObject *__pyx_v_self); /*proto*/
13157 static PyObject *__pyx_pw_9csamtools_7Samfile_4text_1__get__(PyObject *__pyx_v_self) {
13158 PyObject *__pyx_r = 0;
13159 __Pyx_RefNannyDeclarations
13160 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13161 __pyx_r = __pyx_pf_9csamtools_7Samfile_4text___get__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
13162 __Pyx_RefNannyFinishContext();
13166 /* "csamtools.pyx":1247
13168 * '''full contents of the :term:`sam file` header as a string.'''
13169 * def __get__(self): # <<<<<<<<<<<<<<
13170 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
13171 * return from_string_and_size(self.samfile.header.text, self.samfile.header.l_text)
13174 static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
13175 PyObject *__pyx_r = NULL;
13176 __Pyx_RefNannyDeclarations
13177 PyObject *__pyx_t_1 = NULL;
13178 PyObject *__pyx_t_2 = NULL;
13181 int __pyx_lineno = 0;
13182 const char *__pyx_filename = NULL;
13183 int __pyx_clineno = 0;
13184 __Pyx_TraceDeclarations
13185 __Pyx_RefNannySetupContext("__get__", 0);
13186 __Pyx_TraceCall("__get__", __pyx_f[0], 1247);
13188 /* "csamtools.pyx":1248
13189 * '''full contents of the :term:`sam file` header as a string.'''
13190 * def __get__(self):
13191 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
13192 * return from_string_and_size(self.samfile.header.text, self.samfile.header.l_text)
13195 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13196 __Pyx_GOTREF(__pyx_t_1);
13197 __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 = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13198 __Pyx_GOTREF(__pyx_t_2);
13199 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13200 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13201 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13202 __pyx_t_4 = (!__pyx_t_3);
13204 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_97), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13205 __Pyx_GOTREF(__pyx_t_2);
13206 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
13207 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13208 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13213 /* "csamtools.pyx":1249
13214 * def __get__(self):
13215 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
13216 * return from_string_and_size(self.samfile.header.text, self.samfile.header.l_text) # <<<<<<<<<<<<<<
13220 __Pyx_XDECREF(__pyx_r);
13221 __pyx_t_2 = __pyx_f_9csamtools_from_string_and_size(__pyx_v_self->samfile->header->text, __pyx_v_self->samfile->header->l_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13222 __Pyx_GOTREF(__pyx_t_2);
13223 __pyx_r = __pyx_t_2;
13227 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13230 __Pyx_XDECREF(__pyx_t_1);
13231 __Pyx_XDECREF(__pyx_t_2);
13232 __Pyx_AddTraceback("csamtools.Samfile.text.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13235 __Pyx_XGIVEREF(__pyx_r);
13236 __Pyx_TraceReturn(__pyx_r);
13237 __Pyx_RefNannyFinishContext();
13241 /* Python wrapper */
13242 static PyObject *__pyx_pw_9csamtools_7Samfile_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
13243 static PyObject *__pyx_pw_9csamtools_7Samfile_6header_1__get__(PyObject *__pyx_v_self) {
13244 PyObject *__pyx_r = 0;
13245 __Pyx_RefNannyDeclarations
13246 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13247 __pyx_r = __pyx_pf_9csamtools_7Samfile_6header___get__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
13248 __Pyx_RefNannyFinishContext();
13252 /* "csamtools.pyx":1255
13253 * a two-level dictionary.
13255 * def __get__(self): # <<<<<<<<<<<<<<
13256 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
13260 static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
13261 PyObject *__pyx_v_result = NULL;
13262 PyObject *__pyx_v_t = NULL;
13263 PyObject *__pyx_v_line = NULL;
13264 PyObject *__pyx_v_fields = NULL;
13265 PyObject *__pyx_v_record = NULL;
13266 PyObject *__pyx_v_x = NULL;
13267 PyObject *__pyx_v_field = NULL;
13268 PyObject *__pyx_v_key = NULL;
13269 PyObject *__pyx_v_value = NULL;
13270 PyObject *__pyx_v_sq = NULL;
13271 PyObject *__pyx_v_ref = NULL;
13272 PyObject *__pyx_v_length = NULL;
13273 PyObject *__pyx_r = NULL;
13274 __Pyx_RefNannyDeclarations
13275 PyObject *__pyx_t_1 = NULL;
13276 PyObject *__pyx_t_2 = NULL;
13279 Py_ssize_t __pyx_t_5;
13280 PyObject *(*__pyx_t_6)(PyObject *);
13281 PyObject *__pyx_t_7 = NULL;
13282 PyObject *__pyx_t_8 = NULL;
13283 PyObject *__pyx_t_9 = NULL;
13284 Py_ssize_t __pyx_t_10;
13285 PyObject *(*__pyx_t_11)(PyObject *);
13286 PyObject *__pyx_t_12 = NULL;
13287 PyObject *(*__pyx_t_13)(PyObject *);
13289 int __pyx_lineno = 0;
13290 const char *__pyx_filename = NULL;
13291 int __pyx_clineno = 0;
13292 __Pyx_TraceDeclarations
13293 __Pyx_RefNannySetupContext("__get__", 0);
13294 __Pyx_TraceCall("__get__", __pyx_f[0], 1255);
13296 /* "csamtools.pyx":1256
13298 * def __get__(self):
13299 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
13303 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13304 __Pyx_GOTREF(__pyx_t_1);
13305 __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 = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13306 __Pyx_GOTREF(__pyx_t_2);
13307 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13308 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13309 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13310 __pyx_t_4 = (!__pyx_t_3);
13312 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_98), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13313 __Pyx_GOTREF(__pyx_t_2);
13314 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
13315 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13316 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13321 /* "csamtools.pyx":1258
13322 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
13324 * result = {} # <<<<<<<<<<<<<<
13326 * if self.samfile.header.text != NULL:
13328 __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13329 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
13330 __pyx_v_result = __pyx_t_2;
13333 /* "csamtools.pyx":1260
13336 * if self.samfile.header.text != NULL: # <<<<<<<<<<<<<<
13337 * # convert to python string (note: call self.text to create 0-terminated string)
13340 __pyx_t_4 = (__pyx_v_self->samfile->header->text != NULL);
13343 /* "csamtools.pyx":1262
13344 * if self.samfile.header.text != NULL:
13345 * # convert to python string (note: call self.text to create 0-terminated string)
13346 * t = self.text # <<<<<<<<<<<<<<
13347 * for line in t.split("\n"):
13348 * if not line.strip(): continue
13350 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13351 __Pyx_GOTREF(__pyx_t_2);
13352 __pyx_v_t = __pyx_t_2;
13355 /* "csamtools.pyx":1263
13356 * # convert to python string (note: call self.text to create 0-terminated string)
13358 * for line in t.split("\n"): # <<<<<<<<<<<<<<
13359 * if not line.strip(): continue
13360 * assert line.startswith("@"), "header line without '@': '%s'" % line
13362 __pyx_t_2 = PyObject_GetAttr(__pyx_v_t, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13363 __Pyx_GOTREF(__pyx_t_2);
13364 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_99), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13365 __Pyx_GOTREF(__pyx_t_1);
13366 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13367 if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
13368 __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0;
13371 __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13372 __Pyx_GOTREF(__pyx_t_2);
13373 __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext;
13375 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13377 if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_2)) {
13378 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
13379 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
13380 } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_2)) {
13381 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
13382 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
13384 __pyx_t_1 = __pyx_t_6(__pyx_t_2);
13385 if (unlikely(!__pyx_t_1)) {
13386 if (PyErr_Occurred()) {
13387 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
13388 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13392 __Pyx_GOTREF(__pyx_t_1);
13394 __Pyx_XDECREF(__pyx_v_line);
13395 __pyx_v_line = __pyx_t_1;
13398 /* "csamtools.pyx":1264
13400 * for line in t.split("\n"):
13401 * if not line.strip(): continue # <<<<<<<<<<<<<<
13402 * assert line.startswith("@"), "header line without '@': '%s'" % line
13403 * fields = line[1:].split("\t")
13405 __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13406 __Pyx_GOTREF(__pyx_t_1);
13407 __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13408 __Pyx_GOTREF(__pyx_t_7);
13409 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13410 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13411 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13412 __pyx_t_3 = (!__pyx_t_4);
13414 goto __pyx_L5_continue;
13419 /* "csamtools.pyx":1265
13420 * for line in t.split("\n"):
13421 * if not line.strip(): continue
13422 * assert line.startswith("@"), "header line without '@': '%s'" % line # <<<<<<<<<<<<<<
13423 * fields = line[1:].split("\t")
13424 * record = fields[0]
13426 #ifndef CYTHON_WITHOUT_ASSERTIONS
13427 __pyx_t_7 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13428 __Pyx_GOTREF(__pyx_t_7);
13429 __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_101), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13430 __Pyx_GOTREF(__pyx_t_1);
13431 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13432 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13433 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13434 if (unlikely(!__pyx_t_3)) {
13435 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_102), __pyx_v_line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13436 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
13437 PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_1));
13438 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
13439 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13443 /* "csamtools.pyx":1266
13444 * if not line.strip(): continue
13445 * assert line.startswith("@"), "header line without '@': '%s'" % line
13446 * fields = line[1:].split("\t") # <<<<<<<<<<<<<<
13447 * record = fields[0]
13448 * assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line)
13450 __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_line, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13451 __Pyx_GOTREF(__pyx_t_1);
13452 __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13453 __Pyx_GOTREF(__pyx_t_7);
13454 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13455 __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_103), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13456 __Pyx_GOTREF(__pyx_t_1);
13457 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13458 __Pyx_XDECREF(__pyx_v_fields);
13459 __pyx_v_fields = __pyx_t_1;
13462 /* "csamtools.pyx":1267
13463 * assert line.startswith("@"), "header line without '@': '%s'" % line
13464 * fields = line[1:].split("\t")
13465 * record = fields[0] # <<<<<<<<<<<<<<
13466 * assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line)
13469 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fields, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13470 __Pyx_GOTREF(__pyx_t_1);
13471 __Pyx_XDECREF(__pyx_v_record);
13472 __pyx_v_record = __pyx_t_1;
13475 /* "csamtools.pyx":1268
13476 * fields = line[1:].split("\t")
13477 * record = fields[0]
13478 * assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line) # <<<<<<<<<<<<<<
13482 #ifndef CYTHON_WITHOUT_ASSERTIONS
13483 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13484 __Pyx_GOTREF(__pyx_t_1);
13485 __pyx_t_3 = ((PySequence_Contains(__pyx_t_1, __pyx_v_record))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13486 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13487 if (unlikely(!__pyx_t_3)) {
13488 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13489 __Pyx_GOTREF(__pyx_t_1);
13490 __Pyx_INCREF(__pyx_v_record);
13491 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_record);
13492 __Pyx_GIVEREF(__pyx_v_record);
13493 __Pyx_INCREF(__pyx_v_line);
13494 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_line);
13495 __Pyx_GIVEREF(__pyx_v_line);
13496 __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_104), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13497 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
13498 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
13499 PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_7));
13500 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
13501 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13505 /* "csamtools.pyx":1271
13508 * if record == "CO": # <<<<<<<<<<<<<<
13509 * if record not in result: result[record] = []
13510 * result[record].append( "\t".join( fields[1:] ) )
13512 __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_record, ((PyObject *)__pyx_n_s__CO), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13515 /* "csamtools.pyx":1272
13517 * if record == "CO":
13518 * if record not in result: result[record] = [] # <<<<<<<<<<<<<<
13519 * result[record].append( "\t".join( fields[1:] ) )
13522 __pyx_t_3 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_record))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13524 __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13525 __Pyx_GOTREF(__pyx_t_7);
13526 if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13527 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
13532 /* "csamtools.pyx":1273
13533 * if record == "CO":
13534 * if record not in result: result[record] = []
13535 * result[record].append( "\t".join( fields[1:] ) ) # <<<<<<<<<<<<<<
13539 __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_record); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13540 __Pyx_GOTREF(__pyx_t_7);
13541 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_5), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13542 __Pyx_GOTREF(__pyx_t_1);
13543 __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 = 1273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13544 __Pyx_GOTREF(__pyx_t_8);
13545 __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13546 __Pyx_GOTREF(__pyx_t_9);
13547 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
13548 __Pyx_GIVEREF(__pyx_t_8);
13550 __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13551 __Pyx_GOTREF(__pyx_t_8);
13552 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13553 __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
13554 __pyx_t_9 = __Pyx_PyObject_Append(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13555 __Pyx_GOTREF(__pyx_t_9);
13556 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13557 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13558 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13560 /* "csamtools.pyx":1274
13561 * if record not in result: result[record] = []
13562 * result[record].append( "\t".join( fields[1:] ) )
13563 * continue # <<<<<<<<<<<<<<
13565 * # the following is clumsy as generators do not work?
13567 goto __pyx_L5_continue;
13572 /* "csamtools.pyx":1277
13574 * # the following is clumsy as generators do not work?
13575 * x = {} # <<<<<<<<<<<<<<
13576 * for field in fields[1:]:
13577 * key, value = field.split(":",1)
13579 __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13580 __Pyx_GOTREF(((PyObject *)__pyx_t_9));
13581 __Pyx_XDECREF(((PyObject *)__pyx_v_x));
13582 __pyx_v_x = __pyx_t_9;
13585 /* "csamtools.pyx":1278
13586 * # the following is clumsy as generators do not work?
13588 * for field in fields[1:]: # <<<<<<<<<<<<<<
13589 * key, value = field.split(":",1)
13590 * # uppercase keys must be valid
13592 __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 = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13593 __Pyx_GOTREF(__pyx_t_9);
13594 if (PyList_CheckExact(__pyx_t_9) || PyTuple_CheckExact(__pyx_t_9)) {
13595 __pyx_t_8 = __pyx_t_9; __Pyx_INCREF(__pyx_t_8); __pyx_t_10 = 0;
13598 __pyx_t_10 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13599 __Pyx_GOTREF(__pyx_t_8);
13600 __pyx_t_11 = Py_TYPE(__pyx_t_8)->tp_iternext;
13602 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13604 if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_8)) {
13605 if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_8)) break;
13606 __pyx_t_9 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++;
13607 } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_8)) {
13608 if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
13609 __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++;
13611 __pyx_t_9 = __pyx_t_11(__pyx_t_8);
13612 if (unlikely(!__pyx_t_9)) {
13613 if (PyErr_Occurred()) {
13614 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
13615 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13619 __Pyx_GOTREF(__pyx_t_9);
13621 __Pyx_XDECREF(__pyx_v_field);
13622 __pyx_v_field = __pyx_t_9;
13625 /* "csamtools.pyx":1279
13627 * for field in fields[1:]:
13628 * key, value = field.split(":",1) # <<<<<<<<<<<<<<
13629 * # uppercase keys must be valid
13630 * # lowercase are permitted for user fields
13632 __pyx_t_9 = PyObject_GetAttr(__pyx_v_field, __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13633 __Pyx_GOTREF(__pyx_t_9);
13634 __pyx_t_7 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_106), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13635 __Pyx_GOTREF(__pyx_t_7);
13636 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13637 if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
13638 PyObject* sequence = __pyx_t_7;
13639 if (likely(PyTuple_CheckExact(sequence))) {
13640 if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
13641 if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
13642 else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
13643 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13645 __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
13646 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
13648 if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
13649 if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
13650 else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
13651 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13653 __pyx_t_9 = PyList_GET_ITEM(sequence, 0);
13654 __pyx_t_1 = PyList_GET_ITEM(sequence, 1);
13656 __Pyx_INCREF(__pyx_t_9);
13657 __Pyx_INCREF(__pyx_t_1);
13658 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13660 Py_ssize_t index = -1;
13661 __pyx_t_12 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13662 __Pyx_GOTREF(__pyx_t_12);
13663 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13664 __pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext;
13665 index = 0; __pyx_t_9 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_9)) goto __pyx_L12_unpacking_failed;
13666 __Pyx_GOTREF(__pyx_t_9);
13667 index = 1; __pyx_t_1 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_1)) goto __pyx_L12_unpacking_failed;
13668 __Pyx_GOTREF(__pyx_t_1);
13669 if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13670 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
13671 goto __pyx_L13_unpacking_done;
13672 __pyx_L12_unpacking_failed:;
13673 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
13674 if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
13675 if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
13676 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13677 __pyx_L13_unpacking_done:;
13679 __Pyx_XDECREF(__pyx_v_key);
13680 __pyx_v_key = __pyx_t_9;
13682 __Pyx_XDECREF(__pyx_v_value);
13683 __pyx_v_value = __pyx_t_1;
13686 /* "csamtools.pyx":1282
13687 * # uppercase keys must be valid
13688 * # lowercase are permitted for user fields
13689 * if key in VALID_HEADER_FIELDS[record]: # <<<<<<<<<<<<<<
13690 * x[key] = VALID_HEADER_FIELDS[record][key](value)
13691 * elif not key.isupper():
13693 __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13694 __Pyx_GOTREF(__pyx_t_7);
13695 __pyx_t_1 = PyObject_GetItem(__pyx_t_7, __pyx_v_record); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13696 __Pyx_GOTREF(__pyx_t_1);
13697 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13698 __pyx_t_3 = ((PySequence_Contains(__pyx_t_1, __pyx_v_key))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13699 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13702 /* "csamtools.pyx":1283
13703 * # lowercase are permitted for user fields
13704 * if key in VALID_HEADER_FIELDS[record]:
13705 * x[key] = VALID_HEADER_FIELDS[record][key](value) # <<<<<<<<<<<<<<
13706 * elif not key.isupper():
13709 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13710 __Pyx_GOTREF(__pyx_t_1);
13711 __pyx_t_7 = PyObject_GetItem(__pyx_t_1, __pyx_v_record); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13712 __Pyx_GOTREF(__pyx_t_7);
13713 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13714 __pyx_t_1 = PyObject_GetItem(__pyx_t_7, __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13715 __Pyx_GOTREF(__pyx_t_1);
13716 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13717 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13718 __Pyx_GOTREF(__pyx_t_7);
13719 __Pyx_INCREF(__pyx_v_value);
13720 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_value);
13721 __Pyx_GIVEREF(__pyx_v_value);
13722 __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13723 __Pyx_GOTREF(__pyx_t_9);
13724 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13725 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
13726 if (PyDict_SetItem(((PyObject *)__pyx_v_x), __pyx_v_key, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13727 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13731 /* "csamtools.pyx":1284
13732 * if key in VALID_HEADER_FIELDS[record]:
13733 * x[key] = VALID_HEADER_FIELDS[record][key](value)
13734 * elif not key.isupper(): # <<<<<<<<<<<<<<
13738 __pyx_t_9 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__isupper); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13739 __Pyx_GOTREF(__pyx_t_9);
13740 __pyx_t_7 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13741 __Pyx_GOTREF(__pyx_t_7);
13742 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13743 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13744 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13745 __pyx_t_4 = (!__pyx_t_3);
13748 /* "csamtools.pyx":1285
13749 * x[key] = VALID_HEADER_FIELDS[record][key](value)
13750 * elif not key.isupper():
13751 * x[key] = value # <<<<<<<<<<<<<<
13753 * raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) )
13755 if (PyDict_SetItem(((PyObject *)__pyx_v_x), __pyx_v_key, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13760 /* "csamtools.pyx":1287
13763 * raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) ) # <<<<<<<<<<<<<<
13765 * if VALID_HEADER_TYPES[record] == dict:
13767 __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13768 __Pyx_GOTREF(__pyx_t_7);
13769 __Pyx_INCREF(__pyx_v_key);
13770 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_key);
13771 __Pyx_GIVEREF(__pyx_v_key);
13772 __Pyx_INCREF(__pyx_v_record);
13773 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_record);
13774 __Pyx_GIVEREF(__pyx_v_record);
13775 __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_107), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13776 __Pyx_GOTREF(((PyObject *)__pyx_t_9));
13777 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
13778 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13779 __Pyx_GOTREF(__pyx_t_7);
13780 PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_9));
13781 __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
13783 __pyx_t_9 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13784 __Pyx_GOTREF(__pyx_t_9);
13785 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
13786 __Pyx_Raise(__pyx_t_9, 0, 0, 0);
13787 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13788 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13792 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13794 /* "csamtools.pyx":1289
13795 * raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) )
13797 * if VALID_HEADER_TYPES[record] == dict: # <<<<<<<<<<<<<<
13798 * if record in result:
13799 * raise ValueError( "multiple '%s' lines are not permitted" % record )
13801 __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 = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13802 __Pyx_GOTREF(__pyx_t_8);
13803 __pyx_t_9 = PyObject_GetItem(__pyx_t_8, __pyx_v_record); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13804 __Pyx_GOTREF(__pyx_t_9);
13805 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13806 __pyx_t_8 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)((PyObject*)(&PyDict_Type))), Py_EQ); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13807 __Pyx_GOTREF(__pyx_t_8);
13808 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13809 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13810 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13813 /* "csamtools.pyx":1290
13815 * if VALID_HEADER_TYPES[record] == dict:
13816 * if record in result: # <<<<<<<<<<<<<<
13817 * raise ValueError( "multiple '%s' lines are not permitted" % record )
13818 * result[record] = x
13820 __pyx_t_4 = ((PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_record))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13823 /* "csamtools.pyx":1291
13824 * if VALID_HEADER_TYPES[record] == dict:
13825 * if record in result:
13826 * raise ValueError( "multiple '%s' lines are not permitted" % record ) # <<<<<<<<<<<<<<
13827 * result[record] = x
13828 * elif VALID_HEADER_TYPES[record] == list:
13830 __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_108), __pyx_v_record); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13831 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
13832 __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13833 __Pyx_GOTREF(__pyx_t_9);
13834 PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8));
13835 __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
13837 __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 = 1291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13838 __Pyx_GOTREF(__pyx_t_8);
13839 __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
13840 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
13841 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13842 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13847 /* "csamtools.pyx":1292
13848 * if record in result:
13849 * raise ValueError( "multiple '%s' lines are not permitted" % record )
13850 * result[record] = x # <<<<<<<<<<<<<<
13851 * elif VALID_HEADER_TYPES[record] == list:
13852 * if record not in result: result[record] = []
13854 if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_v_x)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13858 /* "csamtools.pyx":1293
13859 * raise ValueError( "multiple '%s' lines are not permitted" % record )
13860 * result[record] = x
13861 * elif VALID_HEADER_TYPES[record] == list: # <<<<<<<<<<<<<<
13862 * if record not in result: result[record] = []
13863 * result[record].append( x )
13865 __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 = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13866 __Pyx_GOTREF(__pyx_t_8);
13867 __pyx_t_9 = PyObject_GetItem(__pyx_t_8, __pyx_v_record); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13868 __Pyx_GOTREF(__pyx_t_9);
13869 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13870 __pyx_t_8 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)((PyObject*)(&PyList_Type))), Py_EQ); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13871 __Pyx_GOTREF(__pyx_t_8);
13872 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13873 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13874 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13877 /* "csamtools.pyx":1294
13878 * result[record] = x
13879 * elif VALID_HEADER_TYPES[record] == list:
13880 * if record not in result: result[record] = [] # <<<<<<<<<<<<<<
13881 * result[record].append( x )
13884 __pyx_t_4 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_record))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13886 __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13887 __Pyx_GOTREF(__pyx_t_8);
13888 if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13889 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
13894 /* "csamtools.pyx":1295
13895 * elif VALID_HEADER_TYPES[record] == list:
13896 * if record not in result: result[record] = []
13897 * result[record].append( x ) # <<<<<<<<<<<<<<
13899 * # if there are no SQ lines in the header, add the reference names
13901 __pyx_t_8 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_record); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13902 __Pyx_GOTREF(__pyx_t_8);
13903 __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 = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13904 __Pyx_GOTREF(__pyx_t_9);
13905 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13906 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13910 __pyx_L5_continue:;
13912 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13914 /* "csamtools.pyx":1303
13915 * # SQ lines, the SQ information is not part of the textual header and thus
13916 * # are missing from the output. See issue 84.
13917 * if "SQ" not in result: # <<<<<<<<<<<<<<
13919 * for ref, length in zip( self.references, self.lengths ):
13921 __pyx_t_4 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_n_s__SQ)))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13924 /* "csamtools.pyx":1304
13925 * # are missing from the output. See issue 84.
13926 * if "SQ" not in result:
13927 * sq = [] # <<<<<<<<<<<<<<
13928 * for ref, length in zip( self.references, self.lengths ):
13929 * sq.append( {'LN': length, 'SN': ref } )
13931 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13932 __Pyx_GOTREF(__pyx_t_2);
13933 __pyx_v_sq = __pyx_t_2;
13936 /* "csamtools.pyx":1305
13937 * if "SQ" not in result:
13939 * for ref, length in zip( self.references, self.lengths ): # <<<<<<<<<<<<<<
13940 * sq.append( {'LN': length, 'SN': ref } )
13941 * result["SQ"] = sq
13943 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__references); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13944 __Pyx_GOTREF(__pyx_t_2);
13945 __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__lengths); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13946 __Pyx_GOTREF(__pyx_t_9);
13947 __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13948 __Pyx_GOTREF(__pyx_t_8);
13949 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
13950 __Pyx_GIVEREF(__pyx_t_2);
13951 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9);
13952 __Pyx_GIVEREF(__pyx_t_9);
13955 __pyx_t_9 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13956 __Pyx_GOTREF(__pyx_t_9);
13957 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
13958 if (PyList_CheckExact(__pyx_t_9) || PyTuple_CheckExact(__pyx_t_9)) {
13959 __pyx_t_8 = __pyx_t_9; __Pyx_INCREF(__pyx_t_8); __pyx_t_5 = 0;
13962 __pyx_t_5 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13963 __Pyx_GOTREF(__pyx_t_8);
13964 __pyx_t_6 = Py_TYPE(__pyx_t_8)->tp_iternext;
13966 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13968 if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_8)) {
13969 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_8)) break;
13970 __pyx_t_9 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++;
13971 } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_8)) {
13972 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
13973 __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_5); __Pyx_INCREF(__pyx_t_9); __pyx_t_5++;
13975 __pyx_t_9 = __pyx_t_6(__pyx_t_8);
13976 if (unlikely(!__pyx_t_9)) {
13977 if (PyErr_Occurred()) {
13978 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
13979 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13983 __Pyx_GOTREF(__pyx_t_9);
13985 if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
13986 PyObject* sequence = __pyx_t_9;
13987 if (likely(PyTuple_CheckExact(sequence))) {
13988 if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
13989 if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
13990 else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
13991 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13993 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
13994 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
13996 if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
13997 if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
13998 else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
13999 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14001 __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
14002 __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
14004 __Pyx_INCREF(__pyx_t_2);
14005 __Pyx_INCREF(__pyx_t_7);
14006 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14008 Py_ssize_t index = -1;
14009 __pyx_t_1 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14010 __Pyx_GOTREF(__pyx_t_1);
14011 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14012 __pyx_t_13 = Py_TYPE(__pyx_t_1)->tp_iternext;
14013 index = 0; __pyx_t_2 = __pyx_t_13(__pyx_t_1); if (unlikely(!__pyx_t_2)) goto __pyx_L21_unpacking_failed;
14014 __Pyx_GOTREF(__pyx_t_2);
14015 index = 1; __pyx_t_7 = __pyx_t_13(__pyx_t_1); if (unlikely(!__pyx_t_7)) goto __pyx_L21_unpacking_failed;
14016 __Pyx_GOTREF(__pyx_t_7);
14017 if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14018 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14019 goto __pyx_L22_unpacking_done;
14020 __pyx_L21_unpacking_failed:;
14021 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14022 if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
14023 if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
14024 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14025 __pyx_L22_unpacking_done:;
14027 __Pyx_XDECREF(__pyx_v_ref);
14028 __pyx_v_ref = __pyx_t_2;
14030 __Pyx_XDECREF(__pyx_v_length);
14031 __pyx_v_length = __pyx_t_7;
14034 /* "csamtools.pyx":1306
14036 * for ref, length in zip( self.references, self.lengths ):
14037 * sq.append( {'LN': length, 'SN': ref } ) # <<<<<<<<<<<<<<
14038 * result["SQ"] = sq
14041 __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14042 __Pyx_GOTREF(((PyObject *)__pyx_t_9));
14043 if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__LN), __pyx_v_length) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14044 if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__SN), __pyx_v_ref) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14045 __pyx_t_14 = PyList_Append(__pyx_v_sq, ((PyObject *)__pyx_t_9)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14046 __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
14048 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14050 /* "csamtools.pyx":1307
14051 * for ref, length in zip( self.references, self.lengths ):
14052 * sq.append( {'LN': length, 'SN': ref } )
14053 * result["SQ"] = sq # <<<<<<<<<<<<<<
14057 if (PyDict_SetItem(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_n_s__SQ), ((PyObject *)__pyx_v_sq)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14065 /* "csamtools.pyx":1309
14066 * result["SQ"] = sq
14068 * return result # <<<<<<<<<<<<<<
14070 * def _buildLine( self, fields, record ):
14072 __Pyx_XDECREF(__pyx_r);
14073 __Pyx_INCREF(((PyObject *)__pyx_v_result));
14074 __pyx_r = ((PyObject *)__pyx_v_result);
14077 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14080 __Pyx_XDECREF(__pyx_t_1);
14081 __Pyx_XDECREF(__pyx_t_2);
14082 __Pyx_XDECREF(__pyx_t_7);
14083 __Pyx_XDECREF(__pyx_t_8);
14084 __Pyx_XDECREF(__pyx_t_9);
14085 __Pyx_XDECREF(__pyx_t_12);
14086 __Pyx_AddTraceback("csamtools.Samfile.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14089 __Pyx_XDECREF(__pyx_v_result);
14090 __Pyx_XDECREF(__pyx_v_t);
14091 __Pyx_XDECREF(__pyx_v_line);
14092 __Pyx_XDECREF(__pyx_v_fields);
14093 __Pyx_XDECREF(__pyx_v_record);
14094 __Pyx_XDECREF(__pyx_v_x);
14095 __Pyx_XDECREF(__pyx_v_field);
14096 __Pyx_XDECREF(__pyx_v_key);
14097 __Pyx_XDECREF(__pyx_v_value);
14098 __Pyx_XDECREF(__pyx_v_sq);
14099 __Pyx_XDECREF(__pyx_v_ref);
14100 __Pyx_XDECREF(__pyx_v_length);
14101 __Pyx_XGIVEREF(__pyx_r);
14102 __Pyx_TraceReturn(__pyx_r);
14103 __Pyx_RefNannyFinishContext();
14107 /* Python wrapper */
14108 static PyObject *__pyx_pw_9csamtools_7Samfile_39_buildLine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
14109 static char __pyx_doc_9csamtools_7Samfile_38_buildLine[] = "Samfile._buildLine(self, fields, record)\nbuild a header line from *fields* dictionary for *record*";
14110 static PyObject *__pyx_pw_9csamtools_7Samfile_39_buildLine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
14111 PyObject *__pyx_v_fields = 0;
14112 PyObject *__pyx_v_record = 0;
14113 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fields,&__pyx_n_s__record,0};
14114 PyObject *__pyx_r = 0;
14115 __Pyx_RefNannyDeclarations
14116 __Pyx_RefNannySetupContext("_buildLine (wrapper)", 0);
14118 PyObject* values[2] = {0,0};
14119 if (unlikely(__pyx_kwds)) {
14120 Py_ssize_t kw_args;
14121 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
14122 switch (pos_args) {
14123 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14124 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14126 default: goto __pyx_L5_argtuple_error;
14128 kw_args = PyDict_Size(__pyx_kwds);
14129 switch (pos_args) {
14131 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fields);
14132 if (likely(values[0])) kw_args--;
14133 else goto __pyx_L5_argtuple_error;
14135 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__record);
14136 if (likely(values[1])) kw_args--;
14138 __Pyx_RaiseArgtupleInvalid("_buildLine", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14141 if (unlikely(kw_args > 0)) {
14142 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_buildLine") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14144 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
14145 goto __pyx_L5_argtuple_error;
14147 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14148 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14150 __pyx_v_fields = values[0];
14151 __pyx_v_record = values[1];
14153 goto __pyx_L4_argument_unpacking_done;
14154 __pyx_L5_argtuple_error:;
14155 __Pyx_RaiseArgtupleInvalid("_buildLine", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14157 __Pyx_AddTraceback("csamtools.Samfile._buildLine", __pyx_clineno, __pyx_lineno, __pyx_filename);
14158 __Pyx_RefNannyFinishContext();
14160 __pyx_L4_argument_unpacking_done:;
14161 __pyx_r = __pyx_pf_9csamtools_7Samfile_38_buildLine(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_fields, __pyx_v_record);
14162 __Pyx_RefNannyFinishContext();
14166 /* "csamtools.pyx":1311
14169 * def _buildLine( self, fields, record ): # <<<<<<<<<<<<<<
14170 * '''build a header line from *fields* dictionary for *record*'''
14174 static PyObject *__pyx_pf_9csamtools_7Samfile_38_buildLine(CYTHON_UNUSED struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_fields, PyObject *__pyx_v_record) {
14175 PyObject *__pyx_v_line = NULL;
14176 PyObject *__pyx_v_key = NULL;
14177 PyObject *__pyx_r = NULL;
14178 __Pyx_RefNannyDeclarations
14179 PyObject *__pyx_t_1 = NULL;
14180 PyObject *__pyx_t_2 = NULL;
14183 Py_ssize_t __pyx_t_5;
14184 PyObject *(*__pyx_t_6)(PyObject *);
14185 PyObject *__pyx_t_7 = NULL;
14187 int __pyx_lineno = 0;
14188 const char *__pyx_filename = NULL;
14189 int __pyx_clineno = 0;
14190 __Pyx_TraceDeclarations
14191 __Pyx_RefNannySetupContext("_buildLine", 0);
14192 __Pyx_TraceCall("_buildLine", __pyx_f[0], 1311);
14194 /* "csamtools.pyx":1315
14196 * # TODO: add checking for field and sort order
14197 * line = ["@%s" % record ] # <<<<<<<<<<<<<<
14199 * if record == "CO":
14201 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_109), __pyx_v_record); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14202 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
14203 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14204 __Pyx_GOTREF(__pyx_t_2);
14205 PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
14206 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
14208 __pyx_v_line = __pyx_t_2;
14211 /* "csamtools.pyx":1317
14212 * line = ["@%s" % record ]
14214 * if record == "CO": # <<<<<<<<<<<<<<
14215 * line.append( fields )
14218 __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_record, ((PyObject *)__pyx_n_s__CO), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14221 /* "csamtools.pyx":1318
14223 * if record == "CO":
14224 * line.append( fields ) # <<<<<<<<<<<<<<
14226 * elif record.islower():
14228 __pyx_t_4 = PyList_Append(__pyx_v_line, __pyx_v_fields); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14232 /* "csamtools.pyx":1320
14233 * line.append( fields )
14235 * elif record.islower(): # <<<<<<<<<<<<<<
14236 * for key in sorted(fields):
14237 * line.append( "%s:%s" % (key, str(fields[key])))
14239 __pyx_t_2 = PyObject_GetAttr(__pyx_v_record, __pyx_n_s__islower); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14240 __Pyx_GOTREF(__pyx_t_2);
14241 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14242 __Pyx_GOTREF(__pyx_t_1);
14243 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14244 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14245 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14248 /* "csamtools.pyx":1321
14250 * elif record.islower():
14251 * for key in sorted(fields): # <<<<<<<<<<<<<<
14252 * line.append( "%s:%s" % (key, str(fields[key])))
14255 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14256 __Pyx_GOTREF(__pyx_t_1);
14257 __Pyx_INCREF(__pyx_v_fields);
14258 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fields);
14259 __Pyx_GIVEREF(__pyx_v_fields);
14260 __pyx_t_2 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14261 __Pyx_GOTREF(__pyx_t_2);
14262 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
14263 if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
14264 __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
14267 __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14268 __Pyx_GOTREF(__pyx_t_1);
14269 __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
14271 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14273 if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_1)) {
14274 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
14275 __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
14276 } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) {
14277 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
14278 __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
14280 __pyx_t_2 = __pyx_t_6(__pyx_t_1);
14281 if (unlikely(!__pyx_t_2)) {
14282 if (PyErr_Occurred()) {
14283 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
14284 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14288 __Pyx_GOTREF(__pyx_t_2);
14290 __Pyx_XDECREF(__pyx_v_key);
14291 __pyx_v_key = __pyx_t_2;
14294 /* "csamtools.pyx":1322
14295 * elif record.islower():
14296 * for key in sorted(fields):
14297 * line.append( "%s:%s" % (key, str(fields[key]))) # <<<<<<<<<<<<<<
14301 __pyx_t_2 = PyObject_GetItem(__pyx_v_fields, __pyx_v_key); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14302 __Pyx_GOTREF(__pyx_t_2);
14303 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14304 __Pyx_GOTREF(__pyx_t_7);
14305 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
14306 __Pyx_GIVEREF(__pyx_t_2);
14308 __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14309 __Pyx_GOTREF(__pyx_t_2);
14310 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
14311 __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14312 __Pyx_GOTREF(__pyx_t_7);
14313 __Pyx_INCREF(__pyx_v_key);
14314 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_key);
14315 __Pyx_GIVEREF(__pyx_v_key);
14316 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
14317 __Pyx_GIVEREF(__pyx_t_2);
14319 __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_110), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14320 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
14321 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
14322 __pyx_t_4 = PyList_Append(__pyx_v_line, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14323 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
14325 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14330 /* "csamtools.pyx":1326
14332 * # write fields of the specification
14333 * for key in VALID_HEADER_ORDER[record]: # <<<<<<<<<<<<<<
14334 * if key in fields:
14335 * line.append( "%s:%s" % (key, str(fields[key])))
14337 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_ORDER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14338 __Pyx_GOTREF(__pyx_t_1);
14339 __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_record); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14340 __Pyx_GOTREF(__pyx_t_2);
14341 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14342 if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
14343 __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
14346 __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14347 __Pyx_GOTREF(__pyx_t_1);
14348 __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
14350 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14352 if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_1)) {
14353 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
14354 __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
14355 } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) {
14356 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
14357 __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
14359 __pyx_t_2 = __pyx_t_6(__pyx_t_1);
14360 if (unlikely(!__pyx_t_2)) {
14361 if (PyErr_Occurred()) {
14362 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
14363 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14367 __Pyx_GOTREF(__pyx_t_2);
14369 __Pyx_XDECREF(__pyx_v_key);
14370 __pyx_v_key = __pyx_t_2;
14373 /* "csamtools.pyx":1327
14374 * # write fields of the specification
14375 * for key in VALID_HEADER_ORDER[record]:
14376 * if key in fields: # <<<<<<<<<<<<<<
14377 * line.append( "%s:%s" % (key, str(fields[key])))
14378 * # write user fields
14380 __pyx_t_3 = ((PySequence_Contains(__pyx_v_fields, __pyx_v_key))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14383 /* "csamtools.pyx":1328
14384 * for key in VALID_HEADER_ORDER[record]:
14385 * if key in fields:
14386 * line.append( "%s:%s" % (key, str(fields[key]))) # <<<<<<<<<<<<<<
14387 * # write user fields
14388 * for key in fields:
14390 __pyx_t_2 = PyObject_GetItem(__pyx_v_fields, __pyx_v_key); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14391 __Pyx_GOTREF(__pyx_t_2);
14392 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14393 __Pyx_GOTREF(__pyx_t_7);
14394 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
14395 __Pyx_GIVEREF(__pyx_t_2);
14397 __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14398 __Pyx_GOTREF(__pyx_t_2);
14399 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
14400 __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14401 __Pyx_GOTREF(__pyx_t_7);
14402 __Pyx_INCREF(__pyx_v_key);
14403 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_key);
14404 __Pyx_GIVEREF(__pyx_v_key);
14405 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
14406 __Pyx_GIVEREF(__pyx_t_2);
14408 __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_110), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14409 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
14410 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
14411 __pyx_t_4 = PyList_Append(__pyx_v_line, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14412 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
14417 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14419 /* "csamtools.pyx":1330
14420 * line.append( "%s:%s" % (key, str(fields[key])))
14421 * # write user fields
14422 * for key in fields: # <<<<<<<<<<<<<<
14423 * if not key.isupper():
14424 * line.append( "%s:%s" % (key, str(fields[key])))
14426 if (PyList_CheckExact(__pyx_v_fields) || PyTuple_CheckExact(__pyx_v_fields)) {
14427 __pyx_t_1 = __pyx_v_fields; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
14430 __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_fields); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14431 __Pyx_GOTREF(__pyx_t_1);
14432 __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
14435 if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_1)) {
14436 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
14437 __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
14438 } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) {
14439 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
14440 __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++;
14442 __pyx_t_2 = __pyx_t_6(__pyx_t_1);
14443 if (unlikely(!__pyx_t_2)) {
14444 if (PyErr_Occurred()) {
14445 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
14446 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14450 __Pyx_GOTREF(__pyx_t_2);
14452 __Pyx_XDECREF(__pyx_v_key);
14453 __pyx_v_key = __pyx_t_2;
14456 /* "csamtools.pyx":1331
14457 * # write user fields
14458 * for key in fields:
14459 * if not key.isupper(): # <<<<<<<<<<<<<<
14460 * line.append( "%s:%s" % (key, str(fields[key])))
14463 __pyx_t_2 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__isupper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14464 __Pyx_GOTREF(__pyx_t_2);
14465 __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14466 __Pyx_GOTREF(__pyx_t_7);
14467 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14468 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14469 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14470 __pyx_t_8 = (!__pyx_t_3);
14473 /* "csamtools.pyx":1332
14474 * for key in fields:
14475 * if not key.isupper():
14476 * line.append( "%s:%s" % (key, str(fields[key]))) # <<<<<<<<<<<<<<
14478 * return "\t".join( line )
14480 __pyx_t_7 = PyObject_GetItem(__pyx_v_fields, __pyx_v_key); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14481 __Pyx_GOTREF(__pyx_t_7);
14482 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14483 __Pyx_GOTREF(__pyx_t_2);
14484 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
14485 __Pyx_GIVEREF(__pyx_t_7);
14487 __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14488 __Pyx_GOTREF(__pyx_t_7);
14489 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
14490 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14491 __Pyx_GOTREF(__pyx_t_2);
14492 __Pyx_INCREF(__pyx_v_key);
14493 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key);
14494 __Pyx_GIVEREF(__pyx_v_key);
14495 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7);
14496 __Pyx_GIVEREF(__pyx_t_7);
14498 __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_110), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14499 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
14500 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
14501 __pyx_t_4 = PyList_Append(__pyx_v_line, ((PyObject *)__pyx_t_7)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14502 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
14507 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14511 /* "csamtools.pyx":1334
14512 * line.append( "%s:%s" % (key, str(fields[key])))
14514 * return "\t".join( line ) # <<<<<<<<<<<<<<
14516 * cdef bam_header_t * _buildHeader( self, new_header ):
14518 __Pyx_XDECREF(__pyx_r);
14519 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_5), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14520 __Pyx_GOTREF(__pyx_t_1);
14521 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14522 __Pyx_GOTREF(__pyx_t_7);
14523 __Pyx_INCREF(((PyObject *)__pyx_v_line));
14524 PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_line));
14525 __Pyx_GIVEREF(((PyObject *)__pyx_v_line));
14526 __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14527 __Pyx_GOTREF(__pyx_t_2);
14528 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14529 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
14530 __pyx_r = __pyx_t_2;
14534 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14537 __Pyx_XDECREF(__pyx_t_1);
14538 __Pyx_XDECREF(__pyx_t_2);
14539 __Pyx_XDECREF(__pyx_t_7);
14540 __Pyx_AddTraceback("csamtools.Samfile._buildLine", __pyx_clineno, __pyx_lineno, __pyx_filename);
14543 __Pyx_XDECREF(__pyx_v_line);
14544 __Pyx_XDECREF(__pyx_v_key);
14545 __Pyx_XGIVEREF(__pyx_r);
14546 __Pyx_TraceReturn(__pyx_r);
14547 __Pyx_RefNannyFinishContext();
14551 /* "csamtools.pyx":1336
14552 * return "\t".join( line )
14554 * cdef bam_header_t * _buildHeader( self, new_header ): # <<<<<<<<<<<<<<
14555 * '''return a new header built from a dictionary in *new_header*.
14559 static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_new_header) {
14560 PyObject *__pyx_v_lines = NULL;
14561 bam_header_t *__pyx_v_dest;
14562 PyObject *__pyx_v_record = NULL;
14563 PyObject *__pyx_v_ttype = NULL;
14564 PyObject *__pyx_v_data = NULL;
14565 PyObject *__pyx_v_fields = NULL;
14566 PyObject *__pyx_v_text = NULL;
14567 PyObject *__pyx_v_btext = 0;
14568 PyObject *__pyx_v_bseqname = 0;
14569 PyObject *__pyx_v_seqs = NULL;
14571 PyObject *__pyx_v_seqname = NULL;
14572 PyObject *__pyx_v_seqlen = NULL;
14573 bam_header_t *__pyx_r;
14574 __Pyx_RefNannyDeclarations
14575 PyObject *__pyx_t_1 = NULL;
14576 PyObject *__pyx_t_2 = NULL;
14577 Py_ssize_t __pyx_t_3;
14578 PyObject *(*__pyx_t_4)(PyObject *);
14580 PyObject *__pyx_t_6 = NULL;
14581 PyObject *__pyx_t_7 = NULL;
14583 Py_ssize_t __pyx_t_9;
14584 PyObject *(*__pyx_t_10)(PyObject *);
14585 PyObject *__pyx_t_11 = NULL;
14586 PyObject *(*__pyx_t_12)(PyObject *);
14588 PyObject *__pyx_t_14 = NULL;
14589 PyObject *__pyx_t_15 = NULL;
14590 PyObject *__pyx_t_16 = NULL;
14592 PyObject *__pyx_t_18 = NULL;
14593 int32_t __pyx_t_19;
14594 uint32_t __pyx_t_20;
14595 int __pyx_lineno = 0;
14596 const char *__pyx_filename = NULL;
14597 int __pyx_clineno = 0;
14598 __Pyx_TraceDeclarations
14599 __Pyx_RefNannySetupContext("_buildHeader", 0);
14600 __Pyx_TraceCall("_buildHeader", __pyx_f[0], 1336);
14602 /* "csamtools.pyx":1342
14605 * lines = [] # <<<<<<<<<<<<<<
14607 * # check if hash exists
14609 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14610 __Pyx_GOTREF(__pyx_t_1);
14611 __pyx_v_lines = __pyx_t_1;
14614 /* "csamtools.pyx":1349
14615 * cdef bam_header_t * dest
14617 * dest = bam_header_init() # <<<<<<<<<<<<<<
14619 * # first: defined tags
14621 __pyx_v_dest = bam_header_init();
14623 /* "csamtools.pyx":1352
14625 * # first: defined tags
14626 * for record in VALID_HEADERS: # <<<<<<<<<<<<<<
14627 * if record in new_header:
14628 * ttype = VALID_HEADER_TYPES[record]
14630 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADERS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14631 __Pyx_GOTREF(__pyx_t_1);
14632 if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
14633 __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
14636 __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14637 __Pyx_GOTREF(__pyx_t_2);
14638 __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
14640 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14642 if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
14643 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
14644 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
14645 } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
14646 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
14647 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
14649 __pyx_t_1 = __pyx_t_4(__pyx_t_2);
14650 if (unlikely(!__pyx_t_1)) {
14651 if (PyErr_Occurred()) {
14652 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
14653 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14657 __Pyx_GOTREF(__pyx_t_1);
14659 __Pyx_XDECREF(__pyx_v_record);
14660 __pyx_v_record = __pyx_t_1;
14663 /* "csamtools.pyx":1353
14664 * # first: defined tags
14665 * for record in VALID_HEADERS:
14666 * if record in new_header: # <<<<<<<<<<<<<<
14667 * ttype = VALID_HEADER_TYPES[record]
14668 * data = new_header[record]
14670 __pyx_t_5 = ((PySequence_Contains(__pyx_v_new_header, __pyx_v_record))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14673 /* "csamtools.pyx":1354
14674 * for record in VALID_HEADERS:
14675 * if record in new_header:
14676 * ttype = VALID_HEADER_TYPES[record] # <<<<<<<<<<<<<<
14677 * data = new_header[record]
14678 * if type( data ) != type( ttype() ):
14680 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14681 __Pyx_GOTREF(__pyx_t_1);
14682 __pyx_t_6 = PyObject_GetItem(__pyx_t_1, __pyx_v_record); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14683 __Pyx_GOTREF(__pyx_t_6);
14684 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14685 __Pyx_XDECREF(__pyx_v_ttype);
14686 __pyx_v_ttype = __pyx_t_6;
14689 /* "csamtools.pyx":1355
14690 * if record in new_header:
14691 * ttype = VALID_HEADER_TYPES[record]
14692 * data = new_header[record] # <<<<<<<<<<<<<<
14693 * if type( data ) != type( ttype() ):
14694 * raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) )
14696 __pyx_t_6 = PyObject_GetItem(__pyx_v_new_header, __pyx_v_record); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14697 __Pyx_GOTREF(__pyx_t_6);
14698 __Pyx_XDECREF(__pyx_v_data);
14699 __pyx_v_data = __pyx_t_6;
14702 /* "csamtools.pyx":1356
14703 * ttype = VALID_HEADER_TYPES[record]
14704 * data = new_header[record]
14705 * if type( data ) != type( ttype() ): # <<<<<<<<<<<<<<
14706 * raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) )
14707 * if type( data ) is dict:
14709 __pyx_t_6 = PyObject_Call(__pyx_v_ttype, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14710 __Pyx_GOTREF(__pyx_t_6);
14711 __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_data)), ((PyObject *)Py_TYPE(__pyx_t_6)), Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14712 __Pyx_GOTREF(__pyx_t_1);
14713 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14714 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14715 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14718 /* "csamtools.pyx":1357
14719 * data = new_header[record]
14720 * if type( data ) != type( ttype() ):
14721 * raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) ) # <<<<<<<<<<<<<<
14722 * if type( data ) is dict:
14723 * lines.append( self._buildLine( data, record ) )
14725 __pyx_t_1 = PyObject_Call(__pyx_v_ttype, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14726 __Pyx_GOTREF(__pyx_t_1);
14727 __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14728 __Pyx_GOTREF(__pyx_t_6);
14729 __Pyx_INCREF(__pyx_v_record);
14730 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_record);
14731 __Pyx_GIVEREF(__pyx_v_record);
14732 __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_data)));
14733 PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)Py_TYPE(__pyx_v_data)));
14734 __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_data)));
14735 __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_t_1)));
14736 PyTuple_SET_ITEM(__pyx_t_6, 2, ((PyObject *)Py_TYPE(__pyx_t_1)));
14737 __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_t_1)));
14738 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14739 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_111), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14740 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
14741 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
14742 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14743 __Pyx_GOTREF(__pyx_t_6);
14744 PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1));
14745 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
14747 __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14748 __Pyx_GOTREF(__pyx_t_1);
14749 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
14750 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14751 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14752 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14757 /* "csamtools.pyx":1358
14758 * if type( data ) != type( ttype() ):
14759 * raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) )
14760 * if type( data ) is dict: # <<<<<<<<<<<<<<
14761 * lines.append( self._buildLine( data, record ) )
14764 __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_data)) == ((PyObject *)((PyObject*)(&PyDict_Type))));
14767 /* "csamtools.pyx":1359
14768 * raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) )
14769 * if type( data ) is dict:
14770 * lines.append( self._buildLine( data, record ) ) # <<<<<<<<<<<<<<
14772 * for fields in new_header[record]:
14774 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___buildLine); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14775 __Pyx_GOTREF(__pyx_t_1);
14776 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14777 __Pyx_GOTREF(__pyx_t_6);
14778 __Pyx_INCREF(__pyx_v_data);
14779 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_data);
14780 __Pyx_GIVEREF(__pyx_v_data);
14781 __Pyx_INCREF(__pyx_v_record);
14782 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_record);
14783 __Pyx_GIVEREF(__pyx_v_record);
14784 __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14785 __Pyx_GOTREF(__pyx_t_7);
14786 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14787 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
14788 __pyx_t_8 = PyList_Append(__pyx_v_lines, __pyx_t_7); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14789 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14794 /* "csamtools.pyx":1361
14795 * lines.append( self._buildLine( data, record ) )
14797 * for fields in new_header[record]: # <<<<<<<<<<<<<<
14798 * lines.append( self._buildLine( fields, record ) )
14801 __pyx_t_7 = PyObject_GetItem(__pyx_v_new_header, __pyx_v_record); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14802 __Pyx_GOTREF(__pyx_t_7);
14803 if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) {
14804 __pyx_t_6 = __pyx_t_7; __Pyx_INCREF(__pyx_t_6); __pyx_t_9 = 0;
14807 __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14808 __Pyx_GOTREF(__pyx_t_6);
14809 __pyx_t_10 = Py_TYPE(__pyx_t_6)->tp_iternext;
14811 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14813 if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_6)) {
14814 if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_6)) break;
14815 __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++;
14816 } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_6)) {
14817 if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
14818 __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++;
14820 __pyx_t_7 = __pyx_t_10(__pyx_t_6);
14821 if (unlikely(!__pyx_t_7)) {
14822 if (PyErr_Occurred()) {
14823 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
14824 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14828 __Pyx_GOTREF(__pyx_t_7);
14830 __Pyx_XDECREF(__pyx_v_fields);
14831 __pyx_v_fields = __pyx_t_7;
14834 /* "csamtools.pyx":1362
14836 * for fields in new_header[record]:
14837 * lines.append( self._buildLine( fields, record ) ) # <<<<<<<<<<<<<<
14839 * # then: user tags (lower case), sorted alphabetically
14841 __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___buildLine); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14842 __Pyx_GOTREF(__pyx_t_7);
14843 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14844 __Pyx_GOTREF(__pyx_t_1);
14845 __Pyx_INCREF(__pyx_v_fields);
14846 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fields);
14847 __Pyx_GIVEREF(__pyx_v_fields);
14848 __Pyx_INCREF(__pyx_v_record);
14849 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_record);
14850 __Pyx_GIVEREF(__pyx_v_record);
14851 __pyx_t_11 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14852 __Pyx_GOTREF(__pyx_t_11);
14853 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14854 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
14855 __pyx_t_8 = PyList_Append(__pyx_v_lines, __pyx_t_11); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14856 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
14858 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14865 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14867 /* "csamtools.pyx":1365
14869 * # then: user tags (lower case), sorted alphabetically
14870 * for record, data in sorted(new_header.items()): # <<<<<<<<<<<<<<
14871 * if record in VALID_HEADERS: continue
14872 * if type( data ) is dict:
14874 __pyx_t_2 = PyObject_GetAttr(__pyx_v_new_header, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14875 __Pyx_GOTREF(__pyx_t_2);
14876 __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14877 __Pyx_GOTREF(__pyx_t_6);
14878 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14879 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14880 __Pyx_GOTREF(__pyx_t_2);
14881 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
14882 __Pyx_GIVEREF(__pyx_t_6);
14884 __pyx_t_6 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14885 __Pyx_GOTREF(__pyx_t_6);
14886 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
14887 if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
14888 __pyx_t_2 = __pyx_t_6; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
14891 __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14892 __Pyx_GOTREF(__pyx_t_2);
14893 __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
14895 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14897 if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
14898 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
14899 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
14900 } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
14901 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
14902 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
14904 __pyx_t_6 = __pyx_t_4(__pyx_t_2);
14905 if (unlikely(!__pyx_t_6)) {
14906 if (PyErr_Occurred()) {
14907 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
14908 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14912 __Pyx_GOTREF(__pyx_t_6);
14914 if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
14915 PyObject* sequence = __pyx_t_6;
14916 if (likely(PyTuple_CheckExact(sequence))) {
14917 if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
14918 if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
14919 else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
14920 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14922 __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0);
14923 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
14925 if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
14926 if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
14927 else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
14928 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14930 __pyx_t_11 = PyList_GET_ITEM(sequence, 0);
14931 __pyx_t_1 = PyList_GET_ITEM(sequence, 1);
14933 __Pyx_INCREF(__pyx_t_11);
14934 __Pyx_INCREF(__pyx_t_1);
14935 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14937 Py_ssize_t index = -1;
14938 __pyx_t_7 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14939 __Pyx_GOTREF(__pyx_t_7);
14940 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14941 __pyx_t_12 = Py_TYPE(__pyx_t_7)->tp_iternext;
14942 index = 0; __pyx_t_11 = __pyx_t_12(__pyx_t_7); if (unlikely(!__pyx_t_11)) goto __pyx_L12_unpacking_failed;
14943 __Pyx_GOTREF(__pyx_t_11);
14944 index = 1; __pyx_t_1 = __pyx_t_12(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L12_unpacking_failed;
14945 __Pyx_GOTREF(__pyx_t_1);
14946 if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14947 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14948 goto __pyx_L13_unpacking_done;
14949 __pyx_L12_unpacking_failed:;
14950 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14951 if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
14952 if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
14953 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14954 __pyx_L13_unpacking_done:;
14956 __Pyx_XDECREF(__pyx_v_record);
14957 __pyx_v_record = __pyx_t_11;
14959 __Pyx_XDECREF(__pyx_v_data);
14960 __pyx_v_data = __pyx_t_1;
14963 /* "csamtools.pyx":1366
14964 * # then: user tags (lower case), sorted alphabetically
14965 * for record, data in sorted(new_header.items()):
14966 * if record in VALID_HEADERS: continue # <<<<<<<<<<<<<<
14967 * if type( data ) is dict:
14968 * lines.append( self._buildLine( data, record ) )
14970 __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADERS); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14971 __Pyx_GOTREF(__pyx_t_6);
14972 __pyx_t_5 = ((PySequence_Contains(__pyx_t_6, __pyx_v_record))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14973 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14975 goto __pyx_L10_continue;
14980 /* "csamtools.pyx":1367
14981 * for record, data in sorted(new_header.items()):
14982 * if record in VALID_HEADERS: continue
14983 * if type( data ) is dict: # <<<<<<<<<<<<<<
14984 * lines.append( self._buildLine( data, record ) )
14987 __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_data)) == ((PyObject *)((PyObject*)(&PyDict_Type))));
14990 /* "csamtools.pyx":1368
14991 * if record in VALID_HEADERS: continue
14992 * if type( data ) is dict:
14993 * lines.append( self._buildLine( data, record ) ) # <<<<<<<<<<<<<<
14995 * for fields in new_header[record]:
14997 __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___buildLine); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14998 __Pyx_GOTREF(__pyx_t_6);
14999 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15000 __Pyx_GOTREF(__pyx_t_1);
15001 __Pyx_INCREF(__pyx_v_data);
15002 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_data);
15003 __Pyx_GIVEREF(__pyx_v_data);
15004 __Pyx_INCREF(__pyx_v_record);
15005 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_record);
15006 __Pyx_GIVEREF(__pyx_v_record);
15007 __pyx_t_11 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15008 __Pyx_GOTREF(__pyx_t_11);
15009 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15010 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
15011 __pyx_t_8 = PyList_Append(__pyx_v_lines, __pyx_t_11); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15012 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
15017 /* "csamtools.pyx":1370
15018 * lines.append( self._buildLine( data, record ) )
15020 * for fields in new_header[record]: # <<<<<<<<<<<<<<
15021 * lines.append( self._buildLine( fields, record ) )
15024 __pyx_t_11 = PyObject_GetItem(__pyx_v_new_header, __pyx_v_record); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15025 __Pyx_GOTREF(__pyx_t_11);
15026 if (PyList_CheckExact(__pyx_t_11) || PyTuple_CheckExact(__pyx_t_11)) {
15027 __pyx_t_1 = __pyx_t_11; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0;
15030 __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15031 __Pyx_GOTREF(__pyx_t_1);
15032 __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext;
15034 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
15036 if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_1)) {
15037 if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break;
15038 __pyx_t_11 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_11); __pyx_t_9++;
15039 } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_1)) {
15040 if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
15041 __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_11); __pyx_t_9++;
15043 __pyx_t_11 = __pyx_t_10(__pyx_t_1);
15044 if (unlikely(!__pyx_t_11)) {
15045 if (PyErr_Occurred()) {
15046 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
15047 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15051 __Pyx_GOTREF(__pyx_t_11);
15053 __Pyx_XDECREF(__pyx_v_fields);
15054 __pyx_v_fields = __pyx_t_11;
15057 /* "csamtools.pyx":1371
15059 * for fields in new_header[record]:
15060 * lines.append( self._buildLine( fields, record ) ) # <<<<<<<<<<<<<<
15062 * text = "\n".join(lines) + "\n"
15064 __pyx_t_11 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___buildLine); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15065 __Pyx_GOTREF(__pyx_t_11);
15066 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15067 __Pyx_GOTREF(__pyx_t_6);
15068 __Pyx_INCREF(__pyx_v_fields);
15069 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_fields);
15070 __Pyx_GIVEREF(__pyx_v_fields);
15071 __Pyx_INCREF(__pyx_v_record);
15072 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_record);
15073 __Pyx_GIVEREF(__pyx_v_record);
15074 __pyx_t_7 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15075 __Pyx_GOTREF(__pyx_t_7);
15076 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
15077 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
15078 __pyx_t_8 = PyList_Append(__pyx_v_lines, __pyx_t_7); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15079 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
15081 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15084 __pyx_L10_continue:;
15086 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15088 /* "csamtools.pyx":1373
15089 * lines.append( self._buildLine( fields, record ) )
15091 * text = "\n".join(lines) + "\n" # <<<<<<<<<<<<<<
15092 * if dest.text != NULL: free( dest.text )
15093 * dest.text = <char*>calloc( len(text), sizeof(char))
15095 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_6), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15096 __Pyx_GOTREF(__pyx_t_2);
15097 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15098 __Pyx_GOTREF(__pyx_t_1);
15099 __Pyx_INCREF(((PyObject *)__pyx_v_lines));
15100 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_lines));
15101 __Pyx_GIVEREF(((PyObject *)__pyx_v_lines));
15102 __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15103 __Pyx_GOTREF(__pyx_t_7);
15104 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15105 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
15106 __pyx_t_1 = PyNumber_Add(__pyx_t_7, ((PyObject *)__pyx_kp_s_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15107 __Pyx_GOTREF(__pyx_t_1);
15108 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
15109 __pyx_v_text = __pyx_t_1;
15112 /* "csamtools.pyx":1374
15114 * text = "\n".join(lines) + "\n"
15115 * if dest.text != NULL: free( dest.text ) # <<<<<<<<<<<<<<
15116 * dest.text = <char*>calloc( len(text), sizeof(char))
15117 * dest.l_text = len(text)
15119 __pyx_t_5 = (__pyx_v_dest->text != NULL);
15121 free(__pyx_v_dest->text);
15126 /* "csamtools.pyx":1375
15127 * text = "\n".join(lines) + "\n"
15128 * if dest.text != NULL: free( dest.text )
15129 * dest.text = <char*>calloc( len(text), sizeof(char)) # <<<<<<<<<<<<<<
15130 * dest.l_text = len(text)
15131 * cdef bytes btext = text.encode('ascii')
15133 __pyx_t_3 = PyObject_Length(__pyx_v_text); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15134 __pyx_v_dest->text = ((char *)calloc(__pyx_t_3, (sizeof(char))));
15136 /* "csamtools.pyx":1376
15137 * if dest.text != NULL: free( dest.text )
15138 * dest.text = <char*>calloc( len(text), sizeof(char))
15139 * dest.l_text = len(text) # <<<<<<<<<<<<<<
15140 * cdef bytes btext = text.encode('ascii')
15141 * strncpy( dest.text, btext, dest.l_text )
15143 __pyx_t_3 = PyObject_Length(__pyx_v_text); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15144 __pyx_v_dest->l_text = __pyx_t_3;
15146 /* "csamtools.pyx":1377
15147 * dest.text = <char*>calloc( len(text), sizeof(char))
15148 * dest.l_text = len(text)
15149 * cdef bytes btext = text.encode('ascii') # <<<<<<<<<<<<<<
15150 * strncpy( dest.text, btext, dest.l_text )
15153 __pyx_t_1 = PyObject_GetAttr(__pyx_v_text, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15154 __Pyx_GOTREF(__pyx_t_1);
15155 __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_112), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15156 __Pyx_GOTREF(__pyx_t_7);
15157 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15158 if (!(likely(PyBytes_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_7)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15159 __pyx_v_btext = ((PyObject*)__pyx_t_7);
15162 /* "csamtools.pyx":1378
15163 * dest.l_text = len(text)
15164 * cdef bytes btext = text.encode('ascii')
15165 * strncpy( dest.text, btext, dest.l_text ) # <<<<<<<<<<<<<<
15167 * cdef bytes bseqname
15169 __pyx_t_13 = PyBytes_AsString(((PyObject *)__pyx_v_btext)); if (unlikely((!__pyx_t_13) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15170 strncpy(__pyx_v_dest->text, __pyx_t_13, __pyx_v_dest->l_text);
15172 /* "csamtools.pyx":1382
15173 * cdef bytes bseqname
15174 * # collect targets
15175 * if "SQ" in new_header: # <<<<<<<<<<<<<<
15177 * for fields in new_header["SQ"]:
15179 __pyx_t_5 = ((PySequence_Contains(__pyx_v_new_header, ((PyObject *)__pyx_n_s__SQ)))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15182 /* "csamtools.pyx":1383
15183 * # collect targets
15184 * if "SQ" in new_header:
15185 * seqs = [] # <<<<<<<<<<<<<<
15186 * for fields in new_header["SQ"]:
15189 __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15190 __Pyx_GOTREF(__pyx_t_7);
15191 __pyx_v_seqs = __pyx_t_7;
15194 /* "csamtools.pyx":1384
15195 * if "SQ" in new_header:
15197 * for fields in new_header["SQ"]: # <<<<<<<<<<<<<<
15199 * seqs.append( (fields["SN"], fields["LN"] ) )
15201 __pyx_t_7 = PyObject_GetItem(__pyx_v_new_header, ((PyObject *)__pyx_n_s__SQ)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15202 __Pyx_GOTREF(__pyx_t_7);
15203 if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) {
15204 __pyx_t_1 = __pyx_t_7; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
15207 __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15208 __Pyx_GOTREF(__pyx_t_1);
15209 __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
15211 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
15213 if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
15214 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
15215 __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
15216 } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
15217 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
15218 __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
15220 __pyx_t_7 = __pyx_t_4(__pyx_t_1);
15221 if (unlikely(!__pyx_t_7)) {
15222 if (PyErr_Occurred()) {
15223 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
15224 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15228 __Pyx_GOTREF(__pyx_t_7);
15230 __Pyx_XDECREF(__pyx_v_fields);
15231 __pyx_v_fields = __pyx_t_7;
15234 /* "csamtools.pyx":1385
15236 * for fields in new_header["SQ"]:
15237 * try: # <<<<<<<<<<<<<<
15238 * seqs.append( (fields["SN"], fields["LN"] ) )
15242 __Pyx_ExceptionSave(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
15243 __Pyx_XGOTREF(__pyx_t_14);
15244 __Pyx_XGOTREF(__pyx_t_15);
15245 __Pyx_XGOTREF(__pyx_t_16);
15248 /* "csamtools.pyx":1386
15249 * for fields in new_header["SQ"]:
15251 * seqs.append( (fields["SN"], fields["LN"] ) ) # <<<<<<<<<<<<<<
15253 * raise KeyError( "incomplete sequence information in '%s'" % str(fields))
15255 __pyx_t_7 = PyObject_GetItem(__pyx_v_fields, ((PyObject *)__pyx_n_s__SN)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
15256 __Pyx_GOTREF(__pyx_t_7);
15257 __pyx_t_2 = PyObject_GetItem(__pyx_v_fields, ((PyObject *)__pyx_n_s__LN)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
15258 __Pyx_GOTREF(__pyx_t_2);
15259 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
15260 __Pyx_GOTREF(__pyx_t_6);
15261 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
15262 __Pyx_GIVEREF(__pyx_t_7);
15263 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
15264 __Pyx_GIVEREF(__pyx_t_2);
15267 __pyx_t_8 = PyList_Append(__pyx_v_seqs, ((PyObject *)__pyx_t_6)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
15268 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
15270 __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
15271 __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
15272 __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
15273 goto __pyx_L29_try_end;
15275 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
15276 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
15277 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
15278 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
15280 /* "csamtools.pyx":1387
15282 * seqs.append( (fields["SN"], fields["LN"] ) )
15283 * except KeyError: # <<<<<<<<<<<<<<
15284 * raise KeyError( "incomplete sequence information in '%s'" % str(fields))
15287 __pyx_t_17 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
15289 __Pyx_AddTraceback("csamtools.Samfile._buildHeader", __pyx_clineno, __pyx_lineno, __pyx_filename);
15290 if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_2, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
15291 __Pyx_GOTREF(__pyx_t_6);
15292 __Pyx_GOTREF(__pyx_t_2);
15293 __Pyx_GOTREF(__pyx_t_7);
15295 /* "csamtools.pyx":1388
15296 * seqs.append( (fields["SN"], fields["LN"] ) )
15298 * raise KeyError( "incomplete sequence information in '%s'" % str(fields)) # <<<<<<<<<<<<<<
15300 * dest.n_targets = len(seqs)
15302 __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
15303 __Pyx_GOTREF(__pyx_t_11);
15304 __Pyx_INCREF(__pyx_v_fields);
15305 PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_fields);
15306 __Pyx_GIVEREF(__pyx_v_fields);
15307 __pyx_t_18 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
15308 __Pyx_GOTREF(__pyx_t_18);
15309 __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
15310 __pyx_t_11 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_113), __pyx_t_18); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
15311 __Pyx_GOTREF(((PyObject *)__pyx_t_11));
15312 __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
15313 __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
15314 __Pyx_GOTREF(__pyx_t_18);
15315 PyTuple_SET_ITEM(__pyx_t_18, 0, ((PyObject *)__pyx_t_11));
15316 __Pyx_GIVEREF(((PyObject *)__pyx_t_11));
15318 __pyx_t_11 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
15319 __Pyx_GOTREF(__pyx_t_11);
15320 __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
15321 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
15322 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
15323 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
15324 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15325 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15326 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
15327 goto __pyx_L23_exception_handled;
15329 __pyx_L24_except_error:;
15330 __Pyx_XGIVEREF(__pyx_t_14);
15331 __Pyx_XGIVEREF(__pyx_t_15);
15332 __Pyx_XGIVEREF(__pyx_t_16);
15333 __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
15334 goto __pyx_L1_error;
15335 __pyx_L23_exception_handled:;
15336 __Pyx_XGIVEREF(__pyx_t_14);
15337 __Pyx_XGIVEREF(__pyx_t_15);
15338 __Pyx_XGIVEREF(__pyx_t_16);
15339 __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
15340 __pyx_L29_try_end:;
15343 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15345 /* "csamtools.pyx":1390
15346 * raise KeyError( "incomplete sequence information in '%s'" % str(fields))
15348 * dest.n_targets = len(seqs) # <<<<<<<<<<<<<<
15349 * dest.target_name = <char**>calloc( dest.n_targets, sizeof(char*) )
15350 * dest.target_len = <uint32_t*>calloc( dest.n_targets, sizeof(uint32_t) )
15352 __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_seqs));
15353 __pyx_v_dest->n_targets = __pyx_t_3;
15355 /* "csamtools.pyx":1391
15357 * dest.n_targets = len(seqs)
15358 * dest.target_name = <char**>calloc( dest.n_targets, sizeof(char*) ) # <<<<<<<<<<<<<<
15359 * dest.target_len = <uint32_t*>calloc( dest.n_targets, sizeof(uint32_t) )
15362 __pyx_v_dest->target_name = ((char **)calloc(__pyx_v_dest->n_targets, (sizeof(char *))));
15364 /* "csamtools.pyx":1392
15365 * dest.n_targets = len(seqs)
15366 * dest.target_name = <char**>calloc( dest.n_targets, sizeof(char*) )
15367 * dest.target_len = <uint32_t*>calloc( dest.n_targets, sizeof(uint32_t) ) # <<<<<<<<<<<<<<
15369 * for x from 0 <= x < dest.n_targets:
15371 __pyx_v_dest->target_len = ((uint32_t *)calloc(__pyx_v_dest->n_targets, (sizeof(uint32_t))));
15373 /* "csamtools.pyx":1394
15374 * dest.target_len = <uint32_t*>calloc( dest.n_targets, sizeof(uint32_t) )
15376 * for x from 0 <= x < dest.n_targets: # <<<<<<<<<<<<<<
15377 * seqname, seqlen = seqs[x]
15378 * dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) )
15380 __pyx_t_19 = __pyx_v_dest->n_targets;
15381 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_19; __pyx_v_x++) {
15383 /* "csamtools.pyx":1395
15385 * for x from 0 <= x < dest.n_targets:
15386 * seqname, seqlen = seqs[x] # <<<<<<<<<<<<<<
15387 * dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) )
15388 * bseqname = seqname.encode('ascii')
15390 __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_seqs), __pyx_v_x, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15391 __Pyx_GOTREF(__pyx_t_1);
15392 if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
15393 PyObject* sequence = __pyx_t_1;
15394 if (likely(PyTuple_CheckExact(sequence))) {
15395 if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
15396 if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
15397 else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
15398 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15400 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
15401 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
15403 if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
15404 if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
15405 else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
15406 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15408 __pyx_t_7 = PyList_GET_ITEM(sequence, 0);
15409 __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
15411 __Pyx_INCREF(__pyx_t_7);
15412 __Pyx_INCREF(__pyx_t_2);
15413 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15415 Py_ssize_t index = -1;
15416 __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15417 __Pyx_GOTREF(__pyx_t_6);
15418 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15419 __pyx_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext;
15420 index = 0; __pyx_t_7 = __pyx_t_12(__pyx_t_6); if (unlikely(!__pyx_t_7)) goto __pyx_L34_unpacking_failed;
15421 __Pyx_GOTREF(__pyx_t_7);
15422 index = 1; __pyx_t_2 = __pyx_t_12(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L34_unpacking_failed;
15423 __Pyx_GOTREF(__pyx_t_2);
15424 if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15425 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15426 goto __pyx_L35_unpacking_done;
15427 __pyx_L34_unpacking_failed:;
15428 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15429 if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
15430 if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
15431 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15432 __pyx_L35_unpacking_done:;
15434 __Pyx_XDECREF(__pyx_v_seqname);
15435 __pyx_v_seqname = __pyx_t_7;
15437 __Pyx_XDECREF(__pyx_v_seqlen);
15438 __pyx_v_seqlen = __pyx_t_2;
15441 /* "csamtools.pyx":1396
15442 * for x from 0 <= x < dest.n_targets:
15443 * seqname, seqlen = seqs[x]
15444 * dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) ) # <<<<<<<<<<<<<<
15445 * bseqname = seqname.encode('ascii')
15446 * strncpy( dest.target_name[x], bseqname, len(seqname) + 1 )
15448 __pyx_t_3 = PyObject_Length(__pyx_v_seqname); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15449 (__pyx_v_dest->target_name[__pyx_v_x]) = ((char *)calloc((__pyx_t_3 + 1), (sizeof(char))));
15451 /* "csamtools.pyx":1397
15452 * seqname, seqlen = seqs[x]
15453 * dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) )
15454 * bseqname = seqname.encode('ascii') # <<<<<<<<<<<<<<
15455 * strncpy( dest.target_name[x], bseqname, len(seqname) + 1 )
15456 * dest.target_len[x] = seqlen
15458 __pyx_t_1 = PyObject_GetAttr(__pyx_v_seqname, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15459 __Pyx_GOTREF(__pyx_t_1);
15460 __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_114), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15461 __Pyx_GOTREF(__pyx_t_2);
15462 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15463 if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15464 __Pyx_XDECREF(((PyObject *)__pyx_v_bseqname));
15465 __pyx_v_bseqname = ((PyObject*)__pyx_t_2);
15468 /* "csamtools.pyx":1398
15469 * dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) )
15470 * bseqname = seqname.encode('ascii')
15471 * strncpy( dest.target_name[x], bseqname, len(seqname) + 1 ) # <<<<<<<<<<<<<<
15472 * dest.target_len[x] = seqlen
15475 __pyx_t_13 = PyBytes_AsString(((PyObject *)__pyx_v_bseqname)); if (unlikely((!__pyx_t_13) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15476 __pyx_t_3 = PyObject_Length(__pyx_v_seqname); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15477 strncpy((__pyx_v_dest->target_name[__pyx_v_x]), __pyx_t_13, (__pyx_t_3 + 1));
15479 /* "csamtools.pyx":1399
15480 * bseqname = seqname.encode('ascii')
15481 * strncpy( dest.target_name[x], bseqname, len(seqname) + 1 )
15482 * dest.target_len[x] = seqlen # <<<<<<<<<<<<<<
15486 __pyx_t_20 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_seqlen); if (unlikely((__pyx_t_20 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15487 (__pyx_v_dest->target_len[__pyx_v_x]) = __pyx_t_20;
15493 /* "csamtools.pyx":1401
15494 * dest.target_len[x] = seqlen
15496 * return dest # <<<<<<<<<<<<<<
15498 * ###############################################################
15500 __pyx_r = __pyx_v_dest;
15506 __Pyx_XDECREF(__pyx_t_1);
15507 __Pyx_XDECREF(__pyx_t_2);
15508 __Pyx_XDECREF(__pyx_t_6);
15509 __Pyx_XDECREF(__pyx_t_7);
15510 __Pyx_XDECREF(__pyx_t_11);
15511 __Pyx_XDECREF(__pyx_t_18);
15512 __Pyx_WriteUnraisable("csamtools.Samfile._buildHeader", __pyx_clineno, __pyx_lineno, __pyx_filename);
15515 __Pyx_XDECREF(__pyx_v_lines);
15516 __Pyx_XDECREF(__pyx_v_record);
15517 __Pyx_XDECREF(__pyx_v_ttype);
15518 __Pyx_XDECREF(__pyx_v_data);
15519 __Pyx_XDECREF(__pyx_v_fields);
15520 __Pyx_XDECREF(__pyx_v_text);
15521 __Pyx_XDECREF(__pyx_v_btext);
15522 __Pyx_XDECREF(__pyx_v_bseqname);
15523 __Pyx_XDECREF(__pyx_v_seqs);
15524 __Pyx_XDECREF(__pyx_v_seqname);
15525 __Pyx_XDECREF(__pyx_v_seqlen);
15526 __Pyx_TraceReturn(Py_None);
15527 __Pyx_RefNannyFinishContext();
15531 /* Python wrapper */
15532 static PyObject *__pyx_pw_9csamtools_7Samfile_41__iter__(PyObject *__pyx_v_self); /*proto*/
15533 static PyObject *__pyx_pw_9csamtools_7Samfile_41__iter__(PyObject *__pyx_v_self) {
15534 PyObject *__pyx_r = 0;
15535 __Pyx_RefNannyDeclarations
15536 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
15537 __pyx_r = __pyx_pf_9csamtools_7Samfile_40__iter__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
15538 __Pyx_RefNannyFinishContext();
15542 /* "csamtools.pyx":1411
15543 * ## Possible solutions: deprecate or open new file handle
15544 * ###############################################################
15545 * def __iter__(self): # <<<<<<<<<<<<<<
15546 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
15547 * if not self.isbam and self.samfile.header.n_targets == 0:
15550 static PyObject *__pyx_pf_9csamtools_7Samfile_40__iter__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
15551 PyObject *__pyx_r = NULL;
15552 __Pyx_RefNannyDeclarations
15553 PyObject *__pyx_t_1 = NULL;
15554 PyObject *__pyx_t_2 = NULL;
15558 int __pyx_lineno = 0;
15559 const char *__pyx_filename = NULL;
15560 int __pyx_clineno = 0;
15561 __Pyx_TraceDeclarations
15562 __Pyx_RefNannySetupContext("__iter__", 0);
15563 __Pyx_TraceCall("__iter__", __pyx_f[0], 1411);
15565 /* "csamtools.pyx":1412
15566 * ###############################################################
15567 * def __iter__(self):
15568 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
15569 * if not self.isbam and self.samfile.header.n_targets == 0:
15570 * raise NotImplementedError( "can not iterate over samfile without header")
15572 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15573 __Pyx_GOTREF(__pyx_t_1);
15574 __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 = 1412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15575 __Pyx_GOTREF(__pyx_t_2);
15576 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15577 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15578 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15579 __pyx_t_4 = (!__pyx_t_3);
15581 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_115), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15582 __Pyx_GOTREF(__pyx_t_2);
15583 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
15584 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15585 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15590 /* "csamtools.pyx":1413
15591 * def __iter__(self):
15592 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
15593 * if not self.isbam and self.samfile.header.n_targets == 0: # <<<<<<<<<<<<<<
15594 * raise NotImplementedError( "can not iterate over samfile without header")
15597 __pyx_t_4 = (!__pyx_v_self->isbam);
15599 __pyx_t_3 = (__pyx_v_self->samfile->header->n_targets == 0);
15600 __pyx_t_5 = __pyx_t_3;
15602 __pyx_t_5 = __pyx_t_4;
15606 /* "csamtools.pyx":1414
15607 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
15608 * if not self.isbam and self.samfile.header.n_targets == 0:
15609 * raise NotImplementedError( "can not iterate over samfile without header") # <<<<<<<<<<<<<<
15613 __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_117), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15614 __Pyx_GOTREF(__pyx_t_2);
15615 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
15616 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15617 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15622 /* "csamtools.pyx":1415
15623 * if not self.isbam and self.samfile.header.n_targets == 0:
15624 * raise NotImplementedError( "can not iterate over samfile without header")
15625 * return self # <<<<<<<<<<<<<<
15627 * cdef bam1_t * getCurrent( self ):
15629 __Pyx_XDECREF(__pyx_r);
15630 __Pyx_INCREF(((PyObject *)__pyx_v_self));
15631 __pyx_r = ((PyObject *)__pyx_v_self);
15634 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15637 __Pyx_XDECREF(__pyx_t_1);
15638 __Pyx_XDECREF(__pyx_t_2);
15639 __Pyx_AddTraceback("csamtools.Samfile.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15642 __Pyx_XGIVEREF(__pyx_r);
15643 __Pyx_TraceReturn(__pyx_r);
15644 __Pyx_RefNannyFinishContext();
15648 /* "csamtools.pyx":1417
15651 * cdef bam1_t * getCurrent( self ): # <<<<<<<<<<<<<<
15656 static bam1_t *__pyx_f_9csamtools_7Samfile_getCurrent(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
15658 __Pyx_RefNannyDeclarations
15659 __Pyx_TraceDeclarations
15660 __Pyx_RefNannySetupContext("getCurrent", 0);
15661 __Pyx_TraceCall("getCurrent", __pyx_f[0], 1417);
15663 /* "csamtools.pyx":1418
15665 * cdef bam1_t * getCurrent( self ):
15666 * return self.b # <<<<<<<<<<<<<<
15668 * cdef int cnext(self):
15670 __pyx_r = __pyx_v_self->b;
15675 __Pyx_TraceReturn(Py_None);
15676 __Pyx_RefNannyFinishContext();
15680 /* "csamtools.pyx":1420
15683 * cdef int cnext(self): # <<<<<<<<<<<<<<
15685 * cversion of iterator. Used by :class:`pysam.Samfile.IteratorColumn`.
15688 static int __pyx_f_9csamtools_7Samfile_cnext(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
15690 __Pyx_RefNannyDeclarations
15691 __Pyx_TraceDeclarations
15692 __Pyx_RefNannySetupContext("cnext", 0);
15693 __Pyx_TraceCall("cnext", __pyx_f[0], 1420);
15695 /* "csamtools.pyx":1425
15698 * return samread(self.samfile, self.b) # <<<<<<<<<<<<<<
15700 * def __next__(self):
15702 __pyx_r = samread(__pyx_v_self->samfile, __pyx_v_self->b);
15707 __Pyx_TraceReturn(Py_None);
15708 __Pyx_RefNannyFinishContext();
15712 /* Python wrapper */
15713 static PyObject *__pyx_pw_9csamtools_7Samfile_43__next__(PyObject *__pyx_v_self); /*proto*/
15714 static char __pyx_doc_9csamtools_7Samfile_42__next__[] = "\n python version of next().\n ";
15715 struct wrapperbase __pyx_wrapperbase_9csamtools_7Samfile_42__next__;
15716 static PyObject *__pyx_pw_9csamtools_7Samfile_43__next__(PyObject *__pyx_v_self) {
15717 PyObject *__pyx_r = 0;
15718 __Pyx_RefNannyDeclarations
15719 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
15720 __pyx_r = __pyx_pf_9csamtools_7Samfile_42__next__(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self));
15721 __Pyx_RefNannyFinishContext();
15725 /* "csamtools.pyx":1427
15726 * return samread(self.samfile, self.b)
15728 * def __next__(self): # <<<<<<<<<<<<<<
15730 * python version of next().
15733 static PyObject *__pyx_pf_9csamtools_7Samfile_42__next__(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
15735 PyObject *__pyx_r = NULL;
15736 __Pyx_RefNannyDeclarations
15738 PyObject *__pyx_t_2 = NULL;
15739 int __pyx_lineno = 0;
15740 const char *__pyx_filename = NULL;
15741 int __pyx_clineno = 0;
15742 __Pyx_TraceDeclarations
15743 __Pyx_RefNannySetupContext("__next__", 0);
15744 __Pyx_TraceCall("__next__", __pyx_f[0], 1427);
15746 /* "csamtools.pyx":1432
15749 * ret = samread(self.samfile, self.b) # <<<<<<<<<<<<<<
15751 * return makeAlignedRead( self.b )
15753 __pyx_v_ret = samread(__pyx_v_self->samfile, __pyx_v_self->b);
15755 /* "csamtools.pyx":1433
15757 * ret = samread(self.samfile, self.b)
15758 * if (ret > 0): # <<<<<<<<<<<<<<
15759 * return makeAlignedRead( self.b )
15762 __pyx_t_1 = (__pyx_v_ret > 0);
15765 /* "csamtools.pyx":1434
15766 * ret = samread(self.samfile, self.b)
15768 * return makeAlignedRead( self.b ) # <<<<<<<<<<<<<<
15770 * raise StopIteration
15772 __Pyx_XDECREF(__pyx_r);
15773 __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(__pyx_v_self->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15774 __Pyx_GOTREF(__pyx_t_2);
15775 __pyx_r = __pyx_t_2;
15782 /* "csamtools.pyx":1436
15783 * return makeAlignedRead( self.b )
15785 * raise StopIteration # <<<<<<<<<<<<<<
15787 * ##-------------------------------------------------------------------
15789 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
15790 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15794 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15797 __Pyx_XDECREF(__pyx_t_2);
15798 __Pyx_AddTraceback("csamtools.Samfile.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15801 __Pyx_XGIVEREF(__pyx_r);
15802 __Pyx_TraceReturn(__pyx_r);
15803 __Pyx_RefNannyFinishContext();
15807 /* Python wrapper */
15808 static int __pyx_pw_9csamtools_17IteratorRowRegion_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15809 static int __pyx_pw_9csamtools_17IteratorRowRegion_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15810 struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
15814 int __pyx_v_reopen;
15815 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__tid,&__pyx_n_s__beg,&__pyx_n_s__end,&__pyx_n_s__reopen,0};
15817 __Pyx_RefNannyDeclarations
15818 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
15820 PyObject* values[5] = {0,0,0,0,0};
15821 if (unlikely(__pyx_kwds)) {
15822 Py_ssize_t kw_args;
15823 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15824 switch (pos_args) {
15825 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15826 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15827 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15828 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15829 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15831 default: goto __pyx_L5_argtuple_error;
15833 kw_args = PyDict_Size(__pyx_kwds);
15834 switch (pos_args) {
15836 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
15837 if (likely(values[0])) kw_args--;
15838 else goto __pyx_L5_argtuple_error;
15840 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid);
15841 if (likely(values[1])) kw_args--;
15843 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15846 values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beg);
15847 if (likely(values[2])) kw_args--;
15849 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15852 values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
15853 if (likely(values[3])) kw_args--;
15855 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15859 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reopen);
15860 if (value) { values[4] = value; kw_args--; }
15863 if (unlikely(kw_args > 0)) {
15864 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15869 /* "csamtools.pyx":1481
15872 * def __cinit__(self, Samfile samfile, int tid, int beg, int end, int reopen = True ): # <<<<<<<<<<<<<<
15874 * if not samfile._isOpen():
15876 __pyx_v_reopen = ((int)1);
15879 switch (PyTuple_GET_SIZE(__pyx_args)) {
15880 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15881 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15882 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15883 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15884 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15886 default: goto __pyx_L5_argtuple_error;
15889 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
15890 __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15891 __pyx_v_beg = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_beg == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15892 __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15894 __pyx_v_reopen = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15896 __pyx_v_reopen = ((int)1);
15899 goto __pyx_L4_argument_unpacking_done;
15900 __pyx_L5_argtuple_error:;
15901 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15903 __Pyx_AddTraceback("csamtools.IteratorRowRegion.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15904 __Pyx_RefNannyFinishContext();
15906 __pyx_L4_argument_unpacking_done:;
15907 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15908 __pyx_r = __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self), __pyx_v_samfile, __pyx_v_tid, __pyx_v_beg, __pyx_v_end, __pyx_v_reopen);
15913 __Pyx_RefNannyFinishContext();
15917 static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, int __pyx_v_tid, int __pyx_v_beg, int __pyx_v_end, int __pyx_v_reopen) {
15918 PyObject *__pyx_v_mode = NULL;
15919 PyObject *__pyx_v_store = NULL;
15921 __Pyx_RefNannyDeclarations
15922 PyObject *__pyx_t_1 = NULL;
15923 PyObject *__pyx_t_2 = NULL;
15927 int __pyx_lineno = 0;
15928 const char *__pyx_filename = NULL;
15929 int __pyx_clineno = 0;
15930 __Pyx_TraceDeclarations
15931 __Pyx_RefNannySetupContext("__cinit__", 0);
15932 __Pyx_TraceCall("__cinit__", __pyx_f[0], 1481);
15934 /* "csamtools.pyx":1483
15935 * def __cinit__(self, Samfile samfile, int tid, int beg, int end, int reopen = True ):
15937 * if not samfile._isOpen(): # <<<<<<<<<<<<<<
15938 * raise ValueError( "I/O operation on closed file" )
15941 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15942 __Pyx_GOTREF(__pyx_t_1);
15943 __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 = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15944 __Pyx_GOTREF(__pyx_t_2);
15945 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15946 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15947 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15948 __pyx_t_4 = (!__pyx_t_3);
15951 /* "csamtools.pyx":1484
15953 * if not samfile._isOpen():
15954 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
15956 * if not samfile._hasIndex():
15958 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_118), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15959 __Pyx_GOTREF(__pyx_t_2);
15960 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
15961 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15962 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15967 /* "csamtools.pyx":1486
15968 * raise ValueError( "I/O operation on closed file" )
15970 * if not samfile._hasIndex(): # <<<<<<<<<<<<<<
15971 * raise ValueError( "no index available for iteration" )
15974 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15975 __Pyx_GOTREF(__pyx_t_2);
15976 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15977 __Pyx_GOTREF(__pyx_t_1);
15978 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15979 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15980 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15981 __pyx_t_3 = (!__pyx_t_4);
15984 /* "csamtools.pyx":1487
15986 * if not samfile._hasIndex():
15987 * raise ValueError( "no index available for iteration" ) # <<<<<<<<<<<<<<
15989 * # makes sure that samfile stays alive as long as the
15991 __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_120), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15992 __Pyx_GOTREF(__pyx_t_1);
15993 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
15994 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15995 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16000 /* "csamtools.pyx":1491
16001 * # makes sure that samfile stays alive as long as the
16002 * # iterator is alive
16003 * self.samfile = samfile # <<<<<<<<<<<<<<
16005 * if samfile.isbam: mode = b"rb"
16007 __Pyx_INCREF(((PyObject *)__pyx_v_samfile));
16008 __Pyx_GIVEREF(((PyObject *)__pyx_v_samfile));
16009 __Pyx_GOTREF(__pyx_v_self->samfile);
16010 __Pyx_DECREF(((PyObject *)__pyx_v_self->samfile));
16011 __pyx_v_self->samfile = __pyx_v_samfile;
16013 /* "csamtools.pyx":1493
16014 * self.samfile = samfile
16016 * if samfile.isbam: mode = b"rb" # <<<<<<<<<<<<<<
16017 * else: mode = b"r"
16020 if (__pyx_v_samfile->isbam) {
16021 __Pyx_INCREF(((PyObject *)__pyx_n_b__rb));
16022 __pyx_v_mode = __pyx_n_b__rb;
16027 /* "csamtools.pyx":1494
16029 * if samfile.isbam: mode = b"rb"
16030 * else: mode = b"r" # <<<<<<<<<<<<<<
16032 * # reopen the file - note that this makes the iterator
16034 __Pyx_INCREF(((PyObject *)__pyx_n_b__r));
16035 __pyx_v_mode = __pyx_n_b__r;
16039 /* "csamtools.pyx":1498
16040 * # reopen the file - note that this makes the iterator
16041 * # slow and causes pileup to slow down significantly.
16042 * if reopen: # <<<<<<<<<<<<<<
16043 * store = StderrStore()
16044 * self.fp = samopen( samfile._filename, mode, NULL )
16046 if (__pyx_v_reopen) {
16048 /* "csamtools.pyx":1499
16049 * # slow and causes pileup to slow down significantly.
16051 * store = StderrStore() # <<<<<<<<<<<<<<
16052 * self.fp = samopen( samfile._filename, mode, NULL )
16055 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16056 __Pyx_GOTREF(__pyx_t_1);
16057 __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 = 1499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16058 __Pyx_GOTREF(__pyx_t_2);
16059 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16060 __pyx_v_store = __pyx_t_2;
16063 /* "csamtools.pyx":1500
16065 * store = StderrStore()
16066 * self.fp = samopen( samfile._filename, mode, NULL ) # <<<<<<<<<<<<<<
16068 * assert self.fp != NULL
16070 __pyx_t_5 = PyBytes_AsString(((PyObject *)__pyx_v_mode)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16071 __pyx_v_self->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_5, NULL);
16073 /* "csamtools.pyx":1501
16074 * store = StderrStore()
16075 * self.fp = samopen( samfile._filename, mode, NULL )
16076 * store.release() # <<<<<<<<<<<<<<
16077 * assert self.fp != NULL
16078 * self.owns_samfile = True
16080 __pyx_t_2 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16081 __Pyx_GOTREF(__pyx_t_2);
16082 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16083 __Pyx_GOTREF(__pyx_t_1);
16084 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16085 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16087 /* "csamtools.pyx":1502
16088 * self.fp = samopen( samfile._filename, mode, NULL )
16090 * assert self.fp != NULL # <<<<<<<<<<<<<<
16091 * self.owns_samfile = True
16094 #ifndef CYTHON_WITHOUT_ASSERTIONS
16095 if (unlikely(!(__pyx_v_self->fp != NULL))) {
16096 PyErr_SetNone(PyExc_AssertionError);
16097 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16101 /* "csamtools.pyx":1503
16103 * assert self.fp != NULL
16104 * self.owns_samfile = True # <<<<<<<<<<<<<<
16106 * self.fp = self.samfile.samfile
16108 __pyx_v_self->owns_samfile = 1;
16113 /* "csamtools.pyx":1505
16114 * self.owns_samfile = True
16116 * self.fp = self.samfile.samfile # <<<<<<<<<<<<<<
16117 * self.owns_samfile = False
16120 __pyx_v_self->fp = __pyx_v_self->samfile->samfile;
16122 /* "csamtools.pyx":1506
16124 * self.fp = self.samfile.samfile
16125 * self.owns_samfile = False # <<<<<<<<<<<<<<
16129 __pyx_v_self->owns_samfile = 0;
16133 /* "csamtools.pyx":1508
16134 * self.owns_samfile = False
16136 * self.retval = 0 # <<<<<<<<<<<<<<
16138 * self.iter = bam_iter_query(self.samfile.index,
16140 __pyx_v_self->retval = 0;
16142 /* "csamtools.pyx":1510
16145 * self.iter = bam_iter_query(self.samfile.index, # <<<<<<<<<<<<<<
16149 __pyx_v_self->iter = bam_iter_query(__pyx_v_self->samfile->index, __pyx_v_tid, __pyx_v_beg, __pyx_v_end);
16151 /* "csamtools.pyx":1514
16154 * self.b = bam_init1() # <<<<<<<<<<<<<<
16156 * def __iter__(self):
16158 __pyx_v_self->b = bam_init1();
16163 __Pyx_XDECREF(__pyx_t_1);
16164 __Pyx_XDECREF(__pyx_t_2);
16165 __Pyx_AddTraceback("csamtools.IteratorRowRegion.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16168 __Pyx_XDECREF(__pyx_v_mode);
16169 __Pyx_XDECREF(__pyx_v_store);
16170 __Pyx_TraceReturn(Py_None);
16171 __Pyx_RefNannyFinishContext();
16175 /* Python wrapper */
16176 static PyObject *__pyx_pw_9csamtools_17IteratorRowRegion_3__iter__(PyObject *__pyx_v_self); /*proto*/
16177 static PyObject *__pyx_pw_9csamtools_17IteratorRowRegion_3__iter__(PyObject *__pyx_v_self) {
16178 PyObject *__pyx_r = 0;
16179 __Pyx_RefNannyDeclarations
16180 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
16181 __pyx_r = __pyx_pf_9csamtools_17IteratorRowRegion_2__iter__(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self));
16182 __Pyx_RefNannyFinishContext();
16186 /* "csamtools.pyx":1516
16187 * self.b = bam_init1()
16189 * def __iter__(self): # <<<<<<<<<<<<<<
16194 static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_2__iter__(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self) {
16195 PyObject *__pyx_r = NULL;
16196 __Pyx_RefNannyDeclarations
16197 __Pyx_TraceDeclarations
16198 __Pyx_RefNannySetupContext("__iter__", 0);
16199 __Pyx_TraceCall("__iter__", __pyx_f[0], 1516);
16201 /* "csamtools.pyx":1517
16203 * def __iter__(self):
16204 * return self # <<<<<<<<<<<<<<
16206 * cdef bam1_t * getCurrent( self ):
16208 __Pyx_XDECREF(__pyx_r);
16209 __Pyx_INCREF(((PyObject *)__pyx_v_self));
16210 __pyx_r = ((PyObject *)__pyx_v_self);
16213 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16215 __Pyx_XGIVEREF(__pyx_r);
16216 __Pyx_TraceReturn(__pyx_r);
16217 __Pyx_RefNannyFinishContext();
16221 /* "csamtools.pyx":1519
16224 * cdef bam1_t * getCurrent( self ): # <<<<<<<<<<<<<<
16229 static bam1_t *__pyx_f_9csamtools_17IteratorRowRegion_getCurrent(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self) {
16231 __Pyx_RefNannyDeclarations
16232 __Pyx_TraceDeclarations
16233 __Pyx_RefNannySetupContext("getCurrent", 0);
16234 __Pyx_TraceCall("getCurrent", __pyx_f[0], 1519);
16236 /* "csamtools.pyx":1520
16238 * cdef bam1_t * getCurrent( self ):
16239 * return self.b # <<<<<<<<<<<<<<
16241 * cdef int cnext(self):
16243 __pyx_r = __pyx_v_self->b;
16248 __Pyx_TraceReturn(Py_None);
16249 __Pyx_RefNannyFinishContext();
16253 /* "csamtools.pyx":1522
16256 * cdef int cnext(self): # <<<<<<<<<<<<<<
16257 * '''cversion of iterator. Used by IteratorColumn'''
16258 * self.retval = bam_iter_read( self.fp.x.bam,
16261 static int __pyx_f_9csamtools_17IteratorRowRegion_cnext(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self) {
16263 __Pyx_RefNannyDeclarations
16264 __Pyx_TraceDeclarations
16265 __Pyx_RefNannySetupContext("cnext", 0);
16266 __Pyx_TraceCall("cnext", __pyx_f[0], 1522);
16268 /* "csamtools.pyx":1524
16269 * cdef int cnext(self):
16270 * '''cversion of iterator. Used by IteratorColumn'''
16271 * self.retval = bam_iter_read( self.fp.x.bam, # <<<<<<<<<<<<<<
16275 __pyx_v_self->retval = bam_iter_read(__pyx_v_self->fp->x.bam, __pyx_v_self->iter, __pyx_v_self->b);
16278 __Pyx_TraceReturn(Py_None);
16279 __Pyx_RefNannyFinishContext();
16283 /* Python wrapper */
16284 static PyObject *__pyx_pw_9csamtools_17IteratorRowRegion_5__next__(PyObject *__pyx_v_self); /*proto*/
16285 static char __pyx_doc_9csamtools_17IteratorRowRegion_4__next__[] = "python version of next().\n ";
16286 struct wrapperbase __pyx_wrapperbase_9csamtools_17IteratorRowRegion_4__next__;
16287 static PyObject *__pyx_pw_9csamtools_17IteratorRowRegion_5__next__(PyObject *__pyx_v_self) {
16288 PyObject *__pyx_r = 0;
16289 __Pyx_RefNannyDeclarations
16290 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
16291 __pyx_r = __pyx_pf_9csamtools_17IteratorRowRegion_4__next__(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self));
16292 __Pyx_RefNannyFinishContext();
16296 /* "csamtools.pyx":1528
16299 * def __next__(self): # <<<<<<<<<<<<<<
16300 * """python version of next().
16304 static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_4__next__(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self) {
16305 PyObject *__pyx_r = NULL;
16306 __Pyx_RefNannyDeclarations
16308 PyObject *__pyx_t_2 = NULL;
16309 int __pyx_lineno = 0;
16310 const char *__pyx_filename = NULL;
16311 int __pyx_clineno = 0;
16312 __Pyx_TraceDeclarations
16313 __Pyx_RefNannySetupContext("__next__", 0);
16314 __Pyx_TraceCall("__next__", __pyx_f[0], 1528);
16316 /* "csamtools.pyx":1531
16317 * """python version of next().
16319 * self.cnext() # <<<<<<<<<<<<<<
16320 * if self.retval < 0: raise StopIteration
16321 * return makeAlignedRead( self.b )
16323 ((struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *)__pyx_v_self->__pyx_vtab)->cnext(__pyx_v_self);
16325 /* "csamtools.pyx":1532
16328 * if self.retval < 0: raise StopIteration # <<<<<<<<<<<<<<
16329 * return makeAlignedRead( self.b )
16332 __pyx_t_1 = (__pyx_v_self->retval < 0);
16334 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
16335 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16340 /* "csamtools.pyx":1533
16342 * if self.retval < 0: raise StopIteration
16343 * return makeAlignedRead( self.b ) # <<<<<<<<<<<<<<
16345 * def __dealloc__(self):
16347 __Pyx_XDECREF(__pyx_r);
16348 __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(__pyx_v_self->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16349 __Pyx_GOTREF(__pyx_t_2);
16350 __pyx_r = __pyx_t_2;
16354 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16357 __Pyx_XDECREF(__pyx_t_2);
16358 __Pyx_AddTraceback("csamtools.IteratorRowRegion.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16361 __Pyx_XGIVEREF(__pyx_r);
16362 __Pyx_TraceReturn(__pyx_r);
16363 __Pyx_RefNannyFinishContext();
16367 /* Python wrapper */
16368 static void __pyx_pw_9csamtools_17IteratorRowRegion_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
16369 static void __pyx_pw_9csamtools_17IteratorRowRegion_7__dealloc__(PyObject *__pyx_v_self) {
16370 __Pyx_RefNannyDeclarations
16371 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
16372 __pyx_pf_9csamtools_17IteratorRowRegion_6__dealloc__(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self));
16373 __Pyx_RefNannyFinishContext();
16376 /* "csamtools.pyx":1535
16377 * return makeAlignedRead( self.b )
16379 * def __dealloc__(self): # <<<<<<<<<<<<<<
16380 * bam_destroy1(self.b)
16381 * bam_iter_destroy( self.iter )
16384 static void __pyx_pf_9csamtools_17IteratorRowRegion_6__dealloc__(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self) {
16385 __Pyx_RefNannyDeclarations
16386 __Pyx_TraceDeclarations
16387 __Pyx_RefNannySetupContext("__dealloc__", 0);
16388 __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1535);
16390 /* "csamtools.pyx":1536
16392 * def __dealloc__(self):
16393 * bam_destroy1(self.b) # <<<<<<<<<<<<<<
16394 * bam_iter_destroy( self.iter )
16395 * if self.owns_samfile: samclose( self.fp )
16397 bam_destroy1(__pyx_v_self->b);
16399 /* "csamtools.pyx":1537
16400 * def __dealloc__(self):
16401 * bam_destroy1(self.b)
16402 * bam_iter_destroy( self.iter ) # <<<<<<<<<<<<<<
16403 * if self.owns_samfile: samclose( self.fp )
16406 bam_iter_destroy(__pyx_v_self->iter);
16408 /* "csamtools.pyx":1538
16409 * bam_destroy1(self.b)
16410 * bam_iter_destroy( self.iter )
16411 * if self.owns_samfile: samclose( self.fp ) # <<<<<<<<<<<<<<
16413 * cdef class IteratorRowAll(IteratorRow):
16415 if (__pyx_v_self->owns_samfile) {
16416 samclose(__pyx_v_self->fp);
16421 __Pyx_TraceReturn(Py_None);
16422 __Pyx_RefNannyFinishContext();
16425 /* Python wrapper */
16426 static int __pyx_pw_9csamtools_14IteratorRowAll_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16427 static int __pyx_pw_9csamtools_14IteratorRowAll_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16428 struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
16429 int __pyx_v_reopen;
16430 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__reopen,0};
16432 __Pyx_RefNannyDeclarations
16433 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
16435 PyObject* values[2] = {0,0};
16436 if (unlikely(__pyx_kwds)) {
16437 Py_ssize_t kw_args;
16438 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16439 switch (pos_args) {
16440 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16441 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16443 default: goto __pyx_L5_argtuple_error;
16445 kw_args = PyDict_Size(__pyx_kwds);
16446 switch (pos_args) {
16448 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
16449 if (likely(values[0])) kw_args--;
16450 else goto __pyx_L5_argtuple_error;
16453 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reopen);
16454 if (value) { values[1] = value; kw_args--; }
16457 if (unlikely(kw_args > 0)) {
16458 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16463 /* "csamtools.pyx":1550
16466 * def __cinit__(self, Samfile samfile, int reopen = True ): # <<<<<<<<<<<<<<
16468 * if not samfile._isOpen():
16470 __pyx_v_reopen = ((int)1);
16473 switch (PyTuple_GET_SIZE(__pyx_args)) {
16474 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16475 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16477 default: goto __pyx_L5_argtuple_error;
16480 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
16482 __pyx_v_reopen = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16484 __pyx_v_reopen = ((int)1);
16487 goto __pyx_L4_argument_unpacking_done;
16488 __pyx_L5_argtuple_error:;
16489 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16491 __Pyx_AddTraceback("csamtools.IteratorRowAll.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16492 __Pyx_RefNannyFinishContext();
16494 __pyx_L4_argument_unpacking_done:;
16495 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16496 __pyx_r = __pyx_pf_9csamtools_14IteratorRowAll___cinit__(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self), __pyx_v_samfile, __pyx_v_reopen);
16501 __Pyx_RefNannyFinishContext();
16505 static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, int __pyx_v_reopen) {
16506 PyObject *__pyx_v_mode = NULL;
16507 PyObject *__pyx_v_store = NULL;
16509 __Pyx_RefNannyDeclarations
16510 PyObject *__pyx_t_1 = NULL;
16511 PyObject *__pyx_t_2 = NULL;
16515 int __pyx_lineno = 0;
16516 const char *__pyx_filename = NULL;
16517 int __pyx_clineno = 0;
16518 __Pyx_TraceDeclarations
16519 __Pyx_RefNannySetupContext("__cinit__", 0);
16520 __Pyx_TraceCall("__cinit__", __pyx_f[0], 1550);
16522 /* "csamtools.pyx":1552
16523 * def __cinit__(self, Samfile samfile, int reopen = True ):
16525 * if not samfile._isOpen(): # <<<<<<<<<<<<<<
16526 * raise ValueError( "I/O operation on closed file" )
16529 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16530 __Pyx_GOTREF(__pyx_t_1);
16531 __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 = 1552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16532 __Pyx_GOTREF(__pyx_t_2);
16533 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16534 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16535 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16536 __pyx_t_4 = (!__pyx_t_3);
16539 /* "csamtools.pyx":1553
16541 * if not samfile._isOpen():
16542 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
16544 * if samfile.isbam: mode = b"rb"
16546 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_121), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16547 __Pyx_GOTREF(__pyx_t_2);
16548 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
16549 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16550 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16555 /* "csamtools.pyx":1555
16556 * raise ValueError( "I/O operation on closed file" )
16558 * if samfile.isbam: mode = b"rb" # <<<<<<<<<<<<<<
16559 * else: mode = b"r"
16562 if (__pyx_v_samfile->isbam) {
16563 __Pyx_INCREF(((PyObject *)__pyx_n_b__rb));
16564 __pyx_v_mode = __pyx_n_b__rb;
16569 /* "csamtools.pyx":1556
16571 * if samfile.isbam: mode = b"rb"
16572 * else: mode = b"r" # <<<<<<<<<<<<<<
16574 * # reopen the file to avoid iterator conflict
16576 __Pyx_INCREF(((PyObject *)__pyx_n_b__r));
16577 __pyx_v_mode = __pyx_n_b__r;
16581 /* "csamtools.pyx":1559
16583 * # reopen the file to avoid iterator conflict
16584 * if reopen: # <<<<<<<<<<<<<<
16585 * store = StderrStore()
16586 * self.fp = samopen( samfile._filename, mode, NULL )
16588 if (__pyx_v_reopen) {
16590 /* "csamtools.pyx":1560
16591 * # reopen the file to avoid iterator conflict
16593 * store = StderrStore() # <<<<<<<<<<<<<<
16594 * self.fp = samopen( samfile._filename, mode, NULL )
16597 __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16598 __Pyx_GOTREF(__pyx_t_2);
16599 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16600 __Pyx_GOTREF(__pyx_t_1);
16601 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16602 __pyx_v_store = __pyx_t_1;
16605 /* "csamtools.pyx":1561
16607 * store = StderrStore()
16608 * self.fp = samopen( samfile._filename, mode, NULL ) # <<<<<<<<<<<<<<
16610 * assert self.fp != NULL
16612 __pyx_t_5 = PyBytes_AsString(((PyObject *)__pyx_v_mode)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16613 __pyx_v_self->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_5, NULL);
16615 /* "csamtools.pyx":1562
16616 * store = StderrStore()
16617 * self.fp = samopen( samfile._filename, mode, NULL )
16618 * store.release() # <<<<<<<<<<<<<<
16619 * assert self.fp != NULL
16620 * self.owns_samfile = True
16622 __pyx_t_1 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16623 __Pyx_GOTREF(__pyx_t_1);
16624 __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 = 1562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16625 __Pyx_GOTREF(__pyx_t_2);
16626 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16627 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16629 /* "csamtools.pyx":1563
16630 * self.fp = samopen( samfile._filename, mode, NULL )
16632 * assert self.fp != NULL # <<<<<<<<<<<<<<
16633 * self.owns_samfile = True
16636 #ifndef CYTHON_WITHOUT_ASSERTIONS
16637 if (unlikely(!(__pyx_v_self->fp != NULL))) {
16638 PyErr_SetNone(PyExc_AssertionError);
16639 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16643 /* "csamtools.pyx":1564
16645 * assert self.fp != NULL
16646 * self.owns_samfile = True # <<<<<<<<<<<<<<
16648 * self.fp = samfile.samfile
16650 __pyx_v_self->owns_samfile = 1;
16655 /* "csamtools.pyx":1566
16656 * self.owns_samfile = True
16658 * self.fp = samfile.samfile # <<<<<<<<<<<<<<
16659 * self.owns_samfile = False
16662 __pyx_v_self->fp = __pyx_v_samfile->samfile;
16664 /* "csamtools.pyx":1567
16666 * self.fp = samfile.samfile
16667 * self.owns_samfile = False # <<<<<<<<<<<<<<
16669 * # allocate memory for alignment
16671 __pyx_v_self->owns_samfile = 0;
16675 /* "csamtools.pyx":1570
16677 * # allocate memory for alignment
16678 * self.b = <bam1_t*>calloc(1, sizeof(bam1_t)) # <<<<<<<<<<<<<<
16680 * def __iter__(self):
16682 __pyx_v_self->b = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
16687 __Pyx_XDECREF(__pyx_t_1);
16688 __Pyx_XDECREF(__pyx_t_2);
16689 __Pyx_AddTraceback("csamtools.IteratorRowAll.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16692 __Pyx_XDECREF(__pyx_v_mode);
16693 __Pyx_XDECREF(__pyx_v_store);
16694 __Pyx_TraceReturn(Py_None);
16695 __Pyx_RefNannyFinishContext();
16699 /* Python wrapper */
16700 static PyObject *__pyx_pw_9csamtools_14IteratorRowAll_3__iter__(PyObject *__pyx_v_self); /*proto*/
16701 static PyObject *__pyx_pw_9csamtools_14IteratorRowAll_3__iter__(PyObject *__pyx_v_self) {
16702 PyObject *__pyx_r = 0;
16703 __Pyx_RefNannyDeclarations
16704 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
16705 __pyx_r = __pyx_pf_9csamtools_14IteratorRowAll_2__iter__(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self));
16706 __Pyx_RefNannyFinishContext();
16710 /* "csamtools.pyx":1572
16711 * self.b = <bam1_t*>calloc(1, sizeof(bam1_t))
16713 * def __iter__(self): # <<<<<<<<<<<<<<
16718 static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_2__iter__(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self) {
16719 PyObject *__pyx_r = NULL;
16720 __Pyx_RefNannyDeclarations
16721 __Pyx_TraceDeclarations
16722 __Pyx_RefNannySetupContext("__iter__", 0);
16723 __Pyx_TraceCall("__iter__", __pyx_f[0], 1572);
16725 /* "csamtools.pyx":1573
16727 * def __iter__(self):
16728 * return self # <<<<<<<<<<<<<<
16730 * cdef bam1_t * getCurrent( self ):
16732 __Pyx_XDECREF(__pyx_r);
16733 __Pyx_INCREF(((PyObject *)__pyx_v_self));
16734 __pyx_r = ((PyObject *)__pyx_v_self);
16737 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16739 __Pyx_XGIVEREF(__pyx_r);
16740 __Pyx_TraceReturn(__pyx_r);
16741 __Pyx_RefNannyFinishContext();
16745 /* "csamtools.pyx":1575
16748 * cdef bam1_t * getCurrent( self ): # <<<<<<<<<<<<<<
16753 static bam1_t *__pyx_f_9csamtools_14IteratorRowAll_getCurrent(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self) {
16755 __Pyx_RefNannyDeclarations
16756 __Pyx_TraceDeclarations
16757 __Pyx_RefNannySetupContext("getCurrent", 0);
16758 __Pyx_TraceCall("getCurrent", __pyx_f[0], 1575);
16760 /* "csamtools.pyx":1576
16762 * cdef bam1_t * getCurrent( self ):
16763 * return self.b # <<<<<<<<<<<<<<
16765 * cdef int cnext(self):
16767 __pyx_r = __pyx_v_self->b;
16772 __Pyx_TraceReturn(Py_None);
16773 __Pyx_RefNannyFinishContext();
16777 /* "csamtools.pyx":1578
16780 * cdef int cnext(self): # <<<<<<<<<<<<<<
16781 * '''cversion of iterator. Used by IteratorColumn'''
16782 * return samread(self.fp, self.b)
16785 static int __pyx_f_9csamtools_14IteratorRowAll_cnext(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self) {
16787 __Pyx_RefNannyDeclarations
16788 __Pyx_TraceDeclarations
16789 __Pyx_RefNannySetupContext("cnext", 0);
16790 __Pyx_TraceCall("cnext", __pyx_f[0], 1578);
16792 /* "csamtools.pyx":1580
16793 * cdef int cnext(self):
16794 * '''cversion of iterator. Used by IteratorColumn'''
16795 * return samread(self.fp, self.b) # <<<<<<<<<<<<<<
16797 * def __next__(self):
16799 __pyx_r = samread(__pyx_v_self->fp, __pyx_v_self->b);
16804 __Pyx_TraceReturn(Py_None);
16805 __Pyx_RefNannyFinishContext();
16809 /* Python wrapper */
16810 static PyObject *__pyx_pw_9csamtools_14IteratorRowAll_5__next__(PyObject *__pyx_v_self); /*proto*/
16811 static char __pyx_doc_9csamtools_14IteratorRowAll_4__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n ";
16812 struct wrapperbase __pyx_wrapperbase_9csamtools_14IteratorRowAll_4__next__;
16813 static PyObject *__pyx_pw_9csamtools_14IteratorRowAll_5__next__(PyObject *__pyx_v_self) {
16814 PyObject *__pyx_r = 0;
16815 __Pyx_RefNannyDeclarations
16816 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
16817 __pyx_r = __pyx_pf_9csamtools_14IteratorRowAll_4__next__(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self));
16818 __Pyx_RefNannyFinishContext();
16822 /* "csamtools.pyx":1582
16823 * return samread(self.fp, self.b)
16825 * def __next__(self): # <<<<<<<<<<<<<<
16826 * """python version of next().
16830 static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_4__next__(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self) {
16832 PyObject *__pyx_r = NULL;
16833 __Pyx_RefNannyDeclarations
16835 PyObject *__pyx_t_2 = NULL;
16836 int __pyx_lineno = 0;
16837 const char *__pyx_filename = NULL;
16838 int __pyx_clineno = 0;
16839 __Pyx_TraceDeclarations
16840 __Pyx_RefNannySetupContext("__next__", 0);
16841 __Pyx_TraceCall("__next__", __pyx_f[0], 1582);
16843 /* "csamtools.pyx":1588
16846 * ret = samread(self.fp, self.b) # <<<<<<<<<<<<<<
16848 * return makeAlignedRead( self.b )
16850 __pyx_v_ret = samread(__pyx_v_self->fp, __pyx_v_self->b);
16852 /* "csamtools.pyx":1589
16854 * ret = samread(self.fp, self.b)
16855 * if (ret > 0): # <<<<<<<<<<<<<<
16856 * return makeAlignedRead( self.b )
16859 __pyx_t_1 = (__pyx_v_ret > 0);
16862 /* "csamtools.pyx":1590
16863 * ret = samread(self.fp, self.b)
16865 * return makeAlignedRead( self.b ) # <<<<<<<<<<<<<<
16867 * raise StopIteration
16869 __Pyx_XDECREF(__pyx_r);
16870 __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(__pyx_v_self->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16871 __Pyx_GOTREF(__pyx_t_2);
16872 __pyx_r = __pyx_t_2;
16879 /* "csamtools.pyx":1592
16880 * return makeAlignedRead( self.b )
16882 * raise StopIteration # <<<<<<<<<<<<<<
16884 * def __dealloc__(self):
16886 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
16887 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16891 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16894 __Pyx_XDECREF(__pyx_t_2);
16895 __Pyx_AddTraceback("csamtools.IteratorRowAll.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16898 __Pyx_XGIVEREF(__pyx_r);
16899 __Pyx_TraceReturn(__pyx_r);
16900 __Pyx_RefNannyFinishContext();
16904 /* Python wrapper */
16905 static void __pyx_pw_9csamtools_14IteratorRowAll_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
16906 static void __pyx_pw_9csamtools_14IteratorRowAll_7__dealloc__(PyObject *__pyx_v_self) {
16907 __Pyx_RefNannyDeclarations
16908 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
16909 __pyx_pf_9csamtools_14IteratorRowAll_6__dealloc__(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self));
16910 __Pyx_RefNannyFinishContext();
16913 /* "csamtools.pyx":1594
16914 * raise StopIteration
16916 * def __dealloc__(self): # <<<<<<<<<<<<<<
16917 * bam_destroy1(self.b)
16918 * if self.owns_samfile: samclose( self.fp )
16921 static void __pyx_pf_9csamtools_14IteratorRowAll_6__dealloc__(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self) {
16922 __Pyx_RefNannyDeclarations
16923 __Pyx_TraceDeclarations
16924 __Pyx_RefNannySetupContext("__dealloc__", 0);
16925 __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1594);
16927 /* "csamtools.pyx":1595
16929 * def __dealloc__(self):
16930 * bam_destroy1(self.b) # <<<<<<<<<<<<<<
16931 * if self.owns_samfile: samclose( self.fp )
16934 bam_destroy1(__pyx_v_self->b);
16936 /* "csamtools.pyx":1596
16937 * def __dealloc__(self):
16938 * bam_destroy1(self.b)
16939 * if self.owns_samfile: samclose( self.fp ) # <<<<<<<<<<<<<<
16941 * cdef class IteratorRowAllRefs(IteratorRow):
16943 if (__pyx_v_self->owns_samfile) {
16944 samclose(__pyx_v_self->fp);
16949 __Pyx_TraceReturn(Py_None);
16950 __Pyx_RefNannyFinishContext();
16953 /* Python wrapper */
16954 static int __pyx_pw_9csamtools_18IteratorRowAllRefs_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16955 static int __pyx_pw_9csamtools_18IteratorRowAllRefs_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16956 struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
16957 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0};
16959 __Pyx_RefNannyDeclarations
16960 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
16962 PyObject* values[1] = {0};
16963 if (unlikely(__pyx_kwds)) {
16964 Py_ssize_t kw_args;
16965 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16966 switch (pos_args) {
16967 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16969 default: goto __pyx_L5_argtuple_error;
16971 kw_args = PyDict_Size(__pyx_kwds);
16972 switch (pos_args) {
16974 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
16975 if (likely(values[0])) kw_args--;
16976 else goto __pyx_L5_argtuple_error;
16978 if (unlikely(kw_args > 0)) {
16979 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16981 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
16982 goto __pyx_L5_argtuple_error;
16984 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16986 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
16988 goto __pyx_L4_argument_unpacking_done;
16989 __pyx_L5_argtuple_error:;
16990 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16992 __Pyx_AddTraceback("csamtools.IteratorRowAllRefs.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16993 __Pyx_RefNannyFinishContext();
16995 __pyx_L4_argument_unpacking_done:;
16996 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16997 __pyx_r = __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self), __pyx_v_samfile);
17002 __Pyx_RefNannyFinishContext();
17006 /* "csamtools.pyx":1602
17009 * def __cinit__(self, Samfile samfile): # <<<<<<<<<<<<<<
17010 * assert samfile._isOpen()
17011 * if not samfile._hasIndex(): raise ValueError("no index available for fetch")
17014 static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(struct __pyx_obj_9csamtools_IteratorRowAllRefs *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile) {
17016 __Pyx_RefNannyDeclarations
17017 PyObject *__pyx_t_1 = NULL;
17018 PyObject *__pyx_t_2 = NULL;
17021 int __pyx_lineno = 0;
17022 const char *__pyx_filename = NULL;
17023 int __pyx_clineno = 0;
17024 __Pyx_TraceDeclarations
17025 __Pyx_RefNannySetupContext("__cinit__", 0);
17026 __Pyx_TraceCall("__cinit__", __pyx_f[0], 1602);
17028 /* "csamtools.pyx":1603
17030 * def __cinit__(self, Samfile samfile):
17031 * assert samfile._isOpen() # <<<<<<<<<<<<<<
17032 * if not samfile._hasIndex(): raise ValueError("no index available for fetch")
17033 * self.samfile = samfile
17035 #ifndef CYTHON_WITHOUT_ASSERTIONS
17036 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17037 __Pyx_GOTREF(__pyx_t_1);
17038 __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 = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17039 __Pyx_GOTREF(__pyx_t_2);
17040 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17041 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17042 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17043 if (unlikely(!__pyx_t_3)) {
17044 PyErr_SetNone(PyExc_AssertionError);
17045 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17049 /* "csamtools.pyx":1604
17050 * def __cinit__(self, Samfile samfile):
17051 * assert samfile._isOpen()
17052 * if not samfile._hasIndex(): raise ValueError("no index available for fetch") # <<<<<<<<<<<<<<
17053 * self.samfile = samfile
17056 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17057 __Pyx_GOTREF(__pyx_t_2);
17058 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17059 __Pyx_GOTREF(__pyx_t_1);
17060 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17061 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17062 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17063 __pyx_t_4 = (!__pyx_t_3);
17065 __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_122), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17066 __Pyx_GOTREF(__pyx_t_1);
17067 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
17068 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17069 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17074 /* "csamtools.pyx":1605
17075 * assert samfile._isOpen()
17076 * if not samfile._hasIndex(): raise ValueError("no index available for fetch")
17077 * self.samfile = samfile # <<<<<<<<<<<<<<
17081 __Pyx_INCREF(((PyObject *)__pyx_v_samfile));
17082 __Pyx_GIVEREF(((PyObject *)__pyx_v_samfile));
17083 __Pyx_GOTREF(__pyx_v_self->samfile);
17084 __Pyx_DECREF(((PyObject *)__pyx_v_self->samfile));
17085 __pyx_v_self->samfile = __pyx_v_samfile;
17087 /* "csamtools.pyx":1606
17088 * if not samfile._hasIndex(): raise ValueError("no index available for fetch")
17089 * self.samfile = samfile
17090 * self.tid = -1 # <<<<<<<<<<<<<<
17092 * def nextiter(self):
17094 __pyx_v_self->tid = -1;
17099 __Pyx_XDECREF(__pyx_t_1);
17100 __Pyx_XDECREF(__pyx_t_2);
17101 __Pyx_AddTraceback("csamtools.IteratorRowAllRefs.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17104 __Pyx_TraceReturn(Py_None);
17105 __Pyx_RefNannyFinishContext();
17109 /* Python wrapper */
17110 static PyObject *__pyx_pw_9csamtools_18IteratorRowAllRefs_3nextiter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
17111 static char __pyx_doc_9csamtools_18IteratorRowAllRefs_2nextiter[] = "IteratorRowAllRefs.nextiter(self)";
17112 static PyObject *__pyx_pw_9csamtools_18IteratorRowAllRefs_3nextiter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
17113 PyObject *__pyx_r = 0;
17114 __Pyx_RefNannyDeclarations
17115 __Pyx_RefNannySetupContext("nextiter (wrapper)", 0);
17116 __pyx_r = __pyx_pf_9csamtools_18IteratorRowAllRefs_2nextiter(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self));
17117 __Pyx_RefNannyFinishContext();
17121 /* "csamtools.pyx":1608
17124 * def nextiter(self): # <<<<<<<<<<<<<<
17125 * self.rowiter = IteratorRowRegion(self.samfile, self.tid, 0, 1<<29)
17129 static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_2nextiter(struct __pyx_obj_9csamtools_IteratorRowAllRefs *__pyx_v_self) {
17130 PyObject *__pyx_r = NULL;
17131 __Pyx_RefNannyDeclarations
17132 PyObject *__pyx_t_1 = NULL;
17133 PyObject *__pyx_t_2 = NULL;
17134 int __pyx_lineno = 0;
17135 const char *__pyx_filename = NULL;
17136 int __pyx_clineno = 0;
17137 __Pyx_TraceDeclarations
17138 __Pyx_RefNannySetupContext("nextiter", 0);
17139 __Pyx_TraceCall("nextiter", __pyx_f[0], 1608);
17141 /* "csamtools.pyx":1609
17143 * def nextiter(self):
17144 * self.rowiter = IteratorRowRegion(self.samfile, self.tid, 0, 1<<29) # <<<<<<<<<<<<<<
17146 * def __iter__(self):
17148 __pyx_t_1 = PyInt_FromLong(__pyx_v_self->tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17149 __Pyx_GOTREF(__pyx_t_1);
17150 __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17151 __Pyx_GOTREF(__pyx_t_2);
17152 __Pyx_INCREF(((PyObject *)__pyx_v_self->samfile));
17153 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self->samfile));
17154 __Pyx_GIVEREF(((PyObject *)__pyx_v_self->samfile));
17155 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
17156 __Pyx_GIVEREF(__pyx_t_1);
17157 __Pyx_INCREF(__pyx_int_0);
17158 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_int_0);
17159 __Pyx_GIVEREF(__pyx_int_0);
17160 __Pyx_INCREF(__pyx_int_536870912);
17161 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_int_536870912);
17162 __Pyx_GIVEREF(__pyx_int_536870912);
17164 __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17165 __Pyx_GOTREF(__pyx_t_1);
17166 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
17167 __Pyx_GIVEREF(__pyx_t_1);
17168 __Pyx_GOTREF(__pyx_v_self->rowiter);
17169 __Pyx_DECREF(((PyObject *)__pyx_v_self->rowiter));
17170 __pyx_v_self->rowiter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_t_1);
17173 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17176 __Pyx_XDECREF(__pyx_t_1);
17177 __Pyx_XDECREF(__pyx_t_2);
17178 __Pyx_AddTraceback("csamtools.IteratorRowAllRefs.nextiter", __pyx_clineno, __pyx_lineno, __pyx_filename);
17181 __Pyx_XGIVEREF(__pyx_r);
17182 __Pyx_TraceReturn(__pyx_r);
17183 __Pyx_RefNannyFinishContext();
17187 /* Python wrapper */
17188 static PyObject *__pyx_pw_9csamtools_18IteratorRowAllRefs_5__iter__(PyObject *__pyx_v_self); /*proto*/
17189 static PyObject *__pyx_pw_9csamtools_18IteratorRowAllRefs_5__iter__(PyObject *__pyx_v_self) {
17190 PyObject *__pyx_r = 0;
17191 __Pyx_RefNannyDeclarations
17192 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
17193 __pyx_r = __pyx_pf_9csamtools_18IteratorRowAllRefs_4__iter__(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self));
17194 __Pyx_RefNannyFinishContext();
17198 /* "csamtools.pyx":1611
17199 * self.rowiter = IteratorRowRegion(self.samfile, self.tid, 0, 1<<29)
17201 * def __iter__(self): # <<<<<<<<<<<<<<
17206 static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_4__iter__(struct __pyx_obj_9csamtools_IteratorRowAllRefs *__pyx_v_self) {
17207 PyObject *__pyx_r = NULL;
17208 __Pyx_RefNannyDeclarations
17209 __Pyx_TraceDeclarations
17210 __Pyx_RefNannySetupContext("__iter__", 0);
17211 __Pyx_TraceCall("__iter__", __pyx_f[0], 1611);
17213 /* "csamtools.pyx":1612
17215 * def __iter__(self):
17216 * return self # <<<<<<<<<<<<<<
17218 * def __next__(self):
17220 __Pyx_XDECREF(__pyx_r);
17221 __Pyx_INCREF(((PyObject *)__pyx_v_self));
17222 __pyx_r = ((PyObject *)__pyx_v_self);
17225 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17227 __Pyx_XGIVEREF(__pyx_r);
17228 __Pyx_TraceReturn(__pyx_r);
17229 __Pyx_RefNannyFinishContext();
17233 /* Python wrapper */
17234 static PyObject *__pyx_pw_9csamtools_18IteratorRowAllRefs_7__next__(PyObject *__pyx_v_self); /*proto*/
17235 static char __pyx_doc_9csamtools_18IteratorRowAllRefs_6__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n ";
17236 struct wrapperbase __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_6__next__;
17237 static PyObject *__pyx_pw_9csamtools_18IteratorRowAllRefs_7__next__(PyObject *__pyx_v_self) {
17238 PyObject *__pyx_r = 0;
17239 __Pyx_RefNannyDeclarations
17240 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
17241 __pyx_r = __pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self));
17242 __Pyx_RefNannyFinishContext();
17246 /* "csamtools.pyx":1614
17249 * def __next__(self): # <<<<<<<<<<<<<<
17250 * """python version of next().
17254 static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_6__next__(struct __pyx_obj_9csamtools_IteratorRowAllRefs *__pyx_v_self) {
17255 PyObject *__pyx_r = NULL;
17256 __Pyx_RefNannyDeclarations
17258 PyObject *__pyx_t_2 = NULL;
17260 PyObject *__pyx_t_4 = NULL;
17261 PyObject *__pyx_t_5 = NULL;
17262 int __pyx_lineno = 0;
17263 const char *__pyx_filename = NULL;
17264 int __pyx_clineno = 0;
17265 __Pyx_TraceDeclarations
17266 __Pyx_RefNannySetupContext("__next__", 0);
17267 __Pyx_TraceCall("__next__", __pyx_f[0], 1614);
17269 /* "csamtools.pyx":1620
17271 * # Create an initial iterator
17272 * if self.tid==-1: # <<<<<<<<<<<<<<
17273 * if not self.samfile.nreferences:
17274 * raise StopIteration
17276 __pyx_t_1 = (__pyx_v_self->tid == -1);
17279 /* "csamtools.pyx":1621
17280 * # Create an initial iterator
17282 * if not self.samfile.nreferences: # <<<<<<<<<<<<<<
17283 * raise StopIteration
17286 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self->samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17287 __Pyx_GOTREF(__pyx_t_2);
17288 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17289 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17290 __pyx_t_3 = (!__pyx_t_1);
17293 /* "csamtools.pyx":1622
17295 * if not self.samfile.nreferences:
17296 * raise StopIteration # <<<<<<<<<<<<<<
17300 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
17301 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17306 /* "csamtools.pyx":1623
17307 * if not self.samfile.nreferences:
17308 * raise StopIteration
17309 * self.tid = 0 # <<<<<<<<<<<<<<
17313 __pyx_v_self->tid = 0;
17315 /* "csamtools.pyx":1624
17316 * raise StopIteration
17318 * self.nextiter() # <<<<<<<<<<<<<<
17322 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__nextiter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17323 __Pyx_GOTREF(__pyx_t_2);
17324 __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17325 __Pyx_GOTREF(__pyx_t_4);
17326 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17327 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17332 /* "csamtools.pyx":1626
17335 * while 1: # <<<<<<<<<<<<<<
17336 * self.rowiter.cnext()
17342 /* "csamtools.pyx":1627
17345 * self.rowiter.cnext() # <<<<<<<<<<<<<<
17347 * # If current iterator is not exhausted, return aligned read
17349 ((struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *)__pyx_v_self->rowiter->__pyx_vtab)->cnext(__pyx_v_self->rowiter);
17351 /* "csamtools.pyx":1630
17353 * # If current iterator is not exhausted, return aligned read
17354 * if self.rowiter.retval>0: # <<<<<<<<<<<<<<
17355 * return makeAlignedRead(self.rowiter.b)
17358 __pyx_t_3 = (__pyx_v_self->rowiter->retval > 0);
17361 /* "csamtools.pyx":1631
17362 * # If current iterator is not exhausted, return aligned read
17363 * if self.rowiter.retval>0:
17364 * return makeAlignedRead(self.rowiter.b) # <<<<<<<<<<<<<<
17368 __Pyx_XDECREF(__pyx_r);
17369 __pyx_t_4 = __pyx_f_9csamtools_makeAlignedRead(__pyx_v_self->rowiter->b); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17370 __Pyx_GOTREF(__pyx_t_4);
17371 __pyx_r = __pyx_t_4;
17378 /* "csamtools.pyx":1633
17379 * return makeAlignedRead(self.rowiter.b)
17381 * self.tid += 1 # <<<<<<<<<<<<<<
17383 * # Otherwise, proceed to next reference or stop
17385 __pyx_v_self->tid = (__pyx_v_self->tid + 1);
17387 /* "csamtools.pyx":1636
17389 * # Otherwise, proceed to next reference or stop
17390 * if self.tid<self.samfile.nreferences: # <<<<<<<<<<<<<<
17394 __pyx_t_4 = PyInt_FromLong(__pyx_v_self->tid); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17395 __Pyx_GOTREF(__pyx_t_4);
17396 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self->samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17397 __Pyx_GOTREF(__pyx_t_2);
17398 __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17399 __Pyx_GOTREF(__pyx_t_5);
17400 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17401 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17402 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17403 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
17406 /* "csamtools.pyx":1637
17407 * # Otherwise, proceed to next reference or stop
17408 * if self.tid<self.samfile.nreferences:
17409 * self.nextiter() # <<<<<<<<<<<<<<
17411 * raise StopIteration
17413 __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__nextiter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17414 __Pyx_GOTREF(__pyx_t_5);
17415 __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17416 __Pyx_GOTREF(__pyx_t_2);
17417 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
17418 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17423 /* "csamtools.pyx":1639
17426 * raise StopIteration # <<<<<<<<<<<<<<
17428 * cdef class IteratorRowSelection(IteratorRow):
17430 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
17431 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17436 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17439 __Pyx_XDECREF(__pyx_t_2);
17440 __Pyx_XDECREF(__pyx_t_4);
17441 __Pyx_XDECREF(__pyx_t_5);
17442 __Pyx_AddTraceback("csamtools.IteratorRowAllRefs.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17445 __Pyx_XGIVEREF(__pyx_r);
17446 __Pyx_TraceReturn(__pyx_r);
17447 __Pyx_RefNannyFinishContext();
17451 /* Python wrapper */
17452 static int __pyx_pw_9csamtools_20IteratorRowSelection_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
17453 static int __pyx_pw_9csamtools_20IteratorRowSelection_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17454 struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
17455 PyObject *__pyx_v_positions = 0;
17456 int __pyx_v_reopen;
17457 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__positions,&__pyx_n_s__reopen,0};
17459 __Pyx_RefNannyDeclarations
17460 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
17462 PyObject* values[3] = {0,0,0};
17463 if (unlikely(__pyx_kwds)) {
17464 Py_ssize_t kw_args;
17465 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
17466 switch (pos_args) {
17467 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17468 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17469 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17471 default: goto __pyx_L5_argtuple_error;
17473 kw_args = PyDict_Size(__pyx_kwds);
17474 switch (pos_args) {
17476 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
17477 if (likely(values[0])) kw_args--;
17478 else goto __pyx_L5_argtuple_error;
17480 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__positions);
17481 if (likely(values[1])) kw_args--;
17483 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17487 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reopen);
17488 if (value) { values[2] = value; kw_args--; }
17491 if (unlikely(kw_args > 0)) {
17492 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17497 /* "csamtools.pyx":1647
17500 * def __cinit__(self, Samfile samfile, positions, int reopen = True ): # <<<<<<<<<<<<<<
17502 * if not samfile._isOpen():
17504 __pyx_v_reopen = ((int)1);
17507 switch (PyTuple_GET_SIZE(__pyx_args)) {
17508 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17509 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17510 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17512 default: goto __pyx_L5_argtuple_error;
17515 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
17516 __pyx_v_positions = values[1];
17518 __pyx_v_reopen = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17520 __pyx_v_reopen = ((int)1);
17523 goto __pyx_L4_argument_unpacking_done;
17524 __pyx_L5_argtuple_error:;
17525 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
17527 __Pyx_AddTraceback("csamtools.IteratorRowSelection.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17528 __Pyx_RefNannyFinishContext();
17530 __pyx_L4_argument_unpacking_done:;
17531 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17532 __pyx_r = __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self), __pyx_v_samfile, __pyx_v_positions, __pyx_v_reopen);
17537 __Pyx_RefNannyFinishContext();
17541 static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, PyObject *__pyx_v_positions, int __pyx_v_reopen) {
17542 PyObject *__pyx_v_mode = NULL;
17543 PyObject *__pyx_v_store = NULL;
17545 __Pyx_RefNannyDeclarations
17546 PyObject *__pyx_t_1 = NULL;
17547 PyObject *__pyx_t_2 = NULL;
17551 int __pyx_lineno = 0;
17552 const char *__pyx_filename = NULL;
17553 int __pyx_clineno = 0;
17554 __Pyx_TraceDeclarations
17555 __Pyx_RefNannySetupContext("__cinit__", 0);
17556 __Pyx_TraceCall("__cinit__", __pyx_f[0], 1647);
17558 /* "csamtools.pyx":1649
17559 * def __cinit__(self, Samfile samfile, positions, int reopen = True ):
17561 * if not samfile._isOpen(): # <<<<<<<<<<<<<<
17562 * raise ValueError( "I/O operation on closed file" )
17565 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17566 __Pyx_GOTREF(__pyx_t_1);
17567 __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 = 1649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17568 __Pyx_GOTREF(__pyx_t_2);
17569 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17570 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17571 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17572 __pyx_t_4 = (!__pyx_t_3);
17575 /* "csamtools.pyx":1650
17577 * if not samfile._isOpen():
17578 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
17580 * if not samfile._isOpen():
17582 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_123), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17583 __Pyx_GOTREF(__pyx_t_2);
17584 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
17585 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17586 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17591 /* "csamtools.pyx":1652
17592 * raise ValueError( "I/O operation on closed file" )
17594 * if not samfile._isOpen(): # <<<<<<<<<<<<<<
17595 * raise ValueError( "I/O operation on closed file" )
17598 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17599 __Pyx_GOTREF(__pyx_t_2);
17600 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17601 __Pyx_GOTREF(__pyx_t_1);
17602 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17603 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17604 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17605 __pyx_t_3 = (!__pyx_t_4);
17608 /* "csamtools.pyx":1653
17610 * if not samfile._isOpen():
17611 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
17613 * assert samfile.isbam, "can only use this iterator on bam files"
17615 __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_124), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17616 __Pyx_GOTREF(__pyx_t_1);
17617 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
17618 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17619 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17624 /* "csamtools.pyx":1655
17625 * raise ValueError( "I/O operation on closed file" )
17627 * assert samfile.isbam, "can only use this iterator on bam files" # <<<<<<<<<<<<<<
17631 #ifndef CYTHON_WITHOUT_ASSERTIONS
17632 if (unlikely(!__pyx_v_samfile->isbam)) {
17633 PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_125));
17634 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17638 /* "csamtools.pyx":1656
17640 * assert samfile.isbam, "can only use this iterator on bam files"
17641 * mode = b"rb" # <<<<<<<<<<<<<<
17643 * # reopen the file to avoid iterator conflict
17645 __Pyx_INCREF(((PyObject *)__pyx_n_b__rb));
17646 __pyx_v_mode = __pyx_n_b__rb;
17648 /* "csamtools.pyx":1659
17650 * # reopen the file to avoid iterator conflict
17651 * if reopen: # <<<<<<<<<<<<<<
17652 * store = StderrStore()
17653 * self.fp = samopen( samfile._filename, mode, NULL )
17655 if (__pyx_v_reopen) {
17657 /* "csamtools.pyx":1660
17658 * # reopen the file to avoid iterator conflict
17660 * store = StderrStore() # <<<<<<<<<<<<<<
17661 * self.fp = samopen( samfile._filename, mode, NULL )
17664 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17665 __Pyx_GOTREF(__pyx_t_1);
17666 __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 = 1660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17667 __Pyx_GOTREF(__pyx_t_2);
17668 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17669 __pyx_v_store = __pyx_t_2;
17672 /* "csamtools.pyx":1661
17674 * store = StderrStore()
17675 * self.fp = samopen( samfile._filename, mode, NULL ) # <<<<<<<<<<<<<<
17677 * assert self.fp != NULL
17679 __pyx_t_5 = PyBytes_AsString(((PyObject *)__pyx_v_mode)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17680 __pyx_v_self->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_5, NULL);
17682 /* "csamtools.pyx":1662
17683 * store = StderrStore()
17684 * self.fp = samopen( samfile._filename, mode, NULL )
17685 * store.release() # <<<<<<<<<<<<<<
17686 * assert self.fp != NULL
17687 * self.owns_samfile = True
17689 __pyx_t_2 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17690 __Pyx_GOTREF(__pyx_t_2);
17691 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17692 __Pyx_GOTREF(__pyx_t_1);
17693 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17694 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17696 /* "csamtools.pyx":1663
17697 * self.fp = samopen( samfile._filename, mode, NULL )
17699 * assert self.fp != NULL # <<<<<<<<<<<<<<
17700 * self.owns_samfile = True
17703 #ifndef CYTHON_WITHOUT_ASSERTIONS
17704 if (unlikely(!(__pyx_v_self->fp != NULL))) {
17705 PyErr_SetNone(PyExc_AssertionError);
17706 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17710 /* "csamtools.pyx":1664
17712 * assert self.fp != NULL
17713 * self.owns_samfile = True # <<<<<<<<<<<<<<
17715 * self.fp = samfile.samfile
17717 __pyx_v_self->owns_samfile = 1;
17722 /* "csamtools.pyx":1666
17723 * self.owns_samfile = True
17725 * self.fp = samfile.samfile # <<<<<<<<<<<<<<
17726 * self.owns_samfile = False
17729 __pyx_v_self->fp = __pyx_v_samfile->samfile;
17731 /* "csamtools.pyx":1667
17733 * self.fp = samfile.samfile
17734 * self.owns_samfile = False # <<<<<<<<<<<<<<
17736 * # allocate memory for alignment
17738 __pyx_v_self->owns_samfile = 0;
17742 /* "csamtools.pyx":1670
17744 * # allocate memory for alignment
17745 * self.b = <bam1_t*>calloc(1, sizeof(bam1_t)) # <<<<<<<<<<<<<<
17747 * self.positions = positions
17749 __pyx_v_self->b = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
17751 /* "csamtools.pyx":1672
17752 * self.b = <bam1_t*>calloc(1, sizeof(bam1_t))
17754 * self.positions = positions # <<<<<<<<<<<<<<
17755 * self.current_pos = 0
17758 __Pyx_INCREF(__pyx_v_positions);
17759 __Pyx_GIVEREF(__pyx_v_positions);
17760 __Pyx_GOTREF(__pyx_v_self->positions);
17761 __Pyx_DECREF(__pyx_v_self->positions);
17762 __pyx_v_self->positions = __pyx_v_positions;
17764 /* "csamtools.pyx":1673
17766 * self.positions = positions
17767 * self.current_pos = 0 # <<<<<<<<<<<<<<
17769 * def __iter__(self):
17771 __pyx_v_self->current_pos = 0;
17776 __Pyx_XDECREF(__pyx_t_1);
17777 __Pyx_XDECREF(__pyx_t_2);
17778 __Pyx_AddTraceback("csamtools.IteratorRowSelection.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17781 __Pyx_XDECREF(__pyx_v_mode);
17782 __Pyx_XDECREF(__pyx_v_store);
17783 __Pyx_TraceReturn(Py_None);
17784 __Pyx_RefNannyFinishContext();
17788 /* Python wrapper */
17789 static PyObject *__pyx_pw_9csamtools_20IteratorRowSelection_3__iter__(PyObject *__pyx_v_self); /*proto*/
17790 static PyObject *__pyx_pw_9csamtools_20IteratorRowSelection_3__iter__(PyObject *__pyx_v_self) {
17791 PyObject *__pyx_r = 0;
17792 __Pyx_RefNannyDeclarations
17793 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
17794 __pyx_r = __pyx_pf_9csamtools_20IteratorRowSelection_2__iter__(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self));
17795 __Pyx_RefNannyFinishContext();
17799 /* "csamtools.pyx":1675
17800 * self.current_pos = 0
17802 * def __iter__(self): # <<<<<<<<<<<<<<
17807 static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_2__iter__(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self) {
17808 PyObject *__pyx_r = NULL;
17809 __Pyx_RefNannyDeclarations
17810 __Pyx_TraceDeclarations
17811 __Pyx_RefNannySetupContext("__iter__", 0);
17812 __Pyx_TraceCall("__iter__", __pyx_f[0], 1675);
17814 /* "csamtools.pyx":1676
17816 * def __iter__(self):
17817 * return self # <<<<<<<<<<<<<<
17819 * cdef bam1_t * getCurrent( self ):
17821 __Pyx_XDECREF(__pyx_r);
17822 __Pyx_INCREF(((PyObject *)__pyx_v_self));
17823 __pyx_r = ((PyObject *)__pyx_v_self);
17826 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17828 __Pyx_XGIVEREF(__pyx_r);
17829 __Pyx_TraceReturn(__pyx_r);
17830 __Pyx_RefNannyFinishContext();
17834 /* "csamtools.pyx":1678
17837 * cdef bam1_t * getCurrent( self ): # <<<<<<<<<<<<<<
17842 static bam1_t *__pyx_f_9csamtools_20IteratorRowSelection_getCurrent(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self) {
17844 __Pyx_RefNannyDeclarations
17845 __Pyx_TraceDeclarations
17846 __Pyx_RefNannySetupContext("getCurrent", 0);
17847 __Pyx_TraceCall("getCurrent", __pyx_f[0], 1678);
17849 /* "csamtools.pyx":1679
17851 * cdef bam1_t * getCurrent( self ):
17852 * return self.b # <<<<<<<<<<<<<<
17854 * cdef int cnext(self):
17856 __pyx_r = __pyx_v_self->b;
17861 __Pyx_TraceReturn(Py_None);
17862 __Pyx_RefNannyFinishContext();
17866 /* "csamtools.pyx":1681
17869 * cdef int cnext(self): # <<<<<<<<<<<<<<
17870 * '''cversion of iterator'''
17874 static int __pyx_f_9csamtools_20IteratorRowSelection_cnext(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self) {
17876 __Pyx_RefNannyDeclarations
17877 PyObject *__pyx_t_1 = NULL;
17878 Py_ssize_t __pyx_t_2;
17880 uint64_t __pyx_t_4;
17881 int __pyx_lineno = 0;
17882 const char *__pyx_filename = NULL;
17883 int __pyx_clineno = 0;
17884 __Pyx_TraceDeclarations
17885 __Pyx_RefNannySetupContext("cnext", 0);
17886 __Pyx_TraceCall("cnext", __pyx_f[0], 1681);
17888 /* "csamtools.pyx":1685
17890 * # end iteration if out of positions
17891 * if self.current_pos >= len(self.positions): return -1 # <<<<<<<<<<<<<<
17893 * bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 )
17895 __pyx_t_1 = __pyx_v_self->positions;
17896 __Pyx_INCREF(__pyx_t_1);
17897 __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17898 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17899 __pyx_t_3 = (__pyx_v_self->current_pos >= __pyx_t_2);
17907 /* "csamtools.pyx":1687
17908 * if self.current_pos >= len(self.positions): return -1
17910 * bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 ) # <<<<<<<<<<<<<<
17911 * self.current_pos += 1
17912 * return samread(self.fp, self.b)
17914 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->positions, __pyx_v_self->current_pos, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17915 __Pyx_GOTREF(__pyx_t_1);
17916 __pyx_t_4 = __Pyx_PyInt_from_py_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17917 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17918 bam_seek(__pyx_v_self->fp->x.bam, __pyx_t_4, 0);
17920 /* "csamtools.pyx":1688
17922 * bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 )
17923 * self.current_pos += 1 # <<<<<<<<<<<<<<
17924 * return samread(self.fp, self.b)
17927 __pyx_v_self->current_pos = (__pyx_v_self->current_pos + 1);
17929 /* "csamtools.pyx":1689
17930 * bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 )
17931 * self.current_pos += 1
17932 * return samread(self.fp, self.b) # <<<<<<<<<<<<<<
17934 * def __next__(self):
17936 __pyx_r = samread(__pyx_v_self->fp, __pyx_v_self->b);
17942 __Pyx_XDECREF(__pyx_t_1);
17943 __Pyx_WriteUnraisable("csamtools.IteratorRowSelection.cnext", __pyx_clineno, __pyx_lineno, __pyx_filename);
17946 __Pyx_TraceReturn(Py_None);
17947 __Pyx_RefNannyFinishContext();
17951 /* Python wrapper */
17952 static PyObject *__pyx_pw_9csamtools_20IteratorRowSelection_5__next__(PyObject *__pyx_v_self); /*proto*/
17953 static char __pyx_doc_9csamtools_20IteratorRowSelection_4__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n ";
17954 struct wrapperbase __pyx_wrapperbase_9csamtools_20IteratorRowSelection_4__next__;
17955 static PyObject *__pyx_pw_9csamtools_20IteratorRowSelection_5__next__(PyObject *__pyx_v_self) {
17956 PyObject *__pyx_r = 0;
17957 __Pyx_RefNannyDeclarations
17958 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
17959 __pyx_r = __pyx_pf_9csamtools_20IteratorRowSelection_4__next__(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self));
17960 __Pyx_RefNannyFinishContext();
17964 /* "csamtools.pyx":1691
17965 * return samread(self.fp, self.b)
17967 * def __next__(self): # <<<<<<<<<<<<<<
17968 * """python version of next().
17972 static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_4__next__(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self) {
17974 PyObject *__pyx_r = NULL;
17975 __Pyx_RefNannyDeclarations
17977 PyObject *__pyx_t_2 = NULL;
17978 int __pyx_lineno = 0;
17979 const char *__pyx_filename = NULL;
17980 int __pyx_clineno = 0;
17981 __Pyx_TraceDeclarations
17982 __Pyx_RefNannySetupContext("__next__", 0);
17983 __Pyx_TraceCall("__next__", __pyx_f[0], 1691);
17985 /* "csamtools.pyx":1697
17988 * cdef int ret = self.cnext() # <<<<<<<<<<<<<<
17990 * return makeAlignedRead( self.b )
17992 __pyx_v_ret = ((struct __pyx_vtabstruct_9csamtools_IteratorRowSelection *)__pyx_v_self->__pyx_vtab)->cnext(__pyx_v_self);
17994 /* "csamtools.pyx":1698
17996 * cdef int ret = self.cnext()
17997 * if (ret > 0): # <<<<<<<<<<<<<<
17998 * return makeAlignedRead( self.b )
18001 __pyx_t_1 = (__pyx_v_ret > 0);
18004 /* "csamtools.pyx":1699
18005 * cdef int ret = self.cnext()
18007 * return makeAlignedRead( self.b ) # <<<<<<<<<<<<<<
18009 * raise StopIteration
18011 __Pyx_XDECREF(__pyx_r);
18012 __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(__pyx_v_self->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18013 __Pyx_GOTREF(__pyx_t_2);
18014 __pyx_r = __pyx_t_2;
18021 /* "csamtools.pyx":1701
18022 * return makeAlignedRead( self.b )
18024 * raise StopIteration # <<<<<<<<<<<<<<
18026 * def __dealloc__(self):
18028 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
18029 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18033 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18036 __Pyx_XDECREF(__pyx_t_2);
18037 __Pyx_AddTraceback("csamtools.IteratorRowSelection.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18040 __Pyx_XGIVEREF(__pyx_r);
18041 __Pyx_TraceReturn(__pyx_r);
18042 __Pyx_RefNannyFinishContext();
18046 /* Python wrapper */
18047 static void __pyx_pw_9csamtools_20IteratorRowSelection_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
18048 static void __pyx_pw_9csamtools_20IteratorRowSelection_7__dealloc__(PyObject *__pyx_v_self) {
18049 __Pyx_RefNannyDeclarations
18050 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
18051 __pyx_pf_9csamtools_20IteratorRowSelection_6__dealloc__(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self));
18052 __Pyx_RefNannyFinishContext();
18055 /* "csamtools.pyx":1703
18056 * raise StopIteration
18058 * def __dealloc__(self): # <<<<<<<<<<<<<<
18059 * bam_destroy1(self.b)
18060 * if self.owns_samfile: samclose( self.fp )
18063 static void __pyx_pf_9csamtools_20IteratorRowSelection_6__dealloc__(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self) {
18064 __Pyx_RefNannyDeclarations
18065 __Pyx_TraceDeclarations
18066 __Pyx_RefNannySetupContext("__dealloc__", 0);
18067 __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1703);
18069 /* "csamtools.pyx":1704
18071 * def __dealloc__(self):
18072 * bam_destroy1(self.b) # <<<<<<<<<<<<<<
18073 * if self.owns_samfile: samclose( self.fp )
18076 bam_destroy1(__pyx_v_self->b);
18078 /* "csamtools.pyx":1705
18079 * def __dealloc__(self):
18080 * bam_destroy1(self.b)
18081 * if self.owns_samfile: samclose( self.fp ) # <<<<<<<<<<<<<<
18083 * ##-------------------------------------------------------------------
18085 if (__pyx_v_self->owns_samfile) {
18086 samclose(__pyx_v_self->fp);
18091 __Pyx_TraceReturn(Py_None);
18092 __Pyx_RefNannyFinishContext();
18095 /* "csamtools.pyx":1710
18096 * ##-------------------------------------------------------------------
18097 * ##-------------------------------------------------------------------
18098 * cdef int __advance_all( void * data, bam1_t * b ): # <<<<<<<<<<<<<<
18099 * '''advance without any read filtering.
18103 static int __pyx_f_9csamtools___advance_all(void *__pyx_v_data, bam1_t *__pyx_v_b) {
18104 __pyx_t_9csamtools___iterdata *__pyx_v_d;
18106 __Pyx_RefNannyDeclarations
18107 __Pyx_TraceDeclarations
18108 __Pyx_RefNannySetupContext("__advance_all", 0);
18109 __Pyx_TraceCall("__advance_all", __pyx_f[0], 1710);
18111 /* "csamtools.pyx":1714
18113 * cdef __iterdata * d
18114 * d = <__iterdata*>data # <<<<<<<<<<<<<<
18115 * return bam_iter_read( d.samfile.x.bam, d.iter, b )
18118 __pyx_v_d = ((__pyx_t_9csamtools___iterdata *)__pyx_v_data);
18120 /* "csamtools.pyx":1715
18121 * cdef __iterdata * d
18122 * d = <__iterdata*>data
18123 * return bam_iter_read( d.samfile.x.bam, d.iter, b ) # <<<<<<<<<<<<<<
18125 * cdef int __advance_snpcalls( void * data, bam1_t * b ):
18127 __pyx_r = bam_iter_read(__pyx_v_d->samfile->x.bam, __pyx_v_d->iter, __pyx_v_b);
18132 __Pyx_TraceReturn(Py_None);
18133 __Pyx_RefNannyFinishContext();
18137 /* "csamtools.pyx":1717
18138 * return bam_iter_read( d.samfile.x.bam, d.iter, b )
18140 * cdef int __advance_snpcalls( void * data, bam1_t * b ): # <<<<<<<<<<<<<<
18141 * '''advance using same filter and read processing as in
18142 * the samtools pileup.
18145 static int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__pyx_v_b) {
18146 __pyx_t_9csamtools___iterdata *__pyx_v_d;
18150 int __pyx_v_is_cns;
18151 int __pyx_v_is_nobaq;
18152 int __pyx_v_capQ_thres;
18154 __Pyx_RefNannyDeclarations
18158 PyObject *__pyx_t_4 = NULL;
18159 PyObject *__pyx_t_5 = NULL;
18160 PyObject *__pyx_t_6 = NULL;
18162 int __pyx_lineno = 0;
18163 const char *__pyx_filename = NULL;
18164 int __pyx_clineno = 0;
18165 __Pyx_TraceDeclarations
18166 __Pyx_RefNannySetupContext("__advance_snpcalls", 0);
18167 __Pyx_TraceCall("__advance_snpcalls", __pyx_f[0], 1717);
18169 /* "csamtools.pyx":1722
18171 * cdef __iterdata * d
18172 * d = <__iterdata*>data # <<<<<<<<<<<<<<
18174 * cdef int ret = bam_iter_read( d.samfile.x.bam, d.iter, b )
18176 __pyx_v_d = ((__pyx_t_9csamtools___iterdata *)__pyx_v_data);
18178 /* "csamtools.pyx":1724
18179 * d = <__iterdata*>data
18181 * cdef int ret = bam_iter_read( d.samfile.x.bam, d.iter, b ) # <<<<<<<<<<<<<<
18182 * cdef int skip = 0
18185 __pyx_v_ret = bam_iter_read(__pyx_v_d->samfile->x.bam, __pyx_v_d->iter, __pyx_v_b);
18187 /* "csamtools.pyx":1725
18189 * cdef int ret = bam_iter_read( d.samfile.x.bam, d.iter, b )
18190 * cdef int skip = 0 # <<<<<<<<<<<<<<
18192 * cdef int is_cns = 1
18196 /* "csamtools.pyx":1727
18197 * cdef int skip = 0
18199 * cdef int is_cns = 1 # <<<<<<<<<<<<<<
18200 * cdef int is_nobaq = 0
18201 * cdef int capQ_thres = 0
18203 __pyx_v_is_cns = 1;
18205 /* "csamtools.pyx":1728
18207 * cdef int is_cns = 1
18208 * cdef int is_nobaq = 0 # <<<<<<<<<<<<<<
18209 * cdef int capQ_thres = 0
18212 __pyx_v_is_nobaq = 0;
18214 /* "csamtools.pyx":1729
18215 * cdef int is_cns = 1
18216 * cdef int is_nobaq = 0
18217 * cdef int capQ_thres = 0 # <<<<<<<<<<<<<<
18219 * # reload sequence
18221 __pyx_v_capQ_thres = 0;
18223 /* "csamtools.pyx":1732
18225 * # reload sequence
18226 * if d.fastafile != NULL and b.core.tid != d.tid: # <<<<<<<<<<<<<<
18227 * if d.seq != NULL: free(d.seq)
18228 * d.tid = b.core.tid
18230 __pyx_t_1 = (__pyx_v_d->fastafile != NULL);
18232 __pyx_t_2 = (__pyx_v_b->core.tid != __pyx_v_d->tid);
18233 __pyx_t_3 = __pyx_t_2;
18235 __pyx_t_3 = __pyx_t_1;
18239 /* "csamtools.pyx":1733
18240 * # reload sequence
18241 * if d.fastafile != NULL and b.core.tid != d.tid:
18242 * if d.seq != NULL: free(d.seq) # <<<<<<<<<<<<<<
18243 * d.tid = b.core.tid
18244 * d.seq = faidx_fetch_seq(d.fastafile,
18246 __pyx_t_3 = (__pyx_v_d->seq != NULL);
18248 free(__pyx_v_d->seq);
18253 /* "csamtools.pyx":1734
18254 * if d.fastafile != NULL and b.core.tid != d.tid:
18255 * if d.seq != NULL: free(d.seq)
18256 * d.tid = b.core.tid # <<<<<<<<<<<<<<
18257 * d.seq = faidx_fetch_seq(d.fastafile,
18258 * d.samfile.header.target_name[d.tid],
18260 __pyx_v_d->tid = __pyx_v_b->core.tid;
18262 /* "csamtools.pyx":1735
18263 * if d.seq != NULL: free(d.seq)
18264 * d.tid = b.core.tid
18265 * d.seq = faidx_fetch_seq(d.fastafile, # <<<<<<<<<<<<<<
18266 * d.samfile.header.target_name[d.tid],
18269 __pyx_v_d->seq = faidx_fetch_seq(__pyx_v_d->fastafile, (__pyx_v_d->samfile->header->target_name[__pyx_v_d->tid]), 0, __pyx_v_9csamtools_max_pos, (&__pyx_v_d->seq_len));
18271 /* "csamtools.pyx":1739
18274 * if d.seq == NULL: # <<<<<<<<<<<<<<
18275 * raise ValueError( "reference sequence for '%s' (tid=%i) not found" % \
18276 * (d.samfile.header.target_name[d.tid],
18278 __pyx_t_3 = (__pyx_v_d->seq == NULL);
18281 /* "csamtools.pyx":1741
18282 * if d.seq == NULL:
18283 * raise ValueError( "reference sequence for '%s' (tid=%i) not found" % \
18284 * (d.samfile.header.target_name[d.tid], # <<<<<<<<<<<<<<
18288 __pyx_t_4 = PyBytes_FromString((__pyx_v_d->samfile->header->target_name[__pyx_v_d->tid])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18289 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
18291 /* "csamtools.pyx":1742
18292 * raise ValueError( "reference sequence for '%s' (tid=%i) not found" % \
18293 * (d.samfile.header.target_name[d.tid],
18294 * d.tid)) # <<<<<<<<<<<<<<
18298 __pyx_t_5 = PyInt_FromLong(__pyx_v_d->tid); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18299 __Pyx_GOTREF(__pyx_t_5);
18300 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18301 __Pyx_GOTREF(__pyx_t_6);
18302 PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4));
18303 __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
18304 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
18305 __Pyx_GIVEREF(__pyx_t_5);
18308 __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_126), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18309 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
18310 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
18311 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18312 __Pyx_GOTREF(__pyx_t_6);
18313 PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
18314 __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
18316 __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18317 __Pyx_GOTREF(__pyx_t_5);
18318 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
18319 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
18320 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
18321 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18329 /* "csamtools.pyx":1745
18332 * while ret >= 0: # <<<<<<<<<<<<<<
18337 __pyx_t_3 = (__pyx_v_ret >= 0);
18338 if (!__pyx_t_3) break;
18340 /* "csamtools.pyx":1747
18343 * skip = 0 # <<<<<<<<<<<<<<
18345 * # realign read - changes base qualities
18349 /* "csamtools.pyx":1750
18351 * # realign read - changes base qualities
18352 * if d.seq != NULL and is_cns and not is_nobaq: bam_prob_realn( b, d.seq ) # <<<<<<<<<<<<<<
18354 * if d.seq != NULL and capQ_thres > 10:
18356 __pyx_t_3 = (__pyx_v_d->seq != NULL);
18358 if (__pyx_v_is_cns) {
18359 __pyx_t_1 = (!__pyx_v_is_nobaq);
18360 __pyx_t_2 = __pyx_t_1;
18362 __pyx_t_2 = __pyx_v_is_cns;
18364 __pyx_t_1 = __pyx_t_2;
18366 __pyx_t_1 = __pyx_t_3;
18369 bam_prob_realn(__pyx_v_b, __pyx_v_d->seq);
18374 /* "csamtools.pyx":1752
18375 * if d.seq != NULL and is_cns and not is_nobaq: bam_prob_realn( b, d.seq )
18377 * if d.seq != NULL and capQ_thres > 10: # <<<<<<<<<<<<<<
18378 * q = bam_cap_mapQ(b, d.seq, capQ_thres)
18379 * if q < 0: skip = 1
18381 __pyx_t_1 = (__pyx_v_d->seq != NULL);
18383 __pyx_t_3 = (__pyx_v_capQ_thres > 10);
18384 __pyx_t_2 = __pyx_t_3;
18386 __pyx_t_2 = __pyx_t_1;
18390 /* "csamtools.pyx":1753
18392 * if d.seq != NULL and capQ_thres > 10:
18393 * q = bam_cap_mapQ(b, d.seq, capQ_thres) # <<<<<<<<<<<<<<
18394 * if q < 0: skip = 1
18395 * elif b.core.qual > q: b.core.qual = q
18397 __pyx_v_q = bam_cap_mapQ(__pyx_v_b, __pyx_v_d->seq, __pyx_v_capQ_thres);
18399 /* "csamtools.pyx":1754
18400 * if d.seq != NULL and capQ_thres > 10:
18401 * q = bam_cap_mapQ(b, d.seq, capQ_thres)
18402 * if q < 0: skip = 1 # <<<<<<<<<<<<<<
18403 * elif b.core.qual > q: b.core.qual = q
18404 * if b.core.flag & BAM_FUNMAP: skip = 1
18406 __pyx_t_2 = (__pyx_v_q < 0);
18412 /* "csamtools.pyx":1755
18413 * q = bam_cap_mapQ(b, d.seq, capQ_thres)
18414 * if q < 0: skip = 1
18415 * elif b.core.qual > q: b.core.qual = q # <<<<<<<<<<<<<<
18416 * if b.core.flag & BAM_FUNMAP: skip = 1
18417 * elif b.core.flag & 1 and not b.core.flag & 2: skip = 1
18419 __pyx_t_2 = (__pyx_v_b->core.qual > __pyx_v_q);
18421 __pyx_v_b->core.qual = __pyx_v_q;
18429 /* "csamtools.pyx":1756
18430 * if q < 0: skip = 1
18431 * elif b.core.qual > q: b.core.qual = q
18432 * if b.core.flag & BAM_FUNMAP: skip = 1 # <<<<<<<<<<<<<<
18433 * elif b.core.flag & 1 and not b.core.flag & 2: skip = 1
18436 __pyx_t_7 = (__pyx_v_b->core.flag & 4);
18442 /* "csamtools.pyx":1757
18443 * elif b.core.qual > q: b.core.qual = q
18444 * if b.core.flag & BAM_FUNMAP: skip = 1
18445 * elif b.core.flag & 1 and not b.core.flag & 2: skip = 1 # <<<<<<<<<<<<<<
18447 * if not skip: break
18449 if ((__pyx_v_b->core.flag & 1)) {
18450 __pyx_t_2 = (!(__pyx_v_b->core.flag & 2));
18451 __pyx_t_1 = __pyx_t_2;
18453 __pyx_t_1 = (__pyx_v_b->core.flag & 1);
18461 /* "csamtools.pyx":1759
18462 * elif b.core.flag & 1 and not b.core.flag & 2: skip = 1
18464 * if not skip: break # <<<<<<<<<<<<<<
18465 * # additional filters
18468 __pyx_t_1 = (!__pyx_v_skip);
18470 goto __pyx_L7_break;
18475 /* "csamtools.pyx":1762
18476 * # additional filters
18478 * ret = bam_iter_read( d.samfile.x.bam, d.iter, b ) # <<<<<<<<<<<<<<
18482 __pyx_v_ret = bam_iter_read(__pyx_v_d->samfile->x.bam, __pyx_v_d->iter, __pyx_v_b);
18486 /* "csamtools.pyx":1764
18487 * ret = bam_iter_read( d.samfile.x.bam, d.iter, b )
18489 * return ret # <<<<<<<<<<<<<<
18491 * cdef class IteratorColumn:
18493 __pyx_r = __pyx_v_ret;
18499 __Pyx_XDECREF(__pyx_t_4);
18500 __Pyx_XDECREF(__pyx_t_5);
18501 __Pyx_XDECREF(__pyx_t_6);
18502 __Pyx_WriteUnraisable("csamtools.__advance_snpcalls", __pyx_clineno, __pyx_lineno, __pyx_filename);
18505 __Pyx_TraceReturn(Py_None);
18506 __Pyx_RefNannyFinishContext();
18510 /* Python wrapper */
18511 static int __pyx_pw_9csamtools_14IteratorColumn_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
18512 static int __pyx_pw_9csamtools_14IteratorColumn_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
18513 struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
18514 PyObject *__pyx_v_kwargs = 0;
18515 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0};
18517 __Pyx_RefNannyDeclarations
18518 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
18519 __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
18520 __Pyx_GOTREF(__pyx_v_kwargs);
18522 PyObject* values[1] = {0};
18523 if (unlikely(__pyx_kwds)) {
18524 Py_ssize_t kw_args;
18525 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
18526 switch (pos_args) {
18527 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18529 default: goto __pyx_L5_argtuple_error;
18531 kw_args = PyDict_Size(__pyx_kwds);
18532 switch (pos_args) {
18534 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
18535 if (likely(values[0])) kw_args--;
18536 else goto __pyx_L5_argtuple_error;
18538 if (unlikely(kw_args > 0)) {
18539 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18541 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
18542 goto __pyx_L5_argtuple_error;
18544 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18546 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
18548 goto __pyx_L4_argument_unpacking_done;
18549 __pyx_L5_argtuple_error:;
18550 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
18552 __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
18553 __Pyx_AddTraceback("csamtools.IteratorColumn.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18554 __Pyx_RefNannyFinishContext();
18556 __pyx_L4_argument_unpacking_done:;
18557 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18558 __pyx_r = __pyx_pf_9csamtools_14IteratorColumn___cinit__(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), __pyx_v_samfile, __pyx_v_kwargs);
18563 __Pyx_XDECREF(__pyx_v_kwargs);
18564 __Pyx_RefNannyFinishContext();
18568 /* "csamtools.pyx":1813
18571 * def __cinit__( self, Samfile samfile, **kwargs ): # <<<<<<<<<<<<<<
18572 * self.samfile = samfile
18573 * self.mask = kwargs.get("mask", BAM_DEF_MASK )
18576 static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, PyObject *__pyx_v_kwargs) {
18578 __Pyx_RefNannyDeclarations
18579 PyObject *__pyx_t_1 = NULL;
18580 PyObject *__pyx_t_2 = NULL;
18582 int __pyx_lineno = 0;
18583 const char *__pyx_filename = NULL;
18584 int __pyx_clineno = 0;
18585 __Pyx_TraceDeclarations
18586 __Pyx_RefNannySetupContext("__cinit__", 0);
18587 __Pyx_TraceCall("__cinit__", __pyx_f[0], 1813);
18589 /* "csamtools.pyx":1814
18591 * def __cinit__( self, Samfile samfile, **kwargs ):
18592 * self.samfile = samfile # <<<<<<<<<<<<<<
18593 * self.mask = kwargs.get("mask", BAM_DEF_MASK )
18594 * self.fastafile = kwargs.get( "fastafile", None )
18596 __Pyx_INCREF(((PyObject *)__pyx_v_samfile));
18597 __Pyx_GIVEREF(((PyObject *)__pyx_v_samfile));
18598 __Pyx_GOTREF(__pyx_v_self->samfile);
18599 __Pyx_DECREF(((PyObject *)__pyx_v_self->samfile));
18600 __pyx_v_self->samfile = __pyx_v_samfile;
18602 /* "csamtools.pyx":1815
18603 * def __cinit__( self, Samfile samfile, **kwargs ):
18604 * self.samfile = samfile
18605 * self.mask = kwargs.get("mask", BAM_DEF_MASK ) # <<<<<<<<<<<<<<
18606 * self.fastafile = kwargs.get( "fastafile", None )
18607 * self.stepper = kwargs.get( "stepper", None )
18609 __pyx_t_1 = PyInt_FromLong(BAM_DEF_MASK); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18610 __Pyx_GOTREF(__pyx_t_1);
18611 __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__mask), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18612 __Pyx_GOTREF(__pyx_t_2);
18613 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18614 __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 = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18615 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18616 __pyx_v_self->mask = __pyx_t_3;
18618 /* "csamtools.pyx":1816
18619 * self.samfile = samfile
18620 * self.mask = kwargs.get("mask", BAM_DEF_MASK )
18621 * self.fastafile = kwargs.get( "fastafile", None ) # <<<<<<<<<<<<<<
18622 * self.stepper = kwargs.get( "stepper", None )
18623 * self.max_depth = kwargs.get( "max_depth", 8000 )
18625 __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__fastafile), Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18626 __Pyx_GOTREF(__pyx_t_2);
18627 if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9csamtools_Fastafile))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18628 __Pyx_GIVEREF(__pyx_t_2);
18629 __Pyx_GOTREF(__pyx_v_self->fastafile);
18630 __Pyx_DECREF(((PyObject *)__pyx_v_self->fastafile));
18631 __pyx_v_self->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_t_2);
18634 /* "csamtools.pyx":1817
18635 * self.mask = kwargs.get("mask", BAM_DEF_MASK )
18636 * self.fastafile = kwargs.get( "fastafile", None )
18637 * self.stepper = kwargs.get( "stepper", None ) # <<<<<<<<<<<<<<
18638 * self.max_depth = kwargs.get( "max_depth", 8000 )
18639 * self.iterdata.seq = NULL
18641 __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__stepper), Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18642 __Pyx_GOTREF(__pyx_t_2);
18643 __Pyx_GIVEREF(__pyx_t_2);
18644 __Pyx_GOTREF(__pyx_v_self->stepper);
18645 __Pyx_DECREF(__pyx_v_self->stepper);
18646 __pyx_v_self->stepper = __pyx_t_2;
18649 /* "csamtools.pyx":1818
18650 * self.fastafile = kwargs.get( "fastafile", None )
18651 * self.stepper = kwargs.get( "stepper", None )
18652 * self.max_depth = kwargs.get( "max_depth", 8000 ) # <<<<<<<<<<<<<<
18653 * self.iterdata.seq = NULL
18656 __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__max_depth), __pyx_int_8000); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18657 __Pyx_GOTREF(__pyx_t_2);
18658 __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 = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18659 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18660 __pyx_v_self->max_depth = __pyx_t_3;
18662 /* "csamtools.pyx":1819
18663 * self.stepper = kwargs.get( "stepper", None )
18664 * self.max_depth = kwargs.get( "max_depth", 8000 )
18665 * self.iterdata.seq = NULL # <<<<<<<<<<<<<<
18669 __pyx_v_self->iterdata.seq = NULL;
18671 /* "csamtools.pyx":1820
18672 * self.max_depth = kwargs.get( "max_depth", 8000 )
18673 * self.iterdata.seq = NULL
18674 * self.tid = 0 # <<<<<<<<<<<<<<
18678 __pyx_v_self->tid = 0;
18680 /* "csamtools.pyx":1821
18681 * self.iterdata.seq = NULL
18683 * self.pos = 0 # <<<<<<<<<<<<<<
18687 __pyx_v_self->pos = 0;
18689 /* "csamtools.pyx":1822
18692 * self.n_plp = 0 # <<<<<<<<<<<<<<
18694 * self.pileup_iter = <bam_plp_t>NULL
18696 __pyx_v_self->n_plp = 0;
18698 /* "csamtools.pyx":1823
18701 * self.plp = NULL # <<<<<<<<<<<<<<
18702 * self.pileup_iter = <bam_plp_t>NULL
18705 __pyx_v_self->plp = NULL;
18707 /* "csamtools.pyx":1824
18710 * self.pileup_iter = <bam_plp_t>NULL # <<<<<<<<<<<<<<
18714 __pyx_v_self->pileup_iter = NULL;
18719 __Pyx_XDECREF(__pyx_t_1);
18720 __Pyx_XDECREF(__pyx_t_2);
18721 __Pyx_AddTraceback("csamtools.IteratorColumn.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18724 __Pyx_TraceReturn(Py_None);
18725 __Pyx_RefNannyFinishContext();
18729 /* Python wrapper */
18730 static PyObject *__pyx_pw_9csamtools_14IteratorColumn_3__iter__(PyObject *__pyx_v_self); /*proto*/
18731 static PyObject *__pyx_pw_9csamtools_14IteratorColumn_3__iter__(PyObject *__pyx_v_self) {
18732 PyObject *__pyx_r = 0;
18733 __Pyx_RefNannyDeclarations
18734 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
18735 __pyx_r = __pyx_pf_9csamtools_14IteratorColumn_2__iter__(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self));
18736 __Pyx_RefNannyFinishContext();
18740 /* "csamtools.pyx":1827
18743 * def __iter__(self): # <<<<<<<<<<<<<<
18748 static PyObject *__pyx_pf_9csamtools_14IteratorColumn_2__iter__(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self) {
18749 PyObject *__pyx_r = NULL;
18750 __Pyx_RefNannyDeclarations
18751 __Pyx_TraceDeclarations
18752 __Pyx_RefNannySetupContext("__iter__", 0);
18753 __Pyx_TraceCall("__iter__", __pyx_f[0], 1827);
18755 /* "csamtools.pyx":1828
18757 * def __iter__(self):
18758 * return self # <<<<<<<<<<<<<<
18760 * cdef int cnext(self):
18762 __Pyx_XDECREF(__pyx_r);
18763 __Pyx_INCREF(((PyObject *)__pyx_v_self));
18764 __pyx_r = ((PyObject *)__pyx_v_self);
18767 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18769 __Pyx_XGIVEREF(__pyx_r);
18770 __Pyx_TraceReturn(__pyx_r);
18771 __Pyx_RefNannyFinishContext();
18775 /* "csamtools.pyx":1830
18778 * cdef int cnext(self): # <<<<<<<<<<<<<<
18779 * '''perform next iteration.
18783 static int __pyx_f_9csamtools_14IteratorColumn_cnext(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self) {
18785 __Pyx_RefNannyDeclarations
18786 __Pyx_TraceDeclarations
18787 __Pyx_RefNannySetupContext("cnext", 0);
18788 __Pyx_TraceCall("cnext", __pyx_f[0], 1830);
18790 /* "csamtools.pyx":1836
18791 * It has been re-implemented to permit for filtering.
18793 * self.plp = bam_plp_auto( self.pileup_iter, # <<<<<<<<<<<<<<
18797 __pyx_v_self->plp = bam_plp_auto(__pyx_v_self->pileup_iter, (&__pyx_v_self->tid), (&__pyx_v_self->pos), (&__pyx_v_self->n_plp));
18800 __Pyx_TraceReturn(Py_None);
18801 __Pyx_RefNannyFinishContext();
18805 /* "csamtools.pyx":1841
18808 * cdef char * getSequence( self ): # <<<<<<<<<<<<<<
18809 * '''return current reference sequence underlying the iterator.
18813 static char *__pyx_f_9csamtools_14IteratorColumn_getSequence(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self) {
18815 __Pyx_RefNannyDeclarations
18816 __Pyx_TraceDeclarations
18817 __Pyx_RefNannySetupContext("getSequence", 0);
18818 __Pyx_TraceCall("getSequence", __pyx_f[0], 1841);
18820 /* "csamtools.pyx":1844
18821 * '''return current reference sequence underlying the iterator.
18823 * return self.iterdata.seq # <<<<<<<<<<<<<<
18825 * property seq_len:
18827 __pyx_r = __pyx_v_self->iterdata.seq;
18832 __Pyx_TraceReturn(Py_None);
18833 __Pyx_RefNannyFinishContext();
18837 /* Python wrapper */
18838 static PyObject *__pyx_pw_9csamtools_14IteratorColumn_7seq_len_1__get__(PyObject *__pyx_v_self); /*proto*/
18839 static PyObject *__pyx_pw_9csamtools_14IteratorColumn_7seq_len_1__get__(PyObject *__pyx_v_self) {
18840 PyObject *__pyx_r = 0;
18841 __Pyx_RefNannyDeclarations
18842 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
18843 __pyx_r = __pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self));
18844 __Pyx_RefNannyFinishContext();
18848 /* "csamtools.pyx":1848
18849 * property seq_len:
18850 * '''current sequence length.'''
18851 * def __get__(self): return self.iterdata.seq_len # <<<<<<<<<<<<<<
18853 * def addReference( self, Fastafile fastafile ):
18856 static PyObject *__pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self) {
18857 PyObject *__pyx_r = NULL;
18858 __Pyx_RefNannyDeclarations
18859 PyObject *__pyx_t_1 = NULL;
18860 int __pyx_lineno = 0;
18861 const char *__pyx_filename = NULL;
18862 int __pyx_clineno = 0;
18863 __Pyx_TraceDeclarations
18864 __Pyx_RefNannySetupContext("__get__", 0);
18865 __Pyx_TraceCall("__get__", __pyx_f[0], 1848);
18866 __Pyx_XDECREF(__pyx_r);
18867 __pyx_t_1 = PyInt_FromLong(__pyx_v_self->iterdata.seq_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18868 __Pyx_GOTREF(__pyx_t_1);
18869 __pyx_r = __pyx_t_1;
18873 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18876 __Pyx_XDECREF(__pyx_t_1);
18877 __Pyx_AddTraceback("csamtools.IteratorColumn.seq_len.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18880 __Pyx_XGIVEREF(__pyx_r);
18881 __Pyx_TraceReturn(__pyx_r);
18882 __Pyx_RefNannyFinishContext();
18886 /* Python wrapper */
18887 static PyObject *__pyx_pw_9csamtools_14IteratorColumn_5addReference(PyObject *__pyx_v_self, PyObject *__pyx_v_fastafile); /*proto*/
18888 static char __pyx_doc_9csamtools_14IteratorColumn_4addReference[] = "IteratorColumn.addReference(self, Fastafile fastafile)\n\n add reference sequences in *fastafile* to iterator.";
18889 static PyObject *__pyx_pw_9csamtools_14IteratorColumn_5addReference(PyObject *__pyx_v_self, PyObject *__pyx_v_fastafile) {
18890 PyObject *__pyx_r = 0;
18891 __Pyx_RefNannyDeclarations
18892 __Pyx_RefNannySetupContext("addReference (wrapper)", 0);
18893 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fastafile), __pyx_ptype_9csamtools_Fastafile, 1, "fastafile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18894 __pyx_r = __pyx_pf_9csamtools_14IteratorColumn_4addReference(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_fastafile));
18899 __Pyx_RefNannyFinishContext();
18903 /* "csamtools.pyx":1850
18904 * def __get__(self): return self.iterdata.seq_len
18906 * def addReference( self, Fastafile fastafile ): # <<<<<<<<<<<<<<
18908 * add reference sequences in *fastafile* to iterator.'''
18911 static PyObject *__pyx_pf_9csamtools_14IteratorColumn_4addReference(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self, struct __pyx_obj_9csamtools_Fastafile *__pyx_v_fastafile) {
18912 PyObject *__pyx_r = NULL;
18913 __Pyx_RefNannyDeclarations
18915 __Pyx_TraceDeclarations
18916 __Pyx_RefNannySetupContext("addReference", 0);
18917 __Pyx_TraceCall("addReference", __pyx_f[0], 1850);
18919 /* "csamtools.pyx":1853
18921 * add reference sequences in *fastafile* to iterator.'''
18922 * self.fastafile = fastafile # <<<<<<<<<<<<<<
18923 * if self.iterdata.seq != NULL: free(self.iterdata.seq)
18924 * self.iterdata.tid = -1
18926 __Pyx_INCREF(((PyObject *)__pyx_v_fastafile));
18927 __Pyx_GIVEREF(((PyObject *)__pyx_v_fastafile));
18928 __Pyx_GOTREF(__pyx_v_self->fastafile);
18929 __Pyx_DECREF(((PyObject *)__pyx_v_self->fastafile));
18930 __pyx_v_self->fastafile = __pyx_v_fastafile;
18932 /* "csamtools.pyx":1854
18933 * add reference sequences in *fastafile* to iterator.'''
18934 * self.fastafile = fastafile
18935 * if self.iterdata.seq != NULL: free(self.iterdata.seq) # <<<<<<<<<<<<<<
18936 * self.iterdata.tid = -1
18937 * self.iterdata.fastafile = self.fastafile.fastafile
18939 __pyx_t_1 = (__pyx_v_self->iterdata.seq != NULL);
18941 free(__pyx_v_self->iterdata.seq);
18946 /* "csamtools.pyx":1855
18947 * self.fastafile = fastafile
18948 * if self.iterdata.seq != NULL: free(self.iterdata.seq)
18949 * self.iterdata.tid = -1 # <<<<<<<<<<<<<<
18950 * self.iterdata.fastafile = self.fastafile.fastafile
18953 __pyx_v_self->iterdata.tid = -1;
18955 /* "csamtools.pyx":1856
18956 * if self.iterdata.seq != NULL: free(self.iterdata.seq)
18957 * self.iterdata.tid = -1
18958 * self.iterdata.fastafile = self.fastafile.fastafile # <<<<<<<<<<<<<<
18960 * def hasReference( self ):
18962 __pyx_v_self->iterdata.fastafile = __pyx_v_self->fastafile->fastafile;
18964 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18965 __Pyx_XGIVEREF(__pyx_r);
18966 __Pyx_TraceReturn(__pyx_r);
18967 __Pyx_RefNannyFinishContext();
18971 /* Python wrapper */
18972 static PyObject *__pyx_pw_9csamtools_14IteratorColumn_7hasReference(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
18973 static char __pyx_doc_9csamtools_14IteratorColumn_6hasReference[] = "IteratorColumn.hasReference(self)\n\n return true if iterator is associated with a reference";
18974 static PyObject *__pyx_pw_9csamtools_14IteratorColumn_7hasReference(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
18975 PyObject *__pyx_r = 0;
18976 __Pyx_RefNannyDeclarations
18977 __Pyx_RefNannySetupContext("hasReference (wrapper)", 0);
18978 __pyx_r = __pyx_pf_9csamtools_14IteratorColumn_6hasReference(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self));
18979 __Pyx_RefNannyFinishContext();
18983 /* "csamtools.pyx":1858
18984 * self.iterdata.fastafile = self.fastafile.fastafile
18986 * def hasReference( self ): # <<<<<<<<<<<<<<
18988 * return true if iterator is associated with a reference'''
18991 static PyObject *__pyx_pf_9csamtools_14IteratorColumn_6hasReference(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self) {
18992 PyObject *__pyx_r = NULL;
18993 __Pyx_RefNannyDeclarations
18994 __Pyx_TraceDeclarations
18995 __Pyx_RefNannySetupContext("hasReference", 0);
18996 __Pyx_TraceCall("hasReference", __pyx_f[0], 1858);
18998 /* "csamtools.pyx":1861
19000 * return true if iterator is associated with a reference'''
19001 * return self.fastafile # <<<<<<<<<<<<<<
19003 * cdef setMask( self, mask ):
19005 __Pyx_XDECREF(__pyx_r);
19006 __Pyx_INCREF(((PyObject *)__pyx_v_self->fastafile));
19007 __pyx_r = ((PyObject *)__pyx_v_self->fastafile);
19010 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19012 __Pyx_XGIVEREF(__pyx_r);
19013 __Pyx_TraceReturn(__pyx_r);
19014 __Pyx_RefNannyFinishContext();
19018 /* "csamtools.pyx":1863
19019 * return self.fastafile
19021 * cdef setMask( self, mask ): # <<<<<<<<<<<<<<
19022 * '''set masking flag in iterator.
19026 static PyObject *__pyx_f_9csamtools_14IteratorColumn_setMask(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self, PyObject *__pyx_v_mask) {
19027 PyObject *__pyx_r = NULL;
19028 __Pyx_RefNannyDeclarations
19030 int __pyx_lineno = 0;
19031 const char *__pyx_filename = NULL;
19032 int __pyx_clineno = 0;
19033 __Pyx_TraceDeclarations
19034 __Pyx_RefNannySetupContext("setMask", 0);
19035 __Pyx_TraceCall("setMask", __pyx_f[0], 1863);
19037 /* "csamtools.pyx":1868
19038 * reads with bits set in *mask* will be skipped.
19040 * self.mask = mask # <<<<<<<<<<<<<<
19041 * bam_plp_set_mask( self.pileup_iter, self.mask )
19044 __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_mask); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19045 __pyx_v_self->mask = __pyx_t_1;
19047 /* "csamtools.pyx":1869
19050 * bam_plp_set_mask( self.pileup_iter, self.mask ) # <<<<<<<<<<<<<<
19052 * cdef setupIteratorData( self,
19054 bam_plp_set_mask(__pyx_v_self->pileup_iter, __pyx_v_self->mask);
19056 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19059 __Pyx_AddTraceback("csamtools.IteratorColumn.setMask", __pyx_clineno, __pyx_lineno, __pyx_filename);
19062 __Pyx_XGIVEREF(__pyx_r);
19063 __Pyx_TraceReturn(__pyx_r);
19064 __Pyx_RefNannyFinishContext();
19068 /* "csamtools.pyx":1871
19069 * bam_plp_set_mask( self.pileup_iter, self.mask )
19071 * cdef setupIteratorData( self, # <<<<<<<<<<<<<<
19076 static PyObject *__pyx_f_9csamtools_14IteratorColumn_setupIteratorData(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end, struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData *__pyx_optional_args) {
19077 int __pyx_v_reopen = ((int)0);
19078 PyObject *__pyx_r = NULL;
19079 __Pyx_RefNannyDeclarations
19080 PyObject *__pyx_t_1 = NULL;
19081 PyObject *__pyx_t_2 = NULL;
19082 PyObject *__pyx_t_3 = NULL;
19083 PyObject *__pyx_t_4 = NULL;
19084 PyObject *__pyx_t_5 = NULL;
19088 int __pyx_lineno = 0;
19089 const char *__pyx_filename = NULL;
19090 int __pyx_clineno = 0;
19091 __Pyx_TraceDeclarations
19092 __Pyx_RefNannySetupContext("setupIteratorData", 0);
19093 __Pyx_TraceCall("setupIteratorData", __pyx_f[0], 1871);
19094 if (__pyx_optional_args) {
19095 if (__pyx_optional_args->__pyx_n > 0) {
19096 __pyx_v_reopen = __pyx_optional_args->reopen;
19100 /* "csamtools.pyx":1878
19101 * '''setup the iterator structure'''
19103 * self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen ) # <<<<<<<<<<<<<<
19104 * self.iterdata.samfile = self.samfile.samfile
19105 * self.iterdata.iter = self.iter.iter
19107 __pyx_t_1 = PyInt_FromLong(__pyx_v_tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19108 __Pyx_GOTREF(__pyx_t_1);
19109 __pyx_t_2 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19110 __Pyx_GOTREF(__pyx_t_2);
19111 __pyx_t_3 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19112 __Pyx_GOTREF(__pyx_t_3);
19113 __pyx_t_4 = PyInt_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19114 __Pyx_GOTREF(__pyx_t_4);
19115 __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19116 __Pyx_GOTREF(__pyx_t_5);
19117 __Pyx_INCREF(((PyObject *)__pyx_v_self->samfile));
19118 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self->samfile));
19119 __Pyx_GIVEREF(((PyObject *)__pyx_v_self->samfile));
19120 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
19121 __Pyx_GIVEREF(__pyx_t_1);
19122 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_2);
19123 __Pyx_GIVEREF(__pyx_t_2);
19124 PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_3);
19125 __Pyx_GIVEREF(__pyx_t_3);
19126 PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_4);
19127 __Pyx_GIVEREF(__pyx_t_4);
19132 __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19133 __Pyx_GOTREF(__pyx_t_4);
19134 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
19135 __Pyx_GIVEREF(__pyx_t_4);
19136 __Pyx_GOTREF(__pyx_v_self->iter);
19137 __Pyx_DECREF(((PyObject *)__pyx_v_self->iter));
19138 __pyx_v_self->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_t_4);
19141 /* "csamtools.pyx":1879
19143 * self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen )
19144 * self.iterdata.samfile = self.samfile.samfile # <<<<<<<<<<<<<<
19145 * self.iterdata.iter = self.iter.iter
19146 * self.iterdata.seq = NULL
19148 __pyx_v_self->iterdata.samfile = __pyx_v_self->samfile->samfile;
19150 /* "csamtools.pyx":1880
19151 * self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen )
19152 * self.iterdata.samfile = self.samfile.samfile
19153 * self.iterdata.iter = self.iter.iter # <<<<<<<<<<<<<<
19154 * self.iterdata.seq = NULL
19155 * self.iterdata.tid = -1
19157 __pyx_v_self->iterdata.iter = __pyx_v_self->iter->iter;
19159 /* "csamtools.pyx":1881
19160 * self.iterdata.samfile = self.samfile.samfile
19161 * self.iterdata.iter = self.iter.iter
19162 * self.iterdata.seq = NULL # <<<<<<<<<<<<<<
19163 * self.iterdata.tid = -1
19166 __pyx_v_self->iterdata.seq = NULL;
19168 /* "csamtools.pyx":1882
19169 * self.iterdata.iter = self.iter.iter
19170 * self.iterdata.seq = NULL
19171 * self.iterdata.tid = -1 # <<<<<<<<<<<<<<
19173 * if self.fastafile != None:
19175 __pyx_v_self->iterdata.tid = -1;
19177 /* "csamtools.pyx":1884
19178 * self.iterdata.tid = -1
19180 * if self.fastafile != None: # <<<<<<<<<<<<<<
19181 * self.iterdata.fastafile = self.fastafile.fastafile
19184 __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_self->fastafile), Py_None, Py_NE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19185 __Pyx_GOTREF(__pyx_t_4);
19186 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19187 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19190 /* "csamtools.pyx":1885
19192 * if self.fastafile != None:
19193 * self.iterdata.fastafile = self.fastafile.fastafile # <<<<<<<<<<<<<<
19195 * self.iterdata.fastafile = NULL
19197 __pyx_v_self->iterdata.fastafile = __pyx_v_self->fastafile->fastafile;
19202 /* "csamtools.pyx":1887
19203 * self.iterdata.fastafile = self.fastafile.fastafile
19205 * self.iterdata.fastafile = NULL # <<<<<<<<<<<<<<
19207 * if self.stepper == None or self.stepper == "all":
19209 __pyx_v_self->iterdata.fastafile = NULL;
19213 /* "csamtools.pyx":1889
19214 * self.iterdata.fastafile = NULL
19216 * if self.stepper == None or self.stepper == "all": # <<<<<<<<<<<<<<
19217 * self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata )
19218 * elif self.stepper == "samtools":
19220 __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->stepper, Py_None, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19221 __Pyx_GOTREF(__pyx_t_4);
19222 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19223 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19225 __pyx_t_7 = __Pyx_PyString_Equals(__pyx_v_self->stepper, ((PyObject *)__pyx_n_s__all), Py_EQ); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19226 __pyx_t_8 = __pyx_t_7;
19228 __pyx_t_8 = __pyx_t_6;
19232 /* "csamtools.pyx":1890
19234 * if self.stepper == None or self.stepper == "all":
19235 * self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata ) # <<<<<<<<<<<<<<
19236 * elif self.stepper == "samtools":
19237 * self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata )
19239 __pyx_v_self->pileup_iter = bam_plp_init((&__pyx_f_9csamtools___advance_all), (&__pyx_v_self->iterdata));
19243 /* "csamtools.pyx":1891
19244 * if self.stepper == None or self.stepper == "all":
19245 * self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata )
19246 * elif self.stepper == "samtools": # <<<<<<<<<<<<<<
19247 * self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata )
19250 __pyx_t_8 = __Pyx_PyString_Equals(__pyx_v_self->stepper, ((PyObject *)__pyx_n_s__samtools), Py_EQ); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19253 /* "csamtools.pyx":1892
19254 * self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata )
19255 * elif self.stepper == "samtools":
19256 * self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata ) # <<<<<<<<<<<<<<
19258 * raise ValueError( "unknown stepper option `%s` in IteratorColumn" % self.stepper)
19260 __pyx_v_self->pileup_iter = bam_plp_init((&__pyx_f_9csamtools___advance_snpcalls), (&__pyx_v_self->iterdata));
19265 /* "csamtools.pyx":1894
19266 * self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata )
19268 * raise ValueError( "unknown stepper option `%s` in IteratorColumn" % self.stepper) # <<<<<<<<<<<<<<
19270 * if self.max_depth:
19272 __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_127), __pyx_v_self->stepper); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19273 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
19274 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19275 __Pyx_GOTREF(__pyx_t_5);
19276 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
19277 __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
19279 __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 = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19280 __Pyx_GOTREF(__pyx_t_4);
19281 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
19282 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
19283 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19284 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19288 /* "csamtools.pyx":1896
19289 * raise ValueError( "unknown stepper option `%s` in IteratorColumn" % self.stepper)
19291 * if self.max_depth: # <<<<<<<<<<<<<<
19292 * bam_plp_set_maxcnt( self.pileup_iter, self.max_depth )
19295 if (__pyx_v_self->max_depth) {
19297 /* "csamtools.pyx":1897
19299 * if self.max_depth:
19300 * bam_plp_set_maxcnt( self.pileup_iter, self.max_depth ) # <<<<<<<<<<<<<<
19302 * bam_plp_set_mask( self.pileup_iter, self.mask )
19304 bam_plp_set_maxcnt(__pyx_v_self->pileup_iter, __pyx_v_self->max_depth);
19309 /* "csamtools.pyx":1899
19310 * bam_plp_set_maxcnt( self.pileup_iter, self.max_depth )
19312 * bam_plp_set_mask( self.pileup_iter, self.mask ) # <<<<<<<<<<<<<<
19314 * cdef reset( self, tid, start, end ):
19316 bam_plp_set_mask(__pyx_v_self->pileup_iter, __pyx_v_self->mask);
19318 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19321 __Pyx_XDECREF(__pyx_t_1);
19322 __Pyx_XDECREF(__pyx_t_2);
19323 __Pyx_XDECREF(__pyx_t_3);
19324 __Pyx_XDECREF(__pyx_t_4);
19325 __Pyx_XDECREF(__pyx_t_5);
19326 __Pyx_AddTraceback("csamtools.IteratorColumn.setupIteratorData", __pyx_clineno, __pyx_lineno, __pyx_filename);
19329 __Pyx_XGIVEREF(__pyx_r);
19330 __Pyx_TraceReturn(__pyx_r);
19331 __Pyx_RefNannyFinishContext();
19335 /* "csamtools.pyx":1901
19336 * bam_plp_set_mask( self.pileup_iter, self.mask )
19338 * cdef reset( self, tid, start, end ): # <<<<<<<<<<<<<<
19339 * '''reset iterator position.
19343 static PyObject *__pyx_f_9csamtools_14IteratorColumn_reset(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self, PyObject *__pyx_v_tid, PyObject *__pyx_v_start, PyObject *__pyx_v_end) {
19344 PyObject *__pyx_r = NULL;
19345 __Pyx_RefNannyDeclarations
19346 PyObject *__pyx_t_1 = NULL;
19347 PyObject *__pyx_t_2 = NULL;
19348 PyObject *__pyx_t_3 = NULL;
19350 int __pyx_lineno = 0;
19351 const char *__pyx_filename = NULL;
19352 int __pyx_clineno = 0;
19353 __Pyx_TraceDeclarations
19354 __Pyx_RefNannySetupContext("reset", 0);
19355 __Pyx_TraceCall("reset", __pyx_f[0], 1901);
19357 /* "csamtools.pyx":1907
19358 * having to incur the full set-up costs.
19360 * self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen = 0 ) # <<<<<<<<<<<<<<
19361 * self.iterdata.iter = self.iter.iter
19364 __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19365 __Pyx_GOTREF(__pyx_t_1);
19366 __Pyx_INCREF(((PyObject *)__pyx_v_self->samfile));
19367 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->samfile));
19368 __Pyx_GIVEREF(((PyObject *)__pyx_v_self->samfile));
19369 __Pyx_INCREF(__pyx_v_tid);
19370 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_tid);
19371 __Pyx_GIVEREF(__pyx_v_tid);
19372 __Pyx_INCREF(__pyx_v_start);
19373 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_start);
19374 __Pyx_GIVEREF(__pyx_v_start);
19375 __Pyx_INCREF(__pyx_v_end);
19376 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_end);
19377 __Pyx_GIVEREF(__pyx_v_end);
19378 __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19379 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
19380 if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reopen), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19381 __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19382 __Pyx_GOTREF(__pyx_t_3);
19383 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
19384 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
19385 __Pyx_GIVEREF(__pyx_t_3);
19386 __Pyx_GOTREF(__pyx_v_self->iter);
19387 __Pyx_DECREF(((PyObject *)__pyx_v_self->iter));
19388 __pyx_v_self->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_t_3);
19391 /* "csamtools.pyx":1908
19393 * self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen = 0 )
19394 * self.iterdata.iter = self.iter.iter # <<<<<<<<<<<<<<
19396 * # invalidate sequence if different tid
19398 __pyx_v_self->iterdata.iter = __pyx_v_self->iter->iter;
19400 /* "csamtools.pyx":1911
19402 * # invalidate sequence if different tid
19403 * if self.tid != tid: # <<<<<<<<<<<<<<
19404 * if self.iterdata.seq != NULL: free( self.iterdata.seq )
19405 * self.iterdata.seq = NULL
19407 __pyx_t_3 = PyInt_FromLong(__pyx_v_self->tid); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19408 __Pyx_GOTREF(__pyx_t_3);
19409 __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_v_tid, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19410 __Pyx_GOTREF(__pyx_t_2);
19411 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19412 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19413 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19416 /* "csamtools.pyx":1912
19417 * # invalidate sequence if different tid
19418 * if self.tid != tid:
19419 * if self.iterdata.seq != NULL: free( self.iterdata.seq ) # <<<<<<<<<<<<<<
19420 * self.iterdata.seq = NULL
19421 * self.iterdata.tid = -1
19423 __pyx_t_4 = (__pyx_v_self->iterdata.seq != NULL);
19425 free(__pyx_v_self->iterdata.seq);
19430 /* "csamtools.pyx":1913
19431 * if self.tid != tid:
19432 * if self.iterdata.seq != NULL: free( self.iterdata.seq )
19433 * self.iterdata.seq = NULL # <<<<<<<<<<<<<<
19434 * self.iterdata.tid = -1
19437 __pyx_v_self->iterdata.seq = NULL;
19439 /* "csamtools.pyx":1914
19440 * if self.iterdata.seq != NULL: free( self.iterdata.seq )
19441 * self.iterdata.seq = NULL
19442 * self.iterdata.tid = -1 # <<<<<<<<<<<<<<
19444 * # self.pileup_iter = bam_plp_init( &__advancepileup, &self.iterdata )
19446 __pyx_v_self->iterdata.tid = -1;
19451 /* "csamtools.pyx":1917
19453 * # self.pileup_iter = bam_plp_init( &__advancepileup, &self.iterdata )
19454 * bam_plp_reset(self.pileup_iter) # <<<<<<<<<<<<<<
19456 * def __dealloc__(self):
19458 bam_plp_reset(__pyx_v_self->pileup_iter);
19460 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19463 __Pyx_XDECREF(__pyx_t_1);
19464 __Pyx_XDECREF(__pyx_t_2);
19465 __Pyx_XDECREF(__pyx_t_3);
19466 __Pyx_AddTraceback("csamtools.IteratorColumn.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
19469 __Pyx_XGIVEREF(__pyx_r);
19470 __Pyx_TraceReturn(__pyx_r);
19471 __Pyx_RefNannyFinishContext();
19475 /* Python wrapper */
19476 static void __pyx_pw_9csamtools_14IteratorColumn_9__dealloc__(PyObject *__pyx_v_self); /*proto*/
19477 static void __pyx_pw_9csamtools_14IteratorColumn_9__dealloc__(PyObject *__pyx_v_self) {
19478 __Pyx_RefNannyDeclarations
19479 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
19480 __pyx_pf_9csamtools_14IteratorColumn_8__dealloc__(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self));
19481 __Pyx_RefNannyFinishContext();
19484 /* "csamtools.pyx":1919
19485 * bam_plp_reset(self.pileup_iter)
19487 * def __dealloc__(self): # <<<<<<<<<<<<<<
19488 * # reset in order to avoid memory leak messages for iterators that have
19489 * # not been fully consumed
19492 static void __pyx_pf_9csamtools_14IteratorColumn_8__dealloc__(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self) {
19493 __Pyx_RefNannyDeclarations
19495 __Pyx_TraceDeclarations
19496 __Pyx_RefNannySetupContext("__dealloc__", 0);
19497 __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1919);
19499 /* "csamtools.pyx":1922
19500 * # reset in order to avoid memory leak messages for iterators that have
19501 * # not been fully consumed
19502 * if self.pileup_iter != <bam_plp_t>NULL: # <<<<<<<<<<<<<<
19503 * bam_plp_reset(self.pileup_iter)
19504 * bam_plp_destroy(self.pileup_iter)
19506 __pyx_t_1 = (__pyx_v_self->pileup_iter != NULL);
19509 /* "csamtools.pyx":1923
19510 * # not been fully consumed
19511 * if self.pileup_iter != <bam_plp_t>NULL:
19512 * bam_plp_reset(self.pileup_iter) # <<<<<<<<<<<<<<
19513 * bam_plp_destroy(self.pileup_iter)
19514 * self.pileup_iter = <bam_plp_t>NULL
19516 bam_plp_reset(__pyx_v_self->pileup_iter);
19518 /* "csamtools.pyx":1924
19519 * if self.pileup_iter != <bam_plp_t>NULL:
19520 * bam_plp_reset(self.pileup_iter)
19521 * bam_plp_destroy(self.pileup_iter) # <<<<<<<<<<<<<<
19522 * self.pileup_iter = <bam_plp_t>NULL
19525 bam_plp_destroy(__pyx_v_self->pileup_iter);
19527 /* "csamtools.pyx":1925
19528 * bam_plp_reset(self.pileup_iter)
19529 * bam_plp_destroy(self.pileup_iter)
19530 * self.pileup_iter = <bam_plp_t>NULL # <<<<<<<<<<<<<<
19532 * if self.iterdata.seq != NULL:
19534 __pyx_v_self->pileup_iter = NULL;
19539 /* "csamtools.pyx":1927
19540 * self.pileup_iter = <bam_plp_t>NULL
19542 * if self.iterdata.seq != NULL: # <<<<<<<<<<<<<<
19543 * free(self.iterdata.seq)
19544 * self.iterdata.seq = NULL
19546 __pyx_t_1 = (__pyx_v_self->iterdata.seq != NULL);
19549 /* "csamtools.pyx":1928
19551 * if self.iterdata.seq != NULL:
19552 * free(self.iterdata.seq) # <<<<<<<<<<<<<<
19553 * self.iterdata.seq = NULL
19556 free(__pyx_v_self->iterdata.seq);
19558 /* "csamtools.pyx":1929
19559 * if self.iterdata.seq != NULL:
19560 * free(self.iterdata.seq)
19561 * self.iterdata.seq = NULL # <<<<<<<<<<<<<<
19563 * cdef class IteratorColumnRegion(IteratorColumn):
19565 __pyx_v_self->iterdata.seq = NULL;
19570 __Pyx_TraceReturn(Py_None);
19571 __Pyx_RefNannyFinishContext();
19574 /* Python wrapper */
19575 static int __pyx_pw_9csamtools_20IteratorColumnRegion_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
19576 static int __pyx_pw_9csamtools_20IteratorColumnRegion_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19577 CYTHON_UNUSED struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
19581 int __pyx_v_truncate;
19582 CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
19583 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__truncate,0};
19585 __Pyx_RefNannyDeclarations
19586 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
19587 __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
19588 __Pyx_GOTREF(__pyx_v_kwargs);
19590 PyObject* values[5] = {0,0,0,0,0};
19591 if (unlikely(__pyx_kwds)) {
19592 Py_ssize_t kw_args;
19593 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19594 switch (pos_args) {
19595 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19596 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19597 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19598 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19599 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19601 default: goto __pyx_L5_argtuple_error;
19603 kw_args = PyDict_Size(__pyx_kwds);
19604 switch (pos_args) {
19606 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
19607 if (likely(values[0])) kw_args--;
19608 else goto __pyx_L5_argtuple_error;
19611 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid);
19612 if (value) { values[1] = value; kw_args--; }
19616 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
19617 if (value) { values[2] = value; kw_args--; }
19621 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
19622 if (value) { values[3] = value; kw_args--; }
19626 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__truncate);
19627 if (value) { values[4] = value; kw_args--; }
19630 if (unlikely(kw_args > 0)) {
19631 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
19635 __pyx_v_tid = ((int)0);
19639 __pyx_v_start = ((int)0);
19643 __pyx_v_end = __pyx_k_128;
19648 /* "csamtools.pyx":1938
19650 * int end = max_pos,
19651 * int truncate = False, # <<<<<<<<<<<<<<
19655 __pyx_v_truncate = ((int)0);
19658 switch (PyTuple_GET_SIZE(__pyx_args)) {
19659 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19660 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19661 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19662 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19663 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19665 default: goto __pyx_L5_argtuple_error;
19668 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
19670 __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1935; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
19672 __pyx_v_tid = ((int)0);
19675 __pyx_v_start = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
19677 __pyx_v_start = ((int)0);
19680 __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
19682 __pyx_v_end = __pyx_k_128;
19685 __pyx_v_truncate = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_truncate == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
19687 __pyx_v_truncate = ((int)0);
19690 goto __pyx_L4_argument_unpacking_done;
19691 __pyx_L5_argtuple_error:;
19692 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
19694 __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
19695 __Pyx_AddTraceback("csamtools.IteratorColumnRegion.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19696 __Pyx_RefNannyFinishContext();
19698 __pyx_L4_argument_unpacking_done:;
19699 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19700 __pyx_r = __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self), __pyx_v_samfile, __pyx_v_tid, __pyx_v_start, __pyx_v_end, __pyx_v_truncate, __pyx_v_kwargs);
19705 __Pyx_XDECREF(__pyx_v_kwargs);
19706 __Pyx_RefNannyFinishContext();
19710 /* "csamtools.pyx":1934
19711 * '''iterates over a region only.
19713 * def __cinit__(self, Samfile samfile, # <<<<<<<<<<<<<<
19718 static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(struct __pyx_obj_9csamtools_IteratorColumnRegion *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end, int __pyx_v_truncate, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
19720 __Pyx_RefNannyDeclarations
19721 PyObject *__pyx_t_1 = NULL;
19722 struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData __pyx_t_2;
19723 int __pyx_lineno = 0;
19724 const char *__pyx_filename = NULL;
19725 int __pyx_clineno = 0;
19726 __Pyx_TraceDeclarations
19727 __Pyx_RefNannySetupContext("__cinit__", 0);
19728 __Pyx_TraceCall("__cinit__", __pyx_f[0], 1934);
19730 /* "csamtools.pyx":1942
19732 * # initialize iterator
19733 * self.setupIteratorData( tid, start, end, 1 ) # <<<<<<<<<<<<<<
19734 * self.start = start
19737 __pyx_t_2.__pyx_n = 1;
19738 __pyx_t_2.reopen = 1;
19739 __pyx_t_1 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), __pyx_v_tid, __pyx_v_start, __pyx_v_end, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19740 __Pyx_GOTREF(__pyx_t_1);
19741 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19743 /* "csamtools.pyx":1943
19744 * # initialize iterator
19745 * self.setupIteratorData( tid, start, end, 1 )
19746 * self.start = start # <<<<<<<<<<<<<<
19748 * self.truncate = truncate
19750 __pyx_v_self->start = __pyx_v_start;
19752 /* "csamtools.pyx":1944
19753 * self.setupIteratorData( tid, start, end, 1 )
19754 * self.start = start
19755 * self.end = end # <<<<<<<<<<<<<<
19756 * self.truncate = truncate
19759 __pyx_v_self->end = __pyx_v_end;
19761 /* "csamtools.pyx":1945
19762 * self.start = start
19764 * self.truncate = truncate # <<<<<<<<<<<<<<
19766 * def __next__(self):
19768 __pyx_v_self->truncate = __pyx_v_truncate;
19773 __Pyx_XDECREF(__pyx_t_1);
19774 __Pyx_AddTraceback("csamtools.IteratorColumnRegion.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19777 __Pyx_TraceReturn(Py_None);
19778 __Pyx_RefNannyFinishContext();
19782 /* Python wrapper */
19783 static PyObject *__pyx_pw_9csamtools_20IteratorColumnRegion_3__next__(PyObject *__pyx_v_self); /*proto*/
19784 static char __pyx_doc_9csamtools_20IteratorColumnRegion_2__next__[] = "python version of next().\n ";
19785 struct wrapperbase __pyx_wrapperbase_9csamtools_20IteratorColumnRegion_2__next__;
19786 static PyObject *__pyx_pw_9csamtools_20IteratorColumnRegion_3__next__(PyObject *__pyx_v_self) {
19787 PyObject *__pyx_r = 0;
19788 __Pyx_RefNannyDeclarations
19789 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
19790 __pyx_r = __pyx_pf_9csamtools_20IteratorColumnRegion_2__next__(((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self));
19791 __Pyx_RefNannyFinishContext();
19795 /* "csamtools.pyx":1947
19796 * self.truncate = truncate
19798 * def __next__(self): # <<<<<<<<<<<<<<
19799 * """python version of next().
19803 static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_2__next__(struct __pyx_obj_9csamtools_IteratorColumnRegion *__pyx_v_self) {
19804 PyObject *__pyx_r = NULL;
19805 __Pyx_RefNannyDeclarations
19807 PyObject *__pyx_t_2 = NULL;
19808 int __pyx_lineno = 0;
19809 const char *__pyx_filename = NULL;
19810 int __pyx_clineno = 0;
19811 __Pyx_TraceDeclarations
19812 __Pyx_RefNannySetupContext("__next__", 0);
19813 __Pyx_TraceCall("__next__", __pyx_f[0], 1947);
19815 /* "csamtools.pyx":1951
19818 * while 1: # <<<<<<<<<<<<<<
19820 * if self.n_plp < 0:
19825 /* "csamtools.pyx":1952
19828 * self.cnext() # <<<<<<<<<<<<<<
19829 * if self.n_plp < 0:
19830 * raise ValueError("error during iteration" )
19832 ((struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.cnext(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self));
19834 /* "csamtools.pyx":1953
19837 * if self.n_plp < 0: # <<<<<<<<<<<<<<
19838 * raise ValueError("error during iteration" )
19841 __pyx_t_1 = (__pyx_v_self->__pyx_base.n_plp < 0);
19844 /* "csamtools.pyx":1954
19846 * if self.n_plp < 0:
19847 * raise ValueError("error during iteration" ) # <<<<<<<<<<<<<<
19849 * if self.plp == NULL:
19851 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_130), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19852 __Pyx_GOTREF(__pyx_t_2);
19853 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
19854 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19855 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19860 /* "csamtools.pyx":1956
19861 * raise ValueError("error during iteration" )
19863 * if self.plp == NULL: # <<<<<<<<<<<<<<
19864 * raise StopIteration
19867 __pyx_t_1 = (__pyx_v_self->__pyx_base.plp == NULL);
19870 /* "csamtools.pyx":1957
19872 * if self.plp == NULL:
19873 * raise StopIteration # <<<<<<<<<<<<<<
19875 * if self.truncate:
19877 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
19878 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19883 /* "csamtools.pyx":1959
19884 * raise StopIteration
19886 * if self.truncate: # <<<<<<<<<<<<<<
19887 * if self.start < self.pos: continue
19888 * if self.pos >= self.end: raise StopIteration
19890 if (__pyx_v_self->truncate) {
19892 /* "csamtools.pyx":1960
19894 * if self.truncate:
19895 * if self.start < self.pos: continue # <<<<<<<<<<<<<<
19896 * if self.pos >= self.end: raise StopIteration
19899 __pyx_t_1 = (__pyx_v_self->start < __pyx_v_self->__pyx_base.pos);
19901 goto __pyx_L3_continue;
19906 /* "csamtools.pyx":1961
19907 * if self.truncate:
19908 * if self.start < self.pos: continue
19909 * if self.pos >= self.end: raise StopIteration # <<<<<<<<<<<<<<
19911 * return makePileupProxy( &self.plp,
19913 __pyx_t_1 = (__pyx_v_self->__pyx_base.pos >= __pyx_v_self->end);
19915 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
19916 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19924 /* "csamtools.pyx":1963
19925 * if self.pos >= self.end: raise StopIteration
19927 * return makePileupProxy( &self.plp, # <<<<<<<<<<<<<<
19931 __Pyx_XDECREF(__pyx_r);
19933 /* "csamtools.pyx":1966
19936 * self.n_plp ) # <<<<<<<<<<<<<<
19938 * cdef class IteratorColumnAllRefs(IteratorColumn):
19940 __pyx_t_2 = __pyx_f_9csamtools_makePileupProxy((&__pyx_v_self->__pyx_base.plp), __pyx_v_self->__pyx_base.tid, __pyx_v_self->__pyx_base.pos, __pyx_v_self->__pyx_base.n_plp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19941 __Pyx_GOTREF(__pyx_t_2);
19942 __pyx_r = __pyx_t_2;
19945 __pyx_L3_continue:;
19948 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19951 __Pyx_XDECREF(__pyx_t_2);
19952 __Pyx_AddTraceback("csamtools.IteratorColumnRegion.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19955 __Pyx_XGIVEREF(__pyx_r);
19956 __Pyx_TraceReturn(__pyx_r);
19957 __Pyx_RefNannyFinishContext();
19961 /* Python wrapper */
19962 static int __pyx_pw_9csamtools_21IteratorColumnAllRefs_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
19963 static int __pyx_pw_9csamtools_21IteratorColumnAllRefs_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19964 struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
19965 CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
19966 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0};
19968 __Pyx_RefNannyDeclarations
19969 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
19970 __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
19971 __Pyx_GOTREF(__pyx_v_kwargs);
19973 PyObject* values[1] = {0};
19974 if (unlikely(__pyx_kwds)) {
19975 Py_ssize_t kw_args;
19976 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19977 switch (pos_args) {
19978 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19980 default: goto __pyx_L5_argtuple_error;
19982 kw_args = PyDict_Size(__pyx_kwds);
19983 switch (pos_args) {
19985 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
19986 if (likely(values[0])) kw_args--;
19987 else goto __pyx_L5_argtuple_error;
19989 if (unlikely(kw_args > 0)) {
19990 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
19992 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
19993 goto __pyx_L5_argtuple_error;
19995 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19997 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
19999 goto __pyx_L4_argument_unpacking_done;
20000 __pyx_L5_argtuple_error:;
20001 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
20003 __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
20004 __Pyx_AddTraceback("csamtools.IteratorColumnAllRefs.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20005 __Pyx_RefNannyFinishContext();
20007 __pyx_L4_argument_unpacking_done:;
20008 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20009 __pyx_r = __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self), __pyx_v_samfile, __pyx_v_kwargs);
20014 __Pyx_XDECREF(__pyx_v_kwargs);
20015 __Pyx_RefNannyFinishContext();
20019 /* "csamtools.pyx":1972
20022 * def __cinit__(self, # <<<<<<<<<<<<<<
20027 static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(struct __pyx_obj_9csamtools_IteratorColumnAllRefs *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
20029 __Pyx_RefNannyDeclarations
20030 PyObject *__pyx_t_1 = NULL;
20033 struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData __pyx_t_4;
20034 int __pyx_lineno = 0;
20035 const char *__pyx_filename = NULL;
20036 int __pyx_clineno = 0;
20037 __Pyx_TraceDeclarations
20038 __Pyx_RefNannySetupContext("__cinit__", 0);
20039 __Pyx_TraceCall("__cinit__", __pyx_f[0], 1972);
20041 /* "csamtools.pyx":1977
20043 * # no iteration over empty files
20044 * if not samfile.nreferences: raise StopIteration # <<<<<<<<<<<<<<
20046 * # initialize iterator
20048 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20049 __Pyx_GOTREF(__pyx_t_1);
20050 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20051 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20052 __pyx_t_3 = (!__pyx_t_2);
20054 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
20055 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20060 /* "csamtools.pyx":1980
20062 * # initialize iterator
20063 * self.setupIteratorData( self.tid, 0, max_pos, 1 ) # <<<<<<<<<<<<<<
20065 * def __next__(self):
20067 __pyx_t_4.__pyx_n = 1;
20068 __pyx_t_4.reopen = 1;
20069 __pyx_t_1 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), __pyx_v_self->__pyx_base.tid, 0, __pyx_v_9csamtools_max_pos, &__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20070 __Pyx_GOTREF(__pyx_t_1);
20071 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20076 __Pyx_XDECREF(__pyx_t_1);
20077 __Pyx_AddTraceback("csamtools.IteratorColumnAllRefs.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20080 __Pyx_TraceReturn(Py_None);
20081 __Pyx_RefNannyFinishContext();
20085 /* Python wrapper */
20086 static PyObject *__pyx_pw_9csamtools_21IteratorColumnAllRefs_3__next__(PyObject *__pyx_v_self); /*proto*/
20087 static char __pyx_doc_9csamtools_21IteratorColumnAllRefs_2__next__[] = "python version of next().\n ";
20088 struct wrapperbase __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_2__next__;
20089 static PyObject *__pyx_pw_9csamtools_21IteratorColumnAllRefs_3__next__(PyObject *__pyx_v_self) {
20090 PyObject *__pyx_r = 0;
20091 __Pyx_RefNannyDeclarations
20092 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
20093 __pyx_r = __pyx_pf_9csamtools_21IteratorColumnAllRefs_2__next__(((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self));
20094 __Pyx_RefNannyFinishContext();
20098 /* "csamtools.pyx":1982
20099 * self.setupIteratorData( self.tid, 0, max_pos, 1 )
20101 * def __next__(self): # <<<<<<<<<<<<<<
20102 * """python version of next().
20106 static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_2__next__(struct __pyx_obj_9csamtools_IteratorColumnAllRefs *__pyx_v_self) {
20107 PyObject *__pyx_r = NULL;
20108 __Pyx_RefNannyDeclarations
20110 PyObject *__pyx_t_2 = NULL;
20111 PyObject *__pyx_t_3 = NULL;
20112 PyObject *__pyx_t_4 = NULL;
20113 struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData __pyx_t_5;
20114 int __pyx_lineno = 0;
20115 const char *__pyx_filename = NULL;
20116 int __pyx_clineno = 0;
20117 __Pyx_TraceDeclarations
20118 __Pyx_RefNannySetupContext("__next__", 0);
20119 __Pyx_TraceCall("__next__", __pyx_f[0], 1982);
20121 /* "csamtools.pyx":1986
20124 * while 1: # <<<<<<<<<<<<<<
20131 /* "csamtools.pyx":1987
20134 * self.cnext() # <<<<<<<<<<<<<<
20136 * if self.n_plp < 0:
20138 ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.cnext(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self));
20140 /* "csamtools.pyx":1989
20143 * if self.n_plp < 0: # <<<<<<<<<<<<<<
20144 * raise ValueError("error during iteration" )
20147 __pyx_t_1 = (__pyx_v_self->__pyx_base.n_plp < 0);
20150 /* "csamtools.pyx":1990
20152 * if self.n_plp < 0:
20153 * raise ValueError("error during iteration" ) # <<<<<<<<<<<<<<
20155 * # return result, if within same reference
20157 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_131), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20158 __Pyx_GOTREF(__pyx_t_2);
20159 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
20160 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20161 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20166 /* "csamtools.pyx":1993
20168 * # return result, if within same reference
20169 * if self.plp != NULL: # <<<<<<<<<<<<<<
20170 * return makePileupProxy( &self.plp,
20173 __pyx_t_1 = (__pyx_v_self->__pyx_base.plp != NULL);
20176 /* "csamtools.pyx":1994
20177 * # return result, if within same reference
20178 * if self.plp != NULL:
20179 * return makePileupProxy( &self.plp, # <<<<<<<<<<<<<<
20183 __Pyx_XDECREF(__pyx_r);
20185 /* "csamtools.pyx":1997
20188 * self.n_plp ) # <<<<<<<<<<<<<<
20190 * # otherwise, proceed to next reference or stop
20192 __pyx_t_2 = __pyx_f_9csamtools_makePileupProxy((&__pyx_v_self->__pyx_base.plp), __pyx_v_self->__pyx_base.tid, __pyx_v_self->__pyx_base.pos, __pyx_v_self->__pyx_base.n_plp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20193 __Pyx_GOTREF(__pyx_t_2);
20194 __pyx_r = __pyx_t_2;
20201 /* "csamtools.pyx":2000
20203 * # otherwise, proceed to next reference or stop
20204 * self.tid += 1 # <<<<<<<<<<<<<<
20205 * if self.tid < self.samfile.nreferences:
20206 * self.setupIteratorData( self.tid, 0, max_pos, 0 )
20208 __pyx_v_self->__pyx_base.tid = (__pyx_v_self->__pyx_base.tid + 1);
20210 /* "csamtools.pyx":2001
20211 * # otherwise, proceed to next reference or stop
20213 * if self.tid < self.samfile.nreferences: # <<<<<<<<<<<<<<
20214 * self.setupIteratorData( self.tid, 0, max_pos, 0 )
20217 __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20218 __Pyx_GOTREF(__pyx_t_2);
20219 __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self->__pyx_base.samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20220 __Pyx_GOTREF(__pyx_t_3);
20221 __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20222 __Pyx_GOTREF(__pyx_t_4);
20223 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20224 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20225 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20226 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20229 /* "csamtools.pyx":2002
20231 * if self.tid < self.samfile.nreferences:
20232 * self.setupIteratorData( self.tid, 0, max_pos, 0 ) # <<<<<<<<<<<<<<
20234 * raise StopIteration
20236 __pyx_t_5.__pyx_n = 1;
20237 __pyx_t_5.reopen = 0;
20238 __pyx_t_4 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), __pyx_v_self->__pyx_base.tid, 0, __pyx_v_9csamtools_max_pos, &__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20239 __Pyx_GOTREF(__pyx_t_4);
20240 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20245 /* "csamtools.pyx":2004
20246 * self.setupIteratorData( self.tid, 0, max_pos, 0 )
20248 * raise StopIteration # <<<<<<<<<<<<<<
20250 * ##-------------------------------------------------------------------
20252 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
20253 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20258 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20261 __Pyx_XDECREF(__pyx_t_2);
20262 __Pyx_XDECREF(__pyx_t_3);
20263 __Pyx_XDECREF(__pyx_t_4);
20264 __Pyx_AddTraceback("csamtools.IteratorColumnAllRefs.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20267 __Pyx_XGIVEREF(__pyx_r);
20268 __Pyx_TraceReturn(__pyx_r);
20269 __Pyx_RefNannyFinishContext();
20273 /* "csamtools.pyx":2009
20274 * ##-------------------------------------------------------------------
20275 * ##-------------------------------------------------------------------
20276 * cdef inline int32_t query_start(bam1_t *src) except -1: # <<<<<<<<<<<<<<
20277 * cdef uint32_t * cigar_p, op
20281 static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *__pyx_v_src) {
20282 uint32_t *__pyx_v_cigar_p;
20283 uint32_t __pyx_v_op;
20284 uint32_t __pyx_v_k;
20285 uint32_t __pyx_v_start_offset;
20287 __Pyx_RefNannyDeclarations
20288 uint32_t __pyx_t_1;
20292 PyObject *__pyx_t_5 = NULL;
20293 __Pyx_TraceDeclarations
20294 __Pyx_RefNannySetupContext("query_start", 0);
20295 __Pyx_TraceCall("query_start", __pyx_f[0], 2009);
20297 /* "csamtools.pyx":2012
20298 * cdef uint32_t * cigar_p, op
20300 * cdef uint32_t start_offset = 0 # <<<<<<<<<<<<<<
20302 * if src.core.n_cigar:
20304 __pyx_v_start_offset = 0;
20306 /* "csamtools.pyx":2014
20307 * cdef uint32_t start_offset = 0
20309 * if src.core.n_cigar: # <<<<<<<<<<<<<<
20310 * cigar_p = bam1_cigar(src);
20311 * for k from 0 <= k < src.core.n_cigar:
20313 if (__pyx_v_src->core.n_cigar) {
20315 /* "csamtools.pyx":2015
20317 * if src.core.n_cigar:
20318 * cigar_p = bam1_cigar(src); # <<<<<<<<<<<<<<
20319 * for k from 0 <= k < src.core.n_cigar:
20320 * op = cigar_p[k] & BAM_CIGAR_MASK
20322 __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
20324 /* "csamtools.pyx":2016
20325 * if src.core.n_cigar:
20326 * cigar_p = bam1_cigar(src);
20327 * for k from 0 <= k < src.core.n_cigar: # <<<<<<<<<<<<<<
20328 * op = cigar_p[k] & BAM_CIGAR_MASK
20329 * if op==BAM_CHARD_CLIP:
20331 __pyx_t_1 = __pyx_v_src->core.n_cigar;
20332 for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_1; __pyx_v_k++) {
20334 /* "csamtools.pyx":2017
20335 * cigar_p = bam1_cigar(src);
20336 * for k from 0 <= k < src.core.n_cigar:
20337 * op = cigar_p[k] & BAM_CIGAR_MASK # <<<<<<<<<<<<<<
20338 * if op==BAM_CHARD_CLIP:
20339 * if start_offset!=0 and start_offset!=src.core.l_qseq:
20341 __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);
20343 /* "csamtools.pyx":2022
20344 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
20346 * elif op==BAM_CSOFT_CLIP: # <<<<<<<<<<<<<<
20347 * start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT
20350 switch (__pyx_v_op) {
20352 /* "csamtools.pyx":2018
20353 * for k from 0 <= k < src.core.n_cigar:
20354 * op = cigar_p[k] & BAM_CIGAR_MASK
20355 * if op==BAM_CHARD_CLIP: # <<<<<<<<<<<<<<
20356 * if start_offset!=0 and start_offset!=src.core.l_qseq:
20357 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
20361 /* "csamtools.pyx":2019
20362 * op = cigar_p[k] & BAM_CIGAR_MASK
20363 * if op==BAM_CHARD_CLIP:
20364 * if start_offset!=0 and start_offset!=src.core.l_qseq: # <<<<<<<<<<<<<<
20365 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
20368 __pyx_t_2 = (__pyx_v_start_offset != 0);
20370 __pyx_t_3 = (__pyx_v_start_offset != __pyx_v_src->core.l_qseq);
20371 __pyx_t_4 = __pyx_t_3;
20373 __pyx_t_4 = __pyx_t_2;
20377 /* "csamtools.pyx":2020
20378 * if op==BAM_CHARD_CLIP:
20379 * if start_offset!=0 and start_offset!=src.core.l_qseq:
20380 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string') # <<<<<<<<<<<<<<
20382 * elif op==BAM_CSOFT_CLIP:
20384 __pyx_t_5 = __pyx_builtin_ValueError;
20385 __Pyx_INCREF(__pyx_t_5);
20386 PyErr_SetString(__pyx_t_5, __pyx_k_132);
20387 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
20389 /* "csamtools.pyx":2021
20390 * if start_offset!=0 and start_offset!=src.core.l_qseq:
20391 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
20392 * return -1 # <<<<<<<<<<<<<<
20393 * elif op==BAM_CSOFT_CLIP:
20394 * start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT
20403 /* "csamtools.pyx":2022
20404 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
20406 * elif op==BAM_CSOFT_CLIP: # <<<<<<<<<<<<<<
20407 * start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT
20412 /* "csamtools.pyx":2023
20414 * elif op==BAM_CSOFT_CLIP:
20415 * start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT # <<<<<<<<<<<<<<
20419 __pyx_v_start_offset = (__pyx_v_start_offset + ((__pyx_v_cigar_p[__pyx_v_k]) >> 4));
20423 /* "csamtools.pyx":2025
20424 * start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT
20426 * break # <<<<<<<<<<<<<<
20428 * return start_offset
20430 goto __pyx_L5_break;
20439 /* "csamtools.pyx":2027
20442 * return start_offset # <<<<<<<<<<<<<<
20444 * ##-------------------------------------------------------------------
20446 __pyx_r = __pyx_v_start_offset;
20451 __Pyx_TraceReturn(Py_None);
20452 __Pyx_RefNannyFinishContext();
20456 /* "csamtools.pyx":2032
20457 * ##-------------------------------------------------------------------
20458 * ##-------------------------------------------------------------------
20459 * cdef inline int32_t query_end(bam1_t *src) except -1: # <<<<<<<<<<<<<<
20460 * cdef uint32_t * cigar_p, op
20464 static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *__pyx_v_src) {
20465 uint32_t *__pyx_v_cigar_p;
20466 uint32_t __pyx_v_op;
20467 uint32_t __pyx_v_k;
20468 uint32_t __pyx_v_end_offset;
20470 __Pyx_RefNannyDeclarations
20474 PyObject *__pyx_t_4 = NULL;
20475 __Pyx_TraceDeclarations
20476 __Pyx_RefNannySetupContext("query_end", 0);
20477 __Pyx_TraceCall("query_end", __pyx_f[0], 2032);
20479 /* "csamtools.pyx":2035
20480 * cdef uint32_t * cigar_p, op
20482 * cdef uint32_t end_offset = src.core.l_qseq # <<<<<<<<<<<<<<
20484 * if src.core.n_cigar>1:
20486 __pyx_v_end_offset = __pyx_v_src->core.l_qseq;
20488 /* "csamtools.pyx":2037
20489 * cdef uint32_t end_offset = src.core.l_qseq
20491 * if src.core.n_cigar>1: # <<<<<<<<<<<<<<
20492 * cigar_p = bam1_cigar(src);
20493 * for k from src.core.n_cigar > k >= 1:
20495 __pyx_t_1 = (__pyx_v_src->core.n_cigar > 1);
20498 /* "csamtools.pyx":2038
20500 * if src.core.n_cigar>1:
20501 * cigar_p = bam1_cigar(src); # <<<<<<<<<<<<<<
20502 * for k from src.core.n_cigar > k >= 1:
20503 * op = cigar_p[k] & BAM_CIGAR_MASK
20505 __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
20507 /* "csamtools.pyx":2039
20508 * if src.core.n_cigar>1:
20509 * cigar_p = bam1_cigar(src);
20510 * for k from src.core.n_cigar > k >= 1: # <<<<<<<<<<<<<<
20511 * op = cigar_p[k] & BAM_CIGAR_MASK
20512 * if op==BAM_CHARD_CLIP:
20514 for (__pyx_v_k = __pyx_v_src->core.n_cigar-1; __pyx_v_k >= 1; __pyx_v_k--) {
20516 /* "csamtools.pyx":2040
20517 * cigar_p = bam1_cigar(src);
20518 * for k from src.core.n_cigar > k >= 1:
20519 * op = cigar_p[k] & BAM_CIGAR_MASK # <<<<<<<<<<<<<<
20520 * if op==BAM_CHARD_CLIP:
20521 * if end_offset!=0 and end_offset!=src.core.l_qseq:
20523 __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);
20525 /* "csamtools.pyx":2045
20526 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
20528 * elif op==BAM_CSOFT_CLIP: # <<<<<<<<<<<<<<
20529 * end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT
20532 switch (__pyx_v_op) {
20534 /* "csamtools.pyx":2041
20535 * for k from src.core.n_cigar > k >= 1:
20536 * op = cigar_p[k] & BAM_CIGAR_MASK
20537 * if op==BAM_CHARD_CLIP: # <<<<<<<<<<<<<<
20538 * if end_offset!=0 and end_offset!=src.core.l_qseq:
20539 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
20543 /* "csamtools.pyx":2042
20544 * op = cigar_p[k] & BAM_CIGAR_MASK
20545 * if op==BAM_CHARD_CLIP:
20546 * if end_offset!=0 and end_offset!=src.core.l_qseq: # <<<<<<<<<<<<<<
20547 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
20550 __pyx_t_1 = (__pyx_v_end_offset != 0);
20552 __pyx_t_2 = (__pyx_v_end_offset != __pyx_v_src->core.l_qseq);
20553 __pyx_t_3 = __pyx_t_2;
20555 __pyx_t_3 = __pyx_t_1;
20559 /* "csamtools.pyx":2043
20560 * if op==BAM_CHARD_CLIP:
20561 * if end_offset!=0 and end_offset!=src.core.l_qseq:
20562 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string') # <<<<<<<<<<<<<<
20564 * elif op==BAM_CSOFT_CLIP:
20566 __pyx_t_4 = __pyx_builtin_ValueError;
20567 __Pyx_INCREF(__pyx_t_4);
20568 PyErr_SetString(__pyx_t_4, __pyx_k_132);
20569 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20571 /* "csamtools.pyx":2044
20572 * if end_offset!=0 and end_offset!=src.core.l_qseq:
20573 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
20574 * return -1 # <<<<<<<<<<<<<<
20575 * elif op==BAM_CSOFT_CLIP:
20576 * end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT
20585 /* "csamtools.pyx":2045
20586 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
20588 * elif op==BAM_CSOFT_CLIP: # <<<<<<<<<<<<<<
20589 * end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT
20594 /* "csamtools.pyx":2046
20596 * elif op==BAM_CSOFT_CLIP:
20597 * end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT # <<<<<<<<<<<<<<
20601 __pyx_v_end_offset = (__pyx_v_end_offset - ((__pyx_v_cigar_p[__pyx_v_k]) >> 4));
20605 /* "csamtools.pyx":2048
20606 * end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT
20608 * break # <<<<<<<<<<<<<<
20610 * if end_offset==0:
20612 goto __pyx_L5_break;
20621 /* "csamtools.pyx":2050
20624 * if end_offset==0: # <<<<<<<<<<<<<<
20625 * end_offset = src.core.l_qseq
20628 __pyx_t_3 = (__pyx_v_end_offset == 0);
20631 /* "csamtools.pyx":2051
20633 * if end_offset==0:
20634 * end_offset = src.core.l_qseq # <<<<<<<<<<<<<<
20636 * return end_offset
20638 __pyx_v_end_offset = __pyx_v_src->core.l_qseq;
20643 /* "csamtools.pyx":2053
20644 * end_offset = src.core.l_qseq
20646 * return end_offset # <<<<<<<<<<<<<<
20650 __pyx_r = __pyx_v_end_offset;
20655 __Pyx_TraceReturn(Py_None);
20656 __Pyx_RefNannyFinishContext();
20660 /* "csamtools.pyx":2056
20663 * cdef inline object get_seq_range(bam1_t *src, uint32_t start, uint32_t end): # <<<<<<<<<<<<<<
20668 static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_seq_range(bam1_t *__pyx_v_src, uint32_t __pyx_v_start, uint32_t __pyx_v_end) {
20669 uint8_t *__pyx_v_p;
20670 uint32_t __pyx_v_k;
20672 PyObject *__pyx_v_seq = NULL;
20673 PyObject *__pyx_r = NULL;
20674 __Pyx_RefNannyDeclarations
20676 PyObject *__pyx_t_2 = NULL;
20678 uint32_t __pyx_t_4;
20679 int __pyx_lineno = 0;
20680 const char *__pyx_filename = NULL;
20681 int __pyx_clineno = 0;
20682 __Pyx_TraceDeclarations
20683 __Pyx_RefNannySetupContext("get_seq_range", 0);
20684 __Pyx_TraceCall("get_seq_range", __pyx_f[0], 2056);
20686 /* "csamtools.pyx":2061
20689 * if not src.core.l_qseq: # <<<<<<<<<<<<<<
20693 __pyx_t_1 = (!__pyx_v_src->core.l_qseq);
20696 /* "csamtools.pyx":2062
20698 * if not src.core.l_qseq:
20699 * return None # <<<<<<<<<<<<<<
20701 * seq = PyBytes_FromStringAndSize(NULL, end - start)
20703 __Pyx_XDECREF(__pyx_r);
20704 __Pyx_INCREF(Py_None);
20711 /* "csamtools.pyx":2064
20714 * seq = PyBytes_FromStringAndSize(NULL, end - start) # <<<<<<<<<<<<<<
20716 * p = bam1_seq(src)
20718 __pyx_t_2 = ((PyObject *)PyBytes_FromStringAndSize(NULL, (__pyx_v_end - __pyx_v_start))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20719 __Pyx_GOTREF(__pyx_t_2);
20720 __pyx_v_seq = ((PyObject*)__pyx_t_2);
20723 /* "csamtools.pyx":2065
20725 * seq = PyBytes_FromStringAndSize(NULL, end - start)
20726 * s = <char*>seq # <<<<<<<<<<<<<<
20727 * p = bam1_seq(src)
20730 __pyx_t_3 = PyBytes_AsString(((PyObject *)__pyx_v_seq)); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20731 __pyx_v_s = ((char *)__pyx_t_3);
20733 /* "csamtools.pyx":2066
20734 * seq = PyBytes_FromStringAndSize(NULL, end - start)
20736 * p = bam1_seq(src) # <<<<<<<<<<<<<<
20738 * for k from start <= k < end:
20740 __pyx_v_p = bam1_seq(__pyx_v_src);
20742 /* "csamtools.pyx":2068
20743 * p = bam1_seq(src)
20745 * for k from start <= k < end: # <<<<<<<<<<<<<<
20746 * # equivalent to bam_nt16_rev_table[bam1_seqi(s, i)] (see bam.c)
20747 * # note: do not use string literal as it will be a python string
20749 __pyx_t_4 = __pyx_v_end;
20750 for (__pyx_v_k = __pyx_v_start; __pyx_v_k < __pyx_t_4; __pyx_v_k++) {
20752 /* "csamtools.pyx":2071
20753 * # equivalent to bam_nt16_rev_table[bam1_seqi(s, i)] (see bam.c)
20754 * # note: do not use string literal as it will be a python string
20755 * s[k-start] = bam_nt16_rev_table[p[k/2] >> 4 * (1 - k%2) & 0xf] # <<<<<<<<<<<<<<
20759 (__pyx_v_s[(__pyx_v_k - __pyx_v_start)]) = (__pyx_v_9csamtools_bam_nt16_rev_table[(((__pyx_v_p[__Pyx_div_long(__pyx_v_k, 2)]) >> (4 * (1 - __Pyx_mod_long(__pyx_v_k, 2)))) & 0xf)]);
20762 /* "csamtools.pyx":2073
20763 * s[k-start] = bam_nt16_rev_table[p[k/2] >> 4 * (1 - k%2) & 0xf]
20765 * return seq # <<<<<<<<<<<<<<
20769 __Pyx_XDECREF(__pyx_r);
20770 __Pyx_INCREF(((PyObject *)__pyx_v_seq));
20771 __pyx_r = ((PyObject *)__pyx_v_seq);
20774 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20777 __Pyx_XDECREF(__pyx_t_2);
20778 __Pyx_AddTraceback("csamtools.get_seq_range", __pyx_clineno, __pyx_lineno, __pyx_filename);
20781 __Pyx_XDECREF(__pyx_v_seq);
20782 __Pyx_XGIVEREF(__pyx_r);
20783 __Pyx_TraceReturn(__pyx_r);
20784 __Pyx_RefNannyFinishContext();
20788 /* "csamtools.pyx":2076
20791 * cdef inline object get_qual_range(bam1_t *src, uint32_t start, uint32_t end): # <<<<<<<<<<<<<<
20796 static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_qual_range(bam1_t *__pyx_v_src, uint32_t __pyx_v_start, uint32_t __pyx_v_end) {
20797 uint8_t *__pyx_v_p;
20798 uint32_t __pyx_v_k;
20800 PyObject *__pyx_v_qual = NULL;
20801 PyObject *__pyx_r = NULL;
20802 __Pyx_RefNannyDeclarations
20804 PyObject *__pyx_t_2 = NULL;
20806 uint32_t __pyx_t_4;
20807 int __pyx_lineno = 0;
20808 const char *__pyx_filename = NULL;
20809 int __pyx_clineno = 0;
20810 __Pyx_TraceDeclarations
20811 __Pyx_RefNannySetupContext("get_qual_range", 0);
20812 __Pyx_TraceCall("get_qual_range", __pyx_f[0], 2076);
20814 /* "csamtools.pyx":2081
20817 * p = bam1_qual(src) # <<<<<<<<<<<<<<
20821 __pyx_v_p = bam1_qual(__pyx_v_src);
20823 /* "csamtools.pyx":2082
20825 * p = bam1_qual(src)
20826 * if p[0] == 0xff: # <<<<<<<<<<<<<<
20830 __pyx_t_1 = ((__pyx_v_p[0]) == 0xff);
20833 /* "csamtools.pyx":2083
20834 * p = bam1_qual(src)
20836 * return None # <<<<<<<<<<<<<<
20838 * qual = PyBytes_FromStringAndSize(NULL, end - start)
20840 __Pyx_XDECREF(__pyx_r);
20841 __Pyx_INCREF(Py_None);
20848 /* "csamtools.pyx":2085
20851 * qual = PyBytes_FromStringAndSize(NULL, end - start) # <<<<<<<<<<<<<<
20855 __pyx_t_2 = ((PyObject *)PyBytes_FromStringAndSize(NULL, (__pyx_v_end - __pyx_v_start))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20856 __Pyx_GOTREF(__pyx_t_2);
20857 __pyx_v_qual = ((PyObject*)__pyx_t_2);
20860 /* "csamtools.pyx":2086
20862 * qual = PyBytes_FromStringAndSize(NULL, end - start)
20863 * q = <char*>qual # <<<<<<<<<<<<<<
20865 * for k from start <= k < end:
20867 __pyx_t_3 = PyBytes_AsString(((PyObject *)__pyx_v_qual)); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20868 __pyx_v_q = ((char *)__pyx_t_3);
20870 /* "csamtools.pyx":2088
20873 * for k from start <= k < end: # <<<<<<<<<<<<<<
20874 * ## equivalent to t[i] + 33 (see bam.c)
20875 * q[k-start] = p[k] + 33
20877 __pyx_t_4 = __pyx_v_end;
20878 for (__pyx_v_k = __pyx_v_start; __pyx_v_k < __pyx_t_4; __pyx_v_k++) {
20880 /* "csamtools.pyx":2090
20881 * for k from start <= k < end:
20882 * ## equivalent to t[i] + 33 (see bam.c)
20883 * q[k-start] = p[k] + 33 # <<<<<<<<<<<<<<
20887 (__pyx_v_q[(__pyx_v_k - __pyx_v_start)]) = ((__pyx_v_p[__pyx_v_k]) + 33);
20890 /* "csamtools.pyx":2092
20891 * q[k-start] = p[k] + 33
20893 * return qual # <<<<<<<<<<<<<<
20895 * cdef class AlignedRead:
20897 __Pyx_XDECREF(__pyx_r);
20898 __Pyx_INCREF(((PyObject *)__pyx_v_qual));
20899 __pyx_r = ((PyObject *)__pyx_v_qual);
20902 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20905 __Pyx_XDECREF(__pyx_t_2);
20906 __Pyx_AddTraceback("csamtools.get_qual_range", __pyx_clineno, __pyx_lineno, __pyx_filename);
20909 __Pyx_XDECREF(__pyx_v_qual);
20910 __Pyx_XGIVEREF(__pyx_r);
20911 __Pyx_TraceReturn(__pyx_r);
20912 __Pyx_RefNannyFinishContext();
20916 /* Python wrapper */
20917 static int __pyx_pw_9csamtools_11AlignedRead_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
20918 static int __pyx_pw_9csamtools_11AlignedRead_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20920 __Pyx_RefNannyDeclarations
20921 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
20922 if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
20923 __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
20924 if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
20925 __pyx_r = __pyx_pf_9csamtools_11AlignedRead___init__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
20926 __Pyx_RefNannyFinishContext();
20930 /* "csamtools.pyx":2124
20932 * # Now only called when instances are created from Python
20933 * def __init__(self): # <<<<<<<<<<<<<<
20935 * self._delegate = <bam1_t*>calloc( 1, sizeof( bam1_t) )
20938 static int __pyx_pf_9csamtools_11AlignedRead___init__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
20940 __Pyx_RefNannyDeclarations
20941 __Pyx_TraceDeclarations
20942 __Pyx_RefNannySetupContext("__init__", 0);
20943 __Pyx_TraceCall("__init__", __pyx_f[0], 2124);
20945 /* "csamtools.pyx":2126
20946 * def __init__(self):
20948 * self._delegate = <bam1_t*>calloc( 1, sizeof( bam1_t) ) # <<<<<<<<<<<<<<
20949 * # allocate some memory
20950 * # If size is 0, calloc does not return a pointer that can be passed to free()
20952 __pyx_v_self->_delegate = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
20954 /* "csamtools.pyx":2130
20955 * # If size is 0, calloc does not return a pointer that can be passed to free()
20956 * # so allocate 40 bytes for a new read
20957 * self._delegate.m_data = 40 # <<<<<<<<<<<<<<
20958 * self._delegate.data = <uint8_t *>calloc( self._delegate.m_data, 1 )
20959 * self._delegate.data_len = 0
20961 __pyx_v_self->_delegate->m_data = 40;
20963 /* "csamtools.pyx":2131
20964 * # so allocate 40 bytes for a new read
20965 * self._delegate.m_data = 40
20966 * self._delegate.data = <uint8_t *>calloc( self._delegate.m_data, 1 ) # <<<<<<<<<<<<<<
20967 * self._delegate.data_len = 0
20970 __pyx_v_self->_delegate->data = ((uint8_t *)calloc(__pyx_v_self->_delegate->m_data, 1));
20972 /* "csamtools.pyx":2132
20973 * self._delegate.m_data = 40
20974 * self._delegate.data = <uint8_t *>calloc( self._delegate.m_data, 1 )
20975 * self._delegate.data_len = 0 # <<<<<<<<<<<<<<
20977 * def __dealloc__(self):
20979 __pyx_v_self->_delegate->data_len = 0;
20982 __Pyx_TraceReturn(Py_None);
20983 __Pyx_RefNannyFinishContext();
20987 /* Python wrapper */
20988 static void __pyx_pw_9csamtools_11AlignedRead_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
20989 static void __pyx_pw_9csamtools_11AlignedRead_3__dealloc__(PyObject *__pyx_v_self) {
20990 __Pyx_RefNannyDeclarations
20991 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
20992 __pyx_pf_9csamtools_11AlignedRead_2__dealloc__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
20993 __Pyx_RefNannyFinishContext();
20996 /* "csamtools.pyx":2134
20997 * self._delegate.data_len = 0
20999 * def __dealloc__(self): # <<<<<<<<<<<<<<
21000 * bam_destroy1(self._delegate)
21004 static void __pyx_pf_9csamtools_11AlignedRead_2__dealloc__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
21005 __Pyx_RefNannyDeclarations
21006 __Pyx_TraceDeclarations
21007 __Pyx_RefNannySetupContext("__dealloc__", 0);
21008 __Pyx_TraceCall("__dealloc__", __pyx_f[0], 2134);
21010 /* "csamtools.pyx":2135
21012 * def __dealloc__(self):
21013 * bam_destroy1(self._delegate) # <<<<<<<<<<<<<<
21015 * def __str__(self):
21017 bam_destroy1(__pyx_v_self->_delegate);
21019 __Pyx_TraceReturn(Py_None);
21020 __Pyx_RefNannyFinishContext();
21023 /* Python wrapper */
21024 static PyObject *__pyx_pw_9csamtools_11AlignedRead_5__str__(PyObject *__pyx_v_self); /*proto*/
21025 static char __pyx_doc_9csamtools_11AlignedRead_4__str__[] = "return string representation of alignment.\n\n The representation is an approximate :term:`sam` format.\n\n An aligned read might not be associated with a :term:`Samfile`.\n As a result :term:`tid` is shown instead of the reference name.\n\n Similarly, the tags field is returned in its parsed state.\n ";
21026 struct wrapperbase __pyx_wrapperbase_9csamtools_11AlignedRead_4__str__;
21027 static PyObject *__pyx_pw_9csamtools_11AlignedRead_5__str__(PyObject *__pyx_v_self) {
21028 PyObject *__pyx_r = 0;
21029 __Pyx_RefNannyDeclarations
21030 __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
21031 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4__str__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
21032 __Pyx_RefNannyFinishContext();
21036 /* "csamtools.pyx":2137
21037 * bam_destroy1(self._delegate)
21039 * def __str__(self): # <<<<<<<<<<<<<<
21040 * """return string representation of alignment.
21044 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4__str__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
21045 PyObject *__pyx_v_seq = NULL;
21046 PyObject *__pyx_v_qual = NULL;
21047 PyObject *__pyx_r = NULL;
21048 __Pyx_RefNannyDeclarations
21049 PyObject *__pyx_t_1 = NULL;
21050 PyObject *__pyx_t_2 = NULL;
21052 PyObject *__pyx_t_4 = NULL;
21053 PyObject *__pyx_t_5 = NULL;
21054 PyObject *__pyx_t_6 = NULL;
21055 PyObject *__pyx_t_7 = NULL;
21056 PyObject *__pyx_t_8 = NULL;
21057 PyObject *__pyx_t_9 = NULL;
21058 PyObject *__pyx_t_10 = NULL;
21059 PyObject *__pyx_t_11 = NULL;
21060 PyObject *__pyx_t_12 = NULL;
21061 PyObject *__pyx_t_13 = NULL;
21062 int __pyx_lineno = 0;
21063 const char *__pyx_filename = NULL;
21064 int __pyx_clineno = 0;
21065 __Pyx_TraceDeclarations
21066 __Pyx_RefNannySetupContext("__str__", 0);
21067 __Pyx_TraceCall("__str__", __pyx_f[0], 2137);
21069 /* "csamtools.pyx":2149
21070 * # sam-parsing is done in sam.c/bam_format1_core which
21071 * # requires a valid header.
21072 * if sys.version_info[0] < 3: # <<<<<<<<<<<<<<
21076 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21077 __Pyx_GOTREF(__pyx_t_1);
21078 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__version_info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21079 __Pyx_GOTREF(__pyx_t_2);
21080 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21081 __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21082 __Pyx_GOTREF(__pyx_t_1);
21083 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21084 __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_3, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21085 __Pyx_GOTREF(__pyx_t_2);
21086 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21087 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21088 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21091 /* "csamtools.pyx":2150
21092 * # requires a valid header.
21093 * if sys.version_info[0] < 3:
21094 * seq = self.seq # <<<<<<<<<<<<<<
21098 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__seq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21099 __Pyx_GOTREF(__pyx_t_2);
21100 __pyx_v_seq = __pyx_t_2;
21103 /* "csamtools.pyx":2151
21104 * if sys.version_info[0] < 3:
21106 * qual = self.qual # <<<<<<<<<<<<<<
21108 * seq = self.seq.decode('ascii')
21110 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__qual); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21111 __Pyx_GOTREF(__pyx_t_2);
21112 __pyx_v_qual = __pyx_t_2;
21118 /* "csamtools.pyx":2153
21121 * seq = self.seq.decode('ascii') # <<<<<<<<<<<<<<
21122 * qual = self.qual.decode('ascii')
21123 * return "\t".join(map(str, (self.qname,
21125 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__seq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21126 __Pyx_GOTREF(__pyx_t_2);
21127 __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__decode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21128 __Pyx_GOTREF(__pyx_t_1);
21129 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21130 __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_133), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21131 __Pyx_GOTREF(__pyx_t_2);
21132 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21133 __pyx_v_seq = __pyx_t_2;
21136 /* "csamtools.pyx":2154
21138 * seq = self.seq.decode('ascii')
21139 * qual = self.qual.decode('ascii') # <<<<<<<<<<<<<<
21140 * return "\t".join(map(str, (self.qname,
21143 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__qual); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21144 __Pyx_GOTREF(__pyx_t_2);
21145 __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__decode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21146 __Pyx_GOTREF(__pyx_t_1);
21147 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21148 __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_134), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21149 __Pyx_GOTREF(__pyx_t_2);
21150 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21151 __pyx_v_qual = __pyx_t_2;
21156 /* "csamtools.pyx":2155
21157 * seq = self.seq.decode('ascii')
21158 * qual = self.qual.decode('ascii')
21159 * return "\t".join(map(str, (self.qname, # <<<<<<<<<<<<<<
21163 __Pyx_XDECREF(__pyx_r);
21164 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_5), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21165 __Pyx_GOTREF(__pyx_t_2);
21166 __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 = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21167 __Pyx_GOTREF(__pyx_t_1);
21169 /* "csamtools.pyx":2156
21170 * qual = self.qual.decode('ascii')
21171 * return "\t".join(map(str, (self.qname,
21172 * self.flag, # <<<<<<<<<<<<<<
21176 __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21177 __Pyx_GOTREF(__pyx_t_4);
21179 /* "csamtools.pyx":2157
21180 * return "\t".join(map(str, (self.qname,
21182 * self.rname, # <<<<<<<<<<<<<<
21186 __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__rname); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21187 __Pyx_GOTREF(__pyx_t_5);
21189 /* "csamtools.pyx":2158
21192 * self.pos, # <<<<<<<<<<<<<<
21196 __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__pos); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21197 __Pyx_GOTREF(__pyx_t_6);
21199 /* "csamtools.pyx":2159
21202 * self.mapq, # <<<<<<<<<<<<<<
21206 __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__mapq); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21207 __Pyx_GOTREF(__pyx_t_7);
21209 /* "csamtools.pyx":2160
21212 * self.cigar, # <<<<<<<<<<<<<<
21216 __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__cigar); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21217 __Pyx_GOTREF(__pyx_t_8);
21219 /* "csamtools.pyx":2161
21222 * self.mrnm, # <<<<<<<<<<<<<<
21226 __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__mrnm); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21227 __Pyx_GOTREF(__pyx_t_9);
21229 /* "csamtools.pyx":2162
21232 * self.mpos, # <<<<<<<<<<<<<<
21236 __pyx_t_10 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__mpos); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21237 __Pyx_GOTREF(__pyx_t_10);
21239 /* "csamtools.pyx":2163
21242 * self.rlen, # <<<<<<<<<<<<<<
21246 __pyx_t_11 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__rlen); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21247 __Pyx_GOTREF(__pyx_t_11);
21249 /* "csamtools.pyx":2166
21252 * self.tags ))) # <<<<<<<<<<<<<<
21254 * def compare(self, AlignedRead other):
21256 __pyx_t_12 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__tags); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21257 __Pyx_GOTREF(__pyx_t_12);
21258 __pyx_t_13 = PyTuple_New(12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21259 __Pyx_GOTREF(__pyx_t_13);
21260 PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1);
21261 __Pyx_GIVEREF(__pyx_t_1);
21262 PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_4);
21263 __Pyx_GIVEREF(__pyx_t_4);
21264 PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_5);
21265 __Pyx_GIVEREF(__pyx_t_5);
21266 PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_t_6);
21267 __Pyx_GIVEREF(__pyx_t_6);
21268 PyTuple_SET_ITEM(__pyx_t_13, 4, __pyx_t_7);
21269 __Pyx_GIVEREF(__pyx_t_7);
21270 PyTuple_SET_ITEM(__pyx_t_13, 5, __pyx_t_8);
21271 __Pyx_GIVEREF(__pyx_t_8);
21272 PyTuple_SET_ITEM(__pyx_t_13, 6, __pyx_t_9);
21273 __Pyx_GIVEREF(__pyx_t_9);
21274 PyTuple_SET_ITEM(__pyx_t_13, 7, __pyx_t_10);
21275 __Pyx_GIVEREF(__pyx_t_10);
21276 PyTuple_SET_ITEM(__pyx_t_13, 8, __pyx_t_11);
21277 __Pyx_GIVEREF(__pyx_t_11);
21278 __Pyx_INCREF(__pyx_v_seq);
21279 PyTuple_SET_ITEM(__pyx_t_13, 9, __pyx_v_seq);
21280 __Pyx_GIVEREF(__pyx_v_seq);
21281 __Pyx_INCREF(__pyx_v_qual);
21282 PyTuple_SET_ITEM(__pyx_t_13, 10, __pyx_v_qual);
21283 __Pyx_GIVEREF(__pyx_v_qual);
21284 PyTuple_SET_ITEM(__pyx_t_13, 11, __pyx_t_12);
21285 __Pyx_GIVEREF(__pyx_t_12);
21296 __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21297 __Pyx_GOTREF(__pyx_t_12);
21298 __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
21299 PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
21300 __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
21301 PyTuple_SET_ITEM(__pyx_t_12, 1, ((PyObject *)__pyx_t_13));
21302 __Pyx_GIVEREF(((PyObject *)__pyx_t_13));
21304 __pyx_t_13 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21305 __Pyx_GOTREF(__pyx_t_13);
21306 __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
21307 __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21308 __Pyx_GOTREF(__pyx_t_12);
21309 PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13);
21310 __Pyx_GIVEREF(__pyx_t_13);
21312 __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21313 __Pyx_GOTREF(__pyx_t_13);
21314 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21315 __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
21316 __pyx_r = __pyx_t_13;
21320 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21323 __Pyx_XDECREF(__pyx_t_1);
21324 __Pyx_XDECREF(__pyx_t_2);
21325 __Pyx_XDECREF(__pyx_t_4);
21326 __Pyx_XDECREF(__pyx_t_5);
21327 __Pyx_XDECREF(__pyx_t_6);
21328 __Pyx_XDECREF(__pyx_t_7);
21329 __Pyx_XDECREF(__pyx_t_8);
21330 __Pyx_XDECREF(__pyx_t_9);
21331 __Pyx_XDECREF(__pyx_t_10);
21332 __Pyx_XDECREF(__pyx_t_11);
21333 __Pyx_XDECREF(__pyx_t_12);
21334 __Pyx_XDECREF(__pyx_t_13);
21335 __Pyx_AddTraceback("csamtools.AlignedRead.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
21338 __Pyx_XDECREF(__pyx_v_seq);
21339 __Pyx_XDECREF(__pyx_v_qual);
21340 __Pyx_XGIVEREF(__pyx_r);
21341 __Pyx_TraceReturn(__pyx_r);
21342 __Pyx_RefNannyFinishContext();
21346 /* Python wrapper */
21347 static PyObject *__pyx_pw_9csamtools_11AlignedRead_7compare(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
21348 static char __pyx_doc_9csamtools_11AlignedRead_6compare[] = "AlignedRead.compare(self, AlignedRead other)\nreturn -1,0,1, if contents in this are binary <,=,> to *other*";
21349 static PyObject *__pyx_pw_9csamtools_11AlignedRead_7compare(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
21350 PyObject *__pyx_r = 0;
21351 __Pyx_RefNannyDeclarations
21352 __Pyx_RefNannySetupContext("compare (wrapper)", 0);
21353 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_9csamtools_AlignedRead, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21354 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_6compare(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_other));
21359 __Pyx_RefNannyFinishContext();
21363 /* "csamtools.pyx":2168
21366 * def compare(self, AlignedRead other): # <<<<<<<<<<<<<<
21367 * '''return -1,0,1, if contents in this are binary <,=,> to *other*'''
21371 static PyObject *__pyx_pf_9csamtools_11AlignedRead_6compare(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_other) {
21372 int __pyx_v_retval;
21375 PyObject *__pyx_r = NULL;
21376 __Pyx_RefNannyDeclarations
21378 PyObject *__pyx_t_2 = NULL;
21379 int __pyx_lineno = 0;
21380 const char *__pyx_filename = NULL;
21381 int __pyx_clineno = 0;
21382 __Pyx_TraceDeclarations
21383 __Pyx_RefNannySetupContext("compare", 0);
21384 __Pyx_TraceCall("compare", __pyx_f[0], 2168);
21386 /* "csamtools.pyx":2174
21387 * cdef bam1_t *t, *o
21389 * t = self._delegate # <<<<<<<<<<<<<<
21390 * o = other._delegate
21393 __pyx_v_t = __pyx_v_self->_delegate;
21395 /* "csamtools.pyx":2175
21397 * t = self._delegate
21398 * o = other._delegate # <<<<<<<<<<<<<<
21400 * # uncomment for debugging purposes
21402 __pyx_v_o = __pyx_v_other->_delegate;
21404 /* "csamtools.pyx":2187
21406 * # Fast-path test for object identity
21407 * if t==o: # <<<<<<<<<<<<<<
21411 __pyx_t_1 = (__pyx_v_t == __pyx_v_o);
21414 /* "csamtools.pyx":2188
21415 * # Fast-path test for object identity
21417 * return 0 # <<<<<<<<<<<<<<
21419 * retval = memcmp(&t.core, &o.core, sizeof(bam1_core_t))
21421 __Pyx_XDECREF(__pyx_r);
21422 __Pyx_INCREF(__pyx_int_0);
21423 __pyx_r = __pyx_int_0;
21429 /* "csamtools.pyx":2190
21432 * retval = memcmp(&t.core, &o.core, sizeof(bam1_core_t)) # <<<<<<<<<<<<<<
21434 * if retval: return retval
21436 __pyx_v_retval = memcmp((&__pyx_v_t->core), (&__pyx_v_o->core), (sizeof(bam1_core_t)));
21438 /* "csamtools.pyx":2192
21439 * retval = memcmp(&t.core, &o.core, sizeof(bam1_core_t))
21441 * if retval: return retval # <<<<<<<<<<<<<<
21442 * retval = (t.data_len > o.data_len) - (t.data_len < o.data_len) # cmp(t.data_len, o.data_len)
21443 * if retval: return retval
21445 if (__pyx_v_retval) {
21446 __Pyx_XDECREF(__pyx_r);
21447 __pyx_t_2 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21448 __Pyx_GOTREF(__pyx_t_2);
21449 __pyx_r = __pyx_t_2;
21456 /* "csamtools.pyx":2193
21458 * if retval: return retval
21459 * retval = (t.data_len > o.data_len) - (t.data_len < o.data_len) # cmp(t.data_len, o.data_len) # <<<<<<<<<<<<<<
21460 * if retval: return retval
21461 * return memcmp(t.data, o.data, t.data_len)
21463 __pyx_v_retval = ((__pyx_v_t->data_len > __pyx_v_o->data_len) - (__pyx_v_t->data_len < __pyx_v_o->data_len));
21465 /* "csamtools.pyx":2194
21466 * if retval: return retval
21467 * retval = (t.data_len > o.data_len) - (t.data_len < o.data_len) # cmp(t.data_len, o.data_len)
21468 * if retval: return retval # <<<<<<<<<<<<<<
21469 * return memcmp(t.data, o.data, t.data_len)
21472 if (__pyx_v_retval) {
21473 __Pyx_XDECREF(__pyx_r);
21474 __pyx_t_2 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21475 __Pyx_GOTREF(__pyx_t_2);
21476 __pyx_r = __pyx_t_2;
21483 /* "csamtools.pyx":2195
21484 * retval = (t.data_len > o.data_len) - (t.data_len < o.data_len) # cmp(t.data_len, o.data_len)
21485 * if retval: return retval
21486 * return memcmp(t.data, o.data, t.data_len) # <<<<<<<<<<<<<<
21488 * # Disabled so long as __cmp__ is a special method
21490 __Pyx_XDECREF(__pyx_r);
21491 __pyx_t_2 = PyInt_FromLong(memcmp(__pyx_v_t->data, __pyx_v_o->data, __pyx_v_t->data_len)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21492 __Pyx_GOTREF(__pyx_t_2);
21493 __pyx_r = __pyx_t_2;
21497 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21500 __Pyx_XDECREF(__pyx_t_2);
21501 __Pyx_AddTraceback("csamtools.AlignedRead.compare", __pyx_clineno, __pyx_lineno, __pyx_filename);
21504 __Pyx_XGIVEREF(__pyx_r);
21505 __Pyx_TraceReturn(__pyx_r);
21506 __Pyx_RefNannyFinishContext();
21510 /* Python wrapper */
21511 static Py_hash_t __pyx_pw_9csamtools_11AlignedRead_9__hash__(PyObject *__pyx_v_self); /*proto*/
21512 static Py_hash_t __pyx_pw_9csamtools_11AlignedRead_9__hash__(PyObject *__pyx_v_self) {
21514 __Pyx_RefNannyDeclarations
21515 __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
21516 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_8__hash__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
21517 __Pyx_RefNannyFinishContext();
21521 /* "csamtools.pyx":2198
21523 * # Disabled so long as __cmp__ is a special method
21524 * def __hash__(self): # <<<<<<<<<<<<<<
21525 * return _Py_HashPointer(<void *>self)
21529 static Py_hash_t __pyx_pf_9csamtools_11AlignedRead_8__hash__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
21531 __Pyx_RefNannyDeclarations
21532 __Pyx_TraceDeclarations
21533 __Pyx_RefNannySetupContext("__hash__", 0);
21534 __Pyx_TraceCall("__hash__", __pyx_f[0], 2198);
21536 /* "csamtools.pyx":2199
21537 * # Disabled so long as __cmp__ is a special method
21538 * def __hash__(self):
21539 * return _Py_HashPointer(<void *>self) # <<<<<<<<<<<<<<
21543 __pyx_r = _Py_HashPointer(((void *)__pyx_v_self));
21548 if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
21549 __Pyx_TraceReturn(Py_None);
21550 __Pyx_RefNannyFinishContext();
21554 /* Python wrapper */
21555 static PyObject *__pyx_pw_9csamtools_11AlignedRead_5qname_1__get__(PyObject *__pyx_v_self); /*proto*/
21556 static PyObject *__pyx_pw_9csamtools_11AlignedRead_5qname_1__get__(PyObject *__pyx_v_self) {
21557 PyObject *__pyx_r = 0;
21558 __Pyx_RefNannyDeclarations
21559 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
21560 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5qname___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
21561 __Pyx_RefNannyFinishContext();
21565 /* "csamtools.pyx":2203
21567 * """the query name (None if not present)"""
21568 * def __get__(self): # <<<<<<<<<<<<<<
21569 * cdef bam1_t * src
21570 * src = self._delegate
21573 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
21574 bam1_t *__pyx_v_src;
21575 PyObject *__pyx_r = NULL;
21576 __Pyx_RefNannyDeclarations
21578 PyObject *__pyx_t_2 = NULL;
21579 int __pyx_lineno = 0;
21580 const char *__pyx_filename = NULL;
21581 int __pyx_clineno = 0;
21582 __Pyx_TraceDeclarations
21583 __Pyx_RefNannySetupContext("__get__", 0);
21584 __Pyx_TraceCall("__get__", __pyx_f[0], 2203);
21586 /* "csamtools.pyx":2205
21587 * def __get__(self):
21588 * cdef bam1_t * src
21589 * src = self._delegate # <<<<<<<<<<<<<<
21590 * if src.core.l_qname == 0: return None
21591 * return _charptr_to_str(<char *>bam1_qname( src ))
21593 __pyx_v_src = __pyx_v_self->_delegate;
21595 /* "csamtools.pyx":2206
21596 * cdef bam1_t * src
21597 * src = self._delegate
21598 * if src.core.l_qname == 0: return None # <<<<<<<<<<<<<<
21599 * return _charptr_to_str(<char *>bam1_qname( src ))
21602 __pyx_t_1 = (__pyx_v_src->core.l_qname == 0);
21604 __Pyx_XDECREF(__pyx_r);
21605 __Pyx_INCREF(Py_None);
21612 /* "csamtools.pyx":2207
21613 * src = self._delegate
21614 * if src.core.l_qname == 0: return None
21615 * return _charptr_to_str(<char *>bam1_qname( src )) # <<<<<<<<<<<<<<
21617 * def __set__(self, qname ):
21619 __Pyx_XDECREF(__pyx_r);
21620 __pyx_t_2 = __pyx_f_9csamtools__charptr_to_str(((char *)bam1_qname(__pyx_v_src))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21621 __Pyx_GOTREF(__pyx_t_2);
21622 __pyx_r = __pyx_t_2;
21626 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21629 __Pyx_XDECREF(__pyx_t_2);
21630 __Pyx_AddTraceback("csamtools.AlignedRead.qname.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
21633 __Pyx_XGIVEREF(__pyx_r);
21634 __Pyx_TraceReturn(__pyx_r);
21635 __Pyx_RefNannyFinishContext();
21639 /* Python wrapper */
21640 static int __pyx_pw_9csamtools_11AlignedRead_5qname_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qname); /*proto*/
21641 static int __pyx_pw_9csamtools_11AlignedRead_5qname_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qname) {
21643 __Pyx_RefNannyDeclarations
21644 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
21645 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5qname_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_qname));
21646 __Pyx_RefNannyFinishContext();
21650 /* "csamtools.pyx":2209
21651 * return _charptr_to_str(<char *>bam1_qname( src ))
21653 * def __set__(self, qname ): # <<<<<<<<<<<<<<
21654 * if qname == None or len(qname) == 0: return
21655 * qname = _force_bytes(qname)
21658 static int __pyx_pf_9csamtools_11AlignedRead_5qname_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_qname) {
21659 bam1_t *__pyx_v_src;
21663 __Pyx_RefNannyDeclarations
21664 PyObject *__pyx_t_1 = NULL;
21666 Py_ssize_t __pyx_t_3;
21670 int __pyx_lineno = 0;
21671 const char *__pyx_filename = NULL;
21672 int __pyx_clineno = 0;
21673 __Pyx_TraceDeclarations
21674 __Pyx_RefNannySetupContext("__set__", 0);
21675 __Pyx_TraceCall("__set__", __pyx_f[0], 2209);
21676 __Pyx_INCREF(__pyx_v_qname);
21678 /* "csamtools.pyx":2210
21680 * def __set__(self, qname ):
21681 * if qname == None or len(qname) == 0: return # <<<<<<<<<<<<<<
21682 * qname = _force_bytes(qname)
21683 * cdef bam1_t * src
21685 __pyx_t_1 = PyObject_RichCompare(__pyx_v_qname, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21686 __Pyx_GOTREF(__pyx_t_1);
21687 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21688 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21690 __pyx_t_3 = PyObject_Length(__pyx_v_qname); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21691 __pyx_t_4 = (__pyx_t_3 == 0);
21692 __pyx_t_5 = __pyx_t_4;
21694 __pyx_t_5 = __pyx_t_2;
21703 /* "csamtools.pyx":2211
21704 * def __set__(self, qname ):
21705 * if qname == None or len(qname) == 0: return
21706 * qname = _force_bytes(qname) # <<<<<<<<<<<<<<
21707 * cdef bam1_t * src
21710 __pyx_t_1 = ((PyObject *)__pyx_f_9csamtools__force_bytes(__pyx_v_qname)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21711 __Pyx_GOTREF(__pyx_t_1);
21712 __Pyx_DECREF(__pyx_v_qname);
21713 __pyx_v_qname = __pyx_t_1;
21716 /* "csamtools.pyx":2216
21719 * src = self._delegate # <<<<<<<<<<<<<<
21720 * p = bam1_qname( src )
21723 __pyx_v_src = __pyx_v_self->_delegate;
21725 /* "csamtools.pyx":2217
21727 * src = self._delegate
21728 * p = bam1_qname( src ) # <<<<<<<<<<<<<<
21730 * # the qname is \0 terminated
21732 __pyx_v_p = bam1_qname(__pyx_v_src);
21734 /* "csamtools.pyx":2220
21736 * # the qname is \0 terminated
21737 * l = len(qname) + 1 # <<<<<<<<<<<<<<
21738 * pysam_bam_update( src,
21739 * src.core.l_qname,
21741 __pyx_t_3 = PyObject_Length(__pyx_v_qname); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21742 __pyx_v_l = (__pyx_t_3 + 1);
21744 /* "csamtools.pyx":2224
21745 * src.core.l_qname,
21747 * <uint8_t*>p ) # <<<<<<<<<<<<<<
21749 * src.core.l_qname = l
21751 pysam_bam_update(__pyx_v_src, __pyx_v_src->core.l_qname, __pyx_v_l, ((uint8_t *)__pyx_v_p));
21753 /* "csamtools.pyx":2226
21756 * src.core.l_qname = l # <<<<<<<<<<<<<<
21758 * # re-acquire pointer to location in memory
21760 __pyx_v_src->core.l_qname = __pyx_v_l;
21762 /* "csamtools.pyx":2230
21763 * # re-acquire pointer to location in memory
21764 * # as it might have moved
21765 * p = bam1_qname(src) # <<<<<<<<<<<<<<
21767 * strncpy( p, qname, l )
21769 __pyx_v_p = bam1_qname(__pyx_v_src);
21771 /* "csamtools.pyx":2232
21772 * p = bam1_qname(src)
21774 * strncpy( p, qname, l ) # <<<<<<<<<<<<<<
21778 __pyx_t_6 = PyBytes_AsString(__pyx_v_qname); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21779 strncpy(__pyx_v_p, __pyx_t_6, __pyx_v_l);
21784 __Pyx_XDECREF(__pyx_t_1);
21785 __Pyx_AddTraceback("csamtools.AlignedRead.qname.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
21788 __Pyx_XDECREF(__pyx_v_qname);
21789 __Pyx_TraceReturn(Py_None);
21790 __Pyx_RefNannyFinishContext();
21794 /* Python wrapper */
21795 static PyObject *__pyx_pw_9csamtools_11AlignedRead_5cigar_1__get__(PyObject *__pyx_v_self); /*proto*/
21796 static PyObject *__pyx_pw_9csamtools_11AlignedRead_5cigar_1__get__(PyObject *__pyx_v_self) {
21797 PyObject *__pyx_r = 0;
21798 __Pyx_RefNannyDeclarations
21799 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
21800 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5cigar___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
21801 __Pyx_RefNannyFinishContext();
21805 /* "csamtools.pyx":2259
21808 * def __get__(self): # <<<<<<<<<<<<<<
21809 * cdef uint32_t * cigar_p
21810 * cdef bam1_t * src
21813 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
21814 uint32_t *__pyx_v_cigar_p;
21815 bam1_t *__pyx_v_src;
21816 PyObject *__pyx_v_op = 0;
21817 PyObject *__pyx_v_l = 0;
21818 PyObject *__pyx_v_cigar = 0;
21820 PyObject *__pyx_r = NULL;
21821 __Pyx_RefNannyDeclarations
21823 PyObject *__pyx_t_2 = NULL;
21824 uint32_t __pyx_t_3;
21825 PyObject *__pyx_t_4 = NULL;
21826 int __pyx_lineno = 0;
21827 const char *__pyx_filename = NULL;
21828 int __pyx_clineno = 0;
21829 __Pyx_TraceDeclarations
21830 __Pyx_RefNannySetupContext("__get__", 0);
21831 __Pyx_TraceCall("__get__", __pyx_f[0], 2259);
21833 /* "csamtools.pyx":2265
21836 * src = self._delegate # <<<<<<<<<<<<<<
21837 * if src.core.n_cigar == 0: return None
21840 __pyx_v_src = __pyx_v_self->_delegate;
21842 /* "csamtools.pyx":2266
21844 * src = self._delegate
21845 * if src.core.n_cigar == 0: return None # <<<<<<<<<<<<<<
21849 __pyx_t_1 = (__pyx_v_src->core.n_cigar == 0);
21851 __Pyx_XDECREF(__pyx_r);
21852 __Pyx_INCREF(Py_None);
21859 /* "csamtools.pyx":2268
21860 * if src.core.n_cigar == 0: return None
21862 * cigar = [] # <<<<<<<<<<<<<<
21863 * cigar_p = bam1_cigar(src);
21864 * for k from 0 <= k < src.core.n_cigar:
21866 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21867 __Pyx_GOTREF(__pyx_t_2);
21868 __pyx_v_cigar = ((PyObject *)__pyx_t_2);
21871 /* "csamtools.pyx":2269
21874 * cigar_p = bam1_cigar(src); # <<<<<<<<<<<<<<
21875 * for k from 0 <= k < src.core.n_cigar:
21876 * op = cigar_p[k] & BAM_CIGAR_MASK
21878 __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
21880 /* "csamtools.pyx":2270
21882 * cigar_p = bam1_cigar(src);
21883 * for k from 0 <= k < src.core.n_cigar: # <<<<<<<<<<<<<<
21884 * op = cigar_p[k] & BAM_CIGAR_MASK
21885 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
21887 __pyx_t_3 = __pyx_v_src->core.n_cigar;
21888 for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
21890 /* "csamtools.pyx":2271
21891 * cigar_p = bam1_cigar(src);
21892 * for k from 0 <= k < src.core.n_cigar:
21893 * op = cigar_p[k] & BAM_CIGAR_MASK # <<<<<<<<<<<<<<
21894 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
21895 * cigar.append((op, l))
21897 __pyx_t_2 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) & 15)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21898 __Pyx_GOTREF(__pyx_t_2);
21899 __Pyx_XDECREF(__pyx_v_op);
21900 __pyx_v_op = __pyx_t_2;
21903 /* "csamtools.pyx":2272
21904 * for k from 0 <= k < src.core.n_cigar:
21905 * op = cigar_p[k] & BAM_CIGAR_MASK
21906 * l = cigar_p[k] >> BAM_CIGAR_SHIFT # <<<<<<<<<<<<<<
21907 * cigar.append((op, l))
21910 __pyx_t_2 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21911 __Pyx_GOTREF(__pyx_t_2);
21912 __Pyx_XDECREF(__pyx_v_l);
21913 __pyx_v_l = __pyx_t_2;
21916 /* "csamtools.pyx":2273
21917 * op = cigar_p[k] & BAM_CIGAR_MASK
21918 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
21919 * cigar.append((op, l)) # <<<<<<<<<<<<<<
21923 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21924 __Pyx_GOTREF(__pyx_t_2);
21925 __Pyx_INCREF(__pyx_v_op);
21926 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_op);
21927 __Pyx_GIVEREF(__pyx_v_op);
21928 __Pyx_INCREF(__pyx_v_l);
21929 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_l);
21930 __Pyx_GIVEREF(__pyx_v_l);
21931 __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_cigar, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21932 __Pyx_GOTREF(__pyx_t_4);
21933 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
21934 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21937 /* "csamtools.pyx":2274
21938 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
21939 * cigar.append((op, l))
21940 * return cigar # <<<<<<<<<<<<<<
21942 * def __set__(self, values ):
21944 __Pyx_XDECREF(__pyx_r);
21945 __Pyx_INCREF(__pyx_v_cigar);
21946 __pyx_r = __pyx_v_cigar;
21949 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21952 __Pyx_XDECREF(__pyx_t_2);
21953 __Pyx_XDECREF(__pyx_t_4);
21954 __Pyx_AddTraceback("csamtools.AlignedRead.cigar.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
21957 __Pyx_XDECREF(__pyx_v_op);
21958 __Pyx_XDECREF(__pyx_v_l);
21959 __Pyx_XDECREF(__pyx_v_cigar);
21960 __Pyx_XGIVEREF(__pyx_r);
21961 __Pyx_TraceReturn(__pyx_r);
21962 __Pyx_RefNannyFinishContext();
21966 /* Python wrapper */
21967 static int __pyx_pw_9csamtools_11AlignedRead_5cigar_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_values); /*proto*/
21968 static int __pyx_pw_9csamtools_11AlignedRead_5cigar_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_values) {
21970 __Pyx_RefNannyDeclarations
21971 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
21972 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5cigar_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_values));
21973 __Pyx_RefNannyFinishContext();
21977 /* "csamtools.pyx":2276
21980 * def __set__(self, values ): # <<<<<<<<<<<<<<
21981 * if values == None or len(values) == 0: return
21982 * cdef uint32_t * p
21985 static int __pyx_pf_9csamtools_11AlignedRead_5cigar_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_values) {
21986 uint32_t *__pyx_v_p;
21987 bam1_t *__pyx_v_src;
21988 PyObject *__pyx_v_op = 0;
21989 PyObject *__pyx_v_l = 0;
21992 __Pyx_RefNannyDeclarations
21993 PyObject *__pyx_t_1 = NULL;
21995 Py_ssize_t __pyx_t_3;
21998 PyObject *(*__pyx_t_6)(PyObject *);
21999 PyObject *__pyx_t_7 = NULL;
22000 PyObject *__pyx_t_8 = NULL;
22001 PyObject *__pyx_t_9 = NULL;
22002 PyObject *__pyx_t_10 = NULL;
22003 PyObject *(*__pyx_t_11)(PyObject *);
22004 uint32_t __pyx_t_12;
22005 int __pyx_lineno = 0;
22006 const char *__pyx_filename = NULL;
22007 int __pyx_clineno = 0;
22008 __Pyx_TraceDeclarations
22009 __Pyx_RefNannySetupContext("__set__", 0);
22010 __Pyx_TraceCall("__set__", __pyx_f[0], 2276);
22012 /* "csamtools.pyx":2277
22014 * def __set__(self, values ):
22015 * if values == None or len(values) == 0: return # <<<<<<<<<<<<<<
22016 * cdef uint32_t * p
22017 * cdef bam1_t * src
22019 __pyx_t_1 = PyObject_RichCompare(__pyx_v_values, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22020 __Pyx_GOTREF(__pyx_t_1);
22021 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22022 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22024 __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22025 __pyx_t_4 = (__pyx_t_3 == 0);
22026 __pyx_t_5 = __pyx_t_4;
22028 __pyx_t_5 = __pyx_t_2;
22037 /* "csamtools.pyx":2283
22040 * k = 0 # <<<<<<<<<<<<<<
22042 * src = self._delegate
22046 /* "csamtools.pyx":2285
22049 * src = self._delegate # <<<<<<<<<<<<<<
22051 * # get location of cigar string
22053 __pyx_v_src = __pyx_v_self->_delegate;
22055 /* "csamtools.pyx":2288
22057 * # get location of cigar string
22058 * p = bam1_cigar(src) # <<<<<<<<<<<<<<
22060 * # create space for cigar data within src.data
22062 __pyx_v_p = bam1_cigar(__pyx_v_src);
22064 /* "csamtools.pyx":2293
22065 * pysam_bam_update( src,
22066 * src.core.n_cigar * 4,
22067 * len(values) * 4, # <<<<<<<<<<<<<<
22071 __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22073 /* "csamtools.pyx":2294
22074 * src.core.n_cigar * 4,
22076 * <uint8_t*>p ) # <<<<<<<<<<<<<<
22078 * # length is number of cigar operations, not bytes
22080 pysam_bam_update(__pyx_v_src, (__pyx_v_src->core.n_cigar * 4), (__pyx_t_3 * 4), ((uint8_t *)__pyx_v_p));
22082 /* "csamtools.pyx":2297
22084 * # length is number of cigar operations, not bytes
22085 * src.core.n_cigar = len(values) # <<<<<<<<<<<<<<
22087 * # re-acquire pointer to location in memory
22089 __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22090 __pyx_v_src->core.n_cigar = __pyx_t_3;
22092 /* "csamtools.pyx":2301
22093 * # re-acquire pointer to location in memory
22094 * # as it might have moved
22095 * p = bam1_cigar(src) # <<<<<<<<<<<<<<
22097 * # insert cigar operations
22099 __pyx_v_p = bam1_cigar(__pyx_v_src);
22101 /* "csamtools.pyx":2304
22103 * # insert cigar operations
22104 * for op, l in values: # <<<<<<<<<<<<<<
22105 * p[k] = l << BAM_CIGAR_SHIFT | op
22108 if (PyList_CheckExact(__pyx_v_values) || PyTuple_CheckExact(__pyx_v_values)) {
22109 __pyx_t_1 = __pyx_v_values; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
22112 __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22113 __Pyx_GOTREF(__pyx_t_1);
22114 __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
22117 if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_1)) {
22118 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
22119 __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
22120 } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) {
22121 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
22122 __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++;
22124 __pyx_t_7 = __pyx_t_6(__pyx_t_1);
22125 if (unlikely(!__pyx_t_7)) {
22126 if (PyErr_Occurred()) {
22127 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
22128 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22132 __Pyx_GOTREF(__pyx_t_7);
22134 if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
22135 PyObject* sequence = __pyx_t_7;
22136 if (likely(PyTuple_CheckExact(sequence))) {
22137 if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
22138 if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
22139 else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
22140 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22142 __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0);
22143 __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
22145 if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
22146 if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
22147 else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
22148 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22150 __pyx_t_8 = PyList_GET_ITEM(sequence, 0);
22151 __pyx_t_9 = PyList_GET_ITEM(sequence, 1);
22153 __Pyx_INCREF(__pyx_t_8);
22154 __Pyx_INCREF(__pyx_t_9);
22155 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
22157 Py_ssize_t index = -1;
22158 __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22159 __Pyx_GOTREF(__pyx_t_10);
22160 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
22161 __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
22162 index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
22163 __Pyx_GOTREF(__pyx_t_8);
22164 index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
22165 __Pyx_GOTREF(__pyx_t_9);
22166 if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22167 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
22168 goto __pyx_L7_unpacking_done;
22169 __pyx_L6_unpacking_failed:;
22170 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
22171 if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
22172 if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
22173 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22174 __pyx_L7_unpacking_done:;
22176 __Pyx_XDECREF(__pyx_v_op);
22177 __pyx_v_op = __pyx_t_8;
22179 __Pyx_XDECREF(__pyx_v_l);
22180 __pyx_v_l = __pyx_t_9;
22183 /* "csamtools.pyx":2305
22184 * # insert cigar operations
22185 * for op, l in values:
22186 * p[k] = l << BAM_CIGAR_SHIFT | op # <<<<<<<<<<<<<<
22190 __pyx_t_7 = PyNumber_Lshift(__pyx_v_l, __pyx_int_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22191 __Pyx_GOTREF(__pyx_t_7);
22192 __pyx_t_9 = PyNumber_Or(__pyx_t_7, __pyx_v_op); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22193 __Pyx_GOTREF(__pyx_t_9);
22194 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
22195 __pyx_t_12 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22196 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
22197 (__pyx_v_p[__pyx_v_k]) = __pyx_t_12;
22199 /* "csamtools.pyx":2306
22200 * for op, l in values:
22201 * p[k] = l << BAM_CIGAR_SHIFT | op
22202 * k += 1 # <<<<<<<<<<<<<<
22204 * ## setting the cigar string also updates the "bin" attribute
22206 __pyx_v_k = (__pyx_v_k + 1);
22208 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22210 /* "csamtools.pyx":2309
22212 * ## setting the cigar string also updates the "bin" attribute
22213 * src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, p)) # <<<<<<<<<<<<<<
22215 * property cigarstring:
22217 __pyx_v_src->core.bin = bam_reg2bin(__pyx_v_src->core.pos, bam_calend((&__pyx_v_src->core), __pyx_v_p));
22222 __Pyx_XDECREF(__pyx_t_1);
22223 __Pyx_XDECREF(__pyx_t_7);
22224 __Pyx_XDECREF(__pyx_t_8);
22225 __Pyx_XDECREF(__pyx_t_9);
22226 __Pyx_XDECREF(__pyx_t_10);
22227 __Pyx_AddTraceback("csamtools.AlignedRead.cigar.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
22230 __Pyx_XDECREF(__pyx_v_op);
22231 __Pyx_XDECREF(__pyx_v_l);
22232 __Pyx_TraceReturn(Py_None);
22233 __Pyx_RefNannyFinishContext();
22237 /* Python wrapper */
22238 static PyObject *__pyx_pw_9csamtools_11AlignedRead_11cigarstring_1__get__(PyObject *__pyx_v_self); /*proto*/
22239 static PyObject *__pyx_pw_9csamtools_11AlignedRead_11cigarstring_1__get__(PyObject *__pyx_v_self) {
22240 PyObject *__pyx_r = 0;
22241 __Pyx_RefNannyDeclarations
22242 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22243 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
22244 __Pyx_RefNannyFinishContext();
22248 /* "csamtools.pyx":2316
22249 * Returns the empty string if not present.
22251 * def __get__(self): # <<<<<<<<<<<<<<
22253 * if c == None: return ""
22256 static PyObject *__pyx_pf_9csamtools_11AlignedRead_11cigarstring___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
22257 PyObject *__pyx_v_c = NULL;
22258 PyObject *__pyx_v_x = NULL;
22259 PyObject *__pyx_v_y = NULL;
22260 PyObject *__pyx_r = NULL;
22261 __Pyx_RefNannyDeclarations
22262 PyObject *__pyx_t_1 = NULL;
22264 PyObject *__pyx_t_3 = NULL;
22265 PyObject *__pyx_t_4 = NULL;
22266 Py_ssize_t __pyx_t_5;
22267 PyObject *(*__pyx_t_6)(PyObject *);
22268 PyObject *__pyx_t_7 = NULL;
22269 PyObject *__pyx_t_8 = NULL;
22270 PyObject *__pyx_t_9 = NULL;
22271 PyObject *__pyx_t_10 = NULL;
22272 PyObject *(*__pyx_t_11)(PyObject *);
22273 Py_ssize_t __pyx_t_12;
22274 int __pyx_lineno = 0;
22275 const char *__pyx_filename = NULL;
22276 int __pyx_clineno = 0;
22277 __Pyx_TraceDeclarations
22278 __Pyx_RefNannySetupContext("__get__", 0);
22279 __Pyx_TraceCall("__get__", __pyx_f[0], 2316);
22281 /* "csamtools.pyx":2317
22283 * def __get__(self):
22284 * c = self.cigar # <<<<<<<<<<<<<<
22285 * if c == None: return ""
22286 * else: return "".join([ "%c%i" % (CODE2CIGAR[x],y) for x,y in c])
22288 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__cigar); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22289 __Pyx_GOTREF(__pyx_t_1);
22290 __pyx_v_c = __pyx_t_1;
22293 /* "csamtools.pyx":2318
22294 * def __get__(self):
22296 * if c == None: return "" # <<<<<<<<<<<<<<
22297 * else: return "".join([ "%c%i" % (CODE2CIGAR[x],y) for x,y in c])
22300 __pyx_t_1 = PyObject_RichCompare(__pyx_v_c, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22301 __Pyx_GOTREF(__pyx_t_1);
22302 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22303 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22305 __Pyx_XDECREF(__pyx_r);
22306 __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
22307 __pyx_r = ((PyObject *)__pyx_kp_s_16);
22313 /* "csamtools.pyx":2319
22315 * if c == None: return ""
22316 * else: return "".join([ "%c%i" % (CODE2CIGAR[x],y) for x,y in c]) # <<<<<<<<<<<<<<
22318 * def __set__(self, cigar):
22320 __Pyx_XDECREF(__pyx_r);
22321 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_16), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22322 __Pyx_GOTREF(__pyx_t_1);
22323 __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22324 __Pyx_GOTREF(__pyx_t_3);
22325 if (PyList_CheckExact(__pyx_v_c) || PyTuple_CheckExact(__pyx_v_c)) {
22326 __pyx_t_4 = __pyx_v_c; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
22329 __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_c); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22330 __Pyx_GOTREF(__pyx_t_4);
22331 __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
22334 if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
22335 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
22336 __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
22337 } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
22338 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
22339 __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
22341 __pyx_t_7 = __pyx_t_6(__pyx_t_4);
22342 if (unlikely(!__pyx_t_7)) {
22343 if (PyErr_Occurred()) {
22344 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
22345 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22349 __Pyx_GOTREF(__pyx_t_7);
22351 if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
22352 PyObject* sequence = __pyx_t_7;
22353 if (likely(PyTuple_CheckExact(sequence))) {
22354 if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
22355 if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
22356 else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
22357 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22359 __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0);
22360 __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
22362 if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
22363 if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
22364 else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
22365 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22367 __pyx_t_8 = PyList_GET_ITEM(sequence, 0);
22368 __pyx_t_9 = PyList_GET_ITEM(sequence, 1);
22370 __Pyx_INCREF(__pyx_t_8);
22371 __Pyx_INCREF(__pyx_t_9);
22372 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
22374 Py_ssize_t index = -1;
22375 __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22376 __Pyx_GOTREF(__pyx_t_10);
22377 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
22378 __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
22379 index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
22380 __Pyx_GOTREF(__pyx_t_8);
22381 index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
22382 __Pyx_GOTREF(__pyx_t_9);
22383 if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22384 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
22385 goto __pyx_L7_unpacking_done;
22386 __pyx_L6_unpacking_failed:;
22387 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
22388 if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
22389 if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
22390 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22391 __pyx_L7_unpacking_done:;
22393 __Pyx_XDECREF(__pyx_v_x);
22394 __pyx_v_x = __pyx_t_8;
22396 __Pyx_XDECREF(__pyx_v_y);
22397 __pyx_v_y = __pyx_t_9;
22399 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22400 __pyx_t_7 = PyInt_FromLong((__pyx_v_9csamtools_CODE2CIGAR[__pyx_t_12])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22401 __Pyx_GOTREF(__pyx_t_7);
22402 __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22403 __Pyx_GOTREF(__pyx_t_9);
22404 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7);
22405 __Pyx_GIVEREF(__pyx_t_7);
22406 __Pyx_INCREF(__pyx_v_y);
22407 PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_y);
22408 __Pyx_GIVEREF(__pyx_v_y);
22410 __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_135), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22411 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
22412 __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
22413 if (unlikely(PyList_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22414 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
22416 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22417 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22418 __Pyx_GOTREF(__pyx_t_4);
22419 __Pyx_INCREF(((PyObject *)__pyx_t_3));
22420 PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
22421 __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
22422 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
22423 __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22424 __Pyx_GOTREF(__pyx_t_3);
22425 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22426 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
22427 __pyx_r = __pyx_t_3;
22433 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
22436 __Pyx_XDECREF(__pyx_t_1);
22437 __Pyx_XDECREF(__pyx_t_3);
22438 __Pyx_XDECREF(__pyx_t_4);
22439 __Pyx_XDECREF(__pyx_t_7);
22440 __Pyx_XDECREF(__pyx_t_8);
22441 __Pyx_XDECREF(__pyx_t_9);
22442 __Pyx_XDECREF(__pyx_t_10);
22443 __Pyx_AddTraceback("csamtools.AlignedRead.cigarstring.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
22446 __Pyx_XDECREF(__pyx_v_c);
22447 __Pyx_XDECREF(__pyx_v_x);
22448 __Pyx_XDECREF(__pyx_v_y);
22449 __Pyx_XGIVEREF(__pyx_r);
22450 __Pyx_TraceReturn(__pyx_r);
22451 __Pyx_RefNannyFinishContext();
22455 /* Python wrapper */
22456 static int __pyx_pw_9csamtools_11AlignedRead_11cigarstring_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_cigar); /*proto*/
22457 static int __pyx_pw_9csamtools_11AlignedRead_11cigarstring_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_cigar) {
22459 __Pyx_RefNannyDeclarations
22460 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
22461 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_11cigarstring_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_cigar));
22462 __Pyx_RefNannyFinishContext();
22466 /* "csamtools.pyx":2321
22467 * else: return "".join([ "%c%i" % (CODE2CIGAR[x],y) for x,y in c])
22469 * def __set__(self, cigar): # <<<<<<<<<<<<<<
22470 * if cigar == None or len(cigar) == 0: self.cigar = []
22471 * parts = CIGAR_REGEX.findall( cigar )
22474 static int __pyx_pf_9csamtools_11AlignedRead_11cigarstring_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_cigar) {
22475 PyObject *__pyx_v_parts = NULL;
22476 PyObject *__pyx_v_x = NULL;
22477 PyObject *__pyx_v_y = NULL;
22479 __Pyx_RefNannyDeclarations
22480 PyObject *__pyx_t_1 = NULL;
22482 Py_ssize_t __pyx_t_3;
22485 PyObject *__pyx_t_6 = NULL;
22486 PyObject *__pyx_t_7 = NULL;
22487 PyObject *(*__pyx_t_8)(PyObject *);
22488 PyObject *__pyx_t_9 = NULL;
22489 PyObject *__pyx_t_10 = NULL;
22490 PyObject *__pyx_t_11 = NULL;
22491 PyObject *(*__pyx_t_12)(PyObject *);
22492 int __pyx_lineno = 0;
22493 const char *__pyx_filename = NULL;
22494 int __pyx_clineno = 0;
22495 __Pyx_TraceDeclarations
22496 __Pyx_RefNannySetupContext("__set__", 0);
22497 __Pyx_TraceCall("__set__", __pyx_f[0], 2321);
22499 /* "csamtools.pyx":2322
22501 * def __set__(self, cigar):
22502 * if cigar == None or len(cigar) == 0: self.cigar = [] # <<<<<<<<<<<<<<
22503 * parts = CIGAR_REGEX.findall( cigar )
22504 * self.cigar = [ (CIGAR2CODE[ord(x)], int(y)) for x,y in parts ]
22506 __pyx_t_1 = PyObject_RichCompare(__pyx_v_cigar, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22507 __Pyx_GOTREF(__pyx_t_1);
22508 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22509 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22511 __pyx_t_3 = PyObject_Length(__pyx_v_cigar); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22512 __pyx_t_4 = (__pyx_t_3 == 0);
22513 __pyx_t_5 = __pyx_t_4;
22515 __pyx_t_5 = __pyx_t_2;
22518 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22519 __Pyx_GOTREF(__pyx_t_1);
22520 if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__cigar, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22521 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
22526 /* "csamtools.pyx":2323
22527 * def __set__(self, cigar):
22528 * if cigar == None or len(cigar) == 0: self.cigar = []
22529 * parts = CIGAR_REGEX.findall( cigar ) # <<<<<<<<<<<<<<
22530 * self.cigar = [ (CIGAR2CODE[ord(x)], int(y)) for x,y in parts ]
22533 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__CIGAR_REGEX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22534 __Pyx_GOTREF(__pyx_t_1);
22535 __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__findall); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22536 __Pyx_GOTREF(__pyx_t_6);
22537 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22538 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22539 __Pyx_GOTREF(__pyx_t_1);
22540 __Pyx_INCREF(__pyx_v_cigar);
22541 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_cigar);
22542 __Pyx_GIVEREF(__pyx_v_cigar);
22543 __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22544 __Pyx_GOTREF(__pyx_t_7);
22545 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22546 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
22547 __pyx_v_parts = __pyx_t_7;
22550 /* "csamtools.pyx":2324
22551 * if cigar == None or len(cigar) == 0: self.cigar = []
22552 * parts = CIGAR_REGEX.findall( cigar )
22553 * self.cigar = [ (CIGAR2CODE[ord(x)], int(y)) for x,y in parts ] # <<<<<<<<<<<<<<
22557 __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22558 __Pyx_GOTREF(__pyx_t_7);
22559 if (PyList_CheckExact(__pyx_v_parts) || PyTuple_CheckExact(__pyx_v_parts)) {
22560 __pyx_t_1 = __pyx_v_parts; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
22563 __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_parts); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22564 __Pyx_GOTREF(__pyx_t_1);
22565 __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext;
22568 if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_1)) {
22569 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
22570 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
22571 } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_1)) {
22572 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
22573 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
22575 __pyx_t_6 = __pyx_t_8(__pyx_t_1);
22576 if (unlikely(!__pyx_t_6)) {
22577 if (PyErr_Occurred()) {
22578 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
22579 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22583 __Pyx_GOTREF(__pyx_t_6);
22585 if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
22586 PyObject* sequence = __pyx_t_6;
22587 if (likely(PyTuple_CheckExact(sequence))) {
22588 if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
22589 if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
22590 else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
22591 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22593 __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
22594 __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
22596 if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
22597 if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
22598 else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
22599 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22601 __pyx_t_9 = PyList_GET_ITEM(sequence, 0);
22602 __pyx_t_10 = PyList_GET_ITEM(sequence, 1);
22604 __Pyx_INCREF(__pyx_t_9);
22605 __Pyx_INCREF(__pyx_t_10);
22606 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22608 Py_ssize_t index = -1;
22609 __pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22610 __Pyx_GOTREF(__pyx_t_11);
22611 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22612 __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
22613 index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
22614 __Pyx_GOTREF(__pyx_t_9);
22615 index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L6_unpacking_failed;
22616 __Pyx_GOTREF(__pyx_t_10);
22617 if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22618 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
22619 goto __pyx_L7_unpacking_done;
22620 __pyx_L6_unpacking_failed:;
22621 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
22622 if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
22623 if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
22624 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22625 __pyx_L7_unpacking_done:;
22627 __Pyx_XDECREF(__pyx_v_x);
22628 __pyx_v_x = __pyx_t_9;
22630 __Pyx_XDECREF(__pyx_v_y);
22631 __pyx_v_y = __pyx_t_10;
22633 __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__CIGAR2CODE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22634 __Pyx_GOTREF(__pyx_t_6);
22635 __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22636 __Pyx_GOTREF(__pyx_t_10);
22637 __Pyx_INCREF(__pyx_v_x);
22638 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_x);
22639 __Pyx_GIVEREF(__pyx_v_x);
22640 __pyx_t_9 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22641 __Pyx_GOTREF(__pyx_t_9);
22642 __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
22643 __pyx_t_10 = PyObject_GetItem(__pyx_t_6, __pyx_t_9); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22644 __Pyx_GOTREF(__pyx_t_10);
22645 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22646 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
22647 __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22648 __Pyx_GOTREF(__pyx_t_9);
22649 __Pyx_INCREF(__pyx_v_y);
22650 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_y);
22651 __Pyx_GIVEREF(__pyx_v_y);
22652 __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22653 __Pyx_GOTREF(__pyx_t_6);
22654 __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
22655 __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22656 __Pyx_GOTREF(__pyx_t_9);
22657 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10);
22658 __Pyx_GIVEREF(__pyx_t_10);
22659 PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_6);
22660 __Pyx_GIVEREF(__pyx_t_6);
22663 if (unlikely(PyList_Append(__pyx_t_7, (PyObject*)__pyx_t_9))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22664 __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
22666 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22667 if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__cigar, ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22668 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
22673 __Pyx_XDECREF(__pyx_t_1);
22674 __Pyx_XDECREF(__pyx_t_6);
22675 __Pyx_XDECREF(__pyx_t_7);
22676 __Pyx_XDECREF(__pyx_t_9);
22677 __Pyx_XDECREF(__pyx_t_10);
22678 __Pyx_XDECREF(__pyx_t_11);
22679 __Pyx_AddTraceback("csamtools.AlignedRead.cigarstring.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
22682 __Pyx_XDECREF(__pyx_v_parts);
22683 __Pyx_XDECREF(__pyx_v_x);
22684 __Pyx_XDECREF(__pyx_v_y);
22685 __Pyx_TraceReturn(Py_None);
22686 __Pyx_RefNannyFinishContext();
22690 /* Python wrapper */
22691 static PyObject *__pyx_pw_9csamtools_11AlignedRead_3seq_1__get__(PyObject *__pyx_v_self); /*proto*/
22692 static PyObject *__pyx_pw_9csamtools_11AlignedRead_3seq_1__get__(PyObject *__pyx_v_self) {
22693 PyObject *__pyx_r = 0;
22694 __Pyx_RefNannyDeclarations
22695 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22696 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_3seq___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
22697 __Pyx_RefNannyFinishContext();
22701 /* "csamtools.pyx":2330
22703 * In Python 3, this property is of type bytes and assigning a unicode string to it consisting of ASCII characters only will work, but is inefficient."""
22704 * def __get__(self): # <<<<<<<<<<<<<<
22705 * cdef bam1_t * src
22709 static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
22710 bam1_t *__pyx_v_src;
22711 PyObject *__pyx_r = NULL;
22712 __Pyx_RefNannyDeclarations
22714 PyObject *__pyx_t_2 = NULL;
22715 int __pyx_lineno = 0;
22716 const char *__pyx_filename = NULL;
22717 int __pyx_clineno = 0;
22718 __Pyx_TraceDeclarations
22719 __Pyx_RefNannySetupContext("__get__", 0);
22720 __Pyx_TraceCall("__get__", __pyx_f[0], 2330);
22722 /* "csamtools.pyx":2333
22723 * cdef bam1_t * src
22725 * src = self._delegate # <<<<<<<<<<<<<<
22727 * if src.core.l_qseq == 0: return None
22729 __pyx_v_src = __pyx_v_self->_delegate;
22731 /* "csamtools.pyx":2335
22732 * src = self._delegate
22734 * if src.core.l_qseq == 0: return None # <<<<<<<<<<<<<<
22736 * return get_seq_range(src, 0, src.core.l_qseq)
22738 __pyx_t_1 = (__pyx_v_src->core.l_qseq == 0);
22740 __Pyx_XDECREF(__pyx_r);
22741 __Pyx_INCREF(Py_None);
22748 /* "csamtools.pyx":2337
22749 * if src.core.l_qseq == 0: return None
22751 * return get_seq_range(src, 0, src.core.l_qseq) # <<<<<<<<<<<<<<
22753 * def __set__(self,seq):
22755 __Pyx_XDECREF(__pyx_r);
22756 __pyx_t_2 = __pyx_f_9csamtools_get_seq_range(__pyx_v_src, 0, __pyx_v_src->core.l_qseq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22757 __Pyx_GOTREF(__pyx_t_2);
22758 __pyx_r = __pyx_t_2;
22762 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
22765 __Pyx_XDECREF(__pyx_t_2);
22766 __Pyx_AddTraceback("csamtools.AlignedRead.seq.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
22769 __Pyx_XGIVEREF(__pyx_r);
22770 __Pyx_TraceReturn(__pyx_r);
22771 __Pyx_RefNannyFinishContext();
22775 /* Python wrapper */
22776 static int __pyx_pw_9csamtools_11AlignedRead_3seq_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq); /*proto*/
22777 static int __pyx_pw_9csamtools_11AlignedRead_3seq_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq) {
22779 __Pyx_RefNannyDeclarations
22780 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
22781 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_3seq_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_seq));
22782 __Pyx_RefNannyFinishContext();
22786 /* "csamtools.pyx":2339
22787 * return get_seq_range(src, 0, src.core.l_qseq)
22789 * def __set__(self,seq): # <<<<<<<<<<<<<<
22790 * # samtools manages sequence and quality length memory together
22791 * # if no quality information is present, the first byte says 0xff.
22794 static int __pyx_pf_9csamtools_11AlignedRead_3seq_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_seq) {
22795 bam1_t *__pyx_v_src;
22796 uint8_t *__pyx_v_p;
22800 int __pyx_v_nbytes_new;
22801 int __pyx_v_nbytes_old;
22803 __Pyx_RefNannyDeclarations
22804 PyObject *__pyx_t_1 = NULL;
22806 Py_ssize_t __pyx_t_3;
22812 int __pyx_lineno = 0;
22813 const char *__pyx_filename = NULL;
22814 int __pyx_clineno = 0;
22815 __Pyx_TraceDeclarations
22816 __Pyx_RefNannySetupContext("__set__", 0);
22817 __Pyx_TraceCall("__set__", __pyx_f[0], 2339);
22818 __Pyx_INCREF(__pyx_v_seq);
22820 /* "csamtools.pyx":2343
22821 * # if no quality information is present, the first byte says 0xff.
22823 * if seq == None or len(seq) == 0: return # <<<<<<<<<<<<<<
22824 * seq = _force_bytes(seq)
22825 * cdef bam1_t * src
22827 __pyx_t_1 = PyObject_RichCompare(__pyx_v_seq, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22828 __Pyx_GOTREF(__pyx_t_1);
22829 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22830 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22832 __pyx_t_3 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22833 __pyx_t_4 = (__pyx_t_3 == 0);
22834 __pyx_t_5 = __pyx_t_4;
22836 __pyx_t_5 = __pyx_t_2;
22845 /* "csamtools.pyx":2344
22847 * if seq == None or len(seq) == 0: return
22848 * seq = _force_bytes(seq) # <<<<<<<<<<<<<<
22849 * cdef bam1_t * src
22852 __pyx_t_1 = ((PyObject *)__pyx_f_9csamtools__force_bytes(__pyx_v_seq)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22853 __Pyx_GOTREF(__pyx_t_1);
22854 __Pyx_DECREF(__pyx_v_seq);
22855 __pyx_v_seq = __pyx_t_1;
22858 /* "csamtools.pyx":2350
22859 * cdef int l, k, nbytes_new, nbytes_old
22861 * src = self._delegate # <<<<<<<<<<<<<<
22865 __pyx_v_src = __pyx_v_self->_delegate;
22867 /* "csamtools.pyx":2352
22868 * src = self._delegate
22870 * l = len(seq) # <<<<<<<<<<<<<<
22872 * # as the sequence is stored in half-bytes, the total length (sequence
22874 __pyx_t_3 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22875 __pyx_v_l = __pyx_t_3;
22877 /* "csamtools.pyx":2356
22878 * # as the sequence is stored in half-bytes, the total length (sequence
22879 * # plus quality scores) is (l+1)/2 + l
22880 * nbytes_new = (l+1)/2 + l # <<<<<<<<<<<<<<
22881 * nbytes_old = (src.core.l_qseq+1)/2 + src.core.l_qseq
22882 * # acquire pointer to location in memory
22884 __pyx_v_nbytes_new = (__Pyx_div_long((__pyx_v_l + 1), 2) + __pyx_v_l);
22886 /* "csamtools.pyx":2357
22887 * # plus quality scores) is (l+1)/2 + l
22888 * nbytes_new = (l+1)/2 + l
22889 * nbytes_old = (src.core.l_qseq+1)/2 + src.core.l_qseq # <<<<<<<<<<<<<<
22890 * # acquire pointer to location in memory
22891 * p = bam1_seq( src )
22893 __pyx_v_nbytes_old = (__Pyx_div_long((__pyx_v_src->core.l_qseq + 1), 2) + __pyx_v_src->core.l_qseq);
22895 /* "csamtools.pyx":2359
22896 * nbytes_old = (src.core.l_qseq+1)/2 + src.core.l_qseq
22897 * # acquire pointer to location in memory
22898 * p = bam1_seq( src ) # <<<<<<<<<<<<<<
22899 * src.core.l_qseq = l
22902 __pyx_v_p = bam1_seq(__pyx_v_src);
22904 /* "csamtools.pyx":2360
22905 * # acquire pointer to location in memory
22906 * p = bam1_seq( src )
22907 * src.core.l_qseq = l # <<<<<<<<<<<<<<
22909 * pysam_bam_update( src,
22911 __pyx_v_src->core.l_qseq = __pyx_v_l;
22913 /* "csamtools.pyx":2365
22916 * p) # <<<<<<<<<<<<<<
22917 * # re-acquire pointer to location in memory
22918 * # as it might have moved
22920 pysam_bam_update(__pyx_v_src, __pyx_v_nbytes_old, __pyx_v_nbytes_new, __pyx_v_p);
22922 /* "csamtools.pyx":2368
22923 * # re-acquire pointer to location in memory
22924 * # as it might have moved
22925 * p = bam1_seq( src ) # <<<<<<<<<<<<<<
22926 * for k from 0 <= k < nbytes_new: p[k] = 0
22927 * # convert to C string
22929 __pyx_v_p = bam1_seq(__pyx_v_src);
22931 /* "csamtools.pyx":2369
22932 * # as it might have moved
22933 * p = bam1_seq( src )
22934 * for k from 0 <= k < nbytes_new: p[k] = 0 # <<<<<<<<<<<<<<
22935 * # convert to C string
22938 __pyx_t_6 = __pyx_v_nbytes_new;
22939 for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_6; __pyx_v_k++) {
22940 (__pyx_v_p[__pyx_v_k]) = 0;
22943 /* "csamtools.pyx":2371
22944 * for k from 0 <= k < nbytes_new: p[k] = 0
22945 * # convert to C string
22946 * s = seq # <<<<<<<<<<<<<<
22947 * for k from 0 <= k < l:
22948 * p[k/2] |= pysam_translate_sequence(s[k]) << 4 * (1 - k % 2)
22950 __pyx_t_7 = PyBytes_AsString(__pyx_v_seq); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22951 __pyx_v_s = __pyx_t_7;
22953 /* "csamtools.pyx":2372
22954 * # convert to C string
22956 * for k from 0 <= k < l: # <<<<<<<<<<<<<<
22957 * p[k/2] |= pysam_translate_sequence(s[k]) << 4 * (1 - k % 2)
22960 __pyx_t_6 = __pyx_v_l;
22961 for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_6; __pyx_v_k++) {
22963 /* "csamtools.pyx":2373
22965 * for k from 0 <= k < l:
22966 * p[k/2] |= pysam_translate_sequence(s[k]) << 4 * (1 - k % 2) # <<<<<<<<<<<<<<
22968 * # erase qualities
22970 __pyx_t_8 = __Pyx_div_long(__pyx_v_k, 2);
22971 (__pyx_v_p[__pyx_t_8]) = ((__pyx_v_p[__pyx_t_8]) | (pysam_translate_sequence((__pyx_v_s[__pyx_v_k])) << (4 * (1 - __Pyx_mod_long(__pyx_v_k, 2)))));
22974 /* "csamtools.pyx":2376
22976 * # erase qualities
22977 * p = bam1_qual( src ) # <<<<<<<<<<<<<<
22981 __pyx_v_p = bam1_qual(__pyx_v_src);
22983 /* "csamtools.pyx":2377
22984 * # erase qualities
22985 * p = bam1_qual( src )
22986 * p[0] = 0xff # <<<<<<<<<<<<<<
22990 (__pyx_v_p[0]) = 0xff;
22995 __Pyx_XDECREF(__pyx_t_1);
22996 __Pyx_AddTraceback("csamtools.AlignedRead.seq.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
22999 __Pyx_XDECREF(__pyx_v_seq);
23000 __Pyx_TraceReturn(Py_None);
23001 __Pyx_RefNannyFinishContext();
23005 /* Python wrapper */
23006 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4qual_1__get__(PyObject *__pyx_v_self); /*proto*/
23007 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4qual_1__get__(PyObject *__pyx_v_self) {
23008 PyObject *__pyx_r = 0;
23009 __Pyx_RefNannyDeclarations
23010 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
23011 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4qual___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
23012 __Pyx_RefNannyFinishContext();
23016 /* "csamtools.pyx":2384
23018 * In Python 3, this property is of type bytes and assigning a unicode string to it consisting of ASCII characters only will work, but is inefficient."""
23019 * def __get__(self): # <<<<<<<<<<<<<<
23021 * cdef bam1_t * src
23024 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
23025 bam1_t *__pyx_v_src;
23026 PyObject *__pyx_r = NULL;
23027 __Pyx_RefNannyDeclarations
23029 PyObject *__pyx_t_2 = NULL;
23030 int __pyx_lineno = 0;
23031 const char *__pyx_filename = NULL;
23032 int __pyx_clineno = 0;
23033 __Pyx_TraceDeclarations
23034 __Pyx_RefNannySetupContext("__get__", 0);
23035 __Pyx_TraceCall("__get__", __pyx_f[0], 2384);
23037 /* "csamtools.pyx":2389
23040 * src = self._delegate # <<<<<<<<<<<<<<
23042 * if src.core.l_qseq == 0: return None
23044 __pyx_v_src = __pyx_v_self->_delegate;
23046 /* "csamtools.pyx":2391
23047 * src = self._delegate
23049 * if src.core.l_qseq == 0: return None # <<<<<<<<<<<<<<
23051 * return get_qual_range(src, 0, src.core.l_qseq)
23053 __pyx_t_1 = (__pyx_v_src->core.l_qseq == 0);
23055 __Pyx_XDECREF(__pyx_r);
23056 __Pyx_INCREF(Py_None);
23063 /* "csamtools.pyx":2393
23064 * if src.core.l_qseq == 0: return None
23066 * return get_qual_range(src, 0, src.core.l_qseq) # <<<<<<<<<<<<<<
23068 * def __set__(self,qual):
23070 __Pyx_XDECREF(__pyx_r);
23071 __pyx_t_2 = __pyx_f_9csamtools_get_qual_range(__pyx_v_src, 0, __pyx_v_src->core.l_qseq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23072 __Pyx_GOTREF(__pyx_t_2);
23073 __pyx_r = __pyx_t_2;
23077 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
23080 __Pyx_XDECREF(__pyx_t_2);
23081 __Pyx_AddTraceback("csamtools.AlignedRead.qual.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
23084 __Pyx_XGIVEREF(__pyx_r);
23085 __Pyx_TraceReturn(__pyx_r);
23086 __Pyx_RefNannyFinishContext();
23090 /* Python wrapper */
23091 static int __pyx_pw_9csamtools_11AlignedRead_4qual_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual); /*proto*/
23092 static int __pyx_pw_9csamtools_11AlignedRead_4qual_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual) {
23094 __Pyx_RefNannyDeclarations
23095 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
23096 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4qual_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_qual));
23097 __Pyx_RefNannyFinishContext();
23101 /* "csamtools.pyx":2395
23102 * return get_qual_range(src, 0, src.core.l_qseq)
23104 * def __set__(self,qual): # <<<<<<<<<<<<<<
23105 * # note that space is already allocated via the sequences
23106 * cdef bam1_t * src
23109 static int __pyx_pf_9csamtools_11AlignedRead_4qual_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_qual) {
23110 bam1_t *__pyx_v_src;
23111 uint8_t *__pyx_v_p;
23116 __Pyx_RefNannyDeclarations
23117 PyObject *__pyx_t_1 = NULL;
23119 Py_ssize_t __pyx_t_3;
23123 PyObject *__pyx_t_7 = NULL;
23124 PyObject *__pyx_t_8 = NULL;
23126 int __pyx_lineno = 0;
23127 const char *__pyx_filename = NULL;
23128 int __pyx_clineno = 0;
23129 __Pyx_TraceDeclarations
23130 __Pyx_RefNannySetupContext("__set__", 0);
23131 __Pyx_TraceCall("__set__", __pyx_f[0], 2395);
23132 __Pyx_INCREF(__pyx_v_qual);
23134 /* "csamtools.pyx":2402
23137 * src = self._delegate # <<<<<<<<<<<<<<
23138 * p = bam1_qual( src )
23139 * if qual == None or len(qual) == 0:
23141 __pyx_v_src = __pyx_v_self->_delegate;
23143 /* "csamtools.pyx":2403
23145 * src = self._delegate
23146 * p = bam1_qual( src ) # <<<<<<<<<<<<<<
23147 * if qual == None or len(qual) == 0:
23148 * # if absent - set to 0xff
23150 __pyx_v_p = bam1_qual(__pyx_v_src);
23152 /* "csamtools.pyx":2404
23153 * src = self._delegate
23154 * p = bam1_qual( src )
23155 * if qual == None or len(qual) == 0: # <<<<<<<<<<<<<<
23156 * # if absent - set to 0xff
23159 __pyx_t_1 = PyObject_RichCompare(__pyx_v_qual, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23160 __Pyx_GOTREF(__pyx_t_1);
23161 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23162 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23164 __pyx_t_3 = PyObject_Length(__pyx_v_qual); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23165 __pyx_t_4 = (__pyx_t_3 == 0);
23166 __pyx_t_5 = __pyx_t_4;
23168 __pyx_t_5 = __pyx_t_2;
23172 /* "csamtools.pyx":2406
23173 * if qual == None or len(qual) == 0:
23174 * # if absent - set to 0xff
23175 * p[0] = 0xff # <<<<<<<<<<<<<<
23177 * qual = _force_bytes(qual)
23179 (__pyx_v_p[0]) = 0xff;
23181 /* "csamtools.pyx":2407
23182 * # if absent - set to 0xff
23184 * return # <<<<<<<<<<<<<<
23185 * qual = _force_bytes(qual)
23194 /* "csamtools.pyx":2408
23197 * qual = _force_bytes(qual) # <<<<<<<<<<<<<<
23199 * # convert to C string
23201 __pyx_t_1 = ((PyObject *)__pyx_f_9csamtools__force_bytes(__pyx_v_qual)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23202 __Pyx_GOTREF(__pyx_t_1);
23203 __Pyx_DECREF(__pyx_v_qual);
23204 __pyx_v_qual = __pyx_t_1;
23207 /* "csamtools.pyx":2411
23209 * # convert to C string
23210 * q = qual # <<<<<<<<<<<<<<
23212 * if src.core.l_qseq != l:
23214 __pyx_t_6 = PyBytes_AsString(__pyx_v_qual); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23215 __pyx_v_q = __pyx_t_6;
23217 /* "csamtools.pyx":2412
23218 * # convert to C string
23220 * l = len(qual) # <<<<<<<<<<<<<<
23221 * if src.core.l_qseq != l:
23222 * raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq))
23224 __pyx_t_3 = PyObject_Length(__pyx_v_qual); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23225 __pyx_v_l = __pyx_t_3;
23227 /* "csamtools.pyx":2413
23230 * if src.core.l_qseq != l: # <<<<<<<<<<<<<<
23231 * raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq))
23232 * assert src.core.l_qseq == l
23234 __pyx_t_5 = (__pyx_v_src->core.l_qseq != __pyx_v_l);
23237 /* "csamtools.pyx":2414
23239 * if src.core.l_qseq != l:
23240 * raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq)) # <<<<<<<<<<<<<<
23241 * assert src.core.l_qseq == l
23242 * for k from 0 <= k < l:
23244 __pyx_t_1 = PyInt_FromLong(__pyx_v_l); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23245 __Pyx_GOTREF(__pyx_t_1);
23246 __pyx_t_7 = __Pyx_PyInt_to_py_int32_t(__pyx_v_src->core.l_qseq); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23247 __Pyx_GOTREF(__pyx_t_7);
23248 __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23249 __Pyx_GOTREF(__pyx_t_8);
23250 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
23251 __Pyx_GIVEREF(__pyx_t_1);
23252 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
23253 __Pyx_GIVEREF(__pyx_t_7);
23256 __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_136), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23257 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
23258 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
23259 __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23260 __Pyx_GOTREF(__pyx_t_8);
23261 PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7));
23262 __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
23264 __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23265 __Pyx_GOTREF(__pyx_t_7);
23266 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
23267 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
23268 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
23269 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23274 /* "csamtools.pyx":2415
23275 * if src.core.l_qseq != l:
23276 * raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq))
23277 * assert src.core.l_qseq == l # <<<<<<<<<<<<<<
23278 * for k from 0 <= k < l:
23279 * p[k] = <uint8_t>q[k] - 33
23281 #ifndef CYTHON_WITHOUT_ASSERTIONS
23282 if (unlikely(!(__pyx_v_src->core.l_qseq == __pyx_v_l))) {
23283 PyErr_SetNone(PyExc_AssertionError);
23284 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23288 /* "csamtools.pyx":2416
23289 * raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq))
23290 * assert src.core.l_qseq == l
23291 * for k from 0 <= k < l: # <<<<<<<<<<<<<<
23292 * p[k] = <uint8_t>q[k] - 33
23295 __pyx_t_9 = __pyx_v_l;
23296 for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_9; __pyx_v_k++) {
23298 /* "csamtools.pyx":2417
23299 * assert src.core.l_qseq == l
23300 * for k from 0 <= k < l:
23301 * p[k] = <uint8_t>q[k] - 33 # <<<<<<<<<<<<<<
23305 (__pyx_v_p[__pyx_v_k]) = (((uint8_t)(__pyx_v_q[__pyx_v_k])) - 33);
23311 __Pyx_XDECREF(__pyx_t_1);
23312 __Pyx_XDECREF(__pyx_t_7);
23313 __Pyx_XDECREF(__pyx_t_8);
23314 __Pyx_AddTraceback("csamtools.AlignedRead.qual.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
23317 __Pyx_XDECREF(__pyx_v_qual);
23318 __Pyx_TraceReturn(Py_None);
23319 __Pyx_RefNannyFinishContext();
23323 /* Python wrapper */
23324 static PyObject *__pyx_pw_9csamtools_11AlignedRead_5query_1__get__(PyObject *__pyx_v_self); /*proto*/
23325 static PyObject *__pyx_pw_9csamtools_11AlignedRead_5query_1__get__(PyObject *__pyx_v_self) {
23326 PyObject *__pyx_r = 0;
23327 __Pyx_RefNannyDeclarations
23328 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
23329 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5query___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
23330 __Pyx_RefNannyFinishContext();
23334 /* "csamtools.pyx":2431
23335 * were not considered for alignment may have been retained."""
23337 * def __get__(self): # <<<<<<<<<<<<<<
23338 * cdef bam1_t * src
23339 * cdef uint32_t start, end
23342 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
23343 bam1_t *__pyx_v_src;
23344 uint32_t __pyx_v_start;
23345 uint32_t __pyx_v_end;
23346 PyObject *__pyx_r = NULL;
23347 __Pyx_RefNannyDeclarations
23350 PyObject *__pyx_t_3 = NULL;
23351 int __pyx_lineno = 0;
23352 const char *__pyx_filename = NULL;
23353 int __pyx_clineno = 0;
23354 __Pyx_TraceDeclarations
23355 __Pyx_RefNannySetupContext("__get__", 0);
23356 __Pyx_TraceCall("__get__", __pyx_f[0], 2431);
23358 /* "csamtools.pyx":2436
23361 * src = self._delegate # <<<<<<<<<<<<<<
23363 * if src.core.l_qseq == 0: return None
23365 __pyx_v_src = __pyx_v_self->_delegate;
23367 /* "csamtools.pyx":2438
23368 * src = self._delegate
23370 * if src.core.l_qseq == 0: return None # <<<<<<<<<<<<<<
23372 * start = query_start(src)
23374 __pyx_t_1 = (__pyx_v_src->core.l_qseq == 0);
23376 __Pyx_XDECREF(__pyx_r);
23377 __Pyx_INCREF(Py_None);
23384 /* "csamtools.pyx":2440
23385 * if src.core.l_qseq == 0: return None
23387 * start = query_start(src) # <<<<<<<<<<<<<<
23388 * end = query_end(src)
23391 __pyx_t_2 = __pyx_f_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23392 __pyx_v_start = __pyx_t_2;
23394 /* "csamtools.pyx":2441
23396 * start = query_start(src)
23397 * end = query_end(src) # <<<<<<<<<<<<<<
23399 * return get_seq_range(src, start, end)
23401 __pyx_t_2 = __pyx_f_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23402 __pyx_v_end = __pyx_t_2;
23404 /* "csamtools.pyx":2443
23405 * end = query_end(src)
23407 * return get_seq_range(src, start, end) # <<<<<<<<<<<<<<
23411 __Pyx_XDECREF(__pyx_r);
23412 __pyx_t_3 = __pyx_f_9csamtools_get_seq_range(__pyx_v_src, __pyx_v_start, __pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23413 __Pyx_GOTREF(__pyx_t_3);
23414 __pyx_r = __pyx_t_3;
23418 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
23421 __Pyx_XDECREF(__pyx_t_3);
23422 __Pyx_AddTraceback("csamtools.AlignedRead.query.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
23425 __Pyx_XGIVEREF(__pyx_r);
23426 __Pyx_TraceReturn(__pyx_r);
23427 __Pyx_RefNannyFinishContext();
23431 /* Python wrapper */
23432 static PyObject *__pyx_pw_9csamtools_11AlignedRead_5qqual_1__get__(PyObject *__pyx_v_self); /*proto*/
23433 static PyObject *__pyx_pw_9csamtools_11AlignedRead_5qqual_1__get__(PyObject *__pyx_v_self) {
23434 PyObject *__pyx_r = 0;
23435 __Pyx_RefNannyDeclarations
23436 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
23437 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5qqual___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
23438 __Pyx_RefNannyFinishContext();
23442 /* "csamtools.pyx":2449
23444 * In Python 3, this property is of type bytes."""
23445 * def __get__(self): # <<<<<<<<<<<<<<
23446 * cdef bam1_t * src
23447 * cdef uint32_t start, end
23450 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
23451 bam1_t *__pyx_v_src;
23452 uint32_t __pyx_v_start;
23453 uint32_t __pyx_v_end;
23454 PyObject *__pyx_r = NULL;
23455 __Pyx_RefNannyDeclarations
23458 PyObject *__pyx_t_3 = NULL;
23459 int __pyx_lineno = 0;
23460 const char *__pyx_filename = NULL;
23461 int __pyx_clineno = 0;
23462 __Pyx_TraceDeclarations
23463 __Pyx_RefNannySetupContext("__get__", 0);
23464 __Pyx_TraceCall("__get__", __pyx_f[0], 2449);
23466 /* "csamtools.pyx":2453
23467 * cdef uint32_t start, end
23469 * src = self._delegate # <<<<<<<<<<<<<<
23471 * if src.core.l_qseq == 0: return None
23473 __pyx_v_src = __pyx_v_self->_delegate;
23475 /* "csamtools.pyx":2455
23476 * src = self._delegate
23478 * if src.core.l_qseq == 0: return None # <<<<<<<<<<<<<<
23480 * start = query_start(src)
23482 __pyx_t_1 = (__pyx_v_src->core.l_qseq == 0);
23484 __Pyx_XDECREF(__pyx_r);
23485 __Pyx_INCREF(Py_None);
23492 /* "csamtools.pyx":2457
23493 * if src.core.l_qseq == 0: return None
23495 * start = query_start(src) # <<<<<<<<<<<<<<
23496 * end = query_end(src)
23499 __pyx_t_2 = __pyx_f_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23500 __pyx_v_start = __pyx_t_2;
23502 /* "csamtools.pyx":2458
23504 * start = query_start(src)
23505 * end = query_end(src) # <<<<<<<<<<<<<<
23507 * return get_qual_range(src, start, end)
23509 __pyx_t_2 = __pyx_f_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23510 __pyx_v_end = __pyx_t_2;
23512 /* "csamtools.pyx":2460
23513 * end = query_end(src)
23515 * return get_qual_range(src, start, end) # <<<<<<<<<<<<<<
23519 __Pyx_XDECREF(__pyx_r);
23520 __pyx_t_3 = __pyx_f_9csamtools_get_qual_range(__pyx_v_src, __pyx_v_start, __pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23521 __Pyx_GOTREF(__pyx_t_3);
23522 __pyx_r = __pyx_t_3;
23526 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
23529 __Pyx_XDECREF(__pyx_t_3);
23530 __Pyx_AddTraceback("csamtools.AlignedRead.qqual.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
23533 __Pyx_XGIVEREF(__pyx_r);
23534 __Pyx_TraceReturn(__pyx_r);
23535 __Pyx_RefNannyFinishContext();
23539 /* Python wrapper */
23540 static PyObject *__pyx_pw_9csamtools_11AlignedRead_6qstart_1__get__(PyObject *__pyx_v_self); /*proto*/
23541 static PyObject *__pyx_pw_9csamtools_11AlignedRead_6qstart_1__get__(PyObject *__pyx_v_self) {
23542 PyObject *__pyx_r = 0;
23543 __Pyx_RefNannyDeclarations
23544 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
23545 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_6qstart___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
23546 __Pyx_RefNannyFinishContext();
23550 /* "csamtools.pyx":2464
23552 * """start index of the aligned query portion of the sequence (0-based, inclusive)"""
23553 * def __get__(self): # <<<<<<<<<<<<<<
23554 * return query_start(self._delegate)
23558 static PyObject *__pyx_pf_9csamtools_11AlignedRead_6qstart___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
23559 PyObject *__pyx_r = NULL;
23560 __Pyx_RefNannyDeclarations
23562 PyObject *__pyx_t_2 = NULL;
23563 int __pyx_lineno = 0;
23564 const char *__pyx_filename = NULL;
23565 int __pyx_clineno = 0;
23566 __Pyx_TraceDeclarations
23567 __Pyx_RefNannySetupContext("__get__", 0);
23568 __Pyx_TraceCall("__get__", __pyx_f[0], 2464);
23570 /* "csamtools.pyx":2465
23571 * """start index of the aligned query portion of the sequence (0-based, inclusive)"""
23572 * def __get__(self):
23573 * return query_start(self._delegate) # <<<<<<<<<<<<<<
23577 __Pyx_XDECREF(__pyx_r);
23578 __pyx_t_1 = __pyx_f_9csamtools_query_start(__pyx_v_self->_delegate); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23579 __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23580 __Pyx_GOTREF(__pyx_t_2);
23581 __pyx_r = __pyx_t_2;
23585 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
23588 __Pyx_XDECREF(__pyx_t_2);
23589 __Pyx_AddTraceback("csamtools.AlignedRead.qstart.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
23592 __Pyx_XGIVEREF(__pyx_r);
23593 __Pyx_TraceReturn(__pyx_r);
23594 __Pyx_RefNannyFinishContext();
23598 /* Python wrapper */
23599 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4qend_1__get__(PyObject *__pyx_v_self); /*proto*/
23600 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4qend_1__get__(PyObject *__pyx_v_self) {
23601 PyObject *__pyx_r = 0;
23602 __Pyx_RefNannyDeclarations
23603 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
23604 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4qend___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
23605 __Pyx_RefNannyFinishContext();
23609 /* "csamtools.pyx":2469
23611 * """end index of the aligned query portion of the sequence (0-based, exclusive)"""
23612 * def __get__(self): # <<<<<<<<<<<<<<
23613 * return query_end(self._delegate)
23617 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qend___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
23618 PyObject *__pyx_r = NULL;
23619 __Pyx_RefNannyDeclarations
23621 PyObject *__pyx_t_2 = NULL;
23622 int __pyx_lineno = 0;
23623 const char *__pyx_filename = NULL;
23624 int __pyx_clineno = 0;
23625 __Pyx_TraceDeclarations
23626 __Pyx_RefNannySetupContext("__get__", 0);
23627 __Pyx_TraceCall("__get__", __pyx_f[0], 2469);
23629 /* "csamtools.pyx":2470
23630 * """end index of the aligned query portion of the sequence (0-based, exclusive)"""
23631 * def __get__(self):
23632 * return query_end(self._delegate) # <<<<<<<<<<<<<<
23636 __Pyx_XDECREF(__pyx_r);
23637 __pyx_t_1 = __pyx_f_9csamtools_query_end(__pyx_v_self->_delegate); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23638 __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23639 __Pyx_GOTREF(__pyx_t_2);
23640 __pyx_r = __pyx_t_2;
23644 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
23647 __Pyx_XDECREF(__pyx_t_2);
23648 __Pyx_AddTraceback("csamtools.AlignedRead.qend.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
23651 __Pyx_XGIVEREF(__pyx_r);
23652 __Pyx_TraceReturn(__pyx_r);
23653 __Pyx_RefNannyFinishContext();
23657 /* Python wrapper */
23658 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4qlen_1__get__(PyObject *__pyx_v_self); /*proto*/
23659 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4qlen_1__get__(PyObject *__pyx_v_self) {
23660 PyObject *__pyx_r = 0;
23661 __Pyx_RefNannyDeclarations
23662 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
23663 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4qlen___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
23664 __Pyx_RefNannyFinishContext();
23668 /* "csamtools.pyx":2474
23670 * """Length of the aligned query sequence"""
23671 * def __get__(self): # <<<<<<<<<<<<<<
23672 * cdef bam1_t * src
23673 * src = self._delegate
23676 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qlen___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
23677 bam1_t *__pyx_v_src;
23678 PyObject *__pyx_r = NULL;
23679 __Pyx_RefNannyDeclarations
23682 PyObject *__pyx_t_3 = NULL;
23683 int __pyx_lineno = 0;
23684 const char *__pyx_filename = NULL;
23685 int __pyx_clineno = 0;
23686 __Pyx_TraceDeclarations
23687 __Pyx_RefNannySetupContext("__get__", 0);
23688 __Pyx_TraceCall("__get__", __pyx_f[0], 2474);
23690 /* "csamtools.pyx":2476
23691 * def __get__(self):
23692 * cdef bam1_t * src
23693 * src = self._delegate # <<<<<<<<<<<<<<
23694 * return query_end(src)-query_start(src)
23697 __pyx_v_src = __pyx_v_self->_delegate;
23699 /* "csamtools.pyx":2477
23700 * cdef bam1_t * src
23701 * src = self._delegate
23702 * return query_end(src)-query_start(src) # <<<<<<<<<<<<<<
23706 __Pyx_XDECREF(__pyx_r);
23707 __pyx_t_1 = __pyx_f_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23708 __pyx_t_2 = __pyx_f_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23709 __pyx_t_3 = PyInt_FromLong((__pyx_t_1 - __pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23710 __Pyx_GOTREF(__pyx_t_3);
23711 __pyx_r = __pyx_t_3;
23715 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
23718 __Pyx_XDECREF(__pyx_t_3);
23719 __Pyx_AddTraceback("csamtools.AlignedRead.qlen.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
23722 __Pyx_XGIVEREF(__pyx_r);
23723 __Pyx_TraceReturn(__pyx_r);
23724 __Pyx_RefNannyFinishContext();
23728 /* Python wrapper */
23729 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4tags_1__get__(PyObject *__pyx_v_self); /*proto*/
23730 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4tags_1__get__(PyObject *__pyx_v_self) {
23731 PyObject *__pyx_r = 0;
23732 __Pyx_RefNannyDeclarations
23733 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
23734 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4tags___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
23735 __Pyx_RefNannyFinishContext();
23739 /* "csamtools.pyx":2494
23742 * def __get__(self): # <<<<<<<<<<<<<<
23744 * cdef bam1_t * src
23747 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
23748 bam1_t *__pyx_v_src;
23749 uint8_t *__pyx_v_s;
23750 char __pyx_v_auxtag[3];
23751 char __pyx_v_auxtype;
23752 uint8_t __pyx_v_byte_size;
23753 int32_t __pyx_v_nvalues;
23754 PyObject *__pyx_v_result = NULL;
23755 PyObject *__pyx_v_value = NULL;
23756 PyObject *__pyx_r = NULL;
23757 __Pyx_RefNannyDeclarations
23759 PyObject *__pyx_t_2 = NULL;
23763 PyObject *__pyx_t_6 = NULL;
23764 Py_ssize_t __pyx_t_7;
23765 PyObject *__pyx_t_8 = NULL;
23766 PyObject *__pyx_t_9 = NULL;
23767 PyObject *__pyx_t_10 = NULL;
23768 PyObject *(*__pyx_t_11)(PyObject *);
23769 uint8_t __pyx_t_12;
23770 int32_t __pyx_t_13;
23772 int __pyx_lineno = 0;
23773 const char *__pyx_filename = NULL;
23774 int __pyx_clineno = 0;
23775 __Pyx_TraceDeclarations
23776 __Pyx_RefNannySetupContext("__get__", 0);
23777 __Pyx_TraceCall("__get__", __pyx_f[0], 2494);
23779 /* "csamtools.pyx":2503
23780 * cdef int32_t nvalues
23782 * src = self._delegate # <<<<<<<<<<<<<<
23783 * if src.l_aux == 0: return []
23784 * s = bam1_aux( src )
23786 __pyx_v_src = __pyx_v_self->_delegate;
23788 /* "csamtools.pyx":2504
23790 * src = self._delegate
23791 * if src.l_aux == 0: return [] # <<<<<<<<<<<<<<
23792 * s = bam1_aux( src )
23795 __pyx_t_1 = (__pyx_v_src->l_aux == 0);
23797 __Pyx_XDECREF(__pyx_r);
23798 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23799 __Pyx_GOTREF(__pyx_t_2);
23800 __pyx_r = ((PyObject *)__pyx_t_2);
23807 /* "csamtools.pyx":2505
23808 * src = self._delegate
23809 * if src.l_aux == 0: return []
23810 * s = bam1_aux( src ) # <<<<<<<<<<<<<<
23814 __pyx_v_s = bam1_aux(__pyx_v_src);
23816 /* "csamtools.pyx":2506
23817 * if src.l_aux == 0: return []
23818 * s = bam1_aux( src )
23819 * result = [] # <<<<<<<<<<<<<<
23821 * while s < (src.data + src.data_len):
23823 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23824 __Pyx_GOTREF(__pyx_t_2);
23825 __pyx_v_result = __pyx_t_2;
23828 /* "csamtools.pyx":2507
23829 * s = bam1_aux( src )
23831 * auxtag[2] = 0 # <<<<<<<<<<<<<<
23832 * while s < (src.data + src.data_len):
23835 (__pyx_v_auxtag[2]) = 0;
23837 /* "csamtools.pyx":2508
23840 * while s < (src.data + src.data_len): # <<<<<<<<<<<<<<
23845 __pyx_t_1 = (__pyx_v_s < (__pyx_v_src->data + __pyx_v_src->data_len));
23846 if (!__pyx_t_1) break;
23848 /* "csamtools.pyx":2510
23849 * while s < (src.data + src.data_len):
23851 * auxtag[0] = s[0] # <<<<<<<<<<<<<<
23855 (__pyx_v_auxtag[0]) = (__pyx_v_s[0]);
23857 /* "csamtools.pyx":2511
23860 * auxtag[1] = s[1] # <<<<<<<<<<<<<<
23864 (__pyx_v_auxtag[1]) = (__pyx_v_s[1]);
23866 /* "csamtools.pyx":2512
23869 * s += 2 # <<<<<<<<<<<<<<
23871 * if auxtype in ('c', 'C'):
23873 __pyx_v_s = (__pyx_v_s + 2);
23875 /* "csamtools.pyx":2513
23878 * auxtype = s[0] # <<<<<<<<<<<<<<
23879 * if auxtype in ('c', 'C'):
23880 * value = <int>bam_aux2i(s)
23882 __pyx_v_auxtype = (__pyx_v_s[0]);
23884 /* "csamtools.pyx":2514
23887 * if auxtype in ('c', 'C'): # <<<<<<<<<<<<<<
23888 * value = <int>bam_aux2i(s)
23891 __pyx_t_3 = __pyx_v_auxtype;
23892 __pyx_t_1 = ((int)(__pyx_t_3 == 'c'));
23894 __pyx_t_4 = ((int)(__pyx_t_3 == 'C'));
23895 __pyx_t_5 = __pyx_t_4;
23897 __pyx_t_5 = __pyx_t_1;
23899 __pyx_t_1 = __pyx_t_5;
23902 /* "csamtools.pyx":2515
23904 * if auxtype in ('c', 'C'):
23905 * value = <int>bam_aux2i(s) # <<<<<<<<<<<<<<
23907 * elif auxtype in ('s', 'S'):
23909 __pyx_t_2 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23910 __Pyx_GOTREF(__pyx_t_2);
23911 __Pyx_XDECREF(__pyx_v_value);
23912 __pyx_v_value = __pyx_t_2;
23915 /* "csamtools.pyx":2516
23916 * if auxtype in ('c', 'C'):
23917 * value = <int>bam_aux2i(s)
23918 * s += 1 # <<<<<<<<<<<<<<
23919 * elif auxtype in ('s', 'S'):
23920 * value = <int>bam_aux2i(s)
23922 __pyx_v_s = (__pyx_v_s + 1);
23926 /* "csamtools.pyx":2517
23927 * value = <int>bam_aux2i(s)
23929 * elif auxtype in ('s', 'S'): # <<<<<<<<<<<<<<
23930 * value = <int>bam_aux2i(s)
23933 __pyx_t_3 = __pyx_v_auxtype;
23934 __pyx_t_1 = ((int)(__pyx_t_3 == 's'));
23936 __pyx_t_5 = ((int)(__pyx_t_3 == 'S'));
23937 __pyx_t_4 = __pyx_t_5;
23939 __pyx_t_4 = __pyx_t_1;
23941 __pyx_t_1 = __pyx_t_4;
23944 /* "csamtools.pyx":2518
23946 * elif auxtype in ('s', 'S'):
23947 * value = <int>bam_aux2i(s) # <<<<<<<<<<<<<<
23949 * elif auxtype in ('i', 'I'):
23951 __pyx_t_2 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23952 __Pyx_GOTREF(__pyx_t_2);
23953 __Pyx_XDECREF(__pyx_v_value);
23954 __pyx_v_value = __pyx_t_2;
23957 /* "csamtools.pyx":2519
23958 * elif auxtype in ('s', 'S'):
23959 * value = <int>bam_aux2i(s)
23960 * s += 2 # <<<<<<<<<<<<<<
23961 * elif auxtype in ('i', 'I'):
23962 * value = <int32_t>bam_aux2i(s)
23964 __pyx_v_s = (__pyx_v_s + 2);
23968 /* "csamtools.pyx":2520
23969 * value = <int>bam_aux2i(s)
23971 * elif auxtype in ('i', 'I'): # <<<<<<<<<<<<<<
23972 * value = <int32_t>bam_aux2i(s)
23975 __pyx_t_3 = __pyx_v_auxtype;
23976 __pyx_t_1 = ((int)(__pyx_t_3 == 'i'));
23978 __pyx_t_4 = ((int)(__pyx_t_3 == 'I'));
23979 __pyx_t_5 = __pyx_t_4;
23981 __pyx_t_5 = __pyx_t_1;
23983 __pyx_t_1 = __pyx_t_5;
23986 /* "csamtools.pyx":2521
23988 * elif auxtype in ('i', 'I'):
23989 * value = <int32_t>bam_aux2i(s) # <<<<<<<<<<<<<<
23991 * elif auxtype == 'f':
23993 __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(((int32_t)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23994 __Pyx_GOTREF(__pyx_t_2);
23995 __Pyx_XDECREF(__pyx_v_value);
23996 __pyx_v_value = __pyx_t_2;
23999 /* "csamtools.pyx":2522
24000 * elif auxtype in ('i', 'I'):
24001 * value = <int32_t>bam_aux2i(s)
24002 * s += 4 # <<<<<<<<<<<<<<
24003 * elif auxtype == 'f':
24004 * value = <float>bam_aux2f(s)
24006 __pyx_v_s = (__pyx_v_s + 4);
24010 /* "csamtools.pyx":2523
24011 * value = <int32_t>bam_aux2i(s)
24013 * elif auxtype == 'f': # <<<<<<<<<<<<<<
24014 * value = <float>bam_aux2f(s)
24017 __pyx_t_1 = (__pyx_v_auxtype == 'f');
24020 /* "csamtools.pyx":2524
24022 * elif auxtype == 'f':
24023 * value = <float>bam_aux2f(s) # <<<<<<<<<<<<<<
24025 * elif auxtype == 'd':
24027 __pyx_t_2 = PyFloat_FromDouble(((float)bam_aux2f(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24028 __Pyx_GOTREF(__pyx_t_2);
24029 __Pyx_XDECREF(__pyx_v_value);
24030 __pyx_v_value = __pyx_t_2;
24033 /* "csamtools.pyx":2525
24034 * elif auxtype == 'f':
24035 * value = <float>bam_aux2f(s)
24036 * s += 4 # <<<<<<<<<<<<<<
24037 * elif auxtype == 'd':
24038 * value = <double>bam_aux2d(s)
24040 __pyx_v_s = (__pyx_v_s + 4);
24044 /* "csamtools.pyx":2526
24045 * value = <float>bam_aux2f(s)
24047 * elif auxtype == 'd': # <<<<<<<<<<<<<<
24048 * value = <double>bam_aux2d(s)
24051 __pyx_t_1 = (__pyx_v_auxtype == 'd');
24054 /* "csamtools.pyx":2527
24056 * elif auxtype == 'd':
24057 * value = <double>bam_aux2d(s) # <<<<<<<<<<<<<<
24059 * elif auxtype == 'A':
24061 __pyx_t_2 = PyFloat_FromDouble(((double)bam_aux2d(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24062 __Pyx_GOTREF(__pyx_t_2);
24063 __Pyx_XDECREF(__pyx_v_value);
24064 __pyx_v_value = __pyx_t_2;
24067 /* "csamtools.pyx":2528
24068 * elif auxtype == 'd':
24069 * value = <double>bam_aux2d(s)
24070 * s += 8 # <<<<<<<<<<<<<<
24071 * elif auxtype == 'A':
24072 * value = "%c" % <char>bam_aux2A(s)
24074 __pyx_v_s = (__pyx_v_s + 8);
24078 /* "csamtools.pyx":2529
24079 * value = <double>bam_aux2d(s)
24081 * elif auxtype == 'A': # <<<<<<<<<<<<<<
24082 * value = "%c" % <char>bam_aux2A(s)
24085 __pyx_t_1 = (__pyx_v_auxtype == 'A');
24088 /* "csamtools.pyx":2530
24090 * elif auxtype == 'A':
24091 * value = "%c" % <char>bam_aux2A(s) # <<<<<<<<<<<<<<
24093 * elif auxtype in ('Z', 'H'):
24095 __pyx_t_2 = PyInt_FromLong(((char)bam_aux2A(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24096 __Pyx_GOTREF(__pyx_t_2);
24097 __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_137), __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24098 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
24099 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
24100 __Pyx_XDECREF(__pyx_v_value);
24101 __pyx_v_value = ((PyObject *)__pyx_t_6);
24104 /* "csamtools.pyx":2531
24105 * elif auxtype == 'A':
24106 * value = "%c" % <char>bam_aux2A(s)
24107 * s += 1 # <<<<<<<<<<<<<<
24108 * elif auxtype in ('Z', 'H'):
24109 * value = _charptr_to_str(<char*>bam_aux2Z(s))
24111 __pyx_v_s = (__pyx_v_s + 1);
24115 /* "csamtools.pyx":2532
24116 * value = "%c" % <char>bam_aux2A(s)
24118 * elif auxtype in ('Z', 'H'): # <<<<<<<<<<<<<<
24119 * value = _charptr_to_str(<char*>bam_aux2Z(s))
24120 * # +1 for NULL terminated string
24122 __pyx_t_3 = __pyx_v_auxtype;
24123 __pyx_t_1 = ((int)(__pyx_t_3 == 'Z'));
24125 __pyx_t_5 = ((int)(__pyx_t_3 == 'H'));
24126 __pyx_t_4 = __pyx_t_5;
24128 __pyx_t_4 = __pyx_t_1;
24130 __pyx_t_1 = __pyx_t_4;
24133 /* "csamtools.pyx":2533
24135 * elif auxtype in ('Z', 'H'):
24136 * value = _charptr_to_str(<char*>bam_aux2Z(s)) # <<<<<<<<<<<<<<
24137 * # +1 for NULL terminated string
24138 * s += len(value) + 1
24140 __pyx_t_6 = __pyx_f_9csamtools__charptr_to_str(((char *)bam_aux2Z(__pyx_v_s))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24141 __Pyx_GOTREF(__pyx_t_6);
24142 __Pyx_XDECREF(__pyx_v_value);
24143 __pyx_v_value = __pyx_t_6;
24146 /* "csamtools.pyx":2535
24147 * value = _charptr_to_str(<char*>bam_aux2Z(s))
24148 * # +1 for NULL terminated string
24149 * s += len(value) + 1 # <<<<<<<<<<<<<<
24150 * elif auxtype == 'B':
24153 __pyx_t_7 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24154 __pyx_v_s = (__pyx_v_s + (__pyx_t_7 + 1));
24158 /* "csamtools.pyx":2536
24159 * # +1 for NULL terminated string
24160 * s += len(value) + 1
24161 * elif auxtype == 'B': # <<<<<<<<<<<<<<
24163 * byte_size, nvalues, value = convertBinaryTagToList( s )
24165 __pyx_t_1 = (__pyx_v_auxtype == 'B');
24168 /* "csamtools.pyx":2537
24169 * s += len(value) + 1
24170 * elif auxtype == 'B':
24171 * s += 1 # <<<<<<<<<<<<<<
24172 * byte_size, nvalues, value = convertBinaryTagToList( s )
24173 * # 5 for 1 char and 1 int
24175 __pyx_v_s = (__pyx_v_s + 1);
24177 /* "csamtools.pyx":2538
24178 * elif auxtype == 'B':
24180 * byte_size, nvalues, value = convertBinaryTagToList( s ) # <<<<<<<<<<<<<<
24181 * # 5 for 1 char and 1 int
24182 * s += 5 + ( nvalues * byte_size) - 1
24184 __pyx_t_6 = __pyx_f_9csamtools_convertBinaryTagToList(__pyx_v_s); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24185 __Pyx_GOTREF(__pyx_t_6);
24186 if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
24187 PyObject* sequence = __pyx_t_6;
24188 if (likely(PyTuple_CheckExact(sequence))) {
24189 if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) {
24190 if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
24191 else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
24192 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24194 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
24195 __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
24196 __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2);
24198 if (unlikely(PyList_GET_SIZE(sequence) != 3)) {
24199 if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
24200 else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
24201 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24203 __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
24204 __pyx_t_8 = PyList_GET_ITEM(sequence, 1);
24205 __pyx_t_9 = PyList_GET_ITEM(sequence, 2);
24207 __Pyx_INCREF(__pyx_t_2);
24208 __Pyx_INCREF(__pyx_t_8);
24209 __Pyx_INCREF(__pyx_t_9);
24210 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
24212 Py_ssize_t index = -1;
24213 __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24214 __Pyx_GOTREF(__pyx_t_10);
24215 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
24216 __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
24217 index = 0; __pyx_t_2 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
24218 __Pyx_GOTREF(__pyx_t_2);
24219 index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L7_unpacking_failed;
24220 __Pyx_GOTREF(__pyx_t_8);
24221 index = 2; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed;
24222 __Pyx_GOTREF(__pyx_t_9);
24223 if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24224 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
24225 goto __pyx_L8_unpacking_done;
24226 __pyx_L7_unpacking_failed:;
24227 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
24228 if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
24229 if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
24230 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24231 __pyx_L8_unpacking_done:;
24233 __pyx_t_12 = __Pyx_PyInt_from_py_uint8_t(__pyx_t_2); if (unlikely((__pyx_t_12 == (uint8_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24234 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
24235 __pyx_t_13 = __Pyx_PyInt_from_py_int32_t(__pyx_t_8); if (unlikely((__pyx_t_13 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24236 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
24237 __pyx_v_byte_size = __pyx_t_12;
24238 __pyx_v_nvalues = __pyx_t_13;
24239 __Pyx_XDECREF(__pyx_v_value);
24240 __pyx_v_value = __pyx_t_9;
24243 /* "csamtools.pyx":2540
24244 * byte_size, nvalues, value = convertBinaryTagToList( s )
24245 * # 5 for 1 char and 1 int
24246 * s += 5 + ( nvalues * byte_size) - 1 # <<<<<<<<<<<<<<
24250 __pyx_v_s = (__pyx_v_s + ((5 + (__pyx_v_nvalues * __pyx_v_byte_size)) - 1));
24255 /* "csamtools.pyx":2542
24256 * s += 5 + ( nvalues * byte_size) - 1
24258 * s += 1 # <<<<<<<<<<<<<<
24260 * result.append( (_charptr_to_str(auxtag), value) )
24262 __pyx_v_s = (__pyx_v_s + 1);
24264 /* "csamtools.pyx":2544
24267 * result.append( (_charptr_to_str(auxtag), value) ) # <<<<<<<<<<<<<<
24271 __pyx_t_6 = __pyx_f_9csamtools__charptr_to_str(__pyx_v_auxtag); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24272 __Pyx_GOTREF(__pyx_t_6);
24273 if (unlikely(!__pyx_v_value)) { __Pyx_RaiseUnboundLocalError("value"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
24274 __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24275 __Pyx_GOTREF(__pyx_t_9);
24276 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6);
24277 __Pyx_GIVEREF(__pyx_t_6);
24278 __Pyx_INCREF(__pyx_v_value);
24279 PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_value);
24280 __Pyx_GIVEREF(__pyx_v_value);
24282 __pyx_t_14 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_9)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24283 __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
24286 /* "csamtools.pyx":2546
24287 * result.append( (_charptr_to_str(auxtag), value) )
24289 * return result # <<<<<<<<<<<<<<
24291 * def __set__(self, tags):
24293 __Pyx_XDECREF(__pyx_r);
24294 __Pyx_INCREF(((PyObject *)__pyx_v_result));
24295 __pyx_r = ((PyObject *)__pyx_v_result);
24298 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
24301 __Pyx_XDECREF(__pyx_t_2);
24302 __Pyx_XDECREF(__pyx_t_6);
24303 __Pyx_XDECREF(__pyx_t_8);
24304 __Pyx_XDECREF(__pyx_t_9);
24305 __Pyx_XDECREF(__pyx_t_10);
24306 __Pyx_AddTraceback("csamtools.AlignedRead.tags.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
24309 __Pyx_XDECREF(__pyx_v_result);
24310 __Pyx_XDECREF(__pyx_v_value);
24311 __Pyx_XGIVEREF(__pyx_r);
24312 __Pyx_TraceReturn(__pyx_r);
24313 __Pyx_RefNannyFinishContext();
24317 /* Python wrapper */
24318 static int __pyx_pw_9csamtools_11AlignedRead_4tags_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tags); /*proto*/
24319 static int __pyx_pw_9csamtools_11AlignedRead_4tags_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tags) {
24321 __Pyx_RefNannyDeclarations
24322 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
24323 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_tags));
24324 __Pyx_RefNannyFinishContext();
24328 /* "csamtools.pyx":2548
24331 * def __set__(self, tags): # <<<<<<<<<<<<<<
24332 * cdef bam1_t * src
24336 static int __pyx_pf_9csamtools_11AlignedRead_4tags_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tags) {
24337 bam1_t *__pyx_v_src;
24338 uint8_t *__pyx_v_s;
24339 char *__pyx_v_temp;
24340 PyObject *__pyx_v_fmts = NULL;
24341 PyObject *__pyx_v_args = NULL;
24342 PyObject *__pyx_v_pytag = NULL;
24343 PyObject *__pyx_v_value = NULL;
24344 PyObject *__pyx_v_t = NULL;
24345 PyObject *__pyx_v_pytype = NULL;
24346 PyObject *__pyx_v_datafmt = NULL;
24347 PyObject *__pyx_v_datatype = NULL;
24348 PyObject *__pyx_v_mi = NULL;
24349 PyObject *__pyx_v_ma = NULL;
24350 PyObject *__pyx_v_absmax = NULL;
24351 PyObject *__pyx_v_fmt = NULL;
24352 PyObject *__pyx_v_total_size = NULL;
24353 PyObject *__pyx_v_buffer = NULL;
24355 __Pyx_RefNannyDeclarations
24356 PyObject *__pyx_t_1 = NULL;
24357 PyObject *__pyx_t_2 = NULL;
24359 Py_ssize_t __pyx_t_4;
24360 PyObject *(*__pyx_t_5)(PyObject *);
24361 PyObject *__pyx_t_6 = NULL;
24362 PyObject *__pyx_t_7 = NULL;
24363 PyObject *__pyx_t_8 = NULL;
24364 PyObject *(*__pyx_t_9)(PyObject *);
24367 Py_ssize_t __pyx_t_12;
24368 PyObject *__pyx_t_13 = NULL;
24369 PyObject *__pyx_t_14 = NULL;
24374 int __pyx_lineno = 0;
24375 const char *__pyx_filename = NULL;
24376 int __pyx_clineno = 0;
24377 __Pyx_TraceDeclarations
24378 __Pyx_RefNannySetupContext("__set__", 0);
24379 __Pyx_TraceCall("__set__", __pyx_f[0], 2548);
24381 /* "csamtools.pyx":2554
24384 * src = self._delegate # <<<<<<<<<<<<<<
24386 * fmts, args = ["<"], []
24388 __pyx_v_src = __pyx_v_self->_delegate;
24390 /* "csamtools.pyx":2556
24391 * src = self._delegate
24393 * fmts, args = ["<"], [] # <<<<<<<<<<<<<<
24397 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24398 __Pyx_GOTREF(__pyx_t_1);
24399 __Pyx_INCREF(((PyObject *)__pyx_kp_s_138));
24400 PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_138));
24401 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_138));
24402 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24403 __Pyx_GOTREF(__pyx_t_2);
24404 __pyx_v_fmts = __pyx_t_1;
24406 __pyx_v_args = __pyx_t_2;
24409 /* "csamtools.pyx":2558
24410 * fmts, args = ["<"], []
24412 * if tags != None: # <<<<<<<<<<<<<<
24414 * # map samtools code to python.struct code and byte size
24416 __pyx_t_2 = PyObject_RichCompare(__pyx_v_tags, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24417 __Pyx_GOTREF(__pyx_t_2);
24418 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24419 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
24422 /* "csamtools.pyx":2561
24424 * # map samtools code to python.struct code and byte size
24425 * for pytag, value in tags: # <<<<<<<<<<<<<<
24426 * if not type(pytag) is bytes:
24427 * pytag = pytag.encode('ascii')
24429 if (PyList_CheckExact(__pyx_v_tags) || PyTuple_CheckExact(__pyx_v_tags)) {
24430 __pyx_t_2 = __pyx_v_tags; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
24433 __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_tags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24434 __Pyx_GOTREF(__pyx_t_2);
24435 __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext;
24438 if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_2)) {
24439 if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
24440 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
24441 } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_2)) {
24442 if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
24443 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
24445 __pyx_t_1 = __pyx_t_5(__pyx_t_2);
24446 if (unlikely(!__pyx_t_1)) {
24447 if (PyErr_Occurred()) {
24448 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
24449 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24453 __Pyx_GOTREF(__pyx_t_1);
24455 if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
24456 PyObject* sequence = __pyx_t_1;
24457 if (likely(PyTuple_CheckExact(sequence))) {
24458 if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
24459 if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
24460 else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
24461 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24463 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
24464 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
24466 if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
24467 if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
24468 else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
24469 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24471 __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
24472 __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
24474 __Pyx_INCREF(__pyx_t_6);
24475 __Pyx_INCREF(__pyx_t_7);
24476 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24478 Py_ssize_t index = -1;
24479 __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24480 __Pyx_GOTREF(__pyx_t_8);
24481 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24482 __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
24483 index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
24484 __Pyx_GOTREF(__pyx_t_6);
24485 index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
24486 __Pyx_GOTREF(__pyx_t_7);
24487 if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24488 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
24489 goto __pyx_L7_unpacking_done;
24490 __pyx_L6_unpacking_failed:;
24491 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
24492 if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
24493 if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
24494 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24495 __pyx_L7_unpacking_done:;
24497 __Pyx_XDECREF(__pyx_v_pytag);
24498 __pyx_v_pytag = __pyx_t_6;
24500 __Pyx_XDECREF(__pyx_v_value);
24501 __pyx_v_value = __pyx_t_7;
24504 /* "csamtools.pyx":2562
24505 * # map samtools code to python.struct code and byte size
24506 * for pytag, value in tags:
24507 * if not type(pytag) is bytes: # <<<<<<<<<<<<<<
24508 * pytag = pytag.encode('ascii')
24511 __pyx_t_3 = (((PyObject *)Py_TYPE(__pyx_v_pytag)) == ((PyObject *)((PyObject*)(&PyBytes_Type))));
24512 __pyx_t_10 = (!__pyx_t_3);
24515 /* "csamtools.pyx":2563
24516 * for pytag, value in tags:
24517 * if not type(pytag) is bytes:
24518 * pytag = pytag.encode('ascii') # <<<<<<<<<<<<<<
24522 __pyx_t_1 = PyObject_GetAttr(__pyx_v_pytag, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24523 __Pyx_GOTREF(__pyx_t_1);
24524 __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_139), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24525 __Pyx_GOTREF(__pyx_t_7);
24526 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24527 __Pyx_DECREF(__pyx_v_pytag);
24528 __pyx_v_pytag = __pyx_t_7;
24534 /* "csamtools.pyx":2564
24535 * if not type(pytag) is bytes:
24536 * pytag = pytag.encode('ascii')
24537 * t = type(value) # <<<<<<<<<<<<<<
24539 * if t is tuple or t is list:
24541 __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value)));
24542 __Pyx_XDECREF(((PyObject *)__pyx_v_t));
24543 __pyx_v_t = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_value)));
24545 /* "csamtools.pyx":2566
24548 * if t is tuple or t is list: # <<<<<<<<<<<<<<
24549 * # binary tags - treat separately
24552 __pyx_t_10 = (__pyx_v_t == ((PyObject*)(&PyTuple_Type)));
24554 __pyx_t_3 = (__pyx_v_t == ((PyObject*)(&PyList_Type)));
24555 __pyx_t_11 = __pyx_t_3;
24557 __pyx_t_11 = __pyx_t_10;
24561 /* "csamtools.pyx":2568
24562 * if t is tuple or t is list:
24563 * # binary tags - treat separately
24564 * pytype = 'B' # <<<<<<<<<<<<<<
24565 * # get data type - first value determines type
24566 * if type(value[0]) is float:
24568 __Pyx_INCREF(((PyObject *)__pyx_n_s__B));
24569 __Pyx_XDECREF(__pyx_v_pytype);
24570 __pyx_v_pytype = ((PyObject *)__pyx_n_s__B);
24572 /* "csamtools.pyx":2570
24574 * # get data type - first value determines type
24575 * if type(value[0]) is float: # <<<<<<<<<<<<<<
24576 * datafmt, datatype = "f", "f"
24579 __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_value, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24580 __Pyx_GOTREF(__pyx_t_7);
24581 __pyx_t_11 = (((PyObject *)Py_TYPE(__pyx_t_7)) == ((PyObject *)((PyObject*)(&PyFloat_Type))));
24582 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
24585 /* "csamtools.pyx":2571
24586 * # get data type - first value determines type
24587 * if type(value[0]) is float:
24588 * datafmt, datatype = "f", "f" # <<<<<<<<<<<<<<
24590 * mi, ma = min(value), max(value)
24592 __pyx_t_7 = ((PyObject *)__pyx_n_s__f);
24593 __Pyx_INCREF(__pyx_t_7);
24594 __pyx_t_1 = ((PyObject *)__pyx_n_s__f);
24595 __Pyx_INCREF(__pyx_t_1);
24596 __Pyx_XDECREF(__pyx_v_datafmt);
24597 __pyx_v_datafmt = __pyx_t_7;
24599 __Pyx_XDECREF(__pyx_v_datatype);
24600 __pyx_v_datatype = __pyx_t_1;
24606 /* "csamtools.pyx":2573
24607 * datafmt, datatype = "f", "f"
24609 * mi, ma = min(value), max(value) # <<<<<<<<<<<<<<
24610 * absmax = max( abs(mi), abs(ma) )
24613 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24614 __Pyx_GOTREF(__pyx_t_1);
24615 __Pyx_INCREF(__pyx_v_value);
24616 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_value);
24617 __Pyx_GIVEREF(__pyx_v_value);
24618 __pyx_t_7 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24619 __Pyx_GOTREF(__pyx_t_7);
24620 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
24621 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24622 __Pyx_GOTREF(__pyx_t_1);
24623 __Pyx_INCREF(__pyx_v_value);
24624 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_value);
24625 __Pyx_GIVEREF(__pyx_v_value);
24626 __pyx_t_6 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24627 __Pyx_GOTREF(__pyx_t_6);
24628 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
24629 __Pyx_XDECREF(__pyx_v_mi);
24630 __pyx_v_mi = __pyx_t_7;
24632 __Pyx_XDECREF(__pyx_v_ma);
24633 __pyx_v_ma = __pyx_t_6;
24636 /* "csamtools.pyx":2574
24638 * mi, ma = min(value), max(value)
24639 * absmax = max( abs(mi), abs(ma) ) # <<<<<<<<<<<<<<
24643 __pyx_t_6 = PyNumber_Absolute(__pyx_v_ma); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24644 __Pyx_GOTREF(__pyx_t_6);
24645 __pyx_t_7 = PyNumber_Absolute(__pyx_v_mi); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24646 __Pyx_GOTREF(__pyx_t_7);
24647 __pyx_t_8 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_GT); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24648 __Pyx_GOTREF(__pyx_t_8);
24649 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24650 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
24652 __Pyx_INCREF(__pyx_t_6);
24653 __pyx_t_1 = __pyx_t_6;
24655 __Pyx_INCREF(__pyx_t_7);
24656 __pyx_t_1 = __pyx_t_7;
24658 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
24659 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
24660 __Pyx_INCREF(__pyx_t_1);
24661 __Pyx_XDECREF(__pyx_v_absmax);
24662 __pyx_v_absmax = __pyx_t_1;
24663 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24665 /* "csamtools.pyx":2576
24666 * absmax = max( abs(mi), abs(ma) )
24668 * if mi < 0: # <<<<<<<<<<<<<<
24669 * if mi >= -127: datafmt, datatype = "b", 'c'
24670 * elif mi >= -32767: datafmt, datatype = "h", 's'
24672 __pyx_t_1 = PyObject_RichCompare(__pyx_v_mi, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24673 __Pyx_GOTREF(__pyx_t_1);
24674 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24675 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24678 /* "csamtools.pyx":2577
24681 * if mi >= -127: datafmt, datatype = "b", 'c' # <<<<<<<<<<<<<<
24682 * elif mi >= -32767: datafmt, datatype = "h", 's'
24683 * elif absmax < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
24685 __pyx_t_1 = PyObject_RichCompare(__pyx_v_mi, __pyx_int_neg_127, Py_GE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24686 __Pyx_GOTREF(__pyx_t_1);
24687 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24688 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24690 __pyx_t_1 = ((PyObject *)__pyx_n_s__b);
24691 __Pyx_INCREF(__pyx_t_1);
24692 __pyx_t_6 = ((PyObject *)__pyx_n_s__c);
24693 __Pyx_INCREF(__pyx_t_6);
24694 __Pyx_XDECREF(__pyx_v_datafmt);
24695 __pyx_v_datafmt = __pyx_t_1;
24697 __Pyx_XDECREF(__pyx_v_datatype);
24698 __pyx_v_datatype = __pyx_t_6;
24703 /* "csamtools.pyx":2578
24705 * if mi >= -127: datafmt, datatype = "b", 'c'
24706 * elif mi >= -32767: datafmt, datatype = "h", 's' # <<<<<<<<<<<<<<
24707 * elif absmax < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
24708 * else: datafmt, datatype = "i", 'i'
24710 __pyx_t_6 = PyObject_RichCompare(__pyx_v_mi, __pyx_int_neg_32767, Py_GE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24711 __Pyx_GOTREF(__pyx_t_6);
24712 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24713 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
24715 __pyx_t_6 = ((PyObject *)__pyx_n_s__h);
24716 __Pyx_INCREF(__pyx_t_6);
24717 __pyx_t_1 = ((PyObject *)__pyx_n_s__s);
24718 __Pyx_INCREF(__pyx_t_1);
24719 __Pyx_XDECREF(__pyx_v_datafmt);
24720 __pyx_v_datafmt = __pyx_t_6;
24722 __Pyx_XDECREF(__pyx_v_datatype);
24723 __pyx_v_datatype = __pyx_t_1;
24728 /* "csamtools.pyx":2579
24729 * if mi >= -127: datafmt, datatype = "b", 'c'
24730 * elif mi >= -32767: datafmt, datatype = "h", 's'
24731 * elif absmax < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value ) # <<<<<<<<<<<<<<
24732 * else: datafmt, datatype = "i", 'i'
24735 __pyx_t_1 = PyObject_RichCompare(__pyx_v_absmax, __pyx_int_neg_2147483648, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24736 __Pyx_GOTREF(__pyx_t_1);
24737 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24738 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24740 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_140), __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24741 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
24742 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24743 __Pyx_GOTREF(__pyx_t_6);
24744 PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1));
24745 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
24747 __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24748 __Pyx_GOTREF(__pyx_t_1);
24749 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
24750 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
24751 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24752 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24757 /* "csamtools.pyx":2580
24758 * elif mi >= -32767: datafmt, datatype = "h", 's'
24759 * elif absmax < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
24760 * else: datafmt, datatype = "i", 'i' # <<<<<<<<<<<<<<
24764 __pyx_t_1 = ((PyObject *)__pyx_n_s__i);
24765 __Pyx_INCREF(__pyx_t_1);
24766 __pyx_t_6 = ((PyObject *)__pyx_n_s__i);
24767 __Pyx_INCREF(__pyx_t_6);
24768 __Pyx_XDECREF(__pyx_v_datafmt);
24769 __pyx_v_datafmt = __pyx_t_1;
24771 __Pyx_XDECREF(__pyx_v_datatype);
24772 __pyx_v_datatype = __pyx_t_6;
24780 /* "csamtools.pyx":2584
24783 * if absmax <= 255: datafmt, datatype = "B", 'C' # <<<<<<<<<<<<<<
24784 * elif absmax <= 65535: datafmt, datatype = "H", 'S'
24785 * elif absmax > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
24787 __pyx_t_6 = PyObject_RichCompare(__pyx_v_absmax, __pyx_int_255, Py_LE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24788 __Pyx_GOTREF(__pyx_t_6);
24789 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24790 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
24792 __pyx_t_6 = ((PyObject *)__pyx_n_s__B);
24793 __Pyx_INCREF(__pyx_t_6);
24794 __pyx_t_1 = ((PyObject *)__pyx_n_s__C);
24795 __Pyx_INCREF(__pyx_t_1);
24796 __Pyx_XDECREF(__pyx_v_datafmt);
24797 __pyx_v_datafmt = __pyx_t_6;
24799 __Pyx_XDECREF(__pyx_v_datatype);
24800 __pyx_v_datatype = __pyx_t_1;
24805 /* "csamtools.pyx":2585
24807 * if absmax <= 255: datafmt, datatype = "B", 'C'
24808 * elif absmax <= 65535: datafmt, datatype = "H", 'S' # <<<<<<<<<<<<<<
24809 * elif absmax > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
24810 * else: datafmt, datatype = "I", 'I'
24812 __pyx_t_1 = PyObject_RichCompare(__pyx_v_absmax, __pyx_int_65535, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24813 __Pyx_GOTREF(__pyx_t_1);
24814 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24815 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24817 __pyx_t_1 = ((PyObject *)__pyx_n_s__H);
24818 __Pyx_INCREF(__pyx_t_1);
24819 __pyx_t_6 = ((PyObject *)__pyx_n_s__S);
24820 __Pyx_INCREF(__pyx_t_6);
24821 __Pyx_XDECREF(__pyx_v_datafmt);
24822 __pyx_v_datafmt = __pyx_t_1;
24824 __Pyx_XDECREF(__pyx_v_datatype);
24825 __pyx_v_datatype = __pyx_t_6;
24830 /* "csamtools.pyx":2586
24831 * if absmax <= 255: datafmt, datatype = "B", 'C'
24832 * elif absmax <= 65535: datafmt, datatype = "H", 'S'
24833 * elif absmax > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value ) # <<<<<<<<<<<<<<
24834 * else: datafmt, datatype = "I", 'I'
24837 __pyx_t_6 = PyObject_RichCompare(__pyx_v_absmax, __pyx_int_4294967295, Py_GT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24838 __Pyx_GOTREF(__pyx_t_6);
24839 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24840 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
24842 __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_140), __pyx_v_value); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24843 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
24844 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24845 __Pyx_GOTREF(__pyx_t_1);
24846 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6));
24847 __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
24849 __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24850 __Pyx_GOTREF(__pyx_t_6);
24851 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
24852 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
24853 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
24854 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24859 /* "csamtools.pyx":2587
24860 * elif absmax <= 65535: datafmt, datatype = "H", 'S'
24861 * elif absmax > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
24862 * else: datafmt, datatype = "I", 'I' # <<<<<<<<<<<<<<
24864 * datafmt = "2sccI%i%s" % (len(value), datafmt)
24866 __pyx_t_6 = ((PyObject *)__pyx_n_s__I);
24867 __Pyx_INCREF(__pyx_t_6);
24868 __pyx_t_1 = ((PyObject *)__pyx_n_s__I);
24869 __Pyx_INCREF(__pyx_t_1);
24870 __Pyx_XDECREF(__pyx_v_datafmt);
24871 __pyx_v_datafmt = __pyx_t_6;
24873 __Pyx_XDECREF(__pyx_v_datatype);
24874 __pyx_v_datatype = __pyx_t_1;
24883 /* "csamtools.pyx":2589
24884 * else: datafmt, datatype = "I", 'I'
24886 * datafmt = "2sccI%i%s" % (len(value), datafmt) # <<<<<<<<<<<<<<
24887 * args.extend( [pytag[:2],
24888 * pytype.encode('ascii'),
24890 __pyx_t_12 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24891 __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24892 __Pyx_GOTREF(__pyx_t_1);
24893 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24894 __Pyx_GOTREF(__pyx_t_6);
24895 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
24896 __Pyx_GIVEREF(__pyx_t_1);
24897 __Pyx_INCREF(__pyx_v_datafmt);
24898 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_datafmt);
24899 __Pyx_GIVEREF(__pyx_v_datafmt);
24901 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_141), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24902 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
24903 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
24904 __Pyx_DECREF(__pyx_v_datafmt);
24905 __pyx_v_datafmt = ((PyObject *)__pyx_t_1);
24908 /* "csamtools.pyx":2590
24910 * datafmt = "2sccI%i%s" % (len(value), datafmt)
24911 * args.extend( [pytag[:2], # <<<<<<<<<<<<<<
24912 * pytype.encode('ascii'),
24913 * datatype.encode('ascii'),
24915 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_args), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24916 __Pyx_GOTREF(__pyx_t_1);
24918 /* "csamtools.pyx":2593
24919 * pytype.encode('ascii'),
24920 * datatype.encode('ascii'),
24921 * len(value)] + list(value) ) # <<<<<<<<<<<<<<
24922 * fmts.append( datafmt )
24925 __pyx_t_6 = __Pyx_PySequence_GetSlice(__pyx_v_pytag, 0, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24926 __Pyx_GOTREF(__pyx_t_6);
24928 /* "csamtools.pyx":2591
24929 * datafmt = "2sccI%i%s" % (len(value), datafmt)
24930 * args.extend( [pytag[:2],
24931 * pytype.encode('ascii'), # <<<<<<<<<<<<<<
24932 * datatype.encode('ascii'),
24933 * len(value)] + list(value) )
24935 __pyx_t_7 = PyObject_GetAttr(__pyx_v_pytype, __pyx_n_s__encode); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24936 __Pyx_GOTREF(__pyx_t_7);
24937 __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_142), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24938 __Pyx_GOTREF(__pyx_t_8);
24939 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
24941 /* "csamtools.pyx":2592
24942 * args.extend( [pytag[:2],
24943 * pytype.encode('ascii'),
24944 * datatype.encode('ascii'), # <<<<<<<<<<<<<<
24945 * len(value)] + list(value) )
24946 * fmts.append( datafmt )
24948 __pyx_t_7 = PyObject_GetAttr(__pyx_v_datatype, __pyx_n_s__encode); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24949 __Pyx_GOTREF(__pyx_t_7);
24950 __pyx_t_13 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_143), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24951 __Pyx_GOTREF(__pyx_t_13);
24952 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
24954 /* "csamtools.pyx":2593
24955 * pytype.encode('ascii'),
24956 * datatype.encode('ascii'),
24957 * len(value)] + list(value) ) # <<<<<<<<<<<<<<
24958 * fmts.append( datafmt )
24961 __pyx_t_12 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24962 __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24963 __Pyx_GOTREF(__pyx_t_7);
24964 __pyx_t_14 = PyList_New(4); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24965 __Pyx_GOTREF(__pyx_t_14);
24966 PyList_SET_ITEM(__pyx_t_14, 0, __pyx_t_6);
24967 __Pyx_GIVEREF(__pyx_t_6);
24968 PyList_SET_ITEM(__pyx_t_14, 1, __pyx_t_8);
24969 __Pyx_GIVEREF(__pyx_t_8);
24970 PyList_SET_ITEM(__pyx_t_14, 2, __pyx_t_13);
24971 __Pyx_GIVEREF(__pyx_t_13);
24972 PyList_SET_ITEM(__pyx_t_14, 3, __pyx_t_7);
24973 __Pyx_GIVEREF(__pyx_t_7);
24978 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24979 __Pyx_GOTREF(__pyx_t_7);
24980 __Pyx_INCREF(__pyx_v_value);
24981 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_value);
24982 __Pyx_GIVEREF(__pyx_v_value);
24983 __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24984 __Pyx_GOTREF(__pyx_t_13);
24985 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
24986 __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_t_14), __pyx_t_13); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24987 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
24988 __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
24989 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
24990 __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24991 __Pyx_GOTREF(__pyx_t_13);
24992 PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_7));
24993 __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
24995 __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24996 __Pyx_GOTREF(__pyx_t_7);
24997 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24998 __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
24999 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
25001 /* "csamtools.pyx":2594
25002 * datatype.encode('ascii'),
25003 * len(value)] + list(value) )
25004 * fmts.append( datafmt ) # <<<<<<<<<<<<<<
25008 __pyx_t_15 = PyList_Append(__pyx_v_fmts, __pyx_v_datafmt); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25010 /* "csamtools.pyx":2595
25011 * len(value)] + list(value) )
25012 * fmts.append( datafmt )
25013 * continue # <<<<<<<<<<<<<<
25017 goto __pyx_L4_continue;
25022 /* "csamtools.pyx":2597
25025 * if t is float: # <<<<<<<<<<<<<<
25026 * fmt, pytype = "2scf", 'f'
25029 __pyx_t_11 = (__pyx_v_t == ((PyObject*)(&PyFloat_Type)));
25032 /* "csamtools.pyx":2598
25035 * fmt, pytype = "2scf", 'f' # <<<<<<<<<<<<<<
25037 * # negative values
25039 __pyx_t_7 = ((PyObject *)__pyx_kp_s__2scf);
25040 __Pyx_INCREF(__pyx_t_7);
25041 __pyx_t_13 = ((PyObject *)__pyx_n_s__f);
25042 __Pyx_INCREF(__pyx_t_13);
25043 __Pyx_XDECREF(__pyx_v_fmt);
25044 __pyx_v_fmt = __pyx_t_7;
25046 __Pyx_XDECREF(__pyx_v_pytype);
25047 __pyx_v_pytype = __pyx_t_13;
25052 /* "csamtools.pyx":2599
25054 * fmt, pytype = "2scf", 'f'
25055 * elif t is int: # <<<<<<<<<<<<<<
25056 * # negative values
25059 __pyx_t_11 = (__pyx_v_t == ((PyObject*)(&PyInt_Type)));
25062 /* "csamtools.pyx":2601
25064 * # negative values
25065 * if value < 0: # <<<<<<<<<<<<<<
25066 * if value >= -127: fmt, pytype = "2scb", 'c'
25067 * elif value >= -32767: fmt, pytype = "2sch", 's'
25069 __pyx_t_13 = PyObject_RichCompare(__pyx_v_value, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25070 __Pyx_GOTREF(__pyx_t_13);
25071 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25072 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
25075 /* "csamtools.pyx":2602
25076 * # negative values
25078 * if value >= -127: fmt, pytype = "2scb", 'c' # <<<<<<<<<<<<<<
25079 * elif value >= -32767: fmt, pytype = "2sch", 's'
25080 * elif value < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
25082 __pyx_t_13 = PyObject_RichCompare(__pyx_v_value, __pyx_int_neg_127, Py_GE); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25083 __Pyx_GOTREF(__pyx_t_13);
25084 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25085 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
25087 __pyx_t_13 = ((PyObject *)__pyx_kp_s__2scb);
25088 __Pyx_INCREF(__pyx_t_13);
25089 __pyx_t_7 = ((PyObject *)__pyx_n_s__c);
25090 __Pyx_INCREF(__pyx_t_7);
25091 __Pyx_XDECREF(__pyx_v_fmt);
25092 __pyx_v_fmt = __pyx_t_13;
25094 __Pyx_XDECREF(__pyx_v_pytype);
25095 __pyx_v_pytype = __pyx_t_7;
25100 /* "csamtools.pyx":2603
25102 * if value >= -127: fmt, pytype = "2scb", 'c'
25103 * elif value >= -32767: fmt, pytype = "2sch", 's' # <<<<<<<<<<<<<<
25104 * elif value < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
25105 * else: fmt, pytype = "2sci", 'i'
25107 __pyx_t_7 = PyObject_RichCompare(__pyx_v_value, __pyx_int_neg_32767, Py_GE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25108 __Pyx_GOTREF(__pyx_t_7);
25109 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25110 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
25112 __pyx_t_7 = ((PyObject *)__pyx_kp_s__2sch);
25113 __Pyx_INCREF(__pyx_t_7);
25114 __pyx_t_13 = ((PyObject *)__pyx_n_s__s);
25115 __Pyx_INCREF(__pyx_t_13);
25116 __Pyx_XDECREF(__pyx_v_fmt);
25117 __pyx_v_fmt = __pyx_t_7;
25119 __Pyx_XDECREF(__pyx_v_pytype);
25120 __pyx_v_pytype = __pyx_t_13;
25125 /* "csamtools.pyx":2604
25126 * if value >= -127: fmt, pytype = "2scb", 'c'
25127 * elif value >= -32767: fmt, pytype = "2sch", 's'
25128 * elif value < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value ) # <<<<<<<<<<<<<<
25129 * else: fmt, pytype = "2sci", 'i'
25130 * # positive values
25132 __pyx_t_13 = PyObject_RichCompare(__pyx_v_value, __pyx_int_neg_2147483648, Py_LT); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25133 __Pyx_GOTREF(__pyx_t_13);
25134 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25135 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
25137 __pyx_t_13 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_140), __pyx_v_value); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25138 __Pyx_GOTREF(((PyObject *)__pyx_t_13));
25139 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25140 __Pyx_GOTREF(__pyx_t_7);
25141 PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_13));
25142 __Pyx_GIVEREF(((PyObject *)__pyx_t_13));
25144 __pyx_t_13 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25145 __Pyx_GOTREF(__pyx_t_13);
25146 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
25147 __Pyx_Raise(__pyx_t_13, 0, 0, 0);
25148 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
25149 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25154 /* "csamtools.pyx":2605
25155 * elif value >= -32767: fmt, pytype = "2sch", 's'
25156 * elif value < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
25157 * else: fmt, pytype = "2sci", 'i' # <<<<<<<<<<<<<<
25158 * # positive values
25161 __pyx_t_13 = ((PyObject *)__pyx_kp_s__2sci);
25162 __Pyx_INCREF(__pyx_t_13);
25163 __pyx_t_7 = ((PyObject *)__pyx_n_s__i);
25164 __Pyx_INCREF(__pyx_t_7);
25165 __Pyx_XDECREF(__pyx_v_fmt);
25166 __pyx_v_fmt = __pyx_t_13;
25168 __Pyx_XDECREF(__pyx_v_pytype);
25169 __pyx_v_pytype = __pyx_t_7;
25177 /* "csamtools.pyx":2608
25178 * # positive values
25180 * if value <= 255: fmt, pytype = "2scB", 'C' # <<<<<<<<<<<<<<
25181 * elif value <= 65535: fmt, pytype = "2scH", 'S'
25182 * elif value > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
25184 __pyx_t_7 = PyObject_RichCompare(__pyx_v_value, __pyx_int_255, Py_LE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25185 __Pyx_GOTREF(__pyx_t_7);
25186 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25187 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
25189 __pyx_t_7 = ((PyObject *)__pyx_kp_s__2scB);
25190 __Pyx_INCREF(__pyx_t_7);
25191 __pyx_t_13 = ((PyObject *)__pyx_n_s__C);
25192 __Pyx_INCREF(__pyx_t_13);
25193 __Pyx_XDECREF(__pyx_v_fmt);
25194 __pyx_v_fmt = __pyx_t_7;
25196 __Pyx_XDECREF(__pyx_v_pytype);
25197 __pyx_v_pytype = __pyx_t_13;
25202 /* "csamtools.pyx":2609
25204 * if value <= 255: fmt, pytype = "2scB", 'C'
25205 * elif value <= 65535: fmt, pytype = "2scH", 'S' # <<<<<<<<<<<<<<
25206 * elif value > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
25207 * else: fmt, pytype = "2scI", 'I'
25209 __pyx_t_13 = PyObject_RichCompare(__pyx_v_value, __pyx_int_65535, Py_LE); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25210 __Pyx_GOTREF(__pyx_t_13);
25211 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25212 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
25214 __pyx_t_13 = ((PyObject *)__pyx_kp_s__2scH);
25215 __Pyx_INCREF(__pyx_t_13);
25216 __pyx_t_7 = ((PyObject *)__pyx_n_s__S);
25217 __Pyx_INCREF(__pyx_t_7);
25218 __Pyx_XDECREF(__pyx_v_fmt);
25219 __pyx_v_fmt = __pyx_t_13;
25221 __Pyx_XDECREF(__pyx_v_pytype);
25222 __pyx_v_pytype = __pyx_t_7;
25227 /* "csamtools.pyx":2610
25228 * if value <= 255: fmt, pytype = "2scB", 'C'
25229 * elif value <= 65535: fmt, pytype = "2scH", 'S'
25230 * elif value > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value ) # <<<<<<<<<<<<<<
25231 * else: fmt, pytype = "2scI", 'I'
25234 __pyx_t_7 = PyObject_RichCompare(__pyx_v_value, __pyx_int_4294967295, Py_GT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25235 __Pyx_GOTREF(__pyx_t_7);
25236 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25237 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
25239 __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_140), __pyx_v_value); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25240 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
25241 __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25242 __Pyx_GOTREF(__pyx_t_13);
25243 PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_7));
25244 __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
25246 __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25247 __Pyx_GOTREF(__pyx_t_7);
25248 __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
25249 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
25250 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
25251 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25256 /* "csamtools.pyx":2611
25257 * elif value <= 65535: fmt, pytype = "2scH", 'S'
25258 * elif value > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
25259 * else: fmt, pytype = "2scI", 'I' # <<<<<<<<<<<<<<
25261 * # Note: hex strings (H) are not supported yet
25263 __pyx_t_7 = ((PyObject *)__pyx_kp_s__2scI);
25264 __Pyx_INCREF(__pyx_t_7);
25265 __pyx_t_13 = ((PyObject *)__pyx_n_s__I);
25266 __Pyx_INCREF(__pyx_t_13);
25267 __Pyx_XDECREF(__pyx_v_fmt);
25268 __pyx_v_fmt = __pyx_t_7;
25270 __Pyx_XDECREF(__pyx_v_pytype);
25271 __pyx_v_pytype = __pyx_t_13;
25281 /* "csamtools.pyx":2614
25283 * # Note: hex strings (H) are not supported yet
25284 * if t is not bytes: # <<<<<<<<<<<<<<
25285 * value = value.encode('ascii')
25286 * if len(value) == 1:
25288 __pyx_t_11 = (__pyx_v_t != ((PyObject*)(&PyBytes_Type)));
25291 /* "csamtools.pyx":2615
25292 * # Note: hex strings (H) are not supported yet
25293 * if t is not bytes:
25294 * value = value.encode('ascii') # <<<<<<<<<<<<<<
25295 * if len(value) == 1:
25296 * fmt, pytype = "2scc", 'A'
25298 __pyx_t_13 = PyObject_GetAttr(__pyx_v_value, __pyx_n_s__encode); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25299 __Pyx_GOTREF(__pyx_t_13);
25300 __pyx_t_7 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_k_tuple_144), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25301 __Pyx_GOTREF(__pyx_t_7);
25302 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
25303 __Pyx_DECREF(__pyx_v_value);
25304 __pyx_v_value = __pyx_t_7;
25310 /* "csamtools.pyx":2616
25311 * if t is not bytes:
25312 * value = value.encode('ascii')
25313 * if len(value) == 1: # <<<<<<<<<<<<<<
25314 * fmt, pytype = "2scc", 'A'
25317 __pyx_t_12 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25318 __pyx_t_11 = (__pyx_t_12 == 1);
25321 /* "csamtools.pyx":2617
25322 * value = value.encode('ascii')
25323 * if len(value) == 1:
25324 * fmt, pytype = "2scc", 'A' # <<<<<<<<<<<<<<
25326 * fmt, pytype = "2sc%is" % (len(value)+1), 'Z'
25328 __pyx_t_7 = ((PyObject *)__pyx_kp_s__2scc);
25329 __Pyx_INCREF(__pyx_t_7);
25330 __pyx_t_13 = ((PyObject *)__pyx_n_s__A);
25331 __Pyx_INCREF(__pyx_t_13);
25332 __Pyx_XDECREF(__pyx_v_fmt);
25333 __pyx_v_fmt = __pyx_t_7;
25335 __Pyx_XDECREF(__pyx_v_pytype);
25336 __pyx_v_pytype = __pyx_t_13;
25342 /* "csamtools.pyx":2619
25343 * fmt, pytype = "2scc", 'A'
25345 * fmt, pytype = "2sc%is" % (len(value)+1), 'Z' # <<<<<<<<<<<<<<
25347 * args.extend( [pytag[:2],
25349 __pyx_t_12 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25350 __pyx_t_13 = PyInt_FromSsize_t((__pyx_t_12 + 1)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25351 __Pyx_GOTREF(__pyx_t_13);
25352 __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_145), __pyx_t_13); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25353 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
25354 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
25355 __pyx_t_13 = ((PyObject *)__pyx_n_s__Z);
25356 __Pyx_INCREF(__pyx_t_13);
25357 __Pyx_XDECREF(__pyx_v_fmt);
25358 __pyx_v_fmt = ((PyObject *)__pyx_t_7);
25360 __Pyx_XDECREF(__pyx_v_pytype);
25361 __pyx_v_pytype = __pyx_t_13;
25368 /* "csamtools.pyx":2621
25369 * fmt, pytype = "2sc%is" % (len(value)+1), 'Z'
25371 * args.extend( [pytag[:2], # <<<<<<<<<<<<<<
25372 * pytype.encode('ascii'),
25375 __pyx_t_13 = PyObject_GetAttr(((PyObject *)__pyx_v_args), __pyx_n_s__extend); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25376 __Pyx_GOTREF(__pyx_t_13);
25377 __pyx_t_7 = __Pyx_PySequence_GetSlice(__pyx_v_pytag, 0, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25378 __Pyx_GOTREF(__pyx_t_7);
25380 /* "csamtools.pyx":2622
25382 * args.extend( [pytag[:2],
25383 * pytype.encode('ascii'), # <<<<<<<<<<<<<<
25387 __pyx_t_1 = PyObject_GetAttr(__pyx_v_pytype, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25388 __Pyx_GOTREF(__pyx_t_1);
25389 __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_146), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25390 __Pyx_GOTREF(__pyx_t_14);
25391 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25393 /* "csamtools.pyx":2623
25394 * args.extend( [pytag[:2],
25395 * pytype.encode('ascii'),
25396 * value ] ) # <<<<<<<<<<<<<<
25398 * fmts.append( fmt )
25400 __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25401 __Pyx_GOTREF(__pyx_t_1);
25402 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
25403 __Pyx_GIVEREF(__pyx_t_7);
25404 PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_14);
25405 __Pyx_GIVEREF(__pyx_t_14);
25406 __Pyx_INCREF(__pyx_v_value);
25407 PyList_SET_ITEM(__pyx_t_1, 2, __pyx_v_value);
25408 __Pyx_GIVEREF(__pyx_v_value);
25411 __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25412 __Pyx_GOTREF(__pyx_t_14);
25413 PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_t_1));
25414 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
25416 __pyx_t_1 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25417 __Pyx_GOTREF(__pyx_t_1);
25418 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
25419 __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
25420 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25422 /* "csamtools.pyx":2625
25425 * fmts.append( fmt ) # <<<<<<<<<<<<<<
25427 * fmt = "".join(fmts)
25429 __pyx_t_15 = PyList_Append(__pyx_v_fmts, __pyx_v_fmt); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25430 __pyx_L4_continue:;
25432 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25434 /* "csamtools.pyx":2627
25435 * fmts.append( fmt )
25437 * fmt = "".join(fmts) # <<<<<<<<<<<<<<
25438 * total_size = struct.calcsize(fmt)
25439 * buffer = ctypes.create_string_buffer(total_size)
25441 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_16), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25442 __Pyx_GOTREF(__pyx_t_2);
25443 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25444 __Pyx_GOTREF(__pyx_t_1);
25445 __Pyx_INCREF(((PyObject *)__pyx_v_fmts));
25446 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_fmts));
25447 __Pyx_GIVEREF(((PyObject *)__pyx_v_fmts));
25448 __pyx_t_14 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25449 __Pyx_GOTREF(__pyx_t_14);
25450 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25451 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
25452 __Pyx_XDECREF(__pyx_v_fmt);
25453 __pyx_v_fmt = __pyx_t_14;
25456 /* "csamtools.pyx":2628
25458 * fmt = "".join(fmts)
25459 * total_size = struct.calcsize(fmt) # <<<<<<<<<<<<<<
25460 * buffer = ctypes.create_string_buffer(total_size)
25461 * struct.pack_into( fmt,
25463 __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__struct); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25464 __Pyx_GOTREF(__pyx_t_14);
25465 __pyx_t_1 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__calcsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25466 __Pyx_GOTREF(__pyx_t_1);
25467 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
25468 __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25469 __Pyx_GOTREF(__pyx_t_14);
25470 __Pyx_INCREF(__pyx_v_fmt);
25471 PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_fmt);
25472 __Pyx_GIVEREF(__pyx_v_fmt);
25473 __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25474 __Pyx_GOTREF(__pyx_t_2);
25475 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25476 __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
25477 __pyx_v_total_size = __pyx_t_2;
25480 /* "csamtools.pyx":2629
25481 * fmt = "".join(fmts)
25482 * total_size = struct.calcsize(fmt)
25483 * buffer = ctypes.create_string_buffer(total_size) # <<<<<<<<<<<<<<
25484 * struct.pack_into( fmt,
25487 __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ctypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25488 __Pyx_GOTREF(__pyx_t_2);
25489 __pyx_t_14 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s_147); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25490 __Pyx_GOTREF(__pyx_t_14);
25491 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25492 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25493 __Pyx_GOTREF(__pyx_t_2);
25494 __Pyx_INCREF(__pyx_v_total_size);
25495 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_total_size);
25496 __Pyx_GIVEREF(__pyx_v_total_size);
25497 __pyx_t_1 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25498 __Pyx_GOTREF(__pyx_t_1);
25499 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
25500 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
25501 __pyx_v_buffer = __pyx_t_1;
25504 /* "csamtools.pyx":2630
25505 * total_size = struct.calcsize(fmt)
25506 * buffer = ctypes.create_string_buffer(total_size)
25507 * struct.pack_into( fmt, # <<<<<<<<<<<<<<
25511 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__struct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25512 __Pyx_GOTREF(__pyx_t_1);
25513 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__pack_into); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25514 __Pyx_GOTREF(__pyx_t_2);
25515 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25517 /* "csamtools.pyx":2631
25518 * buffer = ctypes.create_string_buffer(total_size)
25519 * struct.pack_into( fmt,
25520 * buffer, # <<<<<<<<<<<<<<
25524 __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25525 __Pyx_GOTREF(__pyx_t_1);
25526 __Pyx_INCREF(__pyx_v_fmt);
25527 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fmt);
25528 __Pyx_GIVEREF(__pyx_v_fmt);
25529 __Pyx_INCREF(__pyx_v_buffer);
25530 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_buffer);
25531 __Pyx_GIVEREF(__pyx_v_buffer);
25532 __Pyx_INCREF(__pyx_int_0);
25533 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_0);
25534 __Pyx_GIVEREF(__pyx_int_0);
25536 /* "csamtools.pyx":2633
25539 * *args ) # <<<<<<<<<<<<<<
25541 * # delete the old data and allocate new space.
25543 __pyx_t_14 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25544 __Pyx_GOTREF(((PyObject *)__pyx_t_14));
25545 __pyx_t_13 = PyNumber_Add(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25546 __Pyx_GOTREF(((PyObject *)__pyx_t_13));
25547 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
25548 __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
25549 __pyx_t_14 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25550 __Pyx_GOTREF(__pyx_t_14);
25551 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25552 __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
25553 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
25558 /* "csamtools.pyx":2640
25559 * pysam_bam_update( src,
25561 * total_size, # <<<<<<<<<<<<<<
25562 * bam1_aux( src ) )
25565 if (unlikely(!__pyx_v_total_size)) { __Pyx_RaiseUnboundLocalError("total_size"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
25566 __pyx_t_16 = __Pyx_PyInt_AsSize_t(__pyx_v_total_size); if (unlikely((__pyx_t_16 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25568 /* "csamtools.pyx":2641
25571 * bam1_aux( src ) ) # <<<<<<<<<<<<<<
25573 * src.l_aux = total_size
25575 pysam_bam_update(__pyx_v_src, __pyx_v_src->l_aux, __pyx_t_16, bam1_aux(__pyx_v_src));
25577 /* "csamtools.pyx":2643
25578 * bam1_aux( src ) )
25580 * src.l_aux = total_size # <<<<<<<<<<<<<<
25582 * # copy data only if there is any
25584 __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_v_total_size); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25585 __pyx_v_src->l_aux = __pyx_t_17;
25587 /* "csamtools.pyx":2646
25589 * # copy data only if there is any
25590 * if total_size != 0: # <<<<<<<<<<<<<<
25592 * # get location of new data
25594 __pyx_t_14 = PyObject_RichCompare(__pyx_v_total_size, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25595 __Pyx_GOTREF(__pyx_t_14);
25596 __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25597 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
25600 /* "csamtools.pyx":2649
25602 * # get location of new data
25603 * s = bam1_aux( src ) # <<<<<<<<<<<<<<
25605 * # check if there is direct path from buffer.raw to tmp
25607 __pyx_v_s = bam1_aux(__pyx_v_src);
25609 /* "csamtools.pyx":2652
25611 * # check if there is direct path from buffer.raw to tmp
25612 * temp = buffer.raw # <<<<<<<<<<<<<<
25613 * memcpy( s, temp, total_size )
25616 if (unlikely(!__pyx_v_buffer)) { __Pyx_RaiseUnboundLocalError("buffer"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
25617 __pyx_t_14 = PyObject_GetAttr(__pyx_v_buffer, __pyx_n_s__raw); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25618 __Pyx_GOTREF(__pyx_t_14);
25619 __pyx_t_18 = PyBytes_AsString(__pyx_t_14); if (unlikely((!__pyx_t_18) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25620 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
25621 __pyx_v_temp = __pyx_t_18;
25623 /* "csamtools.pyx":2653
25624 * # check if there is direct path from buffer.raw to tmp
25625 * temp = buffer.raw
25626 * memcpy( s, temp, total_size ) # <<<<<<<<<<<<<<
25630 __pyx_t_16 = __Pyx_PyInt_AsSize_t(__pyx_v_total_size); if (unlikely((__pyx_t_16 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25631 memcpy(__pyx_v_s, __pyx_v_temp, __pyx_t_16);
25639 __Pyx_XDECREF(__pyx_t_1);
25640 __Pyx_XDECREF(__pyx_t_2);
25641 __Pyx_XDECREF(__pyx_t_6);
25642 __Pyx_XDECREF(__pyx_t_7);
25643 __Pyx_XDECREF(__pyx_t_8);
25644 __Pyx_XDECREF(__pyx_t_13);
25645 __Pyx_XDECREF(__pyx_t_14);
25646 __Pyx_AddTraceback("csamtools.AlignedRead.tags.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
25649 __Pyx_XDECREF(__pyx_v_fmts);
25650 __Pyx_XDECREF(__pyx_v_args);
25651 __Pyx_XDECREF(__pyx_v_pytag);
25652 __Pyx_XDECREF(__pyx_v_value);
25653 __Pyx_XDECREF(__pyx_v_t);
25654 __Pyx_XDECREF(__pyx_v_pytype);
25655 __Pyx_XDECREF(__pyx_v_datafmt);
25656 __Pyx_XDECREF(__pyx_v_datatype);
25657 __Pyx_XDECREF(__pyx_v_mi);
25658 __Pyx_XDECREF(__pyx_v_ma);
25659 __Pyx_XDECREF(__pyx_v_absmax);
25660 __Pyx_XDECREF(__pyx_v_fmt);
25661 __Pyx_XDECREF(__pyx_v_total_size);
25662 __Pyx_XDECREF(__pyx_v_buffer);
25663 __Pyx_TraceReturn(Py_None);
25664 __Pyx_RefNannyFinishContext();
25668 /* Python wrapper */
25669 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4flag_1__get__(PyObject *__pyx_v_self); /*proto*/
25670 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4flag_1__get__(PyObject *__pyx_v_self) {
25671 PyObject *__pyx_r = 0;
25672 __Pyx_RefNannyDeclarations
25673 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
25674 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4flag___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
25675 __Pyx_RefNannyFinishContext();
25679 /* "csamtools.pyx":2657
25681 * """properties flag"""
25682 * def __get__(self): return self._delegate.core.flag # <<<<<<<<<<<<<<
25683 * def __set__(self, flag): self._delegate.core.flag = flag
25687 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4flag___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
25688 PyObject *__pyx_r = NULL;
25689 __Pyx_RefNannyDeclarations
25690 PyObject *__pyx_t_1 = NULL;
25691 int __pyx_lineno = 0;
25692 const char *__pyx_filename = NULL;
25693 int __pyx_clineno = 0;
25694 __Pyx_TraceDeclarations
25695 __Pyx_RefNannySetupContext("__get__", 0);
25696 __Pyx_TraceCall("__get__", __pyx_f[0], 2657);
25697 __Pyx_XDECREF(__pyx_r);
25698 __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_self->_delegate->core.flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25699 __Pyx_GOTREF(__pyx_t_1);
25700 __pyx_r = __pyx_t_1;
25704 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
25707 __Pyx_XDECREF(__pyx_t_1);
25708 __Pyx_AddTraceback("csamtools.AlignedRead.flag.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
25711 __Pyx_XGIVEREF(__pyx_r);
25712 __Pyx_TraceReturn(__pyx_r);
25713 __Pyx_RefNannyFinishContext();
25717 /* Python wrapper */
25718 static int __pyx_pw_9csamtools_11AlignedRead_4flag_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_flag); /*proto*/
25719 static int __pyx_pw_9csamtools_11AlignedRead_4flag_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_flag) {
25721 __Pyx_RefNannyDeclarations
25722 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
25723 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4flag_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_flag));
25724 __Pyx_RefNannyFinishContext();
25728 /* "csamtools.pyx":2658
25729 * """properties flag"""
25730 * def __get__(self): return self._delegate.core.flag
25731 * def __set__(self, flag): self._delegate.core.flag = flag # <<<<<<<<<<<<<<
25736 static int __pyx_pf_9csamtools_11AlignedRead_4flag_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_flag) {
25738 __Pyx_RefNannyDeclarations
25739 uint32_t __pyx_t_1;
25740 int __pyx_lineno = 0;
25741 const char *__pyx_filename = NULL;
25742 int __pyx_clineno = 0;
25743 __Pyx_TraceDeclarations
25744 __Pyx_RefNannySetupContext("__set__", 0);
25745 __Pyx_TraceCall("__set__", __pyx_f[0], 2658);
25746 __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_flag); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25747 __pyx_v_self->_delegate->core.flag = __pyx_t_1;
25752 __Pyx_AddTraceback("csamtools.AlignedRead.flag.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
25755 __Pyx_TraceReturn(Py_None);
25756 __Pyx_RefNannyFinishContext();
25760 /* Python wrapper */
25761 static PyObject *__pyx_pw_9csamtools_11AlignedRead_5rname_1__get__(PyObject *__pyx_v_self); /*proto*/
25762 static PyObject *__pyx_pw_9csamtools_11AlignedRead_5rname_1__get__(PyObject *__pyx_v_self) {
25763 PyObject *__pyx_r = 0;
25764 __Pyx_RefNannyDeclarations
25765 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
25766 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5rname___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
25767 __Pyx_RefNannyFinishContext();
25771 /* "csamtools.pyx":2676
25774 * def __get__(self): return self._delegate.core.tid # <<<<<<<<<<<<<<
25775 * def __set__(self, tid): self._delegate.core.tid = tid
25779 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rname___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
25780 PyObject *__pyx_r = NULL;
25781 __Pyx_RefNannyDeclarations
25782 PyObject *__pyx_t_1 = NULL;
25783 int __pyx_lineno = 0;
25784 const char *__pyx_filename = NULL;
25785 int __pyx_clineno = 0;
25786 __Pyx_TraceDeclarations
25787 __Pyx_RefNannySetupContext("__get__", 0);
25788 __Pyx_TraceCall("__get__", __pyx_f[0], 2676);
25789 __Pyx_XDECREF(__pyx_r);
25790 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25791 __Pyx_GOTREF(__pyx_t_1);
25792 __pyx_r = __pyx_t_1;
25796 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
25799 __Pyx_XDECREF(__pyx_t_1);
25800 __Pyx_AddTraceback("csamtools.AlignedRead.rname.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
25803 __Pyx_XGIVEREF(__pyx_r);
25804 __Pyx_TraceReturn(__pyx_r);
25805 __Pyx_RefNannyFinishContext();
25809 /* Python wrapper */
25810 static int __pyx_pw_9csamtools_11AlignedRead_5rname_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
25811 static int __pyx_pw_9csamtools_11AlignedRead_5rname_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) {
25813 __Pyx_RefNannyDeclarations
25814 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
25815 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5rname_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_tid));
25816 __Pyx_RefNannyFinishContext();
25820 /* "csamtools.pyx":2677
25822 * def __get__(self): return self._delegate.core.tid
25823 * def __set__(self, tid): self._delegate.core.tid = tid # <<<<<<<<<<<<<<
25828 static int __pyx_pf_9csamtools_11AlignedRead_5rname_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tid) {
25830 __Pyx_RefNannyDeclarations
25832 int __pyx_lineno = 0;
25833 const char *__pyx_filename = NULL;
25834 int __pyx_clineno = 0;
25835 __Pyx_TraceDeclarations
25836 __Pyx_RefNannySetupContext("__set__", 0);
25837 __Pyx_TraceCall("__set__", __pyx_f[0], 2677);
25838 __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_tid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25839 __pyx_v_self->_delegate->core.tid = __pyx_t_1;
25844 __Pyx_AddTraceback("csamtools.AlignedRead.rname.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
25847 __Pyx_TraceReturn(Py_None);
25848 __Pyx_RefNannyFinishContext();
25852 /* Python wrapper */
25853 static PyObject *__pyx_pw_9csamtools_11AlignedRead_3tid_1__get__(PyObject *__pyx_v_self); /*proto*/
25854 static PyObject *__pyx_pw_9csamtools_11AlignedRead_3tid_1__get__(PyObject *__pyx_v_self) {
25855 PyObject *__pyx_r = 0;
25856 __Pyx_RefNannyDeclarations
25857 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
25858 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_3tid___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
25859 __Pyx_RefNannyFinishContext();
25863 /* "csamtools.pyx":2690
25866 * def __get__(self): return self._delegate.core.tid # <<<<<<<<<<<<<<
25867 * def __set__(self, tid): self._delegate.core.tid = tid
25871 static PyObject *__pyx_pf_9csamtools_11AlignedRead_3tid___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
25872 PyObject *__pyx_r = NULL;
25873 __Pyx_RefNannyDeclarations
25874 PyObject *__pyx_t_1 = NULL;
25875 int __pyx_lineno = 0;
25876 const char *__pyx_filename = NULL;
25877 int __pyx_clineno = 0;
25878 __Pyx_TraceDeclarations
25879 __Pyx_RefNannySetupContext("__get__", 0);
25880 __Pyx_TraceCall("__get__", __pyx_f[0], 2690);
25881 __Pyx_XDECREF(__pyx_r);
25882 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25883 __Pyx_GOTREF(__pyx_t_1);
25884 __pyx_r = __pyx_t_1;
25888 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
25891 __Pyx_XDECREF(__pyx_t_1);
25892 __Pyx_AddTraceback("csamtools.AlignedRead.tid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
25895 __Pyx_XGIVEREF(__pyx_r);
25896 __Pyx_TraceReturn(__pyx_r);
25897 __Pyx_RefNannyFinishContext();
25901 /* Python wrapper */
25902 static int __pyx_pw_9csamtools_11AlignedRead_3tid_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
25903 static int __pyx_pw_9csamtools_11AlignedRead_3tid_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) {
25905 __Pyx_RefNannyDeclarations
25906 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
25907 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_3tid_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_tid));
25908 __Pyx_RefNannyFinishContext();
25912 /* "csamtools.pyx":2691
25914 * def __get__(self): return self._delegate.core.tid
25915 * def __set__(self, tid): self._delegate.core.tid = tid # <<<<<<<<<<<<<<
25920 static int __pyx_pf_9csamtools_11AlignedRead_3tid_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tid) {
25922 __Pyx_RefNannyDeclarations
25924 int __pyx_lineno = 0;
25925 const char *__pyx_filename = NULL;
25926 int __pyx_clineno = 0;
25927 __Pyx_TraceDeclarations
25928 __Pyx_RefNannySetupContext("__set__", 0);
25929 __Pyx_TraceCall("__set__", __pyx_f[0], 2691);
25930 __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_tid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25931 __pyx_v_self->_delegate->core.tid = __pyx_t_1;
25936 __Pyx_AddTraceback("csamtools.AlignedRead.tid.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
25939 __Pyx_TraceReturn(Py_None);
25940 __Pyx_RefNannyFinishContext();
25944 /* Python wrapper */
25945 static PyObject *__pyx_pw_9csamtools_11AlignedRead_3pos_1__get__(PyObject *__pyx_v_self); /*proto*/
25946 static PyObject *__pyx_pw_9csamtools_11AlignedRead_3pos_1__get__(PyObject *__pyx_v_self) {
25947 PyObject *__pyx_r = 0;
25948 __Pyx_RefNannyDeclarations
25949 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
25950 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_3pos___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
25951 __Pyx_RefNannyFinishContext();
25955 /* "csamtools.pyx":2695
25957 * """0-based leftmost coordinate"""
25958 * def __get__(self): return self._delegate.core.pos # <<<<<<<<<<<<<<
25959 * def __set__(self, pos):
25960 * ## setting the cigar string also updates the "bin" attribute
25963 static PyObject *__pyx_pf_9csamtools_11AlignedRead_3pos___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
25964 PyObject *__pyx_r = NULL;
25965 __Pyx_RefNannyDeclarations
25966 PyObject *__pyx_t_1 = NULL;
25967 int __pyx_lineno = 0;
25968 const char *__pyx_filename = NULL;
25969 int __pyx_clineno = 0;
25970 __Pyx_TraceDeclarations
25971 __Pyx_RefNannySetupContext("__get__", 0);
25972 __Pyx_TraceCall("__get__", __pyx_f[0], 2695);
25973 __Pyx_XDECREF(__pyx_r);
25974 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25975 __Pyx_GOTREF(__pyx_t_1);
25976 __pyx_r = __pyx_t_1;
25980 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
25983 __Pyx_XDECREF(__pyx_t_1);
25984 __Pyx_AddTraceback("csamtools.AlignedRead.pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
25987 __Pyx_XGIVEREF(__pyx_r);
25988 __Pyx_TraceReturn(__pyx_r);
25989 __Pyx_RefNannyFinishContext();
25993 /* Python wrapper */
25994 static int __pyx_pw_9csamtools_11AlignedRead_3pos_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pos); /*proto*/
25995 static int __pyx_pw_9csamtools_11AlignedRead_3pos_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pos) {
25997 __Pyx_RefNannyDeclarations
25998 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
25999 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_3pos_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_pos));
26000 __Pyx_RefNannyFinishContext();
26004 /* "csamtools.pyx":2696
26005 * """0-based leftmost coordinate"""
26006 * def __get__(self): return self._delegate.core.pos
26007 * def __set__(self, pos): # <<<<<<<<<<<<<<
26008 * ## setting the cigar string also updates the "bin" attribute
26009 * cdef bam1_t * src
26012 static int __pyx_pf_9csamtools_11AlignedRead_3pos_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_pos) {
26013 bam1_t *__pyx_v_src;
26015 __Pyx_RefNannyDeclarations
26017 int __pyx_lineno = 0;
26018 const char *__pyx_filename = NULL;
26019 int __pyx_clineno = 0;
26020 __Pyx_TraceDeclarations
26021 __Pyx_RefNannySetupContext("__set__", 0);
26022 __Pyx_TraceCall("__set__", __pyx_f[0], 2696);
26024 /* "csamtools.pyx":2699
26025 * ## setting the cigar string also updates the "bin" attribute
26026 * cdef bam1_t * src
26027 * src = self._delegate # <<<<<<<<<<<<<<
26028 * if src.core.n_cigar:
26029 * src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) )
26031 __pyx_v_src = __pyx_v_self->_delegate;
26033 /* "csamtools.pyx":2700
26034 * cdef bam1_t * src
26035 * src = self._delegate
26036 * if src.core.n_cigar: # <<<<<<<<<<<<<<
26037 * src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) )
26040 if (__pyx_v_src->core.n_cigar) {
26042 /* "csamtools.pyx":2701
26043 * src = self._delegate
26044 * if src.core.n_cigar:
26045 * src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) ) # <<<<<<<<<<<<<<
26047 * src.core.bin = bam_reg2bin( src.core.pos, src.core.pos + 1)
26049 __pyx_v_src->core.bin = bam_reg2bin(__pyx_v_src->core.pos, bam_calend((&__pyx_v_src->core), bam1_cigar(__pyx_v_src)));
26054 /* "csamtools.pyx":2703
26055 * src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) )
26057 * src.core.bin = bam_reg2bin( src.core.pos, src.core.pos + 1) # <<<<<<<<<<<<<<
26058 * self._delegate.core.pos = pos
26061 __pyx_v_src->core.bin = bam_reg2bin(__pyx_v_src->core.pos, (__pyx_v_src->core.pos + 1));
26065 /* "csamtools.pyx":2704
26067 * src.core.bin = bam_reg2bin( src.core.pos, src.core.pos + 1)
26068 * self._delegate.core.pos = pos # <<<<<<<<<<<<<<
26070 * """properties bin"""
26072 __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_pos); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26073 __pyx_v_self->_delegate->core.pos = __pyx_t_1;
26078 __Pyx_AddTraceback("csamtools.AlignedRead.pos.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26081 __Pyx_TraceReturn(Py_None);
26082 __Pyx_RefNannyFinishContext();
26086 /* Python wrapper */
26087 static PyObject *__pyx_pw_9csamtools_11AlignedRead_3bin_1__get__(PyObject *__pyx_v_self); /*proto*/
26088 static PyObject *__pyx_pw_9csamtools_11AlignedRead_3bin_1__get__(PyObject *__pyx_v_self) {
26089 PyObject *__pyx_r = 0;
26090 __Pyx_RefNannyDeclarations
26091 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
26092 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_3bin___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
26093 __Pyx_RefNannyFinishContext();
26097 /* "csamtools.pyx":2707
26099 * """properties bin"""
26100 * def __get__(self): return self._delegate.core.bin # <<<<<<<<<<<<<<
26101 * def __set__(self, bin): self._delegate.core.bin = bin
26105 static PyObject *__pyx_pf_9csamtools_11AlignedRead_3bin___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
26106 PyObject *__pyx_r = NULL;
26107 __Pyx_RefNannyDeclarations
26108 PyObject *__pyx_t_1 = NULL;
26109 int __pyx_lineno = 0;
26110 const char *__pyx_filename = NULL;
26111 int __pyx_clineno = 0;
26112 __Pyx_TraceDeclarations
26113 __Pyx_RefNannySetupContext("__get__", 0);
26114 __Pyx_TraceCall("__get__", __pyx_f[0], 2707);
26115 __Pyx_XDECREF(__pyx_r);
26116 __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 = 2707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26117 __Pyx_GOTREF(__pyx_t_1);
26118 __pyx_r = __pyx_t_1;
26122 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26125 __Pyx_XDECREF(__pyx_t_1);
26126 __Pyx_AddTraceback("csamtools.AlignedRead.bin.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26129 __Pyx_XGIVEREF(__pyx_r);
26130 __Pyx_TraceReturn(__pyx_r);
26131 __Pyx_RefNannyFinishContext();
26135 /* Python wrapper */
26136 static int __pyx_pw_9csamtools_11AlignedRead_3bin_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_bin); /*proto*/
26137 static int __pyx_pw_9csamtools_11AlignedRead_3bin_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_bin) {
26139 __Pyx_RefNannyDeclarations
26140 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
26141 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_3bin_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_bin));
26142 __Pyx_RefNannyFinishContext();
26146 /* "csamtools.pyx":2708
26147 * """properties bin"""
26148 * def __get__(self): return self._delegate.core.bin
26149 * def __set__(self, bin): self._delegate.core.bin = bin # <<<<<<<<<<<<<<
26151 * '''length of the read (read only). Returns 0 if not given.'''
26154 static int __pyx_pf_9csamtools_11AlignedRead_3bin_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_bin) {
26156 __Pyx_RefNannyDeclarations
26157 uint32_t __pyx_t_1;
26158 int __pyx_lineno = 0;
26159 const char *__pyx_filename = NULL;
26160 int __pyx_clineno = 0;
26161 __Pyx_TraceDeclarations
26162 __Pyx_RefNannySetupContext("__set__", 0);
26163 __Pyx_TraceCall("__set__", __pyx_f[0], 2708);
26164 __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_bin); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26165 __pyx_v_self->_delegate->core.bin = __pyx_t_1;
26170 __Pyx_AddTraceback("csamtools.AlignedRead.bin.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26173 __Pyx_TraceReturn(Py_None);
26174 __Pyx_RefNannyFinishContext();
26178 /* Python wrapper */
26179 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4rlen_1__get__(PyObject *__pyx_v_self); /*proto*/
26180 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4rlen_1__get__(PyObject *__pyx_v_self) {
26181 PyObject *__pyx_r = 0;
26182 __Pyx_RefNannyDeclarations
26183 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
26184 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4rlen___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
26185 __Pyx_RefNannyFinishContext();
26189 /* "csamtools.pyx":2711
26191 * '''length of the read (read only). Returns 0 if not given.'''
26192 * def __get__(self): return self._delegate.core.l_qseq # <<<<<<<<<<<<<<
26194 * '''aligned reference position of the read on the reference genome.
26197 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4rlen___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
26198 PyObject *__pyx_r = NULL;
26199 __Pyx_RefNannyDeclarations
26200 PyObject *__pyx_t_1 = NULL;
26201 int __pyx_lineno = 0;
26202 const char *__pyx_filename = NULL;
26203 int __pyx_clineno = 0;
26204 __Pyx_TraceDeclarations
26205 __Pyx_RefNannySetupContext("__get__", 0);
26206 __Pyx_TraceCall("__get__", __pyx_f[0], 2711);
26207 __Pyx_XDECREF(__pyx_r);
26208 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.l_qseq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26209 __Pyx_GOTREF(__pyx_t_1);
26210 __pyx_r = __pyx_t_1;
26214 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26217 __Pyx_XDECREF(__pyx_t_1);
26218 __Pyx_AddTraceback("csamtools.AlignedRead.rlen.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26221 __Pyx_XGIVEREF(__pyx_r);
26222 __Pyx_TraceReturn(__pyx_r);
26223 __Pyx_RefNannyFinishContext();
26227 /* Python wrapper */
26228 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4aend_1__get__(PyObject *__pyx_v_self); /*proto*/
26229 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4aend_1__get__(PyObject *__pyx_v_self) {
26230 PyObject *__pyx_r = 0;
26231 __Pyx_RefNannyDeclarations
26232 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
26233 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4aend___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
26234 __Pyx_RefNannyFinishContext();
26238 /* "csamtools.pyx":2717
26239 * aend points to one past the last aligned residue.
26240 * Returns None if not available.'''
26241 * def __get__(self): # <<<<<<<<<<<<<<
26242 * cdef bam1_t * src
26243 * src = self._delegate
26246 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
26247 bam1_t *__pyx_v_src;
26248 PyObject *__pyx_r = NULL;
26249 __Pyx_RefNannyDeclarations
26250 PyObject *__pyx_t_1 = NULL;
26251 PyObject *__pyx_t_2 = NULL;
26255 int __pyx_lineno = 0;
26256 const char *__pyx_filename = NULL;
26257 int __pyx_clineno = 0;
26258 __Pyx_TraceDeclarations
26259 __Pyx_RefNannySetupContext("__get__", 0);
26260 __Pyx_TraceCall("__get__", __pyx_f[0], 2717);
26262 /* "csamtools.pyx":2719
26263 * def __get__(self):
26264 * cdef bam1_t * src
26265 * src = self._delegate # <<<<<<<<<<<<<<
26266 * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
26269 __pyx_v_src = __pyx_v_self->_delegate;
26271 /* "csamtools.pyx":2720
26272 * cdef bam1_t * src
26273 * src = self._delegate
26274 * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0: # <<<<<<<<<<<<<<
26276 * return bam_calend(&src.core, bam1_cigar(src))
26278 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26279 __Pyx_GOTREF(__pyx_t_1);
26280 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26281 __Pyx_GOTREF(__pyx_t_2);
26282 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26283 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26284 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26286 __pyx_t_4 = (__pyx_v_src->core.n_cigar == 0);
26287 __pyx_t_5 = __pyx_t_4;
26289 __pyx_t_5 = __pyx_t_3;
26293 /* "csamtools.pyx":2721
26294 * src = self._delegate
26295 * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
26296 * return None # <<<<<<<<<<<<<<
26297 * return bam_calend(&src.core, bam1_cigar(src))
26300 __Pyx_XDECREF(__pyx_r);
26301 __Pyx_INCREF(Py_None);
26308 /* "csamtools.pyx":2722
26309 * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
26311 * return bam_calend(&src.core, bam1_cigar(src)) # <<<<<<<<<<<<<<
26315 __Pyx_XDECREF(__pyx_r);
26316 __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(bam_calend((&__pyx_v_src->core), bam1_cigar(__pyx_v_src))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26317 __Pyx_GOTREF(__pyx_t_2);
26318 __pyx_r = __pyx_t_2;
26322 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26325 __Pyx_XDECREF(__pyx_t_1);
26326 __Pyx_XDECREF(__pyx_t_2);
26327 __Pyx_AddTraceback("csamtools.AlignedRead.aend.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26330 __Pyx_XGIVEREF(__pyx_r);
26331 __Pyx_TraceReturn(__pyx_r);
26332 __Pyx_RefNannyFinishContext();
26336 /* Python wrapper */
26337 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4alen_1__get__(PyObject *__pyx_v_self); /*proto*/
26338 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4alen_1__get__(PyObject *__pyx_v_self) {
26339 PyObject *__pyx_r = 0;
26340 __Pyx_RefNannyDeclarations
26341 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
26342 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4alen___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
26343 __Pyx_RefNannyFinishContext();
26347 /* "csamtools.pyx":2727
26348 * '''aligned length of the read on the reference genome. Returns None if
26349 * not available.'''
26350 * def __get__(self): # <<<<<<<<<<<<<<
26351 * cdef bam1_t * src
26352 * src = self._delegate
26355 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
26356 bam1_t *__pyx_v_src;
26357 PyObject *__pyx_r = NULL;
26358 __Pyx_RefNannyDeclarations
26359 PyObject *__pyx_t_1 = NULL;
26360 PyObject *__pyx_t_2 = NULL;
26364 int __pyx_lineno = 0;
26365 const char *__pyx_filename = NULL;
26366 int __pyx_clineno = 0;
26367 __Pyx_TraceDeclarations
26368 __Pyx_RefNannySetupContext("__get__", 0);
26369 __Pyx_TraceCall("__get__", __pyx_f[0], 2727);
26371 /* "csamtools.pyx":2729
26372 * def __get__(self):
26373 * cdef bam1_t * src
26374 * src = self._delegate # <<<<<<<<<<<<<<
26375 * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
26378 __pyx_v_src = __pyx_v_self->_delegate;
26380 /* "csamtools.pyx":2730
26381 * cdef bam1_t * src
26382 * src = self._delegate
26383 * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0: # <<<<<<<<<<<<<<
26385 * return bam_calend(&src.core,
26387 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26388 __Pyx_GOTREF(__pyx_t_1);
26389 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26390 __Pyx_GOTREF(__pyx_t_2);
26391 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26392 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26393 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26395 __pyx_t_4 = (__pyx_v_src->core.n_cigar == 0);
26396 __pyx_t_5 = __pyx_t_4;
26398 __pyx_t_5 = __pyx_t_3;
26402 /* "csamtools.pyx":2731
26403 * src = self._delegate
26404 * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
26405 * return None # <<<<<<<<<<<<<<
26406 * return bam_calend(&src.core,
26407 * bam1_cigar(src)) - \
26409 __Pyx_XDECREF(__pyx_r);
26410 __Pyx_INCREF(Py_None);
26417 /* "csamtools.pyx":2732
26418 * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
26420 * return bam_calend(&src.core, # <<<<<<<<<<<<<<
26421 * bam1_cigar(src)) - \
26422 * self._delegate.core.pos
26424 __Pyx_XDECREF(__pyx_r);
26426 /* "csamtools.pyx":2734
26427 * return bam_calend(&src.core,
26428 * bam1_cigar(src)) - \
26429 * self._delegate.core.pos # <<<<<<<<<<<<<<
26433 __pyx_t_2 = PyInt_FromLong((bam_calend((&__pyx_v_src->core), bam1_cigar(__pyx_v_src)) - __pyx_v_self->_delegate->core.pos)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26434 __Pyx_GOTREF(__pyx_t_2);
26435 __pyx_r = __pyx_t_2;
26439 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26442 __Pyx_XDECREF(__pyx_t_1);
26443 __Pyx_XDECREF(__pyx_t_2);
26444 __Pyx_AddTraceback("csamtools.AlignedRead.alen.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26447 __Pyx_XGIVEREF(__pyx_r);
26448 __Pyx_TraceReturn(__pyx_r);
26449 __Pyx_RefNannyFinishContext();
26453 /* Python wrapper */
26454 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4mapq_1__get__(PyObject *__pyx_v_self); /*proto*/
26455 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4mapq_1__get__(PyObject *__pyx_v_self) {
26456 PyObject *__pyx_r = 0;
26457 __Pyx_RefNannyDeclarations
26458 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
26459 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4mapq___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
26460 __Pyx_RefNannyFinishContext();
26464 /* "csamtools.pyx":2738
26466 * """mapping quality"""
26467 * def __get__(self): return self._delegate.core.qual # <<<<<<<<<<<<<<
26468 * def __set__(self, qual): self._delegate.core.qual = qual
26472 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mapq___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
26473 PyObject *__pyx_r = NULL;
26474 __Pyx_RefNannyDeclarations
26475 PyObject *__pyx_t_1 = NULL;
26476 int __pyx_lineno = 0;
26477 const char *__pyx_filename = NULL;
26478 int __pyx_clineno = 0;
26479 __Pyx_TraceDeclarations
26480 __Pyx_RefNannySetupContext("__get__", 0);
26481 __Pyx_TraceCall("__get__", __pyx_f[0], 2738);
26482 __Pyx_XDECREF(__pyx_r);
26483 __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_self->_delegate->core.qual); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26484 __Pyx_GOTREF(__pyx_t_1);
26485 __pyx_r = __pyx_t_1;
26489 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26492 __Pyx_XDECREF(__pyx_t_1);
26493 __Pyx_AddTraceback("csamtools.AlignedRead.mapq.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26496 __Pyx_XGIVEREF(__pyx_r);
26497 __Pyx_TraceReturn(__pyx_r);
26498 __Pyx_RefNannyFinishContext();
26502 /* Python wrapper */
26503 static int __pyx_pw_9csamtools_11AlignedRead_4mapq_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual); /*proto*/
26504 static int __pyx_pw_9csamtools_11AlignedRead_4mapq_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual) {
26506 __Pyx_RefNannyDeclarations
26507 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
26508 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4mapq_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_qual));
26509 __Pyx_RefNannyFinishContext();
26513 /* "csamtools.pyx":2739
26514 * """mapping quality"""
26515 * def __get__(self): return self._delegate.core.qual
26516 * def __set__(self, qual): self._delegate.core.qual = qual # <<<<<<<<<<<<<<
26521 static int __pyx_pf_9csamtools_11AlignedRead_4mapq_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_qual) {
26523 __Pyx_RefNannyDeclarations
26524 uint32_t __pyx_t_1;
26525 int __pyx_lineno = 0;
26526 const char *__pyx_filename = NULL;
26527 int __pyx_clineno = 0;
26528 __Pyx_TraceDeclarations
26529 __Pyx_RefNannySetupContext("__set__", 0);
26530 __Pyx_TraceCall("__set__", __pyx_f[0], 2739);
26531 __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_qual); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26532 __pyx_v_self->_delegate->core.qual = __pyx_t_1;
26537 __Pyx_AddTraceback("csamtools.AlignedRead.mapq.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26540 __Pyx_TraceReturn(Py_None);
26541 __Pyx_RefNannyFinishContext();
26545 /* Python wrapper */
26546 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4mrnm_1__get__(PyObject *__pyx_v_self); /*proto*/
26547 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4mrnm_1__get__(PyObject *__pyx_v_self) {
26548 PyObject *__pyx_r = 0;
26549 __Pyx_RefNannyDeclarations
26550 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
26551 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
26552 __Pyx_RefNannyFinishContext();
26556 /* "csamtools.pyx":2745
26557 * deprecated, use RNEXT instead.
26559 * def __get__(self): return self._delegate.core.mtid # <<<<<<<<<<<<<<
26560 * def __set__(self, mtid): self._delegate.core.mtid = mtid
26564 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
26565 PyObject *__pyx_r = NULL;
26566 __Pyx_RefNannyDeclarations
26567 PyObject *__pyx_t_1 = NULL;
26568 int __pyx_lineno = 0;
26569 const char *__pyx_filename = NULL;
26570 int __pyx_clineno = 0;
26571 __Pyx_TraceDeclarations
26572 __Pyx_RefNannySetupContext("__get__", 0);
26573 __Pyx_TraceCall("__get__", __pyx_f[0], 2745);
26574 __Pyx_XDECREF(__pyx_r);
26575 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.mtid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26576 __Pyx_GOTREF(__pyx_t_1);
26577 __pyx_r = __pyx_t_1;
26581 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26584 __Pyx_XDECREF(__pyx_t_1);
26585 __Pyx_AddTraceback("csamtools.AlignedRead.mrnm.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26588 __Pyx_XGIVEREF(__pyx_r);
26589 __Pyx_TraceReturn(__pyx_r);
26590 __Pyx_RefNannyFinishContext();
26594 /* Python wrapper */
26595 static int __pyx_pw_9csamtools_11AlignedRead_4mrnm_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid); /*proto*/
26596 static int __pyx_pw_9csamtools_11AlignedRead_4mrnm_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid) {
26598 __Pyx_RefNannyDeclarations
26599 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
26600 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4mrnm_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_mtid));
26601 __Pyx_RefNannyFinishContext();
26605 /* "csamtools.pyx":2746
26607 * def __get__(self): return self._delegate.core.mtid
26608 * def __set__(self, mtid): self._delegate.core.mtid = mtid # <<<<<<<<<<<<<<
26610 * """the :term:`reference` id of the mate """
26613 static int __pyx_pf_9csamtools_11AlignedRead_4mrnm_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mtid) {
26615 __Pyx_RefNannyDeclarations
26617 int __pyx_lineno = 0;
26618 const char *__pyx_filename = NULL;
26619 int __pyx_clineno = 0;
26620 __Pyx_TraceDeclarations
26621 __Pyx_RefNannySetupContext("__set__", 0);
26622 __Pyx_TraceCall("__set__", __pyx_f[0], 2746);
26623 __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_mtid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26624 __pyx_v_self->_delegate->core.mtid = __pyx_t_1;
26629 __Pyx_AddTraceback("csamtools.AlignedRead.mrnm.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26632 __Pyx_TraceReturn(Py_None);
26633 __Pyx_RefNannyFinishContext();
26637 /* Python wrapper */
26638 static PyObject *__pyx_pw_9csamtools_11AlignedRead_5rnext_1__get__(PyObject *__pyx_v_self); /*proto*/
26639 static PyObject *__pyx_pw_9csamtools_11AlignedRead_5rnext_1__get__(PyObject *__pyx_v_self) {
26640 PyObject *__pyx_r = 0;
26641 __Pyx_RefNannyDeclarations
26642 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
26643 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5rnext___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
26644 __Pyx_RefNannyFinishContext();
26648 /* "csamtools.pyx":2749
26650 * """the :term:`reference` id of the mate """
26651 * def __get__(self): return self._delegate.core.mtid # <<<<<<<<<<<<<<
26652 * def __set__(self, mtid): self._delegate.core.mtid = mtid
26656 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rnext___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
26657 PyObject *__pyx_r = NULL;
26658 __Pyx_RefNannyDeclarations
26659 PyObject *__pyx_t_1 = NULL;
26660 int __pyx_lineno = 0;
26661 const char *__pyx_filename = NULL;
26662 int __pyx_clineno = 0;
26663 __Pyx_TraceDeclarations
26664 __Pyx_RefNannySetupContext("__get__", 0);
26665 __Pyx_TraceCall("__get__", __pyx_f[0], 2749);
26666 __Pyx_XDECREF(__pyx_r);
26667 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.mtid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26668 __Pyx_GOTREF(__pyx_t_1);
26669 __pyx_r = __pyx_t_1;
26673 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26676 __Pyx_XDECREF(__pyx_t_1);
26677 __Pyx_AddTraceback("csamtools.AlignedRead.rnext.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26680 __Pyx_XGIVEREF(__pyx_r);
26681 __Pyx_TraceReturn(__pyx_r);
26682 __Pyx_RefNannyFinishContext();
26686 /* Python wrapper */
26687 static int __pyx_pw_9csamtools_11AlignedRead_5rnext_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid); /*proto*/
26688 static int __pyx_pw_9csamtools_11AlignedRead_5rnext_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid) {
26690 __Pyx_RefNannyDeclarations
26691 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
26692 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5rnext_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_mtid));
26693 __Pyx_RefNannyFinishContext();
26697 /* "csamtools.pyx":2750
26698 * """the :term:`reference` id of the mate """
26699 * def __get__(self): return self._delegate.core.mtid
26700 * def __set__(self, mtid): self._delegate.core.mtid = mtid # <<<<<<<<<<<<<<
26702 * """the position of the mate
26705 static int __pyx_pf_9csamtools_11AlignedRead_5rnext_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mtid) {
26707 __Pyx_RefNannyDeclarations
26709 int __pyx_lineno = 0;
26710 const char *__pyx_filename = NULL;
26711 int __pyx_clineno = 0;
26712 __Pyx_TraceDeclarations
26713 __Pyx_RefNannySetupContext("__set__", 0);
26714 __Pyx_TraceCall("__set__", __pyx_f[0], 2750);
26715 __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_mtid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26716 __pyx_v_self->_delegate->core.mtid = __pyx_t_1;
26721 __Pyx_AddTraceback("csamtools.AlignedRead.rnext.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26724 __Pyx_TraceReturn(Py_None);
26725 __Pyx_RefNannyFinishContext();
26729 /* Python wrapper */
26730 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4mpos_1__get__(PyObject *__pyx_v_self); /*proto*/
26731 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4mpos_1__get__(PyObject *__pyx_v_self) {
26732 PyObject *__pyx_r = 0;
26733 __Pyx_RefNannyDeclarations
26734 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
26735 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4mpos___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
26736 __Pyx_RefNannyFinishContext();
26740 /* "csamtools.pyx":2754
26741 * """the position of the mate
26742 * deprecated, use PNEXT instead."""
26743 * def __get__(self): return self._delegate.core.mpos # <<<<<<<<<<<<<<
26744 * def __set__(self, mpos): self._delegate.core.mpos = mpos
26748 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mpos___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
26749 PyObject *__pyx_r = NULL;
26750 __Pyx_RefNannyDeclarations
26751 PyObject *__pyx_t_1 = NULL;
26752 int __pyx_lineno = 0;
26753 const char *__pyx_filename = NULL;
26754 int __pyx_clineno = 0;
26755 __Pyx_TraceDeclarations
26756 __Pyx_RefNannySetupContext("__get__", 0);
26757 __Pyx_TraceCall("__get__", __pyx_f[0], 2754);
26758 __Pyx_XDECREF(__pyx_r);
26759 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.mpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26760 __Pyx_GOTREF(__pyx_t_1);
26761 __pyx_r = __pyx_t_1;
26765 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26768 __Pyx_XDECREF(__pyx_t_1);
26769 __Pyx_AddTraceback("csamtools.AlignedRead.mpos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26772 __Pyx_XGIVEREF(__pyx_r);
26773 __Pyx_TraceReturn(__pyx_r);
26774 __Pyx_RefNannyFinishContext();
26778 /* Python wrapper */
26779 static int __pyx_pw_9csamtools_11AlignedRead_4mpos_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos); /*proto*/
26780 static int __pyx_pw_9csamtools_11AlignedRead_4mpos_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos) {
26782 __Pyx_RefNannyDeclarations
26783 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
26784 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4mpos_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_mpos));
26785 __Pyx_RefNannyFinishContext();
26789 /* "csamtools.pyx":2755
26790 * deprecated, use PNEXT instead."""
26791 * def __get__(self): return self._delegate.core.mpos
26792 * def __set__(self, mpos): self._delegate.core.mpos = mpos # <<<<<<<<<<<<<<
26794 * """the position of the mate"""
26797 static int __pyx_pf_9csamtools_11AlignedRead_4mpos_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mpos) {
26799 __Pyx_RefNannyDeclarations
26801 int __pyx_lineno = 0;
26802 const char *__pyx_filename = NULL;
26803 int __pyx_clineno = 0;
26804 __Pyx_TraceDeclarations
26805 __Pyx_RefNannySetupContext("__set__", 0);
26806 __Pyx_TraceCall("__set__", __pyx_f[0], 2755);
26807 __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_mpos); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26808 __pyx_v_self->_delegate->core.mpos = __pyx_t_1;
26813 __Pyx_AddTraceback("csamtools.AlignedRead.mpos.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26816 __Pyx_TraceReturn(Py_None);
26817 __Pyx_RefNannyFinishContext();
26821 /* Python wrapper */
26822 static PyObject *__pyx_pw_9csamtools_11AlignedRead_5pnext_1__get__(PyObject *__pyx_v_self); /*proto*/
26823 static PyObject *__pyx_pw_9csamtools_11AlignedRead_5pnext_1__get__(PyObject *__pyx_v_self) {
26824 PyObject *__pyx_r = 0;
26825 __Pyx_RefNannyDeclarations
26826 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
26827 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5pnext___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
26828 __Pyx_RefNannyFinishContext();
26832 /* "csamtools.pyx":2758
26834 * """the position of the mate"""
26835 * def __get__(self): return self._delegate.core.mpos # <<<<<<<<<<<<<<
26836 * def __set__(self, mpos): self._delegate.core.mpos = mpos
26840 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5pnext___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
26841 PyObject *__pyx_r = NULL;
26842 __Pyx_RefNannyDeclarations
26843 PyObject *__pyx_t_1 = NULL;
26844 int __pyx_lineno = 0;
26845 const char *__pyx_filename = NULL;
26846 int __pyx_clineno = 0;
26847 __Pyx_TraceDeclarations
26848 __Pyx_RefNannySetupContext("__get__", 0);
26849 __Pyx_TraceCall("__get__", __pyx_f[0], 2758);
26850 __Pyx_XDECREF(__pyx_r);
26851 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.mpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26852 __Pyx_GOTREF(__pyx_t_1);
26853 __pyx_r = __pyx_t_1;
26857 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26860 __Pyx_XDECREF(__pyx_t_1);
26861 __Pyx_AddTraceback("csamtools.AlignedRead.pnext.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26864 __Pyx_XGIVEREF(__pyx_r);
26865 __Pyx_TraceReturn(__pyx_r);
26866 __Pyx_RefNannyFinishContext();
26870 /* Python wrapper */
26871 static int __pyx_pw_9csamtools_11AlignedRead_5pnext_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos); /*proto*/
26872 static int __pyx_pw_9csamtools_11AlignedRead_5pnext_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos) {
26874 __Pyx_RefNannyDeclarations
26875 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
26876 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5pnext_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_mpos));
26877 __Pyx_RefNannyFinishContext();
26881 /* "csamtools.pyx":2759
26882 * """the position of the mate"""
26883 * def __get__(self): return self._delegate.core.mpos
26884 * def __set__(self, mpos): self._delegate.core.mpos = mpos # <<<<<<<<<<<<<<
26886 * """the insert size
26889 static int __pyx_pf_9csamtools_11AlignedRead_5pnext_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_mpos) {
26891 __Pyx_RefNannyDeclarations
26893 int __pyx_lineno = 0;
26894 const char *__pyx_filename = NULL;
26895 int __pyx_clineno = 0;
26896 __Pyx_TraceDeclarations
26897 __Pyx_RefNannySetupContext("__set__", 0);
26898 __Pyx_TraceCall("__set__", __pyx_f[0], 2759);
26899 __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_mpos); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26900 __pyx_v_self->_delegate->core.mpos = __pyx_t_1;
26905 __Pyx_AddTraceback("csamtools.AlignedRead.pnext.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26908 __Pyx_TraceReturn(Py_None);
26909 __Pyx_RefNannyFinishContext();
26913 /* Python wrapper */
26914 static PyObject *__pyx_pw_9csamtools_11AlignedRead_5isize_1__get__(PyObject *__pyx_v_self); /*proto*/
26915 static PyObject *__pyx_pw_9csamtools_11AlignedRead_5isize_1__get__(PyObject *__pyx_v_self) {
26916 PyObject *__pyx_r = 0;
26917 __Pyx_RefNannyDeclarations
26918 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
26919 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5isize___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
26920 __Pyx_RefNannyFinishContext();
26924 /* "csamtools.pyx":2763
26925 * """the insert size
26926 * deprecated: use tlen instead"""
26927 * def __get__(self): return self._delegate.core.isize # <<<<<<<<<<<<<<
26928 * def __set__(self, isize): self._delegate.core.isize = isize
26932 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5isize___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
26933 PyObject *__pyx_r = NULL;
26934 __Pyx_RefNannyDeclarations
26935 PyObject *__pyx_t_1 = NULL;
26936 int __pyx_lineno = 0;
26937 const char *__pyx_filename = NULL;
26938 int __pyx_clineno = 0;
26939 __Pyx_TraceDeclarations
26940 __Pyx_RefNannySetupContext("__get__", 0);
26941 __Pyx_TraceCall("__get__", __pyx_f[0], 2763);
26942 __Pyx_XDECREF(__pyx_r);
26943 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.isize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26944 __Pyx_GOTREF(__pyx_t_1);
26945 __pyx_r = __pyx_t_1;
26949 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26952 __Pyx_XDECREF(__pyx_t_1);
26953 __Pyx_AddTraceback("csamtools.AlignedRead.isize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26956 __Pyx_XGIVEREF(__pyx_r);
26957 __Pyx_TraceReturn(__pyx_r);
26958 __Pyx_RefNannyFinishContext();
26962 /* Python wrapper */
26963 static int __pyx_pw_9csamtools_11AlignedRead_5isize_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize); /*proto*/
26964 static int __pyx_pw_9csamtools_11AlignedRead_5isize_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize) {
26966 __Pyx_RefNannyDeclarations
26967 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
26968 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_5isize_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_isize));
26969 __Pyx_RefNannyFinishContext();
26973 /* "csamtools.pyx":2764
26974 * deprecated: use tlen instead"""
26975 * def __get__(self): return self._delegate.core.isize
26976 * def __set__(self, isize): self._delegate.core.isize = isize # <<<<<<<<<<<<<<
26978 * """the insert size"""
26981 static int __pyx_pf_9csamtools_11AlignedRead_5isize_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_isize) {
26983 __Pyx_RefNannyDeclarations
26985 int __pyx_lineno = 0;
26986 const char *__pyx_filename = NULL;
26987 int __pyx_clineno = 0;
26988 __Pyx_TraceDeclarations
26989 __Pyx_RefNannySetupContext("__set__", 0);
26990 __Pyx_TraceCall("__set__", __pyx_f[0], 2764);
26991 __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_isize); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26992 __pyx_v_self->_delegate->core.isize = __pyx_t_1;
26997 __Pyx_AddTraceback("csamtools.AlignedRead.isize.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27000 __Pyx_TraceReturn(Py_None);
27001 __Pyx_RefNannyFinishContext();
27005 /* Python wrapper */
27006 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4tlen_1__get__(PyObject *__pyx_v_self); /*proto*/
27007 static PyObject *__pyx_pw_9csamtools_11AlignedRead_4tlen_1__get__(PyObject *__pyx_v_self) {
27008 PyObject *__pyx_r = 0;
27009 __Pyx_RefNannyDeclarations
27010 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
27011 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4tlen___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
27012 __Pyx_RefNannyFinishContext();
27016 /* "csamtools.pyx":2767
27018 * """the insert size"""
27019 * def __get__(self): return self._delegate.core.isize # <<<<<<<<<<<<<<
27020 * def __set__(self, isize): self._delegate.core.isize = isize
27021 * property is_paired:
27024 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tlen___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
27025 PyObject *__pyx_r = NULL;
27026 __Pyx_RefNannyDeclarations
27027 PyObject *__pyx_t_1 = NULL;
27028 int __pyx_lineno = 0;
27029 const char *__pyx_filename = NULL;
27030 int __pyx_clineno = 0;
27031 __Pyx_TraceDeclarations
27032 __Pyx_RefNannySetupContext("__get__", 0);
27033 __Pyx_TraceCall("__get__", __pyx_f[0], 2767);
27034 __Pyx_XDECREF(__pyx_r);
27035 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_delegate->core.isize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27036 __Pyx_GOTREF(__pyx_t_1);
27037 __pyx_r = __pyx_t_1;
27041 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
27044 __Pyx_XDECREF(__pyx_t_1);
27045 __Pyx_AddTraceback("csamtools.AlignedRead.tlen.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27048 __Pyx_XGIVEREF(__pyx_r);
27049 __Pyx_TraceReturn(__pyx_r);
27050 __Pyx_RefNannyFinishContext();
27054 /* Python wrapper */
27055 static int __pyx_pw_9csamtools_11AlignedRead_4tlen_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize); /*proto*/
27056 static int __pyx_pw_9csamtools_11AlignedRead_4tlen_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize) {
27058 __Pyx_RefNannyDeclarations
27059 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
27060 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_4tlen_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_isize));
27061 __Pyx_RefNannyFinishContext();
27065 /* "csamtools.pyx":2768
27066 * """the insert size"""
27067 * def __get__(self): return self._delegate.core.isize
27068 * def __set__(self, isize): self._delegate.core.isize = isize # <<<<<<<<<<<<<<
27069 * property is_paired:
27070 * """true if read is paired in sequencing"""
27073 static int __pyx_pf_9csamtools_11AlignedRead_4tlen_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_isize) {
27075 __Pyx_RefNannyDeclarations
27077 int __pyx_lineno = 0;
27078 const char *__pyx_filename = NULL;
27079 int __pyx_clineno = 0;
27080 __Pyx_TraceDeclarations
27081 __Pyx_RefNannySetupContext("__set__", 0);
27082 __Pyx_TraceCall("__set__", __pyx_f[0], 2768);
27083 __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_isize); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27084 __pyx_v_self->_delegate->core.isize = __pyx_t_1;
27089 __Pyx_AddTraceback("csamtools.AlignedRead.tlen.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27092 __Pyx_TraceReturn(Py_None);
27093 __Pyx_RefNannyFinishContext();
27097 /* Python wrapper */
27098 static PyObject *__pyx_pw_9csamtools_11AlignedRead_9is_paired_1__get__(PyObject *__pyx_v_self); /*proto*/
27099 static PyObject *__pyx_pw_9csamtools_11AlignedRead_9is_paired_1__get__(PyObject *__pyx_v_self) {
27100 PyObject *__pyx_r = 0;
27101 __Pyx_RefNannyDeclarations
27102 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
27103 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
27104 __Pyx_RefNannyFinishContext();
27108 /* "csamtools.pyx":2771
27109 * property is_paired:
27110 * """true if read is paired in sequencing"""
27111 * def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0 # <<<<<<<<<<<<<<
27112 * def __set__(self,val):
27113 * if val: self._delegate.core.flag |= BAM_FPAIRED
27116 static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
27117 PyObject *__pyx_r = NULL;
27118 __Pyx_RefNannyDeclarations
27119 PyObject *__pyx_t_1 = NULL;
27120 int __pyx_lineno = 0;
27121 const char *__pyx_filename = NULL;
27122 int __pyx_clineno = 0;
27123 __Pyx_TraceDeclarations
27124 __Pyx_RefNannySetupContext("__get__", 0);
27125 __Pyx_TraceCall("__get__", __pyx_f[0], 2771);
27126 __Pyx_XDECREF(__pyx_r);
27127 __pyx_t_1 = __Pyx_PyBool_FromLong(((__pyx_v_self->_delegate->core.flag & 1) != 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27128 __Pyx_GOTREF(__pyx_t_1);
27129 __pyx_r = __pyx_t_1;
27133 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
27136 __Pyx_XDECREF(__pyx_t_1);
27137 __Pyx_AddTraceback("csamtools.AlignedRead.is_paired.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27140 __Pyx_XGIVEREF(__pyx_r);
27141 __Pyx_TraceReturn(__pyx_r);
27142 __Pyx_RefNannyFinishContext();
27146 /* Python wrapper */
27147 static int __pyx_pw_9csamtools_11AlignedRead_9is_paired_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
27148 static int __pyx_pw_9csamtools_11AlignedRead_9is_paired_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
27150 __Pyx_RefNannyDeclarations
27151 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
27152 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_9is_paired_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
27153 __Pyx_RefNannyFinishContext();
27157 /* "csamtools.pyx":2772
27158 * """true if read is paired in sequencing"""
27159 * def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0
27160 * def __set__(self,val): # <<<<<<<<<<<<<<
27161 * if val: self._delegate.core.flag |= BAM_FPAIRED
27162 * else: self._delegate.core.flag &= ~BAM_FPAIRED
27165 static int __pyx_pf_9csamtools_11AlignedRead_9is_paired_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
27167 __Pyx_RefNannyDeclarations
27169 int __pyx_lineno = 0;
27170 const char *__pyx_filename = NULL;
27171 int __pyx_clineno = 0;
27172 __Pyx_TraceDeclarations
27173 __Pyx_RefNannySetupContext("__set__", 0);
27174 __Pyx_TraceCall("__set__", __pyx_f[0], 2772);
27176 /* "csamtools.pyx":2773
27177 * def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0
27178 * def __set__(self,val):
27179 * if val: self._delegate.core.flag |= BAM_FPAIRED # <<<<<<<<<<<<<<
27180 * else: self._delegate.core.flag &= ~BAM_FPAIRED
27181 * property is_proper_pair:
27183 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27185 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 1);
27190 /* "csamtools.pyx":2774
27191 * def __set__(self,val):
27192 * if val: self._delegate.core.flag |= BAM_FPAIRED
27193 * else: self._delegate.core.flag &= ~BAM_FPAIRED # <<<<<<<<<<<<<<
27194 * property is_proper_pair:
27195 * """true if read is mapped in a proper pair"""
27197 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~1));
27204 __Pyx_AddTraceback("csamtools.AlignedRead.is_paired.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27207 __Pyx_TraceReturn(Py_None);
27208 __Pyx_RefNannyFinishContext();
27212 /* Python wrapper */
27213 static PyObject *__pyx_pw_9csamtools_11AlignedRead_14is_proper_pair_1__get__(PyObject *__pyx_v_self); /*proto*/
27214 static PyObject *__pyx_pw_9csamtools_11AlignedRead_14is_proper_pair_1__get__(PyObject *__pyx_v_self) {
27215 PyObject *__pyx_r = 0;
27216 __Pyx_RefNannyDeclarations
27217 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
27218 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
27219 __Pyx_RefNannyFinishContext();
27223 /* "csamtools.pyx":2777
27224 * property is_proper_pair:
27225 * """true if read is mapped in a proper pair"""
27226 * def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0 # <<<<<<<<<<<<<<
27227 * def __set__(self,val):
27228 * if val: self._delegate.core.flag |= BAM_FPROPER_PAIR
27231 static PyObject *__pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
27232 PyObject *__pyx_r = NULL;
27233 __Pyx_RefNannyDeclarations
27234 PyObject *__pyx_t_1 = NULL;
27235 PyObject *__pyx_t_2 = NULL;
27236 int __pyx_lineno = 0;
27237 const char *__pyx_filename = NULL;
27238 int __pyx_clineno = 0;
27239 __Pyx_TraceDeclarations
27240 __Pyx_RefNannySetupContext("__get__", 0);
27241 __Pyx_TraceCall("__get__", __pyx_f[0], 2777);
27242 __Pyx_XDECREF(__pyx_r);
27243 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27244 __Pyx_GOTREF(__pyx_t_1);
27245 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27246 __Pyx_GOTREF(__pyx_t_2);
27247 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27248 __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27249 __Pyx_GOTREF(__pyx_t_1);
27250 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27251 __pyx_r = __pyx_t_1;
27255 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
27258 __Pyx_XDECREF(__pyx_t_1);
27259 __Pyx_XDECREF(__pyx_t_2);
27260 __Pyx_AddTraceback("csamtools.AlignedRead.is_proper_pair.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27263 __Pyx_XGIVEREF(__pyx_r);
27264 __Pyx_TraceReturn(__pyx_r);
27265 __Pyx_RefNannyFinishContext();
27269 /* Python wrapper */
27270 static int __pyx_pw_9csamtools_11AlignedRead_14is_proper_pair_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
27271 static int __pyx_pw_9csamtools_11AlignedRead_14is_proper_pair_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
27273 __Pyx_RefNannyDeclarations
27274 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
27275 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
27276 __Pyx_RefNannyFinishContext();
27280 /* "csamtools.pyx":2778
27281 * """true if read is mapped in a proper pair"""
27282 * def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0
27283 * def __set__(self,val): # <<<<<<<<<<<<<<
27284 * if val: self._delegate.core.flag |= BAM_FPROPER_PAIR
27285 * else: self._delegate.core.flag &= ~BAM_FPROPER_PAIR
27288 static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
27290 __Pyx_RefNannyDeclarations
27292 int __pyx_lineno = 0;
27293 const char *__pyx_filename = NULL;
27294 int __pyx_clineno = 0;
27295 __Pyx_TraceDeclarations
27296 __Pyx_RefNannySetupContext("__set__", 0);
27297 __Pyx_TraceCall("__set__", __pyx_f[0], 2778);
27299 /* "csamtools.pyx":2779
27300 * def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0
27301 * def __set__(self,val):
27302 * if val: self._delegate.core.flag |= BAM_FPROPER_PAIR # <<<<<<<<<<<<<<
27303 * else: self._delegate.core.flag &= ~BAM_FPROPER_PAIR
27304 * property is_unmapped:
27306 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27308 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 2);
27313 /* "csamtools.pyx":2780
27314 * def __set__(self,val):
27315 * if val: self._delegate.core.flag |= BAM_FPROPER_PAIR
27316 * else: self._delegate.core.flag &= ~BAM_FPROPER_PAIR # <<<<<<<<<<<<<<
27317 * property is_unmapped:
27318 * """true if read itself is unmapped"""
27320 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~2));
27327 __Pyx_AddTraceback("csamtools.AlignedRead.is_proper_pair.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27330 __Pyx_TraceReturn(Py_None);
27331 __Pyx_RefNannyFinishContext();
27335 /* Python wrapper */
27336 static PyObject *__pyx_pw_9csamtools_11AlignedRead_11is_unmapped_1__get__(PyObject *__pyx_v_self); /*proto*/
27337 static PyObject *__pyx_pw_9csamtools_11AlignedRead_11is_unmapped_1__get__(PyObject *__pyx_v_self) {
27338 PyObject *__pyx_r = 0;
27339 __Pyx_RefNannyDeclarations
27340 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
27341 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
27342 __Pyx_RefNannyFinishContext();
27346 /* "csamtools.pyx":2783
27347 * property is_unmapped:
27348 * """true if read itself is unmapped"""
27349 * def __get__(self): return (self.flag & BAM_FUNMAP) != 0 # <<<<<<<<<<<<<<
27350 * def __set__(self,val):
27351 * if val: self._delegate.core.flag |= BAM_FUNMAP
27354 static PyObject *__pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
27355 PyObject *__pyx_r = NULL;
27356 __Pyx_RefNannyDeclarations
27357 PyObject *__pyx_t_1 = NULL;
27358 PyObject *__pyx_t_2 = NULL;
27359 int __pyx_lineno = 0;
27360 const char *__pyx_filename = NULL;
27361 int __pyx_clineno = 0;
27362 __Pyx_TraceDeclarations
27363 __Pyx_RefNannySetupContext("__get__", 0);
27364 __Pyx_TraceCall("__get__", __pyx_f[0], 2783);
27365 __Pyx_XDECREF(__pyx_r);
27366 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27367 __Pyx_GOTREF(__pyx_t_1);
27368 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27369 __Pyx_GOTREF(__pyx_t_2);
27370 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27371 __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27372 __Pyx_GOTREF(__pyx_t_1);
27373 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27374 __pyx_r = __pyx_t_1;
27378 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
27381 __Pyx_XDECREF(__pyx_t_1);
27382 __Pyx_XDECREF(__pyx_t_2);
27383 __Pyx_AddTraceback("csamtools.AlignedRead.is_unmapped.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27386 __Pyx_XGIVEREF(__pyx_r);
27387 __Pyx_TraceReturn(__pyx_r);
27388 __Pyx_RefNannyFinishContext();
27392 /* Python wrapper */
27393 static int __pyx_pw_9csamtools_11AlignedRead_11is_unmapped_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
27394 static int __pyx_pw_9csamtools_11AlignedRead_11is_unmapped_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
27396 __Pyx_RefNannyDeclarations
27397 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
27398 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
27399 __Pyx_RefNannyFinishContext();
27403 /* "csamtools.pyx":2784
27404 * """true if read itself is unmapped"""
27405 * def __get__(self): return (self.flag & BAM_FUNMAP) != 0
27406 * def __set__(self,val): # <<<<<<<<<<<<<<
27407 * if val: self._delegate.core.flag |= BAM_FUNMAP
27408 * else: self._delegate.core.flag &= ~BAM_FUNMAP
27411 static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
27413 __Pyx_RefNannyDeclarations
27415 int __pyx_lineno = 0;
27416 const char *__pyx_filename = NULL;
27417 int __pyx_clineno = 0;
27418 __Pyx_TraceDeclarations
27419 __Pyx_RefNannySetupContext("__set__", 0);
27420 __Pyx_TraceCall("__set__", __pyx_f[0], 2784);
27422 /* "csamtools.pyx":2785
27423 * def __get__(self): return (self.flag & BAM_FUNMAP) != 0
27424 * def __set__(self,val):
27425 * if val: self._delegate.core.flag |= BAM_FUNMAP # <<<<<<<<<<<<<<
27426 * else: self._delegate.core.flag &= ~BAM_FUNMAP
27427 * property mate_is_unmapped:
27429 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27431 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 4);
27436 /* "csamtools.pyx":2786
27437 * def __set__(self,val):
27438 * if val: self._delegate.core.flag |= BAM_FUNMAP
27439 * else: self._delegate.core.flag &= ~BAM_FUNMAP # <<<<<<<<<<<<<<
27440 * property mate_is_unmapped:
27441 * """true if the mate is unmapped"""
27443 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~4));
27450 __Pyx_AddTraceback("csamtools.AlignedRead.is_unmapped.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27453 __Pyx_TraceReturn(Py_None);
27454 __Pyx_RefNannyFinishContext();
27458 /* Python wrapper */
27459 static PyObject *__pyx_pw_9csamtools_11AlignedRead_16mate_is_unmapped_1__get__(PyObject *__pyx_v_self); /*proto*/
27460 static PyObject *__pyx_pw_9csamtools_11AlignedRead_16mate_is_unmapped_1__get__(PyObject *__pyx_v_self) {
27461 PyObject *__pyx_r = 0;
27462 __Pyx_RefNannyDeclarations
27463 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
27464 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
27465 __Pyx_RefNannyFinishContext();
27469 /* "csamtools.pyx":2789
27470 * property mate_is_unmapped:
27471 * """true if the mate is unmapped"""
27472 * def __get__(self): return (self.flag & BAM_FMUNMAP) != 0 # <<<<<<<<<<<<<<
27473 * def __set__(self,val):
27474 * if val: self._delegate.core.flag |= BAM_FMUNMAP
27477 static PyObject *__pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
27478 PyObject *__pyx_r = NULL;
27479 __Pyx_RefNannyDeclarations
27480 PyObject *__pyx_t_1 = NULL;
27481 PyObject *__pyx_t_2 = NULL;
27482 int __pyx_lineno = 0;
27483 const char *__pyx_filename = NULL;
27484 int __pyx_clineno = 0;
27485 __Pyx_TraceDeclarations
27486 __Pyx_RefNannySetupContext("__get__", 0);
27487 __Pyx_TraceCall("__get__", __pyx_f[0], 2789);
27488 __Pyx_XDECREF(__pyx_r);
27489 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27490 __Pyx_GOTREF(__pyx_t_1);
27491 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27492 __Pyx_GOTREF(__pyx_t_2);
27493 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27494 __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27495 __Pyx_GOTREF(__pyx_t_1);
27496 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27497 __pyx_r = __pyx_t_1;
27501 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
27504 __Pyx_XDECREF(__pyx_t_1);
27505 __Pyx_XDECREF(__pyx_t_2);
27506 __Pyx_AddTraceback("csamtools.AlignedRead.mate_is_unmapped.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27509 __Pyx_XGIVEREF(__pyx_r);
27510 __Pyx_TraceReturn(__pyx_r);
27511 __Pyx_RefNannyFinishContext();
27515 /* Python wrapper */
27516 static int __pyx_pw_9csamtools_11AlignedRead_16mate_is_unmapped_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
27517 static int __pyx_pw_9csamtools_11AlignedRead_16mate_is_unmapped_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
27519 __Pyx_RefNannyDeclarations
27520 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
27521 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
27522 __Pyx_RefNannyFinishContext();
27526 /* "csamtools.pyx":2790
27527 * """true if the mate is unmapped"""
27528 * def __get__(self): return (self.flag & BAM_FMUNMAP) != 0
27529 * def __set__(self,val): # <<<<<<<<<<<<<<
27530 * if val: self._delegate.core.flag |= BAM_FMUNMAP
27531 * else: self._delegate.core.flag &= ~BAM_FMUNMAP
27534 static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
27536 __Pyx_RefNannyDeclarations
27538 int __pyx_lineno = 0;
27539 const char *__pyx_filename = NULL;
27540 int __pyx_clineno = 0;
27541 __Pyx_TraceDeclarations
27542 __Pyx_RefNannySetupContext("__set__", 0);
27543 __Pyx_TraceCall("__set__", __pyx_f[0], 2790);
27545 /* "csamtools.pyx":2791
27546 * def __get__(self): return (self.flag & BAM_FMUNMAP) != 0
27547 * def __set__(self,val):
27548 * if val: self._delegate.core.flag |= BAM_FMUNMAP # <<<<<<<<<<<<<<
27549 * else: self._delegate.core.flag &= ~BAM_FMUNMAP
27550 * property is_reverse:
27552 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27554 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 8);
27559 /* "csamtools.pyx":2792
27560 * def __set__(self,val):
27561 * if val: self._delegate.core.flag |= BAM_FMUNMAP
27562 * else: self._delegate.core.flag &= ~BAM_FMUNMAP # <<<<<<<<<<<<<<
27563 * property is_reverse:
27564 * """true if read is mapped to reverse strand"""
27566 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~8));
27573 __Pyx_AddTraceback("csamtools.AlignedRead.mate_is_unmapped.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27576 __Pyx_TraceReturn(Py_None);
27577 __Pyx_RefNannyFinishContext();
27581 /* Python wrapper */
27582 static PyObject *__pyx_pw_9csamtools_11AlignedRead_10is_reverse_1__get__(PyObject *__pyx_v_self); /*proto*/
27583 static PyObject *__pyx_pw_9csamtools_11AlignedRead_10is_reverse_1__get__(PyObject *__pyx_v_self) {
27584 PyObject *__pyx_r = 0;
27585 __Pyx_RefNannyDeclarations
27586 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
27587 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
27588 __Pyx_RefNannyFinishContext();
27592 /* "csamtools.pyx":2795
27593 * property is_reverse:
27594 * """true if read is mapped to reverse strand"""
27595 * def __get__(self): return (self.flag & BAM_FREVERSE) != 0 # <<<<<<<<<<<<<<
27596 * def __set__(self,val):
27597 * if val: self._delegate.core.flag |= BAM_FREVERSE
27600 static PyObject *__pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
27601 PyObject *__pyx_r = NULL;
27602 __Pyx_RefNannyDeclarations
27603 PyObject *__pyx_t_1 = NULL;
27604 PyObject *__pyx_t_2 = NULL;
27605 int __pyx_lineno = 0;
27606 const char *__pyx_filename = NULL;
27607 int __pyx_clineno = 0;
27608 __Pyx_TraceDeclarations
27609 __Pyx_RefNannySetupContext("__get__", 0);
27610 __Pyx_TraceCall("__get__", __pyx_f[0], 2795);
27611 __Pyx_XDECREF(__pyx_r);
27612 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27613 __Pyx_GOTREF(__pyx_t_1);
27614 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_16); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27615 __Pyx_GOTREF(__pyx_t_2);
27616 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27617 __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27618 __Pyx_GOTREF(__pyx_t_1);
27619 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27620 __pyx_r = __pyx_t_1;
27624 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
27627 __Pyx_XDECREF(__pyx_t_1);
27628 __Pyx_XDECREF(__pyx_t_2);
27629 __Pyx_AddTraceback("csamtools.AlignedRead.is_reverse.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27632 __Pyx_XGIVEREF(__pyx_r);
27633 __Pyx_TraceReturn(__pyx_r);
27634 __Pyx_RefNannyFinishContext();
27638 /* Python wrapper */
27639 static int __pyx_pw_9csamtools_11AlignedRead_10is_reverse_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
27640 static int __pyx_pw_9csamtools_11AlignedRead_10is_reverse_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
27642 __Pyx_RefNannyDeclarations
27643 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
27644 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_10is_reverse_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
27645 __Pyx_RefNannyFinishContext();
27649 /* "csamtools.pyx":2796
27650 * """true if read is mapped to reverse strand"""
27651 * def __get__(self): return (self.flag & BAM_FREVERSE) != 0
27652 * def __set__(self,val): # <<<<<<<<<<<<<<
27653 * if val: self._delegate.core.flag |= BAM_FREVERSE
27654 * else: self._delegate.core.flag &= ~BAM_FREVERSE
27657 static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
27659 __Pyx_RefNannyDeclarations
27661 int __pyx_lineno = 0;
27662 const char *__pyx_filename = NULL;
27663 int __pyx_clineno = 0;
27664 __Pyx_TraceDeclarations
27665 __Pyx_RefNannySetupContext("__set__", 0);
27666 __Pyx_TraceCall("__set__", __pyx_f[0], 2796);
27668 /* "csamtools.pyx":2797
27669 * def __get__(self): return (self.flag & BAM_FREVERSE) != 0
27670 * def __set__(self,val):
27671 * if val: self._delegate.core.flag |= BAM_FREVERSE # <<<<<<<<<<<<<<
27672 * else: self._delegate.core.flag &= ~BAM_FREVERSE
27673 * property mate_is_reverse:
27675 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27677 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 16);
27682 /* "csamtools.pyx":2798
27683 * def __set__(self,val):
27684 * if val: self._delegate.core.flag |= BAM_FREVERSE
27685 * else: self._delegate.core.flag &= ~BAM_FREVERSE # <<<<<<<<<<<<<<
27686 * property mate_is_reverse:
27687 * """true is read is mapped to reverse strand"""
27689 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~16));
27696 __Pyx_AddTraceback("csamtools.AlignedRead.is_reverse.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27699 __Pyx_TraceReturn(Py_None);
27700 __Pyx_RefNannyFinishContext();
27704 /* Python wrapper */
27705 static PyObject *__pyx_pw_9csamtools_11AlignedRead_15mate_is_reverse_1__get__(PyObject *__pyx_v_self); /*proto*/
27706 static PyObject *__pyx_pw_9csamtools_11AlignedRead_15mate_is_reverse_1__get__(PyObject *__pyx_v_self) {
27707 PyObject *__pyx_r = 0;
27708 __Pyx_RefNannyDeclarations
27709 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
27710 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
27711 __Pyx_RefNannyFinishContext();
27715 /* "csamtools.pyx":2801
27716 * property mate_is_reverse:
27717 * """true is read is mapped to reverse strand"""
27718 * def __get__(self): return (self.flag & BAM_FMREVERSE) != 0 # <<<<<<<<<<<<<<
27719 * def __set__(self,val):
27720 * if val: self._delegate.core.flag |= BAM_FMREVERSE
27723 static PyObject *__pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
27724 PyObject *__pyx_r = NULL;
27725 __Pyx_RefNannyDeclarations
27726 PyObject *__pyx_t_1 = NULL;
27727 PyObject *__pyx_t_2 = NULL;
27728 int __pyx_lineno = 0;
27729 const char *__pyx_filename = NULL;
27730 int __pyx_clineno = 0;
27731 __Pyx_TraceDeclarations
27732 __Pyx_RefNannySetupContext("__get__", 0);
27733 __Pyx_TraceCall("__get__", __pyx_f[0], 2801);
27734 __Pyx_XDECREF(__pyx_r);
27735 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27736 __Pyx_GOTREF(__pyx_t_1);
27737 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27738 __Pyx_GOTREF(__pyx_t_2);
27739 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27740 __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27741 __Pyx_GOTREF(__pyx_t_1);
27742 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27743 __pyx_r = __pyx_t_1;
27747 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
27750 __Pyx_XDECREF(__pyx_t_1);
27751 __Pyx_XDECREF(__pyx_t_2);
27752 __Pyx_AddTraceback("csamtools.AlignedRead.mate_is_reverse.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27755 __Pyx_XGIVEREF(__pyx_r);
27756 __Pyx_TraceReturn(__pyx_r);
27757 __Pyx_RefNannyFinishContext();
27761 /* Python wrapper */
27762 static int __pyx_pw_9csamtools_11AlignedRead_15mate_is_reverse_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
27763 static int __pyx_pw_9csamtools_11AlignedRead_15mate_is_reverse_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
27765 __Pyx_RefNannyDeclarations
27766 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
27767 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
27768 __Pyx_RefNannyFinishContext();
27772 /* "csamtools.pyx":2802
27773 * """true is read is mapped to reverse strand"""
27774 * def __get__(self): return (self.flag & BAM_FMREVERSE) != 0
27775 * def __set__(self,val): # <<<<<<<<<<<<<<
27776 * if val: self._delegate.core.flag |= BAM_FMREVERSE
27777 * else: self._delegate.core.flag &= ~BAM_FMREVERSE
27780 static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
27782 __Pyx_RefNannyDeclarations
27784 int __pyx_lineno = 0;
27785 const char *__pyx_filename = NULL;
27786 int __pyx_clineno = 0;
27787 __Pyx_TraceDeclarations
27788 __Pyx_RefNannySetupContext("__set__", 0);
27789 __Pyx_TraceCall("__set__", __pyx_f[0], 2802);
27791 /* "csamtools.pyx":2803
27792 * def __get__(self): return (self.flag & BAM_FMREVERSE) != 0
27793 * def __set__(self,val):
27794 * if val: self._delegate.core.flag |= BAM_FMREVERSE # <<<<<<<<<<<<<<
27795 * else: self._delegate.core.flag &= ~BAM_FMREVERSE
27796 * property is_read1:
27798 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27800 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 32);
27805 /* "csamtools.pyx":2804
27806 * def __set__(self,val):
27807 * if val: self._delegate.core.flag |= BAM_FMREVERSE
27808 * else: self._delegate.core.flag &= ~BAM_FMREVERSE # <<<<<<<<<<<<<<
27809 * property is_read1:
27810 * """true if this is read1"""
27812 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~32));
27819 __Pyx_AddTraceback("csamtools.AlignedRead.mate_is_reverse.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27822 __Pyx_TraceReturn(Py_None);
27823 __Pyx_RefNannyFinishContext();
27827 /* Python wrapper */
27828 static PyObject *__pyx_pw_9csamtools_11AlignedRead_8is_read1_1__get__(PyObject *__pyx_v_self); /*proto*/
27829 static PyObject *__pyx_pw_9csamtools_11AlignedRead_8is_read1_1__get__(PyObject *__pyx_v_self) {
27830 PyObject *__pyx_r = 0;
27831 __Pyx_RefNannyDeclarations
27832 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
27833 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
27834 __Pyx_RefNannyFinishContext();
27838 /* "csamtools.pyx":2807
27839 * property is_read1:
27840 * """true if this is read1"""
27841 * def __get__(self): return (self.flag & BAM_FREAD1) != 0 # <<<<<<<<<<<<<<
27842 * def __set__(self,val):
27843 * if val: self._delegate.core.flag |= BAM_FREAD1
27846 static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
27847 PyObject *__pyx_r = NULL;
27848 __Pyx_RefNannyDeclarations
27849 PyObject *__pyx_t_1 = NULL;
27850 PyObject *__pyx_t_2 = NULL;
27851 int __pyx_lineno = 0;
27852 const char *__pyx_filename = NULL;
27853 int __pyx_clineno = 0;
27854 __Pyx_TraceDeclarations
27855 __Pyx_RefNannySetupContext("__get__", 0);
27856 __Pyx_TraceCall("__get__", __pyx_f[0], 2807);
27857 __Pyx_XDECREF(__pyx_r);
27858 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27859 __Pyx_GOTREF(__pyx_t_1);
27860 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27861 __Pyx_GOTREF(__pyx_t_2);
27862 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27863 __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27864 __Pyx_GOTREF(__pyx_t_1);
27865 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27866 __pyx_r = __pyx_t_1;
27870 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
27873 __Pyx_XDECREF(__pyx_t_1);
27874 __Pyx_XDECREF(__pyx_t_2);
27875 __Pyx_AddTraceback("csamtools.AlignedRead.is_read1.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27878 __Pyx_XGIVEREF(__pyx_r);
27879 __Pyx_TraceReturn(__pyx_r);
27880 __Pyx_RefNannyFinishContext();
27884 /* Python wrapper */
27885 static int __pyx_pw_9csamtools_11AlignedRead_8is_read1_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
27886 static int __pyx_pw_9csamtools_11AlignedRead_8is_read1_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
27888 __Pyx_RefNannyDeclarations
27889 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
27890 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_8is_read1_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
27891 __Pyx_RefNannyFinishContext();
27895 /* "csamtools.pyx":2808
27896 * """true if this is read1"""
27897 * def __get__(self): return (self.flag & BAM_FREAD1) != 0
27898 * def __set__(self,val): # <<<<<<<<<<<<<<
27899 * if val: self._delegate.core.flag |= BAM_FREAD1
27900 * else: self._delegate.core.flag &= ~BAM_FREAD1
27903 static int __pyx_pf_9csamtools_11AlignedRead_8is_read1_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
27905 __Pyx_RefNannyDeclarations
27907 int __pyx_lineno = 0;
27908 const char *__pyx_filename = NULL;
27909 int __pyx_clineno = 0;
27910 __Pyx_TraceDeclarations
27911 __Pyx_RefNannySetupContext("__set__", 0);
27912 __Pyx_TraceCall("__set__", __pyx_f[0], 2808);
27914 /* "csamtools.pyx":2809
27915 * def __get__(self): return (self.flag & BAM_FREAD1) != 0
27916 * def __set__(self,val):
27917 * if val: self._delegate.core.flag |= BAM_FREAD1 # <<<<<<<<<<<<<<
27918 * else: self._delegate.core.flag &= ~BAM_FREAD1
27919 * property is_read2:
27921 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27923 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 64);
27928 /* "csamtools.pyx":2810
27929 * def __set__(self,val):
27930 * if val: self._delegate.core.flag |= BAM_FREAD1
27931 * else: self._delegate.core.flag &= ~BAM_FREAD1 # <<<<<<<<<<<<<<
27932 * property is_read2:
27933 * """true if this is read2"""
27935 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~64));
27942 __Pyx_AddTraceback("csamtools.AlignedRead.is_read1.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27945 __Pyx_TraceReturn(Py_None);
27946 __Pyx_RefNannyFinishContext();
27950 /* Python wrapper */
27951 static PyObject *__pyx_pw_9csamtools_11AlignedRead_8is_read2_1__get__(PyObject *__pyx_v_self); /*proto*/
27952 static PyObject *__pyx_pw_9csamtools_11AlignedRead_8is_read2_1__get__(PyObject *__pyx_v_self) {
27953 PyObject *__pyx_r = 0;
27954 __Pyx_RefNannyDeclarations
27955 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
27956 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
27957 __Pyx_RefNannyFinishContext();
27961 /* "csamtools.pyx":2813
27962 * property is_read2:
27963 * """true if this is read2"""
27964 * def __get__(self): return (self.flag & BAM_FREAD2) != 0 # <<<<<<<<<<<<<<
27965 * def __set__(self,val):
27966 * if val: self._delegate.core.flag |= BAM_FREAD2
27969 static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
27970 PyObject *__pyx_r = NULL;
27971 __Pyx_RefNannyDeclarations
27972 PyObject *__pyx_t_1 = NULL;
27973 PyObject *__pyx_t_2 = NULL;
27974 int __pyx_lineno = 0;
27975 const char *__pyx_filename = NULL;
27976 int __pyx_clineno = 0;
27977 __Pyx_TraceDeclarations
27978 __Pyx_RefNannySetupContext("__get__", 0);
27979 __Pyx_TraceCall("__get__", __pyx_f[0], 2813);
27980 __Pyx_XDECREF(__pyx_r);
27981 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27982 __Pyx_GOTREF(__pyx_t_1);
27983 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_128); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27984 __Pyx_GOTREF(__pyx_t_2);
27985 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27986 __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27987 __Pyx_GOTREF(__pyx_t_1);
27988 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27989 __pyx_r = __pyx_t_1;
27993 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
27996 __Pyx_XDECREF(__pyx_t_1);
27997 __Pyx_XDECREF(__pyx_t_2);
27998 __Pyx_AddTraceback("csamtools.AlignedRead.is_read2.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28001 __Pyx_XGIVEREF(__pyx_r);
28002 __Pyx_TraceReturn(__pyx_r);
28003 __Pyx_RefNannyFinishContext();
28007 /* Python wrapper */
28008 static int __pyx_pw_9csamtools_11AlignedRead_8is_read2_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
28009 static int __pyx_pw_9csamtools_11AlignedRead_8is_read2_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
28011 __Pyx_RefNannyDeclarations
28012 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
28013 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_8is_read2_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
28014 __Pyx_RefNannyFinishContext();
28018 /* "csamtools.pyx":2814
28019 * """true if this is read2"""
28020 * def __get__(self): return (self.flag & BAM_FREAD2) != 0
28021 * def __set__(self,val): # <<<<<<<<<<<<<<
28022 * if val: self._delegate.core.flag |= BAM_FREAD2
28023 * else: self._delegate.core.flag &= ~BAM_FREAD2
28026 static int __pyx_pf_9csamtools_11AlignedRead_8is_read2_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
28028 __Pyx_RefNannyDeclarations
28030 int __pyx_lineno = 0;
28031 const char *__pyx_filename = NULL;
28032 int __pyx_clineno = 0;
28033 __Pyx_TraceDeclarations
28034 __Pyx_RefNannySetupContext("__set__", 0);
28035 __Pyx_TraceCall("__set__", __pyx_f[0], 2814);
28037 /* "csamtools.pyx":2815
28038 * def __get__(self): return (self.flag & BAM_FREAD2) != 0
28039 * def __set__(self,val):
28040 * if val: self._delegate.core.flag |= BAM_FREAD2 # <<<<<<<<<<<<<<
28041 * else: self._delegate.core.flag &= ~BAM_FREAD2
28042 * property is_secondary:
28044 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28046 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 128);
28051 /* "csamtools.pyx":2816
28052 * def __set__(self,val):
28053 * if val: self._delegate.core.flag |= BAM_FREAD2
28054 * else: self._delegate.core.flag &= ~BAM_FREAD2 # <<<<<<<<<<<<<<
28055 * property is_secondary:
28056 * """true if not primary alignment"""
28058 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~128));
28065 __Pyx_AddTraceback("csamtools.AlignedRead.is_read2.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28068 __Pyx_TraceReturn(Py_None);
28069 __Pyx_RefNannyFinishContext();
28073 /* Python wrapper */
28074 static PyObject *__pyx_pw_9csamtools_11AlignedRead_12is_secondary_1__get__(PyObject *__pyx_v_self); /*proto*/
28075 static PyObject *__pyx_pw_9csamtools_11AlignedRead_12is_secondary_1__get__(PyObject *__pyx_v_self) {
28076 PyObject *__pyx_r = 0;
28077 __Pyx_RefNannyDeclarations
28078 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
28079 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
28080 __Pyx_RefNannyFinishContext();
28084 /* "csamtools.pyx":2819
28085 * property is_secondary:
28086 * """true if not primary alignment"""
28087 * def __get__(self): return (self.flag & BAM_FSECONDARY) != 0 # <<<<<<<<<<<<<<
28088 * def __set__(self,val):
28089 * if val: self._delegate.core.flag |= BAM_FSECONDARY
28092 static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
28093 PyObject *__pyx_r = NULL;
28094 __Pyx_RefNannyDeclarations
28095 PyObject *__pyx_t_1 = NULL;
28096 PyObject *__pyx_t_2 = NULL;
28097 int __pyx_lineno = 0;
28098 const char *__pyx_filename = NULL;
28099 int __pyx_clineno = 0;
28100 __Pyx_TraceDeclarations
28101 __Pyx_RefNannySetupContext("__get__", 0);
28102 __Pyx_TraceCall("__get__", __pyx_f[0], 2819);
28103 __Pyx_XDECREF(__pyx_r);
28104 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28105 __Pyx_GOTREF(__pyx_t_1);
28106 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_256); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28107 __Pyx_GOTREF(__pyx_t_2);
28108 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
28109 __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28110 __Pyx_GOTREF(__pyx_t_1);
28111 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
28112 __pyx_r = __pyx_t_1;
28116 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
28119 __Pyx_XDECREF(__pyx_t_1);
28120 __Pyx_XDECREF(__pyx_t_2);
28121 __Pyx_AddTraceback("csamtools.AlignedRead.is_secondary.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28124 __Pyx_XGIVEREF(__pyx_r);
28125 __Pyx_TraceReturn(__pyx_r);
28126 __Pyx_RefNannyFinishContext();
28130 /* Python wrapper */
28131 static int __pyx_pw_9csamtools_11AlignedRead_12is_secondary_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
28132 static int __pyx_pw_9csamtools_11AlignedRead_12is_secondary_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
28134 __Pyx_RefNannyDeclarations
28135 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
28136 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_12is_secondary_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
28137 __Pyx_RefNannyFinishContext();
28141 /* "csamtools.pyx":2820
28142 * """true if not primary alignment"""
28143 * def __get__(self): return (self.flag & BAM_FSECONDARY) != 0
28144 * def __set__(self,val): # <<<<<<<<<<<<<<
28145 * if val: self._delegate.core.flag |= BAM_FSECONDARY
28146 * else: self._delegate.core.flag &= ~BAM_FSECONDARY
28149 static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
28151 __Pyx_RefNannyDeclarations
28153 int __pyx_lineno = 0;
28154 const char *__pyx_filename = NULL;
28155 int __pyx_clineno = 0;
28156 __Pyx_TraceDeclarations
28157 __Pyx_RefNannySetupContext("__set__", 0);
28158 __Pyx_TraceCall("__set__", __pyx_f[0], 2820);
28160 /* "csamtools.pyx":2821
28161 * def __get__(self): return (self.flag & BAM_FSECONDARY) != 0
28162 * def __set__(self,val):
28163 * if val: self._delegate.core.flag |= BAM_FSECONDARY # <<<<<<<<<<<<<<
28164 * else: self._delegate.core.flag &= ~BAM_FSECONDARY
28165 * property is_qcfail:
28167 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28169 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 256);
28174 /* "csamtools.pyx":2822
28175 * def __set__(self,val):
28176 * if val: self._delegate.core.flag |= BAM_FSECONDARY
28177 * else: self._delegate.core.flag &= ~BAM_FSECONDARY # <<<<<<<<<<<<<<
28178 * property is_qcfail:
28179 * """true if QC failure"""
28181 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~256));
28188 __Pyx_AddTraceback("csamtools.AlignedRead.is_secondary.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28191 __Pyx_TraceReturn(Py_None);
28192 __Pyx_RefNannyFinishContext();
28196 /* Python wrapper */
28197 static PyObject *__pyx_pw_9csamtools_11AlignedRead_9is_qcfail_1__get__(PyObject *__pyx_v_self); /*proto*/
28198 static PyObject *__pyx_pw_9csamtools_11AlignedRead_9is_qcfail_1__get__(PyObject *__pyx_v_self) {
28199 PyObject *__pyx_r = 0;
28200 __Pyx_RefNannyDeclarations
28201 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
28202 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
28203 __Pyx_RefNannyFinishContext();
28207 /* "csamtools.pyx":2825
28208 * property is_qcfail:
28209 * """true if QC failure"""
28210 * def __get__(self): return (self.flag & BAM_FQCFAIL) != 0 # <<<<<<<<<<<<<<
28211 * def __set__(self,val):
28212 * if val: self._delegate.core.flag |= BAM_FQCFAIL
28215 static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
28216 PyObject *__pyx_r = NULL;
28217 __Pyx_RefNannyDeclarations
28218 PyObject *__pyx_t_1 = NULL;
28219 PyObject *__pyx_t_2 = NULL;
28220 int __pyx_lineno = 0;
28221 const char *__pyx_filename = NULL;
28222 int __pyx_clineno = 0;
28223 __Pyx_TraceDeclarations
28224 __Pyx_RefNannySetupContext("__get__", 0);
28225 __Pyx_TraceCall("__get__", __pyx_f[0], 2825);
28226 __Pyx_XDECREF(__pyx_r);
28227 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28228 __Pyx_GOTREF(__pyx_t_1);
28229 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_512); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28230 __Pyx_GOTREF(__pyx_t_2);
28231 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
28232 __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28233 __Pyx_GOTREF(__pyx_t_1);
28234 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
28235 __pyx_r = __pyx_t_1;
28239 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
28242 __Pyx_XDECREF(__pyx_t_1);
28243 __Pyx_XDECREF(__pyx_t_2);
28244 __Pyx_AddTraceback("csamtools.AlignedRead.is_qcfail.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28247 __Pyx_XGIVEREF(__pyx_r);
28248 __Pyx_TraceReturn(__pyx_r);
28249 __Pyx_RefNannyFinishContext();
28253 /* Python wrapper */
28254 static int __pyx_pw_9csamtools_11AlignedRead_9is_qcfail_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
28255 static int __pyx_pw_9csamtools_11AlignedRead_9is_qcfail_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
28257 __Pyx_RefNannyDeclarations
28258 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
28259 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
28260 __Pyx_RefNannyFinishContext();
28264 /* "csamtools.pyx":2826
28265 * """true if QC failure"""
28266 * def __get__(self): return (self.flag & BAM_FQCFAIL) != 0
28267 * def __set__(self,val): # <<<<<<<<<<<<<<
28268 * if val: self._delegate.core.flag |= BAM_FQCFAIL
28269 * else: self._delegate.core.flag &= ~BAM_FQCFAIL
28272 static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
28274 __Pyx_RefNannyDeclarations
28276 int __pyx_lineno = 0;
28277 const char *__pyx_filename = NULL;
28278 int __pyx_clineno = 0;
28279 __Pyx_TraceDeclarations
28280 __Pyx_RefNannySetupContext("__set__", 0);
28281 __Pyx_TraceCall("__set__", __pyx_f[0], 2826);
28283 /* "csamtools.pyx":2827
28284 * def __get__(self): return (self.flag & BAM_FQCFAIL) != 0
28285 * def __set__(self,val):
28286 * if val: self._delegate.core.flag |= BAM_FQCFAIL # <<<<<<<<<<<<<<
28287 * else: self._delegate.core.flag &= ~BAM_FQCFAIL
28288 * property is_duplicate:
28290 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28292 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 512);
28297 /* "csamtools.pyx":2828
28298 * def __set__(self,val):
28299 * if val: self._delegate.core.flag |= BAM_FQCFAIL
28300 * else: self._delegate.core.flag &= ~BAM_FQCFAIL # <<<<<<<<<<<<<<
28301 * property is_duplicate:
28302 * """true if optical or PCR duplicate"""
28304 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~512));
28311 __Pyx_AddTraceback("csamtools.AlignedRead.is_qcfail.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28314 __Pyx_TraceReturn(Py_None);
28315 __Pyx_RefNannyFinishContext();
28319 /* Python wrapper */
28320 static PyObject *__pyx_pw_9csamtools_11AlignedRead_12is_duplicate_1__get__(PyObject *__pyx_v_self); /*proto*/
28321 static PyObject *__pyx_pw_9csamtools_11AlignedRead_12is_duplicate_1__get__(PyObject *__pyx_v_self) {
28322 PyObject *__pyx_r = 0;
28323 __Pyx_RefNannyDeclarations
28324 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
28325 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
28326 __Pyx_RefNannyFinishContext();
28330 /* "csamtools.pyx":2831
28331 * property is_duplicate:
28332 * """true if optical or PCR duplicate"""
28333 * def __get__(self): return (self.flag & BAM_FDUP) != 0 # <<<<<<<<<<<<<<
28334 * def __set__(self,val):
28335 * if val: self._delegate.core.flag |= BAM_FDUP
28338 static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
28339 PyObject *__pyx_r = NULL;
28340 __Pyx_RefNannyDeclarations
28341 PyObject *__pyx_t_1 = NULL;
28342 PyObject *__pyx_t_2 = NULL;
28343 int __pyx_lineno = 0;
28344 const char *__pyx_filename = NULL;
28345 int __pyx_clineno = 0;
28346 __Pyx_TraceDeclarations
28347 __Pyx_RefNannySetupContext("__get__", 0);
28348 __Pyx_TraceCall("__get__", __pyx_f[0], 2831);
28349 __Pyx_XDECREF(__pyx_r);
28350 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28351 __Pyx_GOTREF(__pyx_t_1);
28352 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_1024); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28353 __Pyx_GOTREF(__pyx_t_2);
28354 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
28355 __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28356 __Pyx_GOTREF(__pyx_t_1);
28357 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
28358 __pyx_r = __pyx_t_1;
28362 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
28365 __Pyx_XDECREF(__pyx_t_1);
28366 __Pyx_XDECREF(__pyx_t_2);
28367 __Pyx_AddTraceback("csamtools.AlignedRead.is_duplicate.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28370 __Pyx_XGIVEREF(__pyx_r);
28371 __Pyx_TraceReturn(__pyx_r);
28372 __Pyx_RefNannyFinishContext();
28376 /* Python wrapper */
28377 static int __pyx_pw_9csamtools_11AlignedRead_12is_duplicate_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
28378 static int __pyx_pw_9csamtools_11AlignedRead_12is_duplicate_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
28380 __Pyx_RefNannyDeclarations
28381 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
28382 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_2__set__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_val));
28383 __Pyx_RefNannyFinishContext();
28387 /* "csamtools.pyx":2832
28388 * """true if optical or PCR duplicate"""
28389 * def __get__(self): return (self.flag & BAM_FDUP) != 0
28390 * def __set__(self,val): # <<<<<<<<<<<<<<
28391 * if val: self._delegate.core.flag |= BAM_FDUP
28392 * else: self._delegate.core.flag &= ~BAM_FDUP
28395 static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_2__set__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_val) {
28397 __Pyx_RefNannyDeclarations
28399 int __pyx_lineno = 0;
28400 const char *__pyx_filename = NULL;
28401 int __pyx_clineno = 0;
28402 __Pyx_TraceDeclarations
28403 __Pyx_RefNannySetupContext("__set__", 0);
28404 __Pyx_TraceCall("__set__", __pyx_f[0], 2832);
28406 /* "csamtools.pyx":2833
28407 * def __get__(self): return (self.flag & BAM_FDUP) != 0
28408 * def __set__(self,val):
28409 * if val: self._delegate.core.flag |= BAM_FDUP # <<<<<<<<<<<<<<
28410 * else: self._delegate.core.flag &= ~BAM_FDUP
28411 * property positions:
28413 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28415 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag | 1024);
28420 /* "csamtools.pyx":2834
28421 * def __set__(self,val):
28422 * if val: self._delegate.core.flag |= BAM_FDUP
28423 * else: self._delegate.core.flag &= ~BAM_FDUP # <<<<<<<<<<<<<<
28424 * property positions:
28425 * """a list of reference positions that this read aligns to."""
28427 __pyx_v_self->_delegate->core.flag = (__pyx_v_self->_delegate->core.flag & (~1024));
28434 __Pyx_AddTraceback("csamtools.AlignedRead.is_duplicate.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28437 __Pyx_TraceReturn(Py_None);
28438 __Pyx_RefNannyFinishContext();
28442 /* Python wrapper */
28443 static PyObject *__pyx_pw_9csamtools_11AlignedRead_9positions_1__get__(PyObject *__pyx_v_self); /*proto*/
28444 static PyObject *__pyx_pw_9csamtools_11AlignedRead_9positions_1__get__(PyObject *__pyx_v_self) {
28445 PyObject *__pyx_r = 0;
28446 __Pyx_RefNannyDeclarations
28447 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
28448 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_9positions___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
28449 __Pyx_RefNannyFinishContext();
28453 /* "csamtools.pyx":2837
28454 * property positions:
28455 * """a list of reference positions that this read aligns to."""
28456 * def __get__(self): # <<<<<<<<<<<<<<
28457 * cdef uint32_t k, i, pos
28461 static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
28462 uint32_t __pyx_v_k;
28463 uint32_t __pyx_v_i;
28464 uint32_t __pyx_v_pos;
28466 uint32_t *__pyx_v_cigar_p;
28467 bam1_t *__pyx_v_src;
28468 PyObject *__pyx_v_result = NULL;
28469 PyObject *__pyx_v_l = NULL;
28470 PyObject *__pyx_r = NULL;
28471 __Pyx_RefNannyDeclarations
28473 PyObject *__pyx_t_2 = NULL;
28474 uint32_t __pyx_t_3;
28475 PyObject *__pyx_t_4 = NULL;
28476 uint32_t __pyx_t_5;
28478 int __pyx_lineno = 0;
28479 const char *__pyx_filename = NULL;
28480 int __pyx_clineno = 0;
28481 __Pyx_TraceDeclarations
28482 __Pyx_RefNannySetupContext("__get__", 0);
28483 __Pyx_TraceCall("__get__", __pyx_f[0], 2837);
28485 /* "csamtools.pyx":2843
28486 * cdef bam1_t * src
28488 * src = self._delegate # <<<<<<<<<<<<<<
28489 * if src.core.n_cigar == 0: return []
28492 __pyx_v_src = __pyx_v_self->_delegate;
28494 /* "csamtools.pyx":2844
28496 * src = self._delegate
28497 * if src.core.n_cigar == 0: return [] # <<<<<<<<<<<<<<
28501 __pyx_t_1 = (__pyx_v_src->core.n_cigar == 0);
28503 __Pyx_XDECREF(__pyx_r);
28504 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28505 __Pyx_GOTREF(__pyx_t_2);
28506 __pyx_r = ((PyObject *)__pyx_t_2);
28513 /* "csamtools.pyx":2846
28514 * if src.core.n_cigar == 0: return []
28516 * result = [] # <<<<<<<<<<<<<<
28517 * pos = src.core.pos
28518 * cigar_p = bam1_cigar(src)
28520 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28521 __Pyx_GOTREF(__pyx_t_2);
28522 __pyx_v_result = __pyx_t_2;
28525 /* "csamtools.pyx":2847
28528 * pos = src.core.pos # <<<<<<<<<<<<<<
28529 * cigar_p = bam1_cigar(src)
28532 __pyx_v_pos = __pyx_v_src->core.pos;
28534 /* "csamtools.pyx":2848
28536 * pos = src.core.pos
28537 * cigar_p = bam1_cigar(src) # <<<<<<<<<<<<<<
28539 * for k from 0 <= k < src.core.n_cigar:
28541 __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
28543 /* "csamtools.pyx":2850
28544 * cigar_p = bam1_cigar(src)
28546 * for k from 0 <= k < src.core.n_cigar: # <<<<<<<<<<<<<<
28547 * op = cigar_p[k] & BAM_CIGAR_MASK
28548 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
28550 __pyx_t_3 = __pyx_v_src->core.n_cigar;
28551 for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
28553 /* "csamtools.pyx":2851
28555 * for k from 0 <= k < src.core.n_cigar:
28556 * op = cigar_p[k] & BAM_CIGAR_MASK # <<<<<<<<<<<<<<
28557 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
28558 * if op == BAM_CMATCH:
28560 __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);
28562 /* "csamtools.pyx":2852
28563 * for k from 0 <= k < src.core.n_cigar:
28564 * op = cigar_p[k] & BAM_CIGAR_MASK
28565 * l = cigar_p[k] >> BAM_CIGAR_SHIFT # <<<<<<<<<<<<<<
28566 * if op == BAM_CMATCH:
28567 * for i from pos <= i < pos + l:
28569 __pyx_t_2 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28570 __Pyx_GOTREF(__pyx_t_2);
28571 __Pyx_XDECREF(__pyx_v_l);
28572 __pyx_v_l = __pyx_t_2;
28575 /* "csamtools.pyx":2853
28576 * op = cigar_p[k] & BAM_CIGAR_MASK
28577 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
28578 * if op == BAM_CMATCH: # <<<<<<<<<<<<<<
28579 * for i from pos <= i < pos + l:
28580 * result.append( i )
28582 __pyx_t_1 = (__pyx_v_op == 0);
28585 /* "csamtools.pyx":2854
28586 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
28587 * if op == BAM_CMATCH:
28588 * for i from pos <= i < pos + l: # <<<<<<<<<<<<<<
28589 * result.append( i )
28592 __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28593 __Pyx_GOTREF(__pyx_t_2);
28594 __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_v_l); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28595 __Pyx_GOTREF(__pyx_t_4);
28596 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
28597 __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28598 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
28599 for (__pyx_v_i = __pyx_v_pos; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
28601 /* "csamtools.pyx":2855
28602 * if op == BAM_CMATCH:
28603 * for i from pos <= i < pos + l:
28604 * result.append( i ) # <<<<<<<<<<<<<<
28606 * if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:
28608 __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28609 __Pyx_GOTREF(__pyx_t_4);
28610 __pyx_t_6 = PyList_Append(__pyx_v_result, __pyx_t_4); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28611 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
28617 /* "csamtools.pyx":2857
28618 * result.append( i )
28620 * if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP: # <<<<<<<<<<<<<<
28624 switch (__pyx_v_op) {
28629 /* "csamtools.pyx":2858
28631 * if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:
28632 * pos += l # <<<<<<<<<<<<<<
28636 __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28637 __Pyx_GOTREF(__pyx_t_4);
28638 __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_v_l); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28639 __Pyx_GOTREF(__pyx_t_2);
28640 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
28641 __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28642 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
28643 __pyx_v_pos = __pyx_t_5;
28648 /* "csamtools.pyx":2860
28651 * return result # <<<<<<<<<<<<<<
28653 * property aligned_pairs:
28655 __Pyx_XDECREF(__pyx_r);
28656 __Pyx_INCREF(((PyObject *)__pyx_v_result));
28657 __pyx_r = ((PyObject *)__pyx_v_result);
28660 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
28663 __Pyx_XDECREF(__pyx_t_2);
28664 __Pyx_XDECREF(__pyx_t_4);
28665 __Pyx_AddTraceback("csamtools.AlignedRead.positions.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28668 __Pyx_XDECREF(__pyx_v_result);
28669 __Pyx_XDECREF(__pyx_v_l);
28670 __Pyx_XGIVEREF(__pyx_r);
28671 __Pyx_TraceReturn(__pyx_r);
28672 __Pyx_RefNannyFinishContext();
28676 /* Python wrapper */
28677 static PyObject *__pyx_pw_9csamtools_11AlignedRead_13aligned_pairs_1__get__(PyObject *__pyx_v_self); /*proto*/
28678 static PyObject *__pyx_pw_9csamtools_11AlignedRead_13aligned_pairs_1__get__(PyObject *__pyx_v_self) {
28679 PyObject *__pyx_r = 0;
28680 __Pyx_RefNannyDeclarations
28681 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
28682 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_13aligned_pairs___get__(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
28683 __Pyx_RefNannyFinishContext();
28687 /* "csamtools.pyx":2867
28688 * Unaligned position are marked by None.
28690 * def __get__(self): # <<<<<<<<<<<<<<
28691 * cdef uint32_t k, i, pos, qpos
28695 static PyObject *__pyx_pf_9csamtools_11AlignedRead_13aligned_pairs___get__(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
28696 uint32_t __pyx_v_k;
28697 uint32_t __pyx_v_i;
28698 uint32_t __pyx_v_pos;
28699 uint32_t __pyx_v_qpos;
28701 uint32_t *__pyx_v_cigar_p;
28702 bam1_t *__pyx_v_src;
28703 PyObject *__pyx_v_result = NULL;
28704 PyObject *__pyx_v_l = NULL;
28705 PyObject *__pyx_r = NULL;
28706 __Pyx_RefNannyDeclarations
28708 PyObject *__pyx_t_2 = NULL;
28709 uint32_t __pyx_t_3;
28710 PyObject *__pyx_t_4 = NULL;
28711 uint32_t __pyx_t_5;
28712 PyObject *__pyx_t_6 = NULL;
28714 int __pyx_lineno = 0;
28715 const char *__pyx_filename = NULL;
28716 int __pyx_clineno = 0;
28717 __Pyx_TraceDeclarations
28718 __Pyx_RefNannySetupContext("__get__", 0);
28719 __Pyx_TraceCall("__get__", __pyx_f[0], 2867);
28721 /* "csamtools.pyx":2873
28722 * cdef bam1_t * src
28724 * src = self._delegate # <<<<<<<<<<<<<<
28725 * if src.core.n_cigar == 0: return []
28728 __pyx_v_src = __pyx_v_self->_delegate;
28730 /* "csamtools.pyx":2874
28732 * src = self._delegate
28733 * if src.core.n_cigar == 0: return [] # <<<<<<<<<<<<<<
28737 __pyx_t_1 = (__pyx_v_src->core.n_cigar == 0);
28739 __Pyx_XDECREF(__pyx_r);
28740 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28741 __Pyx_GOTREF(__pyx_t_2);
28742 __pyx_r = ((PyObject *)__pyx_t_2);
28749 /* "csamtools.pyx":2876
28750 * if src.core.n_cigar == 0: return []
28752 * result = [] # <<<<<<<<<<<<<<
28753 * pos = src.core.pos
28756 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28757 __Pyx_GOTREF(__pyx_t_2);
28758 __pyx_v_result = __pyx_t_2;
28761 /* "csamtools.pyx":2877
28764 * pos = src.core.pos # <<<<<<<<<<<<<<
28766 * cigar_p = bam1_cigar(src)
28768 __pyx_v_pos = __pyx_v_src->core.pos;
28770 /* "csamtools.pyx":2878
28772 * pos = src.core.pos
28773 * qpos = 0 # <<<<<<<<<<<<<<
28774 * cigar_p = bam1_cigar(src)
28779 /* "csamtools.pyx":2879
28780 * pos = src.core.pos
28782 * cigar_p = bam1_cigar(src) # <<<<<<<<<<<<<<
28784 * for k from 0 <= k < src.core.n_cigar:
28786 __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
28788 /* "csamtools.pyx":2881
28789 * cigar_p = bam1_cigar(src)
28791 * for k from 0 <= k < src.core.n_cigar: # <<<<<<<<<<<<<<
28792 * op = cigar_p[k] & BAM_CIGAR_MASK
28793 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
28795 __pyx_t_3 = __pyx_v_src->core.n_cigar;
28796 for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
28798 /* "csamtools.pyx":2882
28800 * for k from 0 <= k < src.core.n_cigar:
28801 * op = cigar_p[k] & BAM_CIGAR_MASK # <<<<<<<<<<<<<<
28802 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
28805 __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);
28807 /* "csamtools.pyx":2883
28808 * for k from 0 <= k < src.core.n_cigar:
28809 * op = cigar_p[k] & BAM_CIGAR_MASK
28810 * l = cigar_p[k] >> BAM_CIGAR_SHIFT # <<<<<<<<<<<<<<
28812 * if op == BAM_CMATCH:
28814 __pyx_t_2 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28815 __Pyx_GOTREF(__pyx_t_2);
28816 __Pyx_XDECREF(__pyx_v_l);
28817 __pyx_v_l = __pyx_t_2;
28820 /* "csamtools.pyx":2896
28823 * elif op == BAM_CDEL or op == BAM_CREF_SKIP: # <<<<<<<<<<<<<<
28824 * for i from pos <= i < pos + l:
28825 * result.append( (None, i) )
28827 switch (__pyx_v_op) {
28829 /* "csamtools.pyx":2885
28830 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
28832 * if op == BAM_CMATCH: # <<<<<<<<<<<<<<
28833 * for i from pos <= i < pos + l:
28834 * result.append( (qpos, i) )
28838 /* "csamtools.pyx":2886
28840 * if op == BAM_CMATCH:
28841 * for i from pos <= i < pos + l: # <<<<<<<<<<<<<<
28842 * result.append( (qpos, i) )
28845 __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28846 __Pyx_GOTREF(__pyx_t_2);
28847 __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_v_l); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28848 __Pyx_GOTREF(__pyx_t_4);
28849 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
28850 __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28851 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
28852 for (__pyx_v_i = __pyx_v_pos; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
28854 /* "csamtools.pyx":2887
28855 * if op == BAM_CMATCH:
28856 * for i from pos <= i < pos + l:
28857 * result.append( (qpos, i) ) # <<<<<<<<<<<<<<
28861 __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_qpos); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28862 __Pyx_GOTREF(__pyx_t_4);
28863 __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28864 __Pyx_GOTREF(__pyx_t_2);
28865 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28866 __Pyx_GOTREF(__pyx_t_6);
28867 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
28868 __Pyx_GIVEREF(__pyx_t_4);
28869 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
28870 __Pyx_GIVEREF(__pyx_t_2);
28873 __pyx_t_7 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_6)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28874 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
28876 /* "csamtools.pyx":2888
28877 * for i from pos <= i < pos + l:
28878 * result.append( (qpos, i) )
28879 * qpos += 1 # <<<<<<<<<<<<<<
28883 __pyx_v_qpos = (__pyx_v_qpos + 1);
28886 /* "csamtools.pyx":2889
28887 * result.append( (qpos, i) )
28889 * pos += l # <<<<<<<<<<<<<<
28891 * elif op == BAM_CINS:
28893 __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28894 __Pyx_GOTREF(__pyx_t_6);
28895 __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_v_l); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28896 __Pyx_GOTREF(__pyx_t_2);
28897 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
28898 __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28899 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
28900 __pyx_v_pos = __pyx_t_5;
28903 /* "csamtools.pyx":2891
28906 * elif op == BAM_CINS: # <<<<<<<<<<<<<<
28907 * for i from pos <= i < pos + l:
28908 * result.append( (qpos, None) )
28912 /* "csamtools.pyx":2892
28914 * elif op == BAM_CINS:
28915 * for i from pos <= i < pos + l: # <<<<<<<<<<<<<<
28916 * result.append( (qpos, None) )
28919 __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28920 __Pyx_GOTREF(__pyx_t_2);
28921 __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_v_l); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28922 __Pyx_GOTREF(__pyx_t_6);
28923 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
28924 __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28925 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
28926 for (__pyx_v_i = __pyx_v_pos; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
28928 /* "csamtools.pyx":2893
28929 * elif op == BAM_CINS:
28930 * for i from pos <= i < pos + l:
28931 * result.append( (qpos, None) ) # <<<<<<<<<<<<<<
28935 __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_qpos); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28936 __Pyx_GOTREF(__pyx_t_6);
28937 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28938 __Pyx_GOTREF(__pyx_t_2);
28939 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
28940 __Pyx_GIVEREF(__pyx_t_6);
28941 __Pyx_INCREF(Py_None);
28942 PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
28943 __Pyx_GIVEREF(Py_None);
28945 __pyx_t_7 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28946 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
28948 /* "csamtools.pyx":2894
28949 * for i from pos <= i < pos + l:
28950 * result.append( (qpos, None) )
28951 * qpos += 1 # <<<<<<<<<<<<<<
28953 * elif op == BAM_CDEL or op == BAM_CREF_SKIP:
28955 __pyx_v_qpos = (__pyx_v_qpos + 1);
28959 /* "csamtools.pyx":2896
28962 * elif op == BAM_CDEL or op == BAM_CREF_SKIP: # <<<<<<<<<<<<<<
28963 * for i from pos <= i < pos + l:
28964 * result.append( (None, i) )
28969 /* "csamtools.pyx":2897
28971 * elif op == BAM_CDEL or op == BAM_CREF_SKIP:
28972 * for i from pos <= i < pos + l: # <<<<<<<<<<<<<<
28973 * result.append( (None, i) )
28976 __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28977 __Pyx_GOTREF(__pyx_t_2);
28978 __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_v_l); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28979 __Pyx_GOTREF(__pyx_t_6);
28980 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
28981 __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28982 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
28983 for (__pyx_v_i = __pyx_v_pos; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
28985 /* "csamtools.pyx":2898
28986 * elif op == BAM_CDEL or op == BAM_CREF_SKIP:
28987 * for i from pos <= i < pos + l:
28988 * result.append( (None, i) ) # <<<<<<<<<<<<<<
28992 __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_i); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28993 __Pyx_GOTREF(__pyx_t_6);
28994 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
28995 __Pyx_GOTREF(__pyx_t_2);
28996 __Pyx_INCREF(Py_None);
28997 PyTuple_SET_ITEM(__pyx_t_2, 0, Py_None);
28998 __Pyx_GIVEREF(Py_None);
28999 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
29000 __Pyx_GIVEREF(__pyx_t_6);
29002 __pyx_t_7 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29003 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
29006 /* "csamtools.pyx":2899
29007 * for i from pos <= i < pos + l:
29008 * result.append( (None, i) )
29009 * pos += l # <<<<<<<<<<<<<<
29013 __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29014 __Pyx_GOTREF(__pyx_t_2);
29015 __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_v_l); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29016 __Pyx_GOTREF(__pyx_t_6);
29017 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29018 __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29019 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29020 __pyx_v_pos = __pyx_t_5;
29025 /* "csamtools.pyx":2901
29028 * return result # <<<<<<<<<<<<<<
29032 __Pyx_XDECREF(__pyx_r);
29033 __Pyx_INCREF(((PyObject *)__pyx_v_result));
29034 __pyx_r = ((PyObject *)__pyx_v_result);
29037 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
29040 __Pyx_XDECREF(__pyx_t_2);
29041 __Pyx_XDECREF(__pyx_t_4);
29042 __Pyx_XDECREF(__pyx_t_6);
29043 __Pyx_AddTraceback("csamtools.AlignedRead.aligned_pairs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
29046 __Pyx_XDECREF(__pyx_v_result);
29047 __Pyx_XDECREF(__pyx_v_l);
29048 __Pyx_XGIVEREF(__pyx_r);
29049 __Pyx_TraceReturn(__pyx_r);
29050 __Pyx_RefNannyFinishContext();
29054 /* Python wrapper */
29055 static PyObject *__pyx_pw_9csamtools_11AlignedRead_11overlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
29056 static char __pyx_doc_9csamtools_11AlignedRead_10overlap[] = "AlignedRead.overlap(self, uint32_t start, uint32_t end)\nreturn number of aligned bases of read overlapping the interval *start* and *end*\n on the reference sequence.\n ";
29057 static PyObject *__pyx_pw_9csamtools_11AlignedRead_11overlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
29058 uint32_t __pyx_v_start;
29059 uint32_t __pyx_v_end;
29060 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0};
29061 PyObject *__pyx_r = 0;
29062 __Pyx_RefNannyDeclarations
29063 __Pyx_RefNannySetupContext("overlap (wrapper)", 0);
29065 PyObject* values[2] = {0,0};
29066 if (unlikely(__pyx_kwds)) {
29067 Py_ssize_t kw_args;
29068 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
29069 switch (pos_args) {
29070 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
29071 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
29073 default: goto __pyx_L5_argtuple_error;
29075 kw_args = PyDict_Size(__pyx_kwds);
29076 switch (pos_args) {
29078 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
29079 if (likely(values[0])) kw_args--;
29080 else goto __pyx_L5_argtuple_error;
29082 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
29083 if (likely(values[1])) kw_args--;
29085 __Pyx_RaiseArgtupleInvalid("overlap", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2904; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
29088 if (unlikely(kw_args > 0)) {
29089 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "overlap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2904; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
29091 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
29092 goto __pyx_L5_argtuple_error;
29094 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
29095 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
29097 __pyx_v_start = __Pyx_PyInt_from_py_uint32_t(values[0]); if (unlikely((__pyx_v_start == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2904; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
29098 __pyx_v_end = __Pyx_PyInt_from_py_uint32_t(values[1]); if (unlikely((__pyx_v_end == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2904; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
29100 goto __pyx_L4_argument_unpacking_done;
29101 __pyx_L5_argtuple_error:;
29102 __Pyx_RaiseArgtupleInvalid("overlap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2904; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
29104 __Pyx_AddTraceback("csamtools.AlignedRead.overlap", __pyx_clineno, __pyx_lineno, __pyx_filename);
29105 __Pyx_RefNannyFinishContext();
29107 __pyx_L4_argument_unpacking_done:;
29108 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_10overlap(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), __pyx_v_start, __pyx_v_end);
29109 __Pyx_RefNannyFinishContext();
29113 /* "csamtools.pyx":2904
29116 * def overlap( self, uint32_t start, uint32_t end ): # <<<<<<<<<<<<<<
29117 * """return number of aligned bases of read overlapping the interval *start* and *end*
29118 * on the reference sequence.
29121 static PyObject *__pyx_pf_9csamtools_11AlignedRead_10overlap(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, uint32_t __pyx_v_start, uint32_t __pyx_v_end) {
29122 uint32_t __pyx_v_k;
29123 uint32_t __pyx_v_pos;
29124 uint32_t __pyx_v_overlap;
29127 uint32_t *__pyx_v_cigar_p;
29128 bam1_t *__pyx_v_src;
29129 PyObject *__pyx_v_l = NULL;
29130 PyObject *__pyx_r = NULL;
29131 __Pyx_RefNannyDeclarations
29133 uint32_t __pyx_t_2;
29134 PyObject *__pyx_t_3 = NULL;
29135 uint32_t __pyx_t_4;
29136 PyObject *__pyx_t_5 = NULL;
29137 PyObject *__pyx_t_6 = NULL;
29138 PyObject *__pyx_t_7 = NULL;
29139 uint32_t __pyx_t_8;
29140 uint32_t __pyx_t_9;
29142 int __pyx_lineno = 0;
29143 const char *__pyx_filename = NULL;
29144 int __pyx_clineno = 0;
29145 __Pyx_TraceDeclarations
29146 __Pyx_RefNannySetupContext("overlap", 0);
29147 __Pyx_TraceCall("overlap", __pyx_f[0], 2904);
29149 /* "csamtools.pyx":2913
29150 * cdef bam1_t * src
29152 * overlap = 0 # <<<<<<<<<<<<<<
29154 * src = self._delegate
29156 __pyx_v_overlap = 0;
29158 /* "csamtools.pyx":2915
29161 * src = self._delegate # <<<<<<<<<<<<<<
29162 * if src.core.n_cigar == 0: return 0
29163 * pos = src.core.pos
29165 __pyx_v_src = __pyx_v_self->_delegate;
29167 /* "csamtools.pyx":2916
29169 * src = self._delegate
29170 * if src.core.n_cigar == 0: return 0 # <<<<<<<<<<<<<<
29171 * pos = src.core.pos
29174 __pyx_t_1 = (__pyx_v_src->core.n_cigar == 0);
29176 __Pyx_XDECREF(__pyx_r);
29177 __Pyx_INCREF(__pyx_int_0);
29178 __pyx_r = __pyx_int_0;
29184 /* "csamtools.pyx":2917
29185 * src = self._delegate
29186 * if src.core.n_cigar == 0: return 0
29187 * pos = src.core.pos # <<<<<<<<<<<<<<
29191 __pyx_v_pos = __pyx_v_src->core.pos;
29193 /* "csamtools.pyx":2918
29194 * if src.core.n_cigar == 0: return 0
29195 * pos = src.core.pos
29196 * o = 0 # <<<<<<<<<<<<<<
29198 * cigar_p = bam1_cigar(src)
29202 /* "csamtools.pyx":2920
29205 * cigar_p = bam1_cigar(src) # <<<<<<<<<<<<<<
29206 * for k from 0 <= k < src.core.n_cigar:
29207 * op = cigar_p[k] & BAM_CIGAR_MASK
29209 __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
29211 /* "csamtools.pyx":2921
29213 * cigar_p = bam1_cigar(src)
29214 * for k from 0 <= k < src.core.n_cigar: # <<<<<<<<<<<<<<
29215 * op = cigar_p[k] & BAM_CIGAR_MASK
29216 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
29218 __pyx_t_2 = __pyx_v_src->core.n_cigar;
29219 for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_2; __pyx_v_k++) {
29221 /* "csamtools.pyx":2922
29222 * cigar_p = bam1_cigar(src)
29223 * for k from 0 <= k < src.core.n_cigar:
29224 * op = cigar_p[k] & BAM_CIGAR_MASK # <<<<<<<<<<<<<<
29225 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
29228 __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);
29230 /* "csamtools.pyx":2923
29231 * for k from 0 <= k < src.core.n_cigar:
29232 * op = cigar_p[k] & BAM_CIGAR_MASK
29233 * l = cigar_p[k] >> BAM_CIGAR_SHIFT # <<<<<<<<<<<<<<
29235 * if op == BAM_CMATCH:
29237 __pyx_t_3 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29238 __Pyx_GOTREF(__pyx_t_3);
29239 __Pyx_XDECREF(__pyx_v_l);
29240 __pyx_v_l = __pyx_t_3;
29243 /* "csamtools.pyx":2925
29244 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
29246 * if op == BAM_CMATCH: # <<<<<<<<<<<<<<
29247 * o = min( pos + l, end) - max( pos, start )
29248 * if o > 0: overlap += o
29250 __pyx_t_1 = (__pyx_v_op == 0);
29253 /* "csamtools.pyx":2926
29255 * if op == BAM_CMATCH:
29256 * o = min( pos + l, end) - max( pos, start ) # <<<<<<<<<<<<<<
29257 * if o > 0: overlap += o
29260 __pyx_t_4 = __pyx_v_end;
29261 __pyx_t_3 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29262 __Pyx_GOTREF(__pyx_t_3);
29263 __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_v_l); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29264 __Pyx_GOTREF(__pyx_t_5);
29265 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29266 __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29267 __Pyx_GOTREF(__pyx_t_6);
29268 __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29269 __Pyx_GOTREF(__pyx_t_7);
29270 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29271 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29272 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
29274 __pyx_t_7 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29275 __Pyx_GOTREF(__pyx_t_7);
29276 __pyx_t_3 = __pyx_t_7;
29279 __Pyx_INCREF(__pyx_t_5);
29280 __pyx_t_3 = __pyx_t_5;
29282 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
29283 __pyx_t_4 = __pyx_v_start;
29284 __pyx_t_8 = __pyx_v_pos;
29285 if ((__pyx_t_4 > __pyx_t_8)) {
29286 __pyx_t_9 = __pyx_t_4;
29288 __pyx_t_9 = __pyx_t_8;
29290 __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29291 __Pyx_GOTREF(__pyx_t_5);
29292 __pyx_t_7 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29293 __Pyx_GOTREF(__pyx_t_7);
29294 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29295 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
29296 __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29297 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
29298 __pyx_v_o = __pyx_t_10;
29300 /* "csamtools.pyx":2927
29301 * if op == BAM_CMATCH:
29302 * o = min( pos + l, end) - max( pos, start )
29303 * if o > 0: overlap += o # <<<<<<<<<<<<<<
29305 * if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:
29307 __pyx_t_1 = (__pyx_v_o > 0);
29309 __pyx_v_overlap = (__pyx_v_overlap + __pyx_v_o);
29317 /* "csamtools.pyx":2929
29318 * if o > 0: overlap += o
29320 * if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP: # <<<<<<<<<<<<<<
29324 switch (__pyx_v_op) {
29329 /* "csamtools.pyx":2930
29331 * if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:
29332 * pos += l # <<<<<<<<<<<<<<
29336 __pyx_t_7 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29337 __Pyx_GOTREF(__pyx_t_7);
29338 __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_v_l); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29339 __Pyx_GOTREF(__pyx_t_5);
29340 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
29341 __pyx_t_9 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29342 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
29343 __pyx_v_pos = __pyx_t_9;
29348 /* "csamtools.pyx":2932
29351 * return overlap # <<<<<<<<<<<<<<
29353 * def opt(self, tag):
29355 __Pyx_XDECREF(__pyx_r);
29356 __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_overlap); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29357 __Pyx_GOTREF(__pyx_t_5);
29358 __pyx_r = __pyx_t_5;
29362 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
29365 __Pyx_XDECREF(__pyx_t_3);
29366 __Pyx_XDECREF(__pyx_t_5);
29367 __Pyx_XDECREF(__pyx_t_6);
29368 __Pyx_XDECREF(__pyx_t_7);
29369 __Pyx_AddTraceback("csamtools.AlignedRead.overlap", __pyx_clineno, __pyx_lineno, __pyx_filename);
29372 __Pyx_XDECREF(__pyx_v_l);
29373 __Pyx_XGIVEREF(__pyx_r);
29374 __Pyx_TraceReturn(__pyx_r);
29375 __Pyx_RefNannyFinishContext();
29379 /* Python wrapper */
29380 static PyObject *__pyx_pw_9csamtools_11AlignedRead_13opt(PyObject *__pyx_v_self, PyObject *__pyx_v_tag); /*proto*/
29381 static char __pyx_doc_9csamtools_11AlignedRead_12opt[] = "AlignedRead.opt(self, tag)\nretrieves optional data given a two-letter *tag*";
29382 static PyObject *__pyx_pw_9csamtools_11AlignedRead_13opt(PyObject *__pyx_v_self, PyObject *__pyx_v_tag) {
29383 PyObject *__pyx_r = 0;
29384 __Pyx_RefNannyDeclarations
29385 __Pyx_RefNannySetupContext("opt (wrapper)", 0);
29386 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_12opt(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self), ((PyObject *)__pyx_v_tag));
29387 __Pyx_RefNannyFinishContext();
29391 /* "csamtools.pyx":2934
29394 * def opt(self, tag): # <<<<<<<<<<<<<<
29395 * """retrieves optional data given a two-letter *tag*"""
29396 * #see bam_aux.c: bam_aux_get() and bam_aux2i() etc
29399 static PyObject *__pyx_pf_9csamtools_11AlignedRead_12opt(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self, PyObject *__pyx_v_tag) {
29400 uint8_t *__pyx_v_v;
29401 CYTHON_UNUSED int __pyx_v_nvalues;
29402 PyObject *__pyx_v_btag = NULL;
29403 PyObject *__pyx_v_auxtype = NULL;
29404 CYTHON_UNUSED PyObject *__pyx_v_bytesize = NULL;
29405 PyObject *__pyx_v_values = NULL;
29406 PyObject *__pyx_r = NULL;
29407 __Pyx_RefNannyDeclarations
29408 PyObject *__pyx_t_1 = NULL;
29411 PyObject *__pyx_t_4 = NULL;
29416 PyObject *__pyx_t_9 = NULL;
29417 PyObject *__pyx_t_10 = NULL;
29418 PyObject *__pyx_t_11 = NULL;
29419 PyObject *(*__pyx_t_12)(PyObject *);
29421 int __pyx_lineno = 0;
29422 const char *__pyx_filename = NULL;
29423 int __pyx_clineno = 0;
29424 __Pyx_TraceDeclarations
29425 __Pyx_RefNannySetupContext("opt", 0);
29426 __Pyx_TraceCall("opt", __pyx_f[0], 2934);
29428 /* "csamtools.pyx":2939
29431 * btag = _force_bytes(tag) # <<<<<<<<<<<<<<
29432 * v = bam_aux_get(self._delegate, btag)
29433 * if v == NULL: raise KeyError( "tag '%s' not present" % tag )
29435 __pyx_t_1 = ((PyObject *)__pyx_f_9csamtools__force_bytes(__pyx_v_tag)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29436 __Pyx_GOTREF(__pyx_t_1);
29437 __pyx_v_btag = ((PyObject*)__pyx_t_1);
29440 /* "csamtools.pyx":2940
29442 * btag = _force_bytes(tag)
29443 * v = bam_aux_get(self._delegate, btag) # <<<<<<<<<<<<<<
29444 * if v == NULL: raise KeyError( "tag '%s' not present" % tag )
29445 * auxtype = chr(v[0])
29447 __pyx_t_2 = PyBytes_AsString(((PyObject *)__pyx_v_btag)); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29448 __pyx_v_v = bam_aux_get(__pyx_v_self->_delegate, __pyx_t_2);
29450 /* "csamtools.pyx":2941
29451 * btag = _force_bytes(tag)
29452 * v = bam_aux_get(self._delegate, btag)
29453 * if v == NULL: raise KeyError( "tag '%s' not present" % tag ) # <<<<<<<<<<<<<<
29454 * auxtype = chr(v[0])
29455 * if auxtype == 'c' or auxtype == 'C' or auxtype == 's' or auxtype == 'S':
29457 __pyx_t_3 = (__pyx_v_v == NULL);
29459 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_148), __pyx_v_tag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29460 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
29461 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29462 __Pyx_GOTREF(__pyx_t_4);
29463 PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1));
29464 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
29466 __pyx_t_1 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29467 __Pyx_GOTREF(__pyx_t_1);
29468 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
29469 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
29470 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
29471 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29476 /* "csamtools.pyx":2942
29477 * v = bam_aux_get(self._delegate, btag)
29478 * if v == NULL: raise KeyError( "tag '%s' not present" % tag )
29479 * auxtype = chr(v[0]) # <<<<<<<<<<<<<<
29480 * if auxtype == 'c' or auxtype == 'C' or auxtype == 's' or auxtype == 'S':
29481 * return <int>bam_aux2i(v)
29483 __pyx_t_1 = __Pyx_PyInt_to_py_uint8_t((__pyx_v_v[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29484 __Pyx_GOTREF(__pyx_t_1);
29485 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29486 __Pyx_GOTREF(__pyx_t_4);
29487 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
29488 __Pyx_GIVEREF(__pyx_t_1);
29490 __pyx_t_1 = PyObject_Call(__pyx_builtin_chr, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29491 __Pyx_GOTREF(__pyx_t_1);
29492 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
29493 __pyx_v_auxtype = __pyx_t_1;
29496 /* "csamtools.pyx":2943
29497 * if v == NULL: raise KeyError( "tag '%s' not present" % tag )
29498 * auxtype = chr(v[0])
29499 * if auxtype == 'c' or auxtype == 'C' or auxtype == 's' or auxtype == 'S': # <<<<<<<<<<<<<<
29500 * return <int>bam_aux2i(v)
29501 * elif auxtype == 'i' or auxtype == 'I':
29503 __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__c), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29505 __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__C), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29507 __pyx_t_6 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__s), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29509 __pyx_t_7 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__S), Py_EQ); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29510 __pyx_t_8 = __pyx_t_7;
29512 __pyx_t_8 = __pyx_t_6;
29514 __pyx_t_6 = __pyx_t_8;
29516 __pyx_t_6 = __pyx_t_5;
29518 __pyx_t_5 = __pyx_t_6;
29520 __pyx_t_5 = __pyx_t_3;
29524 /* "csamtools.pyx":2944
29525 * auxtype = chr(v[0])
29526 * if auxtype == 'c' or auxtype == 'C' or auxtype == 's' or auxtype == 'S':
29527 * return <int>bam_aux2i(v) # <<<<<<<<<<<<<<
29528 * elif auxtype == 'i' or auxtype == 'I':
29529 * return <int32_t>bam_aux2i(v)
29531 __Pyx_XDECREF(__pyx_r);
29532 __pyx_t_1 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_v))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29533 __Pyx_GOTREF(__pyx_t_1);
29534 __pyx_r = __pyx_t_1;
29540 /* "csamtools.pyx":2945
29541 * if auxtype == 'c' or auxtype == 'C' or auxtype == 's' or auxtype == 'S':
29542 * return <int>bam_aux2i(v)
29543 * elif auxtype == 'i' or auxtype == 'I': # <<<<<<<<<<<<<<
29544 * return <int32_t>bam_aux2i(v)
29545 * elif auxtype == 'f' or auxtype == 'F':
29547 __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__i), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29549 __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__I), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29550 __pyx_t_6 = __pyx_t_3;
29552 __pyx_t_6 = __pyx_t_5;
29556 /* "csamtools.pyx":2946
29557 * return <int>bam_aux2i(v)
29558 * elif auxtype == 'i' or auxtype == 'I':
29559 * return <int32_t>bam_aux2i(v) # <<<<<<<<<<<<<<
29560 * elif auxtype == 'f' or auxtype == 'F':
29561 * return <float>bam_aux2f(v)
29563 __Pyx_XDECREF(__pyx_r);
29564 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((int32_t)bam_aux2i(__pyx_v_v))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29565 __Pyx_GOTREF(__pyx_t_1);
29566 __pyx_r = __pyx_t_1;
29572 /* "csamtools.pyx":2947
29573 * elif auxtype == 'i' or auxtype == 'I':
29574 * return <int32_t>bam_aux2i(v)
29575 * elif auxtype == 'f' or auxtype == 'F': # <<<<<<<<<<<<<<
29576 * return <float>bam_aux2f(v)
29577 * elif auxtype == 'd' or auxtype == 'D':
29579 __pyx_t_6 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__f), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29581 __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__F), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29582 __pyx_t_3 = __pyx_t_5;
29584 __pyx_t_3 = __pyx_t_6;
29588 /* "csamtools.pyx":2948
29589 * return <int32_t>bam_aux2i(v)
29590 * elif auxtype == 'f' or auxtype == 'F':
29591 * return <float>bam_aux2f(v) # <<<<<<<<<<<<<<
29592 * elif auxtype == 'd' or auxtype == 'D':
29593 * return <double>bam_aux2d(v)
29595 __Pyx_XDECREF(__pyx_r);
29596 __pyx_t_1 = PyFloat_FromDouble(((float)bam_aux2f(__pyx_v_v))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29597 __Pyx_GOTREF(__pyx_t_1);
29598 __pyx_r = __pyx_t_1;
29604 /* "csamtools.pyx":2949
29605 * elif auxtype == 'f' or auxtype == 'F':
29606 * return <float>bam_aux2f(v)
29607 * elif auxtype == 'd' or auxtype == 'D': # <<<<<<<<<<<<<<
29608 * return <double>bam_aux2d(v)
29609 * elif auxtype == 'A':
29611 __pyx_t_3 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__d), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29613 __pyx_t_6 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__D), Py_EQ); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29614 __pyx_t_5 = __pyx_t_6;
29616 __pyx_t_5 = __pyx_t_3;
29620 /* "csamtools.pyx":2950
29621 * return <float>bam_aux2f(v)
29622 * elif auxtype == 'd' or auxtype == 'D':
29623 * return <double>bam_aux2d(v) # <<<<<<<<<<<<<<
29624 * elif auxtype == 'A':
29625 * # there might a more efficient way
29627 __Pyx_XDECREF(__pyx_r);
29628 __pyx_t_1 = PyFloat_FromDouble(((double)bam_aux2d(__pyx_v_v))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29629 __Pyx_GOTREF(__pyx_t_1);
29630 __pyx_r = __pyx_t_1;
29636 /* "csamtools.pyx":2951
29637 * elif auxtype == 'd' or auxtype == 'D':
29638 * return <double>bam_aux2d(v)
29639 * elif auxtype == 'A': # <<<<<<<<<<<<<<
29640 * # there might a more efficient way
29641 * # to convert a char into a string
29643 __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__A), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29646 /* "csamtools.pyx":2954
29647 * # there might a more efficient way
29648 * # to convert a char into a string
29649 * return '%c' % <char>bam_aux2A(v) # <<<<<<<<<<<<<<
29650 * elif auxtype == 'Z':
29651 * return _charptr_to_str(<char*>bam_aux2Z(v))
29653 __Pyx_XDECREF(__pyx_r);
29654 __pyx_t_1 = PyInt_FromLong(((char)bam_aux2A(__pyx_v_v))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29655 __Pyx_GOTREF(__pyx_t_1);
29656 __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_137), __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29657 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
29658 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
29659 __pyx_r = ((PyObject *)__pyx_t_4);
29665 /* "csamtools.pyx":2955
29666 * # to convert a char into a string
29667 * return '%c' % <char>bam_aux2A(v)
29668 * elif auxtype == 'Z': # <<<<<<<<<<<<<<
29669 * return _charptr_to_str(<char*>bam_aux2Z(v))
29670 * elif auxtype == 'B':
29672 __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__Z), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29675 /* "csamtools.pyx":2956
29676 * return '%c' % <char>bam_aux2A(v)
29677 * elif auxtype == 'Z':
29678 * return _charptr_to_str(<char*>bam_aux2Z(v)) # <<<<<<<<<<<<<<
29679 * elif auxtype == 'B':
29680 * bytesize, nvalues, values = convertBinaryTagToList( v + 1 )
29682 __Pyx_XDECREF(__pyx_r);
29683 __pyx_t_4 = __pyx_f_9csamtools__charptr_to_str(((char *)bam_aux2Z(__pyx_v_v))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29684 __Pyx_GOTREF(__pyx_t_4);
29685 __pyx_r = __pyx_t_4;
29691 /* "csamtools.pyx":2957
29692 * elif auxtype == 'Z':
29693 * return _charptr_to_str(<char*>bam_aux2Z(v))
29694 * elif auxtype == 'B': # <<<<<<<<<<<<<<
29695 * bytesize, nvalues, values = convertBinaryTagToList( v + 1 )
29698 __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_auxtype, ((PyObject *)__pyx_n_s__B), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29701 /* "csamtools.pyx":2958
29702 * return _charptr_to_str(<char*>bam_aux2Z(v))
29703 * elif auxtype == 'B':
29704 * bytesize, nvalues, values = convertBinaryTagToList( v + 1 ) # <<<<<<<<<<<<<<
29708 __pyx_t_4 = __pyx_f_9csamtools_convertBinaryTagToList((__pyx_v_v + 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29709 __Pyx_GOTREF(__pyx_t_4);
29710 if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
29711 PyObject* sequence = __pyx_t_4;
29712 if (likely(PyTuple_CheckExact(sequence))) {
29713 if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) {
29714 if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
29715 else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
29716 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29718 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
29719 __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
29720 __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2);
29722 if (unlikely(PyList_GET_SIZE(sequence) != 3)) {
29723 if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
29724 else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
29725 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29727 __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
29728 __pyx_t_9 = PyList_GET_ITEM(sequence, 1);
29729 __pyx_t_10 = PyList_GET_ITEM(sequence, 2);
29731 __Pyx_INCREF(__pyx_t_1);
29732 __Pyx_INCREF(__pyx_t_9);
29733 __Pyx_INCREF(__pyx_t_10);
29734 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
29736 Py_ssize_t index = -1;
29737 __pyx_t_11 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29738 __Pyx_GOTREF(__pyx_t_11);
29739 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
29740 __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
29741 index = 0; __pyx_t_1 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
29742 __Pyx_GOTREF(__pyx_t_1);
29743 index = 1; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L5_unpacking_failed;
29744 __Pyx_GOTREF(__pyx_t_9);
29745 index = 2; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L5_unpacking_failed;
29746 __Pyx_GOTREF(__pyx_t_10);
29747 if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29748 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
29749 goto __pyx_L6_unpacking_done;
29750 __pyx_L5_unpacking_failed:;
29751 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
29752 if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
29753 if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
29754 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29755 __pyx_L6_unpacking_done:;
29757 __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_9); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29758 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
29759 __pyx_v_bytesize = __pyx_t_1;
29761 __pyx_v_nvalues = __pyx_t_13;
29762 __pyx_v_values = __pyx_t_10;
29765 /* "csamtools.pyx":2959
29766 * elif auxtype == 'B':
29767 * bytesize, nvalues, values = convertBinaryTagToList( v + 1 )
29768 * return values # <<<<<<<<<<<<<<
29770 * raise ValueError("unknown auxilliary type '%s'" % auxtype)
29772 __Pyx_XDECREF(__pyx_r);
29773 __Pyx_INCREF(__pyx_v_values);
29774 __pyx_r = __pyx_v_values;
29780 /* "csamtools.pyx":2961
29783 * raise ValueError("unknown auxilliary type '%s'" % auxtype) # <<<<<<<<<<<<<<
29787 __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_149), __pyx_v_auxtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29788 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
29789 __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29790 __Pyx_GOTREF(__pyx_t_10);
29791 PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_4));
29792 __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
29794 __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29795 __Pyx_GOTREF(__pyx_t_4);
29796 __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
29797 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
29798 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
29799 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29803 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
29806 __Pyx_XDECREF(__pyx_t_1);
29807 __Pyx_XDECREF(__pyx_t_4);
29808 __Pyx_XDECREF(__pyx_t_9);
29809 __Pyx_XDECREF(__pyx_t_10);
29810 __Pyx_XDECREF(__pyx_t_11);
29811 __Pyx_AddTraceback("csamtools.AlignedRead.opt", __pyx_clineno, __pyx_lineno, __pyx_filename);
29814 __Pyx_XDECREF(__pyx_v_btag);
29815 __Pyx_XDECREF(__pyx_v_auxtype);
29816 __Pyx_XDECREF(__pyx_v_bytesize);
29817 __Pyx_XDECREF(__pyx_v_values);
29818 __Pyx_XGIVEREF(__pyx_r);
29819 __Pyx_TraceReturn(__pyx_r);
29820 __Pyx_RefNannyFinishContext();
29824 /* Python wrapper */
29825 static PyObject *__pyx_pw_9csamtools_11AlignedRead_15fancy_str(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
29826 static char __pyx_doc_9csamtools_11AlignedRead_14fancy_str[] = "AlignedRead.fancy_str(self)\nreturns list of fieldnames/values in pretty format for debugging\n ";
29827 static PyObject *__pyx_pw_9csamtools_11AlignedRead_15fancy_str(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
29828 PyObject *__pyx_r = 0;
29829 __Pyx_RefNannyDeclarations
29830 __Pyx_RefNannySetupContext("fancy_str (wrapper)", 0);
29831 __pyx_r = __pyx_pf_9csamtools_11AlignedRead_14fancy_str(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self));
29832 __Pyx_RefNannyFinishContext();
29836 /* "csamtools.pyx":2964
29839 * def fancy_str (self): # <<<<<<<<<<<<<<
29840 * """returns list of fieldnames/values in pretty format for debugging
29844 static PyObject *__pyx_pf_9csamtools_11AlignedRead_14fancy_str(struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_self) {
29845 PyObject *__pyx_v_ret_string = NULL;
29846 PyObject *__pyx_v_field_names = NULL;
29847 PyObject *__pyx_v_fields_names_in_order = NULL;
29848 PyObject *__pyx_v_f = NULL;
29849 PyObject *__pyx_r = NULL;
29850 __Pyx_RefNannyDeclarations
29851 PyObject *__pyx_t_1 = NULL;
29852 Py_ssize_t __pyx_t_2;
29853 PyObject *__pyx_t_3 = NULL;
29856 PyObject *__pyx_t_6 = NULL;
29857 PyObject *__pyx_t_7 = NULL;
29858 PyObject *__pyx_t_8 = NULL;
29859 PyObject *__pyx_t_9 = NULL;
29861 PyObject *(*__pyx_t_11)(PyObject *);
29862 int __pyx_lineno = 0;
29863 const char *__pyx_filename = NULL;
29864 int __pyx_clineno = 0;
29865 __Pyx_TraceDeclarations
29866 __Pyx_RefNannySetupContext("fancy_str", 0);
29867 __Pyx_TraceCall("fancy_str", __pyx_f[0], 2964);
29869 /* "csamtools.pyx":2967
29870 * """returns list of fieldnames/values in pretty format for debugging
29872 * ret_string = [] # <<<<<<<<<<<<<<
29874 * "tid": "Contig index",
29876 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29877 __Pyx_GOTREF(__pyx_t_1);
29878 __pyx_v_ret_string = __pyx_t_1;
29881 /* "csamtools.pyx":2968
29884 * field_names = { # <<<<<<<<<<<<<<
29885 * "tid": "Contig index",
29886 * "pos": "Mapped position on contig",
29888 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29889 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
29890 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__tid), ((PyObject *)__pyx_kp_s_150)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29891 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__pos), ((PyObject *)__pyx_kp_s_151)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29892 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mtid), ((PyObject *)__pyx_kp_s_152)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29893 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mpos), ((PyObject *)__pyx_kp_s_153)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29894 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__isize), ((PyObject *)__pyx_kp_s_154)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29895 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__flag), ((PyObject *)__pyx_kp_s_155)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29896 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__n_cigar), ((PyObject *)__pyx_kp_s_156)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29897 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__cigar), ((PyObject *)__pyx_kp_s_157)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29898 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__qual), ((PyObject *)__pyx_kp_s_158)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29899 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__bin), ((PyObject *)__pyx_kp_s_159)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29900 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__l_qname), ((PyObject *)__pyx_kp_s_160)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29901 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__qname), ((PyObject *)__pyx_kp_s_161)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29902 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__l_qseq), ((PyObject *)__pyx_kp_s_162)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29903 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__qseq), ((PyObject *)__pyx_kp_s_163)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29904 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__bqual), ((PyObject *)__pyx_kp_s_164)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29905 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__l_aux), ((PyObject *)__pyx_kp_s_165)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29906 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__m_data), ((PyObject *)__pyx_kp_s_166)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29907 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__data_len), ((PyObject *)__pyx_kp_s_167)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29908 __pyx_v_field_names = __pyx_t_1;
29911 /* "csamtools.pyx":2988
29912 * "data_len": "Current data length",
29914 * fields_names_in_order = ["tid", "pos", "mtid", "mpos", "isize", "flag", # <<<<<<<<<<<<<<
29915 * "n_cigar", "cigar", "qual", "bin", "l_qname", "qname",
29916 * "l_qseq", "qseq", "bqual", "l_aux", "m_data", "data_len"]
29918 __pyx_t_1 = PyList_New(18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
29919 __Pyx_GOTREF(__pyx_t_1);
29920 __Pyx_INCREF(((PyObject *)__pyx_n_s__tid));
29921 PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__tid));
29922 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tid));
29923 __Pyx_INCREF(((PyObject *)__pyx_n_s__pos));
29924 PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__pos));
29925 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos));
29926 __Pyx_INCREF(((PyObject *)__pyx_n_s__mtid));
29927 PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__mtid));
29928 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mtid));
29929 __Pyx_INCREF(((PyObject *)__pyx_n_s__mpos));
29930 PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__mpos));
29931 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mpos));
29932 __Pyx_INCREF(((PyObject *)__pyx_n_s__isize));
29933 PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__isize));
29934 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__isize));
29935 __Pyx_INCREF(((PyObject *)__pyx_n_s__flag));
29936 PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s__flag));
29937 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__flag));
29938 __Pyx_INCREF(((PyObject *)__pyx_n_s__n_cigar));
29939 PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_n_s__n_cigar));
29940 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_cigar));
29941 __Pyx_INCREF(((PyObject *)__pyx_n_s__cigar));
29942 PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_n_s__cigar));
29943 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cigar));
29944 __Pyx_INCREF(((PyObject *)__pyx_n_s__qual));
29945 PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s__qual));
29946 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__qual));
29947 __Pyx_INCREF(((PyObject *)__pyx_n_s__bin));
29948 PyList_SET_ITEM(__pyx_t_1, 9, ((PyObject *)__pyx_n_s__bin));
29949 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin));
29950 __Pyx_INCREF(((PyObject *)__pyx_n_s__l_qname));
29951 PyList_SET_ITEM(__pyx_t_1, 10, ((PyObject *)__pyx_n_s__l_qname));
29952 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l_qname));
29953 __Pyx_INCREF(((PyObject *)__pyx_n_s__qname));
29954 PyList_SET_ITEM(__pyx_t_1, 11, ((PyObject *)__pyx_n_s__qname));
29955 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__qname));
29956 __Pyx_INCREF(((PyObject *)__pyx_n_s__l_qseq));
29957 PyList_SET_ITEM(__pyx_t_1, 12, ((PyObject *)__pyx_n_s__l_qseq));
29958 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l_qseq));
29959 __Pyx_INCREF(((PyObject *)__pyx_n_s__qseq));
29960 PyList_SET_ITEM(__pyx_t_1, 13, ((PyObject *)__pyx_n_s__qseq));
29961 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__qseq));
29962 __Pyx_INCREF(((PyObject *)__pyx_n_s__bqual));
29963 PyList_SET_ITEM(__pyx_t_1, 14, ((PyObject *)__pyx_n_s__bqual));
29964 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bqual));
29965 __Pyx_INCREF(((PyObject *)__pyx_n_s__l_aux));
29966 PyList_SET_ITEM(__pyx_t_1, 15, ((PyObject *)__pyx_n_s__l_aux));
29967 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l_aux));
29968 __Pyx_INCREF(((PyObject *)__pyx_n_s__m_data));
29969 PyList_SET_ITEM(__pyx_t_1, 16, ((PyObject *)__pyx_n_s__m_data));
29970 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m_data));
29971 __Pyx_INCREF(((PyObject *)__pyx_n_s__data_len));
29972 PyList_SET_ITEM(__pyx_t_1, 17, ((PyObject *)__pyx_n_s__data_len));
29973 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data_len));
29974 __pyx_v_fields_names_in_order = __pyx_t_1;
29977 /* "csamtools.pyx":2992
29978 * "l_qseq", "qseq", "bqual", "l_aux", "m_data", "data_len"]
29980 * for f in fields_names_in_order: # <<<<<<<<<<<<<<
29981 * if not f in self.__dict__:
29984 __pyx_t_1 = ((PyObject *)__pyx_v_fields_names_in_order); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
29986 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
29987 __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
29988 __Pyx_XDECREF(__pyx_v_f);
29989 __pyx_v_f = __pyx_t_3;
29992 /* "csamtools.pyx":2993
29994 * for f in fields_names_in_order:
29995 * if not f in self.__dict__: # <<<<<<<<<<<<<<
29997 * ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f)))
29999 __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____dict__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30000 __Pyx_GOTREF(__pyx_t_3);
30001 __pyx_t_4 = ((PySequence_Contains(__pyx_t_3, __pyx_v_f))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30002 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30003 __pyx_t_5 = (!__pyx_t_4);
30006 /* "csamtools.pyx":2994
30007 * for f in fields_names_in_order:
30008 * if not f in self.__dict__:
30009 * continue # <<<<<<<<<<<<<<
30010 * ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f)))
30013 goto __pyx_L3_continue;
30018 /* "csamtools.pyx":2995
30019 * if not f in self.__dict__:
30021 * ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f))) # <<<<<<<<<<<<<<
30023 * for f in self.__dict__:
30025 __pyx_t_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_field_names), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30026 __Pyx_GOTREF(__pyx_t_3);
30027 __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_kp_s_169), __pyx_v_f); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30028 __Pyx_GOTREF(__pyx_t_6);
30029 __pyx_t_7 = PyNumber_Add(__pyx_t_6, ((PyObject *)__pyx_kp_s_170)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30030 __Pyx_GOTREF(__pyx_t_7);
30031 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
30032 __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____getattribute__); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30033 __Pyx_GOTREF(__pyx_t_6);
30034 __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30035 __Pyx_GOTREF(__pyx_t_8);
30036 __Pyx_INCREF(__pyx_v_f);
30037 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f);
30038 __Pyx_GIVEREF(__pyx_v_f);
30039 __pyx_t_9 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30040 __Pyx_GOTREF(__pyx_t_9);
30041 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
30042 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
30043 __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30044 __Pyx_GOTREF(__pyx_t_8);
30045 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3);
30046 __Pyx_GIVEREF(__pyx_t_3);
30047 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
30048 __Pyx_GIVEREF(__pyx_t_7);
30049 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_9);
30050 __Pyx_GIVEREF(__pyx_t_9);
30054 __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_168), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30055 __Pyx_GOTREF(((PyObject *)__pyx_t_9));
30056 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
30057 __pyx_t_10 = PyList_Append(__pyx_v_ret_string, ((PyObject *)__pyx_t_9)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30058 __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
30059 __pyx_L3_continue:;
30061 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30063 /* "csamtools.pyx":2997
30064 * ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f)))
30066 * for f in self.__dict__: # <<<<<<<<<<<<<<
30067 * if not f in field_names:
30068 * ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f)))
30070 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____dict__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30071 __Pyx_GOTREF(__pyx_t_1);
30072 if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
30073 __pyx_t_9 = __pyx_t_1; __Pyx_INCREF(__pyx_t_9); __pyx_t_2 = 0;
30076 __pyx_t_2 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30077 __Pyx_GOTREF(__pyx_t_9);
30078 __pyx_t_11 = Py_TYPE(__pyx_t_9)->tp_iternext;
30080 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30082 if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_9)) {
30083 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_9)) break;
30084 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++;
30085 } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_9)) {
30086 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
30087 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++;
30089 __pyx_t_1 = __pyx_t_11(__pyx_t_9);
30090 if (unlikely(!__pyx_t_1)) {
30091 if (PyErr_Occurred()) {
30092 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
30093 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30097 __Pyx_GOTREF(__pyx_t_1);
30099 __Pyx_XDECREF(__pyx_v_f);
30100 __pyx_v_f = __pyx_t_1;
30103 /* "csamtools.pyx":2998
30105 * for f in self.__dict__:
30106 * if not f in field_names: # <<<<<<<<<<<<<<
30107 * ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f)))
30108 * return ret_string
30110 __pyx_t_5 = ((PyDict_Contains(((PyObject *)__pyx_v_field_names), __pyx_v_f))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30111 __pyx_t_4 = (!__pyx_t_5);
30114 /* "csamtools.pyx":2999
30115 * for f in self.__dict__:
30116 * if not f in field_names:
30117 * ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f))) # <<<<<<<<<<<<<<
30118 * return ret_string
30121 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____getattribute__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30122 __Pyx_GOTREF(__pyx_t_1);
30123 __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30124 __Pyx_GOTREF(__pyx_t_8);
30125 __Pyx_INCREF(__pyx_v_f);
30126 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f);
30127 __Pyx_GIVEREF(__pyx_v_f);
30128 __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30129 __Pyx_GOTREF(__pyx_t_7);
30130 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30131 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
30132 __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30133 __Pyx_GOTREF(__pyx_t_8);
30134 __Pyx_INCREF(__pyx_v_f);
30135 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f);
30136 __Pyx_GIVEREF(__pyx_v_f);
30137 __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
30138 PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_kp_s_16));
30139 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16));
30140 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
30141 __Pyx_GIVEREF(__pyx_t_7);
30143 __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_168), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30144 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
30145 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
30146 __pyx_t_10 = PyList_Append(__pyx_v_ret_string, ((PyObject *)__pyx_t_7)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30147 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
30152 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
30154 /* "csamtools.pyx":3000
30155 * if not f in field_names:
30156 * ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f)))
30157 * return ret_string # <<<<<<<<<<<<<<
30159 * cdef class PileupProxy:
30161 __Pyx_XDECREF(__pyx_r);
30162 __Pyx_INCREF(((PyObject *)__pyx_v_ret_string));
30163 __pyx_r = ((PyObject *)__pyx_v_ret_string);
30166 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
30169 __Pyx_XDECREF(__pyx_t_1);
30170 __Pyx_XDECREF(__pyx_t_3);
30171 __Pyx_XDECREF(__pyx_t_6);
30172 __Pyx_XDECREF(__pyx_t_7);
30173 __Pyx_XDECREF(__pyx_t_8);
30174 __Pyx_XDECREF(__pyx_t_9);
30175 __Pyx_AddTraceback("csamtools.AlignedRead.fancy_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
30178 __Pyx_XDECREF(__pyx_v_ret_string);
30179 __Pyx_XDECREF(__pyx_v_field_names);
30180 __Pyx_XDECREF(__pyx_v_fields_names_in_order);
30181 __Pyx_XDECREF(__pyx_v_f);
30182 __Pyx_XGIVEREF(__pyx_r);
30183 __Pyx_TraceReturn(__pyx_r);
30184 __Pyx_RefNannyFinishContext();
30188 /* Python wrapper */
30189 static int __pyx_pw_9csamtools_11PileupProxy_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
30190 static int __pyx_pw_9csamtools_11PileupProxy_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
30192 __Pyx_RefNannyDeclarations
30193 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
30194 if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
30195 __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
30196 if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
30197 __pyx_r = __pyx_pf_9csamtools_11PileupProxy___init__(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self));
30198 __Pyx_RefNannyFinishContext();
30202 /* "csamtools.pyx":3019
30205 * def __init__(self): # <<<<<<<<<<<<<<
30206 * raise TypeError("This class cannot be instantiated from Python")
30210 static int __pyx_pf_9csamtools_11PileupProxy___init__(CYTHON_UNUSED struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self) {
30212 __Pyx_RefNannyDeclarations
30213 PyObject *__pyx_t_1 = NULL;
30214 int __pyx_lineno = 0;
30215 const char *__pyx_filename = NULL;
30216 int __pyx_clineno = 0;
30217 __Pyx_TraceDeclarations
30218 __Pyx_RefNannySetupContext("__init__", 0);
30219 __Pyx_TraceCall("__init__", __pyx_f[0], 3019);
30221 /* "csamtools.pyx":3020
30223 * def __init__(self):
30224 * raise TypeError("This class cannot be instantiated from Python") # <<<<<<<<<<<<<<
30226 * def __str__(self):
30228 __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_172), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30229 __Pyx_GOTREF(__pyx_t_1);
30230 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
30231 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30232 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30237 __Pyx_XDECREF(__pyx_t_1);
30238 __Pyx_AddTraceback("csamtools.PileupProxy.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
30241 __Pyx_TraceReturn(Py_None);
30242 __Pyx_RefNannyFinishContext();
30246 /* Python wrapper */
30247 static PyObject *__pyx_pw_9csamtools_11PileupProxy_3__str__(PyObject *__pyx_v_self); /*proto*/
30248 static PyObject *__pyx_pw_9csamtools_11PileupProxy_3__str__(PyObject *__pyx_v_self) {
30249 PyObject *__pyx_r = 0;
30250 __Pyx_RefNannyDeclarations
30251 __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
30252 __pyx_r = __pyx_pf_9csamtools_11PileupProxy_2__str__(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self));
30253 __Pyx_RefNannyFinishContext();
30257 /* "csamtools.pyx":3022
30258 * raise TypeError("This class cannot be instantiated from Python")
30260 * def __str__(self): # <<<<<<<<<<<<<<
30261 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
30265 static PyObject *__pyx_pf_9csamtools_11PileupProxy_2__str__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self) {
30266 PyObject *__pyx_r = NULL;
30267 __Pyx_RefNannyDeclarations
30268 PyObject *__pyx_t_1 = NULL;
30269 PyObject *__pyx_t_2 = NULL;
30270 PyObject *__pyx_t_3 = NULL;
30271 PyObject *__pyx_t_4 = NULL;
30272 PyObject *__pyx_t_5 = NULL;
30273 int __pyx_lineno = 0;
30274 const char *__pyx_filename = NULL;
30275 int __pyx_clineno = 0;
30276 __Pyx_TraceDeclarations
30277 __Pyx_RefNannySetupContext("__str__", 0);
30278 __Pyx_TraceCall("__str__", __pyx_f[0], 3022);
30280 /* "csamtools.pyx":3023
30282 * def __str__(self):
30283 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ # <<<<<<<<<<<<<<
30285 * "\n".join( map(str, self.pileups) )
30287 __Pyx_XDECREF(__pyx_r);
30289 /* "csamtools.pyx":3024
30290 * def __str__(self):
30291 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
30292 * "\n" +\ # <<<<<<<<<<<<<<
30293 * "\n".join( map(str, self.pileups) )
30296 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_5), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30297 __Pyx_GOTREF(__pyx_t_1);
30299 /* "csamtools.pyx":3023
30301 * def __str__(self):
30302 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ # <<<<<<<<<<<<<<
30304 * "\n".join( map(str, self.pileups) )
30306 __pyx_t_2 = PyInt_FromLong(__pyx_v_self->tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30307 __Pyx_GOTREF(__pyx_t_2);
30308 __pyx_t_3 = PyInt_FromLong(__pyx_v_self->pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30309 __Pyx_GOTREF(__pyx_t_3);
30310 __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30311 __Pyx_GOTREF(__pyx_t_4);
30312 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30313 __Pyx_GOTREF(__pyx_t_5);
30314 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
30315 __Pyx_GIVEREF(__pyx_t_2);
30316 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
30317 __Pyx_GIVEREF(__pyx_t_3);
30318 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
30319 __Pyx_GIVEREF(__pyx_t_4);
30323 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30324 __Pyx_GOTREF(__pyx_t_4);
30325 __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
30326 PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
30327 __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
30328 PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_5));
30329 __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
30331 __pyx_t_5 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30332 __Pyx_GOTREF(__pyx_t_5);
30333 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
30334 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30335 __Pyx_GOTREF(__pyx_t_4);
30336 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
30337 __Pyx_GIVEREF(__pyx_t_5);
30339 __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30340 __Pyx_GOTREF(__pyx_t_5);
30341 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30342 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
30343 __pyx_t_4 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30344 __Pyx_GOTREF(__pyx_t_4);
30345 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
30347 /* "csamtools.pyx":3025
30348 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
30350 * "\n".join( map(str, self.pileups) ) # <<<<<<<<<<<<<<
30354 __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_6), __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30355 __Pyx_GOTREF(__pyx_t_5);
30356 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__pileups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30357 __Pyx_GOTREF(__pyx_t_1);
30358 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30359 __Pyx_GOTREF(__pyx_t_3);
30360 __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
30361 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
30362 __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
30363 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
30364 __Pyx_GIVEREF(__pyx_t_1);
30366 __pyx_t_1 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30367 __Pyx_GOTREF(__pyx_t_1);
30368 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
30369 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30370 __Pyx_GOTREF(__pyx_t_3);
30371 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
30372 __Pyx_GIVEREF(__pyx_t_1);
30374 __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30375 __Pyx_GOTREF(__pyx_t_1);
30376 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
30377 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
30378 __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30379 __Pyx_GOTREF(__pyx_t_3);
30380 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
30381 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30382 __pyx_r = __pyx_t_3;
30386 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
30389 __Pyx_XDECREF(__pyx_t_1);
30390 __Pyx_XDECREF(__pyx_t_2);
30391 __Pyx_XDECREF(__pyx_t_3);
30392 __Pyx_XDECREF(__pyx_t_4);
30393 __Pyx_XDECREF(__pyx_t_5);
30394 __Pyx_AddTraceback("csamtools.PileupProxy.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
30397 __Pyx_XGIVEREF(__pyx_r);
30398 __Pyx_TraceReturn(__pyx_r);
30399 __Pyx_RefNannyFinishContext();
30403 /* Python wrapper */
30404 static PyObject *__pyx_pw_9csamtools_11PileupProxy_3tid_1__get__(PyObject *__pyx_v_self); /*proto*/
30405 static PyObject *__pyx_pw_9csamtools_11PileupProxy_3tid_1__get__(PyObject *__pyx_v_self) {
30406 PyObject *__pyx_r = 0;
30407 __Pyx_RefNannyDeclarations
30408 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
30409 __pyx_r = __pyx_pf_9csamtools_11PileupProxy_3tid___get__(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self));
30410 __Pyx_RefNannyFinishContext();
30414 /* "csamtools.pyx":3029
30416 * '''the chromosome ID as is defined in the header'''
30417 * def __get__(self): return self.tid # <<<<<<<<<<<<<<
30422 static PyObject *__pyx_pf_9csamtools_11PileupProxy_3tid___get__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self) {
30423 PyObject *__pyx_r = NULL;
30424 __Pyx_RefNannyDeclarations
30425 PyObject *__pyx_t_1 = NULL;
30426 int __pyx_lineno = 0;
30427 const char *__pyx_filename = NULL;
30428 int __pyx_clineno = 0;
30429 __Pyx_TraceDeclarations
30430 __Pyx_RefNannySetupContext("__get__", 0);
30431 __Pyx_TraceCall("__get__", __pyx_f[0], 3029);
30432 __Pyx_XDECREF(__pyx_r);
30433 __pyx_t_1 = PyInt_FromLong(__pyx_v_self->tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30434 __Pyx_GOTREF(__pyx_t_1);
30435 __pyx_r = __pyx_t_1;
30439 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
30442 __Pyx_XDECREF(__pyx_t_1);
30443 __Pyx_AddTraceback("csamtools.PileupProxy.tid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
30446 __Pyx_XGIVEREF(__pyx_r);
30447 __Pyx_TraceReturn(__pyx_r);
30448 __Pyx_RefNannyFinishContext();
30452 /* Python wrapper */
30453 static PyObject *__pyx_pw_9csamtools_11PileupProxy_1n_1__get__(PyObject *__pyx_v_self); /*proto*/
30454 static PyObject *__pyx_pw_9csamtools_11PileupProxy_1n_1__get__(PyObject *__pyx_v_self) {
30455 PyObject *__pyx_r = 0;
30456 __Pyx_RefNannyDeclarations
30457 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
30458 __pyx_r = __pyx_pf_9csamtools_11PileupProxy_1n___get__(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self));
30459 __Pyx_RefNannyFinishContext();
30463 /* "csamtools.pyx":3033
30465 * '''number of reads mapping to this column.'''
30466 * def __get__(self): return self.n_pu # <<<<<<<<<<<<<<
30467 * def __set__(self, n): self.n_pu = n
30471 static PyObject *__pyx_pf_9csamtools_11PileupProxy_1n___get__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self) {
30472 PyObject *__pyx_r = NULL;
30473 __Pyx_RefNannyDeclarations
30474 PyObject *__pyx_t_1 = NULL;
30475 int __pyx_lineno = 0;
30476 const char *__pyx_filename = NULL;
30477 int __pyx_clineno = 0;
30478 __Pyx_TraceDeclarations
30479 __Pyx_RefNannySetupContext("__get__", 0);
30480 __Pyx_TraceCall("__get__", __pyx_f[0], 3033);
30481 __Pyx_XDECREF(__pyx_r);
30482 __pyx_t_1 = PyInt_FromLong(__pyx_v_self->n_pu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30483 __Pyx_GOTREF(__pyx_t_1);
30484 __pyx_r = __pyx_t_1;
30488 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
30491 __Pyx_XDECREF(__pyx_t_1);
30492 __Pyx_AddTraceback("csamtools.PileupProxy.n.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
30495 __Pyx_XGIVEREF(__pyx_r);
30496 __Pyx_TraceReturn(__pyx_r);
30497 __Pyx_RefNannyFinishContext();
30501 /* Python wrapper */
30502 static int __pyx_pw_9csamtools_11PileupProxy_1n_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/
30503 static int __pyx_pw_9csamtools_11PileupProxy_1n_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_n) {
30505 __Pyx_RefNannyDeclarations
30506 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
30507 __pyx_r = __pyx_pf_9csamtools_11PileupProxy_1n_2__set__(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self), ((PyObject *)__pyx_v_n));
30508 __Pyx_RefNannyFinishContext();
30512 /* "csamtools.pyx":3034
30513 * '''number of reads mapping to this column.'''
30514 * def __get__(self): return self.n_pu
30515 * def __set__(self, n): self.n_pu = n # <<<<<<<<<<<<<<
30520 static int __pyx_pf_9csamtools_11PileupProxy_1n_2__set__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self, PyObject *__pyx_v_n) {
30522 __Pyx_RefNannyDeclarations
30524 int __pyx_lineno = 0;
30525 const char *__pyx_filename = NULL;
30526 int __pyx_clineno = 0;
30527 __Pyx_TraceDeclarations
30528 __Pyx_RefNannySetupContext("__set__", 0);
30529 __Pyx_TraceCall("__set__", __pyx_f[0], 3034);
30530 __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_n); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30531 __pyx_v_self->n_pu = __pyx_t_1;
30536 __Pyx_AddTraceback("csamtools.PileupProxy.n.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
30539 __Pyx_TraceReturn(Py_None);
30540 __Pyx_RefNannyFinishContext();
30544 /* Python wrapper */
30545 static PyObject *__pyx_pw_9csamtools_11PileupProxy_3pos_1__get__(PyObject *__pyx_v_self); /*proto*/
30546 static PyObject *__pyx_pw_9csamtools_11PileupProxy_3pos_1__get__(PyObject *__pyx_v_self) {
30547 PyObject *__pyx_r = 0;
30548 __Pyx_RefNannyDeclarations
30549 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
30550 __pyx_r = __pyx_pf_9csamtools_11PileupProxy_3pos___get__(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self));
30551 __Pyx_RefNannyFinishContext();
30555 /* "csamtools.pyx":3037
30558 * def __get__(self): return self.pos # <<<<<<<<<<<<<<
30560 * property pileups:
30563 static PyObject *__pyx_pf_9csamtools_11PileupProxy_3pos___get__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self) {
30564 PyObject *__pyx_r = NULL;
30565 __Pyx_RefNannyDeclarations
30566 PyObject *__pyx_t_1 = NULL;
30567 int __pyx_lineno = 0;
30568 const char *__pyx_filename = NULL;
30569 int __pyx_clineno = 0;
30570 __Pyx_TraceDeclarations
30571 __Pyx_RefNannySetupContext("__get__", 0);
30572 __Pyx_TraceCall("__get__", __pyx_f[0], 3037);
30573 __Pyx_XDECREF(__pyx_r);
30574 __pyx_t_1 = PyInt_FromLong(__pyx_v_self->pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30575 __Pyx_GOTREF(__pyx_t_1);
30576 __pyx_r = __pyx_t_1;
30580 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
30583 __Pyx_XDECREF(__pyx_t_1);
30584 __Pyx_AddTraceback("csamtools.PileupProxy.pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
30587 __Pyx_XGIVEREF(__pyx_r);
30588 __Pyx_TraceReturn(__pyx_r);
30589 __Pyx_RefNannyFinishContext();
30593 /* Python wrapper */
30594 static PyObject *__pyx_pw_9csamtools_11PileupProxy_7pileups_1__get__(PyObject *__pyx_v_self); /*proto*/
30595 static PyObject *__pyx_pw_9csamtools_11PileupProxy_7pileups_1__get__(PyObject *__pyx_v_self) {
30596 PyObject *__pyx_r = 0;
30597 __Pyx_RefNannyDeclarations
30598 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
30599 __pyx_r = __pyx_pf_9csamtools_11PileupProxy_7pileups___get__(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self));
30600 __Pyx_RefNannyFinishContext();
30604 /* "csamtools.pyx":3041
30605 * property pileups:
30606 * '''list of reads (:class:`pysam.PileupRead`) aligned to this column'''
30607 * def __get__(self): # <<<<<<<<<<<<<<
30612 static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_self) {
30614 PyObject *__pyx_v_pileups = NULL;
30615 PyObject *__pyx_r = NULL;
30616 __Pyx_RefNannyDeclarations
30617 PyObject *__pyx_t_1 = NULL;
30621 int __pyx_lineno = 0;
30622 const char *__pyx_filename = NULL;
30623 int __pyx_clineno = 0;
30624 __Pyx_TraceDeclarations
30625 __Pyx_RefNannySetupContext("__get__", 0);
30626 __Pyx_TraceCall("__get__", __pyx_f[0], 3041);
30628 /* "csamtools.pyx":3043
30629 * def __get__(self):
30631 * pileups = [] # <<<<<<<<<<<<<<
30633 * if self.plp[0] == NULL:
30635 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30636 __Pyx_GOTREF(__pyx_t_1);
30637 __pyx_v_pileups = __pyx_t_1;
30640 /* "csamtools.pyx":3045
30643 * if self.plp[0] == NULL: # <<<<<<<<<<<<<<
30644 * raise ValueError("PileupProxy accessed after iterator finished")
30647 __pyx_t_2 = ((__pyx_v_self->plp[0]) == NULL);
30650 /* "csamtools.pyx":3046
30652 * if self.plp[0] == NULL:
30653 * raise ValueError("PileupProxy accessed after iterator finished") # <<<<<<<<<<<<<<
30655 * # warning: there could be problems if self.n and self.buf are
30657 __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_174), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30658 __Pyx_GOTREF(__pyx_t_1);
30659 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
30660 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30661 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30666 /* "csamtools.pyx":3050
30667 * # warning: there could be problems if self.n and self.buf are
30669 * for x from 0 <= x < self.n_pu: # <<<<<<<<<<<<<<
30670 * pileups.append( makePileupRead( &(self.plp[0][x])) )
30673 __pyx_t_3 = __pyx_v_self->n_pu;
30674 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
30676 /* "csamtools.pyx":3051
30678 * for x from 0 <= x < self.n_pu:
30679 * pileups.append( makePileupRead( &(self.plp[0][x])) ) # <<<<<<<<<<<<<<
30683 __pyx_t_1 = __pyx_f_9csamtools_makePileupRead((&((__pyx_v_self->plp[0])[__pyx_v_x]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30684 __Pyx_GOTREF(__pyx_t_1);
30685 __pyx_t_4 = PyList_Append(__pyx_v_pileups, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30686 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30689 /* "csamtools.pyx":3052
30690 * for x from 0 <= x < self.n_pu:
30691 * pileups.append( makePileupRead( &(self.plp[0][x])) )
30692 * return pileups # <<<<<<<<<<<<<<
30694 * cdef class PileupRead:
30696 __Pyx_XDECREF(__pyx_r);
30697 __Pyx_INCREF(((PyObject *)__pyx_v_pileups));
30698 __pyx_r = ((PyObject *)__pyx_v_pileups);
30701 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
30704 __Pyx_XDECREF(__pyx_t_1);
30705 __Pyx_AddTraceback("csamtools.PileupProxy.pileups.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
30708 __Pyx_XDECREF(__pyx_v_pileups);
30709 __Pyx_XGIVEREF(__pyx_r);
30710 __Pyx_TraceReturn(__pyx_r);
30711 __Pyx_RefNannyFinishContext();
30715 /* Python wrapper */
30716 static int __pyx_pw_9csamtools_10PileupRead_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
30717 static int __pyx_pw_9csamtools_10PileupRead_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
30719 __Pyx_RefNannyDeclarations
30720 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
30721 if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
30722 __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
30723 if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
30724 __pyx_r = __pyx_pf_9csamtools_10PileupRead___init__(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self));
30725 __Pyx_RefNannyFinishContext();
30729 /* "csamtools.pyx":3058
30732 * def __init__(self): # <<<<<<<<<<<<<<
30733 * raise TypeError("This class cannot be instantiated from Python")
30737 static int __pyx_pf_9csamtools_10PileupRead___init__(CYTHON_UNUSED struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self) {
30739 __Pyx_RefNannyDeclarations
30740 PyObject *__pyx_t_1 = NULL;
30741 int __pyx_lineno = 0;
30742 const char *__pyx_filename = NULL;
30743 int __pyx_clineno = 0;
30744 __Pyx_TraceDeclarations
30745 __Pyx_RefNannySetupContext("__init__", 0);
30746 __Pyx_TraceCall("__init__", __pyx_f[0], 3058);
30748 /* "csamtools.pyx":3059
30750 * def __init__(self):
30751 * raise TypeError("This class cannot be instantiated from Python") # <<<<<<<<<<<<<<
30753 * def __str__(self):
30755 __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_175), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30756 __Pyx_GOTREF(__pyx_t_1);
30757 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
30758 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30759 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30764 __Pyx_XDECREF(__pyx_t_1);
30765 __Pyx_AddTraceback("csamtools.PileupRead.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
30768 __Pyx_TraceReturn(Py_None);
30769 __Pyx_RefNannyFinishContext();
30773 /* Python wrapper */
30774 static PyObject *__pyx_pw_9csamtools_10PileupRead_3__str__(PyObject *__pyx_v_self); /*proto*/
30775 static PyObject *__pyx_pw_9csamtools_10PileupRead_3__str__(PyObject *__pyx_v_self) {
30776 PyObject *__pyx_r = 0;
30777 __Pyx_RefNannyDeclarations
30778 __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
30779 __pyx_r = __pyx_pf_9csamtools_10PileupRead_2__str__(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self));
30780 __Pyx_RefNannyFinishContext();
30784 /* "csamtools.pyx":3061
30785 * raise TypeError("This class cannot be instantiated from Python")
30787 * def __str__(self): # <<<<<<<<<<<<<<
30788 * return "\t".join( map(str, (self.alignment, self.qpos, self.indel, self.level, self.is_del, self.is_head, self.is_tail ) ) )
30792 static PyObject *__pyx_pf_9csamtools_10PileupRead_2__str__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self) {
30793 PyObject *__pyx_r = NULL;
30794 __Pyx_RefNannyDeclarations
30795 PyObject *__pyx_t_1 = NULL;
30796 PyObject *__pyx_t_2 = NULL;
30797 PyObject *__pyx_t_3 = NULL;
30798 PyObject *__pyx_t_4 = NULL;
30799 PyObject *__pyx_t_5 = NULL;
30800 PyObject *__pyx_t_6 = NULL;
30801 PyObject *__pyx_t_7 = NULL;
30802 PyObject *__pyx_t_8 = NULL;
30803 PyObject *__pyx_t_9 = NULL;
30804 int __pyx_lineno = 0;
30805 const char *__pyx_filename = NULL;
30806 int __pyx_clineno = 0;
30807 __Pyx_TraceDeclarations
30808 __Pyx_RefNannySetupContext("__str__", 0);
30809 __Pyx_TraceCall("__str__", __pyx_f[0], 3061);
30811 /* "csamtools.pyx":3062
30813 * def __str__(self):
30814 * return "\t".join( map(str, (self.alignment, self.qpos, self.indel, self.level, self.is_del, self.is_head, self.is_tail ) ) ) # <<<<<<<<<<<<<<
30816 * property alignment:
30818 __Pyx_XDECREF(__pyx_r);
30819 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_5), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30820 __Pyx_GOTREF(__pyx_t_1);
30821 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__alignment); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30822 __Pyx_GOTREF(__pyx_t_2);
30823 __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__qpos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30824 __Pyx_GOTREF(__pyx_t_3);
30825 __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__indel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30826 __Pyx_GOTREF(__pyx_t_4);
30827 __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__level); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30828 __Pyx_GOTREF(__pyx_t_5);
30829 __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__is_del); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30830 __Pyx_GOTREF(__pyx_t_6);
30831 __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__is_head); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30832 __Pyx_GOTREF(__pyx_t_7);
30833 __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__is_tail); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30834 __Pyx_GOTREF(__pyx_t_8);
30835 __pyx_t_9 = PyTuple_New(7); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30836 __Pyx_GOTREF(__pyx_t_9);
30837 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
30838 __Pyx_GIVEREF(__pyx_t_2);
30839 PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
30840 __Pyx_GIVEREF(__pyx_t_3);
30841 PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_4);
30842 __Pyx_GIVEREF(__pyx_t_4);
30843 PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_5);
30844 __Pyx_GIVEREF(__pyx_t_5);
30845 PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_t_6);
30846 __Pyx_GIVEREF(__pyx_t_6);
30847 PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_t_7);
30848 __Pyx_GIVEREF(__pyx_t_7);
30849 PyTuple_SET_ITEM(__pyx_t_9, 6, __pyx_t_8);
30850 __Pyx_GIVEREF(__pyx_t_8);
30858 __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30859 __Pyx_GOTREF(__pyx_t_8);
30860 __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
30861 PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
30862 __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
30863 PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_t_9));
30864 __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
30866 __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 = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30867 __Pyx_GOTREF(__pyx_t_9);
30868 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
30869 __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30870 __Pyx_GOTREF(__pyx_t_8);
30871 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
30872 __Pyx_GIVEREF(__pyx_t_9);
30874 __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 = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30875 __Pyx_GOTREF(__pyx_t_9);
30876 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30877 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
30878 __pyx_r = __pyx_t_9;
30882 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
30885 __Pyx_XDECREF(__pyx_t_1);
30886 __Pyx_XDECREF(__pyx_t_2);
30887 __Pyx_XDECREF(__pyx_t_3);
30888 __Pyx_XDECREF(__pyx_t_4);
30889 __Pyx_XDECREF(__pyx_t_5);
30890 __Pyx_XDECREF(__pyx_t_6);
30891 __Pyx_XDECREF(__pyx_t_7);
30892 __Pyx_XDECREF(__pyx_t_8);
30893 __Pyx_XDECREF(__pyx_t_9);
30894 __Pyx_AddTraceback("csamtools.PileupRead.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
30897 __Pyx_XGIVEREF(__pyx_r);
30898 __Pyx_TraceReturn(__pyx_r);
30899 __Pyx_RefNannyFinishContext();
30903 /* Python wrapper */
30904 static PyObject *__pyx_pw_9csamtools_10PileupRead_9alignment_1__get__(PyObject *__pyx_v_self); /*proto*/
30905 static PyObject *__pyx_pw_9csamtools_10PileupRead_9alignment_1__get__(PyObject *__pyx_v_self) {
30906 PyObject *__pyx_r = 0;
30907 __Pyx_RefNannyDeclarations
30908 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
30909 __pyx_r = __pyx_pf_9csamtools_10PileupRead_9alignment___get__(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self));
30910 __Pyx_RefNannyFinishContext();
30914 /* "csamtools.pyx":3066
30915 * property alignment:
30916 * """a :class:`pysam.AlignedRead` object of the aligned read"""
30917 * def __get__(self): # <<<<<<<<<<<<<<
30918 * return self._alignment
30922 static PyObject *__pyx_pf_9csamtools_10PileupRead_9alignment___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self) {
30923 PyObject *__pyx_r = NULL;
30924 __Pyx_RefNannyDeclarations
30925 __Pyx_TraceDeclarations
30926 __Pyx_RefNannySetupContext("__get__", 0);
30927 __Pyx_TraceCall("__get__", __pyx_f[0], 3066);
30929 /* "csamtools.pyx":3067
30930 * """a :class:`pysam.AlignedRead` object of the aligned read"""
30931 * def __get__(self):
30932 * return self._alignment # <<<<<<<<<<<<<<
30934 * """position of the read base at the pileup site, 0-based"""
30936 __Pyx_XDECREF(__pyx_r);
30937 __Pyx_INCREF(((PyObject *)__pyx_v_self->_alignment));
30938 __pyx_r = ((PyObject *)__pyx_v_self->_alignment);
30941 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
30943 __Pyx_XGIVEREF(__pyx_r);
30944 __Pyx_TraceReturn(__pyx_r);
30945 __Pyx_RefNannyFinishContext();
30949 /* Python wrapper */
30950 static PyObject *__pyx_pw_9csamtools_10PileupRead_4qpos_1__get__(PyObject *__pyx_v_self); /*proto*/
30951 static PyObject *__pyx_pw_9csamtools_10PileupRead_4qpos_1__get__(PyObject *__pyx_v_self) {
30952 PyObject *__pyx_r = 0;
30953 __Pyx_RefNannyDeclarations
30954 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
30955 __pyx_r = __pyx_pf_9csamtools_10PileupRead_4qpos___get__(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self));
30956 __Pyx_RefNannyFinishContext();
30960 /* "csamtools.pyx":3070
30962 * """position of the read base at the pileup site, 0-based"""
30963 * def __get__(self): # <<<<<<<<<<<<<<
30964 * return self._qpos
30968 static PyObject *__pyx_pf_9csamtools_10PileupRead_4qpos___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self) {
30969 PyObject *__pyx_r = NULL;
30970 __Pyx_RefNannyDeclarations
30971 PyObject *__pyx_t_1 = NULL;
30972 int __pyx_lineno = 0;
30973 const char *__pyx_filename = NULL;
30974 int __pyx_clineno = 0;
30975 __Pyx_TraceDeclarations
30976 __Pyx_RefNannySetupContext("__get__", 0);
30977 __Pyx_TraceCall("__get__", __pyx_f[0], 3070);
30979 /* "csamtools.pyx":3071
30980 * """position of the read base at the pileup site, 0-based"""
30981 * def __get__(self):
30982 * return self._qpos # <<<<<<<<<<<<<<
30984 * """indel length; 0 for no indel, positive for ins and negative for del"""
30986 __Pyx_XDECREF(__pyx_r);
30987 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_qpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
30988 __Pyx_GOTREF(__pyx_t_1);
30989 __pyx_r = __pyx_t_1;
30993 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
30996 __Pyx_XDECREF(__pyx_t_1);
30997 __Pyx_AddTraceback("csamtools.PileupRead.qpos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31000 __Pyx_XGIVEREF(__pyx_r);
31001 __Pyx_TraceReturn(__pyx_r);
31002 __Pyx_RefNannyFinishContext();
31006 /* Python wrapper */
31007 static PyObject *__pyx_pw_9csamtools_10PileupRead_5indel_1__get__(PyObject *__pyx_v_self); /*proto*/
31008 static PyObject *__pyx_pw_9csamtools_10PileupRead_5indel_1__get__(PyObject *__pyx_v_self) {
31009 PyObject *__pyx_r = 0;
31010 __Pyx_RefNannyDeclarations
31011 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
31012 __pyx_r = __pyx_pf_9csamtools_10PileupRead_5indel___get__(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self));
31013 __Pyx_RefNannyFinishContext();
31017 /* "csamtools.pyx":3074
31019 * """indel length; 0 for no indel, positive for ins and negative for del"""
31020 * def __get__(self): # <<<<<<<<<<<<<<
31021 * return self._indel
31025 static PyObject *__pyx_pf_9csamtools_10PileupRead_5indel___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self) {
31026 PyObject *__pyx_r = NULL;
31027 __Pyx_RefNannyDeclarations
31028 PyObject *__pyx_t_1 = NULL;
31029 int __pyx_lineno = 0;
31030 const char *__pyx_filename = NULL;
31031 int __pyx_clineno = 0;
31032 __Pyx_TraceDeclarations
31033 __Pyx_RefNannySetupContext("__get__", 0);
31034 __Pyx_TraceCall("__get__", __pyx_f[0], 3074);
31036 /* "csamtools.pyx":3075
31037 * """indel length; 0 for no indel, positive for ins and negative for del"""
31038 * def __get__(self):
31039 * return self._indel # <<<<<<<<<<<<<<
31041 * """1 iff the base on the padded read is a deletion"""
31043 __Pyx_XDECREF(__pyx_r);
31044 __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_indel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31045 __Pyx_GOTREF(__pyx_t_1);
31046 __pyx_r = __pyx_t_1;
31050 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
31053 __Pyx_XDECREF(__pyx_t_1);
31054 __Pyx_AddTraceback("csamtools.PileupRead.indel.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31057 __Pyx_XGIVEREF(__pyx_r);
31058 __Pyx_TraceReturn(__pyx_r);
31059 __Pyx_RefNannyFinishContext();
31063 /* Python wrapper */
31064 static PyObject *__pyx_pw_9csamtools_10PileupRead_6is_del_1__get__(PyObject *__pyx_v_self); /*proto*/
31065 static PyObject *__pyx_pw_9csamtools_10PileupRead_6is_del_1__get__(PyObject *__pyx_v_self) {
31066 PyObject *__pyx_r = 0;
31067 __Pyx_RefNannyDeclarations
31068 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
31069 __pyx_r = __pyx_pf_9csamtools_10PileupRead_6is_del___get__(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self));
31070 __Pyx_RefNannyFinishContext();
31074 /* "csamtools.pyx":3078
31076 * """1 iff the base on the padded read is a deletion"""
31077 * def __get__(self): # <<<<<<<<<<<<<<
31078 * return self._is_del
31079 * property is_head:
31082 static PyObject *__pyx_pf_9csamtools_10PileupRead_6is_del___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self) {
31083 PyObject *__pyx_r = NULL;
31084 __Pyx_RefNannyDeclarations
31085 PyObject *__pyx_t_1 = NULL;
31086 int __pyx_lineno = 0;
31087 const char *__pyx_filename = NULL;
31088 int __pyx_clineno = 0;
31089 __Pyx_TraceDeclarations
31090 __Pyx_RefNannySetupContext("__get__", 0);
31091 __Pyx_TraceCall("__get__", __pyx_f[0], 3078);
31093 /* "csamtools.pyx":3079
31094 * """1 iff the base on the padded read is a deletion"""
31095 * def __get__(self):
31096 * return self._is_del # <<<<<<<<<<<<<<
31097 * property is_head:
31098 * def __get__(self):
31100 __Pyx_XDECREF(__pyx_r);
31101 __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_self->_is_del); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31102 __Pyx_GOTREF(__pyx_t_1);
31103 __pyx_r = __pyx_t_1;
31107 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
31110 __Pyx_XDECREF(__pyx_t_1);
31111 __Pyx_AddTraceback("csamtools.PileupRead.is_del.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31114 __Pyx_XGIVEREF(__pyx_r);
31115 __Pyx_TraceReturn(__pyx_r);
31116 __Pyx_RefNannyFinishContext();
31120 /* Python wrapper */
31121 static PyObject *__pyx_pw_9csamtools_10PileupRead_7is_head_1__get__(PyObject *__pyx_v_self); /*proto*/
31122 static PyObject *__pyx_pw_9csamtools_10PileupRead_7is_head_1__get__(PyObject *__pyx_v_self) {
31123 PyObject *__pyx_r = 0;
31124 __Pyx_RefNannyDeclarations
31125 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
31126 __pyx_r = __pyx_pf_9csamtools_10PileupRead_7is_head___get__(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self));
31127 __Pyx_RefNannyFinishContext();
31131 /* "csamtools.pyx":3081
31132 * return self._is_del
31133 * property is_head:
31134 * def __get__(self): # <<<<<<<<<<<<<<
31135 * return self._is_head
31136 * property is_tail:
31139 static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_head___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self) {
31140 PyObject *__pyx_r = NULL;
31141 __Pyx_RefNannyDeclarations
31142 PyObject *__pyx_t_1 = NULL;
31143 int __pyx_lineno = 0;
31144 const char *__pyx_filename = NULL;
31145 int __pyx_clineno = 0;
31146 __Pyx_TraceDeclarations
31147 __Pyx_RefNannySetupContext("__get__", 0);
31148 __Pyx_TraceCall("__get__", __pyx_f[0], 3081);
31150 /* "csamtools.pyx":3082
31151 * property is_head:
31152 * def __get__(self):
31153 * return self._is_head # <<<<<<<<<<<<<<
31154 * property is_tail:
31155 * def __get__(self):
31157 __Pyx_XDECREF(__pyx_r);
31158 __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_self->_is_head); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31159 __Pyx_GOTREF(__pyx_t_1);
31160 __pyx_r = __pyx_t_1;
31164 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
31167 __Pyx_XDECREF(__pyx_t_1);
31168 __Pyx_AddTraceback("csamtools.PileupRead.is_head.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31171 __Pyx_XGIVEREF(__pyx_r);
31172 __Pyx_TraceReturn(__pyx_r);
31173 __Pyx_RefNannyFinishContext();
31177 /* Python wrapper */
31178 static PyObject *__pyx_pw_9csamtools_10PileupRead_7is_tail_1__get__(PyObject *__pyx_v_self); /*proto*/
31179 static PyObject *__pyx_pw_9csamtools_10PileupRead_7is_tail_1__get__(PyObject *__pyx_v_self) {
31180 PyObject *__pyx_r = 0;
31181 __Pyx_RefNannyDeclarations
31182 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
31183 __pyx_r = __pyx_pf_9csamtools_10PileupRead_7is_tail___get__(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self));
31184 __Pyx_RefNannyFinishContext();
31188 /* "csamtools.pyx":3084
31189 * return self._is_head
31190 * property is_tail:
31191 * def __get__(self): # <<<<<<<<<<<<<<
31192 * return self._is_tail
31196 static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_tail___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self) {
31197 PyObject *__pyx_r = NULL;
31198 __Pyx_RefNannyDeclarations
31199 PyObject *__pyx_t_1 = NULL;
31200 int __pyx_lineno = 0;
31201 const char *__pyx_filename = NULL;
31202 int __pyx_clineno = 0;
31203 __Pyx_TraceDeclarations
31204 __Pyx_RefNannySetupContext("__get__", 0);
31205 __Pyx_TraceCall("__get__", __pyx_f[0], 3084);
31207 /* "csamtools.pyx":3085
31208 * property is_tail:
31209 * def __get__(self):
31210 * return self._is_tail # <<<<<<<<<<<<<<
31212 * def __get__(self):
31214 __Pyx_XDECREF(__pyx_r);
31215 __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_self->_is_tail); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31216 __Pyx_GOTREF(__pyx_t_1);
31217 __pyx_r = __pyx_t_1;
31221 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
31224 __Pyx_XDECREF(__pyx_t_1);
31225 __Pyx_AddTraceback("csamtools.PileupRead.is_tail.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31228 __Pyx_XGIVEREF(__pyx_r);
31229 __Pyx_TraceReturn(__pyx_r);
31230 __Pyx_RefNannyFinishContext();
31234 /* Python wrapper */
31235 static PyObject *__pyx_pw_9csamtools_10PileupRead_5level_1__get__(PyObject *__pyx_v_self); /*proto*/
31236 static PyObject *__pyx_pw_9csamtools_10PileupRead_5level_1__get__(PyObject *__pyx_v_self) {
31237 PyObject *__pyx_r = 0;
31238 __Pyx_RefNannyDeclarations
31239 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
31240 __pyx_r = __pyx_pf_9csamtools_10PileupRead_5level___get__(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self));
31241 __Pyx_RefNannyFinishContext();
31245 /* "csamtools.pyx":3087
31246 * return self._is_tail
31248 * def __get__(self): # <<<<<<<<<<<<<<
31249 * return self._level
31253 static PyObject *__pyx_pf_9csamtools_10PileupRead_5level___get__(struct __pyx_obj_9csamtools_PileupRead *__pyx_v_self) {
31254 PyObject *__pyx_r = NULL;
31255 __Pyx_RefNannyDeclarations
31256 PyObject *__pyx_t_1 = NULL;
31257 int __pyx_lineno = 0;
31258 const char *__pyx_filename = NULL;
31259 int __pyx_clineno = 0;
31260 __Pyx_TraceDeclarations
31261 __Pyx_RefNannySetupContext("__get__", 0);
31262 __Pyx_TraceCall("__get__", __pyx_f[0], 3087);
31264 /* "csamtools.pyx":3088
31266 * def __get__(self):
31267 * return self._level # <<<<<<<<<<<<<<
31271 __Pyx_XDECREF(__pyx_r);
31272 __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31273 __Pyx_GOTREF(__pyx_t_1);
31274 __pyx_r = __pyx_t_1;
31278 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
31281 __Pyx_XDECREF(__pyx_t_1);
31282 __Pyx_AddTraceback("csamtools.PileupRead.level.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31285 __Pyx_XGIVEREF(__pyx_r);
31286 __Pyx_TraceReturn(__pyx_r);
31287 __Pyx_RefNannyFinishContext();
31291 /* Python wrapper */
31292 static PyObject *__pyx_pw_9csamtools_4Outs_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
31293 static char __pyx_doc_9csamtools_4Outs___init__[] = "Outs.__init__(self, id=1)";
31294 static PyMethodDef __pyx_mdef_9csamtools_4Outs_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_9csamtools_4Outs_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs___init__)};
31295 static PyObject *__pyx_pw_9csamtools_4Outs_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
31296 PyObject *__pyx_v_self = 0;
31297 PyObject *__pyx_v_id = 0;
31298 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__id,0};
31299 PyObject *__pyx_r = 0;
31300 __Pyx_RefNannyDeclarations
31301 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
31302 __pyx_self = __pyx_self;
31304 PyObject* values[2] = {0,0};
31305 values[1] = ((PyObject *)((PyObject *)__pyx_int_1));
31306 if (unlikely(__pyx_kwds)) {
31307 Py_ssize_t kw_args;
31308 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
31309 switch (pos_args) {
31310 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
31311 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
31313 default: goto __pyx_L5_argtuple_error;
31315 kw_args = PyDict_Size(__pyx_kwds);
31316 switch (pos_args) {
31318 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
31319 if (likely(values[0])) kw_args--;
31320 else goto __pyx_L5_argtuple_error;
31323 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__id);
31324 if (value) { values[1] = value; kw_args--; }
31327 if (unlikely(kw_args > 0)) {
31328 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
31331 switch (PyTuple_GET_SIZE(__pyx_args)) {
31332 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
31333 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
31335 default: goto __pyx_L5_argtuple_error;
31338 __pyx_v_self = values[0];
31339 __pyx_v_id = values[1];
31341 goto __pyx_L4_argument_unpacking_done;
31342 __pyx_L5_argtuple_error:;
31343 __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
31345 __Pyx_AddTraceback("csamtools.Outs.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31346 __Pyx_RefNannyFinishContext();
31348 __pyx_L4_argument_unpacking_done:;
31349 __pyx_r = __pyx_pf_9csamtools_4Outs___init__(__pyx_self, __pyx_v_self, __pyx_v_id);
31350 __Pyx_RefNannyFinishContext();
31354 /* "csamtools.pyx":3092
31356 * '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
31357 * def __init__(self, id = 1): # <<<<<<<<<<<<<<
31358 * self.streams = []
31362 static PyObject *__pyx_pf_9csamtools_4Outs___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_id) {
31363 PyObject *__pyx_r = NULL;
31364 __Pyx_RefNannyDeclarations
31365 PyObject *__pyx_t_1 = NULL;
31366 int __pyx_lineno = 0;
31367 const char *__pyx_filename = NULL;
31368 int __pyx_clineno = 0;
31369 __Pyx_TraceDeclarations
31370 __Pyx_RefNannySetupContext("__init__", 0);
31371 __Pyx_TraceCall("__init__", __pyx_f[0], 3092);
31373 /* "csamtools.pyx":3093
31374 * '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
31375 * def __init__(self, id = 1):
31376 * self.streams = [] # <<<<<<<<<<<<<<
31380 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31381 __Pyx_GOTREF(__pyx_t_1);
31382 if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__streams, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31383 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
31385 /* "csamtools.pyx":3094
31386 * def __init__(self, id = 1):
31387 * self.streams = []
31388 * self.id = id # <<<<<<<<<<<<<<
31390 * def setdevice(self, filename):
31392 if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__id, __pyx_v_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31394 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
31397 __Pyx_XDECREF(__pyx_t_1);
31398 __Pyx_AddTraceback("csamtools.Outs.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31401 __Pyx_XGIVEREF(__pyx_r);
31402 __Pyx_TraceReturn(__pyx_r);
31403 __Pyx_RefNannyFinishContext();
31407 /* Python wrapper */
31408 static PyObject *__pyx_pw_9csamtools_4Outs_3setdevice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
31409 static char __pyx_doc_9csamtools_4Outs_2setdevice[] = "Outs.setdevice(self, filename)\nopen an existing file, like \"/dev/null\"";
31410 static PyMethodDef __pyx_mdef_9csamtools_4Outs_3setdevice = {__Pyx_NAMESTR("setdevice"), (PyCFunction)__pyx_pw_9csamtools_4Outs_3setdevice, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_2setdevice)};
31411 static PyObject *__pyx_pw_9csamtools_4Outs_3setdevice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
31412 PyObject *__pyx_v_self = 0;
31413 PyObject *__pyx_v_filename = 0;
31414 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filename,0};
31415 PyObject *__pyx_r = 0;
31416 __Pyx_RefNannyDeclarations
31417 __Pyx_RefNannySetupContext("setdevice (wrapper)", 0);
31418 __pyx_self = __pyx_self;
31420 PyObject* values[2] = {0,0};
31421 if (unlikely(__pyx_kwds)) {
31422 Py_ssize_t kw_args;
31423 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
31424 switch (pos_args) {
31425 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
31426 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
31428 default: goto __pyx_L5_argtuple_error;
31430 kw_args = PyDict_Size(__pyx_kwds);
31431 switch (pos_args) {
31433 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
31434 if (likely(values[0])) kw_args--;
31435 else goto __pyx_L5_argtuple_error;
31437 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
31438 if (likely(values[1])) kw_args--;
31440 __Pyx_RaiseArgtupleInvalid("setdevice", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
31443 if (unlikely(kw_args > 0)) {
31444 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setdevice") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
31446 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
31447 goto __pyx_L5_argtuple_error;
31449 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
31450 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
31452 __pyx_v_self = values[0];
31453 __pyx_v_filename = values[1];
31455 goto __pyx_L4_argument_unpacking_done;
31456 __pyx_L5_argtuple_error:;
31457 __Pyx_RaiseArgtupleInvalid("setdevice", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
31459 __Pyx_AddTraceback("csamtools.Outs.setdevice", __pyx_clineno, __pyx_lineno, __pyx_filename);
31460 __Pyx_RefNannyFinishContext();
31462 __pyx_L4_argument_unpacking_done:;
31463 __pyx_r = __pyx_pf_9csamtools_4Outs_2setdevice(__pyx_self, __pyx_v_self, __pyx_v_filename);
31464 __Pyx_RefNannyFinishContext();
31468 /* "csamtools.pyx":3096
31471 * def setdevice(self, filename): # <<<<<<<<<<<<<<
31472 * '''open an existing file, like "/dev/null"'''
31473 * fd = os.open(filename, os.O_WRONLY)
31476 static PyObject *__pyx_pf_9csamtools_4Outs_2setdevice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
31477 PyObject *__pyx_v_fd = NULL;
31478 PyObject *__pyx_r = NULL;
31479 __Pyx_RefNannyDeclarations
31480 PyObject *__pyx_t_1 = NULL;
31481 PyObject *__pyx_t_2 = NULL;
31482 PyObject *__pyx_t_3 = NULL;
31483 int __pyx_lineno = 0;
31484 const char *__pyx_filename = NULL;
31485 int __pyx_clineno = 0;
31486 __Pyx_TraceDeclarations
31487 __Pyx_RefNannySetupContext("setdevice", 0);
31488 __Pyx_TraceCall("setdevice", __pyx_f[0], 3096);
31490 /* "csamtools.pyx":3098
31491 * def setdevice(self, filename):
31492 * '''open an existing file, like "/dev/null"'''
31493 * fd = os.open(filename, os.O_WRONLY) # <<<<<<<<<<<<<<
31497 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31498 __Pyx_GOTREF(__pyx_t_1);
31499 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__open); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31500 __Pyx_GOTREF(__pyx_t_2);
31501 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31502 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31503 __Pyx_GOTREF(__pyx_t_1);
31504 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__O_WRONLY); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31505 __Pyx_GOTREF(__pyx_t_3);
31506 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31507 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31508 __Pyx_GOTREF(__pyx_t_1);
31509 __Pyx_INCREF(__pyx_v_filename);
31510 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
31511 __Pyx_GIVEREF(__pyx_v_filename);
31512 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
31513 __Pyx_GIVEREF(__pyx_t_3);
31515 __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31516 __Pyx_GOTREF(__pyx_t_3);
31517 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31518 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
31519 __pyx_v_fd = __pyx_t_3;
31522 /* "csamtools.pyx":3099
31523 * '''open an existing file, like "/dev/null"'''
31524 * fd = os.open(filename, os.O_WRONLY)
31525 * self.setfd(fd) # <<<<<<<<<<<<<<
31527 * def setfile(self, filename):
31529 __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__setfd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31530 __Pyx_GOTREF(__pyx_t_3);
31531 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31532 __Pyx_GOTREF(__pyx_t_1);
31533 __Pyx_INCREF(__pyx_v_fd);
31534 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fd);
31535 __Pyx_GIVEREF(__pyx_v_fd);
31536 __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31537 __Pyx_GOTREF(__pyx_t_2);
31538 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31539 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
31540 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31542 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
31545 __Pyx_XDECREF(__pyx_t_1);
31546 __Pyx_XDECREF(__pyx_t_2);
31547 __Pyx_XDECREF(__pyx_t_3);
31548 __Pyx_AddTraceback("csamtools.Outs.setdevice", __pyx_clineno, __pyx_lineno, __pyx_filename);
31551 __Pyx_XDECREF(__pyx_v_fd);
31552 __Pyx_XGIVEREF(__pyx_r);
31553 __Pyx_TraceReturn(__pyx_r);
31554 __Pyx_RefNannyFinishContext();
31558 /* Python wrapper */
31559 static PyObject *__pyx_pw_9csamtools_4Outs_5setfile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
31560 static char __pyx_doc_9csamtools_4Outs_4setfile[] = "Outs.setfile(self, filename)\nopen a new file.";
31561 static PyMethodDef __pyx_mdef_9csamtools_4Outs_5setfile = {__Pyx_NAMESTR("setfile"), (PyCFunction)__pyx_pw_9csamtools_4Outs_5setfile, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_4setfile)};
31562 static PyObject *__pyx_pw_9csamtools_4Outs_5setfile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
31563 PyObject *__pyx_v_self = 0;
31564 PyObject *__pyx_v_filename = 0;
31565 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filename,0};
31566 PyObject *__pyx_r = 0;
31567 __Pyx_RefNannyDeclarations
31568 __Pyx_RefNannySetupContext("setfile (wrapper)", 0);
31569 __pyx_self = __pyx_self;
31571 PyObject* values[2] = {0,0};
31572 if (unlikely(__pyx_kwds)) {
31573 Py_ssize_t kw_args;
31574 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
31575 switch (pos_args) {
31576 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
31577 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
31579 default: goto __pyx_L5_argtuple_error;
31581 kw_args = PyDict_Size(__pyx_kwds);
31582 switch (pos_args) {
31584 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
31585 if (likely(values[0])) kw_args--;
31586 else goto __pyx_L5_argtuple_error;
31588 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
31589 if (likely(values[1])) kw_args--;
31591 __Pyx_RaiseArgtupleInvalid("setfile", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
31594 if (unlikely(kw_args > 0)) {
31595 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setfile") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
31597 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
31598 goto __pyx_L5_argtuple_error;
31600 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
31601 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
31603 __pyx_v_self = values[0];
31604 __pyx_v_filename = values[1];
31606 goto __pyx_L4_argument_unpacking_done;
31607 __pyx_L5_argtuple_error:;
31608 __Pyx_RaiseArgtupleInvalid("setfile", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
31610 __Pyx_AddTraceback("csamtools.Outs.setfile", __pyx_clineno, __pyx_lineno, __pyx_filename);
31611 __Pyx_RefNannyFinishContext();
31613 __pyx_L4_argument_unpacking_done:;
31614 __pyx_r = __pyx_pf_9csamtools_4Outs_4setfile(__pyx_self, __pyx_v_self, __pyx_v_filename);
31615 __Pyx_RefNannyFinishContext();
31619 /* "csamtools.pyx":3101
31622 * def setfile(self, filename): # <<<<<<<<<<<<<<
31623 * '''open a new file.'''
31624 * fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660);
31627 static PyObject *__pyx_pf_9csamtools_4Outs_4setfile(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename) {
31628 PyObject *__pyx_v_fd = NULL;
31629 PyObject *__pyx_r = NULL;
31630 __Pyx_RefNannyDeclarations
31631 PyObject *__pyx_t_1 = NULL;
31632 PyObject *__pyx_t_2 = NULL;
31633 PyObject *__pyx_t_3 = NULL;
31634 PyObject *__pyx_t_4 = NULL;
31635 int __pyx_lineno = 0;
31636 const char *__pyx_filename = NULL;
31637 int __pyx_clineno = 0;
31638 __Pyx_TraceDeclarations
31639 __Pyx_RefNannySetupContext("setfile", 0);
31640 __Pyx_TraceCall("setfile", __pyx_f[0], 3101);
31642 /* "csamtools.pyx":3103
31643 * def setfile(self, filename):
31644 * '''open a new file.'''
31645 * fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660); # <<<<<<<<<<<<<<
31649 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31650 __Pyx_GOTREF(__pyx_t_1);
31651 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__open); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31652 __Pyx_GOTREF(__pyx_t_2);
31653 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31654 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31655 __Pyx_GOTREF(__pyx_t_1);
31656 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__O_WRONLY); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31657 __Pyx_GOTREF(__pyx_t_3);
31658 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31659 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31660 __Pyx_GOTREF(__pyx_t_1);
31661 __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__O_CREAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31662 __Pyx_GOTREF(__pyx_t_4);
31663 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31664 __pyx_t_1 = PyNumber_Or(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31665 __Pyx_GOTREF(__pyx_t_1);
31666 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31667 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
31668 __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31669 __Pyx_GOTREF(__pyx_t_4);
31670 __Pyx_INCREF(__pyx_v_filename);
31671 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filename);
31672 __Pyx_GIVEREF(__pyx_v_filename);
31673 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
31674 __Pyx_GIVEREF(__pyx_t_1);
31675 __Pyx_INCREF(__pyx_int_0660);
31676 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_0660);
31677 __Pyx_GIVEREF(__pyx_int_0660);
31679 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31680 __Pyx_GOTREF(__pyx_t_1);
31681 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31682 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
31683 __pyx_v_fd = __pyx_t_1;
31686 /* "csamtools.pyx":3104
31687 * '''open a new file.'''
31688 * fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660);
31689 * self.setfd(fd) # <<<<<<<<<<<<<<
31691 * def setfd(self, fd):
31693 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__setfd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31694 __Pyx_GOTREF(__pyx_t_1);
31695 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31696 __Pyx_GOTREF(__pyx_t_4);
31697 __Pyx_INCREF(__pyx_v_fd);
31698 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_fd);
31699 __Pyx_GIVEREF(__pyx_v_fd);
31700 __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31701 __Pyx_GOTREF(__pyx_t_2);
31702 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31703 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
31704 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31706 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
31709 __Pyx_XDECREF(__pyx_t_1);
31710 __Pyx_XDECREF(__pyx_t_2);
31711 __Pyx_XDECREF(__pyx_t_3);
31712 __Pyx_XDECREF(__pyx_t_4);
31713 __Pyx_AddTraceback("csamtools.Outs.setfile", __pyx_clineno, __pyx_lineno, __pyx_filename);
31716 __Pyx_XDECREF(__pyx_v_fd);
31717 __Pyx_XGIVEREF(__pyx_r);
31718 __Pyx_TraceReturn(__pyx_r);
31719 __Pyx_RefNannyFinishContext();
31723 /* Python wrapper */
31724 static PyObject *__pyx_pw_9csamtools_4Outs_7setfd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
31725 static char __pyx_doc_9csamtools_4Outs_6setfd[] = "Outs.setfd(self, fd)";
31726 static PyMethodDef __pyx_mdef_9csamtools_4Outs_7setfd = {__Pyx_NAMESTR("setfd"), (PyCFunction)__pyx_pw_9csamtools_4Outs_7setfd, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_6setfd)};
31727 static PyObject *__pyx_pw_9csamtools_4Outs_7setfd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
31728 PyObject *__pyx_v_self = 0;
31729 PyObject *__pyx_v_fd = 0;
31730 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__fd,0};
31731 PyObject *__pyx_r = 0;
31732 __Pyx_RefNannyDeclarations
31733 __Pyx_RefNannySetupContext("setfd (wrapper)", 0);
31734 __pyx_self = __pyx_self;
31736 PyObject* values[2] = {0,0};
31737 if (unlikely(__pyx_kwds)) {
31738 Py_ssize_t kw_args;
31739 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
31740 switch (pos_args) {
31741 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
31742 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
31744 default: goto __pyx_L5_argtuple_error;
31746 kw_args = PyDict_Size(__pyx_kwds);
31747 switch (pos_args) {
31749 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
31750 if (likely(values[0])) kw_args--;
31751 else goto __pyx_L5_argtuple_error;
31753 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fd);
31754 if (likely(values[1])) kw_args--;
31756 __Pyx_RaiseArgtupleInvalid("setfd", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
31759 if (unlikely(kw_args > 0)) {
31760 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setfd") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
31762 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
31763 goto __pyx_L5_argtuple_error;
31765 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
31766 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
31768 __pyx_v_self = values[0];
31769 __pyx_v_fd = values[1];
31771 goto __pyx_L4_argument_unpacking_done;
31772 __pyx_L5_argtuple_error:;
31773 __Pyx_RaiseArgtupleInvalid("setfd", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
31775 __Pyx_AddTraceback("csamtools.Outs.setfd", __pyx_clineno, __pyx_lineno, __pyx_filename);
31776 __Pyx_RefNannyFinishContext();
31778 __pyx_L4_argument_unpacking_done:;
31779 __pyx_r = __pyx_pf_9csamtools_4Outs_6setfd(__pyx_self, __pyx_v_self, __pyx_v_fd);
31780 __Pyx_RefNannyFinishContext();
31784 /* "csamtools.pyx":3106
31787 * def setfd(self, fd): # <<<<<<<<<<<<<<
31788 * ofd = os.dup(self.id) # Save old stream on new unit.
31789 * self.streams.append(ofd)
31792 static PyObject *__pyx_pf_9csamtools_4Outs_6setfd(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fd) {
31793 PyObject *__pyx_v_ofd = NULL;
31794 PyObject *__pyx_r = NULL;
31795 __Pyx_RefNannyDeclarations
31796 PyObject *__pyx_t_1 = NULL;
31797 PyObject *__pyx_t_2 = NULL;
31798 PyObject *__pyx_t_3 = NULL;
31799 int __pyx_lineno = 0;
31800 const char *__pyx_filename = NULL;
31801 int __pyx_clineno = 0;
31802 __Pyx_TraceDeclarations
31803 __Pyx_RefNannySetupContext("setfd", 0);
31804 __Pyx_TraceCall("setfd", __pyx_f[0], 3106);
31806 /* "csamtools.pyx":3107
31808 * def setfd(self, fd):
31809 * ofd = os.dup(self.id) # Save old stream on new unit. # <<<<<<<<<<<<<<
31810 * self.streams.append(ofd)
31811 * sys.stdout.flush() # Buffered data goes to old stream.
31813 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31814 __Pyx_GOTREF(__pyx_t_1);
31815 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dup); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31816 __Pyx_GOTREF(__pyx_t_2);
31817 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31818 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31819 __Pyx_GOTREF(__pyx_t_1);
31820 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31821 __Pyx_GOTREF(__pyx_t_3);
31822 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
31823 __Pyx_GIVEREF(__pyx_t_1);
31825 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31826 __Pyx_GOTREF(__pyx_t_1);
31827 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31828 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
31829 __pyx_v_ofd = __pyx_t_1;
31832 /* "csamtools.pyx":3108
31833 * def setfd(self, fd):
31834 * ofd = os.dup(self.id) # Save old stream on new unit.
31835 * self.streams.append(ofd) # <<<<<<<<<<<<<<
31836 * sys.stdout.flush() # Buffered data goes to old stream.
31837 * sys.stderr.flush() # Buffered data goes to old stream.
31839 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31840 __Pyx_GOTREF(__pyx_t_1);
31841 __pyx_t_3 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_v_ofd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31842 __Pyx_GOTREF(__pyx_t_3);
31843 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31844 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31846 /* "csamtools.pyx":3109
31847 * ofd = os.dup(self.id) # Save old stream on new unit.
31848 * self.streams.append(ofd)
31849 * sys.stdout.flush() # Buffered data goes to old stream. # <<<<<<<<<<<<<<
31850 * sys.stderr.flush() # Buffered data goes to old stream.
31851 * os.dup2(fd, self.id) # Open unit 1 on new stream.
31853 __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31854 __Pyx_GOTREF(__pyx_t_3);
31855 __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stdout); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31856 __Pyx_GOTREF(__pyx_t_1);
31857 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31858 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__flush); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31859 __Pyx_GOTREF(__pyx_t_3);
31860 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31861 __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31862 __Pyx_GOTREF(__pyx_t_1);
31863 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31864 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31866 /* "csamtools.pyx":3110
31867 * self.streams.append(ofd)
31868 * sys.stdout.flush() # Buffered data goes to old stream.
31869 * sys.stderr.flush() # Buffered data goes to old stream. # <<<<<<<<<<<<<<
31870 * os.dup2(fd, self.id) # Open unit 1 on new stream.
31871 * os.close(fd) # Close other unit (look out, caller.)
31873 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31874 __Pyx_GOTREF(__pyx_t_1);
31875 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__stderr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31876 __Pyx_GOTREF(__pyx_t_3);
31877 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31878 __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__flush); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31879 __Pyx_GOTREF(__pyx_t_1);
31880 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31881 __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31882 __Pyx_GOTREF(__pyx_t_3);
31883 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31884 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31886 /* "csamtools.pyx":3111
31887 * sys.stdout.flush() # Buffered data goes to old stream.
31888 * sys.stderr.flush() # Buffered data goes to old stream.
31889 * os.dup2(fd, self.id) # Open unit 1 on new stream. # <<<<<<<<<<<<<<
31890 * os.close(fd) # Close other unit (look out, caller.)
31893 __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31894 __Pyx_GOTREF(__pyx_t_3);
31895 __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dup2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31896 __Pyx_GOTREF(__pyx_t_1);
31897 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31898 __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31899 __Pyx_GOTREF(__pyx_t_3);
31900 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31901 __Pyx_GOTREF(__pyx_t_2);
31902 __Pyx_INCREF(__pyx_v_fd);
31903 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fd);
31904 __Pyx_GIVEREF(__pyx_v_fd);
31905 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
31906 __Pyx_GIVEREF(__pyx_t_3);
31908 __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 = 3111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31909 __Pyx_GOTREF(__pyx_t_3);
31910 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31911 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
31912 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31914 /* "csamtools.pyx":3112
31915 * sys.stderr.flush() # Buffered data goes to old stream.
31916 * os.dup2(fd, self.id) # Open unit 1 on new stream.
31917 * os.close(fd) # Close other unit (look out, caller.) # <<<<<<<<<<<<<<
31919 * def restore(self):
31921 __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31922 __Pyx_GOTREF(__pyx_t_3);
31923 __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31924 __Pyx_GOTREF(__pyx_t_2);
31925 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31926 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31927 __Pyx_GOTREF(__pyx_t_3);
31928 __Pyx_INCREF(__pyx_v_fd);
31929 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fd);
31930 __Pyx_GIVEREF(__pyx_v_fd);
31931 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31932 __Pyx_GOTREF(__pyx_t_1);
31933 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31934 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
31935 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31937 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
31940 __Pyx_XDECREF(__pyx_t_1);
31941 __Pyx_XDECREF(__pyx_t_2);
31942 __Pyx_XDECREF(__pyx_t_3);
31943 __Pyx_AddTraceback("csamtools.Outs.setfd", __pyx_clineno, __pyx_lineno, __pyx_filename);
31946 __Pyx_XDECREF(__pyx_v_ofd);
31947 __Pyx_XGIVEREF(__pyx_r);
31948 __Pyx_TraceReturn(__pyx_r);
31949 __Pyx_RefNannyFinishContext();
31953 /* Python wrapper */
31954 static PyObject *__pyx_pw_9csamtools_4Outs_9restore(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
31955 static char __pyx_doc_9csamtools_4Outs_8restore[] = "Outs.restore(self)\nrestore previous output stream";
31956 static PyMethodDef __pyx_mdef_9csamtools_4Outs_9restore = {__Pyx_NAMESTR("restore"), (PyCFunction)__pyx_pw_9csamtools_4Outs_9restore, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_8restore)};
31957 static PyObject *__pyx_pw_9csamtools_4Outs_9restore(PyObject *__pyx_self, PyObject *__pyx_v_self) {
31958 PyObject *__pyx_r = 0;
31959 __Pyx_RefNannyDeclarations
31960 __Pyx_RefNannySetupContext("restore (wrapper)", 0);
31961 __pyx_self = __pyx_self;
31962 __pyx_r = __pyx_pf_9csamtools_4Outs_8restore(__pyx_self, ((PyObject *)__pyx_v_self));
31963 __Pyx_RefNannyFinishContext();
31967 /* "csamtools.pyx":3114
31968 * os.close(fd) # Close other unit (look out, caller.)
31970 * def restore(self): # <<<<<<<<<<<<<<
31971 * '''restore previous output stream'''
31975 static PyObject *__pyx_pf_9csamtools_4Outs_8restore(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
31976 PyObject *__pyx_r = NULL;
31977 __Pyx_RefNannyDeclarations
31978 PyObject *__pyx_t_1 = NULL;
31980 PyObject *__pyx_t_3 = NULL;
31981 PyObject *__pyx_t_4 = NULL;
31982 PyObject *__pyx_t_5 = NULL;
31983 int __pyx_lineno = 0;
31984 const char *__pyx_filename = NULL;
31985 int __pyx_clineno = 0;
31986 __Pyx_TraceDeclarations
31987 __Pyx_RefNannySetupContext("restore", 0);
31988 __Pyx_TraceCall("restore", __pyx_f[0], 3114);
31990 /* "csamtools.pyx":3116
31991 * def restore(self):
31992 * '''restore previous output stream'''
31993 * if self.streams: # <<<<<<<<<<<<<<
31994 * # the following was not sufficient, hence flush both stderr and stdout
31995 * # os.fsync( self.id )
31997 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31998 __Pyx_GOTREF(__pyx_t_1);
31999 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32000 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32003 /* "csamtools.pyx":3119
32004 * # the following was not sufficient, hence flush both stderr and stdout
32005 * # os.fsync( self.id )
32006 * sys.stdout.flush() # <<<<<<<<<<<<<<
32007 * sys.stderr.flush()
32008 * os.dup2(self.streams[-1], self.id)
32010 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32011 __Pyx_GOTREF(__pyx_t_1);
32012 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__stdout); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32013 __Pyx_GOTREF(__pyx_t_3);
32014 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32015 __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__flush); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32016 __Pyx_GOTREF(__pyx_t_1);
32017 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32018 __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32019 __Pyx_GOTREF(__pyx_t_3);
32020 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32021 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32023 /* "csamtools.pyx":3120
32024 * # os.fsync( self.id )
32025 * sys.stdout.flush()
32026 * sys.stderr.flush() # <<<<<<<<<<<<<<
32027 * os.dup2(self.streams[-1], self.id)
32028 * os.close(self.streams[-1])
32030 __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32031 __Pyx_GOTREF(__pyx_t_3);
32032 __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stderr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32033 __Pyx_GOTREF(__pyx_t_1);
32034 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32035 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__flush); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32036 __Pyx_GOTREF(__pyx_t_3);
32037 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32038 __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32039 __Pyx_GOTREF(__pyx_t_1);
32040 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32041 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32043 /* "csamtools.pyx":3121
32044 * sys.stdout.flush()
32045 * sys.stderr.flush()
32046 * os.dup2(self.streams[-1], self.id) # <<<<<<<<<<<<<<
32047 * os.close(self.streams[-1])
32048 * del self.streams[-1]
32050 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32051 __Pyx_GOTREF(__pyx_t_1);
32052 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dup2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32053 __Pyx_GOTREF(__pyx_t_3);
32054 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32055 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32056 __Pyx_GOTREF(__pyx_t_1);
32057 __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32058 __Pyx_GOTREF(__pyx_t_4);
32059 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32060 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32061 __Pyx_GOTREF(__pyx_t_1);
32062 __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32063 __Pyx_GOTREF(__pyx_t_5);
32064 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
32065 __Pyx_GIVEREF(__pyx_t_4);
32066 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
32067 __Pyx_GIVEREF(__pyx_t_1);
32070 __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32071 __Pyx_GOTREF(__pyx_t_1);
32072 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32073 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
32074 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32076 /* "csamtools.pyx":3122
32077 * sys.stderr.flush()
32078 * os.dup2(self.streams[-1], self.id)
32079 * os.close(self.streams[-1]) # <<<<<<<<<<<<<<
32080 * del self.streams[-1]
32083 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32084 __Pyx_GOTREF(__pyx_t_1);
32085 __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32086 __Pyx_GOTREF(__pyx_t_5);
32087 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32088 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32089 __Pyx_GOTREF(__pyx_t_1);
32090 __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32091 __Pyx_GOTREF(__pyx_t_3);
32092 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32093 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32094 __Pyx_GOTREF(__pyx_t_1);
32095 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
32096 __Pyx_GIVEREF(__pyx_t_3);
32098 __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32099 __Pyx_GOTREF(__pyx_t_3);
32100 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
32101 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
32102 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32104 /* "csamtools.pyx":3123
32105 * os.dup2(self.streams[-1], self.id)
32106 * os.close(self.streams[-1])
32107 * del self.streams[-1] # <<<<<<<<<<<<<<
32109 * def _samtools_dispatch( method,
32111 __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32112 __Pyx_GOTREF(__pyx_t_3);
32113 if (__Pyx_DelItemInt(__pyx_t_3, -1, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32114 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32119 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
32122 __Pyx_XDECREF(__pyx_t_1);
32123 __Pyx_XDECREF(__pyx_t_3);
32124 __Pyx_XDECREF(__pyx_t_4);
32125 __Pyx_XDECREF(__pyx_t_5);
32126 __Pyx_AddTraceback("csamtools.Outs.restore", __pyx_clineno, __pyx_lineno, __pyx_filename);
32129 __Pyx_XGIVEREF(__pyx_r);
32130 __Pyx_TraceReturn(__pyx_r);
32131 __Pyx_RefNannyFinishContext();
32135 /* Python wrapper */
32136 static PyObject *__pyx_pw_9csamtools_1_samtools_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
32137 static char __pyx_doc_9csamtools__samtools_dispatch[] = "_samtools_dispatch(method, args=(), catch_stdout=True)\ncall ``method`` in samtools providing arguments in args.\n \n .. note:: \n This method redirects stdout to capture it \n from samtools. If for some reason stdout disappears\n the reason might be in this method.\n\n .. note::\n The current implementation might only work on linux.\n\n .. note::\n This method captures stdout and stderr using temporary files,\n which are then read into memory in their entirety. This method\n is slow and might cause large memory overhead.\n\n See http://bytes.com/topic/c/answers/487231-how-capture-stdout-temporarily\n on the topic of redirecting stderr/stdout.\n ";
32138 static PyMethodDef __pyx_mdef_9csamtools_1_samtools_dispatch = {__Pyx_NAMESTR("_samtools_dispatch"), (PyCFunction)__pyx_pw_9csamtools_1_samtools_dispatch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools__samtools_dispatch)};
32139 static PyObject *__pyx_pw_9csamtools_1_samtools_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
32140 PyObject *__pyx_v_method = 0;
32141 PyObject *__pyx_v_args = 0;
32142 PyObject *__pyx_v_catch_stdout = 0;
32143 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__method,&__pyx_n_s__args,&__pyx_n_s__catch_stdout,0};
32144 PyObject *__pyx_r = 0;
32145 __Pyx_RefNannyDeclarations
32146 __Pyx_RefNannySetupContext("_samtools_dispatch (wrapper)", 0);
32147 __pyx_self = __pyx_self;
32149 PyObject* values[3] = {0,0,0};
32151 /* "csamtools.pyx":3126
32153 * def _samtools_dispatch( method,
32154 * args = (), # <<<<<<<<<<<<<<
32155 * catch_stdout = True ):
32156 * '''call ``method`` in samtools providing arguments in args.
32158 values[1] = ((PyObject *)__pyx_empty_tuple);
32159 values[2] = __pyx_k_176;
32160 if (unlikely(__pyx_kwds)) {
32161 Py_ssize_t kw_args;
32162 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
32163 switch (pos_args) {
32164 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
32165 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
32166 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
32168 default: goto __pyx_L5_argtuple_error;
32170 kw_args = PyDict_Size(__pyx_kwds);
32171 switch (pos_args) {
32173 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__method);
32174 if (likely(values[0])) kw_args--;
32175 else goto __pyx_L5_argtuple_error;
32178 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__args);
32179 if (value) { values[1] = value; kw_args--; }
32183 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__catch_stdout);
32184 if (value) { values[2] = value; kw_args--; }
32187 if (unlikely(kw_args > 0)) {
32188 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_samtools_dispatch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
32191 switch (PyTuple_GET_SIZE(__pyx_args)) {
32192 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
32193 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
32194 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
32196 default: goto __pyx_L5_argtuple_error;
32199 __pyx_v_method = values[0];
32200 __pyx_v_args = values[1];
32201 __pyx_v_catch_stdout = values[2];
32203 goto __pyx_L4_argument_unpacking_done;
32204 __pyx_L5_argtuple_error:;
32205 __Pyx_RaiseArgtupleInvalid("_samtools_dispatch", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
32207 __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
32208 __Pyx_RefNannyFinishContext();
32210 __pyx_L4_argument_unpacking_done:;
32211 __pyx_r = __pyx_pf_9csamtools__samtools_dispatch(__pyx_self, __pyx_v_method, __pyx_v_args, __pyx_v_catch_stdout);
32212 __Pyx_RefNannyFinishContext();
32216 /* "csamtools.pyx":3125
32217 * del self.streams[-1]
32219 * def _samtools_dispatch( method, # <<<<<<<<<<<<<<
32221 * catch_stdout = True ):
32224 static PyObject *__pyx_pf_9csamtools__samtools_dispatch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_method, PyObject *__pyx_v_args, PyObject *__pyx_v_catch_stdout) {
32225 PyObject *__pyx_v_stderr_h = NULL;
32226 PyObject *__pyx_v_stderr_f = NULL;
32227 PyObject *__pyx_v_stdout_h = NULL;
32228 PyObject *__pyx_v_stdout_f = NULL;
32229 PyObject *__pyx_v_stdout_save = NULL;
32230 char **__pyx_v_cargs;
32233 int __pyx_v_retval;
32234 PyObject *__pyx_v_inf = NULL;
32235 PyObject *__pyx_v_out_stdout = NULL;
32236 PyObject *__pyx_v_out_stderr = NULL;
32237 PyObject *__pyx_v_a = NULL;
32238 PyObject *__pyx_r = NULL;
32239 __Pyx_RefNannyDeclarations
32241 PyObject *__pyx_t_2 = NULL;
32242 PyObject *__pyx_t_3 = NULL;
32243 PyObject *__pyx_t_4 = NULL;
32245 PyObject *__pyx_t_6 = NULL;
32246 PyObject *(*__pyx_t_7)(PyObject *);
32248 PyObject *__pyx_t_9 = NULL;
32249 PyObject *__pyx_t_10 = NULL;
32250 PyObject *__pyx_t_11 = NULL;
32251 Py_ssize_t __pyx_t_12;
32252 PyObject *(*__pyx_t_13)(PyObject *);
32254 PyObject *__pyx_t_15 = NULL;
32255 PyObject *__pyx_t_16 = NULL;
32256 PyObject *__pyx_t_17 = NULL;
32257 PyObject *__pyx_t_18 = NULL;
32258 PyObject *__pyx_t_19 = NULL;
32259 PyObject *__pyx_t_20 = NULL;
32260 PyObject *__pyx_t_21 = NULL;
32261 PyObject *__pyx_t_22 = NULL;
32262 int __pyx_lineno = 0;
32263 const char *__pyx_filename = NULL;
32264 int __pyx_clineno = 0;
32265 __Pyx_TraceDeclarations
32266 __Pyx_RefNannySetupContext("_samtools_dispatch", 0);
32267 __Pyx_TraceCall("_samtools_dispatch", __pyx_f[0], 3125);
32268 __Pyx_INCREF(__pyx_v_method);
32269 __Pyx_INCREF(__pyx_v_args);
32270 __Pyx_INCREF(__pyx_v_catch_stdout);
32272 /* "csamtools.pyx":3151
32274 * # some special cases
32275 * if method == "index": # <<<<<<<<<<<<<<
32276 * if not os.path.exists( args[0] ):
32277 * raise IOError( "No such file or directory: '%s'" % args[0] )
32279 __pyx_t_1 = __Pyx_PyString_Equals(__pyx_v_method, ((PyObject *)__pyx_n_s__index), Py_EQ); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32282 /* "csamtools.pyx":3152
32283 * # some special cases
32284 * if method == "index":
32285 * if not os.path.exists( args[0] ): # <<<<<<<<<<<<<<
32286 * raise IOError( "No such file or directory: '%s'" % args[0] )
32289 __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32290 __Pyx_GOTREF(__pyx_t_2);
32291 __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32292 __Pyx_GOTREF(__pyx_t_3);
32293 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32294 __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__exists); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32295 __Pyx_GOTREF(__pyx_t_2);
32296 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32297 __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32298 __Pyx_GOTREF(__pyx_t_3);
32299 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32300 __Pyx_GOTREF(__pyx_t_4);
32301 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
32302 __Pyx_GIVEREF(__pyx_t_3);
32304 __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32305 __Pyx_GOTREF(__pyx_t_3);
32306 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32307 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
32308 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32309 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32310 __pyx_t_5 = (!__pyx_t_1);
32313 /* "csamtools.pyx":3153
32314 * if method == "index":
32315 * if not os.path.exists( args[0] ):
32316 * raise IOError( "No such file or directory: '%s'" % args[0] ) # <<<<<<<<<<<<<<
32318 * # redirect stderr and stdout to file
32320 __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32321 __Pyx_GOTREF(__pyx_t_3);
32322 __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_177), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32323 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
32324 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32325 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32326 __Pyx_GOTREF(__pyx_t_3);
32327 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
32328 __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
32330 __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32331 __Pyx_GOTREF(__pyx_t_4);
32332 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
32333 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
32334 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
32335 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32343 /* "csamtools.pyx":3156
32345 * # redirect stderr and stdout to file
32346 * stderr_h, stderr_f = tempfile.mkstemp() # <<<<<<<<<<<<<<
32347 * pysam_set_stderr( stderr_h )
32350 __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__tempfile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32351 __Pyx_GOTREF(__pyx_t_4);
32352 __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__mkstemp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32353 __Pyx_GOTREF(__pyx_t_3);
32354 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
32355 __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32356 __Pyx_GOTREF(__pyx_t_4);
32357 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32358 if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
32359 PyObject* sequence = __pyx_t_4;
32360 if (likely(PyTuple_CheckExact(sequence))) {
32361 if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
32362 if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
32363 else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
32364 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32366 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
32367 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
32369 if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
32370 if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
32371 else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
32372 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32374 __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
32375 __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
32377 __Pyx_INCREF(__pyx_t_3);
32378 __Pyx_INCREF(__pyx_t_2);
32379 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
32381 Py_ssize_t index = -1;
32382 __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32383 __Pyx_GOTREF(__pyx_t_6);
32384 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
32385 __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
32386 index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
32387 __Pyx_GOTREF(__pyx_t_3);
32388 index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
32389 __Pyx_GOTREF(__pyx_t_2);
32390 if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32391 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
32392 goto __pyx_L6_unpacking_done;
32393 __pyx_L5_unpacking_failed:;
32394 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
32395 if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
32396 if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
32397 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32398 __pyx_L6_unpacking_done:;
32400 __pyx_v_stderr_h = __pyx_t_3;
32402 __pyx_v_stderr_f = __pyx_t_2;
32405 /* "csamtools.pyx":3157
32406 * # redirect stderr and stdout to file
32407 * stderr_h, stderr_f = tempfile.mkstemp()
32408 * pysam_set_stderr( stderr_h ) # <<<<<<<<<<<<<<
32412 __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_stderr_h); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32413 pysam_set_stderr(__pyx_t_8);
32415 /* "csamtools.pyx":3159
32416 * pysam_set_stderr( stderr_h )
32418 * if catch_stdout: # <<<<<<<<<<<<<<
32419 * stdout_h, stdout_f = tempfile.mkstemp()
32422 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stdout); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32425 /* "csamtools.pyx":3160
32428 * stdout_h, stdout_f = tempfile.mkstemp() # <<<<<<<<<<<<<<
32430 * stdout_save = Outs( sys.stdout.fileno() )
32432 __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__tempfile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32433 __Pyx_GOTREF(__pyx_t_4);
32434 __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__mkstemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32435 __Pyx_GOTREF(__pyx_t_2);
32436 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
32437 __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32438 __Pyx_GOTREF(__pyx_t_4);
32439 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32440 if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
32441 PyObject* sequence = __pyx_t_4;
32442 if (likely(PyTuple_CheckExact(sequence))) {
32443 if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
32444 if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
32445 else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
32446 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32448 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
32449 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
32451 if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
32452 if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
32453 else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
32454 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32456 __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
32457 __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
32459 __Pyx_INCREF(__pyx_t_2);
32460 __Pyx_INCREF(__pyx_t_3);
32461 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
32463 Py_ssize_t index = -1;
32464 __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32465 __Pyx_GOTREF(__pyx_t_6);
32466 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
32467 __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
32468 index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L8_unpacking_failed;
32469 __Pyx_GOTREF(__pyx_t_2);
32470 index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L8_unpacking_failed;
32471 __Pyx_GOTREF(__pyx_t_3);
32472 if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32473 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
32474 goto __pyx_L9_unpacking_done;
32475 __pyx_L8_unpacking_failed:;
32476 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
32477 if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
32478 if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
32479 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32480 __pyx_L9_unpacking_done:;
32482 __pyx_v_stdout_h = __pyx_t_2;
32484 __pyx_v_stdout_f = __pyx_t_3;
32487 /* "csamtools.pyx":3161
32489 * stdout_h, stdout_f = tempfile.mkstemp()
32490 * try: # <<<<<<<<<<<<<<
32491 * stdout_save = Outs( sys.stdout.fileno() )
32492 * stdout_save.setfd( stdout_h )
32495 __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
32496 __Pyx_XGOTREF(__pyx_t_9);
32497 __Pyx_XGOTREF(__pyx_t_10);
32498 __Pyx_XGOTREF(__pyx_t_11);
32501 /* "csamtools.pyx":3162
32502 * stdout_h, stdout_f = tempfile.mkstemp()
32504 * stdout_save = Outs( sys.stdout.fileno() ) # <<<<<<<<<<<<<<
32505 * stdout_save.setfd( stdout_h )
32506 * except AttributeError:
32508 __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__Outs); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
32509 __Pyx_GOTREF(__pyx_t_4);
32510 __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
32511 __Pyx_GOTREF(__pyx_t_3);
32512 __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stdout); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
32513 __Pyx_GOTREF(__pyx_t_2);
32514 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32515 __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__fileno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
32516 __Pyx_GOTREF(__pyx_t_3);
32517 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32518 __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
32519 __Pyx_GOTREF(__pyx_t_2);
32520 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32521 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
32522 __Pyx_GOTREF(__pyx_t_3);
32523 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
32524 __Pyx_GIVEREF(__pyx_t_2);
32526 __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3162; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
32527 __Pyx_GOTREF(__pyx_t_2);
32528 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
32529 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
32530 __pyx_v_stdout_save = __pyx_t_2;
32533 /* "csamtools.pyx":3163
32535 * stdout_save = Outs( sys.stdout.fileno() )
32536 * stdout_save.setfd( stdout_h ) # <<<<<<<<<<<<<<
32537 * except AttributeError:
32538 * # stdout has already been redirected
32540 __pyx_t_2 = PyObject_GetAttr(__pyx_v_stdout_save, __pyx_n_s__setfd); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3163; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
32541 __Pyx_GOTREF(__pyx_t_2);
32542 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3163; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
32543 __Pyx_GOTREF(__pyx_t_3);
32544 __Pyx_INCREF(__pyx_v_stdout_h);
32545 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_stdout_h);
32546 __Pyx_GIVEREF(__pyx_v_stdout_h);
32547 __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3163; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
32548 __Pyx_GOTREF(__pyx_t_4);
32549 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32550 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
32551 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
32553 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
32554 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
32555 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
32556 goto __pyx_L17_try_end;
32558 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
32559 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
32560 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
32561 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
32563 /* "csamtools.pyx":3164
32564 * stdout_save = Outs( sys.stdout.fileno() )
32565 * stdout_save.setfd( stdout_h )
32566 * except AttributeError: # <<<<<<<<<<<<<<
32567 * # stdout has already been redirected
32568 * catch_stdout = False
32570 __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
32572 __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
32573 if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3164; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
32574 __Pyx_GOTREF(__pyx_t_4);
32575 __Pyx_GOTREF(__pyx_t_3);
32576 __Pyx_GOTREF(__pyx_t_2);
32578 /* "csamtools.pyx":3166
32579 * except AttributeError:
32580 * # stdout has already been redirected
32581 * catch_stdout = False # <<<<<<<<<<<<<<
32583 * # patch for `samtools view`
32585 __pyx_t_6 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3166; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
32586 __Pyx_GOTREF(__pyx_t_6);
32587 __Pyx_DECREF(__pyx_v_catch_stdout);
32588 __pyx_v_catch_stdout = __pyx_t_6;
32590 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
32591 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32592 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32593 goto __pyx_L11_exception_handled;
32595 __pyx_L12_except_error:;
32596 __Pyx_XGIVEREF(__pyx_t_9);
32597 __Pyx_XGIVEREF(__pyx_t_10);
32598 __Pyx_XGIVEREF(__pyx_t_11);
32599 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
32600 goto __pyx_L1_error;
32601 __pyx_L11_exception_handled:;
32602 __Pyx_XGIVEREF(__pyx_t_9);
32603 __Pyx_XGIVEREF(__pyx_t_10);
32604 __Pyx_XGIVEREF(__pyx_t_11);
32605 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
32606 __pyx_L17_try_end:;
32609 /* "csamtools.pyx":3171
32610 * # samtools `view` closes stdout, from which I can not
32611 * # recover. Thus redirect output to file with -o option.
32612 * if method == "view": # <<<<<<<<<<<<<<
32613 * if "-o" in args: raise ValueError("option -o is forbidden in samtools view")
32614 * args = ( "-o", stdout_f ) + args
32616 __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_method, ((PyObject *)__pyx_n_s__view), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32619 /* "csamtools.pyx":3172
32620 * # recover. Thus redirect output to file with -o option.
32621 * if method == "view":
32622 * if "-o" in args: raise ValueError("option -o is forbidden in samtools view") # <<<<<<<<<<<<<<
32623 * args = ( "-o", stdout_f ) + args
32626 __pyx_t_5 = ((PySequence_Contains(__pyx_v_args, ((PyObject *)__pyx_kp_s_178)))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32628 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_180), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32629 __Pyx_GOTREF(__pyx_t_2);
32630 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
32631 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32632 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32637 /* "csamtools.pyx":3173
32638 * if method == "view":
32639 * if "-o" in args: raise ValueError("option -o is forbidden in samtools view")
32640 * args = ( "-o", stdout_f ) + args # <<<<<<<<<<<<<<
32642 * # do the function call to samtools
32644 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32645 __Pyx_GOTREF(__pyx_t_2);
32646 __Pyx_INCREF(((PyObject *)__pyx_kp_s_178));
32647 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_178));
32648 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_178));
32649 __Pyx_INCREF(__pyx_v_stdout_f);
32650 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_stdout_f);
32651 __Pyx_GIVEREF(__pyx_v_stdout_f);
32652 __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_t_2), __pyx_v_args); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32653 __Pyx_GOTREF(__pyx_t_3);
32654 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
32655 __Pyx_DECREF(__pyx_v_args);
32656 __pyx_v_args = __pyx_t_3;
32665 /* "csamtools.pyx":3179
32666 * cdef int i, n, retval
32668 * n = len(args) # <<<<<<<<<<<<<<
32669 * method = _force_cmdline_bytes(method)
32670 * args = [ _force_cmdline_bytes(a) for a in args ]
32672 __pyx_t_12 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32673 __pyx_v_n = __pyx_t_12;
32675 /* "csamtools.pyx":3180
32678 * method = _force_cmdline_bytes(method) # <<<<<<<<<<<<<<
32679 * args = [ _force_cmdline_bytes(a) for a in args ]
32682 __pyx_t_3 = ((PyObject *)__pyx_f_9csamtools__force_cmdline_bytes(__pyx_v_method)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32683 __Pyx_GOTREF(__pyx_t_3);
32684 __Pyx_DECREF(__pyx_v_method);
32685 __pyx_v_method = __pyx_t_3;
32688 /* "csamtools.pyx":3181
32690 * method = _force_cmdline_bytes(method)
32691 * args = [ _force_cmdline_bytes(a) for a in args ] # <<<<<<<<<<<<<<
32693 * # allocate two more for first (dummy) argument (contains command)
32695 __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32696 __Pyx_GOTREF(__pyx_t_3);
32697 if (PyList_CheckExact(__pyx_v_args) || PyTuple_CheckExact(__pyx_v_args)) {
32698 __pyx_t_2 = __pyx_v_args; __Pyx_INCREF(__pyx_t_2); __pyx_t_12 = 0;
32701 __pyx_t_12 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_args); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32702 __Pyx_GOTREF(__pyx_t_2);
32703 __pyx_t_13 = Py_TYPE(__pyx_t_2)->tp_iternext;
32706 if (!__pyx_t_13 && PyList_CheckExact(__pyx_t_2)) {
32707 if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_2)) break;
32708 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++;
32709 } else if (!__pyx_t_13 && PyTuple_CheckExact(__pyx_t_2)) {
32710 if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
32711 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++;
32713 __pyx_t_4 = __pyx_t_13(__pyx_t_2);
32714 if (unlikely(!__pyx_t_4)) {
32715 if (PyErr_Occurred()) {
32716 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
32717 else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32721 __Pyx_GOTREF(__pyx_t_4);
32723 __Pyx_XDECREF(__pyx_v_a);
32724 __pyx_v_a = __pyx_t_4;
32726 __pyx_t_4 = ((PyObject *)__pyx_f_9csamtools__force_cmdline_bytes(__pyx_v_a)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32727 __Pyx_GOTREF(__pyx_t_4);
32728 if (unlikely(PyList_Append(__pyx_t_3, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32729 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
32731 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32732 __Pyx_INCREF(((PyObject *)__pyx_t_3));
32733 __Pyx_DECREF(__pyx_v_args);
32734 __pyx_v_args = ((PyObject *)__pyx_t_3);
32735 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
32737 /* "csamtools.pyx":3184
32739 * # allocate two more for first (dummy) argument (contains command)
32740 * cargs = <char**>calloc( n+2, sizeof( char *) ) # <<<<<<<<<<<<<<
32741 * cargs[0] = "samtools"
32742 * cargs[1] = method
32744 __pyx_v_cargs = ((char **)calloc((__pyx_v_n + 2), (sizeof(char *))));
32746 /* "csamtools.pyx":3185
32747 * # allocate two more for first (dummy) argument (contains command)
32748 * cargs = <char**>calloc( n+2, sizeof( char *) )
32749 * cargs[0] = "samtools" # <<<<<<<<<<<<<<
32750 * cargs[1] = method
32751 * for i from 0 <= i < n: cargs[i+2] = args[i]
32753 (__pyx_v_cargs[0]) = __pyx_k__samtools;
32755 /* "csamtools.pyx":3186
32756 * cargs = <char**>calloc( n+2, sizeof( char *) )
32757 * cargs[0] = "samtools"
32758 * cargs[1] = method # <<<<<<<<<<<<<<
32759 * for i from 0 <= i < n: cargs[i+2] = args[i]
32762 __pyx_t_14 = PyBytes_AsString(__pyx_v_method); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32763 (__pyx_v_cargs[1]) = __pyx_t_14;
32765 /* "csamtools.pyx":3187
32766 * cargs[0] = "samtools"
32767 * cargs[1] = method
32768 * for i from 0 <= i < n: cargs[i+2] = args[i] # <<<<<<<<<<<<<<
32770 * retval = pysam_dispatch(n+2, cargs)
32772 __pyx_t_8 = __pyx_v_n;
32773 for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) {
32774 __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32775 __Pyx_GOTREF(__pyx_t_3);
32776 __pyx_t_14 = PyBytes_AsString(__pyx_t_3); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32777 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32778 (__pyx_v_cargs[(__pyx_v_i + 2)]) = __pyx_t_14;
32781 /* "csamtools.pyx":3189
32782 * for i from 0 <= i < n: cargs[i+2] = args[i]
32784 * retval = pysam_dispatch(n+2, cargs) # <<<<<<<<<<<<<<
32788 __pyx_v_retval = pysam_dispatch((__pyx_v_n + 2), __pyx_v_cargs);
32790 /* "csamtools.pyx":3190
32792 * retval = pysam_dispatch(n+2, cargs)
32793 * free( cargs ) # <<<<<<<<<<<<<<
32795 * # restore stdout/stderr. This will also flush, so
32797 free(__pyx_v_cargs);
32799 /* "csamtools.pyx":3194
32800 * # restore stdout/stderr. This will also flush, so
32801 * # needs to be before reading back the file contents
32802 * if catch_stdout: # <<<<<<<<<<<<<<
32803 * stdout_save.restore()
32806 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stdout); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32809 /* "csamtools.pyx":3195
32810 * # needs to be before reading back the file contents
32812 * stdout_save.restore() # <<<<<<<<<<<<<<
32814 * with open( stdout_f, "r") as inf:
32816 if (unlikely(!__pyx_v_stdout_save)) { __Pyx_RaiseUnboundLocalError("stdout_save"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
32817 __pyx_t_3 = PyObject_GetAttr(__pyx_v_stdout_save, __pyx_n_s__restore); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32818 __Pyx_GOTREF(__pyx_t_3);
32819 __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32820 __Pyx_GOTREF(__pyx_t_2);
32821 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32822 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32824 /* "csamtools.pyx":3196
32826 * stdout_save.restore()
32827 * try: # <<<<<<<<<<<<<<
32828 * with open( stdout_f, "r") as inf:
32829 * out_stdout = inf.readlines()
32832 __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
32833 __Pyx_XGOTREF(__pyx_t_11);
32834 __Pyx_XGOTREF(__pyx_t_10);
32835 __Pyx_XGOTREF(__pyx_t_9);
32838 /* "csamtools.pyx":3197
32839 * stdout_save.restore()
32841 * with open( stdout_f, "r") as inf: # <<<<<<<<<<<<<<
32842 * out_stdout = inf.readlines()
32843 * except UnicodeDecodeError:
32846 if (unlikely(!__pyx_v_stdout_f)) { __Pyx_RaiseUnboundLocalError("stdout_f"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L27_error;} }
32847 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L27_error;}
32848 __Pyx_GOTREF(__pyx_t_2);
32849 __Pyx_INCREF(__pyx_v_stdout_f);
32850 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_stdout_f);
32851 __Pyx_GIVEREF(__pyx_v_stdout_f);
32852 __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
32853 PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__r));
32854 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
32855 __pyx_t_3 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L27_error;}
32856 __Pyx_GOTREF(__pyx_t_3);
32857 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
32858 __pyx_t_15 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____exit__); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L27_error;}
32859 __Pyx_GOTREF(__pyx_t_15);
32860 __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L35_error;}
32861 __Pyx_GOTREF(__pyx_t_2);
32862 __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L35_error;}
32863 __Pyx_GOTREF(__pyx_t_4);
32864 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32865 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32868 __Pyx_ExceptionSave(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
32869 __Pyx_XGOTREF(__pyx_t_16);
32870 __Pyx_XGOTREF(__pyx_t_17);
32871 __Pyx_XGOTREF(__pyx_t_18);
32873 __Pyx_INCREF(__pyx_t_4);
32874 __pyx_v_inf = __pyx_t_4;
32875 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
32877 /* "csamtools.pyx":3198
32879 * with open( stdout_f, "r") as inf:
32880 * out_stdout = inf.readlines() # <<<<<<<<<<<<<<
32881 * except UnicodeDecodeError:
32882 * with open( stdout_f, "rb") as inf:
32884 __pyx_t_4 = PyObject_GetAttr(__pyx_v_inf, __pyx_n_s__readlines); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3198; __pyx_clineno = __LINE__; goto __pyx_L41_error;}
32885 __Pyx_GOTREF(__pyx_t_4);
32886 __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3198; __pyx_clineno = __LINE__; goto __pyx_L41_error;}
32887 __Pyx_GOTREF(__pyx_t_3);
32888 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
32889 __pyx_v_out_stdout = __pyx_t_3;
32892 __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
32893 __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
32894 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
32895 goto __pyx_L48_try_end;
32897 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
32898 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
32899 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
32900 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
32902 /* "csamtools.pyx":3197
32903 * stdout_save.restore()
32905 * with open( stdout_f, "r") as inf: # <<<<<<<<<<<<<<
32906 * out_stdout = inf.readlines()
32907 * except UnicodeDecodeError:
32910 __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
32911 if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L43_except_error;}
32912 __Pyx_GOTREF(__pyx_t_3);
32913 __Pyx_GOTREF(__pyx_t_4);
32914 __Pyx_GOTREF(__pyx_t_2);
32915 __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L43_except_error;}
32916 __Pyx_GOTREF(__pyx_t_6);
32917 __Pyx_INCREF(__pyx_t_3);
32918 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
32919 __Pyx_GIVEREF(__pyx_t_3);
32920 __Pyx_INCREF(__pyx_t_4);
32921 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
32922 __Pyx_GIVEREF(__pyx_t_4);
32923 __Pyx_INCREF(__pyx_t_2);
32924 PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2);
32925 __Pyx_GIVEREF(__pyx_t_2);
32926 __pyx_t_19 = PyObject_Call(__pyx_t_15, __pyx_t_6, NULL);
32927 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
32928 if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L43_except_error;}
32929 __Pyx_GOTREF(__pyx_t_19);
32930 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_19);
32931 __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
32932 if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L43_except_error;}
32933 __pyx_t_1 = (!__pyx_t_5);
32935 __Pyx_GIVEREF(__pyx_t_3);
32936 __Pyx_GIVEREF(__pyx_t_4);
32937 __Pyx_GIVEREF(__pyx_t_2);
32938 __Pyx_ErrRestore(__pyx_t_3, __pyx_t_4, __pyx_t_2);
32939 __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_2 = 0;
32940 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L43_except_error;}
32944 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
32945 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32946 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
32947 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32948 goto __pyx_L42_exception_handled;
32950 __pyx_L43_except_error:;
32951 __Pyx_XGIVEREF(__pyx_t_16);
32952 __Pyx_XGIVEREF(__pyx_t_17);
32953 __Pyx_XGIVEREF(__pyx_t_18);
32954 __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
32955 goto __pyx_L27_error;
32956 __pyx_L42_exception_handled:;
32957 __Pyx_XGIVEREF(__pyx_t_16);
32958 __Pyx_XGIVEREF(__pyx_t_17);
32959 __Pyx_XGIVEREF(__pyx_t_18);
32960 __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
32961 __pyx_L48_try_end:;
32966 __pyx_t_18 = PyObject_Call(__pyx_t_15, __pyx_k_tuple_181, NULL);
32967 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
32968 if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L27_error;}
32969 __Pyx_GOTREF(__pyx_t_18);
32970 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_18);
32971 __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
32972 if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L27_error;}
32977 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
32978 goto __pyx_L27_error;
32982 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
32983 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
32984 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
32985 goto __pyx_L34_try_end;
32987 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
32988 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
32989 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
32990 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
32992 /* "csamtools.pyx":3199
32993 * with open( stdout_f, "r") as inf:
32994 * out_stdout = inf.readlines()
32995 * except UnicodeDecodeError: # <<<<<<<<<<<<<<
32996 * with open( stdout_f, "rb") as inf:
32997 * # read binary output
32999 __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
33001 __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
33002 if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3199; __pyx_clineno = __LINE__; goto __pyx_L29_except_error;}
33003 __Pyx_GOTREF(__pyx_t_2);
33004 __Pyx_GOTREF(__pyx_t_4);
33005 __Pyx_GOTREF(__pyx_t_3);
33007 /* "csamtools.pyx":3200
33008 * out_stdout = inf.readlines()
33009 * except UnicodeDecodeError:
33010 * with open( stdout_f, "rb") as inf: # <<<<<<<<<<<<<<
33011 * # read binary output
33012 * out_stdout = inf.read()
33015 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L29_except_error;}
33016 __Pyx_GOTREF(__pyx_t_6);
33017 __Pyx_INCREF(__pyx_v_stdout_f);
33018 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_stdout_f);
33019 __Pyx_GIVEREF(__pyx_v_stdout_f);
33020 __Pyx_INCREF(((PyObject *)__pyx_n_s__rb));
33021 PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_n_s__rb));
33022 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rb));
33023 __pyx_t_20 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L29_except_error;}
33024 __Pyx_GOTREF(__pyx_t_20);
33025 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
33026 __pyx_t_15 = PyObject_GetAttr(__pyx_t_20, __pyx_n_s____exit__); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L29_except_error;}
33027 __Pyx_GOTREF(__pyx_t_15);
33028 __pyx_t_6 = PyObject_GetAttr(__pyx_t_20, __pyx_n_s____enter__); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
33029 __Pyx_GOTREF(__pyx_t_6);
33030 __pyx_t_21 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L56_error;}
33031 __Pyx_GOTREF(__pyx_t_21);
33032 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
33033 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
33036 __Pyx_ExceptionSave(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
33037 __Pyx_XGOTREF(__pyx_t_18);
33038 __Pyx_XGOTREF(__pyx_t_17);
33039 __Pyx_XGOTREF(__pyx_t_16);
33041 __Pyx_INCREF(__pyx_t_21);
33042 __Pyx_XDECREF(__pyx_v_inf);
33043 __pyx_v_inf = __pyx_t_21;
33044 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
33046 /* "csamtools.pyx":3202
33047 * with open( stdout_f, "rb") as inf:
33048 * # read binary output
33049 * out_stdout = inf.read() # <<<<<<<<<<<<<<
33050 * os.remove( stdout_f )
33053 __pyx_t_21 = PyObject_GetAttr(__pyx_v_inf, __pyx_n_s__read); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3202; __pyx_clineno = __LINE__; goto __pyx_L62_error;}
33054 __Pyx_GOTREF(__pyx_t_21);
33055 __pyx_t_20 = PyObject_Call(__pyx_t_21, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3202; __pyx_clineno = __LINE__; goto __pyx_L62_error;}
33056 __Pyx_GOTREF(__pyx_t_20);
33057 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
33058 __Pyx_XDECREF(__pyx_v_out_stdout);
33059 __pyx_v_out_stdout = __pyx_t_20;
33062 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
33063 __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
33064 __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
33065 goto __pyx_L69_try_end;
33067 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
33068 __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
33069 __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
33071 /* "csamtools.pyx":3200
33072 * out_stdout = inf.readlines()
33073 * except UnicodeDecodeError:
33074 * with open( stdout_f, "rb") as inf: # <<<<<<<<<<<<<<
33075 * # read binary output
33076 * out_stdout = inf.read()
33079 __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
33080 if (__Pyx_GetException(&__pyx_t_20, &__pyx_t_21, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L64_except_error;}
33081 __Pyx_GOTREF(__pyx_t_20);
33082 __Pyx_GOTREF(__pyx_t_21);
33083 __Pyx_GOTREF(__pyx_t_6);
33084 __pyx_t_22 = PyTuple_New(3); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L64_except_error;}
33085 __Pyx_GOTREF(__pyx_t_22);
33086 __Pyx_INCREF(__pyx_t_20);
33087 PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_20);
33088 __Pyx_GIVEREF(__pyx_t_20);
33089 __Pyx_INCREF(__pyx_t_21);
33090 PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_21);
33091 __Pyx_GIVEREF(__pyx_t_21);
33092 __Pyx_INCREF(__pyx_t_6);
33093 PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_t_6);
33094 __Pyx_GIVEREF(__pyx_t_6);
33095 __pyx_t_19 = PyObject_Call(__pyx_t_15, __pyx_t_22, NULL);
33096 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
33097 if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L64_except_error;}
33098 __Pyx_GOTREF(__pyx_t_19);
33099 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_19);
33100 __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
33101 if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L64_except_error;}
33102 __pyx_t_5 = (!__pyx_t_1);
33104 __Pyx_GIVEREF(__pyx_t_20);
33105 __Pyx_GIVEREF(__pyx_t_21);
33106 __Pyx_GIVEREF(__pyx_t_6);
33107 __Pyx_ErrRestore(__pyx_t_20, __pyx_t_21, __pyx_t_6);
33108 __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_6 = 0;
33109 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L64_except_error;}
33113 __Pyx_DECREF(((PyObject *)__pyx_t_22)); __pyx_t_22 = 0;
33114 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
33115 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
33116 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
33117 goto __pyx_L63_exception_handled;
33119 __pyx_L64_except_error:;
33120 __Pyx_XGIVEREF(__pyx_t_18);
33121 __Pyx_XGIVEREF(__pyx_t_17);
33122 __Pyx_XGIVEREF(__pyx_t_16);
33123 __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_17, __pyx_t_16);
33124 goto __pyx_L29_except_error;
33125 __pyx_L63_exception_handled:;
33126 __Pyx_XGIVEREF(__pyx_t_18);
33127 __Pyx_XGIVEREF(__pyx_t_17);
33128 __Pyx_XGIVEREF(__pyx_t_16);
33129 __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_17, __pyx_t_16);
33130 __pyx_L69_try_end:;
33135 __pyx_t_16 = PyObject_Call(__pyx_t_15, __pyx_k_tuple_182, NULL);
33136 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
33137 if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L29_except_error;}
33138 __Pyx_GOTREF(__pyx_t_16);
33139 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_16);
33140 __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
33141 if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L29_except_error;}
33146 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
33147 goto __pyx_L29_except_error;
33150 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
33151 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
33152 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33153 goto __pyx_L28_exception_handled;
33155 __pyx_L29_except_error:;
33156 __Pyx_XGIVEREF(__pyx_t_11);
33157 __Pyx_XGIVEREF(__pyx_t_10);
33158 __Pyx_XGIVEREF(__pyx_t_9);
33159 __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
33160 goto __pyx_L1_error;
33161 __pyx_L28_exception_handled:;
33162 __Pyx_XGIVEREF(__pyx_t_11);
33163 __Pyx_XGIVEREF(__pyx_t_10);
33164 __Pyx_XGIVEREF(__pyx_t_9);
33165 __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
33166 __pyx_L34_try_end:;
33169 /* "csamtools.pyx":3203
33170 * # read binary output
33171 * out_stdout = inf.read()
33172 * os.remove( stdout_f ) # <<<<<<<<<<<<<<
33176 __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33177 __Pyx_GOTREF(__pyx_t_3);
33178 __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__remove); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33179 __Pyx_GOTREF(__pyx_t_4);
33180 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33181 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33182 __Pyx_GOTREF(__pyx_t_3);
33183 __Pyx_INCREF(__pyx_v_stdout_f);
33184 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_stdout_f);
33185 __Pyx_GIVEREF(__pyx_v_stdout_f);
33186 __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33187 __Pyx_GOTREF(__pyx_t_2);
33188 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
33189 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
33190 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
33195 /* "csamtools.pyx":3205
33196 * os.remove( stdout_f )
33198 * out_stdout = [] # <<<<<<<<<<<<<<
33200 * # get error messages
33202 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33203 __Pyx_GOTREF(__pyx_t_2);
33204 __pyx_v_out_stdout = ((PyObject *)__pyx_t_2);
33209 /* "csamtools.pyx":3208
33211 * # get error messages
33212 * pysam_unset_stderr() # <<<<<<<<<<<<<<
33214 * with open( stderr_f, "r") as inf:
33216 pysam_unset_stderr();
33218 /* "csamtools.pyx":3209
33219 * # get error messages
33220 * pysam_unset_stderr()
33221 * try: # <<<<<<<<<<<<<<
33222 * with open( stderr_f, "r") as inf:
33223 * out_stderr = inf.readlines()
33226 __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
33227 __Pyx_XGOTREF(__pyx_t_9);
33228 __Pyx_XGOTREF(__pyx_t_10);
33229 __Pyx_XGOTREF(__pyx_t_11);
33232 /* "csamtools.pyx":3210
33233 * pysam_unset_stderr()
33235 * with open( stderr_f, "r") as inf: # <<<<<<<<<<<<<<
33236 * out_stderr = inf.readlines()
33237 * except UnicodeDecodeError:
33240 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L75_error;}
33241 __Pyx_GOTREF(__pyx_t_2);
33242 __Pyx_INCREF(__pyx_v_stderr_f);
33243 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_stderr_f);
33244 __Pyx_GIVEREF(__pyx_v_stderr_f);
33245 __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
33246 PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__r));
33247 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
33248 __pyx_t_3 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L75_error;}
33249 __Pyx_GOTREF(__pyx_t_3);
33250 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
33251 __pyx_t_15 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____exit__); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L75_error;}
33252 __Pyx_GOTREF(__pyx_t_15);
33253 __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L83_error;}
33254 __Pyx_GOTREF(__pyx_t_2);
33255 __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L83_error;}
33256 __Pyx_GOTREF(__pyx_t_4);
33257 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
33258 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33261 __Pyx_ExceptionSave(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
33262 __Pyx_XGOTREF(__pyx_t_16);
33263 __Pyx_XGOTREF(__pyx_t_17);
33264 __Pyx_XGOTREF(__pyx_t_18);
33266 __Pyx_INCREF(__pyx_t_4);
33267 __Pyx_XDECREF(__pyx_v_inf);
33268 __pyx_v_inf = __pyx_t_4;
33269 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
33271 /* "csamtools.pyx":3211
33273 * with open( stderr_f, "r") as inf:
33274 * out_stderr = inf.readlines() # <<<<<<<<<<<<<<
33275 * except UnicodeDecodeError:
33276 * with open( stderr_f, "rb") as inf:
33278 __pyx_t_4 = PyObject_GetAttr(__pyx_v_inf, __pyx_n_s__readlines); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3211; __pyx_clineno = __LINE__; goto __pyx_L89_error;}
33279 __Pyx_GOTREF(__pyx_t_4);
33280 __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3211; __pyx_clineno = __LINE__; goto __pyx_L89_error;}
33281 __Pyx_GOTREF(__pyx_t_3);
33282 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
33283 __pyx_v_out_stderr = __pyx_t_3;
33286 __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
33287 __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
33288 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
33289 goto __pyx_L96_try_end;
33291 __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
33292 __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
33293 __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
33294 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
33295 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
33296 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
33297 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
33299 /* "csamtools.pyx":3210
33300 * pysam_unset_stderr()
33302 * with open( stderr_f, "r") as inf: # <<<<<<<<<<<<<<
33303 * out_stderr = inf.readlines()
33304 * except UnicodeDecodeError:
33307 __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
33308 if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L91_except_error;}
33309 __Pyx_GOTREF(__pyx_t_3);
33310 __Pyx_GOTREF(__pyx_t_4);
33311 __Pyx_GOTREF(__pyx_t_2);
33312 __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L91_except_error;}
33313 __Pyx_GOTREF(__pyx_t_6);
33314 __Pyx_INCREF(__pyx_t_3);
33315 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
33316 __Pyx_GIVEREF(__pyx_t_3);
33317 __Pyx_INCREF(__pyx_t_4);
33318 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
33319 __Pyx_GIVEREF(__pyx_t_4);
33320 __Pyx_INCREF(__pyx_t_2);
33321 PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2);
33322 __Pyx_GIVEREF(__pyx_t_2);
33323 __pyx_t_19 = PyObject_Call(__pyx_t_15, __pyx_t_6, NULL);
33324 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
33325 if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L91_except_error;}
33326 __Pyx_GOTREF(__pyx_t_19);
33327 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_19);
33328 __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
33329 if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L91_except_error;}
33330 __pyx_t_1 = (!__pyx_t_5);
33332 __Pyx_GIVEREF(__pyx_t_3);
33333 __Pyx_GIVEREF(__pyx_t_4);
33334 __Pyx_GIVEREF(__pyx_t_2);
33335 __Pyx_ErrRestore(__pyx_t_3, __pyx_t_4, __pyx_t_2);
33336 __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_2 = 0;
33337 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L91_except_error;}
33341 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
33342 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33343 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
33344 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
33345 goto __pyx_L90_exception_handled;
33347 __pyx_L91_except_error:;
33348 __Pyx_XGIVEREF(__pyx_t_16);
33349 __Pyx_XGIVEREF(__pyx_t_17);
33350 __Pyx_XGIVEREF(__pyx_t_18);
33351 __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
33352 goto __pyx_L75_error;
33353 __pyx_L90_exception_handled:;
33354 __Pyx_XGIVEREF(__pyx_t_16);
33355 __Pyx_XGIVEREF(__pyx_t_17);
33356 __Pyx_XGIVEREF(__pyx_t_18);
33357 __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
33358 __pyx_L96_try_end:;
33363 __pyx_t_18 = PyObject_Call(__pyx_t_15, __pyx_k_tuple_183, NULL);
33364 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
33365 if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L75_error;}
33366 __Pyx_GOTREF(__pyx_t_18);
33367 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_18);
33368 __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
33369 if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L75_error;}
33374 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
33375 goto __pyx_L75_error;
33381 /* "csamtools.pyx":3218
33382 * os.remove( stderr_f )
33384 * out_stderr = [] # <<<<<<<<<<<<<<
33386 * return retval, out_stderr, out_stdout
33388 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3218; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
33389 __Pyx_GOTREF(__pyx_t_2);
33390 __Pyx_XDECREF(__pyx_v_out_stderr);
33391 __pyx_v_out_stderr = ((PyObject *)__pyx_t_2);
33394 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
33395 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
33396 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
33397 goto __pyx_L82_try_end;
33399 __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
33400 __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
33401 __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
33402 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
33403 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
33404 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
33405 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
33407 /* "csamtools.pyx":3212
33408 * with open( stderr_f, "r") as inf:
33409 * out_stderr = inf.readlines()
33410 * except UnicodeDecodeError: # <<<<<<<<<<<<<<
33411 * with open( stderr_f, "rb") as inf:
33412 * # read binary output
33414 __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
33416 __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
33417 if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3212; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
33418 __Pyx_GOTREF(__pyx_t_2);
33419 __Pyx_GOTREF(__pyx_t_4);
33420 __Pyx_GOTREF(__pyx_t_3);
33422 /* "csamtools.pyx":3213
33423 * out_stderr = inf.readlines()
33424 * except UnicodeDecodeError:
33425 * with open( stderr_f, "rb") as inf: # <<<<<<<<<<<<<<
33426 * # read binary output
33427 * out_stderr = inf.read()
33430 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
33431 __Pyx_GOTREF(__pyx_t_6);
33432 __Pyx_INCREF(__pyx_v_stderr_f);
33433 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_stderr_f);
33434 __Pyx_GIVEREF(__pyx_v_stderr_f);
33435 __Pyx_INCREF(((PyObject *)__pyx_n_s__rb));
33436 PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_n_s__rb));
33437 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rb));
33438 __pyx_t_21 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
33439 __Pyx_GOTREF(__pyx_t_21);
33440 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
33441 __pyx_t_15 = PyObject_GetAttr(__pyx_t_21, __pyx_n_s____exit__); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
33442 __Pyx_GOTREF(__pyx_t_15);
33443 __pyx_t_6 = PyObject_GetAttr(__pyx_t_21, __pyx_n_s____enter__); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L104_error;}
33444 __Pyx_GOTREF(__pyx_t_6);
33445 __pyx_t_20 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L104_error;}
33446 __Pyx_GOTREF(__pyx_t_20);
33447 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
33448 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
33451 __Pyx_ExceptionSave(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
33452 __Pyx_XGOTREF(__pyx_t_18);
33453 __Pyx_XGOTREF(__pyx_t_17);
33454 __Pyx_XGOTREF(__pyx_t_16);
33456 __Pyx_INCREF(__pyx_t_20);
33457 __Pyx_XDECREF(__pyx_v_inf);
33458 __pyx_v_inf = __pyx_t_20;
33459 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
33461 /* "csamtools.pyx":3215
33462 * with open( stderr_f, "rb") as inf:
33463 * # read binary output
33464 * out_stderr = inf.read() # <<<<<<<<<<<<<<
33465 * os.remove( stderr_f )
33468 __pyx_t_20 = PyObject_GetAttr(__pyx_v_inf, __pyx_n_s__read); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3215; __pyx_clineno = __LINE__; goto __pyx_L110_error;}
33469 __Pyx_GOTREF(__pyx_t_20);
33470 __pyx_t_21 = PyObject_Call(__pyx_t_20, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3215; __pyx_clineno = __LINE__; goto __pyx_L110_error;}
33471 __Pyx_GOTREF(__pyx_t_21);
33472 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
33473 __Pyx_XDECREF(__pyx_v_out_stderr);
33474 __pyx_v_out_stderr = __pyx_t_21;
33477 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
33478 __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
33479 __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
33480 goto __pyx_L117_try_end;
33482 __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
33483 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
33484 __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
33485 __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
33487 /* "csamtools.pyx":3213
33488 * out_stderr = inf.readlines()
33489 * except UnicodeDecodeError:
33490 * with open( stderr_f, "rb") as inf: # <<<<<<<<<<<<<<
33491 * # read binary output
33492 * out_stderr = inf.read()
33495 __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
33496 if (__Pyx_GetException(&__pyx_t_21, &__pyx_t_20, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L112_except_error;}
33497 __Pyx_GOTREF(__pyx_t_21);
33498 __Pyx_GOTREF(__pyx_t_20);
33499 __Pyx_GOTREF(__pyx_t_6);
33500 __pyx_t_22 = PyTuple_New(3); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L112_except_error;}
33501 __Pyx_GOTREF(__pyx_t_22);
33502 __Pyx_INCREF(__pyx_t_21);
33503 PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_21);
33504 __Pyx_GIVEREF(__pyx_t_21);
33505 __Pyx_INCREF(__pyx_t_20);
33506 PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_20);
33507 __Pyx_GIVEREF(__pyx_t_20);
33508 __Pyx_INCREF(__pyx_t_6);
33509 PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_t_6);
33510 __Pyx_GIVEREF(__pyx_t_6);
33511 __pyx_t_19 = PyObject_Call(__pyx_t_15, __pyx_t_22, NULL);
33512 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
33513 if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L112_except_error;}
33514 __Pyx_GOTREF(__pyx_t_19);
33515 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_19);
33516 __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
33517 if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L112_except_error;}
33518 __pyx_t_5 = (!__pyx_t_1);
33520 __Pyx_GIVEREF(__pyx_t_21);
33521 __Pyx_GIVEREF(__pyx_t_20);
33522 __Pyx_GIVEREF(__pyx_t_6);
33523 __Pyx_ErrRestore(__pyx_t_21, __pyx_t_20, __pyx_t_6);
33524 __pyx_t_21 = 0; __pyx_t_20 = 0; __pyx_t_6 = 0;
33525 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L112_except_error;}
33529 __Pyx_DECREF(((PyObject *)__pyx_t_22)); __pyx_t_22 = 0;
33530 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
33531 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
33532 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
33533 goto __pyx_L111_exception_handled;
33535 __pyx_L112_except_error:;
33536 __Pyx_XGIVEREF(__pyx_t_18);
33537 __Pyx_XGIVEREF(__pyx_t_17);
33538 __Pyx_XGIVEREF(__pyx_t_16);
33539 __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_17, __pyx_t_16);
33540 goto __pyx_L77_except_error;
33541 __pyx_L111_exception_handled:;
33542 __Pyx_XGIVEREF(__pyx_t_18);
33543 __Pyx_XGIVEREF(__pyx_t_17);
33544 __Pyx_XGIVEREF(__pyx_t_16);
33545 __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_17, __pyx_t_16);
33546 __pyx_L117_try_end:;
33551 __pyx_t_16 = PyObject_Call(__pyx_t_15, __pyx_k_tuple_184, NULL);
33552 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
33553 if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
33554 __Pyx_GOTREF(__pyx_t_16);
33555 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_16);
33556 __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
33557 if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
33562 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
33563 goto __pyx_L77_except_error;
33567 /* "csamtools.pyx":3216
33568 * # read binary output
33569 * out_stderr = inf.read()
33570 * os.remove( stderr_f ) # <<<<<<<<<<<<<<
33574 __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3216; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
33575 __Pyx_GOTREF(__pyx_t_6);
33576 __pyx_t_20 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__remove); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3216; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
33577 __Pyx_GOTREF(__pyx_t_20);
33578 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
33579 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3216; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
33580 __Pyx_GOTREF(__pyx_t_6);
33581 __Pyx_INCREF(__pyx_v_stderr_f);
33582 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_stderr_f);
33583 __Pyx_GIVEREF(__pyx_v_stderr_f);
33584 __pyx_t_21 = PyObject_Call(__pyx_t_20, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3216; __pyx_clineno = __LINE__; goto __pyx_L77_except_error;}
33585 __Pyx_GOTREF(__pyx_t_21);
33586 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
33587 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
33588 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
33589 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
33590 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
33591 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33592 goto __pyx_L76_exception_handled;
33594 __pyx_L77_except_error:;
33595 __Pyx_XGIVEREF(__pyx_t_9);
33596 __Pyx_XGIVEREF(__pyx_t_10);
33597 __Pyx_XGIVEREF(__pyx_t_11);
33598 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
33599 goto __pyx_L1_error;
33600 __pyx_L76_exception_handled:;
33601 __Pyx_XGIVEREF(__pyx_t_9);
33602 __Pyx_XGIVEREF(__pyx_t_10);
33603 __Pyx_XGIVEREF(__pyx_t_11);
33604 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
33605 __pyx_L82_try_end:;
33608 /* "csamtools.pyx":3220
33611 * return retval, out_stderr, out_stdout # <<<<<<<<<<<<<<
33613 * cdef class SNPCall:
33615 __Pyx_XDECREF(__pyx_r);
33616 __pyx_t_3 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33617 __Pyx_GOTREF(__pyx_t_3);
33618 if (unlikely(!__pyx_v_out_stderr)) { __Pyx_RaiseUnboundLocalError("out_stderr"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
33619 if (unlikely(!__pyx_v_out_stdout)) { __Pyx_RaiseUnboundLocalError("out_stdout"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
33620 __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33621 __Pyx_GOTREF(__pyx_t_4);
33622 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
33623 __Pyx_GIVEREF(__pyx_t_3);
33624 __Pyx_INCREF(__pyx_v_out_stderr);
33625 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_out_stderr);
33626 __Pyx_GIVEREF(__pyx_v_out_stderr);
33627 __Pyx_INCREF(__pyx_v_out_stdout);
33628 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_out_stdout);
33629 __Pyx_GIVEREF(__pyx_v_out_stdout);
33631 __pyx_r = ((PyObject *)__pyx_t_4);
33635 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
33638 __Pyx_XDECREF(__pyx_t_2);
33639 __Pyx_XDECREF(__pyx_t_3);
33640 __Pyx_XDECREF(__pyx_t_4);
33641 __Pyx_XDECREF(__pyx_t_6);
33642 __Pyx_XDECREF(__pyx_t_20);
33643 __Pyx_XDECREF(__pyx_t_21);
33644 __Pyx_XDECREF(__pyx_t_22);
33645 __Pyx_AddTraceback("csamtools._samtools_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
33648 __Pyx_XDECREF(__pyx_v_stderr_h);
33649 __Pyx_XDECREF(__pyx_v_stderr_f);
33650 __Pyx_XDECREF(__pyx_v_stdout_h);
33651 __Pyx_XDECREF(__pyx_v_stdout_f);
33652 __Pyx_XDECREF(__pyx_v_stdout_save);
33653 __Pyx_XDECREF(__pyx_v_inf);
33654 __Pyx_XDECREF(__pyx_v_out_stdout);
33655 __Pyx_XDECREF(__pyx_v_out_stderr);
33656 __Pyx_XDECREF(__pyx_v_a);
33657 __Pyx_XDECREF(__pyx_v_method);
33658 __Pyx_XDECREF(__pyx_v_args);
33659 __Pyx_XDECREF(__pyx_v_catch_stdout);
33660 __Pyx_XGIVEREF(__pyx_r);
33661 __Pyx_TraceReturn(__pyx_r);
33662 __Pyx_RefNannyFinishContext();
33666 /* Python wrapper */
33667 static PyObject *__pyx_pw_9csamtools_7SNPCall_3tid_1__get__(PyObject *__pyx_v_self); /*proto*/
33668 static PyObject *__pyx_pw_9csamtools_7SNPCall_3tid_1__get__(PyObject *__pyx_v_self) {
33669 PyObject *__pyx_r = 0;
33670 __Pyx_RefNannyDeclarations
33671 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
33672 __pyx_r = __pyx_pf_9csamtools_7SNPCall_3tid___get__(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self));
33673 __Pyx_RefNannyFinishContext();
33677 /* "csamtools.pyx":3235
33679 * '''the chromosome ID as is defined in the header'''
33680 * def __get__(self): # <<<<<<<<<<<<<<
33685 static PyObject *__pyx_pf_9csamtools_7SNPCall_3tid___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self) {
33686 PyObject *__pyx_r = NULL;
33687 __Pyx_RefNannyDeclarations
33688 PyObject *__pyx_t_1 = NULL;
33689 int __pyx_lineno = 0;
33690 const char *__pyx_filename = NULL;
33691 int __pyx_clineno = 0;
33692 __Pyx_TraceDeclarations
33693 __Pyx_RefNannySetupContext("__get__", 0);
33694 __Pyx_TraceCall("__get__", __pyx_f[0], 3235);
33696 /* "csamtools.pyx":3236
33697 * '''the chromosome ID as is defined in the header'''
33698 * def __get__(self):
33699 * return self._tid # <<<<<<<<<<<<<<
33703 __Pyx_XDECREF(__pyx_r);
33704 __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33705 __Pyx_GOTREF(__pyx_t_1);
33706 __pyx_r = __pyx_t_1;
33710 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
33713 __Pyx_XDECREF(__pyx_t_1);
33714 __Pyx_AddTraceback("csamtools.SNPCall.tid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
33717 __Pyx_XGIVEREF(__pyx_r);
33718 __Pyx_TraceReturn(__pyx_r);
33719 __Pyx_RefNannyFinishContext();
33723 /* Python wrapper */
33724 static PyObject *__pyx_pw_9csamtools_7SNPCall_3pos_1__get__(PyObject *__pyx_v_self); /*proto*/
33725 static PyObject *__pyx_pw_9csamtools_7SNPCall_3pos_1__get__(PyObject *__pyx_v_self) {
33726 PyObject *__pyx_r = 0;
33727 __Pyx_RefNannyDeclarations
33728 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
33729 __pyx_r = __pyx_pf_9csamtools_7SNPCall_3pos___get__(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self));
33730 __Pyx_RefNannyFinishContext();
33734 /* "csamtools.pyx":3240
33736 * '''nucleotide position of SNP.'''
33737 * def __get__(self): return self._pos # <<<<<<<<<<<<<<
33739 * property reference_base:
33742 static PyObject *__pyx_pf_9csamtools_7SNPCall_3pos___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self) {
33743 PyObject *__pyx_r = NULL;
33744 __Pyx_RefNannyDeclarations
33745 PyObject *__pyx_t_1 = NULL;
33746 int __pyx_lineno = 0;
33747 const char *__pyx_filename = NULL;
33748 int __pyx_clineno = 0;
33749 __Pyx_TraceDeclarations
33750 __Pyx_RefNannySetupContext("__get__", 0);
33751 __Pyx_TraceCall("__get__", __pyx_f[0], 3240);
33752 __Pyx_XDECREF(__pyx_r);
33753 __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33754 __Pyx_GOTREF(__pyx_t_1);
33755 __pyx_r = __pyx_t_1;
33759 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
33762 __Pyx_XDECREF(__pyx_t_1);
33763 __Pyx_AddTraceback("csamtools.SNPCall.pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
33766 __Pyx_XGIVEREF(__pyx_r);
33767 __Pyx_TraceReturn(__pyx_r);
33768 __Pyx_RefNannyFinishContext();
33772 /* Python wrapper */
33773 static PyObject *__pyx_pw_9csamtools_7SNPCall_14reference_base_1__get__(PyObject *__pyx_v_self); /*proto*/
33774 static PyObject *__pyx_pw_9csamtools_7SNPCall_14reference_base_1__get__(PyObject *__pyx_v_self) {
33775 PyObject *__pyx_r = 0;
33776 __Pyx_RefNannyDeclarations
33777 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
33778 __pyx_r = __pyx_pf_9csamtools_7SNPCall_14reference_base___get__(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self));
33779 __Pyx_RefNannyFinishContext();
33783 /* "csamtools.pyx":3244
33784 * property reference_base:
33785 * '''reference base at pos. ``N`` if no reference sequence supplied.'''
33786 * def __get__(self): return from_string_and_size( &self._reference_base, 1 ) # <<<<<<<<<<<<<<
33788 * property genotype:
33791 static PyObject *__pyx_pf_9csamtools_7SNPCall_14reference_base___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self) {
33792 PyObject *__pyx_r = NULL;
33793 __Pyx_RefNannyDeclarations
33794 PyObject *__pyx_t_1 = NULL;
33795 int __pyx_lineno = 0;
33796 const char *__pyx_filename = NULL;
33797 int __pyx_clineno = 0;
33798 __Pyx_TraceDeclarations
33799 __Pyx_RefNannySetupContext("__get__", 0);
33800 __Pyx_TraceCall("__get__", __pyx_f[0], 3244);
33801 __Pyx_XDECREF(__pyx_r);
33802 __pyx_t_1 = __pyx_f_9csamtools_from_string_and_size((&__pyx_v_self->_reference_base), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33803 __Pyx_GOTREF(__pyx_t_1);
33804 __pyx_r = __pyx_t_1;
33808 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
33811 __Pyx_XDECREF(__pyx_t_1);
33812 __Pyx_AddTraceback("csamtools.SNPCall.reference_base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
33815 __Pyx_XGIVEREF(__pyx_r);
33816 __Pyx_TraceReturn(__pyx_r);
33817 __Pyx_RefNannyFinishContext();
33821 /* Python wrapper */
33822 static PyObject *__pyx_pw_9csamtools_7SNPCall_8genotype_1__get__(PyObject *__pyx_v_self); /*proto*/
33823 static PyObject *__pyx_pw_9csamtools_7SNPCall_8genotype_1__get__(PyObject *__pyx_v_self) {
33824 PyObject *__pyx_r = 0;
33825 __Pyx_RefNannyDeclarations
33826 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
33827 __pyx_r = __pyx_pf_9csamtools_7SNPCall_8genotype___get__(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self));
33828 __Pyx_RefNannyFinishContext();
33832 /* "csamtools.pyx":3248
33833 * property genotype:
33834 * '''the genotype called.'''
33835 * def __get__(self): return from_string_and_size( &self._genotype, 1 ) # <<<<<<<<<<<<<<
33837 * property consensus_quality:
33840 static PyObject *__pyx_pf_9csamtools_7SNPCall_8genotype___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self) {
33841 PyObject *__pyx_r = NULL;
33842 __Pyx_RefNannyDeclarations
33843 PyObject *__pyx_t_1 = NULL;
33844 int __pyx_lineno = 0;
33845 const char *__pyx_filename = NULL;
33846 int __pyx_clineno = 0;
33847 __Pyx_TraceDeclarations
33848 __Pyx_RefNannySetupContext("__get__", 0);
33849 __Pyx_TraceCall("__get__", __pyx_f[0], 3248);
33850 __Pyx_XDECREF(__pyx_r);
33851 __pyx_t_1 = __pyx_f_9csamtools_from_string_and_size((&__pyx_v_self->_genotype), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33852 __Pyx_GOTREF(__pyx_t_1);
33853 __pyx_r = __pyx_t_1;
33857 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
33860 __Pyx_XDECREF(__pyx_t_1);
33861 __Pyx_AddTraceback("csamtools.SNPCall.genotype.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
33864 __Pyx_XGIVEREF(__pyx_r);
33865 __Pyx_TraceReturn(__pyx_r);
33866 __Pyx_RefNannyFinishContext();
33870 /* Python wrapper */
33871 static PyObject *__pyx_pw_9csamtools_7SNPCall_17consensus_quality_1__get__(PyObject *__pyx_v_self); /*proto*/
33872 static PyObject *__pyx_pw_9csamtools_7SNPCall_17consensus_quality_1__get__(PyObject *__pyx_v_self) {
33873 PyObject *__pyx_r = 0;
33874 __Pyx_RefNannyDeclarations
33875 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
33876 __pyx_r = __pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self));
33877 __Pyx_RefNannyFinishContext();
33881 /* "csamtools.pyx":3252
33882 * property consensus_quality:
33883 * '''the genotype quality (Phred-scaled).'''
33884 * def __get__(self): return self._consensus_quality # <<<<<<<<<<<<<<
33886 * property snp_quality:
33889 static PyObject *__pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self) {
33890 PyObject *__pyx_r = NULL;
33891 __Pyx_RefNannyDeclarations
33892 PyObject *__pyx_t_1 = NULL;
33893 int __pyx_lineno = 0;
33894 const char *__pyx_filename = NULL;
33895 int __pyx_clineno = 0;
33896 __Pyx_TraceDeclarations
33897 __Pyx_RefNannySetupContext("__get__", 0);
33898 __Pyx_TraceCall("__get__", __pyx_f[0], 3252);
33899 __Pyx_XDECREF(__pyx_r);
33900 __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_consensus_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33901 __Pyx_GOTREF(__pyx_t_1);
33902 __pyx_r = __pyx_t_1;
33906 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
33909 __Pyx_XDECREF(__pyx_t_1);
33910 __Pyx_AddTraceback("csamtools.SNPCall.consensus_quality.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
33913 __Pyx_XGIVEREF(__pyx_r);
33914 __Pyx_TraceReturn(__pyx_r);
33915 __Pyx_RefNannyFinishContext();
33919 /* Python wrapper */
33920 static PyObject *__pyx_pw_9csamtools_7SNPCall_11snp_quality_1__get__(PyObject *__pyx_v_self); /*proto*/
33921 static PyObject *__pyx_pw_9csamtools_7SNPCall_11snp_quality_1__get__(PyObject *__pyx_v_self) {
33922 PyObject *__pyx_r = 0;
33923 __Pyx_RefNannyDeclarations
33924 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
33925 __pyx_r = __pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self));
33926 __Pyx_RefNannyFinishContext();
33930 /* "csamtools.pyx":3256
33931 * property snp_quality:
33932 * '''the snp quality (Phred scaled) - probability of consensus being identical to reference sequence.'''
33933 * def __get__(self): return self._snp_quality # <<<<<<<<<<<<<<
33935 * property mapping_quality:
33938 static PyObject *__pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self) {
33939 PyObject *__pyx_r = NULL;
33940 __Pyx_RefNannyDeclarations
33941 PyObject *__pyx_t_1 = NULL;
33942 int __pyx_lineno = 0;
33943 const char *__pyx_filename = NULL;
33944 int __pyx_clineno = 0;
33945 __Pyx_TraceDeclarations
33946 __Pyx_RefNannySetupContext("__get__", 0);
33947 __Pyx_TraceCall("__get__", __pyx_f[0], 3256);
33948 __Pyx_XDECREF(__pyx_r);
33949 __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_snp_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33950 __Pyx_GOTREF(__pyx_t_1);
33951 __pyx_r = __pyx_t_1;
33955 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
33958 __Pyx_XDECREF(__pyx_t_1);
33959 __Pyx_AddTraceback("csamtools.SNPCall.snp_quality.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
33962 __Pyx_XGIVEREF(__pyx_r);
33963 __Pyx_TraceReturn(__pyx_r);
33964 __Pyx_RefNannyFinishContext();
33968 /* Python wrapper */
33969 static PyObject *__pyx_pw_9csamtools_7SNPCall_15mapping_quality_1__get__(PyObject *__pyx_v_self); /*proto*/
33970 static PyObject *__pyx_pw_9csamtools_7SNPCall_15mapping_quality_1__get__(PyObject *__pyx_v_self) {
33971 PyObject *__pyx_r = 0;
33972 __Pyx_RefNannyDeclarations
33973 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
33974 __pyx_r = __pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self));
33975 __Pyx_RefNannyFinishContext();
33979 /* "csamtools.pyx":3260
33980 * property mapping_quality:
33981 * '''the root mean square (rms) of the mapping quality of all reads involved in the call.'''
33982 * def __get__(self): return self._rms_mapping_quality # <<<<<<<<<<<<<<
33984 * property coverage:
33987 static PyObject *__pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self) {
33988 PyObject *__pyx_r = NULL;
33989 __Pyx_RefNannyDeclarations
33990 PyObject *__pyx_t_1 = NULL;
33991 int __pyx_lineno = 0;
33992 const char *__pyx_filename = NULL;
33993 int __pyx_clineno = 0;
33994 __Pyx_TraceDeclarations
33995 __Pyx_RefNannySetupContext("__get__", 0);
33996 __Pyx_TraceCall("__get__", __pyx_f[0], 3260);
33997 __Pyx_XDECREF(__pyx_r);
33998 __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_rms_mapping_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33999 __Pyx_GOTREF(__pyx_t_1);
34000 __pyx_r = __pyx_t_1;
34004 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
34007 __Pyx_XDECREF(__pyx_t_1);
34008 __Pyx_AddTraceback("csamtools.SNPCall.mapping_quality.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
34011 __Pyx_XGIVEREF(__pyx_r);
34012 __Pyx_TraceReturn(__pyx_r);
34013 __Pyx_RefNannyFinishContext();
34017 /* Python wrapper */
34018 static PyObject *__pyx_pw_9csamtools_7SNPCall_8coverage_1__get__(PyObject *__pyx_v_self); /*proto*/
34019 static PyObject *__pyx_pw_9csamtools_7SNPCall_8coverage_1__get__(PyObject *__pyx_v_self) {
34020 PyObject *__pyx_r = 0;
34021 __Pyx_RefNannyDeclarations
34022 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
34023 __pyx_r = __pyx_pf_9csamtools_7SNPCall_8coverage___get__(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self));
34024 __Pyx_RefNannyFinishContext();
34028 /* "csamtools.pyx":3264
34029 * property coverage:
34030 * '''coverage or read depth - the number of reads involved in the call.'''
34031 * def __get__(self): return self._coverage # <<<<<<<<<<<<<<
34033 * def __str__(self):
34036 static PyObject *__pyx_pf_9csamtools_7SNPCall_8coverage___get__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self) {
34037 PyObject *__pyx_r = NULL;
34038 __Pyx_RefNannyDeclarations
34039 PyObject *__pyx_t_1 = NULL;
34040 int __pyx_lineno = 0;
34041 const char *__pyx_filename = NULL;
34042 int __pyx_clineno = 0;
34043 __Pyx_TraceDeclarations
34044 __Pyx_RefNannySetupContext("__get__", 0);
34045 __Pyx_TraceCall("__get__", __pyx_f[0], 3264);
34046 __Pyx_XDECREF(__pyx_r);
34047 __pyx_t_1 = PyInt_FromLong(__pyx_v_self->_coverage); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34048 __Pyx_GOTREF(__pyx_t_1);
34049 __pyx_r = __pyx_t_1;
34053 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
34056 __Pyx_XDECREF(__pyx_t_1);
34057 __Pyx_AddTraceback("csamtools.SNPCall.coverage.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
34060 __Pyx_XGIVEREF(__pyx_r);
34061 __Pyx_TraceReturn(__pyx_r);
34062 __Pyx_RefNannyFinishContext();
34066 /* Python wrapper */
34067 static PyObject *__pyx_pw_9csamtools_7SNPCall_1__str__(PyObject *__pyx_v_self); /*proto*/
34068 static PyObject *__pyx_pw_9csamtools_7SNPCall_1__str__(PyObject *__pyx_v_self) {
34069 PyObject *__pyx_r = 0;
34070 __Pyx_RefNannyDeclarations
34071 __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
34072 __pyx_r = __pyx_pf_9csamtools_7SNPCall___str__(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self));
34073 __Pyx_RefNannyFinishContext();
34077 /* "csamtools.pyx":3266
34078 * def __get__(self): return self._coverage
34080 * def __str__(self): # <<<<<<<<<<<<<<
34082 * return "\t".join( map(str, (
34085 static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(struct __pyx_obj_9csamtools_SNPCall *__pyx_v_self) {
34086 PyObject *__pyx_r = NULL;
34087 __Pyx_RefNannyDeclarations
34088 PyObject *__pyx_t_1 = NULL;
34089 PyObject *__pyx_t_2 = NULL;
34090 PyObject *__pyx_t_3 = NULL;
34091 PyObject *__pyx_t_4 = NULL;
34092 PyObject *__pyx_t_5 = NULL;
34093 PyObject *__pyx_t_6 = NULL;
34094 PyObject *__pyx_t_7 = NULL;
34095 PyObject *__pyx_t_8 = NULL;
34096 PyObject *__pyx_t_9 = NULL;
34097 PyObject *__pyx_t_10 = NULL;
34098 int __pyx_lineno = 0;
34099 const char *__pyx_filename = NULL;
34100 int __pyx_clineno = 0;
34101 __Pyx_TraceDeclarations
34102 __Pyx_RefNannySetupContext("__str__", 0);
34103 __Pyx_TraceCall("__str__", __pyx_f[0], 3266);
34105 /* "csamtools.pyx":3268
34106 * def __str__(self):
34108 * return "\t".join( map(str, ( # <<<<<<<<<<<<<<
34112 __Pyx_XDECREF(__pyx_r);
34113 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_5), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34114 __Pyx_GOTREF(__pyx_t_1);
34116 /* "csamtools.pyx":3269
34118 * return "\t".join( map(str, (
34119 * self.tid, # <<<<<<<<<<<<<<
34121 * self.reference_base,
34123 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34124 __Pyx_GOTREF(__pyx_t_2);
34126 /* "csamtools.pyx":3270
34127 * return "\t".join( map(str, (
34129 * self.pos, # <<<<<<<<<<<<<<
34130 * self.reference_base,
34133 __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34134 __Pyx_GOTREF(__pyx_t_3);
34136 /* "csamtools.pyx":3271
34139 * self.reference_base, # <<<<<<<<<<<<<<
34141 * self.consensus_quality,
34143 __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__reference_base); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34144 __Pyx_GOTREF(__pyx_t_4);
34146 /* "csamtools.pyx":3272
34148 * self.reference_base,
34149 * self.genotype, # <<<<<<<<<<<<<<
34150 * self.consensus_quality,
34151 * self.snp_quality,
34153 __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__genotype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34154 __Pyx_GOTREF(__pyx_t_5);
34156 /* "csamtools.pyx":3273
34157 * self.reference_base,
34159 * self.consensus_quality, # <<<<<<<<<<<<<<
34160 * self.snp_quality,
34161 * self.mapping_quality,
34163 __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__consensus_quality); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34164 __Pyx_GOTREF(__pyx_t_6);
34166 /* "csamtools.pyx":3274
34168 * self.consensus_quality,
34169 * self.snp_quality, # <<<<<<<<<<<<<<
34170 * self.mapping_quality,
34171 * self.coverage ) ) )
34173 __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__snp_quality); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34174 __Pyx_GOTREF(__pyx_t_7);
34176 /* "csamtools.pyx":3275
34177 * self.consensus_quality,
34178 * self.snp_quality,
34179 * self.mapping_quality, # <<<<<<<<<<<<<<
34180 * self.coverage ) ) )
34183 __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__mapping_quality); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34184 __Pyx_GOTREF(__pyx_t_8);
34186 /* "csamtools.pyx":3276
34187 * self.snp_quality,
34188 * self.mapping_quality,
34189 * self.coverage ) ) ) # <<<<<<<<<<<<<<
34193 __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__coverage); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34194 __Pyx_GOTREF(__pyx_t_9);
34195 __pyx_t_10 = PyTuple_New(8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34196 __Pyx_GOTREF(__pyx_t_10);
34197 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2);
34198 __Pyx_GIVEREF(__pyx_t_2);
34199 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_3);
34200 __Pyx_GIVEREF(__pyx_t_3);
34201 PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_4);
34202 __Pyx_GIVEREF(__pyx_t_4);
34203 PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_5);
34204 __Pyx_GIVEREF(__pyx_t_5);
34205 PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_6);
34206 __Pyx_GIVEREF(__pyx_t_6);
34207 PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_7);
34208 __Pyx_GIVEREF(__pyx_t_7);
34209 PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_t_8);
34210 __Pyx_GIVEREF(__pyx_t_8);
34211 PyTuple_SET_ITEM(__pyx_t_10, 7, __pyx_t_9);
34212 __Pyx_GIVEREF(__pyx_t_9);
34221 __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34222 __Pyx_GOTREF(__pyx_t_9);
34223 __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
34224 PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
34225 __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
34226 PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_t_10));
34227 __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
34229 __pyx_t_10 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34230 __Pyx_GOTREF(__pyx_t_10);
34231 __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
34232 __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34233 __Pyx_GOTREF(__pyx_t_9);
34234 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10);
34235 __Pyx_GIVEREF(__pyx_t_10);
34237 __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34238 __Pyx_GOTREF(__pyx_t_10);
34239 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
34240 __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
34241 __pyx_r = __pyx_t_10;
34245 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
34248 __Pyx_XDECREF(__pyx_t_1);
34249 __Pyx_XDECREF(__pyx_t_2);
34250 __Pyx_XDECREF(__pyx_t_3);
34251 __Pyx_XDECREF(__pyx_t_4);
34252 __Pyx_XDECREF(__pyx_t_5);
34253 __Pyx_XDECREF(__pyx_t_6);
34254 __Pyx_XDECREF(__pyx_t_7);
34255 __Pyx_XDECREF(__pyx_t_8);
34256 __Pyx_XDECREF(__pyx_t_9);
34257 __Pyx_XDECREF(__pyx_t_10);
34258 __Pyx_AddTraceback("csamtools.SNPCall.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
34261 __Pyx_XGIVEREF(__pyx_r);
34262 __Pyx_TraceReturn(__pyx_r);
34263 __Pyx_RefNannyFinishContext();
34267 /* Python wrapper */
34268 static int __pyx_pw_9csamtools_12IndexedReads_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
34269 static int __pyx_pw_9csamtools_12IndexedReads_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
34270 struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
34271 int __pyx_v_reopen;
34272 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__reopen,0};
34274 __Pyx_RefNannyDeclarations
34275 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
34277 PyObject* values[2] = {0,0};
34278 if (unlikely(__pyx_kwds)) {
34279 Py_ssize_t kw_args;
34280 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
34281 switch (pos_args) {
34282 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
34283 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
34285 default: goto __pyx_L5_argtuple_error;
34287 kw_args = PyDict_Size(__pyx_kwds);
34288 switch (pos_args) {
34290 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
34291 if (likely(values[0])) kw_args--;
34292 else goto __pyx_L5_argtuple_error;
34295 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reopen);
34296 if (value) { values[1] = value; kw_args--; }
34299 if (unlikely(kw_args > 0)) {
34300 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3786; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
34305 /* "csamtools.pyx":3786
34308 * def __init__(self, Samfile samfile, int reopen = True ): # <<<<<<<<<<<<<<
34309 * self.samfile = samfile
34312 __pyx_v_reopen = ((int)1);
34315 switch (PyTuple_GET_SIZE(__pyx_args)) {
34316 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
34317 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
34319 default: goto __pyx_L5_argtuple_error;
34322 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
34324 __pyx_v_reopen = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3786; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
34326 __pyx_v_reopen = ((int)1);
34329 goto __pyx_L4_argument_unpacking_done;
34330 __pyx_L5_argtuple_error:;
34331 __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3786; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
34333 __Pyx_AddTraceback("csamtools.IndexedReads.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
34334 __Pyx_RefNannyFinishContext();
34336 __pyx_L4_argument_unpacking_done:;
34337 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34338 __pyx_r = __pyx_pf_9csamtools_12IndexedReads___init__(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self), __pyx_v_samfile, __pyx_v_reopen);
34343 __Pyx_RefNannyFinishContext();
34347 static int __pyx_pf_9csamtools_12IndexedReads___init__(struct __pyx_obj_9csamtools_IndexedReads *__pyx_v_self, struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile, int __pyx_v_reopen) {
34348 PyObject *__pyx_v_mode = NULL;
34349 PyObject *__pyx_v_store = NULL;
34351 __Pyx_RefNannyDeclarations
34352 PyObject *__pyx_t_1 = NULL;
34353 PyObject *__pyx_t_2 = NULL;
34355 int __pyx_lineno = 0;
34356 const char *__pyx_filename = NULL;
34357 int __pyx_clineno = 0;
34358 __Pyx_TraceDeclarations
34359 __Pyx_RefNannySetupContext("__init__", 0);
34360 __Pyx_TraceCall("__init__", __pyx_f[0], 3786);
34362 /* "csamtools.pyx":3787
34364 * def __init__(self, Samfile samfile, int reopen = True ):
34365 * self.samfile = samfile # <<<<<<<<<<<<<<
34367 * if samfile.isbam: mode = b"rb"
34369 __Pyx_INCREF(((PyObject *)__pyx_v_samfile));
34370 __Pyx_GIVEREF(((PyObject *)__pyx_v_samfile));
34371 __Pyx_GOTREF(__pyx_v_self->samfile);
34372 __Pyx_DECREF(((PyObject *)__pyx_v_self->samfile));
34373 __pyx_v_self->samfile = __pyx_v_samfile;
34375 /* "csamtools.pyx":3789
34376 * self.samfile = samfile
34378 * if samfile.isbam: mode = b"rb" # <<<<<<<<<<<<<<
34379 * else: mode = b"r"
34382 if (__pyx_v_samfile->isbam) {
34383 __Pyx_INCREF(((PyObject *)__pyx_n_b__rb));
34384 __pyx_v_mode = __pyx_n_b__rb;
34389 /* "csamtools.pyx":3790
34391 * if samfile.isbam: mode = b"rb"
34392 * else: mode = b"r" # <<<<<<<<<<<<<<
34394 * # reopen the file - note that this makes the iterator
34396 __Pyx_INCREF(((PyObject *)__pyx_n_b__r));
34397 __pyx_v_mode = __pyx_n_b__r;
34401 /* "csamtools.pyx":3794
34402 * # reopen the file - note that this makes the iterator
34403 * # slow and causes pileup to slow down significantly.
34404 * if reopen: # <<<<<<<<<<<<<<
34405 * store = StderrStore()
34406 * self.fp = samopen( samfile._filename, mode, NULL )
34408 if (__pyx_v_reopen) {
34410 /* "csamtools.pyx":3795
34411 * # slow and causes pileup to slow down significantly.
34413 * store = StderrStore() # <<<<<<<<<<<<<<
34414 * self.fp = samopen( samfile._filename, mode, NULL )
34417 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34418 __Pyx_GOTREF(__pyx_t_1);
34419 __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 = 3795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34420 __Pyx_GOTREF(__pyx_t_2);
34421 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
34422 __pyx_v_store = __pyx_t_2;
34425 /* "csamtools.pyx":3796
34427 * store = StderrStore()
34428 * self.fp = samopen( samfile._filename, mode, NULL ) # <<<<<<<<<<<<<<
34430 * assert self.fp != NULL
34432 __pyx_t_3 = PyBytes_AsString(((PyObject *)__pyx_v_mode)); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34433 __pyx_v_self->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_3, NULL);
34435 /* "csamtools.pyx":3797
34436 * store = StderrStore()
34437 * self.fp = samopen( samfile._filename, mode, NULL )
34438 * store.release() # <<<<<<<<<<<<<<
34439 * assert self.fp != NULL
34440 * self.owns_samfile = True
34442 __pyx_t_2 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34443 __Pyx_GOTREF(__pyx_t_2);
34444 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34445 __Pyx_GOTREF(__pyx_t_1);
34446 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
34447 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
34449 /* "csamtools.pyx":3798
34450 * self.fp = samopen( samfile._filename, mode, NULL )
34452 * assert self.fp != NULL # <<<<<<<<<<<<<<
34453 * self.owns_samfile = True
34456 #ifndef CYTHON_WITHOUT_ASSERTIONS
34457 if (unlikely(!(__pyx_v_self->fp != NULL))) {
34458 PyErr_SetNone(PyExc_AssertionError);
34459 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34463 /* "csamtools.pyx":3799
34465 * assert self.fp != NULL
34466 * self.owns_samfile = True # <<<<<<<<<<<<<<
34468 * self.fp = samfile.samfile
34470 __pyx_v_self->owns_samfile = 1;
34475 /* "csamtools.pyx":3801
34476 * self.owns_samfile = True
34478 * self.fp = samfile.samfile # <<<<<<<<<<<<<<
34479 * self.owns_samfile = False
34482 __pyx_v_self->fp = __pyx_v_samfile->samfile;
34484 /* "csamtools.pyx":3802
34486 * self.fp = samfile.samfile
34487 * self.owns_samfile = False # <<<<<<<<<<<<<<
34489 * assert samfile.isbam, "can only IndexReads on bam files"
34491 __pyx_v_self->owns_samfile = 0;
34495 /* "csamtools.pyx":3804
34496 * self.owns_samfile = False
34498 * assert samfile.isbam, "can only IndexReads on bam files" # <<<<<<<<<<<<<<
34500 * def build( self ):
34502 #ifndef CYTHON_WITHOUT_ASSERTIONS
34503 if (unlikely(!__pyx_v_samfile->isbam)) {
34504 PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_185));
34505 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34512 __Pyx_XDECREF(__pyx_t_1);
34513 __Pyx_XDECREF(__pyx_t_2);
34514 __Pyx_AddTraceback("csamtools.IndexedReads.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
34517 __Pyx_XDECREF(__pyx_v_mode);
34518 __Pyx_XDECREF(__pyx_v_store);
34519 __Pyx_TraceReturn(Py_None);
34520 __Pyx_RefNannyFinishContext();
34524 /* Python wrapper */
34525 static PyObject *__pyx_pw_9csamtools_12IndexedReads_3build(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
34526 static char __pyx_doc_9csamtools_12IndexedReads_2build[] = "IndexedReads.build(self)\nbuild index.";
34527 static PyObject *__pyx_pw_9csamtools_12IndexedReads_3build(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
34528 PyObject *__pyx_r = 0;
34529 __Pyx_RefNannyDeclarations
34530 __Pyx_RefNannySetupContext("build (wrapper)", 0);
34531 __pyx_r = __pyx_pf_9csamtools_12IndexedReads_2build(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self));
34532 __Pyx_RefNannyFinishContext();
34536 /* "csamtools.pyx":3806
34537 * assert samfile.isbam, "can only IndexReads on bam files"
34539 * def build( self ): # <<<<<<<<<<<<<<
34540 * '''build index.'''
34544 static PyObject *__pyx_pf_9csamtools_12IndexedReads_2build(struct __pyx_obj_9csamtools_IndexedReads *__pyx_v_self) {
34547 uint64_t __pyx_v_pos;
34548 PyObject *__pyx_v_qname = NULL;
34549 PyObject *__pyx_r = NULL;
34550 __Pyx_RefNannyDeclarations
34551 PyObject *__pyx_t_1 = NULL;
34552 PyObject *__pyx_t_2 = NULL;
34553 PyObject *__pyx_t_3 = NULL;
34555 int __pyx_lineno = 0;
34556 const char *__pyx_filename = NULL;
34557 int __pyx_clineno = 0;
34558 __Pyx_TraceDeclarations
34559 __Pyx_RefNannySetupContext("build", 0);
34560 __Pyx_TraceCall("build", __pyx_f[0], 3806);
34562 /* "csamtools.pyx":3809
34563 * '''build index.'''
34565 * self.index = collections.defaultdict( list ) # <<<<<<<<<<<<<<
34567 * # this method will start indexing from the current file position
34569 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__collections); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34570 __Pyx_GOTREF(__pyx_t_1);
34571 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34572 __Pyx_GOTREF(__pyx_t_2);
34573 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
34574 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34575 __Pyx_GOTREF(__pyx_t_1);
34576 __Pyx_INCREF(((PyObject *)((PyObject*)(&PyList_Type))));
34577 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)(&PyList_Type))));
34578 __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyList_Type))));
34579 __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34580 __Pyx_GOTREF(__pyx_t_3);
34581 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
34582 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
34583 __Pyx_GIVEREF(__pyx_t_3);
34584 __Pyx_GOTREF(__pyx_v_self->index);
34585 __Pyx_DECREF(__pyx_v_self->index);
34586 __pyx_v_self->index = __pyx_t_3;
34589 /* "csamtools.pyx":3813
34590 * # this method will start indexing from the current file position
34592 * cdef int ret = 1 # <<<<<<<<<<<<<<
34593 * cdef bam1_t * b = <bam1_t*> calloc(1, sizeof( bam1_t) )
34598 /* "csamtools.pyx":3814
34601 * cdef bam1_t * b = <bam1_t*> calloc(1, sizeof( bam1_t) ) # <<<<<<<<<<<<<<
34603 * cdef uint64_t pos
34605 __pyx_v_b = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
34607 /* "csamtools.pyx":3818
34608 * cdef uint64_t pos
34610 * while ret > 0: # <<<<<<<<<<<<<<
34611 * pos = bam_tell( self.fp.x.bam )
34612 * ret = samread( self.fp, b)
34615 __pyx_t_4 = (__pyx_v_ret > 0);
34616 if (!__pyx_t_4) break;
34618 /* "csamtools.pyx":3819
34621 * pos = bam_tell( self.fp.x.bam ) # <<<<<<<<<<<<<<
34622 * ret = samread( self.fp, b)
34625 __pyx_v_pos = bam_tell(__pyx_v_self->fp->x.bam);
34627 /* "csamtools.pyx":3820
34629 * pos = bam_tell( self.fp.x.bam )
34630 * ret = samread( self.fp, b) # <<<<<<<<<<<<<<
34632 * qname = _charptr_to_str(bam1_qname( b ))
34634 __pyx_v_ret = samread(__pyx_v_self->fp, __pyx_v_b);
34636 /* "csamtools.pyx":3821
34637 * pos = bam_tell( self.fp.x.bam )
34638 * ret = samread( self.fp, b)
34639 * if ret > 0: # <<<<<<<<<<<<<<
34640 * qname = _charptr_to_str(bam1_qname( b ))
34641 * self.index[qname].append( pos )
34643 __pyx_t_4 = (__pyx_v_ret > 0);
34646 /* "csamtools.pyx":3822
34647 * ret = samread( self.fp, b)
34649 * qname = _charptr_to_str(bam1_qname( b )) # <<<<<<<<<<<<<<
34650 * self.index[qname].append( pos )
34653 __pyx_t_3 = __pyx_f_9csamtools__charptr_to_str(bam1_qname(__pyx_v_b)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34654 __Pyx_GOTREF(__pyx_t_3);
34655 __Pyx_XDECREF(__pyx_v_qname);
34656 __pyx_v_qname = __pyx_t_3;
34659 /* "csamtools.pyx":3823
34661 * qname = _charptr_to_str(bam1_qname( b ))
34662 * self.index[qname].append( pos ) # <<<<<<<<<<<<<<
34664 * bam_destroy1( b )
34666 __pyx_t_3 = PyObject_GetItem(__pyx_v_self->index, __pyx_v_qname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34667 __Pyx_GOTREF(__pyx_t_3);
34668 __pyx_t_1 = __Pyx_PyInt_to_py_uint64_t(__pyx_v_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34669 __Pyx_GOTREF(__pyx_t_1);
34670 __pyx_t_2 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34671 __Pyx_GOTREF(__pyx_t_2);
34672 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34673 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
34674 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
34680 /* "csamtools.pyx":3825
34681 * self.index[qname].append( pos )
34683 * bam_destroy1( b ) # <<<<<<<<<<<<<<
34685 * def find( self, qname ):
34687 bam_destroy1(__pyx_v_b);
34689 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
34692 __Pyx_XDECREF(__pyx_t_1);
34693 __Pyx_XDECREF(__pyx_t_2);
34694 __Pyx_XDECREF(__pyx_t_3);
34695 __Pyx_AddTraceback("csamtools.IndexedReads.build", __pyx_clineno, __pyx_lineno, __pyx_filename);
34698 __Pyx_XDECREF(__pyx_v_qname);
34699 __Pyx_XGIVEREF(__pyx_r);
34700 __Pyx_TraceReturn(__pyx_r);
34701 __Pyx_RefNannyFinishContext();
34705 /* Python wrapper */
34706 static PyObject *__pyx_pw_9csamtools_12IndexedReads_5find(PyObject *__pyx_v_self, PyObject *__pyx_v_qname); /*proto*/
34707 static char __pyx_doc_9csamtools_12IndexedReads_4find[] = "IndexedReads.find(self, qname)";
34708 static PyObject *__pyx_pw_9csamtools_12IndexedReads_5find(PyObject *__pyx_v_self, PyObject *__pyx_v_qname) {
34709 PyObject *__pyx_r = 0;
34710 __Pyx_RefNannyDeclarations
34711 __Pyx_RefNannySetupContext("find (wrapper)", 0);
34712 __pyx_r = __pyx_pf_9csamtools_12IndexedReads_4find(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self), ((PyObject *)__pyx_v_qname));
34713 __Pyx_RefNannyFinishContext();
34717 /* "csamtools.pyx":3827
34718 * bam_destroy1( b )
34720 * def find( self, qname ): # <<<<<<<<<<<<<<
34721 * if qname in self.index:
34722 * return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )
34725 static PyObject *__pyx_pf_9csamtools_12IndexedReads_4find(struct __pyx_obj_9csamtools_IndexedReads *__pyx_v_self, PyObject *__pyx_v_qname) {
34726 PyObject *__pyx_r = NULL;
34727 __Pyx_RefNannyDeclarations
34729 PyObject *__pyx_t_2 = NULL;
34730 PyObject *__pyx_t_3 = NULL;
34731 PyObject *__pyx_t_4 = NULL;
34732 int __pyx_lineno = 0;
34733 const char *__pyx_filename = NULL;
34734 int __pyx_clineno = 0;
34735 __Pyx_TraceDeclarations
34736 __Pyx_RefNannySetupContext("find", 0);
34737 __Pyx_TraceCall("find", __pyx_f[0], 3827);
34739 /* "csamtools.pyx":3828
34741 * def find( self, qname ):
34742 * if qname in self.index: # <<<<<<<<<<<<<<
34743 * return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )
34746 __pyx_t_1 = ((PySequence_Contains(__pyx_v_self->index, __pyx_v_qname))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34749 /* "csamtools.pyx":3829
34750 * def find( self, qname ):
34751 * if qname in self.index:
34752 * return IteratorRowSelection( self.samfile, self.index[qname], reopen = False ) # <<<<<<<<<<<<<<
34754 * raise KeyError( "read %s not found" % qname )
34756 __Pyx_XDECREF(__pyx_r);
34757 __pyx_t_2 = PyObject_GetItem(__pyx_v_self->index, __pyx_v_qname); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34758 __Pyx_GOTREF(__pyx_t_2);
34759 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34760 __Pyx_GOTREF(__pyx_t_3);
34761 __Pyx_INCREF(((PyObject *)__pyx_v_self->samfile));
34762 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->samfile));
34763 __Pyx_GIVEREF(((PyObject *)__pyx_v_self->samfile));
34764 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
34765 __Pyx_GIVEREF(__pyx_t_2);
34767 __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34768 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
34769 __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34770 __Pyx_GOTREF(__pyx_t_4);
34771 if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reopen), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34772 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34773 __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowSelection)), ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34774 __Pyx_GOTREF(__pyx_t_4);
34775 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
34776 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
34777 __pyx_r = __pyx_t_4;
34784 /* "csamtools.pyx":3831
34785 * return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )
34787 * raise KeyError( "read %s not found" % qname ) # <<<<<<<<<<<<<<
34789 * def __dealloc__(self):
34791 __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_186), __pyx_v_qname); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34792 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
34793 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34794 __Pyx_GOTREF(__pyx_t_2);
34795 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4));
34796 __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
34798 __pyx_t_4 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34799 __Pyx_GOTREF(__pyx_t_4);
34800 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
34801 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
34802 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34803 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
34807 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
34810 __Pyx_XDECREF(__pyx_t_2);
34811 __Pyx_XDECREF(__pyx_t_3);
34812 __Pyx_XDECREF(__pyx_t_4);
34813 __Pyx_AddTraceback("csamtools.IndexedReads.find", __pyx_clineno, __pyx_lineno, __pyx_filename);
34816 __Pyx_XGIVEREF(__pyx_r);
34817 __Pyx_TraceReturn(__pyx_r);
34818 __Pyx_RefNannyFinishContext();
34822 /* Python wrapper */
34823 static void __pyx_pw_9csamtools_12IndexedReads_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
34824 static void __pyx_pw_9csamtools_12IndexedReads_7__dealloc__(PyObject *__pyx_v_self) {
34825 __Pyx_RefNannyDeclarations
34826 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
34827 __pyx_pf_9csamtools_12IndexedReads_6__dealloc__(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self));
34828 __Pyx_RefNannyFinishContext();
34831 /* "csamtools.pyx":3833
34832 * raise KeyError( "read %s not found" % qname )
34834 * def __dealloc__(self): # <<<<<<<<<<<<<<
34835 * if self.owns_samfile: samclose( self.fp )
34839 static void __pyx_pf_9csamtools_12IndexedReads_6__dealloc__(struct __pyx_obj_9csamtools_IndexedReads *__pyx_v_self) {
34840 __Pyx_RefNannyDeclarations
34841 __Pyx_TraceDeclarations
34842 __Pyx_RefNannySetupContext("__dealloc__", 0);
34843 __Pyx_TraceCall("__dealloc__", __pyx_f[0], 3833);
34845 /* "csamtools.pyx":3834
34847 * def __dealloc__(self):
34848 * if self.owns_samfile: samclose( self.fp ) # <<<<<<<<<<<<<<
34850 * __all__ = ["Samfile",
34852 if (__pyx_v_self->owns_samfile) {
34853 samclose(__pyx_v_self->fp);
34858 __Pyx_TraceReturn(Py_None);
34859 __Pyx_RefNannyFinishContext();
34861 static struct __pyx_vtabstruct_9csamtools_Fastafile __pyx_vtable_9csamtools_Fastafile;
34863 static PyObject *__pyx_tp_new_9csamtools_Fastafile(PyTypeObject *t, PyObject *a, PyObject *k) {
34864 struct __pyx_obj_9csamtools_Fastafile *p;
34865 PyObject *o = (*t->tp_alloc)(t, 0);
34867 p = ((struct __pyx_obj_9csamtools_Fastafile *)o);
34868 p->__pyx_vtab = __pyx_vtabptr_9csamtools_Fastafile;
34869 if (__pyx_pw_9csamtools_9Fastafile_1__cinit__(o, a, k) < 0) {
34870 Py_DECREF(o); o = 0;
34875 static void __pyx_tp_dealloc_9csamtools_Fastafile(PyObject *o) {
34877 PyObject *etype, *eval, *etb;
34878 PyErr_Fetch(&etype, &eval, &etb);
34880 __pyx_pw_9csamtools_9Fastafile_11__dealloc__(o);
34881 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
34883 PyErr_Restore(etype, eval, etb);
34885 (*Py_TYPE(o)->tp_free)(o);
34888 static PyObject *__pyx_getprop_9csamtools_9Fastafile_filename(PyObject *o, void *x) {
34889 return __pyx_pw_9csamtools_9Fastafile_8filename_1__get__(o);
34892 static PyMethodDef __pyx_methods_9csamtools_Fastafile[] = {
34893 {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pw_9csamtools_9Fastafile_3_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_2_isOpen)},
34894 {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pw_9csamtools_9Fastafile_7_open, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_6_open)},
34895 {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_9csamtools_9Fastafile_9close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_8close)},
34896 {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pw_9csamtools_9Fastafile_13fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_12fetch)},
34900 static struct PyGetSetDef __pyx_getsets_9csamtools_Fastafile[] = {
34901 {(char *)"filename", __pyx_getprop_9csamtools_9Fastafile_filename, 0, __Pyx_DOCSTR(__pyx_k_187), 0},
34905 static PyNumberMethods __pyx_tp_as_number_Fastafile = {
34909 #if PY_MAJOR_VERSION < 3
34912 0, /*nb_remainder*/
34925 #if PY_MAJOR_VERSION < 3
34929 #if PY_MAJOR_VERSION < 3
34935 #if PY_MAJOR_VERSION < 3
34938 #if PY_MAJOR_VERSION < 3
34941 0, /*nb_inplace_add*/
34942 0, /*nb_inplace_subtract*/
34943 0, /*nb_inplace_multiply*/
34944 #if PY_MAJOR_VERSION < 3
34945 0, /*nb_inplace_divide*/
34947 0, /*nb_inplace_remainder*/
34948 0, /*nb_inplace_power*/
34949 0, /*nb_inplace_lshift*/
34950 0, /*nb_inplace_rshift*/
34951 0, /*nb_inplace_and*/
34952 0, /*nb_inplace_xor*/
34953 0, /*nb_inplace_or*/
34954 0, /*nb_floor_divide*/
34955 0, /*nb_true_divide*/
34956 0, /*nb_inplace_floor_divide*/
34957 0, /*nb_inplace_true_divide*/
34958 #if PY_VERSION_HEX >= 0x02050000
34963 static PySequenceMethods __pyx_tp_as_sequence_Fastafile = {
34964 __pyx_pw_9csamtools_9Fastafile_5__len__, /*sq_length*/
34970 0, /*sq_ass_slice*/
34972 0, /*sq_inplace_concat*/
34973 0, /*sq_inplace_repeat*/
34976 static PyMappingMethods __pyx_tp_as_mapping_Fastafile = {
34977 __pyx_pw_9csamtools_9Fastafile_5__len__, /*mp_length*/
34978 0, /*mp_subscript*/
34979 0, /*mp_ass_subscript*/
34982 static PyBufferProcs __pyx_tp_as_buffer_Fastafile = {
34983 #if PY_MAJOR_VERSION < 3
34984 0, /*bf_getreadbuffer*/
34986 #if PY_MAJOR_VERSION < 3
34987 0, /*bf_getwritebuffer*/
34989 #if PY_MAJOR_VERSION < 3
34990 0, /*bf_getsegcount*/
34992 #if PY_MAJOR_VERSION < 3
34993 0, /*bf_getcharbuffer*/
34995 #if PY_VERSION_HEX >= 0x02060000
34996 0, /*bf_getbuffer*/
34998 #if PY_VERSION_HEX >= 0x02060000
34999 0, /*bf_releasebuffer*/
35003 static PyTypeObject __pyx_type_9csamtools_Fastafile = {
35004 PyVarObject_HEAD_INIT(0, 0)
35005 __Pyx_NAMESTR("csamtools.Fastafile"), /*tp_name*/
35006 sizeof(struct __pyx_obj_9csamtools_Fastafile), /*tp_basicsize*/
35008 __pyx_tp_dealloc_9csamtools_Fastafile, /*tp_dealloc*/
35012 #if PY_MAJOR_VERSION < 3
35018 &__pyx_tp_as_number_Fastafile, /*tp_as_number*/
35019 &__pyx_tp_as_sequence_Fastafile, /*tp_as_sequence*/
35020 &__pyx_tp_as_mapping_Fastafile, /*tp_as_mapping*/
35026 &__pyx_tp_as_buffer_Fastafile, /*tp_as_buffer*/
35027 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
35028 __Pyx_DOCSTR("*(filename)*\n\n A *FASTA* file. The file is automatically opened.\n\n The file expects an indexed fasta file.\n\n TODO:\n add automatic indexing.\n add function to get sequence names.\n "), /*tp_doc*/
35031 0, /*tp_richcompare*/
35032 0, /*tp_weaklistoffset*/
35035 __pyx_methods_9csamtools_Fastafile, /*tp_methods*/
35037 __pyx_getsets_9csamtools_Fastafile, /*tp_getset*/
35040 0, /*tp_descr_get*/
35041 0, /*tp_descr_set*/
35042 0, /*tp_dictoffset*/
35045 __pyx_tp_new_9csamtools_Fastafile, /*tp_new*/
35051 0, /*tp_subclasses*/
35054 #if PY_VERSION_HEX >= 0x02060000
35055 0, /*tp_version_tag*/
35059 static PyObject *__pyx_tp_new_9csamtools_AlignedRead(PyTypeObject *t, PyObject *a, PyObject *k) {
35060 PyObject *o = (*t->tp_alloc)(t, 0);
35065 static void __pyx_tp_dealloc_9csamtools_AlignedRead(PyObject *o) {
35067 PyObject *etype, *eval, *etb;
35068 PyErr_Fetch(&etype, &eval, &etb);
35070 __pyx_pw_9csamtools_11AlignedRead_3__dealloc__(o);
35071 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
35073 PyErr_Restore(etype, eval, etb);
35075 (*Py_TYPE(o)->tp_free)(o);
35078 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qname(PyObject *o, void *x) {
35079 return __pyx_pw_9csamtools_11AlignedRead_5qname_1__get__(o);
35082 static int __pyx_setprop_9csamtools_11AlignedRead_qname(PyObject *o, PyObject *v, void *x) {
35084 return __pyx_pw_9csamtools_11AlignedRead_5qname_3__set__(o, v);
35087 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35092 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_cigar(PyObject *o, void *x) {
35093 return __pyx_pw_9csamtools_11AlignedRead_5cigar_1__get__(o);
35096 static int __pyx_setprop_9csamtools_11AlignedRead_cigar(PyObject *o, PyObject *v, void *x) {
35098 return __pyx_pw_9csamtools_11AlignedRead_5cigar_3__set__(o, v);
35101 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35106 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_cigarstring(PyObject *o, void *x) {
35107 return __pyx_pw_9csamtools_11AlignedRead_11cigarstring_1__get__(o);
35110 static int __pyx_setprop_9csamtools_11AlignedRead_cigarstring(PyObject *o, PyObject *v, void *x) {
35112 return __pyx_pw_9csamtools_11AlignedRead_11cigarstring_3__set__(o, v);
35115 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35120 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_seq(PyObject *o, void *x) {
35121 return __pyx_pw_9csamtools_11AlignedRead_3seq_1__get__(o);
35124 static int __pyx_setprop_9csamtools_11AlignedRead_seq(PyObject *o, PyObject *v, void *x) {
35126 return __pyx_pw_9csamtools_11AlignedRead_3seq_3__set__(o, v);
35129 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35134 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qual(PyObject *o, void *x) {
35135 return __pyx_pw_9csamtools_11AlignedRead_4qual_1__get__(o);
35138 static int __pyx_setprop_9csamtools_11AlignedRead_qual(PyObject *o, PyObject *v, void *x) {
35140 return __pyx_pw_9csamtools_11AlignedRead_4qual_3__set__(o, v);
35143 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35148 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_query(PyObject *o, void *x) {
35149 return __pyx_pw_9csamtools_11AlignedRead_5query_1__get__(o);
35152 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qqual(PyObject *o, void *x) {
35153 return __pyx_pw_9csamtools_11AlignedRead_5qqual_1__get__(o);
35156 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qstart(PyObject *o, void *x) {
35157 return __pyx_pw_9csamtools_11AlignedRead_6qstart_1__get__(o);
35160 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qend(PyObject *o, void *x) {
35161 return __pyx_pw_9csamtools_11AlignedRead_4qend_1__get__(o);
35164 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qlen(PyObject *o, void *x) {
35165 return __pyx_pw_9csamtools_11AlignedRead_4qlen_1__get__(o);
35168 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tags(PyObject *o, void *x) {
35169 return __pyx_pw_9csamtools_11AlignedRead_4tags_1__get__(o);
35172 static int __pyx_setprop_9csamtools_11AlignedRead_tags(PyObject *o, PyObject *v, void *x) {
35174 return __pyx_pw_9csamtools_11AlignedRead_4tags_3__set__(o, v);
35177 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35182 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_flag(PyObject *o, void *x) {
35183 return __pyx_pw_9csamtools_11AlignedRead_4flag_1__get__(o);
35186 static int __pyx_setprop_9csamtools_11AlignedRead_flag(PyObject *o, PyObject *v, void *x) {
35188 return __pyx_pw_9csamtools_11AlignedRead_4flag_3__set__(o, v);
35191 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35196 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rname(PyObject *o, void *x) {
35197 return __pyx_pw_9csamtools_11AlignedRead_5rname_1__get__(o);
35200 static int __pyx_setprop_9csamtools_11AlignedRead_rname(PyObject *o, PyObject *v, void *x) {
35202 return __pyx_pw_9csamtools_11AlignedRead_5rname_3__set__(o, v);
35205 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35210 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tid(PyObject *o, void *x) {
35211 return __pyx_pw_9csamtools_11AlignedRead_3tid_1__get__(o);
35214 static int __pyx_setprop_9csamtools_11AlignedRead_tid(PyObject *o, PyObject *v, void *x) {
35216 return __pyx_pw_9csamtools_11AlignedRead_3tid_3__set__(o, v);
35219 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35224 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_pos(PyObject *o, void *x) {
35225 return __pyx_pw_9csamtools_11AlignedRead_3pos_1__get__(o);
35228 static int __pyx_setprop_9csamtools_11AlignedRead_pos(PyObject *o, PyObject *v, void *x) {
35230 return __pyx_pw_9csamtools_11AlignedRead_3pos_3__set__(o, v);
35233 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35238 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_bin(PyObject *o, void *x) {
35239 return __pyx_pw_9csamtools_11AlignedRead_3bin_1__get__(o);
35242 static int __pyx_setprop_9csamtools_11AlignedRead_bin(PyObject *o, PyObject *v, void *x) {
35244 return __pyx_pw_9csamtools_11AlignedRead_3bin_3__set__(o, v);
35247 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35252 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rlen(PyObject *o, void *x) {
35253 return __pyx_pw_9csamtools_11AlignedRead_4rlen_1__get__(o);
35256 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_aend(PyObject *o, void *x) {
35257 return __pyx_pw_9csamtools_11AlignedRead_4aend_1__get__(o);
35260 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_alen(PyObject *o, void *x) {
35261 return __pyx_pw_9csamtools_11AlignedRead_4alen_1__get__(o);
35264 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mapq(PyObject *o, void *x) {
35265 return __pyx_pw_9csamtools_11AlignedRead_4mapq_1__get__(o);
35268 static int __pyx_setprop_9csamtools_11AlignedRead_mapq(PyObject *o, PyObject *v, void *x) {
35270 return __pyx_pw_9csamtools_11AlignedRead_4mapq_3__set__(o, v);
35273 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35278 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mrnm(PyObject *o, void *x) {
35279 return __pyx_pw_9csamtools_11AlignedRead_4mrnm_1__get__(o);
35282 static int __pyx_setprop_9csamtools_11AlignedRead_mrnm(PyObject *o, PyObject *v, void *x) {
35284 return __pyx_pw_9csamtools_11AlignedRead_4mrnm_3__set__(o, v);
35287 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35292 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rnext(PyObject *o, void *x) {
35293 return __pyx_pw_9csamtools_11AlignedRead_5rnext_1__get__(o);
35296 static int __pyx_setprop_9csamtools_11AlignedRead_rnext(PyObject *o, PyObject *v, void *x) {
35298 return __pyx_pw_9csamtools_11AlignedRead_5rnext_3__set__(o, v);
35301 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35306 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mpos(PyObject *o, void *x) {
35307 return __pyx_pw_9csamtools_11AlignedRead_4mpos_1__get__(o);
35310 static int __pyx_setprop_9csamtools_11AlignedRead_mpos(PyObject *o, PyObject *v, void *x) {
35312 return __pyx_pw_9csamtools_11AlignedRead_4mpos_3__set__(o, v);
35315 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35320 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_pnext(PyObject *o, void *x) {
35321 return __pyx_pw_9csamtools_11AlignedRead_5pnext_1__get__(o);
35324 static int __pyx_setprop_9csamtools_11AlignedRead_pnext(PyObject *o, PyObject *v, void *x) {
35326 return __pyx_pw_9csamtools_11AlignedRead_5pnext_3__set__(o, v);
35329 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35334 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_isize(PyObject *o, void *x) {
35335 return __pyx_pw_9csamtools_11AlignedRead_5isize_1__get__(o);
35338 static int __pyx_setprop_9csamtools_11AlignedRead_isize(PyObject *o, PyObject *v, void *x) {
35340 return __pyx_pw_9csamtools_11AlignedRead_5isize_3__set__(o, v);
35343 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35348 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tlen(PyObject *o, void *x) {
35349 return __pyx_pw_9csamtools_11AlignedRead_4tlen_1__get__(o);
35352 static int __pyx_setprop_9csamtools_11AlignedRead_tlen(PyObject *o, PyObject *v, void *x) {
35354 return __pyx_pw_9csamtools_11AlignedRead_4tlen_3__set__(o, v);
35357 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35362 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_paired(PyObject *o, void *x) {
35363 return __pyx_pw_9csamtools_11AlignedRead_9is_paired_1__get__(o);
35366 static int __pyx_setprop_9csamtools_11AlignedRead_is_paired(PyObject *o, PyObject *v, void *x) {
35368 return __pyx_pw_9csamtools_11AlignedRead_9is_paired_3__set__(o, v);
35371 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35376 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_proper_pair(PyObject *o, void *x) {
35377 return __pyx_pw_9csamtools_11AlignedRead_14is_proper_pair_1__get__(o);
35380 static int __pyx_setprop_9csamtools_11AlignedRead_is_proper_pair(PyObject *o, PyObject *v, void *x) {
35382 return __pyx_pw_9csamtools_11AlignedRead_14is_proper_pair_3__set__(o, v);
35385 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35390 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_unmapped(PyObject *o, void *x) {
35391 return __pyx_pw_9csamtools_11AlignedRead_11is_unmapped_1__get__(o);
35394 static int __pyx_setprop_9csamtools_11AlignedRead_is_unmapped(PyObject *o, PyObject *v, void *x) {
35396 return __pyx_pw_9csamtools_11AlignedRead_11is_unmapped_3__set__(o, v);
35399 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35404 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mate_is_unmapped(PyObject *o, void *x) {
35405 return __pyx_pw_9csamtools_11AlignedRead_16mate_is_unmapped_1__get__(o);
35408 static int __pyx_setprop_9csamtools_11AlignedRead_mate_is_unmapped(PyObject *o, PyObject *v, void *x) {
35410 return __pyx_pw_9csamtools_11AlignedRead_16mate_is_unmapped_3__set__(o, v);
35413 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35418 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_reverse(PyObject *o, void *x) {
35419 return __pyx_pw_9csamtools_11AlignedRead_10is_reverse_1__get__(o);
35422 static int __pyx_setprop_9csamtools_11AlignedRead_is_reverse(PyObject *o, PyObject *v, void *x) {
35424 return __pyx_pw_9csamtools_11AlignedRead_10is_reverse_3__set__(o, v);
35427 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35432 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mate_is_reverse(PyObject *o, void *x) {
35433 return __pyx_pw_9csamtools_11AlignedRead_15mate_is_reverse_1__get__(o);
35436 static int __pyx_setprop_9csamtools_11AlignedRead_mate_is_reverse(PyObject *o, PyObject *v, void *x) {
35438 return __pyx_pw_9csamtools_11AlignedRead_15mate_is_reverse_3__set__(o, v);
35441 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35446 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_read1(PyObject *o, void *x) {
35447 return __pyx_pw_9csamtools_11AlignedRead_8is_read1_1__get__(o);
35450 static int __pyx_setprop_9csamtools_11AlignedRead_is_read1(PyObject *o, PyObject *v, void *x) {
35452 return __pyx_pw_9csamtools_11AlignedRead_8is_read1_3__set__(o, v);
35455 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35460 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_read2(PyObject *o, void *x) {
35461 return __pyx_pw_9csamtools_11AlignedRead_8is_read2_1__get__(o);
35464 static int __pyx_setprop_9csamtools_11AlignedRead_is_read2(PyObject *o, PyObject *v, void *x) {
35466 return __pyx_pw_9csamtools_11AlignedRead_8is_read2_3__set__(o, v);
35469 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35474 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_secondary(PyObject *o, void *x) {
35475 return __pyx_pw_9csamtools_11AlignedRead_12is_secondary_1__get__(o);
35478 static int __pyx_setprop_9csamtools_11AlignedRead_is_secondary(PyObject *o, PyObject *v, void *x) {
35480 return __pyx_pw_9csamtools_11AlignedRead_12is_secondary_3__set__(o, v);
35483 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35488 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_qcfail(PyObject *o, void *x) {
35489 return __pyx_pw_9csamtools_11AlignedRead_9is_qcfail_1__get__(o);
35492 static int __pyx_setprop_9csamtools_11AlignedRead_is_qcfail(PyObject *o, PyObject *v, void *x) {
35494 return __pyx_pw_9csamtools_11AlignedRead_9is_qcfail_3__set__(o, v);
35497 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35502 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_duplicate(PyObject *o, void *x) {
35503 return __pyx_pw_9csamtools_11AlignedRead_12is_duplicate_1__get__(o);
35506 static int __pyx_setprop_9csamtools_11AlignedRead_is_duplicate(PyObject *o, PyObject *v, void *x) {
35508 return __pyx_pw_9csamtools_11AlignedRead_12is_duplicate_3__set__(o, v);
35511 PyErr_SetString(PyExc_NotImplementedError, "__del__");
35516 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_positions(PyObject *o, void *x) {
35517 return __pyx_pw_9csamtools_11AlignedRead_9positions_1__get__(o);
35520 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_aligned_pairs(PyObject *o, void *x) {
35521 return __pyx_pw_9csamtools_11AlignedRead_13aligned_pairs_1__get__(o);
35524 static PyMethodDef __pyx_methods_9csamtools_AlignedRead[] = {
35525 {__Pyx_NAMESTR("compare"), (PyCFunction)__pyx_pw_9csamtools_11AlignedRead_7compare, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_6compare)},
35526 {__Pyx_NAMESTR("overlap"), (PyCFunction)__pyx_pw_9csamtools_11AlignedRead_11overlap, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_10overlap)},
35527 {__Pyx_NAMESTR("opt"), (PyCFunction)__pyx_pw_9csamtools_11AlignedRead_13opt, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_12opt)},
35528 {__Pyx_NAMESTR("fancy_str"), (PyCFunction)__pyx_pw_9csamtools_11AlignedRead_15fancy_str, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_14fancy_str)},
35532 static struct PyGetSetDef __pyx_getsets_9csamtools_AlignedRead[] = {
35533 {(char *)"qname", __pyx_getprop_9csamtools_11AlignedRead_qname, __pyx_setprop_9csamtools_11AlignedRead_qname, __Pyx_DOCSTR(__pyx_k_188), 0},
35534 {(char *)"cigar", __pyx_getprop_9csamtools_11AlignedRead_cigar, __pyx_setprop_9csamtools_11AlignedRead_cigar, __Pyx_DOCSTR(__pyx_k_189), 0},
35535 {(char *)"cigarstring", __pyx_getprop_9csamtools_11AlignedRead_cigarstring, __pyx_setprop_9csamtools_11AlignedRead_cigarstring, __Pyx_DOCSTR(__pyx_k_190), 0},
35536 {(char *)"seq", __pyx_getprop_9csamtools_11AlignedRead_seq, __pyx_setprop_9csamtools_11AlignedRead_seq, __Pyx_DOCSTR(__pyx_k_191), 0},
35537 {(char *)"qual", __pyx_getprop_9csamtools_11AlignedRead_qual, __pyx_setprop_9csamtools_11AlignedRead_qual, __Pyx_DOCSTR(__pyx_k_192), 0},
35538 {(char *)"query", __pyx_getprop_9csamtools_11AlignedRead_query, 0, __Pyx_DOCSTR(__pyx_k_193), 0},
35539 {(char *)"qqual", __pyx_getprop_9csamtools_11AlignedRead_qqual, 0, __Pyx_DOCSTR(__pyx_k_194), 0},
35540 {(char *)"qstart", __pyx_getprop_9csamtools_11AlignedRead_qstart, 0, __Pyx_DOCSTR(__pyx_k_195), 0},
35541 {(char *)"qend", __pyx_getprop_9csamtools_11AlignedRead_qend, 0, __Pyx_DOCSTR(__pyx_k_196), 0},
35542 {(char *)"qlen", __pyx_getprop_9csamtools_11AlignedRead_qlen, 0, __Pyx_DOCSTR(__pyx_k_197), 0},
35543 {(char *)"tags", __pyx_getprop_9csamtools_11AlignedRead_tags, __pyx_setprop_9csamtools_11AlignedRead_tags, __Pyx_DOCSTR(__pyx_k_198), 0},
35544 {(char *)"flag", __pyx_getprop_9csamtools_11AlignedRead_flag, __pyx_setprop_9csamtools_11AlignedRead_flag, __Pyx_DOCSTR(__pyx_k_199), 0},
35545 {(char *)"rname", __pyx_getprop_9csamtools_11AlignedRead_rname, __pyx_setprop_9csamtools_11AlignedRead_rname, __Pyx_DOCSTR(__pyx_k_200), 0},
35546 {(char *)"tid", __pyx_getprop_9csamtools_11AlignedRead_tid, __pyx_setprop_9csamtools_11AlignedRead_tid, __Pyx_DOCSTR(__pyx_k_201), 0},
35547 {(char *)"pos", __pyx_getprop_9csamtools_11AlignedRead_pos, __pyx_setprop_9csamtools_11AlignedRead_pos, __Pyx_DOCSTR(__pyx_k_202), 0},
35548 {(char *)"bin", __pyx_getprop_9csamtools_11AlignedRead_bin, __pyx_setprop_9csamtools_11AlignedRead_bin, __Pyx_DOCSTR(__pyx_k_203), 0},
35549 {(char *)"rlen", __pyx_getprop_9csamtools_11AlignedRead_rlen, 0, __Pyx_DOCSTR(__pyx_k_204), 0},
35550 {(char *)"aend", __pyx_getprop_9csamtools_11AlignedRead_aend, 0, __Pyx_DOCSTR(__pyx_k_205), 0},
35551 {(char *)"alen", __pyx_getprop_9csamtools_11AlignedRead_alen, 0, __Pyx_DOCSTR(__pyx_k_206), 0},
35552 {(char *)"mapq", __pyx_getprop_9csamtools_11AlignedRead_mapq, __pyx_setprop_9csamtools_11AlignedRead_mapq, __Pyx_DOCSTR(__pyx_k_207), 0},
35553 {(char *)"mrnm", __pyx_getprop_9csamtools_11AlignedRead_mrnm, __pyx_setprop_9csamtools_11AlignedRead_mrnm, __Pyx_DOCSTR(__pyx_k_208), 0},
35554 {(char *)"rnext", __pyx_getprop_9csamtools_11AlignedRead_rnext, __pyx_setprop_9csamtools_11AlignedRead_rnext, __Pyx_DOCSTR(__pyx_k_209), 0},
35555 {(char *)"mpos", __pyx_getprop_9csamtools_11AlignedRead_mpos, __pyx_setprop_9csamtools_11AlignedRead_mpos, __Pyx_DOCSTR(__pyx_k_210), 0},
35556 {(char *)"pnext", __pyx_getprop_9csamtools_11AlignedRead_pnext, __pyx_setprop_9csamtools_11AlignedRead_pnext, __Pyx_DOCSTR(__pyx_k_211), 0},
35557 {(char *)"isize", __pyx_getprop_9csamtools_11AlignedRead_isize, __pyx_setprop_9csamtools_11AlignedRead_isize, __Pyx_DOCSTR(__pyx_k_212), 0},
35558 {(char *)"tlen", __pyx_getprop_9csamtools_11AlignedRead_tlen, __pyx_setprop_9csamtools_11AlignedRead_tlen, __Pyx_DOCSTR(__pyx_k_213), 0},
35559 {(char *)"is_paired", __pyx_getprop_9csamtools_11AlignedRead_is_paired, __pyx_setprop_9csamtools_11AlignedRead_is_paired, __Pyx_DOCSTR(__pyx_k_214), 0},
35560 {(char *)"is_proper_pair", __pyx_getprop_9csamtools_11AlignedRead_is_proper_pair, __pyx_setprop_9csamtools_11AlignedRead_is_proper_pair, __Pyx_DOCSTR(__pyx_k_215), 0},
35561 {(char *)"is_unmapped", __pyx_getprop_9csamtools_11AlignedRead_is_unmapped, __pyx_setprop_9csamtools_11AlignedRead_is_unmapped, __Pyx_DOCSTR(__pyx_k_216), 0},
35562 {(char *)"mate_is_unmapped", __pyx_getprop_9csamtools_11AlignedRead_mate_is_unmapped, __pyx_setprop_9csamtools_11AlignedRead_mate_is_unmapped, __Pyx_DOCSTR(__pyx_k_217), 0},
35563 {(char *)"is_reverse", __pyx_getprop_9csamtools_11AlignedRead_is_reverse, __pyx_setprop_9csamtools_11AlignedRead_is_reverse, __Pyx_DOCSTR(__pyx_k_218), 0},
35564 {(char *)"mate_is_reverse", __pyx_getprop_9csamtools_11AlignedRead_mate_is_reverse, __pyx_setprop_9csamtools_11AlignedRead_mate_is_reverse, __Pyx_DOCSTR(__pyx_k_219), 0},
35565 {(char *)"is_read1", __pyx_getprop_9csamtools_11AlignedRead_is_read1, __pyx_setprop_9csamtools_11AlignedRead_is_read1, __Pyx_DOCSTR(__pyx_k_220), 0},
35566 {(char *)"is_read2", __pyx_getprop_9csamtools_11AlignedRead_is_read2, __pyx_setprop_9csamtools_11AlignedRead_is_read2, __Pyx_DOCSTR(__pyx_k_221), 0},
35567 {(char *)"is_secondary", __pyx_getprop_9csamtools_11AlignedRead_is_secondary, __pyx_setprop_9csamtools_11AlignedRead_is_secondary, __Pyx_DOCSTR(__pyx_k_222), 0},
35568 {(char *)"is_qcfail", __pyx_getprop_9csamtools_11AlignedRead_is_qcfail, __pyx_setprop_9csamtools_11AlignedRead_is_qcfail, __Pyx_DOCSTR(__pyx_k_223), 0},
35569 {(char *)"is_duplicate", __pyx_getprop_9csamtools_11AlignedRead_is_duplicate, __pyx_setprop_9csamtools_11AlignedRead_is_duplicate, __Pyx_DOCSTR(__pyx_k_224), 0},
35570 {(char *)"positions", __pyx_getprop_9csamtools_11AlignedRead_positions, 0, __Pyx_DOCSTR(__pyx_k_225), 0},
35571 {(char *)"aligned_pairs", __pyx_getprop_9csamtools_11AlignedRead_aligned_pairs, 0, __Pyx_DOCSTR(__pyx_k_226), 0},
35575 static PyNumberMethods __pyx_tp_as_number_AlignedRead = {
35579 #if PY_MAJOR_VERSION < 3
35582 0, /*nb_remainder*/
35595 #if PY_MAJOR_VERSION < 3
35599 #if PY_MAJOR_VERSION < 3
35605 #if PY_MAJOR_VERSION < 3
35608 #if PY_MAJOR_VERSION < 3
35611 0, /*nb_inplace_add*/
35612 0, /*nb_inplace_subtract*/
35613 0, /*nb_inplace_multiply*/
35614 #if PY_MAJOR_VERSION < 3
35615 0, /*nb_inplace_divide*/
35617 0, /*nb_inplace_remainder*/
35618 0, /*nb_inplace_power*/
35619 0, /*nb_inplace_lshift*/
35620 0, /*nb_inplace_rshift*/
35621 0, /*nb_inplace_and*/
35622 0, /*nb_inplace_xor*/
35623 0, /*nb_inplace_or*/
35624 0, /*nb_floor_divide*/
35625 0, /*nb_true_divide*/
35626 0, /*nb_inplace_floor_divide*/
35627 0, /*nb_inplace_true_divide*/
35628 #if PY_VERSION_HEX >= 0x02050000
35633 static PySequenceMethods __pyx_tp_as_sequence_AlignedRead = {
35640 0, /*sq_ass_slice*/
35642 0, /*sq_inplace_concat*/
35643 0, /*sq_inplace_repeat*/
35646 static PyMappingMethods __pyx_tp_as_mapping_AlignedRead = {
35648 0, /*mp_subscript*/
35649 0, /*mp_ass_subscript*/
35652 static PyBufferProcs __pyx_tp_as_buffer_AlignedRead = {
35653 #if PY_MAJOR_VERSION < 3
35654 0, /*bf_getreadbuffer*/
35656 #if PY_MAJOR_VERSION < 3
35657 0, /*bf_getwritebuffer*/
35659 #if PY_MAJOR_VERSION < 3
35660 0, /*bf_getsegcount*/
35662 #if PY_MAJOR_VERSION < 3
35663 0, /*bf_getcharbuffer*/
35665 #if PY_VERSION_HEX >= 0x02060000
35666 0, /*bf_getbuffer*/
35668 #if PY_VERSION_HEX >= 0x02060000
35669 0, /*bf_releasebuffer*/
35673 static PyTypeObject __pyx_type_9csamtools_AlignedRead = {
35674 PyVarObject_HEAD_INIT(0, 0)
35675 __Pyx_NAMESTR("csamtools.AlignedRead"), /*tp_name*/
35676 sizeof(struct __pyx_obj_9csamtools_AlignedRead), /*tp_basicsize*/
35678 __pyx_tp_dealloc_9csamtools_AlignedRead, /*tp_dealloc*/
35682 #if PY_MAJOR_VERSION < 3
35688 &__pyx_tp_as_number_AlignedRead, /*tp_as_number*/
35689 &__pyx_tp_as_sequence_AlignedRead, /*tp_as_sequence*/
35690 &__pyx_tp_as_mapping_AlignedRead, /*tp_as_mapping*/
35691 __pyx_pw_9csamtools_11AlignedRead_9__hash__, /*tp_hash*/
35693 __pyx_pw_9csamtools_11AlignedRead_5__str__, /*tp_str*/
35696 &__pyx_tp_as_buffer_AlignedRead, /*tp_as_buffer*/
35697 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
35698 __Pyx_DOCSTR("AlignedRead()\n\n Class representing an aligned read. see SAM format specification for\n the meaning of 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\n In Python 3, the fields containing sequence and quality\n (seq, query, qual and qqual) data are of type bytes. Other\n string data, such as the qname field and strings in the\n tags tuple, is represented as unicode strings. On assignment,\n both bytes and unicode objects are allowed, but unicode strings\n must contain only ASCII characters.\n "), /*tp_doc*/
35701 0, /*tp_richcompare*/
35702 0, /*tp_weaklistoffset*/
35705 __pyx_methods_9csamtools_AlignedRead, /*tp_methods*/
35707 __pyx_getsets_9csamtools_AlignedRead, /*tp_getset*/
35710 0, /*tp_descr_get*/
35711 0, /*tp_descr_set*/
35712 0, /*tp_dictoffset*/
35713 __pyx_pw_9csamtools_11AlignedRead_1__init__, /*tp_init*/
35715 __pyx_tp_new_9csamtools_AlignedRead, /*tp_new*/
35721 0, /*tp_subclasses*/
35724 #if PY_VERSION_HEX >= 0x02060000
35725 0, /*tp_version_tag*/
35728 static struct __pyx_vtabstruct_9csamtools_Samfile __pyx_vtable_9csamtools_Samfile;
35730 static PyObject *__pyx_tp_new_9csamtools_Samfile(PyTypeObject *t, PyObject *a, PyObject *k) {
35731 struct __pyx_obj_9csamtools_Samfile *p;
35732 PyObject *o = (*t->tp_alloc)(t, 0);
35734 p = ((struct __pyx_obj_9csamtools_Samfile *)o);
35735 p->__pyx_vtab = __pyx_vtabptr_9csamtools_Samfile;
35736 if (__pyx_pw_9csamtools_7Samfile_1__cinit__(o, a, k) < 0) {
35737 Py_DECREF(o); o = 0;
35742 static void __pyx_tp_dealloc_9csamtools_Samfile(PyObject *o) {
35744 PyObject *etype, *eval, *etb;
35745 PyErr_Fetch(&etype, &eval, &etb);
35747 __pyx_pw_9csamtools_7Samfile_31__dealloc__(o);
35748 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
35750 PyErr_Restore(etype, eval, etb);
35752 (*Py_TYPE(o)->tp_free)(o);
35755 static PyObject *__pyx_getprop_9csamtools_7Samfile_filename(PyObject *o, void *x) {
35756 return __pyx_pw_9csamtools_7Samfile_8filename_1__get__(o);
35759 static PyObject *__pyx_getprop_9csamtools_7Samfile_nreferences(PyObject *o, void *x) {
35760 return __pyx_pw_9csamtools_7Samfile_11nreferences_1__get__(o);
35763 static PyObject *__pyx_getprop_9csamtools_7Samfile_references(PyObject *o, void *x) {
35764 return __pyx_pw_9csamtools_7Samfile_10references_1__get__(o);
35767 static PyObject *__pyx_getprop_9csamtools_7Samfile_lengths(PyObject *o, void *x) {
35768 return __pyx_pw_9csamtools_7Samfile_7lengths_1__get__(o);
35771 static PyObject *__pyx_getprop_9csamtools_7Samfile_mapped(PyObject *o, void *x) {
35772 return __pyx_pw_9csamtools_7Samfile_6mapped_1__get__(o);
35775 static PyObject *__pyx_getprop_9csamtools_7Samfile_unmapped(PyObject *o, void *x) {
35776 return __pyx_pw_9csamtools_7Samfile_8unmapped_1__get__(o);
35779 static PyObject *__pyx_getprop_9csamtools_7Samfile_text(PyObject *o, void *x) {
35780 return __pyx_pw_9csamtools_7Samfile_4text_1__get__(o);
35783 static PyObject *__pyx_getprop_9csamtools_7Samfile_header(PyObject *o, void *x) {
35784 return __pyx_pw_9csamtools_7Samfile_6header_1__get__(o);
35787 static PyMethodDef __pyx_methods_9csamtools_Samfile[] = {
35788 {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_3_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_2_isOpen)},
35789 {__Pyx_NAMESTR("_hasIndex"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_5_hasIndex, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_4_hasIndex)},
35790 {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_7_open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_6_open)},
35791 {__Pyx_NAMESTR("gettid"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_9gettid, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_8gettid)},
35792 {__Pyx_NAMESTR("getrname"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_11getrname, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_10getrname)},
35793 {__Pyx_NAMESTR("_parseRegion"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_13_parseRegion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_12_parseRegion)},
35794 {__Pyx_NAMESTR("reset"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_15reset, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_14reset)},
35795 {__Pyx_NAMESTR("seek"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_17seek, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_16seek)},
35796 {__Pyx_NAMESTR("tell"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_19tell, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_18tell)},
35797 {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_21fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_20fetch)},
35798 {__Pyx_NAMESTR("mate"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_23mate, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_22mate)},
35799 {__Pyx_NAMESTR("count"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_25count, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_24count)},
35800 {__Pyx_NAMESTR("pileup"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_27pileup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_26pileup)},
35801 {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_29close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_28close)},
35802 {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_33write, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_32write)},
35803 {__Pyx_NAMESTR("__enter__"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_35__enter__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_34__enter__)},
35804 {__Pyx_NAMESTR("__exit__"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_37__exit__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_36__exit__)},
35805 {__Pyx_NAMESTR("_buildLine"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_39_buildLine, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_38_buildLine)},
35806 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_9csamtools_7Samfile_43__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_42__next__)},
35810 static struct PyGetSetDef __pyx_getsets_9csamtools_Samfile[] = {
35811 {(char *)"filename", __pyx_getprop_9csamtools_7Samfile_filename, 0, __Pyx_DOCSTR(__pyx_k_187), 0},
35812 {(char *)"nreferences", __pyx_getprop_9csamtools_7Samfile_nreferences, 0, __Pyx_DOCSTR(__pyx_k_227), 0},
35813 {(char *)"references", __pyx_getprop_9csamtools_7Samfile_references, 0, __Pyx_DOCSTR(__pyx_k_228), 0},
35814 {(char *)"lengths", __pyx_getprop_9csamtools_7Samfile_lengths, 0, __Pyx_DOCSTR(__pyx_k_229), 0},
35815 {(char *)"mapped", __pyx_getprop_9csamtools_7Samfile_mapped, 0, __Pyx_DOCSTR(__pyx_k_230), 0},
35816 {(char *)"unmapped", __pyx_getprop_9csamtools_7Samfile_unmapped, 0, __Pyx_DOCSTR(__pyx_k_231), 0},
35817 {(char *)"text", __pyx_getprop_9csamtools_7Samfile_text, 0, __Pyx_DOCSTR(__pyx_k_232), 0},
35818 {(char *)"header", __pyx_getprop_9csamtools_7Samfile_header, 0, __Pyx_DOCSTR(__pyx_k_233), 0},
35822 static PyNumberMethods __pyx_tp_as_number_Samfile = {
35826 #if PY_MAJOR_VERSION < 3
35829 0, /*nb_remainder*/
35842 #if PY_MAJOR_VERSION < 3
35846 #if PY_MAJOR_VERSION < 3
35852 #if PY_MAJOR_VERSION < 3
35855 #if PY_MAJOR_VERSION < 3
35858 0, /*nb_inplace_add*/
35859 0, /*nb_inplace_subtract*/
35860 0, /*nb_inplace_multiply*/
35861 #if PY_MAJOR_VERSION < 3
35862 0, /*nb_inplace_divide*/
35864 0, /*nb_inplace_remainder*/
35865 0, /*nb_inplace_power*/
35866 0, /*nb_inplace_lshift*/
35867 0, /*nb_inplace_rshift*/
35868 0, /*nb_inplace_and*/
35869 0, /*nb_inplace_xor*/
35870 0, /*nb_inplace_or*/
35871 0, /*nb_floor_divide*/
35872 0, /*nb_true_divide*/
35873 0, /*nb_inplace_floor_divide*/
35874 0, /*nb_inplace_true_divide*/
35875 #if PY_VERSION_HEX >= 0x02050000
35880 static PySequenceMethods __pyx_tp_as_sequence_Samfile = {
35887 0, /*sq_ass_slice*/
35889 0, /*sq_inplace_concat*/
35890 0, /*sq_inplace_repeat*/
35893 static PyMappingMethods __pyx_tp_as_mapping_Samfile = {
35895 0, /*mp_subscript*/
35896 0, /*mp_ass_subscript*/
35899 static PyBufferProcs __pyx_tp_as_buffer_Samfile = {
35900 #if PY_MAJOR_VERSION < 3
35901 0, /*bf_getreadbuffer*/
35903 #if PY_MAJOR_VERSION < 3
35904 0, /*bf_getwritebuffer*/
35906 #if PY_MAJOR_VERSION < 3
35907 0, /*bf_getsegcount*/
35909 #if PY_MAJOR_VERSION < 3
35910 0, /*bf_getcharbuffer*/
35912 #if PY_VERSION_HEX >= 0x02060000
35913 0, /*bf_getbuffer*/
35915 #if PY_VERSION_HEX >= 0x02060000
35916 0, /*bf_releasebuffer*/
35920 static PyTypeObject __pyx_type_9csamtools_Samfile = {
35921 PyVarObject_HEAD_INIT(0, 0)
35922 __Pyx_NAMESTR("csamtools.Samfile"), /*tp_name*/
35923 sizeof(struct __pyx_obj_9csamtools_Samfile), /*tp_basicsize*/
35925 __pyx_tp_dealloc_9csamtools_Samfile, /*tp_dealloc*/
35929 #if PY_MAJOR_VERSION < 3
35935 &__pyx_tp_as_number_Samfile, /*tp_as_number*/
35936 &__pyx_tp_as_sequence_Samfile, /*tp_as_sequence*/
35937 &__pyx_tp_as_mapping_Samfile, /*tp_as_mapping*/
35943 &__pyx_tp_as_buffer_Samfile, /*tp_as_buffer*/
35944 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
35945 __Pyx_DOCSTR("*(filename, mode=None, template = None, referencenames = None, referencelengths = None, text = NULL, header = None,\n add_sq_text = False, check_header = True, check_sq = True )*\n\n A :term:`SAM`/:term:`BAM` formatted file. The file is automatically opened.\n\n *mode* should be ``r`` for reading or ``w`` for writing. The default is text mode (:term:`SAM`). 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 Valid modes are ``r``, ``w``, ``wh``, ``rb``, ``wb`` and ``wbu``. For instance, to open\n a :term:`BAM` formatted file for reading, type::\n\n f = pysam.Samfile('ex1.bam','rb')\n\n If mode is not specified, we will try to auto-detect in the order 'rb', 'r', thus both the following\n should work::\n\n f1 = pysam.Samfile('ex1.bam' )\n f2 = pysam.Samfile('ex1.sam' )\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\n For writing, the header of a :term:`SAM` file/:term:`BAM` file can be constituted from several\n sources (see also the samtools format specification):\n\n 1. If *template* is given, the header is copied from a another *Samfile*\n (*template* must be of type *Samfile*).\n\n 2. If *header* is given, the header is built from a multi-level dictionary. The first level\n are the four types ('HD', 'SQ', ...). The second level are a list of lines, with each line\n being a list of tag-value pairs. The header is constructed first from all the defined fields,\n followed by user tags in alphabetical order.\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 By default, 'SQ' and 'LN' tags will be added to the header text. This option can be\n changed by unsetting the flag *add_sq_text*. \n\n By default, if file a file is opened in mode 'r', it is checked for a valid header\n (*check_header* = True) and a definition of chromosome names (*check_sq* = True). \n \n "), /*tp_doc*/
35948 0, /*tp_richcompare*/
35949 0, /*tp_weaklistoffset*/
35950 __pyx_pw_9csamtools_7Samfile_41__iter__, /*tp_iter*/
35951 __pyx_pw_9csamtools_7Samfile_43__next__, /*tp_iternext*/
35952 __pyx_methods_9csamtools_Samfile, /*tp_methods*/
35954 __pyx_getsets_9csamtools_Samfile, /*tp_getset*/
35957 0, /*tp_descr_get*/
35958 0, /*tp_descr_set*/
35959 0, /*tp_dictoffset*/
35962 __pyx_tp_new_9csamtools_Samfile, /*tp_new*/
35968 0, /*tp_subclasses*/
35971 #if PY_VERSION_HEX >= 0x02060000
35972 0, /*tp_version_tag*/
35976 static PyObject *__pyx_tp_new_9csamtools_PileupProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
35977 PyObject *o = (*t->tp_alloc)(t, 0);
35982 static void __pyx_tp_dealloc_9csamtools_PileupProxy(PyObject *o) {
35983 (*Py_TYPE(o)->tp_free)(o);
35986 static PyObject *__pyx_getprop_9csamtools_11PileupProxy_tid(PyObject *o, void *x) {
35987 return __pyx_pw_9csamtools_11PileupProxy_3tid_1__get__(o);
35990 static PyObject *__pyx_getprop_9csamtools_11PileupProxy_n(PyObject *o, void *x) {
35991 return __pyx_pw_9csamtools_11PileupProxy_1n_1__get__(o);
35994 static int __pyx_setprop_9csamtools_11PileupProxy_n(PyObject *o, PyObject *v, void *x) {
35996 return __pyx_pw_9csamtools_11PileupProxy_1n_3__set__(o, v);
35999 PyErr_SetString(PyExc_NotImplementedError, "__del__");
36004 static PyObject *__pyx_getprop_9csamtools_11PileupProxy_pos(PyObject *o, void *x) {
36005 return __pyx_pw_9csamtools_11PileupProxy_3pos_1__get__(o);
36008 static PyObject *__pyx_getprop_9csamtools_11PileupProxy_pileups(PyObject *o, void *x) {
36009 return __pyx_pw_9csamtools_11PileupProxy_7pileups_1__get__(o);
36012 static PyMethodDef __pyx_methods_9csamtools_PileupProxy[] = {
36016 static struct PyGetSetDef __pyx_getsets_9csamtools_PileupProxy[] = {
36017 {(char *)"tid", __pyx_getprop_9csamtools_11PileupProxy_tid, 0, __Pyx_DOCSTR(__pyx_k_234), 0},
36018 {(char *)"n", __pyx_getprop_9csamtools_11PileupProxy_n, __pyx_setprop_9csamtools_11PileupProxy_n, __Pyx_DOCSTR(__pyx_k_235), 0},
36019 {(char *)"pos", __pyx_getprop_9csamtools_11PileupProxy_pos, 0, 0, 0},
36020 {(char *)"pileups", __pyx_getprop_9csamtools_11PileupProxy_pileups, 0, __Pyx_DOCSTR(__pyx_k_236), 0},
36024 static PyNumberMethods __pyx_tp_as_number_PileupProxy = {
36028 #if PY_MAJOR_VERSION < 3
36031 0, /*nb_remainder*/
36044 #if PY_MAJOR_VERSION < 3
36048 #if PY_MAJOR_VERSION < 3
36054 #if PY_MAJOR_VERSION < 3
36057 #if PY_MAJOR_VERSION < 3
36060 0, /*nb_inplace_add*/
36061 0, /*nb_inplace_subtract*/
36062 0, /*nb_inplace_multiply*/
36063 #if PY_MAJOR_VERSION < 3
36064 0, /*nb_inplace_divide*/
36066 0, /*nb_inplace_remainder*/
36067 0, /*nb_inplace_power*/
36068 0, /*nb_inplace_lshift*/
36069 0, /*nb_inplace_rshift*/
36070 0, /*nb_inplace_and*/
36071 0, /*nb_inplace_xor*/
36072 0, /*nb_inplace_or*/
36073 0, /*nb_floor_divide*/
36074 0, /*nb_true_divide*/
36075 0, /*nb_inplace_floor_divide*/
36076 0, /*nb_inplace_true_divide*/
36077 #if PY_VERSION_HEX >= 0x02050000
36082 static PySequenceMethods __pyx_tp_as_sequence_PileupProxy = {
36089 0, /*sq_ass_slice*/
36091 0, /*sq_inplace_concat*/
36092 0, /*sq_inplace_repeat*/
36095 static PyMappingMethods __pyx_tp_as_mapping_PileupProxy = {
36097 0, /*mp_subscript*/
36098 0, /*mp_ass_subscript*/
36101 static PyBufferProcs __pyx_tp_as_buffer_PileupProxy = {
36102 #if PY_MAJOR_VERSION < 3
36103 0, /*bf_getreadbuffer*/
36105 #if PY_MAJOR_VERSION < 3
36106 0, /*bf_getwritebuffer*/
36108 #if PY_MAJOR_VERSION < 3
36109 0, /*bf_getsegcount*/
36111 #if PY_MAJOR_VERSION < 3
36112 0, /*bf_getcharbuffer*/
36114 #if PY_VERSION_HEX >= 0x02060000
36115 0, /*bf_getbuffer*/
36117 #if PY_VERSION_HEX >= 0x02060000
36118 0, /*bf_releasebuffer*/
36122 static PyTypeObject __pyx_type_9csamtools_PileupProxy = {
36123 PyVarObject_HEAD_INIT(0, 0)
36124 __Pyx_NAMESTR("csamtools.PileupProxy"), /*tp_name*/
36125 sizeof(struct __pyx_obj_9csamtools_PileupProxy), /*tp_basicsize*/
36127 __pyx_tp_dealloc_9csamtools_PileupProxy, /*tp_dealloc*/
36131 #if PY_MAJOR_VERSION < 3
36137 &__pyx_tp_as_number_PileupProxy, /*tp_as_number*/
36138 &__pyx_tp_as_sequence_PileupProxy, /*tp_as_sequence*/
36139 &__pyx_tp_as_mapping_PileupProxy, /*tp_as_mapping*/
36142 __pyx_pw_9csamtools_11PileupProxy_3__str__, /*tp_str*/
36145 &__pyx_tp_as_buffer_PileupProxy, /*tp_as_buffer*/
36146 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
36147 __Pyx_DOCSTR("PileupProxy()\nA pileup column. A pileup column contains\n all the reads that map to a certain target base.\n\n tid\n chromosome ID as is defined in the header\n pos\n the target base coordinate (0-based)\n n\n number of reads mapping to this column\n pileups\n list of reads (:class:`pysam.PileupRead`) aligned to this column\n\n This class is a proxy for results returned by the samtools pileup engine.\n If the underlying engine iterator advances, the results of this column\n will change.\n "), /*tp_doc*/
36150 0, /*tp_richcompare*/
36151 0, /*tp_weaklistoffset*/
36154 __pyx_methods_9csamtools_PileupProxy, /*tp_methods*/
36156 __pyx_getsets_9csamtools_PileupProxy, /*tp_getset*/
36159 0, /*tp_descr_get*/
36160 0, /*tp_descr_set*/
36161 0, /*tp_dictoffset*/
36162 __pyx_pw_9csamtools_11PileupProxy_1__init__, /*tp_init*/
36164 __pyx_tp_new_9csamtools_PileupProxy, /*tp_new*/
36170 0, /*tp_subclasses*/
36173 #if PY_VERSION_HEX >= 0x02060000
36174 0, /*tp_version_tag*/
36178 static PyObject *__pyx_tp_new_9csamtools_PileupRead(PyTypeObject *t, PyObject *a, PyObject *k) {
36179 struct __pyx_obj_9csamtools_PileupRead *p;
36180 PyObject *o = (*t->tp_alloc)(t, 0);
36182 p = ((struct __pyx_obj_9csamtools_PileupRead *)o);
36183 p->_alignment = ((struct __pyx_obj_9csamtools_AlignedRead *)Py_None); Py_INCREF(Py_None);
36187 static void __pyx_tp_dealloc_9csamtools_PileupRead(PyObject *o) {
36188 struct __pyx_obj_9csamtools_PileupRead *p = (struct __pyx_obj_9csamtools_PileupRead *)o;
36189 Py_XDECREF(((PyObject *)p->_alignment));
36190 (*Py_TYPE(o)->tp_free)(o);
36193 static int __pyx_tp_traverse_9csamtools_PileupRead(PyObject *o, visitproc v, void *a) {
36195 struct __pyx_obj_9csamtools_PileupRead *p = (struct __pyx_obj_9csamtools_PileupRead *)o;
36196 if (p->_alignment) {
36197 e = (*v)(((PyObject*)p->_alignment), a); if (e) return e;
36202 static int __pyx_tp_clear_9csamtools_PileupRead(PyObject *o) {
36203 struct __pyx_obj_9csamtools_PileupRead *p = (struct __pyx_obj_9csamtools_PileupRead *)o;
36205 tmp = ((PyObject*)p->_alignment);
36206 p->_alignment = ((struct __pyx_obj_9csamtools_AlignedRead *)Py_None); Py_INCREF(Py_None);
36211 static PyObject *__pyx_getprop_9csamtools_10PileupRead_alignment(PyObject *o, void *x) {
36212 return __pyx_pw_9csamtools_10PileupRead_9alignment_1__get__(o);
36215 static PyObject *__pyx_getprop_9csamtools_10PileupRead_qpos(PyObject *o, void *x) {
36216 return __pyx_pw_9csamtools_10PileupRead_4qpos_1__get__(o);
36219 static PyObject *__pyx_getprop_9csamtools_10PileupRead_indel(PyObject *o, void *x) {
36220 return __pyx_pw_9csamtools_10PileupRead_5indel_1__get__(o);
36223 static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_del(PyObject *o, void *x) {
36224 return __pyx_pw_9csamtools_10PileupRead_6is_del_1__get__(o);
36227 static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_head(PyObject *o, void *x) {
36228 return __pyx_pw_9csamtools_10PileupRead_7is_head_1__get__(o);
36231 static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_tail(PyObject *o, void *x) {
36232 return __pyx_pw_9csamtools_10PileupRead_7is_tail_1__get__(o);
36235 static PyObject *__pyx_getprop_9csamtools_10PileupRead_level(PyObject *o, void *x) {
36236 return __pyx_pw_9csamtools_10PileupRead_5level_1__get__(o);
36239 static PyMethodDef __pyx_methods_9csamtools_PileupRead[] = {
36243 static struct PyGetSetDef __pyx_getsets_9csamtools_PileupRead[] = {
36244 {(char *)"alignment", __pyx_getprop_9csamtools_10PileupRead_alignment, 0, __Pyx_DOCSTR(__pyx_k_237), 0},
36245 {(char *)"qpos", __pyx_getprop_9csamtools_10PileupRead_qpos, 0, __Pyx_DOCSTR(__pyx_k_238), 0},
36246 {(char *)"indel", __pyx_getprop_9csamtools_10PileupRead_indel, 0, __Pyx_DOCSTR(__pyx_k_239), 0},
36247 {(char *)"is_del", __pyx_getprop_9csamtools_10PileupRead_is_del, 0, __Pyx_DOCSTR(__pyx_k_240), 0},
36248 {(char *)"is_head", __pyx_getprop_9csamtools_10PileupRead_is_head, 0, 0, 0},
36249 {(char *)"is_tail", __pyx_getprop_9csamtools_10PileupRead_is_tail, 0, 0, 0},
36250 {(char *)"level", __pyx_getprop_9csamtools_10PileupRead_level, 0, 0, 0},
36254 static PyNumberMethods __pyx_tp_as_number_PileupRead = {
36258 #if PY_MAJOR_VERSION < 3
36261 0, /*nb_remainder*/
36274 #if PY_MAJOR_VERSION < 3
36278 #if PY_MAJOR_VERSION < 3
36284 #if PY_MAJOR_VERSION < 3
36287 #if PY_MAJOR_VERSION < 3
36290 0, /*nb_inplace_add*/
36291 0, /*nb_inplace_subtract*/
36292 0, /*nb_inplace_multiply*/
36293 #if PY_MAJOR_VERSION < 3
36294 0, /*nb_inplace_divide*/
36296 0, /*nb_inplace_remainder*/
36297 0, /*nb_inplace_power*/
36298 0, /*nb_inplace_lshift*/
36299 0, /*nb_inplace_rshift*/
36300 0, /*nb_inplace_and*/
36301 0, /*nb_inplace_xor*/
36302 0, /*nb_inplace_or*/
36303 0, /*nb_floor_divide*/
36304 0, /*nb_true_divide*/
36305 0, /*nb_inplace_floor_divide*/
36306 0, /*nb_inplace_true_divide*/
36307 #if PY_VERSION_HEX >= 0x02050000
36312 static PySequenceMethods __pyx_tp_as_sequence_PileupRead = {
36319 0, /*sq_ass_slice*/
36321 0, /*sq_inplace_concat*/
36322 0, /*sq_inplace_repeat*/
36325 static PyMappingMethods __pyx_tp_as_mapping_PileupRead = {
36327 0, /*mp_subscript*/
36328 0, /*mp_ass_subscript*/
36331 static PyBufferProcs __pyx_tp_as_buffer_PileupRead = {
36332 #if PY_MAJOR_VERSION < 3
36333 0, /*bf_getreadbuffer*/
36335 #if PY_MAJOR_VERSION < 3
36336 0, /*bf_getwritebuffer*/
36338 #if PY_MAJOR_VERSION < 3
36339 0, /*bf_getsegcount*/
36341 #if PY_MAJOR_VERSION < 3
36342 0, /*bf_getcharbuffer*/
36344 #if PY_VERSION_HEX >= 0x02060000
36345 0, /*bf_getbuffer*/
36347 #if PY_VERSION_HEX >= 0x02060000
36348 0, /*bf_releasebuffer*/
36352 static PyTypeObject __pyx_type_9csamtools_PileupRead = {
36353 PyVarObject_HEAD_INIT(0, 0)
36354 __Pyx_NAMESTR("csamtools.PileupRead"), /*tp_name*/
36355 sizeof(struct __pyx_obj_9csamtools_PileupRead), /*tp_basicsize*/
36357 __pyx_tp_dealloc_9csamtools_PileupRead, /*tp_dealloc*/
36361 #if PY_MAJOR_VERSION < 3
36367 &__pyx_tp_as_number_PileupRead, /*tp_as_number*/
36368 &__pyx_tp_as_sequence_PileupRead, /*tp_as_sequence*/
36369 &__pyx_tp_as_mapping_PileupRead, /*tp_as_mapping*/
36372 __pyx_pw_9csamtools_10PileupRead_3__str__, /*tp_str*/
36375 &__pyx_tp_as_buffer_PileupRead, /*tp_as_buffer*/
36376 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
36377 __Pyx_DOCSTR("PileupRead()\nA read aligned to a column.\n "), /*tp_doc*/
36378 __pyx_tp_traverse_9csamtools_PileupRead, /*tp_traverse*/
36379 __pyx_tp_clear_9csamtools_PileupRead, /*tp_clear*/
36380 0, /*tp_richcompare*/
36381 0, /*tp_weaklistoffset*/
36384 __pyx_methods_9csamtools_PileupRead, /*tp_methods*/
36386 __pyx_getsets_9csamtools_PileupRead, /*tp_getset*/
36389 0, /*tp_descr_get*/
36390 0, /*tp_descr_set*/
36391 0, /*tp_dictoffset*/
36392 __pyx_pw_9csamtools_10PileupRead_1__init__, /*tp_init*/
36394 __pyx_tp_new_9csamtools_PileupRead, /*tp_new*/
36400 0, /*tp_subclasses*/
36403 #if PY_VERSION_HEX >= 0x02060000
36404 0, /*tp_version_tag*/
36408 static PyObject *__pyx_tp_new_9csamtools_IteratorRow(PyTypeObject *t, PyObject *a, PyObject *k) {
36409 PyObject *o = (*t->tp_alloc)(t, 0);
36414 static void __pyx_tp_dealloc_9csamtools_IteratorRow(PyObject *o) {
36415 (*Py_TYPE(o)->tp_free)(o);
36418 static PyMethodDef __pyx_methods_9csamtools_IteratorRow[] = {
36422 static PyNumberMethods __pyx_tp_as_number_IteratorRow = {
36426 #if PY_MAJOR_VERSION < 3
36429 0, /*nb_remainder*/
36442 #if PY_MAJOR_VERSION < 3
36446 #if PY_MAJOR_VERSION < 3
36452 #if PY_MAJOR_VERSION < 3
36455 #if PY_MAJOR_VERSION < 3
36458 0, /*nb_inplace_add*/
36459 0, /*nb_inplace_subtract*/
36460 0, /*nb_inplace_multiply*/
36461 #if PY_MAJOR_VERSION < 3
36462 0, /*nb_inplace_divide*/
36464 0, /*nb_inplace_remainder*/
36465 0, /*nb_inplace_power*/
36466 0, /*nb_inplace_lshift*/
36467 0, /*nb_inplace_rshift*/
36468 0, /*nb_inplace_and*/
36469 0, /*nb_inplace_xor*/
36470 0, /*nb_inplace_or*/
36471 0, /*nb_floor_divide*/
36472 0, /*nb_true_divide*/
36473 0, /*nb_inplace_floor_divide*/
36474 0, /*nb_inplace_true_divide*/
36475 #if PY_VERSION_HEX >= 0x02050000
36480 static PySequenceMethods __pyx_tp_as_sequence_IteratorRow = {
36487 0, /*sq_ass_slice*/
36489 0, /*sq_inplace_concat*/
36490 0, /*sq_inplace_repeat*/
36493 static PyMappingMethods __pyx_tp_as_mapping_IteratorRow = {
36495 0, /*mp_subscript*/
36496 0, /*mp_ass_subscript*/
36499 static PyBufferProcs __pyx_tp_as_buffer_IteratorRow = {
36500 #if PY_MAJOR_VERSION < 3
36501 0, /*bf_getreadbuffer*/
36503 #if PY_MAJOR_VERSION < 3
36504 0, /*bf_getwritebuffer*/
36506 #if PY_MAJOR_VERSION < 3
36507 0, /*bf_getsegcount*/
36509 #if PY_MAJOR_VERSION < 3
36510 0, /*bf_getcharbuffer*/
36512 #if PY_VERSION_HEX >= 0x02060000
36513 0, /*bf_getbuffer*/
36515 #if PY_VERSION_HEX >= 0x02060000
36516 0, /*bf_releasebuffer*/
36520 static PyTypeObject __pyx_type_9csamtools_IteratorRow = {
36521 PyVarObject_HEAD_INIT(0, 0)
36522 __Pyx_NAMESTR("csamtools.IteratorRow"), /*tp_name*/
36523 sizeof(struct __pyx_obj_9csamtools_IteratorRow), /*tp_basicsize*/
36525 __pyx_tp_dealloc_9csamtools_IteratorRow, /*tp_dealloc*/
36529 #if PY_MAJOR_VERSION < 3
36535 &__pyx_tp_as_number_IteratorRow, /*tp_as_number*/
36536 &__pyx_tp_as_sequence_IteratorRow, /*tp_as_sequence*/
36537 &__pyx_tp_as_mapping_IteratorRow, /*tp_as_mapping*/
36543 &__pyx_tp_as_buffer_IteratorRow, /*tp_as_buffer*/
36544 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
36545 __Pyx_DOCSTR("abstract base class for iterators over mapped reads.\n\n Various iterators implement different behaviours for wrapping around\n contig boundaries. Examples include:\n\n :class:`pysam.IteratorRowRegion`\n iterate within a single contig and a defined region.\n\n :class:`pysam.IteratorRowAll`\n iterate until EOF. This iterator will also include unmapped reads.\n\n :class:`pysam.IteratorRowAllRefs`\n iterate over all reads in all reference sequences.\n\n The method :meth:`Samfile.fetch` returns an IteratorRow.\n "), /*tp_doc*/
36548 0, /*tp_richcompare*/
36549 0, /*tp_weaklistoffset*/
36552 __pyx_methods_9csamtools_IteratorRow, /*tp_methods*/
36557 0, /*tp_descr_get*/
36558 0, /*tp_descr_set*/
36559 0, /*tp_dictoffset*/
36562 __pyx_tp_new_9csamtools_IteratorRow, /*tp_new*/
36568 0, /*tp_subclasses*/
36571 #if PY_VERSION_HEX >= 0x02060000
36572 0, /*tp_version_tag*/
36575 static struct __pyx_vtabstruct_9csamtools_IteratorRowRegion __pyx_vtable_9csamtools_IteratorRowRegion;
36577 static PyObject *__pyx_tp_new_9csamtools_IteratorRowRegion(PyTypeObject *t, PyObject *a, PyObject *k) {
36578 struct __pyx_obj_9csamtools_IteratorRowRegion *p;
36579 PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
36581 p = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)o);
36582 p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowRegion;
36583 p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
36584 if (__pyx_pw_9csamtools_17IteratorRowRegion_1__cinit__(o, a, k) < 0) {
36585 Py_DECREF(o); o = 0;
36590 static void __pyx_tp_dealloc_9csamtools_IteratorRowRegion(PyObject *o) {
36591 struct __pyx_obj_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_9csamtools_IteratorRowRegion *)o;
36593 PyObject *etype, *eval, *etb;
36594 PyErr_Fetch(&etype, &eval, &etb);
36596 __pyx_pw_9csamtools_17IteratorRowRegion_7__dealloc__(o);
36597 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
36599 PyErr_Restore(etype, eval, etb);
36601 Py_XDECREF(((PyObject *)p->samfile));
36602 __pyx_tp_dealloc_9csamtools_IteratorRow(o);
36605 static int __pyx_tp_traverse_9csamtools_IteratorRowRegion(PyObject *o, visitproc v, void *a) {
36607 struct __pyx_obj_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_9csamtools_IteratorRowRegion *)o;
36608 if (__pyx_ptype_9csamtools_IteratorRow->tp_traverse) {
36609 e = __pyx_ptype_9csamtools_IteratorRow->tp_traverse(o, v, a); if (e) return e;
36612 e = (*v)(((PyObject*)p->samfile), a); if (e) return e;
36617 static int __pyx_tp_clear_9csamtools_IteratorRowRegion(PyObject *o) {
36618 struct __pyx_obj_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_9csamtools_IteratorRowRegion *)o;
36620 if (__pyx_ptype_9csamtools_IteratorRow->tp_clear) {
36621 __pyx_ptype_9csamtools_IteratorRow->tp_clear(o);
36623 tmp = ((PyObject*)p->samfile);
36624 p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
36629 static PyMethodDef __pyx_methods_9csamtools_IteratorRowRegion[] = {
36630 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_9csamtools_17IteratorRowRegion_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_17IteratorRowRegion_4__next__)},
36634 static PyNumberMethods __pyx_tp_as_number_IteratorRowRegion = {
36638 #if PY_MAJOR_VERSION < 3
36641 0, /*nb_remainder*/
36654 #if PY_MAJOR_VERSION < 3
36658 #if PY_MAJOR_VERSION < 3
36664 #if PY_MAJOR_VERSION < 3
36667 #if PY_MAJOR_VERSION < 3
36670 0, /*nb_inplace_add*/
36671 0, /*nb_inplace_subtract*/
36672 0, /*nb_inplace_multiply*/
36673 #if PY_MAJOR_VERSION < 3
36674 0, /*nb_inplace_divide*/
36676 0, /*nb_inplace_remainder*/
36677 0, /*nb_inplace_power*/
36678 0, /*nb_inplace_lshift*/
36679 0, /*nb_inplace_rshift*/
36680 0, /*nb_inplace_and*/
36681 0, /*nb_inplace_xor*/
36682 0, /*nb_inplace_or*/
36683 0, /*nb_floor_divide*/
36684 0, /*nb_true_divide*/
36685 0, /*nb_inplace_floor_divide*/
36686 0, /*nb_inplace_true_divide*/
36687 #if PY_VERSION_HEX >= 0x02050000
36692 static PySequenceMethods __pyx_tp_as_sequence_IteratorRowRegion = {
36699 0, /*sq_ass_slice*/
36701 0, /*sq_inplace_concat*/
36702 0, /*sq_inplace_repeat*/
36705 static PyMappingMethods __pyx_tp_as_mapping_IteratorRowRegion = {
36707 0, /*mp_subscript*/
36708 0, /*mp_ass_subscript*/
36711 static PyBufferProcs __pyx_tp_as_buffer_IteratorRowRegion = {
36712 #if PY_MAJOR_VERSION < 3
36713 0, /*bf_getreadbuffer*/
36715 #if PY_MAJOR_VERSION < 3
36716 0, /*bf_getwritebuffer*/
36718 #if PY_MAJOR_VERSION < 3
36719 0, /*bf_getsegcount*/
36721 #if PY_MAJOR_VERSION < 3
36722 0, /*bf_getcharbuffer*/
36724 #if PY_VERSION_HEX >= 0x02060000
36725 0, /*bf_getbuffer*/
36727 #if PY_VERSION_HEX >= 0x02060000
36728 0, /*bf_releasebuffer*/
36732 static PyTypeObject __pyx_type_9csamtools_IteratorRowRegion = {
36733 PyVarObject_HEAD_INIT(0, 0)
36734 __Pyx_NAMESTR("csamtools.IteratorRowRegion"), /*tp_name*/
36735 sizeof(struct __pyx_obj_9csamtools_IteratorRowRegion), /*tp_basicsize*/
36737 __pyx_tp_dealloc_9csamtools_IteratorRowRegion, /*tp_dealloc*/
36741 #if PY_MAJOR_VERSION < 3
36747 &__pyx_tp_as_number_IteratorRowRegion, /*tp_as_number*/
36748 &__pyx_tp_as_sequence_IteratorRowRegion, /*tp_as_sequence*/
36749 &__pyx_tp_as_mapping_IteratorRowRegion, /*tp_as_mapping*/
36755 &__pyx_tp_as_buffer_IteratorRowRegion, /*tp_as_buffer*/
36756 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
36757 __Pyx_DOCSTR("*(Samfile samfile, int tid, int beg, int end, int reopen = True )*\n\n iterate over mapped reads in a region.\n\n By default, the file is re-openend to avoid conflicts between\n multiple iterators working on the same file. Set *reopen* = False\n to not re-open *samfile*.\n\n The samtools iterators assume that the file\n position between iterations do not change.\n As a consequence, no two iterators can work\n on the same file. To permit this, each iterator\n creates its own file handle by re-opening the\n file.\n\n Note that the index will be shared between\n samfile and the iterator.\n "), /*tp_doc*/
36758 __pyx_tp_traverse_9csamtools_IteratorRowRegion, /*tp_traverse*/
36759 __pyx_tp_clear_9csamtools_IteratorRowRegion, /*tp_clear*/
36760 0, /*tp_richcompare*/
36761 0, /*tp_weaklistoffset*/
36762 __pyx_pw_9csamtools_17IteratorRowRegion_3__iter__, /*tp_iter*/
36763 __pyx_pw_9csamtools_17IteratorRowRegion_5__next__, /*tp_iternext*/
36764 __pyx_methods_9csamtools_IteratorRowRegion, /*tp_methods*/
36769 0, /*tp_descr_get*/
36770 0, /*tp_descr_set*/
36771 0, /*tp_dictoffset*/
36774 __pyx_tp_new_9csamtools_IteratorRowRegion, /*tp_new*/
36780 0, /*tp_subclasses*/
36783 #if PY_VERSION_HEX >= 0x02060000
36784 0, /*tp_version_tag*/
36787 static struct __pyx_vtabstruct_9csamtools_IteratorRowAll __pyx_vtable_9csamtools_IteratorRowAll;
36789 static PyObject *__pyx_tp_new_9csamtools_IteratorRowAll(PyTypeObject *t, PyObject *a, PyObject *k) {
36790 struct __pyx_obj_9csamtools_IteratorRowAll *p;
36791 PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
36793 p = ((struct __pyx_obj_9csamtools_IteratorRowAll *)o);
36794 p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowAll;
36795 if (__pyx_pw_9csamtools_14IteratorRowAll_1__cinit__(o, a, k) < 0) {
36796 Py_DECREF(o); o = 0;
36801 static void __pyx_tp_dealloc_9csamtools_IteratorRowAll(PyObject *o) {
36803 PyObject *etype, *eval, *etb;
36804 PyErr_Fetch(&etype, &eval, &etb);
36806 __pyx_pw_9csamtools_14IteratorRowAll_7__dealloc__(o);
36807 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
36809 PyErr_Restore(etype, eval, etb);
36811 __pyx_tp_dealloc_9csamtools_IteratorRow(o);
36814 static PyMethodDef __pyx_methods_9csamtools_IteratorRowAll[] = {
36815 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_9csamtools_14IteratorRowAll_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorRowAll_4__next__)},
36819 static PyNumberMethods __pyx_tp_as_number_IteratorRowAll = {
36823 #if PY_MAJOR_VERSION < 3
36826 0, /*nb_remainder*/
36839 #if PY_MAJOR_VERSION < 3
36843 #if PY_MAJOR_VERSION < 3
36849 #if PY_MAJOR_VERSION < 3
36852 #if PY_MAJOR_VERSION < 3
36855 0, /*nb_inplace_add*/
36856 0, /*nb_inplace_subtract*/
36857 0, /*nb_inplace_multiply*/
36858 #if PY_MAJOR_VERSION < 3
36859 0, /*nb_inplace_divide*/
36861 0, /*nb_inplace_remainder*/
36862 0, /*nb_inplace_power*/
36863 0, /*nb_inplace_lshift*/
36864 0, /*nb_inplace_rshift*/
36865 0, /*nb_inplace_and*/
36866 0, /*nb_inplace_xor*/
36867 0, /*nb_inplace_or*/
36868 0, /*nb_floor_divide*/
36869 0, /*nb_true_divide*/
36870 0, /*nb_inplace_floor_divide*/
36871 0, /*nb_inplace_true_divide*/
36872 #if PY_VERSION_HEX >= 0x02050000
36877 static PySequenceMethods __pyx_tp_as_sequence_IteratorRowAll = {
36884 0, /*sq_ass_slice*/
36886 0, /*sq_inplace_concat*/
36887 0, /*sq_inplace_repeat*/
36890 static PyMappingMethods __pyx_tp_as_mapping_IteratorRowAll = {
36892 0, /*mp_subscript*/
36893 0, /*mp_ass_subscript*/
36896 static PyBufferProcs __pyx_tp_as_buffer_IteratorRowAll = {
36897 #if PY_MAJOR_VERSION < 3
36898 0, /*bf_getreadbuffer*/
36900 #if PY_MAJOR_VERSION < 3
36901 0, /*bf_getwritebuffer*/
36903 #if PY_MAJOR_VERSION < 3
36904 0, /*bf_getsegcount*/
36906 #if PY_MAJOR_VERSION < 3
36907 0, /*bf_getcharbuffer*/
36909 #if PY_VERSION_HEX >= 0x02060000
36910 0, /*bf_getbuffer*/
36912 #if PY_VERSION_HEX >= 0x02060000
36913 0, /*bf_releasebuffer*/
36917 static PyTypeObject __pyx_type_9csamtools_IteratorRowAll = {
36918 PyVarObject_HEAD_INIT(0, 0)
36919 __Pyx_NAMESTR("csamtools.IteratorRowAll"), /*tp_name*/
36920 sizeof(struct __pyx_obj_9csamtools_IteratorRowAll), /*tp_basicsize*/
36922 __pyx_tp_dealloc_9csamtools_IteratorRowAll, /*tp_dealloc*/
36926 #if PY_MAJOR_VERSION < 3
36932 &__pyx_tp_as_number_IteratorRowAll, /*tp_as_number*/
36933 &__pyx_tp_as_sequence_IteratorRowAll, /*tp_as_sequence*/
36934 &__pyx_tp_as_mapping_IteratorRowAll, /*tp_as_mapping*/
36940 &__pyx_tp_as_buffer_IteratorRowAll, /*tp_as_buffer*/
36941 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
36942 __Pyx_DOCSTR("*(Samfile samfile, int reopen = True)*\n\n iterate over all reads in *samfile*\n\n By default, the file is re-openend to avoid conflicts between\n multiple iterators working on the same file. Set *reopen* = False\n to not re-open *samfile*.\n "), /*tp_doc*/
36945 0, /*tp_richcompare*/
36946 0, /*tp_weaklistoffset*/
36947 __pyx_pw_9csamtools_14IteratorRowAll_3__iter__, /*tp_iter*/
36948 __pyx_pw_9csamtools_14IteratorRowAll_5__next__, /*tp_iternext*/
36949 __pyx_methods_9csamtools_IteratorRowAll, /*tp_methods*/
36954 0, /*tp_descr_get*/
36955 0, /*tp_descr_set*/
36956 0, /*tp_dictoffset*/
36959 __pyx_tp_new_9csamtools_IteratorRowAll, /*tp_new*/
36965 0, /*tp_subclasses*/
36968 #if PY_VERSION_HEX >= 0x02060000
36969 0, /*tp_version_tag*/
36973 static PyObject *__pyx_tp_new_9csamtools_IteratorRowAllRefs(PyTypeObject *t, PyObject *a, PyObject *k) {
36974 struct __pyx_obj_9csamtools_IteratorRowAllRefs *p;
36975 PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
36977 p = ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o);
36978 p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
36979 p->rowiter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
36980 if (__pyx_pw_9csamtools_18IteratorRowAllRefs_1__cinit__(o, a, k) < 0) {
36981 Py_DECREF(o); o = 0;
36986 static void __pyx_tp_dealloc_9csamtools_IteratorRowAllRefs(PyObject *o) {
36987 struct __pyx_obj_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o;
36988 Py_XDECREF(((PyObject *)p->samfile));
36989 Py_XDECREF(((PyObject *)p->rowiter));
36990 __pyx_tp_dealloc_9csamtools_IteratorRow(o);
36993 static int __pyx_tp_traverse_9csamtools_IteratorRowAllRefs(PyObject *o, visitproc v, void *a) {
36995 struct __pyx_obj_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o;
36996 if (__pyx_ptype_9csamtools_IteratorRow->tp_traverse) {
36997 e = __pyx_ptype_9csamtools_IteratorRow->tp_traverse(o, v, a); if (e) return e;
37000 e = (*v)(((PyObject*)p->samfile), a); if (e) return e;
37003 e = (*v)(((PyObject*)p->rowiter), a); if (e) return e;
37008 static int __pyx_tp_clear_9csamtools_IteratorRowAllRefs(PyObject *o) {
37009 struct __pyx_obj_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o;
37011 if (__pyx_ptype_9csamtools_IteratorRow->tp_clear) {
37012 __pyx_ptype_9csamtools_IteratorRow->tp_clear(o);
37014 tmp = ((PyObject*)p->samfile);
37015 p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
37017 tmp = ((PyObject*)p->rowiter);
37018 p->rowiter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
37023 static PyMethodDef __pyx_methods_9csamtools_IteratorRowAllRefs[] = {
37024 {__Pyx_NAMESTR("nextiter"), (PyCFunction)__pyx_pw_9csamtools_18IteratorRowAllRefs_3nextiter, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_18IteratorRowAllRefs_2nextiter)},
37025 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_9csamtools_18IteratorRowAllRefs_7__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_18IteratorRowAllRefs_6__next__)},
37029 static PyNumberMethods __pyx_tp_as_number_IteratorRowAllRefs = {
37033 #if PY_MAJOR_VERSION < 3
37036 0, /*nb_remainder*/
37049 #if PY_MAJOR_VERSION < 3
37053 #if PY_MAJOR_VERSION < 3
37059 #if PY_MAJOR_VERSION < 3
37062 #if PY_MAJOR_VERSION < 3
37065 0, /*nb_inplace_add*/
37066 0, /*nb_inplace_subtract*/
37067 0, /*nb_inplace_multiply*/
37068 #if PY_MAJOR_VERSION < 3
37069 0, /*nb_inplace_divide*/
37071 0, /*nb_inplace_remainder*/
37072 0, /*nb_inplace_power*/
37073 0, /*nb_inplace_lshift*/
37074 0, /*nb_inplace_rshift*/
37075 0, /*nb_inplace_and*/
37076 0, /*nb_inplace_xor*/
37077 0, /*nb_inplace_or*/
37078 0, /*nb_floor_divide*/
37079 0, /*nb_true_divide*/
37080 0, /*nb_inplace_floor_divide*/
37081 0, /*nb_inplace_true_divide*/
37082 #if PY_VERSION_HEX >= 0x02050000
37087 static PySequenceMethods __pyx_tp_as_sequence_IteratorRowAllRefs = {
37094 0, /*sq_ass_slice*/
37096 0, /*sq_inplace_concat*/
37097 0, /*sq_inplace_repeat*/
37100 static PyMappingMethods __pyx_tp_as_mapping_IteratorRowAllRefs = {
37102 0, /*mp_subscript*/
37103 0, /*mp_ass_subscript*/
37106 static PyBufferProcs __pyx_tp_as_buffer_IteratorRowAllRefs = {
37107 #if PY_MAJOR_VERSION < 3
37108 0, /*bf_getreadbuffer*/
37110 #if PY_MAJOR_VERSION < 3
37111 0, /*bf_getwritebuffer*/
37113 #if PY_MAJOR_VERSION < 3
37114 0, /*bf_getsegcount*/
37116 #if PY_MAJOR_VERSION < 3
37117 0, /*bf_getcharbuffer*/
37119 #if PY_VERSION_HEX >= 0x02060000
37120 0, /*bf_getbuffer*/
37122 #if PY_VERSION_HEX >= 0x02060000
37123 0, /*bf_releasebuffer*/
37127 static PyTypeObject __pyx_type_9csamtools_IteratorRowAllRefs = {
37128 PyVarObject_HEAD_INIT(0, 0)
37129 __Pyx_NAMESTR("csamtools.IteratorRowAllRefs"), /*tp_name*/
37130 sizeof(struct __pyx_obj_9csamtools_IteratorRowAllRefs), /*tp_basicsize*/
37132 __pyx_tp_dealloc_9csamtools_IteratorRowAllRefs, /*tp_dealloc*/
37136 #if PY_MAJOR_VERSION < 3
37142 &__pyx_tp_as_number_IteratorRowAllRefs, /*tp_as_number*/
37143 &__pyx_tp_as_sequence_IteratorRowAllRefs, /*tp_as_sequence*/
37144 &__pyx_tp_as_mapping_IteratorRowAllRefs, /*tp_as_mapping*/
37150 &__pyx_tp_as_buffer_IteratorRowAllRefs, /*tp_as_buffer*/
37151 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
37152 __Pyx_DOCSTR("iterates over all mapped reads by chaining iterators over each reference\n "), /*tp_doc*/
37153 __pyx_tp_traverse_9csamtools_IteratorRowAllRefs, /*tp_traverse*/
37154 __pyx_tp_clear_9csamtools_IteratorRowAllRefs, /*tp_clear*/
37155 0, /*tp_richcompare*/
37156 0, /*tp_weaklistoffset*/
37157 __pyx_pw_9csamtools_18IteratorRowAllRefs_5__iter__, /*tp_iter*/
37158 __pyx_pw_9csamtools_18IteratorRowAllRefs_7__next__, /*tp_iternext*/
37159 __pyx_methods_9csamtools_IteratorRowAllRefs, /*tp_methods*/
37164 0, /*tp_descr_get*/
37165 0, /*tp_descr_set*/
37166 0, /*tp_dictoffset*/
37169 __pyx_tp_new_9csamtools_IteratorRowAllRefs, /*tp_new*/
37175 0, /*tp_subclasses*/
37178 #if PY_VERSION_HEX >= 0x02060000
37179 0, /*tp_version_tag*/
37182 static struct __pyx_vtabstruct_9csamtools_IteratorRowSelection __pyx_vtable_9csamtools_IteratorRowSelection;
37184 static PyObject *__pyx_tp_new_9csamtools_IteratorRowSelection(PyTypeObject *t, PyObject *a, PyObject *k) {
37185 struct __pyx_obj_9csamtools_IteratorRowSelection *p;
37186 PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
37188 p = ((struct __pyx_obj_9csamtools_IteratorRowSelection *)o);
37189 p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowSelection;
37190 p->positions = Py_None; Py_INCREF(Py_None);
37191 if (__pyx_pw_9csamtools_20IteratorRowSelection_1__cinit__(o, a, k) < 0) {
37192 Py_DECREF(o); o = 0;
37197 static void __pyx_tp_dealloc_9csamtools_IteratorRowSelection(PyObject *o) {
37198 struct __pyx_obj_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_9csamtools_IteratorRowSelection *)o;
37200 PyObject *etype, *eval, *etb;
37201 PyErr_Fetch(&etype, &eval, &etb);
37203 __pyx_pw_9csamtools_20IteratorRowSelection_7__dealloc__(o);
37204 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
37206 PyErr_Restore(etype, eval, etb);
37208 Py_XDECREF(p->positions);
37209 __pyx_tp_dealloc_9csamtools_IteratorRow(o);
37212 static int __pyx_tp_traverse_9csamtools_IteratorRowSelection(PyObject *o, visitproc v, void *a) {
37214 struct __pyx_obj_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_9csamtools_IteratorRowSelection *)o;
37215 if (__pyx_ptype_9csamtools_IteratorRow->tp_traverse) {
37216 e = __pyx_ptype_9csamtools_IteratorRow->tp_traverse(o, v, a); if (e) return e;
37218 if (p->positions) {
37219 e = (*v)(p->positions, a); if (e) return e;
37224 static int __pyx_tp_clear_9csamtools_IteratorRowSelection(PyObject *o) {
37225 struct __pyx_obj_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_9csamtools_IteratorRowSelection *)o;
37227 if (__pyx_ptype_9csamtools_IteratorRow->tp_clear) {
37228 __pyx_ptype_9csamtools_IteratorRow->tp_clear(o);
37230 tmp = ((PyObject*)p->positions);
37231 p->positions = Py_None; Py_INCREF(Py_None);
37236 static PyMethodDef __pyx_methods_9csamtools_IteratorRowSelection[] = {
37237 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_9csamtools_20IteratorRowSelection_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_20IteratorRowSelection_4__next__)},
37241 static PyNumberMethods __pyx_tp_as_number_IteratorRowSelection = {
37245 #if PY_MAJOR_VERSION < 3
37248 0, /*nb_remainder*/
37261 #if PY_MAJOR_VERSION < 3
37265 #if PY_MAJOR_VERSION < 3
37271 #if PY_MAJOR_VERSION < 3
37274 #if PY_MAJOR_VERSION < 3
37277 0, /*nb_inplace_add*/
37278 0, /*nb_inplace_subtract*/
37279 0, /*nb_inplace_multiply*/
37280 #if PY_MAJOR_VERSION < 3
37281 0, /*nb_inplace_divide*/
37283 0, /*nb_inplace_remainder*/
37284 0, /*nb_inplace_power*/
37285 0, /*nb_inplace_lshift*/
37286 0, /*nb_inplace_rshift*/
37287 0, /*nb_inplace_and*/
37288 0, /*nb_inplace_xor*/
37289 0, /*nb_inplace_or*/
37290 0, /*nb_floor_divide*/
37291 0, /*nb_true_divide*/
37292 0, /*nb_inplace_floor_divide*/
37293 0, /*nb_inplace_true_divide*/
37294 #if PY_VERSION_HEX >= 0x02050000
37299 static PySequenceMethods __pyx_tp_as_sequence_IteratorRowSelection = {
37306 0, /*sq_ass_slice*/
37308 0, /*sq_inplace_concat*/
37309 0, /*sq_inplace_repeat*/
37312 static PyMappingMethods __pyx_tp_as_mapping_IteratorRowSelection = {
37314 0, /*mp_subscript*/
37315 0, /*mp_ass_subscript*/
37318 static PyBufferProcs __pyx_tp_as_buffer_IteratorRowSelection = {
37319 #if PY_MAJOR_VERSION < 3
37320 0, /*bf_getreadbuffer*/
37322 #if PY_MAJOR_VERSION < 3
37323 0, /*bf_getwritebuffer*/
37325 #if PY_MAJOR_VERSION < 3
37326 0, /*bf_getsegcount*/
37328 #if PY_MAJOR_VERSION < 3
37329 0, /*bf_getcharbuffer*/
37331 #if PY_VERSION_HEX >= 0x02060000
37332 0, /*bf_getbuffer*/
37334 #if PY_VERSION_HEX >= 0x02060000
37335 0, /*bf_releasebuffer*/
37339 static PyTypeObject __pyx_type_9csamtools_IteratorRowSelection = {
37340 PyVarObject_HEAD_INIT(0, 0)
37341 __Pyx_NAMESTR("csamtools.IteratorRowSelection"), /*tp_name*/
37342 sizeof(struct __pyx_obj_9csamtools_IteratorRowSelection), /*tp_basicsize*/
37344 __pyx_tp_dealloc_9csamtools_IteratorRowSelection, /*tp_dealloc*/
37348 #if PY_MAJOR_VERSION < 3
37354 &__pyx_tp_as_number_IteratorRowSelection, /*tp_as_number*/
37355 &__pyx_tp_as_sequence_IteratorRowSelection, /*tp_as_sequence*/
37356 &__pyx_tp_as_mapping_IteratorRowSelection, /*tp_as_mapping*/
37362 &__pyx_tp_as_buffer_IteratorRowSelection, /*tp_as_buffer*/
37363 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
37364 __Pyx_DOCSTR("*(Samfile samfile)*\n\n iterate over reads in *samfile* at a given list of file positions.\n "), /*tp_doc*/
37365 __pyx_tp_traverse_9csamtools_IteratorRowSelection, /*tp_traverse*/
37366 __pyx_tp_clear_9csamtools_IteratorRowSelection, /*tp_clear*/
37367 0, /*tp_richcompare*/
37368 0, /*tp_weaklistoffset*/
37369 __pyx_pw_9csamtools_20IteratorRowSelection_3__iter__, /*tp_iter*/
37370 __pyx_pw_9csamtools_20IteratorRowSelection_5__next__, /*tp_iternext*/
37371 __pyx_methods_9csamtools_IteratorRowSelection, /*tp_methods*/
37376 0, /*tp_descr_get*/
37377 0, /*tp_descr_set*/
37378 0, /*tp_dictoffset*/
37381 __pyx_tp_new_9csamtools_IteratorRowSelection, /*tp_new*/
37387 0, /*tp_subclasses*/
37390 #if PY_VERSION_HEX >= 0x02060000
37391 0, /*tp_version_tag*/
37394 static struct __pyx_vtabstruct_9csamtools_IteratorColumn __pyx_vtable_9csamtools_IteratorColumn;
37396 static PyObject *__pyx_tp_new_9csamtools_IteratorColumn(PyTypeObject *t, PyObject *a, PyObject *k) {
37397 struct __pyx_obj_9csamtools_IteratorColumn *p;
37398 PyObject *o = (*t->tp_alloc)(t, 0);
37400 p = ((struct __pyx_obj_9csamtools_IteratorColumn *)o);
37401 p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorColumn;
37402 p->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
37403 p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
37404 p->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)Py_None); Py_INCREF(Py_None);
37405 p->stepper = Py_None; Py_INCREF(Py_None);
37406 if (__pyx_pw_9csamtools_14IteratorColumn_1__cinit__(o, a, k) < 0) {
37407 Py_DECREF(o); o = 0;
37412 static void __pyx_tp_dealloc_9csamtools_IteratorColumn(PyObject *o) {
37413 struct __pyx_obj_9csamtools_IteratorColumn *p = (struct __pyx_obj_9csamtools_IteratorColumn *)o;
37415 PyObject *etype, *eval, *etb;
37416 PyErr_Fetch(&etype, &eval, &etb);
37418 __pyx_pw_9csamtools_14IteratorColumn_9__dealloc__(o);
37419 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
37421 PyErr_Restore(etype, eval, etb);
37423 Py_XDECREF(((PyObject *)p->iter));
37424 Py_XDECREF(((PyObject *)p->samfile));
37425 Py_XDECREF(((PyObject *)p->fastafile));
37426 Py_XDECREF(p->stepper);
37427 (*Py_TYPE(o)->tp_free)(o);
37430 static int __pyx_tp_traverse_9csamtools_IteratorColumn(PyObject *o, visitproc v, void *a) {
37432 struct __pyx_obj_9csamtools_IteratorColumn *p = (struct __pyx_obj_9csamtools_IteratorColumn *)o;
37434 e = (*v)(((PyObject*)p->iter), a); if (e) return e;
37437 e = (*v)(((PyObject*)p->samfile), a); if (e) return e;
37439 if (p->fastafile) {
37440 e = (*v)(((PyObject*)p->fastafile), a); if (e) return e;
37443 e = (*v)(p->stepper, a); if (e) return e;
37448 static int __pyx_tp_clear_9csamtools_IteratorColumn(PyObject *o) {
37449 struct __pyx_obj_9csamtools_IteratorColumn *p = (struct __pyx_obj_9csamtools_IteratorColumn *)o;
37451 tmp = ((PyObject*)p->iter);
37452 p->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
37454 tmp = ((PyObject*)p->samfile);
37455 p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
37457 tmp = ((PyObject*)p->fastafile);
37458 p->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)Py_None); Py_INCREF(Py_None);
37460 tmp = ((PyObject*)p->stepper);
37461 p->stepper = Py_None; Py_INCREF(Py_None);
37466 static PyObject *__pyx_getprop_9csamtools_14IteratorColumn_seq_len(PyObject *o, void *x) {
37467 return __pyx_pw_9csamtools_14IteratorColumn_7seq_len_1__get__(o);
37470 static PyMethodDef __pyx_methods_9csamtools_IteratorColumn[] = {
37471 {__Pyx_NAMESTR("addReference"), (PyCFunction)__pyx_pw_9csamtools_14IteratorColumn_5addReference, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorColumn_4addReference)},
37472 {__Pyx_NAMESTR("hasReference"), (PyCFunction)__pyx_pw_9csamtools_14IteratorColumn_7hasReference, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorColumn_6hasReference)},
37476 static struct PyGetSetDef __pyx_getsets_9csamtools_IteratorColumn[] = {
37477 {(char *)"seq_len", __pyx_getprop_9csamtools_14IteratorColumn_seq_len, 0, __Pyx_DOCSTR(__pyx_k_241), 0},
37481 static PyNumberMethods __pyx_tp_as_number_IteratorColumn = {
37485 #if PY_MAJOR_VERSION < 3
37488 0, /*nb_remainder*/
37501 #if PY_MAJOR_VERSION < 3
37505 #if PY_MAJOR_VERSION < 3
37511 #if PY_MAJOR_VERSION < 3
37514 #if PY_MAJOR_VERSION < 3
37517 0, /*nb_inplace_add*/
37518 0, /*nb_inplace_subtract*/
37519 0, /*nb_inplace_multiply*/
37520 #if PY_MAJOR_VERSION < 3
37521 0, /*nb_inplace_divide*/
37523 0, /*nb_inplace_remainder*/
37524 0, /*nb_inplace_power*/
37525 0, /*nb_inplace_lshift*/
37526 0, /*nb_inplace_rshift*/
37527 0, /*nb_inplace_and*/
37528 0, /*nb_inplace_xor*/
37529 0, /*nb_inplace_or*/
37530 0, /*nb_floor_divide*/
37531 0, /*nb_true_divide*/
37532 0, /*nb_inplace_floor_divide*/
37533 0, /*nb_inplace_true_divide*/
37534 #if PY_VERSION_HEX >= 0x02050000
37539 static PySequenceMethods __pyx_tp_as_sequence_IteratorColumn = {
37546 0, /*sq_ass_slice*/
37548 0, /*sq_inplace_concat*/
37549 0, /*sq_inplace_repeat*/
37552 static PyMappingMethods __pyx_tp_as_mapping_IteratorColumn = {
37554 0, /*mp_subscript*/
37555 0, /*mp_ass_subscript*/
37558 static PyBufferProcs __pyx_tp_as_buffer_IteratorColumn = {
37559 #if PY_MAJOR_VERSION < 3
37560 0, /*bf_getreadbuffer*/
37562 #if PY_MAJOR_VERSION < 3
37563 0, /*bf_getwritebuffer*/
37565 #if PY_MAJOR_VERSION < 3
37566 0, /*bf_getsegcount*/
37568 #if PY_MAJOR_VERSION < 3
37569 0, /*bf_getcharbuffer*/
37571 #if PY_VERSION_HEX >= 0x02060000
37572 0, /*bf_getbuffer*/
37574 #if PY_VERSION_HEX >= 0x02060000
37575 0, /*bf_releasebuffer*/
37579 static PyTypeObject __pyx_type_9csamtools_IteratorColumn = {
37580 PyVarObject_HEAD_INIT(0, 0)
37581 __Pyx_NAMESTR("csamtools.IteratorColumn"), /*tp_name*/
37582 sizeof(struct __pyx_obj_9csamtools_IteratorColumn), /*tp_basicsize*/
37584 __pyx_tp_dealloc_9csamtools_IteratorColumn, /*tp_dealloc*/
37588 #if PY_MAJOR_VERSION < 3
37594 &__pyx_tp_as_number_IteratorColumn, /*tp_as_number*/
37595 &__pyx_tp_as_sequence_IteratorColumn, /*tp_as_sequence*/
37596 &__pyx_tp_as_mapping_IteratorColumn, /*tp_as_mapping*/
37602 &__pyx_tp_as_buffer_IteratorColumn, /*tp_as_buffer*/
37603 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
37604 __Pyx_DOCSTR("abstract base class for iterators over columns.\n\n IteratorColumn objects wrap the pileup functionality of samtools.\n\n For reasons of efficiency, the iterator points to the current\n pileup buffer. The pileup buffer is updated at every iteration.\n This might cause some unexpected behavious. For example,\n consider the conversion to a list::\n\n f = Samfile(\"file.bam\", \"rb\")\n result = list( f.pileup() )\n\n Here, ``result`` will contain ``n`` objects of type :class:`PileupProxy` for ``n`` columns,\n but each object in ``result`` will contain the same information.\n\n The desired behaviour can be achieved by list comprehension::\n\n result = [ x.pileups() for x in f.pileup() ]\n\n ``result`` will be a list of ``n`` lists of objects of type :class:`PileupRead`.\n\n If the iterator is associated with a :class:`Fastafile` using the :meth:`addReference`\n method, then the iterator will export the current sequence via the methods :meth:`getSequence`\n and :meth:`seq_len`.\n\n Optional kwargs to the iterator\n\n stepper\n The stepper controls how the iterator advances.\n Possible options for the stepper are\n\n all\n use all reads for pileup.\n samtools\n same filter and read processing as in :term:`csamtools` pileup\n\n The default is to use \"all\" if no stepper is given.\n\n fastafile\n A :class:`FastaFile` object\n mask\n Skip all reads with bits set in mask.\n max_depth\n maximum read depth. The default is 8000.\n "), /*tp_doc*/
37605 __pyx_tp_traverse_9csamtools_IteratorColumn, /*tp_traverse*/
37606 __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/
37607 0, /*tp_richcompare*/
37608 0, /*tp_weaklistoffset*/
37609 __pyx_pw_9csamtools_14IteratorColumn_3__iter__, /*tp_iter*/
37611 __pyx_methods_9csamtools_IteratorColumn, /*tp_methods*/
37613 __pyx_getsets_9csamtools_IteratorColumn, /*tp_getset*/
37616 0, /*tp_descr_get*/
37617 0, /*tp_descr_set*/
37618 0, /*tp_dictoffset*/
37621 __pyx_tp_new_9csamtools_IteratorColumn, /*tp_new*/
37627 0, /*tp_subclasses*/
37630 #if PY_VERSION_HEX >= 0x02060000
37631 0, /*tp_version_tag*/
37634 static struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion __pyx_vtable_9csamtools_IteratorColumnRegion;
37636 static PyObject *__pyx_tp_new_9csamtools_IteratorColumnRegion(PyTypeObject *t, PyObject *a, PyObject *k) {
37637 struct __pyx_obj_9csamtools_IteratorColumnRegion *p;
37638 PyObject *o = __pyx_tp_new_9csamtools_IteratorColumn(t, a, k);
37640 p = ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)o);
37641 p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9csamtools_IteratorColumn*)__pyx_vtabptr_9csamtools_IteratorColumnRegion;
37642 if (__pyx_pw_9csamtools_20IteratorColumnRegion_1__cinit__(o, a, k) < 0) {
37643 Py_DECREF(o); o = 0;
37648 static PyMethodDef __pyx_methods_9csamtools_IteratorColumnRegion[] = {
37649 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_9csamtools_20IteratorColumnRegion_3__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_20IteratorColumnRegion_2__next__)},
37653 static PyNumberMethods __pyx_tp_as_number_IteratorColumnRegion = {
37657 #if PY_MAJOR_VERSION < 3
37660 0, /*nb_remainder*/
37673 #if PY_MAJOR_VERSION < 3
37677 #if PY_MAJOR_VERSION < 3
37683 #if PY_MAJOR_VERSION < 3
37686 #if PY_MAJOR_VERSION < 3
37689 0, /*nb_inplace_add*/
37690 0, /*nb_inplace_subtract*/
37691 0, /*nb_inplace_multiply*/
37692 #if PY_MAJOR_VERSION < 3
37693 0, /*nb_inplace_divide*/
37695 0, /*nb_inplace_remainder*/
37696 0, /*nb_inplace_power*/
37697 0, /*nb_inplace_lshift*/
37698 0, /*nb_inplace_rshift*/
37699 0, /*nb_inplace_and*/
37700 0, /*nb_inplace_xor*/
37701 0, /*nb_inplace_or*/
37702 0, /*nb_floor_divide*/
37703 0, /*nb_true_divide*/
37704 0, /*nb_inplace_floor_divide*/
37705 0, /*nb_inplace_true_divide*/
37706 #if PY_VERSION_HEX >= 0x02050000
37711 static PySequenceMethods __pyx_tp_as_sequence_IteratorColumnRegion = {
37718 0, /*sq_ass_slice*/
37720 0, /*sq_inplace_concat*/
37721 0, /*sq_inplace_repeat*/
37724 static PyMappingMethods __pyx_tp_as_mapping_IteratorColumnRegion = {
37726 0, /*mp_subscript*/
37727 0, /*mp_ass_subscript*/
37730 static PyBufferProcs __pyx_tp_as_buffer_IteratorColumnRegion = {
37731 #if PY_MAJOR_VERSION < 3
37732 0, /*bf_getreadbuffer*/
37734 #if PY_MAJOR_VERSION < 3
37735 0, /*bf_getwritebuffer*/
37737 #if PY_MAJOR_VERSION < 3
37738 0, /*bf_getsegcount*/
37740 #if PY_MAJOR_VERSION < 3
37741 0, /*bf_getcharbuffer*/
37743 #if PY_VERSION_HEX >= 0x02060000
37744 0, /*bf_getbuffer*/
37746 #if PY_VERSION_HEX >= 0x02060000
37747 0, /*bf_releasebuffer*/
37751 static PyTypeObject __pyx_type_9csamtools_IteratorColumnRegion = {
37752 PyVarObject_HEAD_INIT(0, 0)
37753 __Pyx_NAMESTR("csamtools.IteratorColumnRegion"), /*tp_name*/
37754 sizeof(struct __pyx_obj_9csamtools_IteratorColumnRegion), /*tp_basicsize*/
37756 __pyx_tp_dealloc_9csamtools_IteratorColumn, /*tp_dealloc*/
37760 #if PY_MAJOR_VERSION < 3
37766 &__pyx_tp_as_number_IteratorColumnRegion, /*tp_as_number*/
37767 &__pyx_tp_as_sequence_IteratorColumnRegion, /*tp_as_sequence*/
37768 &__pyx_tp_as_mapping_IteratorColumnRegion, /*tp_as_mapping*/
37774 &__pyx_tp_as_buffer_IteratorColumnRegion, /*tp_as_buffer*/
37775 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
37776 __Pyx_DOCSTR("iterates over a region only.\n "), /*tp_doc*/
37777 __pyx_tp_traverse_9csamtools_IteratorColumn, /*tp_traverse*/
37778 __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/
37779 0, /*tp_richcompare*/
37780 0, /*tp_weaklistoffset*/
37782 __pyx_pw_9csamtools_20IteratorColumnRegion_3__next__, /*tp_iternext*/
37783 __pyx_methods_9csamtools_IteratorColumnRegion, /*tp_methods*/
37788 0, /*tp_descr_get*/
37789 0, /*tp_descr_set*/
37790 0, /*tp_dictoffset*/
37793 __pyx_tp_new_9csamtools_IteratorColumnRegion, /*tp_new*/
37799 0, /*tp_subclasses*/
37802 #if PY_VERSION_HEX >= 0x02060000
37803 0, /*tp_version_tag*/
37806 static struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs __pyx_vtable_9csamtools_IteratorColumnAllRefs;
37808 static PyObject *__pyx_tp_new_9csamtools_IteratorColumnAllRefs(PyTypeObject *t, PyObject *a, PyObject *k) {
37809 struct __pyx_obj_9csamtools_IteratorColumnAllRefs *p;
37810 PyObject *o = __pyx_tp_new_9csamtools_IteratorColumn(t, a, k);
37812 p = ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)o);
37813 p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9csamtools_IteratorColumn*)__pyx_vtabptr_9csamtools_IteratorColumnAllRefs;
37814 if (__pyx_pw_9csamtools_21IteratorColumnAllRefs_1__cinit__(o, a, k) < 0) {
37815 Py_DECREF(o); o = 0;
37820 static PyMethodDef __pyx_methods_9csamtools_IteratorColumnAllRefs[] = {
37821 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_9csamtools_21IteratorColumnAllRefs_3__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_21IteratorColumnAllRefs_2__next__)},
37825 static PyNumberMethods __pyx_tp_as_number_IteratorColumnAllRefs = {
37829 #if PY_MAJOR_VERSION < 3
37832 0, /*nb_remainder*/
37845 #if PY_MAJOR_VERSION < 3
37849 #if PY_MAJOR_VERSION < 3
37855 #if PY_MAJOR_VERSION < 3
37858 #if PY_MAJOR_VERSION < 3
37861 0, /*nb_inplace_add*/
37862 0, /*nb_inplace_subtract*/
37863 0, /*nb_inplace_multiply*/
37864 #if PY_MAJOR_VERSION < 3
37865 0, /*nb_inplace_divide*/
37867 0, /*nb_inplace_remainder*/
37868 0, /*nb_inplace_power*/
37869 0, /*nb_inplace_lshift*/
37870 0, /*nb_inplace_rshift*/
37871 0, /*nb_inplace_and*/
37872 0, /*nb_inplace_xor*/
37873 0, /*nb_inplace_or*/
37874 0, /*nb_floor_divide*/
37875 0, /*nb_true_divide*/
37876 0, /*nb_inplace_floor_divide*/
37877 0, /*nb_inplace_true_divide*/
37878 #if PY_VERSION_HEX >= 0x02050000
37883 static PySequenceMethods __pyx_tp_as_sequence_IteratorColumnAllRefs = {
37890 0, /*sq_ass_slice*/
37892 0, /*sq_inplace_concat*/
37893 0, /*sq_inplace_repeat*/
37896 static PyMappingMethods __pyx_tp_as_mapping_IteratorColumnAllRefs = {
37898 0, /*mp_subscript*/
37899 0, /*mp_ass_subscript*/
37902 static PyBufferProcs __pyx_tp_as_buffer_IteratorColumnAllRefs = {
37903 #if PY_MAJOR_VERSION < 3
37904 0, /*bf_getreadbuffer*/
37906 #if PY_MAJOR_VERSION < 3
37907 0, /*bf_getwritebuffer*/
37909 #if PY_MAJOR_VERSION < 3
37910 0, /*bf_getsegcount*/
37912 #if PY_MAJOR_VERSION < 3
37913 0, /*bf_getcharbuffer*/
37915 #if PY_VERSION_HEX >= 0x02060000
37916 0, /*bf_getbuffer*/
37918 #if PY_VERSION_HEX >= 0x02060000
37919 0, /*bf_releasebuffer*/
37923 static PyTypeObject __pyx_type_9csamtools_IteratorColumnAllRefs = {
37924 PyVarObject_HEAD_INIT(0, 0)
37925 __Pyx_NAMESTR("csamtools.IteratorColumnAllRefs"), /*tp_name*/
37926 sizeof(struct __pyx_obj_9csamtools_IteratorColumnAllRefs), /*tp_basicsize*/
37928 __pyx_tp_dealloc_9csamtools_IteratorColumn, /*tp_dealloc*/
37932 #if PY_MAJOR_VERSION < 3
37938 &__pyx_tp_as_number_IteratorColumnAllRefs, /*tp_as_number*/
37939 &__pyx_tp_as_sequence_IteratorColumnAllRefs, /*tp_as_sequence*/
37940 &__pyx_tp_as_mapping_IteratorColumnAllRefs, /*tp_as_mapping*/
37946 &__pyx_tp_as_buffer_IteratorColumnAllRefs, /*tp_as_buffer*/
37947 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
37948 __Pyx_DOCSTR("iterates over all columns by chaining iterators over each reference\n "), /*tp_doc*/
37949 __pyx_tp_traverse_9csamtools_IteratorColumn, /*tp_traverse*/
37950 __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/
37951 0, /*tp_richcompare*/
37952 0, /*tp_weaklistoffset*/
37954 __pyx_pw_9csamtools_21IteratorColumnAllRefs_3__next__, /*tp_iternext*/
37955 __pyx_methods_9csamtools_IteratorColumnAllRefs, /*tp_methods*/
37960 0, /*tp_descr_get*/
37961 0, /*tp_descr_set*/
37962 0, /*tp_dictoffset*/
37965 __pyx_tp_new_9csamtools_IteratorColumnAllRefs, /*tp_new*/
37971 0, /*tp_subclasses*/
37974 #if PY_VERSION_HEX >= 0x02060000
37975 0, /*tp_version_tag*/
37979 static PyObject *__pyx_tp_new_9csamtools_IndexedReads(PyTypeObject *t, PyObject *a, PyObject *k) {
37980 struct __pyx_obj_9csamtools_IndexedReads *p;
37981 PyObject *o = (*t->tp_alloc)(t, 0);
37983 p = ((struct __pyx_obj_9csamtools_IndexedReads *)o);
37984 p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
37985 p->index = Py_None; Py_INCREF(Py_None);
37989 static void __pyx_tp_dealloc_9csamtools_IndexedReads(PyObject *o) {
37990 struct __pyx_obj_9csamtools_IndexedReads *p = (struct __pyx_obj_9csamtools_IndexedReads *)o;
37992 PyObject *etype, *eval, *etb;
37993 PyErr_Fetch(&etype, &eval, &etb);
37995 __pyx_pw_9csamtools_12IndexedReads_7__dealloc__(o);
37996 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
37998 PyErr_Restore(etype, eval, etb);
38000 Py_XDECREF(((PyObject *)p->samfile));
38001 Py_XDECREF(p->index);
38002 (*Py_TYPE(o)->tp_free)(o);
38005 static int __pyx_tp_traverse_9csamtools_IndexedReads(PyObject *o, visitproc v, void *a) {
38007 struct __pyx_obj_9csamtools_IndexedReads *p = (struct __pyx_obj_9csamtools_IndexedReads *)o;
38009 e = (*v)(((PyObject*)p->samfile), a); if (e) return e;
38012 e = (*v)(p->index, a); if (e) return e;
38017 static int __pyx_tp_clear_9csamtools_IndexedReads(PyObject *o) {
38018 struct __pyx_obj_9csamtools_IndexedReads *p = (struct __pyx_obj_9csamtools_IndexedReads *)o;
38020 tmp = ((PyObject*)p->samfile);
38021 p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
38023 tmp = ((PyObject*)p->index);
38024 p->index = Py_None; Py_INCREF(Py_None);
38029 static PyMethodDef __pyx_methods_9csamtools_IndexedReads[] = {
38030 {__Pyx_NAMESTR("build"), (PyCFunction)__pyx_pw_9csamtools_12IndexedReads_3build, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_12IndexedReads_2build)},
38031 {__Pyx_NAMESTR("find"), (PyCFunction)__pyx_pw_9csamtools_12IndexedReads_5find, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_12IndexedReads_4find)},
38035 static PyNumberMethods __pyx_tp_as_number_IndexedReads = {
38039 #if PY_MAJOR_VERSION < 3
38042 0, /*nb_remainder*/
38055 #if PY_MAJOR_VERSION < 3
38059 #if PY_MAJOR_VERSION < 3
38065 #if PY_MAJOR_VERSION < 3
38068 #if PY_MAJOR_VERSION < 3
38071 0, /*nb_inplace_add*/
38072 0, /*nb_inplace_subtract*/
38073 0, /*nb_inplace_multiply*/
38074 #if PY_MAJOR_VERSION < 3
38075 0, /*nb_inplace_divide*/
38077 0, /*nb_inplace_remainder*/
38078 0, /*nb_inplace_power*/
38079 0, /*nb_inplace_lshift*/
38080 0, /*nb_inplace_rshift*/
38081 0, /*nb_inplace_and*/
38082 0, /*nb_inplace_xor*/
38083 0, /*nb_inplace_or*/
38084 0, /*nb_floor_divide*/
38085 0, /*nb_true_divide*/
38086 0, /*nb_inplace_floor_divide*/
38087 0, /*nb_inplace_true_divide*/
38088 #if PY_VERSION_HEX >= 0x02050000
38093 static PySequenceMethods __pyx_tp_as_sequence_IndexedReads = {
38100 0, /*sq_ass_slice*/
38102 0, /*sq_inplace_concat*/
38103 0, /*sq_inplace_repeat*/
38106 static PyMappingMethods __pyx_tp_as_mapping_IndexedReads = {
38108 0, /*mp_subscript*/
38109 0, /*mp_ass_subscript*/
38112 static PyBufferProcs __pyx_tp_as_buffer_IndexedReads = {
38113 #if PY_MAJOR_VERSION < 3
38114 0, /*bf_getreadbuffer*/
38116 #if PY_MAJOR_VERSION < 3
38117 0, /*bf_getwritebuffer*/
38119 #if PY_MAJOR_VERSION < 3
38120 0, /*bf_getsegcount*/
38122 #if PY_MAJOR_VERSION < 3
38123 0, /*bf_getcharbuffer*/
38125 #if PY_VERSION_HEX >= 0x02060000
38126 0, /*bf_getbuffer*/
38128 #if PY_VERSION_HEX >= 0x02060000
38129 0, /*bf_releasebuffer*/
38133 static PyTypeObject __pyx_type_9csamtools_IndexedReads = {
38134 PyVarObject_HEAD_INIT(0, 0)
38135 __Pyx_NAMESTR("csamtools.IndexedReads"), /*tp_name*/
38136 sizeof(struct __pyx_obj_9csamtools_IndexedReads), /*tp_basicsize*/
38138 __pyx_tp_dealloc_9csamtools_IndexedReads, /*tp_dealloc*/
38142 #if PY_MAJOR_VERSION < 3
38148 &__pyx_tp_as_number_IndexedReads, /*tp_as_number*/
38149 &__pyx_tp_as_sequence_IndexedReads, /*tp_as_sequence*/
38150 &__pyx_tp_as_mapping_IndexedReads, /*tp_as_mapping*/
38156 &__pyx_tp_as_buffer_IndexedReads, /*tp_as_buffer*/
38157 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
38158 __Pyx_DOCSTR("IndexedReads(Samfile samfile, int reopen=True)\nindex a bamfile by read.\n\n The index is kept in memory.\n\n By default, the file is re-openend to avoid conflicts if\n multiple operators work on the same file. Set *reopen* = False\n to not re-open *samfile*.\n "), /*tp_doc*/
38159 __pyx_tp_traverse_9csamtools_IndexedReads, /*tp_traverse*/
38160 __pyx_tp_clear_9csamtools_IndexedReads, /*tp_clear*/
38161 0, /*tp_richcompare*/
38162 0, /*tp_weaklistoffset*/
38165 __pyx_methods_9csamtools_IndexedReads, /*tp_methods*/
38170 0, /*tp_descr_get*/
38171 0, /*tp_descr_set*/
38172 0, /*tp_dictoffset*/
38173 __pyx_pw_9csamtools_12IndexedReads_1__init__, /*tp_init*/
38175 __pyx_tp_new_9csamtools_IndexedReads, /*tp_new*/
38181 0, /*tp_subclasses*/
38184 #if PY_VERSION_HEX >= 0x02060000
38185 0, /*tp_version_tag*/
38189 static PyObject *__pyx_tp_new_9csamtools_SNPCall(PyTypeObject *t, PyObject *a, PyObject *k) {
38190 PyObject *o = (*t->tp_alloc)(t, 0);
38195 static void __pyx_tp_dealloc_9csamtools_SNPCall(PyObject *o) {
38196 (*Py_TYPE(o)->tp_free)(o);
38199 static PyObject *__pyx_getprop_9csamtools_7SNPCall_tid(PyObject *o, void *x) {
38200 return __pyx_pw_9csamtools_7SNPCall_3tid_1__get__(o);
38203 static PyObject *__pyx_getprop_9csamtools_7SNPCall_pos(PyObject *o, void *x) {
38204 return __pyx_pw_9csamtools_7SNPCall_3pos_1__get__(o);
38207 static PyObject *__pyx_getprop_9csamtools_7SNPCall_reference_base(PyObject *o, void *x) {
38208 return __pyx_pw_9csamtools_7SNPCall_14reference_base_1__get__(o);
38211 static PyObject *__pyx_getprop_9csamtools_7SNPCall_genotype(PyObject *o, void *x) {
38212 return __pyx_pw_9csamtools_7SNPCall_8genotype_1__get__(o);
38215 static PyObject *__pyx_getprop_9csamtools_7SNPCall_consensus_quality(PyObject *o, void *x) {
38216 return __pyx_pw_9csamtools_7SNPCall_17consensus_quality_1__get__(o);
38219 static PyObject *__pyx_getprop_9csamtools_7SNPCall_snp_quality(PyObject *o, void *x) {
38220 return __pyx_pw_9csamtools_7SNPCall_11snp_quality_1__get__(o);
38223 static PyObject *__pyx_getprop_9csamtools_7SNPCall_mapping_quality(PyObject *o, void *x) {
38224 return __pyx_pw_9csamtools_7SNPCall_15mapping_quality_1__get__(o);
38227 static PyObject *__pyx_getprop_9csamtools_7SNPCall_coverage(PyObject *o, void *x) {
38228 return __pyx_pw_9csamtools_7SNPCall_8coverage_1__get__(o);
38231 static PyMethodDef __pyx_methods_9csamtools_SNPCall[] = {
38235 static struct PyGetSetDef __pyx_getsets_9csamtools_SNPCall[] = {
38236 {(char *)"tid", __pyx_getprop_9csamtools_7SNPCall_tid, 0, __Pyx_DOCSTR(__pyx_k_234), 0},
38237 {(char *)"pos", __pyx_getprop_9csamtools_7SNPCall_pos, 0, __Pyx_DOCSTR(__pyx_k_242), 0},
38238 {(char *)"reference_base", __pyx_getprop_9csamtools_7SNPCall_reference_base, 0, __Pyx_DOCSTR(__pyx_k_243), 0},
38239 {(char *)"genotype", __pyx_getprop_9csamtools_7SNPCall_genotype, 0, __Pyx_DOCSTR(__pyx_k_244), 0},
38240 {(char *)"consensus_quality", __pyx_getprop_9csamtools_7SNPCall_consensus_quality, 0, __Pyx_DOCSTR(__pyx_k_245), 0},
38241 {(char *)"snp_quality", __pyx_getprop_9csamtools_7SNPCall_snp_quality, 0, __Pyx_DOCSTR(__pyx_k_246), 0},
38242 {(char *)"mapping_quality", __pyx_getprop_9csamtools_7SNPCall_mapping_quality, 0, __Pyx_DOCSTR(__pyx_k_247), 0},
38243 {(char *)"coverage", __pyx_getprop_9csamtools_7SNPCall_coverage, 0, __Pyx_DOCSTR(__pyx_k_248), 0},
38247 static PyNumberMethods __pyx_tp_as_number_SNPCall = {
38251 #if PY_MAJOR_VERSION < 3
38254 0, /*nb_remainder*/
38267 #if PY_MAJOR_VERSION < 3
38271 #if PY_MAJOR_VERSION < 3
38277 #if PY_MAJOR_VERSION < 3
38280 #if PY_MAJOR_VERSION < 3
38283 0, /*nb_inplace_add*/
38284 0, /*nb_inplace_subtract*/
38285 0, /*nb_inplace_multiply*/
38286 #if PY_MAJOR_VERSION < 3
38287 0, /*nb_inplace_divide*/
38289 0, /*nb_inplace_remainder*/
38290 0, /*nb_inplace_power*/
38291 0, /*nb_inplace_lshift*/
38292 0, /*nb_inplace_rshift*/
38293 0, /*nb_inplace_and*/
38294 0, /*nb_inplace_xor*/
38295 0, /*nb_inplace_or*/
38296 0, /*nb_floor_divide*/
38297 0, /*nb_true_divide*/
38298 0, /*nb_inplace_floor_divide*/
38299 0, /*nb_inplace_true_divide*/
38300 #if PY_VERSION_HEX >= 0x02050000
38305 static PySequenceMethods __pyx_tp_as_sequence_SNPCall = {
38312 0, /*sq_ass_slice*/
38314 0, /*sq_inplace_concat*/
38315 0, /*sq_inplace_repeat*/
38318 static PyMappingMethods __pyx_tp_as_mapping_SNPCall = {
38320 0, /*mp_subscript*/
38321 0, /*mp_ass_subscript*/
38324 static PyBufferProcs __pyx_tp_as_buffer_SNPCall = {
38325 #if PY_MAJOR_VERSION < 3
38326 0, /*bf_getreadbuffer*/
38328 #if PY_MAJOR_VERSION < 3
38329 0, /*bf_getwritebuffer*/
38331 #if PY_MAJOR_VERSION < 3
38332 0, /*bf_getsegcount*/
38334 #if PY_MAJOR_VERSION < 3
38335 0, /*bf_getcharbuffer*/
38337 #if PY_VERSION_HEX >= 0x02060000
38338 0, /*bf_getbuffer*/
38340 #if PY_VERSION_HEX >= 0x02060000
38341 0, /*bf_releasebuffer*/
38345 static PyTypeObject __pyx_type_9csamtools_SNPCall = {
38346 PyVarObject_HEAD_INIT(0, 0)
38347 __Pyx_NAMESTR("csamtools.SNPCall"), /*tp_name*/
38348 sizeof(struct __pyx_obj_9csamtools_SNPCall), /*tp_basicsize*/
38350 __pyx_tp_dealloc_9csamtools_SNPCall, /*tp_dealloc*/
38354 #if PY_MAJOR_VERSION < 3
38360 &__pyx_tp_as_number_SNPCall, /*tp_as_number*/
38361 &__pyx_tp_as_sequence_SNPCall, /*tp_as_sequence*/
38362 &__pyx_tp_as_mapping_SNPCall, /*tp_as_mapping*/
38365 __pyx_pw_9csamtools_7SNPCall_1__str__, /*tp_str*/
38368 &__pyx_tp_as_buffer_SNPCall, /*tp_as_buffer*/
38369 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
38370 __Pyx_DOCSTR("the results of a SNP call."), /*tp_doc*/
38373 0, /*tp_richcompare*/
38374 0, /*tp_weaklistoffset*/
38377 __pyx_methods_9csamtools_SNPCall, /*tp_methods*/
38379 __pyx_getsets_9csamtools_SNPCall, /*tp_getset*/
38382 0, /*tp_descr_get*/
38383 0, /*tp_descr_set*/
38384 0, /*tp_dictoffset*/
38387 __pyx_tp_new_9csamtools_SNPCall, /*tp_new*/
38393 0, /*tp_subclasses*/
38396 #if PY_VERSION_HEX >= 0x02060000
38397 0, /*tp_version_tag*/
38401 static PyObject *__pyx_tp_new_9csamtools___pyx_scope_struct__genexpr(PyTypeObject *t, PyObject *a, PyObject *k) {
38402 struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *p;
38403 PyObject *o = (*t->tp_alloc)(t, 0);
38405 p = ((struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *)o);
38413 static void __pyx_tp_dealloc_9csamtools___pyx_scope_struct__genexpr(PyObject *o) {
38414 struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *p = (struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *)o;
38415 Py_XDECREF(p->__pyx_v_x);
38416 Py_XDECREF(p->__pyx_v_y);
38417 Py_XDECREF(p->__pyx_t_0);
38418 Py_XDECREF(p->__pyx_t_1);
38419 (*Py_TYPE(o)->tp_free)(o);
38422 static int __pyx_tp_traverse_9csamtools___pyx_scope_struct__genexpr(PyObject *o, visitproc v, void *a) {
38424 struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *p = (struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *)o;
38425 if (p->__pyx_v_x) {
38426 e = (*v)(p->__pyx_v_x, a); if (e) return e;
38428 if (p->__pyx_v_y) {
38429 e = (*v)(p->__pyx_v_y, a); if (e) return e;
38431 if (p->__pyx_t_0) {
38432 e = (*v)(p->__pyx_t_0, a); if (e) return e;
38434 if (p->__pyx_t_1) {
38435 e = (*v)(p->__pyx_t_1, a); if (e) return e;
38440 static int __pyx_tp_clear_9csamtools___pyx_scope_struct__genexpr(PyObject *o) {
38441 struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *p = (struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr *)o;
38443 tmp = ((PyObject*)p->__pyx_v_x);
38444 p->__pyx_v_x = Py_None; Py_INCREF(Py_None);
38446 tmp = ((PyObject*)p->__pyx_v_y);
38447 p->__pyx_v_y = Py_None; Py_INCREF(Py_None);
38449 tmp = ((PyObject*)p->__pyx_t_0);
38450 p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
38452 tmp = ((PyObject*)p->__pyx_t_1);
38453 p->__pyx_t_1 = Py_None; Py_INCREF(Py_None);
38458 static PyMethodDef __pyx_methods_9csamtools___pyx_scope_struct__genexpr[] = {
38462 static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct__genexpr = {
38466 #if PY_MAJOR_VERSION < 3
38469 0, /*nb_remainder*/
38482 #if PY_MAJOR_VERSION < 3
38486 #if PY_MAJOR_VERSION < 3
38492 #if PY_MAJOR_VERSION < 3
38495 #if PY_MAJOR_VERSION < 3
38498 0, /*nb_inplace_add*/
38499 0, /*nb_inplace_subtract*/
38500 0, /*nb_inplace_multiply*/
38501 #if PY_MAJOR_VERSION < 3
38502 0, /*nb_inplace_divide*/
38504 0, /*nb_inplace_remainder*/
38505 0, /*nb_inplace_power*/
38506 0, /*nb_inplace_lshift*/
38507 0, /*nb_inplace_rshift*/
38508 0, /*nb_inplace_and*/
38509 0, /*nb_inplace_xor*/
38510 0, /*nb_inplace_or*/
38511 0, /*nb_floor_divide*/
38512 0, /*nb_true_divide*/
38513 0, /*nb_inplace_floor_divide*/
38514 0, /*nb_inplace_true_divide*/
38515 #if PY_VERSION_HEX >= 0x02050000
38520 static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct__genexpr = {
38527 0, /*sq_ass_slice*/
38529 0, /*sq_inplace_concat*/
38530 0, /*sq_inplace_repeat*/
38533 static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct__genexpr = {
38535 0, /*mp_subscript*/
38536 0, /*mp_ass_subscript*/
38539 static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct__genexpr = {
38540 #if PY_MAJOR_VERSION < 3
38541 0, /*bf_getreadbuffer*/
38543 #if PY_MAJOR_VERSION < 3
38544 0, /*bf_getwritebuffer*/
38546 #if PY_MAJOR_VERSION < 3
38547 0, /*bf_getsegcount*/
38549 #if PY_MAJOR_VERSION < 3
38550 0, /*bf_getcharbuffer*/
38552 #if PY_VERSION_HEX >= 0x02060000
38553 0, /*bf_getbuffer*/
38555 #if PY_VERSION_HEX >= 0x02060000
38556 0, /*bf_releasebuffer*/
38560 static PyTypeObject __pyx_type_9csamtools___pyx_scope_struct__genexpr = {
38561 PyVarObject_HEAD_INIT(0, 0)
38562 __Pyx_NAMESTR("csamtools.__pyx_scope_struct__genexpr"), /*tp_name*/
38563 sizeof(struct __pyx_obj_9csamtools___pyx_scope_struct__genexpr), /*tp_basicsize*/
38565 __pyx_tp_dealloc_9csamtools___pyx_scope_struct__genexpr, /*tp_dealloc*/
38569 #if PY_MAJOR_VERSION < 3
38575 &__pyx_tp_as_number___pyx_scope_struct__genexpr, /*tp_as_number*/
38576 &__pyx_tp_as_sequence___pyx_scope_struct__genexpr, /*tp_as_sequence*/
38577 &__pyx_tp_as_mapping___pyx_scope_struct__genexpr, /*tp_as_mapping*/
38583 &__pyx_tp_as_buffer___pyx_scope_struct__genexpr, /*tp_as_buffer*/
38584 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
38586 __pyx_tp_traverse_9csamtools___pyx_scope_struct__genexpr, /*tp_traverse*/
38587 __pyx_tp_clear_9csamtools___pyx_scope_struct__genexpr, /*tp_clear*/
38588 0, /*tp_richcompare*/
38589 0, /*tp_weaklistoffset*/
38592 __pyx_methods_9csamtools___pyx_scope_struct__genexpr, /*tp_methods*/
38597 0, /*tp_descr_get*/
38598 0, /*tp_descr_set*/
38599 0, /*tp_dictoffset*/
38602 __pyx_tp_new_9csamtools___pyx_scope_struct__genexpr, /*tp_new*/
38608 0, /*tp_subclasses*/
38611 #if PY_VERSION_HEX >= 0x02060000
38612 0, /*tp_version_tag*/
38616 static PyObject *__pyx_tp_new_9csamtools___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k) {
38617 struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *p;
38618 PyObject *o = (*t->tp_alloc)(t, 0);
38620 p = ((struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *)o);
38628 static void __pyx_tp_dealloc_9csamtools___pyx_scope_struct_1_genexpr(PyObject *o) {
38629 struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *)o;
38630 Py_XDECREF(p->__pyx_v_x);
38631 Py_XDECREF(p->__pyx_v_y);
38632 Py_XDECREF(p->__pyx_t_0);
38633 Py_XDECREF(p->__pyx_t_1);
38634 (*Py_TYPE(o)->tp_free)(o);
38637 static int __pyx_tp_traverse_9csamtools___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
38639 struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *)o;
38640 if (p->__pyx_v_x) {
38641 e = (*v)(p->__pyx_v_x, a); if (e) return e;
38643 if (p->__pyx_v_y) {
38644 e = (*v)(p->__pyx_v_y, a); if (e) return e;
38646 if (p->__pyx_t_0) {
38647 e = (*v)(p->__pyx_t_0, a); if (e) return e;
38649 if (p->__pyx_t_1) {
38650 e = (*v)(p->__pyx_t_1, a); if (e) return e;
38655 static int __pyx_tp_clear_9csamtools___pyx_scope_struct_1_genexpr(PyObject *o) {
38656 struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr *)o;
38658 tmp = ((PyObject*)p->__pyx_v_x);
38659 p->__pyx_v_x = Py_None; Py_INCREF(Py_None);
38661 tmp = ((PyObject*)p->__pyx_v_y);
38662 p->__pyx_v_y = Py_None; Py_INCREF(Py_None);
38664 tmp = ((PyObject*)p->__pyx_t_0);
38665 p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
38667 tmp = ((PyObject*)p->__pyx_t_1);
38668 p->__pyx_t_1 = Py_None; Py_INCREF(Py_None);
38673 static PyMethodDef __pyx_methods_9csamtools___pyx_scope_struct_1_genexpr[] = {
38677 static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_1_genexpr = {
38681 #if PY_MAJOR_VERSION < 3
38684 0, /*nb_remainder*/
38697 #if PY_MAJOR_VERSION < 3
38701 #if PY_MAJOR_VERSION < 3
38707 #if PY_MAJOR_VERSION < 3
38710 #if PY_MAJOR_VERSION < 3
38713 0, /*nb_inplace_add*/
38714 0, /*nb_inplace_subtract*/
38715 0, /*nb_inplace_multiply*/
38716 #if PY_MAJOR_VERSION < 3
38717 0, /*nb_inplace_divide*/
38719 0, /*nb_inplace_remainder*/
38720 0, /*nb_inplace_power*/
38721 0, /*nb_inplace_lshift*/
38722 0, /*nb_inplace_rshift*/
38723 0, /*nb_inplace_and*/
38724 0, /*nb_inplace_xor*/
38725 0, /*nb_inplace_or*/
38726 0, /*nb_floor_divide*/
38727 0, /*nb_true_divide*/
38728 0, /*nb_inplace_floor_divide*/
38729 0, /*nb_inplace_true_divide*/
38730 #if PY_VERSION_HEX >= 0x02050000
38735 static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_1_genexpr = {
38742 0, /*sq_ass_slice*/
38744 0, /*sq_inplace_concat*/
38745 0, /*sq_inplace_repeat*/
38748 static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_1_genexpr = {
38750 0, /*mp_subscript*/
38751 0, /*mp_ass_subscript*/
38754 static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_1_genexpr = {
38755 #if PY_MAJOR_VERSION < 3
38756 0, /*bf_getreadbuffer*/
38758 #if PY_MAJOR_VERSION < 3
38759 0, /*bf_getwritebuffer*/
38761 #if PY_MAJOR_VERSION < 3
38762 0, /*bf_getsegcount*/
38764 #if PY_MAJOR_VERSION < 3
38765 0, /*bf_getcharbuffer*/
38767 #if PY_VERSION_HEX >= 0x02060000
38768 0, /*bf_getbuffer*/
38770 #if PY_VERSION_HEX >= 0x02060000
38771 0, /*bf_releasebuffer*/
38775 static PyTypeObject __pyx_type_9csamtools___pyx_scope_struct_1_genexpr = {
38776 PyVarObject_HEAD_INIT(0, 0)
38777 __Pyx_NAMESTR("csamtools.__pyx_scope_struct_1_genexpr"), /*tp_name*/
38778 sizeof(struct __pyx_obj_9csamtools___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
38780 __pyx_tp_dealloc_9csamtools___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
38784 #if PY_MAJOR_VERSION < 3
38790 &__pyx_tp_as_number___pyx_scope_struct_1_genexpr, /*tp_as_number*/
38791 &__pyx_tp_as_sequence___pyx_scope_struct_1_genexpr, /*tp_as_sequence*/
38792 &__pyx_tp_as_mapping___pyx_scope_struct_1_genexpr, /*tp_as_mapping*/
38798 &__pyx_tp_as_buffer___pyx_scope_struct_1_genexpr, /*tp_as_buffer*/
38799 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
38801 __pyx_tp_traverse_9csamtools___pyx_scope_struct_1_genexpr, /*tp_traverse*/
38802 __pyx_tp_clear_9csamtools___pyx_scope_struct_1_genexpr, /*tp_clear*/
38803 0, /*tp_richcompare*/
38804 0, /*tp_weaklistoffset*/
38807 __pyx_methods_9csamtools___pyx_scope_struct_1_genexpr, /*tp_methods*/
38812 0, /*tp_descr_get*/
38813 0, /*tp_descr_set*/
38814 0, /*tp_dictoffset*/
38817 __pyx_tp_new_9csamtools___pyx_scope_struct_1_genexpr, /*tp_new*/
38823 0, /*tp_subclasses*/
38826 #if PY_VERSION_HEX >= 0x02060000
38827 0, /*tp_version_tag*/
38831 static PyMethodDef __pyx_methods[] = {
38835 #if PY_MAJOR_VERSION >= 3
38836 static struct PyModuleDef __pyx_moduledef = {
38837 PyModuleDef_HEAD_INIT,
38838 __Pyx_NAMESTR("csamtools"),
38841 __pyx_methods /* m_methods */,
38842 NULL, /* m_reload */
38843 NULL, /* m_traverse */
38844 NULL, /* m_clear */
38849 static __Pyx_StringTabEntry __pyx_string_tab[] = {
38850 {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0},
38851 {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
38852 {&__pyx_kp_s_100, __pyx_k_100, sizeof(__pyx_k_100), 0, 0, 1, 0},
38853 {&__pyx_kp_s_102, __pyx_k_102, sizeof(__pyx_k_102), 0, 0, 1, 0},
38854 {&__pyx_kp_s_104, __pyx_k_104, sizeof(__pyx_k_104), 0, 0, 1, 0},
38855 {&__pyx_kp_s_105, __pyx_k_105, sizeof(__pyx_k_105), 0, 0, 1, 0},
38856 {&__pyx_kp_s_107, __pyx_k_107, sizeof(__pyx_k_107), 0, 0, 1, 0},
38857 {&__pyx_kp_s_108, __pyx_k_108, sizeof(__pyx_k_108), 0, 0, 1, 0},
38858 {&__pyx_kp_s_109, __pyx_k_109, sizeof(__pyx_k_109), 0, 0, 1, 0},
38859 {&__pyx_kp_s_110, __pyx_k_110, sizeof(__pyx_k_110), 0, 0, 1, 0},
38860 {&__pyx_kp_s_111, __pyx_k_111, sizeof(__pyx_k_111), 0, 0, 1, 0},
38861 {&__pyx_kp_s_113, __pyx_k_113, sizeof(__pyx_k_113), 0, 0, 1, 0},
38862 {&__pyx_kp_s_116, __pyx_k_116, sizeof(__pyx_k_116), 0, 0, 1, 0},
38863 {&__pyx_kp_s_119, __pyx_k_119, sizeof(__pyx_k_119), 0, 0, 1, 0},
38864 {&__pyx_kp_s_125, __pyx_k_125, sizeof(__pyx_k_125), 0, 0, 1, 0},
38865 {&__pyx_kp_s_126, __pyx_k_126, sizeof(__pyx_k_126), 0, 0, 1, 0},
38866 {&__pyx_kp_s_127, __pyx_k_127, sizeof(__pyx_k_127), 0, 0, 1, 0},
38867 {&__pyx_kp_s_129, __pyx_k_129, sizeof(__pyx_k_129), 0, 0, 1, 0},
38868 {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
38869 {&__pyx_kp_s_135, __pyx_k_135, sizeof(__pyx_k_135), 0, 0, 1, 0},
38870 {&__pyx_kp_s_136, __pyx_k_136, sizeof(__pyx_k_136), 0, 0, 1, 0},
38871 {&__pyx_kp_s_137, __pyx_k_137, sizeof(__pyx_k_137), 0, 0, 1, 0},
38872 {&__pyx_kp_s_138, __pyx_k_138, sizeof(__pyx_k_138), 0, 0, 1, 0},
38873 {&__pyx_kp_s_140, __pyx_k_140, sizeof(__pyx_k_140), 0, 0, 1, 0},
38874 {&__pyx_kp_s_141, __pyx_k_141, sizeof(__pyx_k_141), 0, 0, 1, 0},
38875 {&__pyx_kp_s_145, __pyx_k_145, sizeof(__pyx_k_145), 0, 0, 1, 0},
38876 {&__pyx_n_s_147, __pyx_k_147, sizeof(__pyx_k_147), 0, 0, 1, 1},
38877 {&__pyx_kp_s_148, __pyx_k_148, sizeof(__pyx_k_148), 0, 0, 1, 0},
38878 {&__pyx_kp_s_149, __pyx_k_149, sizeof(__pyx_k_149), 0, 0, 1, 0},
38879 {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
38880 {&__pyx_kp_s_150, __pyx_k_150, sizeof(__pyx_k_150), 0, 0, 1, 0},
38881 {&__pyx_kp_s_151, __pyx_k_151, sizeof(__pyx_k_151), 0, 0, 1, 0},
38882 {&__pyx_kp_s_152, __pyx_k_152, sizeof(__pyx_k_152), 0, 0, 1, 0},
38883 {&__pyx_kp_s_153, __pyx_k_153, sizeof(__pyx_k_153), 0, 0, 1, 0},
38884 {&__pyx_kp_s_154, __pyx_k_154, sizeof(__pyx_k_154), 0, 0, 1, 0},
38885 {&__pyx_kp_s_155, __pyx_k_155, sizeof(__pyx_k_155), 0, 0, 1, 0},
38886 {&__pyx_kp_s_156, __pyx_k_156, sizeof(__pyx_k_156), 0, 0, 1, 0},
38887 {&__pyx_kp_s_157, __pyx_k_157, sizeof(__pyx_k_157), 0, 0, 1, 0},
38888 {&__pyx_kp_s_158, __pyx_k_158, sizeof(__pyx_k_158), 0, 0, 1, 0},
38889 {&__pyx_kp_s_159, __pyx_k_159, sizeof(__pyx_k_159), 0, 0, 1, 0},
38890 {&__pyx_kp_b_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 0, 0},
38891 {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
38892 {&__pyx_kp_s_160, __pyx_k_160, sizeof(__pyx_k_160), 0, 0, 1, 0},
38893 {&__pyx_kp_s_161, __pyx_k_161, sizeof(__pyx_k_161), 0, 0, 1, 0},
38894 {&__pyx_kp_s_162, __pyx_k_162, sizeof(__pyx_k_162), 0, 0, 1, 0},
38895 {&__pyx_kp_s_163, __pyx_k_163, sizeof(__pyx_k_163), 0, 0, 1, 0},
38896 {&__pyx_kp_s_164, __pyx_k_164, sizeof(__pyx_k_164), 0, 0, 1, 0},
38897 {&__pyx_kp_s_165, __pyx_k_165, sizeof(__pyx_k_165), 0, 0, 1, 0},
38898 {&__pyx_kp_s_166, __pyx_k_166, sizeof(__pyx_k_166), 0, 0, 1, 0},
38899 {&__pyx_kp_s_167, __pyx_k_167, sizeof(__pyx_k_167), 0, 0, 1, 0},
38900 {&__pyx_kp_s_168, __pyx_k_168, sizeof(__pyx_k_168), 0, 0, 1, 0},
38901 {&__pyx_kp_s_169, __pyx_k_169, sizeof(__pyx_k_169), 0, 0, 1, 0},
38902 {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
38903 {&__pyx_kp_s_170, __pyx_k_170, sizeof(__pyx_k_170), 0, 0, 1, 0},
38904 {&__pyx_kp_s_171, __pyx_k_171, sizeof(__pyx_k_171), 0, 0, 1, 0},
38905 {&__pyx_kp_s_173, __pyx_k_173, sizeof(__pyx_k_173), 0, 0, 1, 0},
38906 {&__pyx_kp_s_177, __pyx_k_177, sizeof(__pyx_k_177), 0, 0, 1, 0},
38907 {&__pyx_kp_s_178, __pyx_k_178, sizeof(__pyx_k_178), 0, 0, 1, 0},
38908 {&__pyx_kp_s_179, __pyx_k_179, sizeof(__pyx_k_179), 0, 0, 1, 0},
38909 {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
38910 {&__pyx_kp_s_185, __pyx_k_185, sizeof(__pyx_k_185), 0, 0, 1, 0},
38911 {&__pyx_kp_s_186, __pyx_k_186, sizeof(__pyx_k_186), 0, 0, 1, 0},
38912 {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
38913 {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
38914 {&__pyx_n_s_249, __pyx_k_249, sizeof(__pyx_k_249), 0, 0, 1, 1},
38915 {&__pyx_kp_s_251, __pyx_k_251, sizeof(__pyx_k_251), 0, 0, 1, 0},
38916 {&__pyx_kp_s_256, __pyx_k_256, sizeof(__pyx_k_256), 0, 0, 1, 0},
38917 {&__pyx_kp_s_257, __pyx_k_257, sizeof(__pyx_k_257), 0, 0, 1, 0},
38918 {&__pyx_kp_s_266, __pyx_k_266, sizeof(__pyx_k_266), 0, 0, 1, 0},
38919 {&__pyx_kp_s_273, __pyx_k_273, sizeof(__pyx_k_273), 0, 0, 1, 0},
38920 {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
38921 {&__pyx_kp_s_290, __pyx_k_290, sizeof(__pyx_k_290), 0, 0, 1, 0},
38922 {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0},
38923 {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
38924 {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
38925 {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
38926 {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
38927 {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
38928 {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
38929 {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0},
38930 {&__pyx_kp_b_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 0, 0},
38931 {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
38932 {&__pyx_kp_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 0},
38933 {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0},
38934 {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0},
38935 {&__pyx_kp_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 0},
38936 {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0},
38937 {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
38938 {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0},
38939 {&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0},
38940 {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0},
38941 {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
38942 {&__pyx_kp_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 0},
38943 {&__pyx_kp_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 0},
38944 {&__pyx_kp_s_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 0, 1, 0},
38945 {&__pyx_kp_s_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 0, 1, 0},
38946 {&__pyx_kp_s_69, __pyx_k_69, sizeof(__pyx_k_69), 0, 0, 1, 0},
38947 {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
38948 {&__pyx_kp_s_70, __pyx_k_70, sizeof(__pyx_k_70), 0, 0, 1, 0},
38949 {&__pyx_kp_s_71, __pyx_k_71, sizeof(__pyx_k_71), 0, 0, 1, 0},
38950 {&__pyx_kp_s_76, __pyx_k_76, sizeof(__pyx_k_76), 0, 0, 1, 0},
38951 {&__pyx_kp_s_79, __pyx_k_79, sizeof(__pyx_k_79), 0, 0, 1, 0},
38952 {&__pyx_kp_s_82, __pyx_k_82, sizeof(__pyx_k_82), 0, 0, 1, 0},
38953 {&__pyx_kp_s_85, __pyx_k_85, sizeof(__pyx_k_85), 0, 0, 1, 0},
38954 {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
38955 {&__pyx_kp_s_92, __pyx_k_92, sizeof(__pyx_k_92), 0, 0, 1, 0},
38956 {&__pyx_kp_s_95, __pyx_k_95, sizeof(__pyx_k_95), 0, 0, 1, 0},
38957 {&__pyx_kp_s__2scB, __pyx_k__2scB, sizeof(__pyx_k__2scB), 0, 0, 1, 0},
38958 {&__pyx_kp_s__2scH, __pyx_k__2scH, sizeof(__pyx_k__2scH), 0, 0, 1, 0},
38959 {&__pyx_kp_s__2scI, __pyx_k__2scI, sizeof(__pyx_k__2scI), 0, 0, 1, 0},
38960 {&__pyx_kp_s__2scb, __pyx_k__2scb, sizeof(__pyx_k__2scb), 0, 0, 1, 0},
38961 {&__pyx_kp_s__2scc, __pyx_k__2scc, sizeof(__pyx_k__2scc), 0, 0, 1, 0},
38962 {&__pyx_kp_s__2scf, __pyx_k__2scf, sizeof(__pyx_k__2scf), 0, 0, 1, 0},
38963 {&__pyx_kp_s__2sch, __pyx_k__2sch, sizeof(__pyx_k__2sch), 0, 0, 1, 0},
38964 {&__pyx_kp_s__2sci, __pyx_k__2sci, sizeof(__pyx_k__2sci), 0, 0, 1, 0},
38965 {&__pyx_n_s__A, __pyx_k__A, sizeof(__pyx_k__A), 0, 0, 1, 1},
38966 {&__pyx_n_s__AS, __pyx_k__AS, sizeof(__pyx_k__AS), 0, 0, 1, 1},
38967 {&__pyx_n_s__AlignedRead, __pyx_k__AlignedRead, sizeof(__pyx_k__AlignedRead), 0, 0, 1, 1},
38968 {&__pyx_n_s__AttributeError, __pyx_k__AttributeError, sizeof(__pyx_k__AttributeError), 0, 0, 1, 1},
38969 {&__pyx_n_s__B, __pyx_k__B, sizeof(__pyx_k__B), 0, 0, 1, 1},
38970 {&__pyx_n_s__C, __pyx_k__C, sizeof(__pyx_k__C), 0, 0, 1, 1},
38971 {&__pyx_n_s__CIGAR2CODE, __pyx_k__CIGAR2CODE, sizeof(__pyx_k__CIGAR2CODE), 0, 0, 1, 1},
38972 {&__pyx_n_s__CIGAR_REGEX, __pyx_k__CIGAR_REGEX, sizeof(__pyx_k__CIGAR_REGEX), 0, 0, 1, 1},
38973 {&__pyx_n_s__CL, __pyx_k__CL, sizeof(__pyx_k__CL), 0, 0, 1, 1},
38974 {&__pyx_n_s__CN, __pyx_k__CN, sizeof(__pyx_k__CN), 0, 0, 1, 1},
38975 {&__pyx_n_s__CO, __pyx_k__CO, sizeof(__pyx_k__CO), 0, 0, 1, 1},
38976 {&__pyx_n_s__D, __pyx_k__D, sizeof(__pyx_k__D), 0, 0, 1, 1},
38977 {&__pyx_n_s__DS, __pyx_k__DS, sizeof(__pyx_k__DS), 0, 0, 1, 1},
38978 {&__pyx_n_s__DT, __pyx_k__DT, sizeof(__pyx_k__DT), 0, 0, 1, 1},
38979 {&__pyx_n_s__F, __pyx_k__F, sizeof(__pyx_k__F), 0, 0, 1, 1},
38980 {&__pyx_n_s__FO, __pyx_k__FO, sizeof(__pyx_k__FO), 0, 0, 1, 1},
38981 {&__pyx_n_s__Fastafile, __pyx_k__Fastafile, sizeof(__pyx_k__Fastafile), 0, 0, 1, 1},
38982 {&__pyx_n_s__GO, __pyx_k__GO, sizeof(__pyx_k__GO), 0, 0, 1, 1},
38983 {&__pyx_n_s__H, __pyx_k__H, sizeof(__pyx_k__H), 0, 0, 1, 1},
38984 {&__pyx_n_s__HD, __pyx_k__HD, sizeof(__pyx_k__HD), 0, 0, 1, 1},
38985 {&__pyx_n_s__I, __pyx_k__I, sizeof(__pyx_k__I), 0, 0, 1, 1},
38986 {&__pyx_n_s__ID, __pyx_k__ID, sizeof(__pyx_k__ID), 0, 0, 1, 1},
38987 {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1},
38988 {&__pyx_n_s__IS_PYTHON3, __pyx_k__IS_PYTHON3, sizeof(__pyx_k__IS_PYTHON3), 0, 0, 1, 1},
38989 {&__pyx_n_s__IndexedReads, __pyx_k__IndexedReads, sizeof(__pyx_k__IndexedReads), 0, 0, 1, 1},
38990 {&__pyx_n_s__IteratorColumn, __pyx_k__IteratorColumn, sizeof(__pyx_k__IteratorColumn), 0, 0, 1, 1},
38991 {&__pyx_n_s__IteratorRow, __pyx_k__IteratorRow, sizeof(__pyx_k__IteratorRow), 0, 0, 1, 1},
38992 {&__pyx_n_s__KS, __pyx_k__KS, sizeof(__pyx_k__KS), 0, 0, 1, 1},
38993 {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1},
38994 {&__pyx_n_s__LB, __pyx_k__LB, sizeof(__pyx_k__LB), 0, 0, 1, 1},
38995 {&__pyx_n_s__LN, __pyx_k__LN, sizeof(__pyx_k__LN), 0, 0, 1, 1},
38996 {&__pyx_n_s__M5, __pyx_k__M5, sizeof(__pyx_k__M5), 0, 0, 1, 1},
38997 {&__pyx_n_s__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1},
38998 {&__pyx_n_s__OSError, __pyx_k__OSError, sizeof(__pyx_k__OSError), 0, 0, 1, 1},
38999 {&__pyx_n_s__O_CREAT, __pyx_k__O_CREAT, sizeof(__pyx_k__O_CREAT), 0, 0, 1, 1},
39000 {&__pyx_n_s__O_WRONLY, __pyx_k__O_WRONLY, sizeof(__pyx_k__O_WRONLY), 0, 0, 1, 1},
39001 {&__pyx_n_s__Outs, __pyx_k__Outs, sizeof(__pyx_k__Outs), 0, 0, 1, 1},
39002 {&__pyx_n_s__OverflowError, __pyx_k__OverflowError, sizeof(__pyx_k__OverflowError), 0, 0, 1, 1},
39003 {&__pyx_n_s__PG, __pyx_k__PG, sizeof(__pyx_k__PG), 0, 0, 1, 1},
39004 {&__pyx_n_s__PI, __pyx_k__PI, sizeof(__pyx_k__PI), 0, 0, 1, 1},
39005 {&__pyx_n_s__PL, __pyx_k__PL, sizeof(__pyx_k__PL), 0, 0, 1, 1},
39006 {&__pyx_n_s__PN, __pyx_k__PN, sizeof(__pyx_k__PN), 0, 0, 1, 1},
39007 {&__pyx_n_s__PU, __pyx_k__PU, sizeof(__pyx_k__PU), 0, 0, 1, 1},
39008 {&__pyx_n_s__PileupColumn, __pyx_k__PileupColumn, sizeof(__pyx_k__PileupColumn), 0, 0, 1, 1},
39009 {&__pyx_n_s__PileupProxy, __pyx_k__PileupProxy, sizeof(__pyx_k__PileupProxy), 0, 0, 1, 1},
39010 {&__pyx_n_s__PileupRead, __pyx_k__PileupRead, sizeof(__pyx_k__PileupRead), 0, 0, 1, 1},
39011 {&__pyx_n_s__RG, __pyx_k__RG, sizeof(__pyx_k__RG), 0, 0, 1, 1},
39012 {&__pyx_n_s__S, __pyx_k__S, sizeof(__pyx_k__S), 0, 0, 1, 1},
39013 {&__pyx_n_s__SM, __pyx_k__SM, sizeof(__pyx_k__SM), 0, 0, 1, 1},
39014 {&__pyx_n_s__SN, __pyx_k__SN, sizeof(__pyx_k__SN), 0, 0, 1, 1},
39015 {&__pyx_n_s__SO, __pyx_k__SO, sizeof(__pyx_k__SO), 0, 0, 1, 1},
39016 {&__pyx_n_s__SP, __pyx_k__SP, sizeof(__pyx_k__SP), 0, 0, 1, 1},
39017 {&__pyx_n_s__SQ, __pyx_k__SQ, sizeof(__pyx_k__SQ), 0, 0, 1, 1},
39018 {&__pyx_n_s__Samfile, __pyx_k__Samfile, sizeof(__pyx_k__Samfile), 0, 0, 1, 1},
39019 {&__pyx_n_s__StderrStore, __pyx_k__StderrStore, sizeof(__pyx_k__StderrStore), 0, 0, 1, 1},
39020 {&__pyx_n_s__StderrStoreWindows, __pyx_k__StderrStoreWindows, sizeof(__pyx_k__StderrStoreWindows), 0, 0, 1, 1},
39021 {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1},
39022 {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
39023 {&__pyx_n_s__UR, __pyx_k__UR, sizeof(__pyx_k__UR), 0, 0, 1, 1},
39024 {&__pyx_n_s__UnicodeDecodeError, __pyx_k__UnicodeDecodeError, sizeof(__pyx_k__UnicodeDecodeError), 0, 0, 1, 1},
39025 {&__pyx_n_s__VALID_HEADERS, __pyx_k__VALID_HEADERS, sizeof(__pyx_k__VALID_HEADERS), 0, 0, 1, 1},
39026 {&__pyx_n_s__VALID_HEADER_FIELDS, __pyx_k__VALID_HEADER_FIELDS, sizeof(__pyx_k__VALID_HEADER_FIELDS), 0, 0, 1, 1},
39027 {&__pyx_n_s__VALID_HEADER_ORDER, __pyx_k__VALID_HEADER_ORDER, sizeof(__pyx_k__VALID_HEADER_ORDER), 0, 0, 1, 1},
39028 {&__pyx_n_s__VALID_HEADER_TYPES, __pyx_k__VALID_HEADER_TYPES, sizeof(__pyx_k__VALID_HEADER_TYPES), 0, 0, 1, 1},
39029 {&__pyx_n_s__VN, __pyx_k__VN, sizeof(__pyx_k__VN), 0, 0, 1, 1},
39030 {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
39031 {&__pyx_n_s__Windows, __pyx_k__Windows, sizeof(__pyx_k__Windows), 0, 0, 1, 1},
39032 {&__pyx_n_s__Z, __pyx_k__Z, sizeof(__pyx_k__Z), 0, 0, 1, 1},
39033 {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1},
39034 {&__pyx_n_s____del__, __pyx_k____del__, sizeof(__pyx_k____del__), 0, 0, 1, 1},
39035 {&__pyx_n_s____dict__, __pyx_k____dict__, sizeof(__pyx_k____dict__), 0, 0, 1, 1},
39036 {&__pyx_n_s____enter__, __pyx_k____enter__, sizeof(__pyx_k____enter__), 0, 0, 1, 1},
39037 {&__pyx_n_s____exit__, __pyx_k____exit__, sizeof(__pyx_k____exit__), 0, 0, 1, 1},
39038 {&__pyx_n_s____getattribute__, __pyx_k____getattribute__, sizeof(__pyx_k____getattribute__), 0, 0, 1, 1},
39039 {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
39040 {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
39041 {&__pyx_n_s____str__, __pyx_k____str__, sizeof(__pyx_k____str__), 0, 0, 1, 1},
39042 {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
39043 {&__pyx_n_s___buildLine, __pyx_k___buildLine, sizeof(__pyx_k___buildLine), 0, 0, 1, 1},
39044 {&__pyx_n_s___hasIndex, __pyx_k___hasIndex, sizeof(__pyx_k___hasIndex), 0, 0, 1, 1},
39045 {&__pyx_n_s___isOpen, __pyx_k___isOpen, sizeof(__pyx_k___isOpen), 0, 0, 1, 1},
39046 {&__pyx_n_s___open, __pyx_k___open, sizeof(__pyx_k___open), 0, 0, 1, 1},
39047 {&__pyx_n_s___parseRegion, __pyx_k___parseRegion, sizeof(__pyx_k___parseRegion), 0, 0, 1, 1},
39048 {&__pyx_n_s___samtools_dispatch, __pyx_k___samtools_dispatch, sizeof(__pyx_k___samtools_dispatch), 0, 0, 1, 1},
39049 {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1},
39050 {&__pyx_n_s__add_sq_text, __pyx_k__add_sq_text, sizeof(__pyx_k__add_sq_text), 0, 0, 1, 1},
39051 {&__pyx_n_s__alignment, __pyx_k__alignment, sizeof(__pyx_k__alignment), 0, 0, 1, 1},
39052 {&__pyx_n_s__all, __pyx_k__all, sizeof(__pyx_k__all), 0, 0, 1, 1},
39053 {&__pyx_n_s__args, __pyx_k__args, sizeof(__pyx_k__args), 0, 0, 1, 1},
39054 {&__pyx_n_s__ascii, __pyx_k__ascii, sizeof(__pyx_k__ascii), 0, 0, 1, 1},
39055 {&__pyx_n_s__b, __pyx_k__b, sizeof(__pyx_k__b), 0, 0, 1, 1},
39056 {&__pyx_n_s__beg, __pyx_k__beg, sizeof(__pyx_k__beg), 0, 0, 1, 1},
39057 {&__pyx_n_s__bin, __pyx_k__bin, sizeof(__pyx_k__bin), 0, 0, 1, 1},
39058 {&__pyx_n_s__bqual, __pyx_k__bqual, sizeof(__pyx_k__bqual), 0, 0, 1, 1},
39059 {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1},
39060 {&__pyx_n_s__calcsize, __pyx_k__calcsize, sizeof(__pyx_k__calcsize), 0, 0, 1, 1},
39061 {&__pyx_n_s__callback, __pyx_k__callback, sizeof(__pyx_k__callback), 0, 0, 1, 1},
39062 {&__pyx_n_s__cargs, __pyx_k__cargs, sizeof(__pyx_k__cargs), 0, 0, 1, 1},
39063 {&__pyx_n_s__catch_stdout, __pyx_k__catch_stdout, sizeof(__pyx_k__catch_stdout), 0, 0, 1, 1},
39064 {&__pyx_n_s__check_header, __pyx_k__check_header, sizeof(__pyx_k__check_header), 0, 0, 1, 1},
39065 {&__pyx_n_s__check_sq, __pyx_k__check_sq, sizeof(__pyx_k__check_sq), 0, 0, 1, 1},
39066 {&__pyx_n_s__chr, __pyx_k__chr, sizeof(__pyx_k__chr), 0, 0, 1, 1},
39067 {&__pyx_n_s__cigar, __pyx_k__cigar, sizeof(__pyx_k__cigar), 0, 0, 1, 1},
39068 {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1},
39069 {&__pyx_n_s__collections, __pyx_k__collections, sizeof(__pyx_k__collections), 0, 0, 1, 1},
39070 {&__pyx_n_s__compile, __pyx_k__compile, sizeof(__pyx_k__compile), 0, 0, 1, 1},
39071 {&__pyx_n_s__consensus_quality, __pyx_k__consensus_quality, sizeof(__pyx_k__consensus_quality), 0, 0, 1, 1},
39072 {&__pyx_n_s__coverage, __pyx_k__coverage, sizeof(__pyx_k__coverage), 0, 0, 1, 1},
39073 {&__pyx_n_s__csamtools, __pyx_k__csamtools, sizeof(__pyx_k__csamtools), 0, 0, 1, 1},
39074 {&__pyx_n_s__ctypes, __pyx_k__ctypes, sizeof(__pyx_k__ctypes), 0, 0, 1, 1},
39075 {&__pyx_n_s__d, __pyx_k__d, sizeof(__pyx_k__d), 0, 0, 1, 1},
39076 {&__pyx_n_s__data_len, __pyx_k__data_len, sizeof(__pyx_k__data_len), 0, 0, 1, 1},
39077 {&__pyx_n_s__decode, __pyx_k__decode, sizeof(__pyx_k__decode), 0, 0, 1, 1},
39078 {&__pyx_n_s__defaultdict, __pyx_k__defaultdict, sizeof(__pyx_k__defaultdict), 0, 0, 1, 1},
39079 {&__pyx_n_s__dup, __pyx_k__dup, sizeof(__pyx_k__dup), 0, 0, 1, 1},
39080 {&__pyx_n_s__dup2, __pyx_k__dup2, sizeof(__pyx_k__dup2), 0, 0, 1, 1},
39081 {&__pyx_n_s__encode, __pyx_k__encode, sizeof(__pyx_k__encode), 0, 0, 1, 1},
39082 {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1},
39083 {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1},
39084 {&__pyx_n_s__exc_type, __pyx_k__exc_type, sizeof(__pyx_k__exc_type), 0, 0, 1, 1},
39085 {&__pyx_n_s__exc_value, __pyx_k__exc_value, sizeof(__pyx_k__exc_value), 0, 0, 1, 1},
39086 {&__pyx_n_s__exists, __pyx_k__exists, sizeof(__pyx_k__exists), 0, 0, 1, 1},
39087 {&__pyx_n_s__extend, __pyx_k__extend, sizeof(__pyx_k__extend), 0, 0, 1, 1},
39088 {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1},
39089 {&__pyx_n_s__fastafile, __pyx_k__fastafile, sizeof(__pyx_k__fastafile), 0, 0, 1, 1},
39090 {&__pyx_n_s__fd, __pyx_k__fd, sizeof(__pyx_k__fd), 0, 0, 1, 1},
39091 {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1},
39092 {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1},
39093 {&__pyx_n_s__fileno, __pyx_k__fileno, sizeof(__pyx_k__fileno), 0, 0, 1, 1},
39094 {&__pyx_n_s__findall, __pyx_k__findall, sizeof(__pyx_k__findall), 0, 0, 1, 1},
39095 {&__pyx_n_s__flag, __pyx_k__flag, sizeof(__pyx_k__flag), 0, 0, 1, 1},
39096 {&__pyx_n_s__flush, __pyx_k__flush, sizeof(__pyx_k__flush), 0, 0, 1, 1},
39097 {&__pyx_n_s__genotype, __pyx_k__genotype, sizeof(__pyx_k__genotype), 0, 0, 1, 1},
39098 {&__pyx_n_s__getdefaultencoding, __pyx_k__getdefaultencoding, sizeof(__pyx_k__getdefaultencoding), 0, 0, 1, 1},
39099 {&__pyx_n_s__gettid, __pyx_k__gettid, sizeof(__pyx_k__gettid), 0, 0, 1, 1},
39100 {&__pyx_n_s__h, __pyx_k__h, sizeof(__pyx_k__h), 0, 0, 1, 1},
39101 {&__pyx_n_s__header, __pyx_k__header, sizeof(__pyx_k__header), 0, 0, 1, 1},
39102 {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
39103 {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1},
39104 {&__pyx_n_s__indel, __pyx_k__indel, sizeof(__pyx_k__indel), 0, 0, 1, 1},
39105 {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1},
39106 {&__pyx_n_s__inf, __pyx_k__inf, sizeof(__pyx_k__inf), 0, 0, 1, 1},
39107 {&__pyx_n_s__is_del, __pyx_k__is_del, sizeof(__pyx_k__is_del), 0, 0, 1, 1},
39108 {&__pyx_n_s__is_head, __pyx_k__is_head, sizeof(__pyx_k__is_head), 0, 0, 1, 1},
39109 {&__pyx_n_s__is_tail, __pyx_k__is_tail, sizeof(__pyx_k__is_tail), 0, 0, 1, 1},
39110 {&__pyx_n_s__isize, __pyx_k__isize, sizeof(__pyx_k__isize), 0, 0, 1, 1},
39111 {&__pyx_n_s__islower, __pyx_k__islower, sizeof(__pyx_k__islower), 0, 0, 1, 1},
39112 {&__pyx_n_s__isupper, __pyx_k__isupper, sizeof(__pyx_k__isupper), 0, 0, 1, 1},
39113 {&__pyx_n_s__items, __pyx_k__items, sizeof(__pyx_k__items), 0, 0, 1, 1},
39114 {&__pyx_n_s__itertools, __pyx_k__itertools, sizeof(__pyx_k__itertools), 0, 0, 1, 1},
39115 {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1},
39116 {&__pyx_n_s__l_aux, __pyx_k__l_aux, sizeof(__pyx_k__l_aux), 0, 0, 1, 1},
39117 {&__pyx_n_s__l_qname, __pyx_k__l_qname, sizeof(__pyx_k__l_qname), 0, 0, 1, 1},
39118 {&__pyx_n_s__l_qseq, __pyx_k__l_qseq, sizeof(__pyx_k__l_qseq), 0, 0, 1, 1},
39119 {&__pyx_n_s__lengths, __pyx_k__lengths, sizeof(__pyx_k__lengths), 0, 0, 1, 1},
39120 {&__pyx_n_s__level, __pyx_k__level, sizeof(__pyx_k__level), 0, 0, 1, 1},
39121 {&__pyx_n_s__m_data, __pyx_k__m_data, sizeof(__pyx_k__m_data), 0, 0, 1, 1},
39122 {&__pyx_n_s__map, __pyx_k__map, sizeof(__pyx_k__map), 0, 0, 1, 1},
39123 {&__pyx_n_s__mapping_quality, __pyx_k__mapping_quality, sizeof(__pyx_k__mapping_quality), 0, 0, 1, 1},
39124 {&__pyx_n_s__mapq, __pyx_k__mapq, sizeof(__pyx_k__mapq), 0, 0, 1, 1},
39125 {&__pyx_n_s__mask, __pyx_k__mask, sizeof(__pyx_k__mask), 0, 0, 1, 1},
39126 {&__pyx_n_s__max, __pyx_k__max, sizeof(__pyx_k__max), 0, 0, 1, 1},
39127 {&__pyx_n_s__max_depth, __pyx_k__max_depth, sizeof(__pyx_k__max_depth), 0, 0, 1, 1},
39128 {&__pyx_n_s__method, __pyx_k__method, sizeof(__pyx_k__method), 0, 0, 1, 1},
39129 {&__pyx_n_s__min, __pyx_k__min, sizeof(__pyx_k__min), 0, 0, 1, 1},
39130 {&__pyx_n_s__mkstemp, __pyx_k__mkstemp, sizeof(__pyx_k__mkstemp), 0, 0, 1, 1},
39131 {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1},
39132 {&__pyx_n_s__mpos, __pyx_k__mpos, sizeof(__pyx_k__mpos), 0, 0, 1, 1},
39133 {&__pyx_n_s__mrnm, __pyx_k__mrnm, sizeof(__pyx_k__mrnm), 0, 0, 1, 1},
39134 {&__pyx_n_s__mtid, __pyx_k__mtid, sizeof(__pyx_k__mtid), 0, 0, 1, 1},
39135 {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1},
39136 {&__pyx_n_s__n_cigar, __pyx_k__n_cigar, sizeof(__pyx_k__n_cigar), 0, 0, 1, 1},
39137 {&__pyx_n_s__nextiter, __pyx_k__nextiter, sizeof(__pyx_k__nextiter), 0, 0, 1, 1},
39138 {&__pyx_n_s__nreferences, __pyx_k__nreferences, sizeof(__pyx_k__nreferences), 0, 0, 1, 1},
39139 {&__pyx_n_s__object, __pyx_k__object, sizeof(__pyx_k__object), 0, 0, 1, 1},
39140 {&__pyx_n_s__ofd, __pyx_k__ofd, sizeof(__pyx_k__ofd), 0, 0, 1, 1},
39141 {&__pyx_n_s__offset, __pyx_k__offset, sizeof(__pyx_k__offset), 0, 0, 1, 1},
39142 {&__pyx_n_s__open, __pyx_k__open, sizeof(__pyx_k__open), 0, 0, 1, 1},
39143 {&__pyx_n_s__ord, __pyx_k__ord, sizeof(__pyx_k__ord), 0, 0, 1, 1},
39144 {&__pyx_n_s__os, __pyx_k__os, sizeof(__pyx_k__os), 0, 0, 1, 1},
39145 {&__pyx_n_s__out_stderr, __pyx_k__out_stderr, sizeof(__pyx_k__out_stderr), 0, 0, 1, 1},
39146 {&__pyx_n_s__out_stdout, __pyx_k__out_stdout, sizeof(__pyx_k__out_stdout), 0, 0, 1, 1},
39147 {&__pyx_n_s__pack_into, __pyx_k__pack_into, sizeof(__pyx_k__pack_into), 0, 0, 1, 1},
39148 {&__pyx_n_s__path, __pyx_k__path, sizeof(__pyx_k__path), 0, 0, 1, 1},
39149 {&__pyx_n_s__pileups, __pyx_k__pileups, sizeof(__pyx_k__pileups), 0, 0, 1, 1},
39150 {&__pyx_n_s__platform, __pyx_k__platform, sizeof(__pyx_k__platform), 0, 0, 1, 1},
39151 {&__pyx_n_s__port, __pyx_k__port, sizeof(__pyx_k__port), 0, 0, 1, 1},
39152 {&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1},
39153 {&__pyx_n_s__positions, __pyx_k__positions, sizeof(__pyx_k__positions), 0, 0, 1, 1},
39154 {&__pyx_n_s__qname, __pyx_k__qname, sizeof(__pyx_k__qname), 0, 0, 1, 1},
39155 {&__pyx_n_s__qpos, __pyx_k__qpos, sizeof(__pyx_k__qpos), 0, 0, 1, 1},
39156 {&__pyx_n_s__qseq, __pyx_k__qseq, sizeof(__pyx_k__qseq), 0, 0, 1, 1},
39157 {&__pyx_n_s__qual, __pyx_k__qual, sizeof(__pyx_k__qual), 0, 0, 1, 1},
39158 {&__pyx_n_b__r, __pyx_k__r, sizeof(__pyx_k__r), 0, 0, 0, 1},
39159 {&__pyx_n_s__r, __pyx_k__r, sizeof(__pyx_k__r), 0, 0, 1, 1},
39160 {&__pyx_n_s__rU, __pyx_k__rU, sizeof(__pyx_k__rU), 0, 0, 1, 1},
39161 {&__pyx_n_s__raw, __pyx_k__raw, sizeof(__pyx_k__raw), 0, 0, 1, 1},
39162 {&__pyx_n_b__rb, __pyx_k__rb, sizeof(__pyx_k__rb), 0, 0, 0, 1},
39163 {&__pyx_n_s__rb, __pyx_k__rb, sizeof(__pyx_k__rb), 0, 0, 1, 1},
39164 {&__pyx_n_s__re, __pyx_k__re, sizeof(__pyx_k__re), 0, 0, 1, 1},
39165 {&__pyx_n_s__read, __pyx_k__read, sizeof(__pyx_k__read), 0, 0, 1, 1},
39166 {&__pyx_n_s__readAndRelease, __pyx_k__readAndRelease, sizeof(__pyx_k__readAndRelease), 0, 0, 1, 1},
39167 {&__pyx_n_s__readlines, __pyx_k__readlines, sizeof(__pyx_k__readlines), 0, 0, 1, 1},
39168 {&__pyx_n_s__record, __pyx_k__record, sizeof(__pyx_k__record), 0, 0, 1, 1},
39169 {&__pyx_n_s__reference, __pyx_k__reference, sizeof(__pyx_k__reference), 0, 0, 1, 1},
39170 {&__pyx_n_s__reference_base, __pyx_k__reference_base, sizeof(__pyx_k__reference_base), 0, 0, 1, 1},
39171 {&__pyx_n_s__referencelengths, __pyx_k__referencelengths, sizeof(__pyx_k__referencelengths), 0, 0, 1, 1},
39172 {&__pyx_n_s__referencenames, __pyx_k__referencenames, sizeof(__pyx_k__referencenames), 0, 0, 1, 1},
39173 {&__pyx_n_s__references, __pyx_k__references, sizeof(__pyx_k__references), 0, 0, 1, 1},
39174 {&__pyx_n_s__region, __pyx_k__region, sizeof(__pyx_k__region), 0, 0, 1, 1},
39175 {&__pyx_n_s__release, __pyx_k__release, sizeof(__pyx_k__release), 0, 0, 1, 1},
39176 {&__pyx_n_s__remove, __pyx_k__remove, sizeof(__pyx_k__remove), 0, 0, 1, 1},
39177 {&__pyx_n_s__reopen, __pyx_k__reopen, sizeof(__pyx_k__reopen), 0, 0, 1, 1},
39178 {&__pyx_n_s__restore, __pyx_k__restore, sizeof(__pyx_k__restore), 0, 0, 1, 1},
39179 {&__pyx_n_s__retval, __pyx_k__retval, sizeof(__pyx_k__retval), 0, 0, 1, 1},
39180 {&__pyx_n_s__rlen, __pyx_k__rlen, sizeof(__pyx_k__rlen), 0, 0, 1, 1},
39181 {&__pyx_n_s__rname, __pyx_k__rname, sizeof(__pyx_k__rname), 0, 0, 1, 1},
39182 {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1},
39183 {&__pyx_n_s__samfile, __pyx_k__samfile, sizeof(__pyx_k__samfile), 0, 0, 1, 1},
39184 {&__pyx_n_s__samtools, __pyx_k__samtools, sizeof(__pyx_k__samtools), 0, 0, 1, 1},
39185 {&__pyx_n_s__seek, __pyx_k__seek, sizeof(__pyx_k__seek), 0, 0, 1, 1},
39186 {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
39187 {&__pyx_n_s__seq, __pyx_k__seq, sizeof(__pyx_k__seq), 0, 0, 1, 1},
39188 {&__pyx_n_s__setdevice, __pyx_k__setdevice, sizeof(__pyx_k__setdevice), 0, 0, 1, 1},
39189 {&__pyx_n_s__setfd, __pyx_k__setfd, sizeof(__pyx_k__setfd), 0, 0, 1, 1},
39190 {&__pyx_n_s__setfile, __pyx_k__setfile, sizeof(__pyx_k__setfile), 0, 0, 1, 1},
39191 {&__pyx_n_s__snp_quality, __pyx_k__snp_quality, sizeof(__pyx_k__snp_quality), 0, 0, 1, 1},
39192 {&__pyx_n_s__sorted, __pyx_k__sorted, sizeof(__pyx_k__sorted), 0, 0, 1, 1},
39193 {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1},
39194 {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1},
39195 {&__pyx_n_s__startswith, __pyx_k__startswith, sizeof(__pyx_k__startswith), 0, 0, 1, 1},
39196 {&__pyx_n_s__stderr, __pyx_k__stderr, sizeof(__pyx_k__stderr), 0, 0, 1, 1},
39197 {&__pyx_n_s__stderr_f, __pyx_k__stderr_f, sizeof(__pyx_k__stderr_f), 0, 0, 1, 1},
39198 {&__pyx_n_s__stderr_h, __pyx_k__stderr_h, sizeof(__pyx_k__stderr_h), 0, 0, 1, 1},
39199 {&__pyx_n_s__stdout, __pyx_k__stdout, sizeof(__pyx_k__stdout), 0, 0, 1, 1},
39200 {&__pyx_n_s__stdout_f, __pyx_k__stdout_f, sizeof(__pyx_k__stdout_f), 0, 0, 1, 1},
39201 {&__pyx_n_s__stdout_h, __pyx_k__stdout_h, sizeof(__pyx_k__stdout_h), 0, 0, 1, 1},
39202 {&__pyx_n_s__stdout_save, __pyx_k__stdout_save, sizeof(__pyx_k__stdout_save), 0, 0, 1, 1},
39203 {&__pyx_n_s__stepper, __pyx_k__stepper, sizeof(__pyx_k__stepper), 0, 0, 1, 1},
39204 {&__pyx_n_s__streams, __pyx_k__streams, sizeof(__pyx_k__streams), 0, 0, 1, 1},
39205 {&__pyx_n_s__strip, __pyx_k__strip, sizeof(__pyx_k__strip), 0, 0, 1, 1},
39206 {&__pyx_n_s__struct, __pyx_k__struct, sizeof(__pyx_k__struct), 0, 0, 1, 1},
39207 {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1},
39208 {&__pyx_n_s__system, __pyx_k__system, sizeof(__pyx_k__system), 0, 0, 1, 1},
39209 {&__pyx_n_s__tags, __pyx_k__tags, sizeof(__pyx_k__tags), 0, 0, 1, 1},
39210 {&__pyx_n_s__tempfile, __pyx_k__tempfile, sizeof(__pyx_k__tempfile), 0, 0, 1, 1},
39211 {&__pyx_n_s__template, __pyx_k__template, sizeof(__pyx_k__template), 0, 0, 1, 1},
39212 {&__pyx_n_s__text, __pyx_k__text, sizeof(__pyx_k__text), 0, 0, 1, 1},
39213 {&__pyx_n_s__tid, __pyx_k__tid, sizeof(__pyx_k__tid), 0, 0, 1, 1},
39214 {&__pyx_n_s__traceback, __pyx_k__traceback, sizeof(__pyx_k__traceback), 0, 0, 1, 1},
39215 {&__pyx_n_s__truncate, __pyx_k__truncate, sizeof(__pyx_k__truncate), 0, 0, 1, 1},
39216 {&__pyx_n_s__types, __pyx_k__types, sizeof(__pyx_k__types), 0, 0, 1, 1},
39217 {&__pyx_n_s__until_eof, __pyx_k__until_eof, sizeof(__pyx_k__until_eof), 0, 0, 1, 1},
39218 {&__pyx_n_s__version_info, __pyx_k__version_info, sizeof(__pyx_k__version_info), 0, 0, 1, 1},
39219 {&__pyx_n_s__view, __pyx_k__view, sizeof(__pyx_k__view), 0, 0, 1, 1},
39220 {&__pyx_n_s__w, __pyx_k__w, sizeof(__pyx_k__w), 0, 0, 1, 1},
39221 {&__pyx_n_s__warn, __pyx_k__warn, sizeof(__pyx_k__warn), 0, 0, 1, 1},
39222 {&__pyx_n_s__warnings, __pyx_k__warnings, sizeof(__pyx_k__warnings), 0, 0, 1, 1},
39223 {&__pyx_n_s__wb, __pyx_k__wb, sizeof(__pyx_k__wb), 0, 0, 1, 1},
39224 {&__pyx_n_s__wbu, __pyx_k__wbu, sizeof(__pyx_k__wbu), 0, 0, 1, 1},
39225 {&__pyx_n_s__wh, __pyx_k__wh, sizeof(__pyx_k__wh), 0, 0, 1, 1},
39226 {&__pyx_n_s__where, __pyx_k__where, sizeof(__pyx_k__where), 0, 0, 1, 1},
39227 {&__pyx_n_s__write, __pyx_k__write, sizeof(__pyx_k__write), 0, 0, 1, 1},
39228 {&__pyx_n_s__zip, __pyx_k__zip, sizeof(__pyx_k__zip), 0, 0, 1, 1},
39229 {0, 0, 0, 0, 0, 0, 0}
39231 static int __Pyx_InitCachedBuiltins(void) {
39232 __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39233 __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39234 __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39235 __pyx_builtin_ord = __Pyx_GetName(__pyx_b, __pyx_n_s__ord); if (!__pyx_builtin_ord) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39236 __pyx_builtin_map = __Pyx_GetName(__pyx_b, __pyx_n_s__map); if (!__pyx_builtin_map) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39237 __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39238 __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39239 __pyx_builtin_OverflowError = __Pyx_GetName(__pyx_b, __pyx_n_s__OverflowError); if (!__pyx_builtin_OverflowError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39240 __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39241 __pyx_builtin_OSError = __Pyx_GetName(__pyx_b, __pyx_n_s__OSError); if (!__pyx_builtin_OSError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39242 __pyx_builtin_AttributeError = __Pyx_GetName(__pyx_b, __pyx_n_s__AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39243 __pyx_builtin_zip = __Pyx_GetName(__pyx_b, __pyx_n_s__zip); if (!__pyx_builtin_zip) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39244 __pyx_builtin_sorted = __Pyx_GetName(__pyx_b, __pyx_n_s__sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39245 __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39246 __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39247 __pyx_builtin_min = __Pyx_GetName(__pyx_b, __pyx_n_s__min); if (!__pyx_builtin_min) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39248 __pyx_builtin_max = __Pyx_GetName(__pyx_b, __pyx_n_s__max); if (!__pyx_builtin_max) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39249 __pyx_builtin_chr = __Pyx_GetName(__pyx_b, __pyx_n_s__chr); if (!__pyx_builtin_chr) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39250 __pyx_builtin_open = __Pyx_GetName(__pyx_b, __pyx_n_s__open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39251 __pyx_builtin_UnicodeDecodeError = __Pyx_GetName(__pyx_b, __pyx_n_s__UnicodeDecodeError); if (!__pyx_builtin_UnicodeDecodeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39257 static int __Pyx_InitCachedConstants(void) {
39258 __Pyx_RefNannyDeclarations
39259 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
39261 /* "csamtools.pyx":64
39263 * elif PyUnicode_Check(s):
39264 * return s.encode('ascii') # <<<<<<<<<<<<<<
39266 * raise TypeError, u"Argument must be string, bytes or unicode."
39268 __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39269 __Pyx_GOTREF(__pyx_k_tuple_2);
39270 __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
39271 PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_n_s__ascii));
39272 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
39273 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
39275 /* "csamtools.pyx":84
39277 * elif PyBytes_Check(s):
39278 * return s.decode('ascii') # <<<<<<<<<<<<<<
39282 __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39283 __Pyx_GOTREF(__pyx_k_tuple_4);
39284 __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
39285 PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_n_s__ascii));
39286 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
39287 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
39289 /* "csamtools.pyx":398
39290 * def __len__(self):
39291 * if self.fastafile == NULL:
39292 * raise ValueError( "calling len() on closed file" ) # <<<<<<<<<<<<<<
39294 * return faidx_fetch_nseq(self.fastafile)
39296 __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39297 __Pyx_GOTREF(__pyx_k_tuple_8);
39298 __Pyx_INCREF(((PyObject *)__pyx_kp_s_7));
39299 PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_7));
39300 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7));
39301 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));
39303 /* "csamtools.pyx":431
39304 * '''number of :term:`filename` associated with this object.'''
39305 * def __get__(self):
39306 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39307 * return self._filename
39310 __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39311 __Pyx_GOTREF(__pyx_k_tuple_11);
39312 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39313 PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_s_10));
39314 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39315 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11));
39317 /* "csamtools.pyx":456
39319 * if not self._isOpen():
39320 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39324 __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39325 __Pyx_GOTREF(__pyx_k_tuple_12);
39326 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39327 PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_10));
39328 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39329 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
39331 /* "csamtools.pyx":462
39334 * if reference is None: raise ValueError( 'no sequence/region supplied.' ) # <<<<<<<<<<<<<<
39335 * if start is None: start = 0
39336 * if end is None: end = max_pos -1
39338 __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39339 __Pyx_GOTREF(__pyx_k_tuple_14);
39340 __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
39341 PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_13));
39342 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
39343 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
39345 /* "csamtools.pyx":481
39346 * region = "%s:%i-%i" % (reference, start+1, end)
39347 * if PY_MAJOR_VERSION >= 3:
39348 * region = region.encode('ascii') # <<<<<<<<<<<<<<
39349 * seq = fai_fetch( self.fastafile,
39352 __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39353 __Pyx_GOTREF(__pyx_k_tuple_20);
39354 __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
39355 PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_n_s__ascii));
39356 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
39357 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));
39359 /* "csamtools.pyx":663
39360 * if self._filename != NULL: free(self._filename )
39361 * filename = _my_encodeFilename(filename)
39362 * cdef bytes bmode = mode.encode('ascii') # <<<<<<<<<<<<<<
39363 * #cdef char* cfilename
39364 * #cfilename = filename.encode(_FILENAME_ENCODING)
39366 __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39367 __Pyx_GOTREF(__pyx_k_tuple_25);
39368 __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
39369 PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_n_s__ascii));
39370 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
39371 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
39373 /* "csamtools.pyx":790
39374 * returns -1 if reference is not known.
39376 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39377 * reference = _force_bytes(reference)
39378 * return pysam_reference2tid( self.samfile.header, reference )
39380 __pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39381 __Pyx_GOTREF(__pyx_k_tuple_39);
39382 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39383 PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_kp_s_10));
39384 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39385 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39));
39387 /* "csamtools.pyx":797
39389 * convert numerical :term:`tid` into :term:`reference` name.'''
39390 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39391 * if not 0 <= tid < self.samfile.header.n_targets:
39392 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
39394 __pyx_k_tuple_40 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39395 __Pyx_GOTREF(__pyx_k_tuple_40);
39396 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39397 PyTuple_SET_ITEM(__pyx_k_tuple_40, 0, ((PyObject *)__pyx_kp_s_10));
39398 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39399 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));
39401 /* "csamtools.pyx":805
39403 * convert numerical :term:`tid` into :term:`reference` name.'''
39404 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39405 * if not 0 <= tid < self.samfile.header.n_targets:
39406 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
39408 __pyx_k_tuple_42 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39409 __Pyx_GOTREF(__pyx_k_tuple_42);
39410 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39411 PyTuple_SET_ITEM(__pyx_k_tuple_42, 0, ((PyObject *)__pyx_kp_s_10));
39412 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39413 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));
39415 /* "csamtools.pyx":855
39416 * if len(parts) >= 3: rend = int(parts[2])
39418 * if not reference: return 0, 0, 0, 0 # <<<<<<<<<<<<<<
39420 * rtid = self.gettid( reference )
39422 __pyx_k_tuple_44 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39423 __Pyx_GOTREF(__pyx_k_tuple_44);
39424 __Pyx_INCREF(__pyx_int_0);
39425 PyTuple_SET_ITEM(__pyx_k_tuple_44, 0, __pyx_int_0);
39426 __Pyx_GIVEREF(__pyx_int_0);
39427 __Pyx_INCREF(__pyx_int_0);
39428 PyTuple_SET_ITEM(__pyx_k_tuple_44, 1, __pyx_int_0);
39429 __Pyx_GIVEREF(__pyx_int_0);
39430 __Pyx_INCREF(__pyx_int_0);
39431 PyTuple_SET_ITEM(__pyx_k_tuple_44, 2, __pyx_int_0);
39432 __Pyx_GIVEREF(__pyx_int_0);
39433 __Pyx_INCREF(__pyx_int_0);
39434 PyTuple_SET_ITEM(__pyx_k_tuple_44, 3, __pyx_int_0);
39435 __Pyx_GIVEREF(__pyx_int_0);
39436 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44));
39438 /* "csamtools.pyx":875
39440 * if not self._isOpen():
39441 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39442 * if not self.isbam:
39443 * raise NotImplementedError("seek only available in bam files")
39445 __pyx_k_tuple_47 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39446 __Pyx_GOTREF(__pyx_k_tuple_47);
39447 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39448 PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_kp_s_10));
39449 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39450 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));
39452 /* "csamtools.pyx":877
39453 * raise ValueError( "I/O operation on closed file" )
39454 * if not self.isbam:
39455 * raise NotImplementedError("seek only available in bam files") # <<<<<<<<<<<<<<
39456 * if self.isstream:
39457 * raise OSError("seek no available in streams")
39459 __pyx_k_tuple_49 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39460 __Pyx_GOTREF(__pyx_k_tuple_49);
39461 __Pyx_INCREF(((PyObject *)__pyx_kp_s_48));
39462 PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, ((PyObject *)__pyx_kp_s_48));
39463 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48));
39464 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));
39466 /* "csamtools.pyx":879
39467 * raise NotImplementedError("seek only available in bam files")
39468 * if self.isstream:
39469 * raise OSError("seek no available in streams") # <<<<<<<<<<<<<<
39471 * return bam_seek( self.samfile.x.bam, offset, where )
39473 __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39474 __Pyx_GOTREF(__pyx_k_tuple_51);
39475 __Pyx_INCREF(((PyObject *)__pyx_kp_s_50));
39476 PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, ((PyObject *)__pyx_kp_s_50));
39477 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_50));
39478 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));
39480 /* "csamtools.pyx":888
39482 * if not self._isOpen():
39483 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39484 * if not self.isbam:
39485 * raise NotImplementedError("seek only available in bam files")
39487 __pyx_k_tuple_52 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39488 __Pyx_GOTREF(__pyx_k_tuple_52);
39489 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39490 PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, ((PyObject *)__pyx_kp_s_10));
39491 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39492 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
39494 /* "csamtools.pyx":890
39495 * raise ValueError( "I/O operation on closed file" )
39496 * if not self.isbam:
39497 * raise NotImplementedError("seek only available in bam files") # <<<<<<<<<<<<<<
39499 * return bam_tell( self.samfile.x.bam )
39501 __pyx_k_tuple_53 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39502 __Pyx_GOTREF(__pyx_k_tuple_53);
39503 __Pyx_INCREF(((PyObject *)__pyx_kp_s_48));
39504 PyTuple_SET_ITEM(__pyx_k_tuple_53, 0, ((PyObject *)__pyx_kp_s_48));
39505 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48));
39506 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));
39508 /* "csamtools.pyx":925
39510 * if not self._isOpen():
39511 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39513 * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
39515 __pyx_k_tuple_55 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39516 __Pyx_GOTREF(__pyx_k_tuple_55);
39517 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39518 PyTuple_SET_ITEM(__pyx_k_tuple_55, 0, ((PyObject *)__pyx_kp_s_10));
39519 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39520 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
39522 /* "csamtools.pyx":934
39524 * if not until_eof and not self._hasIndex() and not self.isremote:
39525 * raise ValueError( "fetch called on bamfile without index" ) # <<<<<<<<<<<<<<
39529 __pyx_k_tuple_57 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39530 __Pyx_GOTREF(__pyx_k_tuple_57);
39531 __Pyx_INCREF(((PyObject *)__pyx_kp_s_56));
39532 PyTuple_SET_ITEM(__pyx_k_tuple_57, 0, ((PyObject *)__pyx_kp_s_56));
39533 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_56));
39534 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));
39536 /* "csamtools.pyx":937
39539 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) # <<<<<<<<<<<<<<
39540 * if not self._hasIndex(): raise ValueError( "no index available for fetch" )
39541 * return bam_fetch(self.samfile.x.bam,
39543 __pyx_k_tuple_59 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39544 __Pyx_GOTREF(__pyx_k_tuple_59);
39545 __Pyx_INCREF(((PyObject *)__pyx_kp_s_58));
39546 PyTuple_SET_ITEM(__pyx_k_tuple_59, 0, ((PyObject *)__pyx_kp_s_58));
39547 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_58));
39548 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));
39550 /* "csamtools.pyx":938
39552 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
39553 * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) # <<<<<<<<<<<<<<
39554 * return bam_fetch(self.samfile.x.bam,
39557 __pyx_k_tuple_61 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39558 __Pyx_GOTREF(__pyx_k_tuple_61);
39559 __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
39560 PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, ((PyObject *)__pyx_kp_s_60));
39561 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
39562 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));
39564 /* "csamtools.pyx":957
39567 * raise ValueError ("fetching by region is not available for sam files" ) # <<<<<<<<<<<<<<
39571 __pyx_k_tuple_63 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39572 __Pyx_GOTREF(__pyx_k_tuple_63);
39573 __Pyx_INCREF(((PyObject *)__pyx_kp_s_62));
39574 PyTuple_SET_ITEM(__pyx_k_tuple_63, 0, ((PyObject *)__pyx_kp_s_62));
39575 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_62));
39576 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));
39578 /* "csamtools.pyx":960
39581 * raise NotImplementedError( "callback not implemented yet" ) # <<<<<<<<<<<<<<
39583 * if self.samfile.header == NULL:
39585 __pyx_k_tuple_65 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39586 __Pyx_GOTREF(__pyx_k_tuple_65);
39587 __Pyx_INCREF(((PyObject *)__pyx_kp_s_64));
39588 PyTuple_SET_ITEM(__pyx_k_tuple_65, 0, ((PyObject *)__pyx_kp_s_64));
39589 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_64));
39590 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65));
39592 /* "csamtools.pyx":963
39594 * if self.samfile.header == NULL:
39595 * raise ValueError( "fetch called for samfile without header") # <<<<<<<<<<<<<<
39597 * # check if targets are defined
39599 __pyx_k_tuple_67 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39600 __Pyx_GOTREF(__pyx_k_tuple_67);
39601 __Pyx_INCREF(((PyObject *)__pyx_kp_s_66));
39602 PyTuple_SET_ITEM(__pyx_k_tuple_67, 0, ((PyObject *)__pyx_kp_s_66));
39603 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_66));
39604 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67));
39606 /* "csamtools.pyx":968
39607 * # give warning, sam_read1 segfaults
39608 * if self.samfile.header.n_targets == 0:
39609 * warnings.warn( "fetch called for samfile without header") # <<<<<<<<<<<<<<
39611 * return IteratorRowAll( self, reopen=reopen )
39613 __pyx_k_tuple_68 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39614 __Pyx_GOTREF(__pyx_k_tuple_68);
39615 __Pyx_INCREF(((PyObject *)__pyx_kp_s_66));
39616 PyTuple_SET_ITEM(__pyx_k_tuple_68, 0, ((PyObject *)__pyx_kp_s_66));
39617 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_66));
39618 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68));
39620 /* "csamtools.pyx":1009
39622 * if mate_data.mate == NULL:
39623 * raise ValueError( "mate not found" ) # <<<<<<<<<<<<<<
39625 * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
39627 __pyx_k_tuple_72 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39628 __Pyx_GOTREF(__pyx_k_tuple_72);
39629 __Pyx_INCREF(((PyObject *)__pyx_kp_s_71));
39630 PyTuple_SET_ITEM(__pyx_k_tuple_72, 0, ((PyObject *)__pyx_kp_s_71));
39631 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_71));
39632 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_72));
39634 /* "csamtools.pyx":1034
39636 * if not self._isOpen():
39637 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39639 * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
39641 __pyx_k_tuple_74 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39642 __Pyx_GOTREF(__pyx_k_tuple_74);
39643 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39644 PyTuple_SET_ITEM(__pyx_k_tuple_74, 0, ((PyObject *)__pyx_kp_s_10));
39645 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39646 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_74));
39648 /* "csamtools.pyx":1043
39650 * if not until_eof and not self._hasIndex() and not self.isremote:
39651 * raise ValueError( "fetch called on bamfile without index" ) # <<<<<<<<<<<<<<
39655 __pyx_k_tuple_75 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39656 __Pyx_GOTREF(__pyx_k_tuple_75);
39657 __Pyx_INCREF(((PyObject *)__pyx_kp_s_56));
39658 PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, ((PyObject *)__pyx_kp_s_56));
39659 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_56));
39660 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75));
39662 /* "csamtools.pyx":1046
39665 * raise ValueError( "counting functionality requires a region/reference" ) # <<<<<<<<<<<<<<
39666 * if not self._hasIndex(): raise ValueError( "no index available for fetch" )
39667 * bam_fetch(self.samfile.x.bam,
39669 __pyx_k_tuple_77 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39670 __Pyx_GOTREF(__pyx_k_tuple_77);
39671 __Pyx_INCREF(((PyObject *)__pyx_kp_s_76));
39672 PyTuple_SET_ITEM(__pyx_k_tuple_77, 0, ((PyObject *)__pyx_kp_s_76));
39673 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_76));
39674 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77));
39676 /* "csamtools.pyx":1047
39678 * raise ValueError( "counting functionality requires a region/reference" )
39679 * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) # <<<<<<<<<<<<<<
39680 * bam_fetch(self.samfile.x.bam,
39683 __pyx_k_tuple_78 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39684 __Pyx_GOTREF(__pyx_k_tuple_78);
39685 __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
39686 PyTuple_SET_ITEM(__pyx_k_tuple_78, 0, ((PyObject *)__pyx_kp_s_60));
39687 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
39688 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_78));
39690 /* "csamtools.pyx":1057
39693 * raise ValueError ("count for a region is not available for sam files" ) # <<<<<<<<<<<<<<
39695 * def pileup( self,
39697 __pyx_k_tuple_80 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39698 __Pyx_GOTREF(__pyx_k_tuple_80);
39699 __Pyx_INCREF(((PyObject *)__pyx_kp_s_79));
39700 PyTuple_SET_ITEM(__pyx_k_tuple_80, 0, ((PyObject *)__pyx_kp_s_79));
39701 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_79));
39702 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_80));
39704 /* "csamtools.pyx":1116
39706 * if not self._isOpen():
39707 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39709 * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
39711 __pyx_k_tuple_81 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39712 __Pyx_GOTREF(__pyx_k_tuple_81);
39713 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39714 PyTuple_SET_ITEM(__pyx_k_tuple_81, 0, ((PyObject *)__pyx_kp_s_10));
39715 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39716 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_81));
39718 /* "csamtools.pyx":1121
39721 * if not self._hasIndex(): raise ValueError( "no index available for pileup" ) # <<<<<<<<<<<<<<
39725 __pyx_k_tuple_83 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39726 __Pyx_GOTREF(__pyx_k_tuple_83);
39727 __Pyx_INCREF(((PyObject *)__pyx_kp_s_82));
39728 PyTuple_SET_ITEM(__pyx_k_tuple_83, 0, ((PyObject *)__pyx_kp_s_82));
39729 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_82));
39730 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_83));
39732 /* "csamtools.pyx":1124
39735 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) # <<<<<<<<<<<<<<
39737 * buf = bam_plbuf_init( <bam_pileup_f>pileup_callback, <void*>callback )
39739 __pyx_k_tuple_84 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_84)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39740 __Pyx_GOTREF(__pyx_k_tuple_84);
39741 __Pyx_INCREF(((PyObject *)__pyx_kp_s_58));
39742 PyTuple_SET_ITEM(__pyx_k_tuple_84, 0, ((PyObject *)__pyx_kp_s_58));
39743 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_58));
39744 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_84));
39746 /* "csamtools.pyx":1145
39749 * raise NotImplementedError( "pileup of samfiles not implemented yet" ) # <<<<<<<<<<<<<<
39751 * def close( self ):
39753 __pyx_k_tuple_86 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_86)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39754 __Pyx_GOTREF(__pyx_k_tuple_86);
39755 __Pyx_INCREF(((PyObject *)__pyx_kp_s_85));
39756 PyTuple_SET_ITEM(__pyx_k_tuple_86, 0, ((PyObject *)__pyx_kp_s_85));
39757 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_85));
39758 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_86));
39760 /* "csamtools.pyx":1189
39761 * '''number of :term:`filename` associated with this object.'''
39762 * def __get__(self):
39763 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39764 * return self._filename
39767 __pyx_k_tuple_87 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_87)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39768 __Pyx_GOTREF(__pyx_k_tuple_87);
39769 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39770 PyTuple_SET_ITEM(__pyx_k_tuple_87, 0, ((PyObject *)__pyx_kp_s_10));
39771 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39772 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_87));
39774 /* "csamtools.pyx":1195
39775 * '''number of :term:`reference` sequences in the file.'''
39776 * def __get__(self):
39777 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39778 * return self.samfile.header.n_targets
39781 __pyx_k_tuple_88 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39782 __Pyx_GOTREF(__pyx_k_tuple_88);
39783 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39784 PyTuple_SET_ITEM(__pyx_k_tuple_88, 0, ((PyObject *)__pyx_kp_s_10));
39785 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39786 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_88));
39788 /* "csamtools.pyx":1201
39789 * """tuple with the names of :term:`reference` sequences."""
39790 * def __get__(self):
39791 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39793 * for x from 0 <= x < self.samfile.header.n_targets:
39795 __pyx_k_tuple_89 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_89)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39796 __Pyx_GOTREF(__pyx_k_tuple_89);
39797 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39798 PyTuple_SET_ITEM(__pyx_k_tuple_89, 0, ((PyObject *)__pyx_kp_s_10));
39799 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39800 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_89));
39802 /* "csamtools.pyx":1212
39804 * def __get__(self):
39805 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39807 * for x from 0 <= x < self.samfile.header.n_targets:
39809 __pyx_k_tuple_90 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39810 __Pyx_GOTREF(__pyx_k_tuple_90);
39811 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39812 PyTuple_SET_ITEM(__pyx_k_tuple_90, 0, ((PyObject *)__pyx_kp_s_10));
39813 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39814 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_90));
39816 /* "csamtools.pyx":1222
39818 * def __get__(self):
39819 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39820 * if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" )
39823 __pyx_k_tuple_91 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_91)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39824 __Pyx_GOTREF(__pyx_k_tuple_91);
39825 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39826 PyTuple_SET_ITEM(__pyx_k_tuple_91, 0, ((PyObject *)__pyx_kp_s_10));
39827 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39828 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_91));
39830 /* "csamtools.pyx":1223
39831 * def __get__(self):
39832 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
39833 * if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" ) # <<<<<<<<<<<<<<
39837 __pyx_k_tuple_93 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_93)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39838 __Pyx_GOTREF(__pyx_k_tuple_93);
39839 __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
39840 PyTuple_SET_ITEM(__pyx_k_tuple_93, 0, ((PyObject *)__pyx_kp_s_92));
39841 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
39842 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_93));
39844 /* "csamtools.pyx":1235
39846 * def __get__(self):
39847 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39848 * if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )
39851 __pyx_k_tuple_94 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39852 __Pyx_GOTREF(__pyx_k_tuple_94);
39853 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39854 PyTuple_SET_ITEM(__pyx_k_tuple_94, 0, ((PyObject *)__pyx_kp_s_10));
39855 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39856 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_94));
39858 /* "csamtools.pyx":1236
39859 * def __get__(self):
39860 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
39861 * if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" ) # <<<<<<<<<<<<<<
39863 * cdef uint32_t total = 0
39865 __pyx_k_tuple_96 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_96)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39866 __Pyx_GOTREF(__pyx_k_tuple_96);
39867 __Pyx_INCREF(((PyObject *)__pyx_kp_s_95));
39868 PyTuple_SET_ITEM(__pyx_k_tuple_96, 0, ((PyObject *)__pyx_kp_s_95));
39869 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_95));
39870 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_96));
39872 /* "csamtools.pyx":1248
39873 * '''full contents of the :term:`sam file` header as a string.'''
39874 * def __get__(self):
39875 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39876 * return from_string_and_size(self.samfile.header.text, self.samfile.header.l_text)
39879 __pyx_k_tuple_97 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39880 __Pyx_GOTREF(__pyx_k_tuple_97);
39881 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39882 PyTuple_SET_ITEM(__pyx_k_tuple_97, 0, ((PyObject *)__pyx_kp_s_10));
39883 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39884 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_97));
39886 /* "csamtools.pyx":1256
39888 * def __get__(self):
39889 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39893 __pyx_k_tuple_98 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_98)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39894 __Pyx_GOTREF(__pyx_k_tuple_98);
39895 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39896 PyTuple_SET_ITEM(__pyx_k_tuple_98, 0, ((PyObject *)__pyx_kp_s_10));
39897 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39898 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_98));
39900 /* "csamtools.pyx":1263
39901 * # convert to python string (note: call self.text to create 0-terminated string)
39903 * for line in t.split("\n"): # <<<<<<<<<<<<<<
39904 * if not line.strip(): continue
39905 * assert line.startswith("@"), "header line without '@': '%s'" % line
39907 __pyx_k_tuple_99 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39908 __Pyx_GOTREF(__pyx_k_tuple_99);
39909 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
39910 PyTuple_SET_ITEM(__pyx_k_tuple_99, 0, ((PyObject *)__pyx_kp_s_6));
39911 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
39912 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_99));
39914 /* "csamtools.pyx":1265
39915 * for line in t.split("\n"):
39916 * if not line.strip(): continue
39917 * assert line.startswith("@"), "header line without '@': '%s'" % line # <<<<<<<<<<<<<<
39918 * fields = line[1:].split("\t")
39919 * record = fields[0]
39921 __pyx_k_tuple_101 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_101)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39922 __Pyx_GOTREF(__pyx_k_tuple_101);
39923 __Pyx_INCREF(((PyObject *)__pyx_kp_s_100));
39924 PyTuple_SET_ITEM(__pyx_k_tuple_101, 0, ((PyObject *)__pyx_kp_s_100));
39925 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_100));
39926 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_101));
39928 /* "csamtools.pyx":1266
39929 * if not line.strip(): continue
39930 * assert line.startswith("@"), "header line without '@': '%s'" % line
39931 * fields = line[1:].split("\t") # <<<<<<<<<<<<<<
39932 * record = fields[0]
39933 * assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line)
39935 __pyx_k_tuple_103 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_103)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39936 __Pyx_GOTREF(__pyx_k_tuple_103);
39937 __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
39938 PyTuple_SET_ITEM(__pyx_k_tuple_103, 0, ((PyObject *)__pyx_kp_s_5));
39939 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
39940 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_103));
39942 /* "csamtools.pyx":1279
39944 * for field in fields[1:]:
39945 * key, value = field.split(":",1) # <<<<<<<<<<<<<<
39946 * # uppercase keys must be valid
39947 * # lowercase are permitted for user fields
39949 __pyx_k_tuple_106 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39950 __Pyx_GOTREF(__pyx_k_tuple_106);
39951 __Pyx_INCREF(((PyObject *)__pyx_kp_s_105));
39952 PyTuple_SET_ITEM(__pyx_k_tuple_106, 0, ((PyObject *)__pyx_kp_s_105));
39953 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_105));
39954 __Pyx_INCREF(__pyx_int_1);
39955 PyTuple_SET_ITEM(__pyx_k_tuple_106, 1, __pyx_int_1);
39956 __Pyx_GIVEREF(__pyx_int_1);
39957 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_106));
39959 /* "csamtools.pyx":1377
39960 * dest.text = <char*>calloc( len(text), sizeof(char))
39961 * dest.l_text = len(text)
39962 * cdef bytes btext = text.encode('ascii') # <<<<<<<<<<<<<<
39963 * strncpy( dest.text, btext, dest.l_text )
39966 __pyx_k_tuple_112 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_112)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39967 __Pyx_GOTREF(__pyx_k_tuple_112);
39968 __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
39969 PyTuple_SET_ITEM(__pyx_k_tuple_112, 0, ((PyObject *)__pyx_n_s__ascii));
39970 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
39971 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_112));
39973 /* "csamtools.pyx":1397
39974 * seqname, seqlen = seqs[x]
39975 * dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) )
39976 * bseqname = seqname.encode('ascii') # <<<<<<<<<<<<<<
39977 * strncpy( dest.target_name[x], bseqname, len(seqname) + 1 )
39978 * dest.target_len[x] = seqlen
39980 __pyx_k_tuple_114 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_114)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39981 __Pyx_GOTREF(__pyx_k_tuple_114);
39982 __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
39983 PyTuple_SET_ITEM(__pyx_k_tuple_114, 0, ((PyObject *)__pyx_n_s__ascii));
39984 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
39985 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_114));
39987 /* "csamtools.pyx":1412
39988 * ###############################################################
39989 * def __iter__(self):
39990 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
39991 * if not self.isbam and self.samfile.header.n_targets == 0:
39992 * raise NotImplementedError( "can not iterate over samfile without header")
39994 __pyx_k_tuple_115 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_115)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
39995 __Pyx_GOTREF(__pyx_k_tuple_115);
39996 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
39997 PyTuple_SET_ITEM(__pyx_k_tuple_115, 0, ((PyObject *)__pyx_kp_s_10));
39998 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
39999 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_115));
40001 /* "csamtools.pyx":1414
40002 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
40003 * if not self.isbam and self.samfile.header.n_targets == 0:
40004 * raise NotImplementedError( "can not iterate over samfile without header") # <<<<<<<<<<<<<<
40008 __pyx_k_tuple_117 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_117)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40009 __Pyx_GOTREF(__pyx_k_tuple_117);
40010 __Pyx_INCREF(((PyObject *)__pyx_kp_s_116));
40011 PyTuple_SET_ITEM(__pyx_k_tuple_117, 0, ((PyObject *)__pyx_kp_s_116));
40012 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_116));
40013 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_117));
40015 /* "csamtools.pyx":1484
40017 * if not samfile._isOpen():
40018 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
40020 * if not samfile._hasIndex():
40022 __pyx_k_tuple_118 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_118)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40023 __Pyx_GOTREF(__pyx_k_tuple_118);
40024 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
40025 PyTuple_SET_ITEM(__pyx_k_tuple_118, 0, ((PyObject *)__pyx_kp_s_10));
40026 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
40027 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_118));
40029 /* "csamtools.pyx":1487
40031 * if not samfile._hasIndex():
40032 * raise ValueError( "no index available for iteration" ) # <<<<<<<<<<<<<<
40034 * # makes sure that samfile stays alive as long as the
40036 __pyx_k_tuple_120 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_120)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40037 __Pyx_GOTREF(__pyx_k_tuple_120);
40038 __Pyx_INCREF(((PyObject *)__pyx_kp_s_119));
40039 PyTuple_SET_ITEM(__pyx_k_tuple_120, 0, ((PyObject *)__pyx_kp_s_119));
40040 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_119));
40041 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_120));
40043 /* "csamtools.pyx":1553
40045 * if not samfile._isOpen():
40046 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
40048 * if samfile.isbam: mode = b"rb"
40050 __pyx_k_tuple_121 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_121)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40051 __Pyx_GOTREF(__pyx_k_tuple_121);
40052 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
40053 PyTuple_SET_ITEM(__pyx_k_tuple_121, 0, ((PyObject *)__pyx_kp_s_10));
40054 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
40055 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_121));
40057 /* "csamtools.pyx":1604
40058 * def __cinit__(self, Samfile samfile):
40059 * assert samfile._isOpen()
40060 * if not samfile._hasIndex(): raise ValueError("no index available for fetch") # <<<<<<<<<<<<<<
40061 * self.samfile = samfile
40064 __pyx_k_tuple_122 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_122)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40065 __Pyx_GOTREF(__pyx_k_tuple_122);
40066 __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
40067 PyTuple_SET_ITEM(__pyx_k_tuple_122, 0, ((PyObject *)__pyx_kp_s_60));
40068 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
40069 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_122));
40071 /* "csamtools.pyx":1650
40073 * if not samfile._isOpen():
40074 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
40076 * if not samfile._isOpen():
40078 __pyx_k_tuple_123 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_123)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40079 __Pyx_GOTREF(__pyx_k_tuple_123);
40080 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
40081 PyTuple_SET_ITEM(__pyx_k_tuple_123, 0, ((PyObject *)__pyx_kp_s_10));
40082 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
40083 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_123));
40085 /* "csamtools.pyx":1653
40087 * if not samfile._isOpen():
40088 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
40090 * assert samfile.isbam, "can only use this iterator on bam files"
40092 __pyx_k_tuple_124 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_124)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40093 __Pyx_GOTREF(__pyx_k_tuple_124);
40094 __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
40095 PyTuple_SET_ITEM(__pyx_k_tuple_124, 0, ((PyObject *)__pyx_kp_s_10));
40096 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
40097 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_124));
40099 /* "csamtools.pyx":1954
40101 * if self.n_plp < 0:
40102 * raise ValueError("error during iteration" ) # <<<<<<<<<<<<<<
40104 * if self.plp == NULL:
40106 __pyx_k_tuple_130 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_130)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40107 __Pyx_GOTREF(__pyx_k_tuple_130);
40108 __Pyx_INCREF(((PyObject *)__pyx_kp_s_129));
40109 PyTuple_SET_ITEM(__pyx_k_tuple_130, 0, ((PyObject *)__pyx_kp_s_129));
40110 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_129));
40111 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_130));
40113 /* "csamtools.pyx":1990
40115 * if self.n_plp < 0:
40116 * raise ValueError("error during iteration" ) # <<<<<<<<<<<<<<
40118 * # return result, if within same reference
40120 __pyx_k_tuple_131 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_131)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40121 __Pyx_GOTREF(__pyx_k_tuple_131);
40122 __Pyx_INCREF(((PyObject *)__pyx_kp_s_129));
40123 PyTuple_SET_ITEM(__pyx_k_tuple_131, 0, ((PyObject *)__pyx_kp_s_129));
40124 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_129));
40125 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_131));
40127 /* "csamtools.pyx":2153
40130 * seq = self.seq.decode('ascii') # <<<<<<<<<<<<<<
40131 * qual = self.qual.decode('ascii')
40132 * return "\t".join(map(str, (self.qname,
40134 __pyx_k_tuple_133 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_133)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40135 __Pyx_GOTREF(__pyx_k_tuple_133);
40136 __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
40137 PyTuple_SET_ITEM(__pyx_k_tuple_133, 0, ((PyObject *)__pyx_n_s__ascii));
40138 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
40139 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_133));
40141 /* "csamtools.pyx":2154
40143 * seq = self.seq.decode('ascii')
40144 * qual = self.qual.decode('ascii') # <<<<<<<<<<<<<<
40145 * return "\t".join(map(str, (self.qname,
40148 __pyx_k_tuple_134 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_134)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40149 __Pyx_GOTREF(__pyx_k_tuple_134);
40150 __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
40151 PyTuple_SET_ITEM(__pyx_k_tuple_134, 0, ((PyObject *)__pyx_n_s__ascii));
40152 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
40153 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_134));
40155 /* "csamtools.pyx":2563
40156 * for pytag, value in tags:
40157 * if not type(pytag) is bytes:
40158 * pytag = pytag.encode('ascii') # <<<<<<<<<<<<<<
40162 __pyx_k_tuple_139 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_139)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40163 __Pyx_GOTREF(__pyx_k_tuple_139);
40164 __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
40165 PyTuple_SET_ITEM(__pyx_k_tuple_139, 0, ((PyObject *)__pyx_n_s__ascii));
40166 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
40167 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_139));
40169 /* "csamtools.pyx":2591
40170 * datafmt = "2sccI%i%s" % (len(value), datafmt)
40171 * args.extend( [pytag[:2],
40172 * pytype.encode('ascii'), # <<<<<<<<<<<<<<
40173 * datatype.encode('ascii'),
40174 * len(value)] + list(value) )
40176 __pyx_k_tuple_142 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_142)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40177 __Pyx_GOTREF(__pyx_k_tuple_142);
40178 __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
40179 PyTuple_SET_ITEM(__pyx_k_tuple_142, 0, ((PyObject *)__pyx_n_s__ascii));
40180 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
40181 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_142));
40183 /* "csamtools.pyx":2592
40184 * args.extend( [pytag[:2],
40185 * pytype.encode('ascii'),
40186 * datatype.encode('ascii'), # <<<<<<<<<<<<<<
40187 * len(value)] + list(value) )
40188 * fmts.append( datafmt )
40190 __pyx_k_tuple_143 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_143)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40191 __Pyx_GOTREF(__pyx_k_tuple_143);
40192 __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
40193 PyTuple_SET_ITEM(__pyx_k_tuple_143, 0, ((PyObject *)__pyx_n_s__ascii));
40194 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
40195 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_143));
40197 /* "csamtools.pyx":2615
40198 * # Note: hex strings (H) are not supported yet
40199 * if t is not bytes:
40200 * value = value.encode('ascii') # <<<<<<<<<<<<<<
40201 * if len(value) == 1:
40202 * fmt, pytype = "2scc", 'A'
40204 __pyx_k_tuple_144 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_144)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40205 __Pyx_GOTREF(__pyx_k_tuple_144);
40206 __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
40207 PyTuple_SET_ITEM(__pyx_k_tuple_144, 0, ((PyObject *)__pyx_n_s__ascii));
40208 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
40209 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_144));
40211 /* "csamtools.pyx":2622
40213 * args.extend( [pytag[:2],
40214 * pytype.encode('ascii'), # <<<<<<<<<<<<<<
40218 __pyx_k_tuple_146 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_146)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40219 __Pyx_GOTREF(__pyx_k_tuple_146);
40220 __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
40221 PyTuple_SET_ITEM(__pyx_k_tuple_146, 0, ((PyObject *)__pyx_n_s__ascii));
40222 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
40223 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_146));
40225 /* "csamtools.pyx":3020
40227 * def __init__(self):
40228 * raise TypeError("This class cannot be instantiated from Python") # <<<<<<<<<<<<<<
40230 * def __str__(self):
40232 __pyx_k_tuple_172 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_172)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40233 __Pyx_GOTREF(__pyx_k_tuple_172);
40234 __Pyx_INCREF(((PyObject *)__pyx_kp_s_171));
40235 PyTuple_SET_ITEM(__pyx_k_tuple_172, 0, ((PyObject *)__pyx_kp_s_171));
40236 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_171));
40237 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_172));
40239 /* "csamtools.pyx":3046
40241 * if self.plp[0] == NULL:
40242 * raise ValueError("PileupProxy accessed after iterator finished") # <<<<<<<<<<<<<<
40244 * # warning: there could be problems if self.n and self.buf are
40246 __pyx_k_tuple_174 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_174)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40247 __Pyx_GOTREF(__pyx_k_tuple_174);
40248 __Pyx_INCREF(((PyObject *)__pyx_kp_s_173));
40249 PyTuple_SET_ITEM(__pyx_k_tuple_174, 0, ((PyObject *)__pyx_kp_s_173));
40250 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_173));
40251 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_174));
40253 /* "csamtools.pyx":3059
40255 * def __init__(self):
40256 * raise TypeError("This class cannot be instantiated from Python") # <<<<<<<<<<<<<<
40258 * def __str__(self):
40260 __pyx_k_tuple_175 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_175)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40261 __Pyx_GOTREF(__pyx_k_tuple_175);
40262 __Pyx_INCREF(((PyObject *)__pyx_kp_s_171));
40263 PyTuple_SET_ITEM(__pyx_k_tuple_175, 0, ((PyObject *)__pyx_kp_s_171));
40264 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_171));
40265 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_175));
40267 /* "csamtools.pyx":3172
40268 * # recover. Thus redirect output to file with -o option.
40269 * if method == "view":
40270 * if "-o" in args: raise ValueError("option -o is forbidden in samtools view") # <<<<<<<<<<<<<<
40271 * args = ( "-o", stdout_f ) + args
40274 __pyx_k_tuple_180 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_180)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40275 __Pyx_GOTREF(__pyx_k_tuple_180);
40276 __Pyx_INCREF(((PyObject *)__pyx_kp_s_179));
40277 PyTuple_SET_ITEM(__pyx_k_tuple_180, 0, ((PyObject *)__pyx_kp_s_179));
40278 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_179));
40279 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_180));
40281 /* "csamtools.pyx":3197
40282 * stdout_save.restore()
40284 * with open( stdout_f, "r") as inf: # <<<<<<<<<<<<<<
40285 * out_stdout = inf.readlines()
40286 * except UnicodeDecodeError:
40288 __pyx_k_tuple_181 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_181)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40289 __Pyx_GOTREF(__pyx_k_tuple_181);
40290 __Pyx_INCREF(Py_None);
40291 PyTuple_SET_ITEM(__pyx_k_tuple_181, 0, Py_None);
40292 __Pyx_GIVEREF(Py_None);
40293 __Pyx_INCREF(Py_None);
40294 PyTuple_SET_ITEM(__pyx_k_tuple_181, 1, Py_None);
40295 __Pyx_GIVEREF(Py_None);
40296 __Pyx_INCREF(Py_None);
40297 PyTuple_SET_ITEM(__pyx_k_tuple_181, 2, Py_None);
40298 __Pyx_GIVEREF(Py_None);
40299 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_181));
40301 /* "csamtools.pyx":3200
40302 * out_stdout = inf.readlines()
40303 * except UnicodeDecodeError:
40304 * with open( stdout_f, "rb") as inf: # <<<<<<<<<<<<<<
40305 * # read binary output
40306 * out_stdout = inf.read()
40308 __pyx_k_tuple_182 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_182)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40309 __Pyx_GOTREF(__pyx_k_tuple_182);
40310 __Pyx_INCREF(Py_None);
40311 PyTuple_SET_ITEM(__pyx_k_tuple_182, 0, Py_None);
40312 __Pyx_GIVEREF(Py_None);
40313 __Pyx_INCREF(Py_None);
40314 PyTuple_SET_ITEM(__pyx_k_tuple_182, 1, Py_None);
40315 __Pyx_GIVEREF(Py_None);
40316 __Pyx_INCREF(Py_None);
40317 PyTuple_SET_ITEM(__pyx_k_tuple_182, 2, Py_None);
40318 __Pyx_GIVEREF(Py_None);
40319 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_182));
40321 /* "csamtools.pyx":3210
40322 * pysam_unset_stderr()
40324 * with open( stderr_f, "r") as inf: # <<<<<<<<<<<<<<
40325 * out_stderr = inf.readlines()
40326 * except UnicodeDecodeError:
40328 __pyx_k_tuple_183 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_183)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40329 __Pyx_GOTREF(__pyx_k_tuple_183);
40330 __Pyx_INCREF(Py_None);
40331 PyTuple_SET_ITEM(__pyx_k_tuple_183, 0, Py_None);
40332 __Pyx_GIVEREF(Py_None);
40333 __Pyx_INCREF(Py_None);
40334 PyTuple_SET_ITEM(__pyx_k_tuple_183, 1, Py_None);
40335 __Pyx_GIVEREF(Py_None);
40336 __Pyx_INCREF(Py_None);
40337 PyTuple_SET_ITEM(__pyx_k_tuple_183, 2, Py_None);
40338 __Pyx_GIVEREF(Py_None);
40339 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_183));
40341 /* "csamtools.pyx":3213
40342 * out_stderr = inf.readlines()
40343 * except UnicodeDecodeError:
40344 * with open( stderr_f, "rb") as inf: # <<<<<<<<<<<<<<
40345 * # read binary output
40346 * out_stderr = inf.read()
40348 __pyx_k_tuple_184 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_184)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40349 __Pyx_GOTREF(__pyx_k_tuple_184);
40350 __Pyx_INCREF(Py_None);
40351 PyTuple_SET_ITEM(__pyx_k_tuple_184, 0, Py_None);
40352 __Pyx_GIVEREF(Py_None);
40353 __Pyx_INCREF(Py_None);
40354 PyTuple_SET_ITEM(__pyx_k_tuple_184, 1, Py_None);
40355 __Pyx_GIVEREF(Py_None);
40356 __Pyx_INCREF(Py_None);
40357 PyTuple_SET_ITEM(__pyx_k_tuple_184, 2, Py_None);
40358 __Pyx_GIVEREF(Py_None);
40359 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_184));
40361 /* "csamtools.pyx":143
40363 * CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) )
40364 * CIGAR_REGEX = re.compile( "([MIDNSHP=X])(\d+)" ) # <<<<<<<<<<<<<<
40366 * #####################################################################
40368 __pyx_k_tuple_252 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_252)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40369 __Pyx_GOTREF(__pyx_k_tuple_252);
40370 __Pyx_INCREF(((PyObject *)__pyx_kp_s_251));
40371 PyTuple_SET_ITEM(__pyx_k_tuple_252, 0, ((PyObject *)__pyx_kp_s_251));
40372 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_251));
40373 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_252));
40375 /* "csamtools.pyx":260
40376 * list of reads (:class:`pysam.PileupRead`) aligned to this column
40378 * def __str__(self): # <<<<<<<<<<<<<<
40379 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
40380 * "\n" + "\n".join( map(str, self.pileups) )
40382 __pyx_k_tuple_254 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_254)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40383 __Pyx_GOTREF(__pyx_k_tuple_254);
40384 __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
40385 PyTuple_SET_ITEM(__pyx_k_tuple_254, 0, ((PyObject *)__pyx_n_s__self));
40386 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
40387 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_254));
40388 __pyx_k_codeobj_255 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_254, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s____str__, 260, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_255)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40390 /* "csamtools.pyx":308
40391 * stderr is captured.
40393 * def __init__(self): # <<<<<<<<<<<<<<
40395 * self.stderr_h, self.stderr_f = tempfile.mkstemp()
40397 __pyx_k_tuple_258 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_258)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40398 __Pyx_GOTREF(__pyx_k_tuple_258);
40399 __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
40400 PyTuple_SET_ITEM(__pyx_k_tuple_258, 0, ((PyObject *)__pyx_n_s__self));
40401 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
40402 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_258));
40403 __pyx_k_codeobj_259 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_258, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s____init__, 308, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_259)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40405 /* "csamtools.pyx":314
40406 * self.stderr_save.setfd( self.stderr_h )
40408 * def readAndRelease( self ): # <<<<<<<<<<<<<<
40410 * self.stderr_save.restore()
40412 __pyx_k_tuple_260 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_260)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40413 __Pyx_GOTREF(__pyx_k_tuple_260);
40414 __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
40415 PyTuple_SET_ITEM(__pyx_k_tuple_260, 0, ((PyObject *)__pyx_n_s__self));
40416 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
40417 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_260));
40418 __pyx_k_codeobj_261 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_260, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__readAndRelease, 314, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_261)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40420 /* "csamtools.pyx":323
40423 * def release(self): # <<<<<<<<<<<<<<
40425 * self.stderr_save.restore()
40427 __pyx_k_tuple_262 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_262)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40428 __Pyx_GOTREF(__pyx_k_tuple_262);
40429 __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
40430 PyTuple_SET_ITEM(__pyx_k_tuple_262, 0, ((PyObject *)__pyx_n_s__self));
40431 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
40432 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_262));
40433 __pyx_k_codeobj_263 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_262, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__release, 323, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_263)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40435 /* "csamtools.pyx":329
40436 * os.remove( self.stderr_f )
40438 * def __del__(self): # <<<<<<<<<<<<<<
40442 __pyx_k_tuple_264 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_264)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40443 __Pyx_GOTREF(__pyx_k_tuple_264);
40444 __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
40445 PyTuple_SET_ITEM(__pyx_k_tuple_264, 0, ((PyObject *)__pyx_n_s__self));
40446 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
40447 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_264));
40448 __pyx_k_codeobj_265 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_264, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s____del__, 329, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_265)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40450 /* "csamtools.pyx":334
40451 * class StderrStoreWindows():
40452 * '''does nothing. stderr can't be redirected on windows'''
40453 * def __init__(self): pass # <<<<<<<<<<<<<<
40454 * def readAndRelease(self): return []
40455 * def release(self): pass
40457 __pyx_k_tuple_267 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_267)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40458 __Pyx_GOTREF(__pyx_k_tuple_267);
40459 __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
40460 PyTuple_SET_ITEM(__pyx_k_tuple_267, 0, ((PyObject *)__pyx_n_s__self));
40461 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
40462 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_267));
40463 __pyx_k_codeobj_268 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_267, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s____init__, 334, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_268)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40465 /* "csamtools.pyx":335
40466 * '''does nothing. stderr can't be redirected on windows'''
40467 * def __init__(self): pass
40468 * def readAndRelease(self): return [] # <<<<<<<<<<<<<<
40469 * def release(self): pass
40472 __pyx_k_tuple_269 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_269)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40473 __Pyx_GOTREF(__pyx_k_tuple_269);
40474 __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
40475 PyTuple_SET_ITEM(__pyx_k_tuple_269, 0, ((PyObject *)__pyx_n_s__self));
40476 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
40477 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_269));
40478 __pyx_k_codeobj_270 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_269, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__readAndRelease, 335, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_270)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40480 /* "csamtools.pyx":336
40481 * def __init__(self): pass
40482 * def readAndRelease(self): return []
40483 * def release(self): pass # <<<<<<<<<<<<<<
40485 * if platform.system()=='Windows':
40487 __pyx_k_tuple_271 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_271)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40488 __Pyx_GOTREF(__pyx_k_tuple_271);
40489 __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
40490 PyTuple_SET_ITEM(__pyx_k_tuple_271, 0, ((PyObject *)__pyx_n_s__self));
40491 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
40492 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_271));
40493 __pyx_k_codeobj_272 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_271, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__release, 336, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_272)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40495 /* "csamtools.pyx":354
40497 * # order of records within sam headers
40498 * VALID_HEADERS = ("HD", "SQ", "RG", "PG", "CO" ) # <<<<<<<<<<<<<<
40500 * # type conversions within sam header records
40502 __pyx_k_tuple_274 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_274)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40503 __Pyx_GOTREF(__pyx_k_tuple_274);
40504 __Pyx_INCREF(((PyObject *)__pyx_n_s__HD));
40505 PyTuple_SET_ITEM(__pyx_k_tuple_274, 0, ((PyObject *)__pyx_n_s__HD));
40506 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__HD));
40507 __Pyx_INCREF(((PyObject *)__pyx_n_s__SQ));
40508 PyTuple_SET_ITEM(__pyx_k_tuple_274, 1, ((PyObject *)__pyx_n_s__SQ));
40509 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SQ));
40510 __Pyx_INCREF(((PyObject *)__pyx_n_s__RG));
40511 PyTuple_SET_ITEM(__pyx_k_tuple_274, 2, ((PyObject *)__pyx_n_s__RG));
40512 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RG));
40513 __Pyx_INCREF(((PyObject *)__pyx_n_s__PG));
40514 PyTuple_SET_ITEM(__pyx_k_tuple_274, 3, ((PyObject *)__pyx_n_s__PG));
40515 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PG));
40516 __Pyx_INCREF(((PyObject *)__pyx_n_s__CO));
40517 PyTuple_SET_ITEM(__pyx_k_tuple_274, 4, ((PyObject *)__pyx_n_s__CO));
40518 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CO));
40519 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_274));
40521 /* "csamtools.pyx":364
40523 * # output order of fields within records
40524 * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ), # <<<<<<<<<<<<<<
40525 * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
40526 * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS" ),
40528 __pyx_k_tuple_275 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_275)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40529 __Pyx_GOTREF(__pyx_k_tuple_275);
40530 __Pyx_INCREF(((PyObject *)__pyx_n_s__VN));
40531 PyTuple_SET_ITEM(__pyx_k_tuple_275, 0, ((PyObject *)__pyx_n_s__VN));
40532 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VN));
40533 __Pyx_INCREF(((PyObject *)__pyx_n_s__SO));
40534 PyTuple_SET_ITEM(__pyx_k_tuple_275, 1, ((PyObject *)__pyx_n_s__SO));
40535 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SO));
40536 __Pyx_INCREF(((PyObject *)__pyx_n_s__GO));
40537 PyTuple_SET_ITEM(__pyx_k_tuple_275, 2, ((PyObject *)__pyx_n_s__GO));
40538 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__GO));
40539 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_275));
40541 /* "csamtools.pyx":365
40542 * # output order of fields within records
40543 * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
40544 * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), # <<<<<<<<<<<<<<
40545 * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS" ),
40546 * "PG" : ( "PN", "ID", "VN", "CL" ), }
40548 __pyx_k_tuple_276 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_276)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40549 __Pyx_GOTREF(__pyx_k_tuple_276);
40550 __Pyx_INCREF(((PyObject *)__pyx_n_s__SN));
40551 PyTuple_SET_ITEM(__pyx_k_tuple_276, 0, ((PyObject *)__pyx_n_s__SN));
40552 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SN));
40553 __Pyx_INCREF(((PyObject *)__pyx_n_s__LN));
40554 PyTuple_SET_ITEM(__pyx_k_tuple_276, 1, ((PyObject *)__pyx_n_s__LN));
40555 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LN));
40556 __Pyx_INCREF(((PyObject *)__pyx_n_s__AS));
40557 PyTuple_SET_ITEM(__pyx_k_tuple_276, 2, ((PyObject *)__pyx_n_s__AS));
40558 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__AS));
40559 __Pyx_INCREF(((PyObject *)__pyx_n_s__M5));
40560 PyTuple_SET_ITEM(__pyx_k_tuple_276, 3, ((PyObject *)__pyx_n_s__M5));
40561 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__M5));
40562 __Pyx_INCREF(((PyObject *)__pyx_n_s__UR));
40563 PyTuple_SET_ITEM(__pyx_k_tuple_276, 4, ((PyObject *)__pyx_n_s__UR));
40564 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__UR));
40565 __Pyx_INCREF(((PyObject *)__pyx_n_s__SP));
40566 PyTuple_SET_ITEM(__pyx_k_tuple_276, 5, ((PyObject *)__pyx_n_s__SP));
40567 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SP));
40568 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_276));
40570 /* "csamtools.pyx":366
40571 * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
40572 * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
40573 * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS" ), # <<<<<<<<<<<<<<
40574 * "PG" : ( "PN", "ID", "VN", "CL" ), }
40577 __pyx_k_tuple_277 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_277)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40578 __Pyx_GOTREF(__pyx_k_tuple_277);
40579 __Pyx_INCREF(((PyObject *)__pyx_n_s__ID));
40580 PyTuple_SET_ITEM(__pyx_k_tuple_277, 0, ((PyObject *)__pyx_n_s__ID));
40581 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ID));
40582 __Pyx_INCREF(((PyObject *)__pyx_n_s__SM));
40583 PyTuple_SET_ITEM(__pyx_k_tuple_277, 1, ((PyObject *)__pyx_n_s__SM));
40584 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SM));
40585 __Pyx_INCREF(((PyObject *)__pyx_n_s__LB));
40586 PyTuple_SET_ITEM(__pyx_k_tuple_277, 2, ((PyObject *)__pyx_n_s__LB));
40587 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LB));
40588 __Pyx_INCREF(((PyObject *)__pyx_n_s__DS));
40589 PyTuple_SET_ITEM(__pyx_k_tuple_277, 3, ((PyObject *)__pyx_n_s__DS));
40590 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DS));
40591 __Pyx_INCREF(((PyObject *)__pyx_n_s__PU));
40592 PyTuple_SET_ITEM(__pyx_k_tuple_277, 4, ((PyObject *)__pyx_n_s__PU));
40593 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PU));
40594 __Pyx_INCREF(((PyObject *)__pyx_n_s__PI));
40595 PyTuple_SET_ITEM(__pyx_k_tuple_277, 5, ((PyObject *)__pyx_n_s__PI));
40596 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PI));
40597 __Pyx_INCREF(((PyObject *)__pyx_n_s__CN));
40598 PyTuple_SET_ITEM(__pyx_k_tuple_277, 6, ((PyObject *)__pyx_n_s__CN));
40599 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CN));
40600 __Pyx_INCREF(((PyObject *)__pyx_n_s__DT));
40601 PyTuple_SET_ITEM(__pyx_k_tuple_277, 7, ((PyObject *)__pyx_n_s__DT));
40602 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DT));
40603 __Pyx_INCREF(((PyObject *)__pyx_n_s__PL));
40604 PyTuple_SET_ITEM(__pyx_k_tuple_277, 8, ((PyObject *)__pyx_n_s__PL));
40605 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PL));
40606 __Pyx_INCREF(((PyObject *)__pyx_n_s__FO));
40607 PyTuple_SET_ITEM(__pyx_k_tuple_277, 9, ((PyObject *)__pyx_n_s__FO));
40608 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FO));
40609 __Pyx_INCREF(((PyObject *)__pyx_n_s__KS));
40610 PyTuple_SET_ITEM(__pyx_k_tuple_277, 10, ((PyObject *)__pyx_n_s__KS));
40611 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__KS));
40612 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_277));
40614 /* "csamtools.pyx":367
40615 * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
40616 * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS" ),
40617 * "PG" : ( "PN", "ID", "VN", "CL" ), } # <<<<<<<<<<<<<<
40621 __pyx_k_tuple_278 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_278)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40622 __Pyx_GOTREF(__pyx_k_tuple_278);
40623 __Pyx_INCREF(((PyObject *)__pyx_n_s__PN));
40624 PyTuple_SET_ITEM(__pyx_k_tuple_278, 0, ((PyObject *)__pyx_n_s__PN));
40625 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PN));
40626 __Pyx_INCREF(((PyObject *)__pyx_n_s__ID));
40627 PyTuple_SET_ITEM(__pyx_k_tuple_278, 1, ((PyObject *)__pyx_n_s__ID));
40628 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ID));
40629 __Pyx_INCREF(((PyObject *)__pyx_n_s__VN));
40630 PyTuple_SET_ITEM(__pyx_k_tuple_278, 2, ((PyObject *)__pyx_n_s__VN));
40631 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VN));
40632 __Pyx_INCREF(((PyObject *)__pyx_n_s__CL));
40633 PyTuple_SET_ITEM(__pyx_k_tuple_278, 3, ((PyObject *)__pyx_n_s__CL));
40634 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CL));
40635 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_278));
40637 /* "csamtools.pyx":3092
40639 * '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
40640 * def __init__(self, id = 1): # <<<<<<<<<<<<<<
40641 * self.streams = []
40644 __pyx_k_tuple_279 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_279)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40645 __Pyx_GOTREF(__pyx_k_tuple_279);
40646 __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
40647 PyTuple_SET_ITEM(__pyx_k_tuple_279, 0, ((PyObject *)__pyx_n_s__self));
40648 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
40649 __Pyx_INCREF(((PyObject *)__pyx_n_s__id));
40650 PyTuple_SET_ITEM(__pyx_k_tuple_279, 1, ((PyObject *)__pyx_n_s__id));
40651 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__id));
40652 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_279));
40653 __pyx_k_codeobj_280 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_279, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s____init__, 3092, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_280)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40654 __pyx_k_tuple_281 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_281)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40655 __Pyx_GOTREF(__pyx_k_tuple_281);
40656 __Pyx_INCREF(((PyObject *)__pyx_int_1));
40657 PyTuple_SET_ITEM(__pyx_k_tuple_281, 0, ((PyObject *)__pyx_int_1));
40658 __Pyx_GIVEREF(((PyObject *)__pyx_int_1));
40659 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_281));
40661 /* "csamtools.pyx":3096
40664 * def setdevice(self, filename): # <<<<<<<<<<<<<<
40665 * '''open an existing file, like "/dev/null"'''
40666 * fd = os.open(filename, os.O_WRONLY)
40668 __pyx_k_tuple_282 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_282)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40669 __Pyx_GOTREF(__pyx_k_tuple_282);
40670 __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
40671 PyTuple_SET_ITEM(__pyx_k_tuple_282, 0, ((PyObject *)__pyx_n_s__self));
40672 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
40673 __Pyx_INCREF(((PyObject *)__pyx_n_s__filename));
40674 PyTuple_SET_ITEM(__pyx_k_tuple_282, 1, ((PyObject *)__pyx_n_s__filename));
40675 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filename));
40676 __Pyx_INCREF(((PyObject *)__pyx_n_s__fd));
40677 PyTuple_SET_ITEM(__pyx_k_tuple_282, 2, ((PyObject *)__pyx_n_s__fd));
40678 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fd));
40679 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_282));
40680 __pyx_k_codeobj_283 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_282, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__setdevice, 3096, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_283)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40682 /* "csamtools.pyx":3101
40685 * def setfile(self, filename): # <<<<<<<<<<<<<<
40686 * '''open a new file.'''
40687 * fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660);
40689 __pyx_k_tuple_284 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_284)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40690 __Pyx_GOTREF(__pyx_k_tuple_284);
40691 __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
40692 PyTuple_SET_ITEM(__pyx_k_tuple_284, 0, ((PyObject *)__pyx_n_s__self));
40693 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
40694 __Pyx_INCREF(((PyObject *)__pyx_n_s__filename));
40695 PyTuple_SET_ITEM(__pyx_k_tuple_284, 1, ((PyObject *)__pyx_n_s__filename));
40696 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filename));
40697 __Pyx_INCREF(((PyObject *)__pyx_n_s__fd));
40698 PyTuple_SET_ITEM(__pyx_k_tuple_284, 2, ((PyObject *)__pyx_n_s__fd));
40699 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fd));
40700 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_284));
40701 __pyx_k_codeobj_285 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_284, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__setfile, 3101, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_285)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40703 /* "csamtools.pyx":3106
40706 * def setfd(self, fd): # <<<<<<<<<<<<<<
40707 * ofd = os.dup(self.id) # Save old stream on new unit.
40708 * self.streams.append(ofd)
40710 __pyx_k_tuple_286 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_286)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40711 __Pyx_GOTREF(__pyx_k_tuple_286);
40712 __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
40713 PyTuple_SET_ITEM(__pyx_k_tuple_286, 0, ((PyObject *)__pyx_n_s__self));
40714 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
40715 __Pyx_INCREF(((PyObject *)__pyx_n_s__fd));
40716 PyTuple_SET_ITEM(__pyx_k_tuple_286, 1, ((PyObject *)__pyx_n_s__fd));
40717 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fd));
40718 __Pyx_INCREF(((PyObject *)__pyx_n_s__ofd));
40719 PyTuple_SET_ITEM(__pyx_k_tuple_286, 2, ((PyObject *)__pyx_n_s__ofd));
40720 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ofd));
40721 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_286));
40722 __pyx_k_codeobj_287 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_286, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__setfd, 3106, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_287)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40724 /* "csamtools.pyx":3114
40725 * os.close(fd) # Close other unit (look out, caller.)
40727 * def restore(self): # <<<<<<<<<<<<<<
40728 * '''restore previous output stream'''
40731 __pyx_k_tuple_288 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_288)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40732 __Pyx_GOTREF(__pyx_k_tuple_288);
40733 __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
40734 PyTuple_SET_ITEM(__pyx_k_tuple_288, 0, ((PyObject *)__pyx_n_s__self));
40735 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
40736 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_288));
40737 __pyx_k_codeobj_289 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s__restore, 3114, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_289)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40739 /* "csamtools.pyx":3125
40740 * del self.streams[-1]
40742 * def _samtools_dispatch( method, # <<<<<<<<<<<<<<
40744 * catch_stdout = True ):
40746 __pyx_k_tuple_291 = PyTuple_New(16); if (unlikely(!__pyx_k_tuple_291)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40747 __Pyx_GOTREF(__pyx_k_tuple_291);
40748 __Pyx_INCREF(((PyObject *)__pyx_n_s__method));
40749 PyTuple_SET_ITEM(__pyx_k_tuple_291, 0, ((PyObject *)__pyx_n_s__method));
40750 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__method));
40751 __Pyx_INCREF(((PyObject *)__pyx_n_s__args));
40752 PyTuple_SET_ITEM(__pyx_k_tuple_291, 1, ((PyObject *)__pyx_n_s__args));
40753 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__args));
40754 __Pyx_INCREF(((PyObject *)__pyx_n_s__catch_stdout));
40755 PyTuple_SET_ITEM(__pyx_k_tuple_291, 2, ((PyObject *)__pyx_n_s__catch_stdout));
40756 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__catch_stdout));
40757 __Pyx_INCREF(((PyObject *)__pyx_n_s__stderr_h));
40758 PyTuple_SET_ITEM(__pyx_k_tuple_291, 3, ((PyObject *)__pyx_n_s__stderr_h));
40759 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stderr_h));
40760 __Pyx_INCREF(((PyObject *)__pyx_n_s__stderr_f));
40761 PyTuple_SET_ITEM(__pyx_k_tuple_291, 4, ((PyObject *)__pyx_n_s__stderr_f));
40762 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stderr_f));
40763 __Pyx_INCREF(((PyObject *)__pyx_n_s__stdout_h));
40764 PyTuple_SET_ITEM(__pyx_k_tuple_291, 5, ((PyObject *)__pyx_n_s__stdout_h));
40765 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stdout_h));
40766 __Pyx_INCREF(((PyObject *)__pyx_n_s__stdout_f));
40767 PyTuple_SET_ITEM(__pyx_k_tuple_291, 6, ((PyObject *)__pyx_n_s__stdout_f));
40768 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stdout_f));
40769 __Pyx_INCREF(((PyObject *)__pyx_n_s__stdout_save));
40770 PyTuple_SET_ITEM(__pyx_k_tuple_291, 7, ((PyObject *)__pyx_n_s__stdout_save));
40771 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stdout_save));
40772 __Pyx_INCREF(((PyObject *)__pyx_n_s__cargs));
40773 PyTuple_SET_ITEM(__pyx_k_tuple_291, 8, ((PyObject *)__pyx_n_s__cargs));
40774 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cargs));
40775 __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
40776 PyTuple_SET_ITEM(__pyx_k_tuple_291, 9, ((PyObject *)__pyx_n_s__i));
40777 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
40778 __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
40779 PyTuple_SET_ITEM(__pyx_k_tuple_291, 10, ((PyObject *)__pyx_n_s__n));
40780 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
40781 __Pyx_INCREF(((PyObject *)__pyx_n_s__retval));
40782 PyTuple_SET_ITEM(__pyx_k_tuple_291, 11, ((PyObject *)__pyx_n_s__retval));
40783 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__retval));
40784 __Pyx_INCREF(((PyObject *)__pyx_n_s__inf));
40785 PyTuple_SET_ITEM(__pyx_k_tuple_291, 12, ((PyObject *)__pyx_n_s__inf));
40786 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__inf));
40787 __Pyx_INCREF(((PyObject *)__pyx_n_s__out_stdout));
40788 PyTuple_SET_ITEM(__pyx_k_tuple_291, 13, ((PyObject *)__pyx_n_s__out_stdout));
40789 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out_stdout));
40790 __Pyx_INCREF(((PyObject *)__pyx_n_s__out_stderr));
40791 PyTuple_SET_ITEM(__pyx_k_tuple_291, 14, ((PyObject *)__pyx_n_s__out_stderr));
40792 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out_stderr));
40793 __Pyx_INCREF(((PyObject *)__pyx_n_s__a));
40794 PyTuple_SET_ITEM(__pyx_k_tuple_291, 15, ((PyObject *)__pyx_n_s__a));
40795 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a));
40796 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_291));
40797 __pyx_k_codeobj_292 = (PyObject*)__Pyx_PyCode_New(3, 0, 16, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_291, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_256, __pyx_n_s___samtools_dispatch, 3125, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_292)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40798 __Pyx_RefNannyFinishContext();
40801 __Pyx_RefNannyFinishContext();
40805 static int __Pyx_InitGlobals(void) {
40806 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40807 __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;};
40808 __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;};
40809 __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40810 __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40811 __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40812 __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40813 __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40814 __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40815 __pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40816 __pyx_int_128 = PyInt_FromLong(128); if (unlikely(!__pyx_int_128)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40817 __pyx_int_255 = PyInt_FromLong(255); if (unlikely(!__pyx_int_255)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40818 __pyx_int_256 = PyInt_FromLong(256); if (unlikely(!__pyx_int_256)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40819 __pyx_int_512 = PyInt_FromLong(512); if (unlikely(!__pyx_int_512)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40820 __pyx_int_neg_127 = PyInt_FromLong(-127); if (unlikely(!__pyx_int_neg_127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40821 __pyx_int_0660 = PyInt_FromLong(0660); if (unlikely(!__pyx_int_0660)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40822 __pyx_int_1024 = PyInt_FromLong(1024); if (unlikely(!__pyx_int_1024)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40823 __pyx_int_8000 = PyInt_FromLong(8000); if (unlikely(!__pyx_int_8000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40824 __pyx_int_65535 = PyInt_FromLong(65535); if (unlikely(!__pyx_int_65535)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40825 __pyx_int_neg_32767 = PyInt_FromLong(-32767); if (unlikely(!__pyx_int_neg_32767)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40826 __pyx_int_536870912 = PyInt_FromLong(536870912); if (unlikely(!__pyx_int_536870912)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40827 __pyx_int_4294967295 = PyInt_FromString((char *)"4294967295", 0, 0); if (unlikely(!__pyx_int_4294967295)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40828 __pyx_int_neg_2147483648 = PyInt_FromLong(-2147483648); if (unlikely(!__pyx_int_neg_2147483648)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40834 #if PY_MAJOR_VERSION < 3
40835 PyMODINIT_FUNC initcsamtools(void); /*proto*/
40836 PyMODINIT_FUNC initcsamtools(void)
40838 PyMODINIT_FUNC PyInit_csamtools(void); /*proto*/
40839 PyMODINIT_FUNC PyInit_csamtools(void)
40842 PyObject *__pyx_t_1 = NULL;
40843 PyObject *__pyx_t_2 = NULL;
40845 PyObject *__pyx_t_4 = NULL;
40846 __Pyx_RefNannyDeclarations
40847 #if CYTHON_REFNANNY
40848 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
40849 if (!__Pyx_RefNanny) {
40851 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
40852 if (!__Pyx_RefNanny)
40853 Py_FatalError("failed to import 'refnanny' module");
40856 __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_csamtools(void)", 0);
40857 if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40858 __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;}
40859 __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;}
40860 #ifdef __Pyx_CyFunction_USED
40861 if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40863 #ifdef __Pyx_FusedFunction_USED
40864 if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40866 #ifdef __Pyx_Generator_USED
40867 if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40869 /*--- Library function declarations ---*/
40870 /*--- Threads initialization code ---*/
40871 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
40872 #ifdef WITH_THREAD /* Python build with threading support? */
40873 PyEval_InitThreads();
40876 /*--- Module creation code ---*/
40877 #if PY_MAJOR_VERSION < 3
40878 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("csamtools"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
40880 __pyx_m = PyModule_Create(&__pyx_moduledef);
40882 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40883 #if PY_MAJOR_VERSION < 3
40884 Py_INCREF(__pyx_m);
40886 __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
40887 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40888 if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
40889 /*--- Initialize various global constants etc. ---*/
40890 if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40891 if (__pyx_module_is_main_csamtools) {
40892 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;};
40894 /*--- Builtin init code ---*/
40895 if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40896 /*--- Constants init code ---*/
40897 if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40898 /*--- Global init code ---*/
40899 __pyx_v_9csamtools__FILENAME_ENCODING = ((PyObject*)Py_None); Py_INCREF(Py_None);
40900 /*--- Variable export code ---*/
40901 /*--- Function export code ---*/
40902 /*--- Type init code ---*/
40903 __pyx_vtabptr_9csamtools_Fastafile = &__pyx_vtable_9csamtools_Fastafile;
40904 __pyx_vtable_9csamtools_Fastafile._fetch = (char *(*)(struct __pyx_obj_9csamtools_Fastafile *, char *, int, int, int *))__pyx_f_9csamtools_9Fastafile__fetch;
40905 if (PyType_Ready(&__pyx_type_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40906 if (__Pyx_SetVtable(__pyx_type_9csamtools_Fastafile.tp_dict, __pyx_vtabptr_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40907 if (__Pyx_SetAttrString(__pyx_m, "Fastafile", (PyObject *)&__pyx_type_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40908 __pyx_ptype_9csamtools_Fastafile = &__pyx_type_9csamtools_Fastafile;
40909 if (PyType_Ready(&__pyx_type_9csamtools_AlignedRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40911 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_AlignedRead, "__str__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40912 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
40913 __pyx_wrapperbase_9csamtools_11AlignedRead_4__str__ = *((PyWrapperDescrObject *)wrapper)->d_base;
40914 __pyx_wrapperbase_9csamtools_11AlignedRead_4__str__.doc = __pyx_doc_9csamtools_11AlignedRead_4__str__;
40915 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_11AlignedRead_4__str__;
40918 if (__Pyx_SetAttrString(__pyx_m, "AlignedRead", (PyObject *)&__pyx_type_9csamtools_AlignedRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40919 __pyx_ptype_9csamtools_AlignedRead = &__pyx_type_9csamtools_AlignedRead;
40920 __pyx_vtabptr_9csamtools_Samfile = &__pyx_vtable_9csamtools_Samfile;
40921 __pyx_vtable_9csamtools_Samfile._buildHeader = (bam_header_t *(*)(struct __pyx_obj_9csamtools_Samfile *, PyObject *))__pyx_f_9csamtools_7Samfile__buildHeader;
40922 __pyx_vtable_9csamtools_Samfile.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_Samfile *))__pyx_f_9csamtools_7Samfile_getCurrent;
40923 __pyx_vtable_9csamtools_Samfile.cnext = (int (*)(struct __pyx_obj_9csamtools_Samfile *))__pyx_f_9csamtools_7Samfile_cnext;
40924 __pyx_vtable_9csamtools_Samfile.write = (int (*)(struct __pyx_obj_9csamtools_Samfile *, struct __pyx_obj_9csamtools_AlignedRead *, int __pyx_skip_dispatch))__pyx_f_9csamtools_7Samfile_write;
40925 __pyx_vtable_9csamtools_Samfile._getrname = (char *(*)(struct __pyx_obj_9csamtools_Samfile *, int))__pyx_f_9csamtools_7Samfile__getrname;
40926 if (PyType_Ready(&__pyx_type_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40928 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_Samfile, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40929 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
40930 __pyx_wrapperbase_9csamtools_7Samfile_42__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
40931 __pyx_wrapperbase_9csamtools_7Samfile_42__next__.doc = __pyx_doc_9csamtools_7Samfile_42__next__;
40932 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_7Samfile_42__next__;
40935 if (__Pyx_SetVtable(__pyx_type_9csamtools_Samfile.tp_dict, __pyx_vtabptr_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40936 if (__Pyx_SetAttrString(__pyx_m, "Samfile", (PyObject *)&__pyx_type_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40937 __pyx_ptype_9csamtools_Samfile = &__pyx_type_9csamtools_Samfile;
40938 if (PyType_Ready(&__pyx_type_9csamtools_PileupProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40939 if (__Pyx_SetAttrString(__pyx_m, "PileupProxy", (PyObject *)&__pyx_type_9csamtools_PileupProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40940 __pyx_ptype_9csamtools_PileupProxy = &__pyx_type_9csamtools_PileupProxy;
40941 if (PyType_Ready(&__pyx_type_9csamtools_PileupRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40942 if (__Pyx_SetAttrString(__pyx_m, "PileupRead", (PyObject *)&__pyx_type_9csamtools_PileupRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40943 __pyx_ptype_9csamtools_PileupRead = &__pyx_type_9csamtools_PileupRead;
40944 if (PyType_Ready(&__pyx_type_9csamtools_IteratorRow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40945 if (__Pyx_SetAttrString(__pyx_m, "IteratorRow", (PyObject *)&__pyx_type_9csamtools_IteratorRow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40946 __pyx_ptype_9csamtools_IteratorRow = &__pyx_type_9csamtools_IteratorRow;
40947 __pyx_vtabptr_9csamtools_IteratorRowRegion = &__pyx_vtable_9csamtools_IteratorRowRegion;
40948 __pyx_vtable_9csamtools_IteratorRowRegion.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_IteratorRowRegion *))__pyx_f_9csamtools_17IteratorRowRegion_getCurrent;
40949 __pyx_vtable_9csamtools_IteratorRowRegion.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorRowRegion *))__pyx_f_9csamtools_17IteratorRowRegion_cnext;
40950 __pyx_type_9csamtools_IteratorRowRegion.tp_base = __pyx_ptype_9csamtools_IteratorRow;
40951 if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40953 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowRegion, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40954 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
40955 __pyx_wrapperbase_9csamtools_17IteratorRowRegion_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
40956 __pyx_wrapperbase_9csamtools_17IteratorRowRegion_4__next__.doc = __pyx_doc_9csamtools_17IteratorRowRegion_4__next__;
40957 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_17IteratorRowRegion_4__next__;
40960 if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorRowRegion.tp_dict, __pyx_vtabptr_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40961 if (__Pyx_SetAttrString(__pyx_m, "IteratorRowRegion", (PyObject *)&__pyx_type_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40962 __pyx_ptype_9csamtools_IteratorRowRegion = &__pyx_type_9csamtools_IteratorRowRegion;
40963 __pyx_vtabptr_9csamtools_IteratorRowAll = &__pyx_vtable_9csamtools_IteratorRowAll;
40964 __pyx_vtable_9csamtools_IteratorRowAll.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_IteratorRowAll *))__pyx_f_9csamtools_14IteratorRowAll_getCurrent;
40965 __pyx_vtable_9csamtools_IteratorRowAll.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorRowAll *))__pyx_f_9csamtools_14IteratorRowAll_cnext;
40966 __pyx_type_9csamtools_IteratorRowAll.tp_base = __pyx_ptype_9csamtools_IteratorRow;
40967 if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40969 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowAll, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40970 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
40971 __pyx_wrapperbase_9csamtools_14IteratorRowAll_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
40972 __pyx_wrapperbase_9csamtools_14IteratorRowAll_4__next__.doc = __pyx_doc_9csamtools_14IteratorRowAll_4__next__;
40973 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_14IteratorRowAll_4__next__;
40976 if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorRowAll.tp_dict, __pyx_vtabptr_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40977 if (__Pyx_SetAttrString(__pyx_m, "IteratorRowAll", (PyObject *)&__pyx_type_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40978 __pyx_ptype_9csamtools_IteratorRowAll = &__pyx_type_9csamtools_IteratorRowAll;
40979 __pyx_type_9csamtools_IteratorRowAllRefs.tp_base = __pyx_ptype_9csamtools_IteratorRow;
40980 if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40982 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowAllRefs, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40983 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
40984 __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_6__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
40985 __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_6__next__.doc = __pyx_doc_9csamtools_18IteratorRowAllRefs_6__next__;
40986 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_6__next__;
40989 if (__Pyx_SetAttrString(__pyx_m, "IteratorRowAllRefs", (PyObject *)&__pyx_type_9csamtools_IteratorRowAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40990 __pyx_ptype_9csamtools_IteratorRowAllRefs = &__pyx_type_9csamtools_IteratorRowAllRefs;
40991 __pyx_vtabptr_9csamtools_IteratorRowSelection = &__pyx_vtable_9csamtools_IteratorRowSelection;
40992 __pyx_vtable_9csamtools_IteratorRowSelection.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_IteratorRowSelection *))__pyx_f_9csamtools_20IteratorRowSelection_getCurrent;
40993 __pyx_vtable_9csamtools_IteratorRowSelection.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorRowSelection *))__pyx_f_9csamtools_20IteratorRowSelection_cnext;
40994 __pyx_type_9csamtools_IteratorRowSelection.tp_base = __pyx_ptype_9csamtools_IteratorRow;
40995 if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40997 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowSelection, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
40998 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
40999 __pyx_wrapperbase_9csamtools_20IteratorRowSelection_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
41000 __pyx_wrapperbase_9csamtools_20IteratorRowSelection_4__next__.doc = __pyx_doc_9csamtools_20IteratorRowSelection_4__next__;
41001 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_20IteratorRowSelection_4__next__;
41004 if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorRowSelection.tp_dict, __pyx_vtabptr_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41005 if (__Pyx_SetAttrString(__pyx_m, "IteratorRowSelection", (PyObject *)&__pyx_type_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41006 __pyx_ptype_9csamtools_IteratorRowSelection = &__pyx_type_9csamtools_IteratorRowSelection;
41007 __pyx_vtabptr_9csamtools_IteratorColumn = &__pyx_vtable_9csamtools_IteratorColumn;
41008 __pyx_vtable_9csamtools_IteratorColumn.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorColumn *))__pyx_f_9csamtools_14IteratorColumn_cnext;
41009 __pyx_vtable_9csamtools_IteratorColumn.getSequence = (char *(*)(struct __pyx_obj_9csamtools_IteratorColumn *))__pyx_f_9csamtools_14IteratorColumn_getSequence;
41010 __pyx_vtable_9csamtools_IteratorColumn.setMask = (PyObject *(*)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *))__pyx_f_9csamtools_14IteratorColumn_setMask;
41011 __pyx_vtable_9csamtools_IteratorColumn.setupIteratorData = (PyObject *(*)(struct __pyx_obj_9csamtools_IteratorColumn *, int, int, int, struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData *__pyx_optional_args))__pyx_f_9csamtools_14IteratorColumn_setupIteratorData;
41012 __pyx_vtable_9csamtools_IteratorColumn.reset = (PyObject *(*)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *, PyObject *, PyObject *))__pyx_f_9csamtools_14IteratorColumn_reset;
41013 if (PyType_Ready(&__pyx_type_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41014 if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorColumn.tp_dict, __pyx_vtabptr_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41015 if (__Pyx_SetAttrString(__pyx_m, "IteratorColumn", (PyObject *)&__pyx_type_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41016 __pyx_ptype_9csamtools_IteratorColumn = &__pyx_type_9csamtools_IteratorColumn;
41017 __pyx_vtabptr_9csamtools_IteratorColumnRegion = &__pyx_vtable_9csamtools_IteratorColumnRegion;
41018 __pyx_vtable_9csamtools_IteratorColumnRegion.__pyx_base = *__pyx_vtabptr_9csamtools_IteratorColumn;
41019 __pyx_type_9csamtools_IteratorColumnRegion.tp_base = __pyx_ptype_9csamtools_IteratorColumn;
41020 if (PyType_Ready(&__pyx_type_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41022 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorColumnRegion, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41023 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
41024 __pyx_wrapperbase_9csamtools_20IteratorColumnRegion_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
41025 __pyx_wrapperbase_9csamtools_20IteratorColumnRegion_2__next__.doc = __pyx_doc_9csamtools_20IteratorColumnRegion_2__next__;
41026 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_20IteratorColumnRegion_2__next__;
41029 if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorColumnRegion.tp_dict, __pyx_vtabptr_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41030 if (__Pyx_SetAttrString(__pyx_m, "IteratorColumnRegion", (PyObject *)&__pyx_type_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41031 __pyx_ptype_9csamtools_IteratorColumnRegion = &__pyx_type_9csamtools_IteratorColumnRegion;
41032 __pyx_vtabptr_9csamtools_IteratorColumnAllRefs = &__pyx_vtable_9csamtools_IteratorColumnAllRefs;
41033 __pyx_vtable_9csamtools_IteratorColumnAllRefs.__pyx_base = *__pyx_vtabptr_9csamtools_IteratorColumn;
41034 __pyx_type_9csamtools_IteratorColumnAllRefs.tp_base = __pyx_ptype_9csamtools_IteratorColumn;
41035 if (PyType_Ready(&__pyx_type_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41037 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorColumnAllRefs, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41038 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
41039 __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
41040 __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_2__next__.doc = __pyx_doc_9csamtools_21IteratorColumnAllRefs_2__next__;
41041 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_2__next__;
41044 if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorColumnAllRefs.tp_dict, __pyx_vtabptr_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41045 if (__Pyx_SetAttrString(__pyx_m, "IteratorColumnAllRefs", (PyObject *)&__pyx_type_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41046 __pyx_ptype_9csamtools_IteratorColumnAllRefs = &__pyx_type_9csamtools_IteratorColumnAllRefs;
41047 if (PyType_Ready(&__pyx_type_9csamtools_IndexedReads) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41048 if (__Pyx_SetAttrString(__pyx_m, "IndexedReads", (PyObject *)&__pyx_type_9csamtools_IndexedReads) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41049 __pyx_ptype_9csamtools_IndexedReads = &__pyx_type_9csamtools_IndexedReads;
41050 if (PyType_Ready(&__pyx_type_9csamtools_SNPCall) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41051 if (__Pyx_SetAttrString(__pyx_m, "SNPCall", (PyObject *)&__pyx_type_9csamtools_SNPCall) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41052 __pyx_ptype_9csamtools_SNPCall = &__pyx_type_9csamtools_SNPCall;
41053 if (PyType_Ready(&__pyx_type_9csamtools___pyx_scope_struct__genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41054 __pyx_ptype_9csamtools___pyx_scope_struct__genexpr = &__pyx_type_9csamtools___pyx_scope_struct__genexpr;
41055 if (PyType_Ready(&__pyx_type_9csamtools___pyx_scope_struct_1_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41056 __pyx_ptype_9csamtools___pyx_scope_struct_1_genexpr = &__pyx_type_9csamtools___pyx_scope_struct_1_genexpr;
41057 /*--- Type import code ---*/
41058 __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41059 __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41060 /*--- Variable import code ---*/
41061 /*--- Function import code ---*/
41062 /*--- Execution code ---*/
41064 /* "csamtools.pyx":4
41065 * # cython: profile=True
41066 * # adds doc-strings for sphinx
41067 * import tempfile # <<<<<<<<<<<<<<
41071 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__tempfile), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41072 __Pyx_GOTREF(__pyx_t_1);
41073 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tempfile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41074 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41076 /* "csamtools.pyx":5
41077 * # adds doc-strings for sphinx
41079 * import os # <<<<<<<<<<<<<<
41083 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41084 __Pyx_GOTREF(__pyx_t_1);
41085 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41086 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41088 /* "csamtools.pyx":6
41091 * import sys # <<<<<<<<<<<<<<
41095 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41096 __Pyx_GOTREF(__pyx_t_1);
41097 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41098 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41100 /* "csamtools.pyx":7
41103 * import types # <<<<<<<<<<<<<<
41107 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__types), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41108 __Pyx_GOTREF(__pyx_t_1);
41109 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__types, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41110 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41112 /* "csamtools.pyx":8
41115 * import itertools # <<<<<<<<<<<<<<
41119 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__itertools), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41120 __Pyx_GOTREF(__pyx_t_1);
41121 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__itertools, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41122 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41124 /* "csamtools.pyx":9
41127 * import struct # <<<<<<<<<<<<<<
41129 * import collections
41131 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41132 __Pyx_GOTREF(__pyx_t_1);
41133 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__struct, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41134 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41136 /* "csamtools.pyx":10
41139 * import ctypes # <<<<<<<<<<<<<<
41140 * import collections
41143 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__ctypes), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41144 __Pyx_GOTREF(__pyx_t_1);
41145 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ctypes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41146 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41148 /* "csamtools.pyx":11
41151 * import collections # <<<<<<<<<<<<<<
41155 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__collections), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41156 __Pyx_GOTREF(__pyx_t_1);
41157 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__collections, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41158 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41160 /* "csamtools.pyx":12
41162 * import collections
41163 * import re # <<<<<<<<<<<<<<
41167 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__re), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41168 __Pyx_GOTREF(__pyx_t_1);
41169 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__re, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41170 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41172 /* "csamtools.pyx":13
41173 * import collections
41175 * import platform # <<<<<<<<<<<<<<
41177 * from cpython cimport PyErr_SetString, PyBytes_Check, PyUnicode_Check, PyBytes_FromStringAndSize
41179 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__platform), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41180 __Pyx_GOTREF(__pyx_t_1);
41181 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__platform, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41182 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41184 /* "csamtools.pyx":14
41187 * import warnings # <<<<<<<<<<<<<<
41188 * from cpython cimport PyErr_SetString, PyBytes_Check, PyUnicode_Check, PyBytes_FromStringAndSize
41189 * from cpython.version cimport PY_MAJOR_VERSION
41191 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__warnings), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41192 __Pyx_GOTREF(__pyx_t_1);
41193 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__warnings, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41194 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41196 /* "csamtools.pyx":23
41197 * ## Python 3 compatibility functions
41198 * ########################################################################
41199 * IS_PYTHON3 = PY_MAJOR_VERSION >= 3 # <<<<<<<<<<<<<<
41200 * cdef from_string_and_size(char* s, size_t length):
41201 * if PY_MAJOR_VERSION < 3:
41203 __pyx_t_1 = __Pyx_PyBool_FromLong((PY_MAJOR_VERSION >= 3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41204 __Pyx_GOTREF(__pyx_t_1);
41205 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__IS_PYTHON3, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41206 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41208 /* "csamtools.pyx":32
41209 * # filename encoding (copied from lxml.etree.pyx)
41210 * cdef str _FILENAME_ENCODING
41211 * _FILENAME_ENCODING = sys.getfilesystemencoding() # <<<<<<<<<<<<<<
41212 * if _FILENAME_ENCODING is None:
41213 * _FILENAME_ENCODING = sys.getdefaultencoding()
41215 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41216 __Pyx_GOTREF(__pyx_t_1);
41217 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_249); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41218 __Pyx_GOTREF(__pyx_t_2);
41219 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41220 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41221 __Pyx_GOTREF(__pyx_t_1);
41222 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
41223 if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41224 __Pyx_XGOTREF(((PyObject *)__pyx_v_9csamtools__FILENAME_ENCODING));
41225 __Pyx_DECREF(((PyObject *)__pyx_v_9csamtools__FILENAME_ENCODING));
41226 __Pyx_GIVEREF(__pyx_t_1);
41227 __pyx_v_9csamtools__FILENAME_ENCODING = ((PyObject*)__pyx_t_1);
41230 /* "csamtools.pyx":33
41231 * cdef str _FILENAME_ENCODING
41232 * _FILENAME_ENCODING = sys.getfilesystemencoding()
41233 * if _FILENAME_ENCODING is None: # <<<<<<<<<<<<<<
41234 * _FILENAME_ENCODING = sys.getdefaultencoding()
41235 * if _FILENAME_ENCODING is None:
41237 __pyx_t_3 = (__pyx_v_9csamtools__FILENAME_ENCODING == ((PyObject*)Py_None));
41240 /* "csamtools.pyx":34
41241 * _FILENAME_ENCODING = sys.getfilesystemencoding()
41242 * if _FILENAME_ENCODING is None:
41243 * _FILENAME_ENCODING = sys.getdefaultencoding() # <<<<<<<<<<<<<<
41244 * if _FILENAME_ENCODING is None:
41245 * _FILENAME_ENCODING = 'ascii'
41247 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41248 __Pyx_GOTREF(__pyx_t_1);
41249 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__getdefaultencoding); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41250 __Pyx_GOTREF(__pyx_t_2);
41251 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41252 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41253 __Pyx_GOTREF(__pyx_t_1);
41254 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
41255 if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41256 __Pyx_XGOTREF(((PyObject *)__pyx_v_9csamtools__FILENAME_ENCODING));
41257 __Pyx_DECREF(((PyObject *)__pyx_v_9csamtools__FILENAME_ENCODING));
41258 __Pyx_GIVEREF(__pyx_t_1);
41259 __pyx_v_9csamtools__FILENAME_ENCODING = ((PyObject*)__pyx_t_1);
41265 /* "csamtools.pyx":35
41266 * if _FILENAME_ENCODING is None:
41267 * _FILENAME_ENCODING = sys.getdefaultencoding()
41268 * if _FILENAME_ENCODING is None: # <<<<<<<<<<<<<<
41269 * _FILENAME_ENCODING = 'ascii'
41272 __pyx_t_3 = (__pyx_v_9csamtools__FILENAME_ENCODING == ((PyObject*)Py_None));
41275 /* "csamtools.pyx":36
41276 * _FILENAME_ENCODING = sys.getdefaultencoding()
41277 * if _FILENAME_ENCODING is None:
41278 * _FILENAME_ENCODING = 'ascii' # <<<<<<<<<<<<<<
41280 * #cdef char* _C_FILENAME_ENCODING
41282 __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
41283 __Pyx_XGOTREF(((PyObject *)__pyx_v_9csamtools__FILENAME_ENCODING));
41284 __Pyx_DECREF(((PyObject *)__pyx_v_9csamtools__FILENAME_ENCODING));
41285 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
41286 __pyx_v_9csamtools__FILENAME_ENCODING = __pyx_n_s__ascii;
41291 /* "csamtools.pyx":138
41292 * DEF BAM_CDIFF = 8
41294 * cdef char* CODE2CIGAR= "MIDNSHP=X" # <<<<<<<<<<<<<<
41296 * CIGAR2CODE = dict( [y,x] for x,y in enumerate( CODE2CIGAR) )
41298 __pyx_v_9csamtools_CODE2CIGAR = __pyx_k_250;
41300 /* "csamtools.pyx":139
41302 * cdef char* CODE2CIGAR= "MIDNSHP=X"
41303 * if IS_PYTHON3: # <<<<<<<<<<<<<<
41304 * CIGAR2CODE = dict( [y,x] for x,y in enumerate( CODE2CIGAR) )
41307 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__IS_PYTHON3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41308 __Pyx_GOTREF(__pyx_t_1);
41309 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41310 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41313 /* "csamtools.pyx":140
41314 * cdef char* CODE2CIGAR= "MIDNSHP=X"
41316 * CIGAR2CODE = dict( [y,x] for x,y in enumerate( CODE2CIGAR) ) # <<<<<<<<<<<<<<
41318 * CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) )
41320 __pyx_t_1 = __pyx_pf_9csamtools_2genexpr(NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41321 __Pyx_GOTREF(__pyx_t_1);
41322 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41323 __Pyx_GOTREF(__pyx_t_2);
41324 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
41325 __Pyx_GIVEREF(__pyx_t_1);
41327 __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41328 __Pyx_GOTREF(__pyx_t_1);
41329 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
41330 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CIGAR2CODE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41331 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41336 /* "csamtools.pyx":142
41337 * CIGAR2CODE = dict( [y,x] for x,y in enumerate( CODE2CIGAR) )
41339 * CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) ) # <<<<<<<<<<<<<<
41340 * CIGAR_REGEX = re.compile( "([MIDNSHP=X])(\d+)" )
41343 __pyx_t_1 = __pyx_pf_9csamtools_5genexpr(NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41344 __Pyx_GOTREF(__pyx_t_1);
41345 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41346 __Pyx_GOTREF(__pyx_t_2);
41347 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
41348 __Pyx_GIVEREF(__pyx_t_1);
41350 __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41351 __Pyx_GOTREF(__pyx_t_1);
41352 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
41353 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CIGAR2CODE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41354 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41358 /* "csamtools.pyx":143
41360 * CIGAR2CODE = dict( [ord(y),x] for x,y in enumerate( CODE2CIGAR) )
41361 * CIGAR_REGEX = re.compile( "([MIDNSHP=X])(\d+)" ) # <<<<<<<<<<<<<<
41363 * #####################################################################
41365 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__re); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41366 __Pyx_GOTREF(__pyx_t_1);
41367 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__compile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41368 __Pyx_GOTREF(__pyx_t_2);
41369 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41370 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_252), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41371 __Pyx_GOTREF(__pyx_t_1);
41372 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
41373 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CIGAR_REGEX, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41374 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41376 /* "csamtools.pyx":147
41377 * #####################################################################
41378 * ## set pysam stderr to /dev/null
41379 * pysam_unset_stderr() # <<<<<<<<<<<<<<
41381 * #####################################################################
41383 pysam_unset_stderr();
41385 /* "csamtools.pyx":151
41386 * #####################################################################
41387 * # hard-coded constants
41388 * cdef char * bam_nt16_rev_table = "=ACMGRSVTWYHKDBN" # <<<<<<<<<<<<<<
41389 * cdef int max_pos = 2 << 29
41392 __pyx_v_9csamtools_bam_nt16_rev_table = __pyx_k_253;
41394 /* "csamtools.pyx":152
41395 * # hard-coded constants
41396 * cdef char * bam_nt16_rev_table = "=ACMGRSVTWYHKDBN"
41397 * cdef int max_pos = 2 << 29 # <<<<<<<<<<<<<<
41399 * #####################################################################
41401 __pyx_v_9csamtools_max_pos = 1073741824;
41403 /* "csamtools.pyx":247
41406 * class PileupColumn(object): # <<<<<<<<<<<<<<
41407 * '''A pileup column. A pileup column contains
41408 * all the reads that map to a certain target base.
41410 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41411 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
41413 /* "csamtools.pyx":260
41414 * list of reads (:class:`pysam.PileupRead`) aligned to this column
41416 * def __str__(self): # <<<<<<<<<<<<<<
41417 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
41418 * "\n" + "\n".join( map(str, self.pileups) )
41420 __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_12PileupColumn_1__str__, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_255)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41421 __Pyx_GOTREF(__pyx_t_2);
41422 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____str__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41423 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
41425 /* "csamtools.pyx":247
41428 * class PileupColumn(object): # <<<<<<<<<<<<<<
41429 * '''A pileup column. A pileup column contains
41430 * all the reads that map to a certain target base.
41432 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41433 __Pyx_GOTREF(__pyx_t_2);
41434 __Pyx_INCREF(__pyx_builtin_object);
41435 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_object);
41436 __Pyx_GIVEREF(__pyx_builtin_object);
41437 if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_257)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41438 __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1), __pyx_n_s__PileupColumn, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41439 __Pyx_GOTREF(__pyx_t_4);
41440 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
41441 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PileupColumn, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41442 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
41443 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
41445 /* "csamtools.pyx":304
41448 * class StderrStore(): # <<<<<<<<<<<<<<
41450 * stderr is captured.
41452 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41453 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
41455 /* "csamtools.pyx":308
41456 * stderr is captured.
41458 * def __init__(self): # <<<<<<<<<<<<<<
41460 * self.stderr_h, self.stderr_f = tempfile.mkstemp()
41462 __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_11StderrStore_1__init__, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_259)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41463 __Pyx_GOTREF(__pyx_t_4);
41464 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41465 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
41467 /* "csamtools.pyx":314
41468 * self.stderr_save.setfd( self.stderr_h )
41470 * def readAndRelease( self ): # <<<<<<<<<<<<<<
41472 * self.stderr_save.restore()
41474 __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_11StderrStore_3readAndRelease, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_261)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41475 __Pyx_GOTREF(__pyx_t_4);
41476 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__readAndRelease, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41477 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
41479 /* "csamtools.pyx":323
41482 * def release(self): # <<<<<<<<<<<<<<
41484 * self.stderr_save.restore()
41486 __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_11StderrStore_5release, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_263)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41487 __Pyx_GOTREF(__pyx_t_4);
41488 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__release, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41489 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
41491 /* "csamtools.pyx":329
41492 * os.remove( self.stderr_f )
41494 * def __del__(self): # <<<<<<<<<<<<<<
41498 __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_11StderrStore_7__del__, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_265)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41499 __Pyx_GOTREF(__pyx_t_4);
41500 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____del__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41501 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
41503 /* "csamtools.pyx":304
41506 * class StderrStore(): # <<<<<<<<<<<<<<
41508 * stderr is captured.
41510 if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_266)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41511 __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s__StderrStore, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41512 __Pyx_GOTREF(__pyx_t_4);
41513 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StderrStore, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41514 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
41515 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
41517 /* "csamtools.pyx":332
41520 * class StderrStoreWindows(): # <<<<<<<<<<<<<<
41521 * '''does nothing. stderr can't be redirected on windows'''
41522 * def __init__(self): pass
41524 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41525 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
41527 /* "csamtools.pyx":334
41528 * class StderrStoreWindows():
41529 * '''does nothing. stderr can't be redirected on windows'''
41530 * def __init__(self): pass # <<<<<<<<<<<<<<
41531 * def readAndRelease(self): return []
41532 * def release(self): pass
41534 __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_18StderrStoreWindows_1__init__, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_268)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41535 __Pyx_GOTREF(__pyx_t_4);
41536 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41537 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
41539 /* "csamtools.pyx":335
41540 * '''does nothing. stderr can't be redirected on windows'''
41541 * def __init__(self): pass
41542 * def readAndRelease(self): return [] # <<<<<<<<<<<<<<
41543 * def release(self): pass
41546 __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_18StderrStoreWindows_3readAndRelease, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_270)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41547 __Pyx_GOTREF(__pyx_t_4);
41548 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__readAndRelease, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41549 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
41551 /* "csamtools.pyx":336
41552 * def __init__(self): pass
41553 * def readAndRelease(self): return []
41554 * def release(self): pass # <<<<<<<<<<<<<<
41556 * if platform.system()=='Windows':
41558 __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_18StderrStoreWindows_5release, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_272)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41559 __Pyx_GOTREF(__pyx_t_4);
41560 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__release, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41561 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
41563 /* "csamtools.pyx":332
41566 * class StderrStoreWindows(): # <<<<<<<<<<<<<<
41567 * '''does nothing. stderr can't be redirected on windows'''
41568 * def __init__(self): pass
41570 if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_273)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41571 __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s__StderrStoreWindows, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41572 __Pyx_GOTREF(__pyx_t_4);
41573 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StderrStoreWindows, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41574 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
41575 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
41577 /* "csamtools.pyx":338
41578 * def release(self): pass
41580 * if platform.system()=='Windows': # <<<<<<<<<<<<<<
41582 * StderrStore = StderrStoreWindows
41584 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__platform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41585 __Pyx_GOTREF(__pyx_t_1);
41586 __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__system); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41587 __Pyx_GOTREF(__pyx_t_4);
41588 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41589 __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41590 __Pyx_GOTREF(__pyx_t_1);
41591 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
41592 __pyx_t_3 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__Windows), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41593 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41596 /* "csamtools.pyx":339
41598 * if platform.system()=='Windows':
41599 * del StderrStore # <<<<<<<<<<<<<<
41600 * StderrStore = StderrStoreWindows
41603 if (__Pyx_DelAttrString(__pyx_m, "StderrStore") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41605 /* "csamtools.pyx":340
41606 * if platform.system()=='Windows':
41608 * StderrStore = StderrStoreWindows # <<<<<<<<<<<<<<
41612 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStoreWindows); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41613 __Pyx_GOTREF(__pyx_t_1);
41614 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StderrStore, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41615 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41620 /* "csamtools.pyx":347
41621 * ######################################################################
41622 * # valid types for sam headers
41623 * VALID_HEADER_TYPES = { "HD" : dict, # <<<<<<<<<<<<<<
41627 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41628 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
41629 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__HD), ((PyObject *)((PyObject*)(&PyDict_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41631 /* "csamtools.pyx":348
41632 * # valid types for sam headers
41633 * VALID_HEADER_TYPES = { "HD" : dict,
41634 * "SQ" : list, # <<<<<<<<<<<<<<
41638 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41640 /* "csamtools.pyx":349
41641 * VALID_HEADER_TYPES = { "HD" : dict,
41643 * "RG" : list, # <<<<<<<<<<<<<<
41647 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__RG), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41649 /* "csamtools.pyx":350
41652 * "PG" : list, # <<<<<<<<<<<<<<
41656 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PG), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41658 /* "csamtools.pyx":351
41661 * "CO" : list } # <<<<<<<<<<<<<<
41663 * # order of records within sam headers
41665 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__CO), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41666 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41667 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
41669 /* "csamtools.pyx":354
41671 * # order of records within sam headers
41672 * VALID_HEADERS = ("HD", "SQ", "RG", "PG", "CO" ) # <<<<<<<<<<<<<<
41674 * # type conversions within sam header records
41676 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADERS, ((PyObject *)__pyx_k_tuple_274)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41678 /* "csamtools.pyx":357
41680 * # type conversions within sam header records
41681 * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str }, # <<<<<<<<<<<<<<
41682 * "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },
41683 * "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str,
41685 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41686 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
41687 __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41688 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
41689 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__VN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41690 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__SO), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41691 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__GO), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41692 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__HD), ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41693 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
41695 /* "csamtools.pyx":358
41696 * # type conversions within sam header records
41697 * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str },
41698 * "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str }, # <<<<<<<<<<<<<<
41699 * "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str,
41700 * "CN" : str, "DT" : str, "PL" : str, "FO" : str, "KS" : str },
41702 __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41703 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
41704 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__SN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41705 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__LN), ((PyObject *)((PyObject*)(&PyInt_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41706 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__AS), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41707 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__M5), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41708 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__UR), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41709 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__SP), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41710 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41711 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
41713 /* "csamtools.pyx":359
41714 * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str },
41715 * "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },
41716 * "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, # <<<<<<<<<<<<<<
41717 * "CN" : str, "DT" : str, "PL" : str, "FO" : str, "KS" : str },
41718 * "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, }
41720 __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41721 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
41722 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__ID), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41723 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__SM), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41724 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__LB), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41725 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__DS), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41726 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__PU), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41727 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__PI), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41729 /* "csamtools.pyx":360
41730 * "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },
41731 * "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str,
41732 * "CN" : str, "DT" : str, "PL" : str, "FO" : str, "KS" : str }, # <<<<<<<<<<<<<<
41733 * "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, }
41736 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__CN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41737 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__DT), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41738 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__PL), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41739 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__FO), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41740 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__KS), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41741 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__RG), ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41742 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
41744 /* "csamtools.pyx":361
41745 * "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str,
41746 * "CN" : str, "DT" : str, "PL" : str, "FO" : str, "KS" : str },
41747 * "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, } # <<<<<<<<<<<<<<
41749 * # output order of fields within records
41751 __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41752 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
41753 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__PN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41754 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__ID), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41755 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__VN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41756 if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__CL), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41757 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PG), ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41758 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
41759 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41760 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
41762 /* "csamtools.pyx":364
41764 * # output order of fields within records
41765 * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ), # <<<<<<<<<<<<<<
41766 * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
41767 * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS" ),
41769 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41770 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
41771 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__HD), ((PyObject *)__pyx_k_tuple_275)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41773 /* "csamtools.pyx":365
41774 * # output order of fields within records
41775 * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
41776 * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), # <<<<<<<<<<<<<<
41777 * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS" ),
41778 * "PG" : ( "PN", "ID", "VN", "CL" ), }
41780 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)__pyx_k_tuple_276)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41782 /* "csamtools.pyx":366
41783 * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
41784 * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
41785 * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS" ), # <<<<<<<<<<<<<<
41786 * "PG" : ( "PN", "ID", "VN", "CL" ), }
41789 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__RG), ((PyObject *)__pyx_k_tuple_277)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41791 /* "csamtools.pyx":367
41792 * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
41793 * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL", "FO", "KS" ),
41794 * "PG" : ( "PN", "ID", "VN", "CL" ), } # <<<<<<<<<<<<<<
41798 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PG), ((PyObject *)__pyx_k_tuple_278)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41799 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_ORDER, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41800 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
41802 /* "csamtools.pyx":619
41805 * add_sq_text = True, # <<<<<<<<<<<<<<
41806 * check_header = True,
41809 __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41810 __Pyx_GOTREF(__pyx_t_1);
41811 __pyx_k_21 = __pyx_t_1;
41812 __Pyx_GIVEREF(__pyx_t_1);
41815 /* "csamtools.pyx":620
41817 * add_sq_text = True,
41818 * check_header = True, # <<<<<<<<<<<<<<
41822 __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41823 __Pyx_GOTREF(__pyx_t_1);
41824 __pyx_k_22 = __pyx_t_1;
41825 __Pyx_GIVEREF(__pyx_t_1);
41828 /* "csamtools.pyx":621
41829 * add_sq_text = True,
41830 * check_header = True,
41831 * check_sq = True, # <<<<<<<<<<<<<<
41833 * '''open a sam/bam file.
41835 __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41836 __Pyx_GOTREF(__pyx_t_1);
41837 __pyx_k_23 = __pyx_t_1;
41838 __Pyx_GIVEREF(__pyx_t_1);
41841 /* "csamtools.pyx":900
41844 * until_eof = False ): # <<<<<<<<<<<<<<
41846 * fetch aligned reads in a :term:`region` using 0-based indexing. The region is specified by
41848 __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41849 __Pyx_GOTREF(__pyx_t_1);
41850 __pyx_k_54 = __pyx_t_1;
41851 __Pyx_GIVEREF(__pyx_t_1);
41854 /* "csamtools.pyx":1020
41857 * until_eof = False ): # <<<<<<<<<<<<<<
41858 * '''*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)*
41861 __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41862 __Pyx_GOTREF(__pyx_t_1);
41863 __pyx_k_73 = __pyx_t_1;
41864 __Pyx_GIVEREF(__pyx_t_1);
41867 /* "csamtools.pyx":1937
41870 * int end = max_pos, # <<<<<<<<<<<<<<
41871 * int truncate = False,
41874 __pyx_k_128 = __pyx_v_9csamtools_max_pos;
41876 /* "csamtools.pyx":3090
41877 * return self._level
41879 * class Outs: # <<<<<<<<<<<<<<
41880 * '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
41881 * def __init__(self, id = 1):
41883 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41884 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
41886 /* "csamtools.pyx":3092
41888 * '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
41889 * def __init__(self, id = 1): # <<<<<<<<<<<<<<
41890 * self.streams = []
41893 __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_4Outs_1__init__, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_280)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41894 __Pyx_GOTREF(__pyx_t_4);
41895 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, ((PyObject *)__pyx_k_tuple_281));
41896 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41897 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
41899 /* "csamtools.pyx":3096
41902 * def setdevice(self, filename): # <<<<<<<<<<<<<<
41903 * '''open an existing file, like "/dev/null"'''
41904 * fd = os.open(filename, os.O_WRONLY)
41906 __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_4Outs_3setdevice, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_283)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41907 __Pyx_GOTREF(__pyx_t_4);
41908 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__setdevice, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41909 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
41911 /* "csamtools.pyx":3101
41914 * def setfile(self, filename): # <<<<<<<<<<<<<<
41915 * '''open a new file.'''
41916 * fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660);
41918 __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_4Outs_5setfile, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_285)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41919 __Pyx_GOTREF(__pyx_t_4);
41920 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__setfile, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41921 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
41923 /* "csamtools.pyx":3106
41926 * def setfd(self, fd): # <<<<<<<<<<<<<<
41927 * ofd = os.dup(self.id) # Save old stream on new unit.
41928 * self.streams.append(ofd)
41930 __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_4Outs_7setfd, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_287)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41931 __Pyx_GOTREF(__pyx_t_4);
41932 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__setfd, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41933 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
41935 /* "csamtools.pyx":3114
41936 * os.close(fd) # Close other unit (look out, caller.)
41938 * def restore(self): # <<<<<<<<<<<<<<
41939 * '''restore previous output stream'''
41942 __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9csamtools_4Outs_9restore, 0, NULL, __pyx_n_s__csamtools, ((PyObject *)__pyx_k_codeobj_289)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41943 __Pyx_GOTREF(__pyx_t_4);
41944 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__restore, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41945 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
41947 /* "csamtools.pyx":3090
41948 * return self._level
41950 * class Outs: # <<<<<<<<<<<<<<
41951 * '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
41952 * def __init__(self, id = 1):
41954 if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_290)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41955 __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s__Outs, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41956 __Pyx_GOTREF(__pyx_t_4);
41957 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Outs, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41958 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
41959 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
41961 /* "csamtools.pyx":3127
41962 * def _samtools_dispatch( method,
41964 * catch_stdout = True ): # <<<<<<<<<<<<<<
41965 * '''call ``method`` in samtools providing arguments in args.
41968 __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41969 __Pyx_GOTREF(__pyx_t_1);
41970 __pyx_k_176 = __pyx_t_1;
41971 __Pyx_GIVEREF(__pyx_t_1);
41974 /* "csamtools.pyx":3125
41975 * del self.streams[-1]
41977 * def _samtools_dispatch( method, # <<<<<<<<<<<<<<
41979 * catch_stdout = True ):
41981 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9csamtools_1_samtools_dispatch, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41982 __Pyx_GOTREF(__pyx_t_1);
41983 if (PyObject_SetAttr(__pyx_m, __pyx_n_s___samtools_dispatch, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41984 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41986 /* "csamtools.pyx":3836
41987 * if self.owns_samfile: samclose( self.fp )
41989 * __all__ = ["Samfile", # <<<<<<<<<<<<<<
41993 __pyx_t_1 = PyList_New(9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
41994 __Pyx_GOTREF(__pyx_t_1);
41995 __Pyx_INCREF(((PyObject *)__pyx_n_s__Samfile));
41996 PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__Samfile));
41997 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Samfile));
41998 __Pyx_INCREF(((PyObject *)__pyx_n_s__Fastafile));
41999 PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__Fastafile));
42000 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Fastafile));
42001 __Pyx_INCREF(((PyObject *)__pyx_n_s__IteratorRow));
42002 PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__IteratorRow));
42003 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IteratorRow));
42004 __Pyx_INCREF(((PyObject *)__pyx_n_s__IteratorColumn));
42005 PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__IteratorColumn));
42006 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IteratorColumn));
42007 __Pyx_INCREF(((PyObject *)__pyx_n_s__AlignedRead));
42008 PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__AlignedRead));
42009 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__AlignedRead));
42010 __Pyx_INCREF(((PyObject *)__pyx_n_s__PileupColumn));
42011 PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s__PileupColumn));
42012 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PileupColumn));
42013 __Pyx_INCREF(((PyObject *)__pyx_n_s__PileupProxy));
42014 PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_n_s__PileupProxy));
42015 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PileupProxy));
42016 __Pyx_INCREF(((PyObject *)__pyx_n_s__PileupRead));
42017 PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_n_s__PileupRead));
42018 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PileupRead));
42019 __Pyx_INCREF(((PyObject *)__pyx_n_s__IndexedReads));
42020 PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s__IndexedReads));
42021 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IndexedReads));
42022 if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
42023 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
42025 /* "csamtools.pyx":1
42026 * # cython: embedsignature=True # <<<<<<<<<<<<<<
42027 * # cython: profile=True
42028 * # adds doc-strings for sphinx
42030 __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;}
42031 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
42032 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;}
42033 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
42036 __Pyx_XDECREF(__pyx_t_1);
42037 __Pyx_XDECREF(__pyx_t_2);
42038 __Pyx_XDECREF(__pyx_t_4);
42040 __Pyx_AddTraceback("init csamtools", __pyx_clineno, __pyx_lineno, __pyx_filename);
42041 Py_DECREF(__pyx_m); __pyx_m = 0;
42042 } else if (!PyErr_Occurred()) {
42043 PyErr_SetString(PyExc_ImportError, "init csamtools");
42046 __Pyx_RefNannyFinishContext();
42047 #if PY_MAJOR_VERSION < 3
42054 /* Runtime support code */
42055 #if CYTHON_REFNANNY
42056 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
42057 PyObject *m = NULL, *p = NULL;
42059 m = PyImport_ImportModule((char *)modname);
42061 p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
42063 r = PyLong_AsVoidPtr(p);
42067 return (__Pyx_RefNannyAPIStruct *)r;
42069 #endif /* CYTHON_REFNANNY */
42071 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
42073 result = PyObject_GetAttr(dict, name);
42075 if (dict != __pyx_b) {
42077 result = PyObject_GetAttr(__pyx_b, name);
42080 PyErr_SetObject(PyExc_NameError, name);
42087 static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
42088 PyFrameObject** frame,
42089 const char *funcname,
42090 const char *srcfile,
42092 if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) {
42093 if (*code == NULL) {
42094 *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
42095 if (*code == NULL) return 0;
42097 *frame = PyFrame_New(
42098 PyThreadState_GET(), /*PyThreadState *tstate*/
42099 *code, /*PyCodeObject *code*/
42100 PyModule_GetDict(__pyx_m), /*PyObject *globals*/
42101 0 /*PyObject *locals*/
42103 if (*frame == NULL) return 0;
42106 (*frame)->f_tstate = PyThreadState_GET();
42108 return PyThreadState_GET()->c_profilefunc(PyThreadState_GET()->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
42110 static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) {
42111 PyObject *py_srcfile = 0;
42112 PyObject *py_funcname = 0;
42113 PyCodeObject *py_code = 0;
42114 #if PY_MAJOR_VERSION < 3
42115 py_funcname = PyString_FromString(funcname);
42116 py_srcfile = PyString_FromString(srcfile);
42118 py_funcname = PyUnicode_FromString(funcname);
42119 py_srcfile = PyUnicode_FromString(srcfile);
42121 if (!py_funcname | !py_srcfile) goto bad;
42122 py_code = PyCode_New(
42123 0, /*int argcount,*/
42124 #if PY_MAJOR_VERSION >= 3
42125 0, /*int kwonlyargcount,*/
42127 0, /*int nlocals,*/
42128 0, /*int stacksize,*/
42130 __pyx_empty_bytes, /*PyObject *code,*/
42131 __pyx_empty_tuple, /*PyObject *consts,*/
42132 __pyx_empty_tuple, /*PyObject *names,*/
42133 __pyx_empty_tuple, /*PyObject *varnames,*/
42134 __pyx_empty_tuple, /*PyObject *freevars,*/
42135 __pyx_empty_tuple, /*PyObject *cellvars,*/
42136 py_srcfile, /*PyObject *filename,*/
42137 py_funcname, /*PyObject *name,*/
42138 firstlineno, /*int firstlineno,*/
42139 __pyx_empty_bytes /*PyObject *lnotab*/
42142 Py_XDECREF(py_srcfile);
42143 Py_XDECREF(py_funcname);
42146 #endif /* CYTHON_PROFILE */
42148 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
42149 #if CYTHON_COMPILING_IN_CPYTHON
42150 PyObject *tmp_type, *tmp_value, *tmp_tb;
42151 PyThreadState *tstate = PyThreadState_GET();
42152 tmp_type = tstate->curexc_type;
42153 tmp_value = tstate->curexc_value;
42154 tmp_tb = tstate->curexc_traceback;
42155 tstate->curexc_type = type;
42156 tstate->curexc_value = value;
42157 tstate->curexc_traceback = tb;
42158 Py_XDECREF(tmp_type);
42159 Py_XDECREF(tmp_value);
42160 Py_XDECREF(tmp_tb);
42162 PyErr_Restore(type, value, tb);
42165 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
42166 #if CYTHON_COMPILING_IN_CPYTHON
42167 PyThreadState *tstate = PyThreadState_GET();
42168 *type = tstate->curexc_type;
42169 *value = tstate->curexc_value;
42170 *tb = tstate->curexc_traceback;
42171 tstate->curexc_type = 0;
42172 tstate->curexc_value = 0;
42173 tstate->curexc_traceback = 0;
42175 PyErr_Fetch(type, value, tb);
42179 #if PY_MAJOR_VERSION < 3
42180 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
42181 CYTHON_UNUSED PyObject *cause) {
42185 if (tb == Py_None) {
42189 else if (tb != NULL && !PyTraceBack_Check(tb)) {
42190 PyErr_SetString(PyExc_TypeError,
42191 "raise: arg 3 must be a traceback or None");
42194 if (value == NULL) {
42198 #if PY_VERSION_HEX < 0x02050000
42199 if (!PyClass_Check(type))
42201 if (!PyType_Check(type))
42204 if (value != Py_None) {
42205 PyErr_SetString(PyExc_TypeError,
42206 "instance exception may not have a separate value");
42211 #if PY_VERSION_HEX < 0x02050000
42212 if (PyInstance_Check(type)) {
42213 type = (PyObject*) ((PyInstanceObject*)type)->in_class;
42218 PyErr_SetString(PyExc_TypeError,
42219 "raise: exception must be an old-style class or instance");
42223 type = (PyObject*) Py_TYPE(type);
42225 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
42226 PyErr_SetString(PyExc_TypeError,
42227 "raise: exception class must be a subclass of BaseException");
42232 __Pyx_ErrRestore(type, value, tb);
42240 #else /* Python 3+ */
42241 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
42242 if (tb == Py_None) {
42244 } else if (tb && !PyTraceBack_Check(tb)) {
42245 PyErr_SetString(PyExc_TypeError,
42246 "raise: arg 3 must be a traceback or None");
42249 if (value == Py_None)
42251 if (PyExceptionInstance_Check(type)) {
42253 PyErr_SetString(PyExc_TypeError,
42254 "instance exception may not have a separate value");
42258 type = (PyObject*) Py_TYPE(value);
42259 } else if (!PyExceptionClass_Check(type)) {
42260 PyErr_SetString(PyExc_TypeError,
42261 "raise: exception class must be a subclass of BaseException");
42265 PyObject *fixed_cause;
42266 if (PyExceptionClass_Check(cause)) {
42267 fixed_cause = PyObject_CallObject(cause, NULL);
42268 if (fixed_cause == NULL)
42271 else if (PyExceptionInstance_Check(cause)) {
42272 fixed_cause = cause;
42273 Py_INCREF(fixed_cause);
42276 PyErr_SetString(PyExc_TypeError,
42277 "exception causes must derive from "
42282 value = PyObject_CallObject(type, NULL);
42284 PyException_SetCause(value, fixed_cause);
42286 PyErr_SetObject(type, value);
42288 PyThreadState *tstate = PyThreadState_GET();
42289 PyObject* tmp_tb = tstate->curexc_traceback;
42290 if (tb != tmp_tb) {
42292 tstate->curexc_traceback = tb;
42293 Py_XDECREF(tmp_tb);
42301 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
42302 if (unlikely(!type)) {
42303 PyErr_Format(PyExc_SystemError, "Missing type object");
42306 if (likely(PyObject_TypeCheck(obj, type)))
42308 PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
42309 Py_TYPE(obj)->tp_name, type->tp_name);
42313 static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
42315 const char* function_name,
42319 Py_ssize_t pos = 0;
42320 while (PyDict_Next(kwdict, &pos, &key, 0)) {
42321 #if PY_MAJOR_VERSION < 3
42322 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
42324 if (unlikely(!PyUnicode_Check(key)))
42326 goto invalid_keyword_type;
42328 if ((!kw_allowed) && unlikely(key))
42329 goto invalid_keyword;
42331 invalid_keyword_type:
42332 PyErr_Format(PyExc_TypeError,
42333 "%s() keywords must be strings", function_name);
42336 PyErr_Format(PyExc_TypeError,
42337 #if PY_MAJOR_VERSION < 3
42338 "%s() got an unexpected keyword argument '%s'",
42339 function_name, PyString_AsString(key));
42341 "%s() got an unexpected keyword argument '%U'",
42342 function_name, key);
42347 static void __Pyx_RaiseDoubleKeywordsError(
42348 const char* func_name,
42351 PyErr_Format(PyExc_TypeError,
42352 #if PY_MAJOR_VERSION >= 3
42353 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
42355 "%s() got multiple values for keyword argument '%s'", func_name,
42356 PyString_AS_STRING(kw_name));
42360 static int __Pyx_ParseOptionalKeywords(
42362 PyObject **argnames[],
42364 PyObject *values[],
42365 Py_ssize_t num_pos_args,
42366 const char* function_name)
42368 PyObject *key = 0, *value = 0;
42369 Py_ssize_t pos = 0;
42371 PyObject*** first_kw_arg = argnames + num_pos_args;
42372 while (PyDict_Next(kwds, &pos, &key, &value)) {
42373 name = first_kw_arg;
42374 while (*name && (**name != key)) name++;
42376 values[name-argnames] = value;
42378 #if PY_MAJOR_VERSION < 3
42379 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
42381 if (unlikely(!PyUnicode_Check(key))) {
42383 goto invalid_keyword_type;
42385 for (name = first_kw_arg; *name; name++) {
42386 #if PY_MAJOR_VERSION >= 3
42387 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
42388 PyUnicode_Compare(**name, key) == 0) break;
42390 if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
42391 _PyString_Eq(**name, key)) break;
42395 values[name-argnames] = value;
42397 for (name=argnames; name != first_kw_arg; name++) {
42398 if (**name == key) goto arg_passed_twice;
42399 #if PY_MAJOR_VERSION >= 3
42400 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
42401 PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
42403 if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
42404 _PyString_Eq(**name, key)) goto arg_passed_twice;
42408 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
42410 goto invalid_keyword;
42418 __Pyx_RaiseDoubleKeywordsError(function_name, **name);
42420 invalid_keyword_type:
42421 PyErr_Format(PyExc_TypeError,
42422 "%s() keywords must be strings", function_name);
42425 PyErr_Format(PyExc_TypeError,
42426 #if PY_MAJOR_VERSION < 3
42427 "%s() got an unexpected keyword argument '%s'",
42428 function_name, PyString_AsString(key));
42430 "%s() got an unexpected keyword argument '%U'",
42431 function_name, key);
42437 static void __Pyx_RaiseArgtupleInvalid(
42438 const char* func_name,
42440 Py_ssize_t num_min,
42441 Py_ssize_t num_max,
42442 Py_ssize_t num_found)
42444 Py_ssize_t num_expected;
42445 const char *more_or_less;
42446 if (num_found < num_min) {
42447 num_expected = num_min;
42448 more_or_less = "at least";
42450 num_expected = num_max;
42451 more_or_less = "at most";
42454 more_or_less = "exactly";
42456 PyErr_Format(PyExc_TypeError,
42457 "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
42458 func_name, more_or_less, num_expected,
42459 (num_expected == 1) ? "" : "s", num_found);
42462 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
42463 const char *name, int exact)
42466 PyErr_Format(PyExc_SystemError, "Missing type object");
42469 if (none_allowed && obj == Py_None) return 1;
42471 if (Py_TYPE(obj) == type) return 1;
42474 if (PyObject_TypeCheck(obj, type)) return 1;
42476 PyErr_Format(PyExc_TypeError,
42477 "Argument '%s' has incorrect type (expected %s, got %s)",
42478 name, type->tp_name, Py_TYPE(obj)->tp_name);
42482 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
42483 PyObject *local_type, *local_value, *local_tb;
42484 PyObject *tmp_type, *tmp_value, *tmp_tb;
42485 PyThreadState *tstate = PyThreadState_GET();
42486 local_type = tstate->curexc_type;
42487 local_value = tstate->curexc_value;
42488 local_tb = tstate->curexc_traceback;
42489 tstate->curexc_type = 0;
42490 tstate->curexc_value = 0;
42491 tstate->curexc_traceback = 0;
42492 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
42493 if (unlikely(tstate->curexc_type))
42495 #if PY_MAJOR_VERSION >= 3
42496 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
42499 *type = local_type;
42500 *value = local_value;
42502 Py_INCREF(local_type);
42503 Py_INCREF(local_value);
42504 Py_INCREF(local_tb);
42505 tmp_type = tstate->exc_type;
42506 tmp_value = tstate->exc_value;
42507 tmp_tb = tstate->exc_traceback;
42508 tstate->exc_type = local_type;
42509 tstate->exc_value = local_value;
42510 tstate->exc_traceback = local_tb;
42511 /* Make sure tstate is in a consistent state when we XDECREF
42512 these objects (XDECREF may run arbitrary code). */
42513 Py_XDECREF(tmp_type);
42514 Py_XDECREF(tmp_value);
42515 Py_XDECREF(tmp_tb);
42521 Py_XDECREF(local_type);
42522 Py_XDECREF(local_value);
42523 Py_XDECREF(local_tb);
42529 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
42530 PyErr_Format(PyExc_ValueError,
42531 "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
42532 index, (index == 1) ? "" : "s");
42535 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
42536 PyErr_Format(PyExc_ValueError,
42537 "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
42540 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
42541 if (unlikely(retval)) {
42543 __Pyx_RaiseTooManyValuesError(expected);
42545 } else if (PyErr_Occurred()) {
42546 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
42556 static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) {
42557 PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable");
42560 static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
42563 q -= ((r != 0) & ((r ^ b) < 0));
42567 static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
42569 r += ((r != 0) & ((r ^ b) < 0)) * b;
42573 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
42574 PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
42579 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
42580 PyThreadState *tstate = PyThreadState_GET();
42581 *type = tstate->exc_type;
42582 *value = tstate->exc_value;
42583 *tb = tstate->exc_traceback;
42585 Py_XINCREF(*value);
42588 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
42589 PyObject *tmp_type, *tmp_value, *tmp_tb;
42590 PyThreadState *tstate = PyThreadState_GET();
42591 tmp_type = tstate->exc_type;
42592 tmp_value = tstate->exc_value;
42593 tmp_tb = tstate->exc_traceback;
42594 tstate->exc_type = type;
42595 tstate->exc_value = value;
42596 tstate->exc_traceback = tb;
42597 Py_XDECREF(tmp_type);
42598 Py_XDECREF(tmp_value);
42599 Py_XDECREF(tmp_tb);
42602 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
42603 PyObject *py_import = 0;
42604 PyObject *empty_list = 0;
42605 PyObject *module = 0;
42606 PyObject *global_dict = 0;
42607 PyObject *empty_dict = 0;
42609 py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
42615 empty_list = PyList_New(0);
42620 global_dict = PyModule_GetDict(__pyx_m);
42623 empty_dict = PyDict_New();
42626 #if PY_VERSION_HEX >= 0x02050000
42628 #if PY_MAJOR_VERSION >= 3
42630 if (strchr(__Pyx_MODULE_NAME, '.')) {
42631 /* try package relative import first */
42632 PyObject *py_level = PyInt_FromLong(1);
42635 module = PyObject_CallFunctionObjArgs(py_import,
42636 name, global_dict, empty_dict, list, py_level, NULL);
42637 Py_DECREF(py_level);
42639 if (!PyErr_ExceptionMatches(PyExc_ImportError))
42644 level = 0; /* try absolute import on failure */
42648 PyObject *py_level = PyInt_FromLong(level);
42651 module = PyObject_CallFunctionObjArgs(py_import,
42652 name, global_dict, empty_dict, list, py_level, NULL);
42653 Py_DECREF(py_level);
42658 PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
42661 module = PyObject_CallFunctionObjArgs(py_import,
42662 name, global_dict, empty_dict, list, NULL);
42665 Py_XDECREF(empty_list);
42666 Py_XDECREF(py_import);
42667 Py_XDECREF(empty_dict);
42671 static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
42672 PyObject *metaclass;
42673 /* Default metaclass */
42674 #if PY_MAJOR_VERSION < 3
42675 if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
42676 PyObject *base = PyTuple_GET_ITEM(bases, 0);
42677 metaclass = PyObject_GetAttrString(base, (char *)"__class__");
42680 metaclass = (PyObject*) Py_TYPE(base);
42683 metaclass = (PyObject *) &PyClass_Type;
42686 if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
42687 PyObject *base = PyTuple_GET_ITEM(bases, 0);
42688 metaclass = (PyObject*) Py_TYPE(base);
42690 metaclass = (PyObject *) &PyType_Type;
42693 Py_INCREF(metaclass);
42697 static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
42698 PyObject *modname) {
42700 PyObject *metaclass;
42701 if (PyDict_SetItemString(dict, "__module__", modname) < 0)
42703 /* Python2 __metaclass__ */
42704 metaclass = PyDict_GetItemString(dict, "__metaclass__");
42706 Py_INCREF(metaclass);
42708 metaclass = __Pyx_FindPy2Metaclass(bases);
42710 result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
42711 Py_DECREF(metaclass);
42716 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
42718 if (op->func_doc == NULL && op->func.m_ml->ml_doc) {
42719 #if PY_MAJOR_VERSION >= 3
42720 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
42722 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
42725 if (op->func_doc == 0) {
42726 Py_INCREF(Py_None);
42729 Py_INCREF(op->func_doc);
42730 return op->func_doc;
42733 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
42735 PyObject *tmp = op->func_doc;
42737 op->func_doc = Py_None; /* Mark as deleted */
42739 op->func_doc = value;
42740 Py_INCREF(op->func_doc);
42745 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
42747 if (op->func_name == NULL) {
42748 #if PY_MAJOR_VERSION >= 3
42749 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
42751 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
42754 Py_INCREF(op->func_name);
42755 return op->func_name;
42758 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
42761 #if PY_MAJOR_VERSION >= 3
42762 if (value == NULL || !PyUnicode_Check(value)) {
42764 if (value == NULL || !PyString_Check(value)) {
42766 PyErr_SetString(PyExc_TypeError,
42767 "__name__ must be set to a string object");
42770 tmp = op->func_name;
42772 op->func_name = value;
42777 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
42780 self = m->func_closure;
42787 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
42789 if (op->func_dict == NULL) {
42790 op->func_dict = PyDict_New();
42791 if (op->func_dict == NULL)
42794 Py_INCREF(op->func_dict);
42795 return op->func_dict;
42798 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
42801 if (value == NULL) {
42802 PyErr_SetString(PyExc_TypeError,
42803 "function's dictionary may not be deleted");
42806 if (!PyDict_Check(value)) {
42807 PyErr_SetString(PyExc_TypeError,
42808 "setting function's dictionary to a non-dict");
42811 tmp = op->func_dict;
42813 op->func_dict = value;
42818 __Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op)
42820 PyObject* dict = PyModule_GetDict(__pyx_m);
42825 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
42827 Py_INCREF(Py_None);
42831 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
42833 PyObject* result = (op->func_code) ? op->func_code : Py_None;
42838 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op)
42840 if (op->defaults_tuple) {
42841 Py_INCREF(op->defaults_tuple);
42842 return op->defaults_tuple;
42844 if (op->defaults_getter) {
42845 PyObject *res = op->defaults_getter((PyObject *) op);
42848 op->defaults_tuple = res;
42852 Py_INCREF(Py_None);
42855 static PyGetSetDef __pyx_CyFunction_getsets[] = {
42856 {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
42857 {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
42858 {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
42859 {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
42860 {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
42861 {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
42862 {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
42863 {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
42864 {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
42865 {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
42866 {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
42867 {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
42868 {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
42869 {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0},
42870 {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0},
42873 #ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
42874 #define PY_WRITE_RESTRICTED WRITE_RESTRICTED
42876 static PyMemberDef __pyx_CyFunction_members[] = {
42877 {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
42881 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
42883 #if PY_MAJOR_VERSION >= 3
42884 return PyUnicode_FromString(m->func.m_ml->ml_name);
42886 return PyString_FromString(m->func.m_ml->ml_name);
42889 static PyMethodDef __pyx_CyFunction_methods[] = {
42890 {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
42893 static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags,
42894 PyObject *closure, PyObject *module, PyObject* code) {
42895 __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
42899 op->func_weakreflist = NULL;
42900 op->func.m_ml = ml;
42901 op->func.m_self = (PyObject *) op;
42902 Py_XINCREF(closure);
42903 op->func_closure = closure;
42904 Py_XINCREF(module);
42905 op->func.m_module = module;
42906 op->func_dict = NULL;
42907 op->func_name = NULL;
42908 op->func_doc = NULL;
42909 op->func_classobj = NULL;
42911 op->func_code = code;
42912 op->defaults_pyobjects = 0;
42913 op->defaults = NULL;
42914 op->defaults_tuple = NULL;
42915 op->defaults_getter = NULL;
42916 PyObject_GC_Track(op);
42917 return (PyObject *) op;
42920 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
42922 Py_CLEAR(m->func_closure);
42923 Py_CLEAR(m->func.m_module);
42924 Py_CLEAR(m->func_dict);
42925 Py_CLEAR(m->func_name);
42926 Py_CLEAR(m->func_doc);
42927 Py_CLEAR(m->func_code);
42928 Py_CLEAR(m->func_classobj);
42929 Py_CLEAR(m->defaults_tuple);
42931 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
42933 for (i = 0; i < m->defaults_pyobjects; i++)
42934 Py_XDECREF(pydefaults[i]);
42935 PyMem_Free(m->defaults);
42936 m->defaults = NULL;
42940 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
42942 PyObject_GC_UnTrack(m);
42943 if (m->func_weakreflist != NULL)
42944 PyObject_ClearWeakRefs((PyObject *) m);
42945 __Pyx_CyFunction_clear(m);
42946 PyObject_GC_Del(m);
42948 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
42950 Py_VISIT(m->func_closure);
42951 Py_VISIT(m->func.m_module);
42952 Py_VISIT(m->func_dict);
42953 Py_VISIT(m->func_name);
42954 Py_VISIT(m->func_doc);
42955 Py_VISIT(m->func_code);
42956 Py_VISIT(m->func_classobj);
42957 Py_VISIT(m->defaults_tuple);
42959 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
42961 for (i = 0; i < m->defaults_pyobjects; i++)
42962 Py_VISIT(pydefaults[i]);
42966 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
42968 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
42969 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
42973 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
42975 type = (PyObject *)(Py_TYPE(obj));
42976 return PyMethod_New(func,
42977 type, (PyObject *)(Py_TYPE(type)));
42979 if (obj == Py_None)
42981 return PyMethod_New(func, obj, type);
42984 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
42986 PyObject *func_name = __Pyx_CyFunction_get_name(op);
42987 #if PY_MAJOR_VERSION >= 3
42988 return PyUnicode_FromFormat("<cyfunction %U at %p>",
42989 func_name, (void *)op);
42991 return PyString_FromFormat("<cyfunction %s at %p>",
42992 PyString_AsString(func_name), (void *)op);
42995 static PyTypeObject __pyx_CyFunctionType_type = {
42996 PyVarObject_HEAD_INIT(0, 0)
42997 __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
42998 sizeof(__pyx_CyFunctionObject), /*tp_basicsize*/
43000 (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
43004 #if PY_MAJOR_VERSION < 3
43009 (reprfunc) __Pyx_CyFunction_repr, /*tp_repr*/
43010 0, /*tp_as_number*/
43011 0, /*tp_as_sequence*/
43012 0, /*tp_as_mapping*/
43014 __Pyx_PyCFunction_Call, /*tp_call*/
43018 0, /*tp_as_buffer*/
43019 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
43021 (traverseproc) __Pyx_CyFunction_traverse, /*tp_traverse*/
43022 (inquiry) __Pyx_CyFunction_clear, /*tp_clear*/
43023 0, /*tp_richcompare*/
43024 offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
43027 __pyx_CyFunction_methods, /*tp_methods*/
43028 __pyx_CyFunction_members, /*tp_members*/
43029 __pyx_CyFunction_getsets, /*tp_getset*/
43032 __Pyx_CyFunction_descr_get, /*tp_descr_get*/
43033 0, /*tp_descr_set*/
43034 offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
43043 0, /*tp_subclasses*/
43046 #if PY_VERSION_HEX >= 0x02060000
43047 0, /*tp_version_tag*/
43050 static int __Pyx_CyFunction_init(void)
43052 if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
43054 __pyx_CyFunctionType = &__pyx_CyFunctionType_type;
43057 void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects)
43059 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
43060 m->defaults = PyMem_Malloc(size);
43062 return PyErr_NoMemory();
43063 memset(m->defaults, 0, sizeof(size));
43064 m->defaults_pyobjects = pyobjects;
43065 return m->defaults;
43067 static void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple)
43069 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
43070 m->defaults_tuple = tuple;
43074 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
43076 return (equals == Py_EQ);
43077 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
43078 if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) {
43079 return (equals == Py_NE);
43080 } else if (PyBytes_GET_SIZE(s1) == 1) {
43081 if (equals == Py_EQ)
43082 return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]);
43084 return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]);
43086 int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1));
43087 return (equals == Py_EQ) ? (result == 0) : (result != 0);
43089 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
43090 return (equals == Py_NE);
43091 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
43092 return (equals == Py_NE);
43095 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
43098 result = __Pyx_PyObject_IsTrue(py_result);
43099 Py_DECREF(py_result);
43104 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
43106 return (equals == Py_EQ);
43107 } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
43108 #if CYTHON_PEP393_ENABLED
43109 if ((PyUnicode_READY(s1) < 0) || (PyUnicode_READY(s2) < 0))
43111 if (PyUnicode_GET_LENGTH(s1) != PyUnicode_GET_LENGTH(s2)) {
43112 return (equals == Py_NE);
43113 } else if (PyUnicode_GET_LENGTH(s1) == 1) {
43114 Py_UCS4 ch1 = PyUnicode_READ_CHAR(s1, 0);
43115 Py_UCS4 ch2 = PyUnicode_READ_CHAR(s2, 0);
43116 return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
43118 if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
43119 return (equals == Py_NE);
43120 } else if (PyUnicode_GET_SIZE(s1) == 1) {
43121 Py_UNICODE ch1 = PyUnicode_AS_UNICODE(s1)[0];
43122 Py_UNICODE ch2 = PyUnicode_AS_UNICODE(s2)[0];
43123 return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
43126 int result = PyUnicode_Compare(s1, s2);
43127 if ((result == -1) && unlikely(PyErr_Occurred()))
43129 return (equals == Py_EQ) ? (result == 0) : (result != 0);
43131 } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
43132 return (equals == Py_NE);
43133 } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
43134 return (equals == Py_NE);
43137 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
43140 result = __Pyx_PyObject_IsTrue(py_result);
43141 Py_DECREF(py_result);
43146 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int8_t(int8_t val) {
43147 const int8_t neg_one = (int8_t)-1, const_zero = (int8_t)0;
43148 const int is_unsigned = const_zero < neg_one;
43149 if ((sizeof(int8_t) == sizeof(char)) ||
43150 (sizeof(int8_t) == sizeof(short))) {
43151 return PyInt_FromLong((long)val);
43152 } else if ((sizeof(int8_t) == sizeof(int)) ||
43153 (sizeof(int8_t) == sizeof(long))) {
43155 return PyLong_FromUnsignedLong((unsigned long)val);
43157 return PyInt_FromLong((long)val);
43158 } else if (sizeof(int8_t) == sizeof(PY_LONG_LONG)) {
43160 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
43162 return PyLong_FromLongLong((PY_LONG_LONG)val);
43164 int one = 1; int little = (int)*(unsigned char *)&one;
43165 unsigned char *bytes = (unsigned char *)&val;
43166 return _PyLong_FromByteArray(bytes, sizeof(int8_t),
43167 little, !is_unsigned);
43171 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint8_t(uint8_t val) {
43172 const uint8_t neg_one = (uint8_t)-1, const_zero = (uint8_t)0;
43173 const int is_unsigned = const_zero < neg_one;
43174 if ((sizeof(uint8_t) == sizeof(char)) ||
43175 (sizeof(uint8_t) == sizeof(short))) {
43176 return PyInt_FromLong((long)val);
43177 } else if ((sizeof(uint8_t) == sizeof(int)) ||
43178 (sizeof(uint8_t) == sizeof(long))) {
43180 return PyLong_FromUnsignedLong((unsigned long)val);
43182 return PyInt_FromLong((long)val);
43183 } else if (sizeof(uint8_t) == sizeof(PY_LONG_LONG)) {
43185 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
43187 return PyLong_FromLongLong((PY_LONG_LONG)val);
43189 int one = 1; int little = (int)*(unsigned char *)&one;
43190 unsigned char *bytes = (unsigned char *)&val;
43191 return _PyLong_FromByteArray(bytes, sizeof(uint8_t),
43192 little, !is_unsigned);
43196 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int16_t(int16_t val) {
43197 const int16_t neg_one = (int16_t)-1, const_zero = (int16_t)0;
43198 const int is_unsigned = const_zero < neg_one;
43199 if ((sizeof(int16_t) == sizeof(char)) ||
43200 (sizeof(int16_t) == sizeof(short))) {
43201 return PyInt_FromLong((long)val);
43202 } else if ((sizeof(int16_t) == sizeof(int)) ||
43203 (sizeof(int16_t) == sizeof(long))) {
43205 return PyLong_FromUnsignedLong((unsigned long)val);
43207 return PyInt_FromLong((long)val);
43208 } else if (sizeof(int16_t) == sizeof(PY_LONG_LONG)) {
43210 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
43212 return PyLong_FromLongLong((PY_LONG_LONG)val);
43214 int one = 1; int little = (int)*(unsigned char *)&one;
43215 unsigned char *bytes = (unsigned char *)&val;
43216 return _PyLong_FromByteArray(bytes, sizeof(int16_t),
43217 little, !is_unsigned);
43221 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint16_t(uint16_t val) {
43222 const uint16_t neg_one = (uint16_t)-1, const_zero = (uint16_t)0;
43223 const int is_unsigned = const_zero < neg_one;
43224 if ((sizeof(uint16_t) == sizeof(char)) ||
43225 (sizeof(uint16_t) == sizeof(short))) {
43226 return PyInt_FromLong((long)val);
43227 } else if ((sizeof(uint16_t) == sizeof(int)) ||
43228 (sizeof(uint16_t) == sizeof(long))) {
43230 return PyLong_FromUnsignedLong((unsigned long)val);
43232 return PyInt_FromLong((long)val);
43233 } else if (sizeof(uint16_t) == sizeof(PY_LONG_LONG)) {
43235 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
43237 return PyLong_FromLongLong((PY_LONG_LONG)val);
43239 int one = 1; int little = (int)*(unsigned char *)&one;
43240 unsigned char *bytes = (unsigned char *)&val;
43241 return _PyLong_FromByteArray(bytes, sizeof(uint16_t),
43242 little, !is_unsigned);
43246 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int32_t(int32_t val) {
43247 const int32_t neg_one = (int32_t)-1, const_zero = (int32_t)0;
43248 const int is_unsigned = const_zero < neg_one;
43249 if ((sizeof(int32_t) == sizeof(char)) ||
43250 (sizeof(int32_t) == sizeof(short))) {
43251 return PyInt_FromLong((long)val);
43252 } else if ((sizeof(int32_t) == sizeof(int)) ||
43253 (sizeof(int32_t) == sizeof(long))) {
43255 return PyLong_FromUnsignedLong((unsigned long)val);
43257 return PyInt_FromLong((long)val);
43258 } else if (sizeof(int32_t) == sizeof(PY_LONG_LONG)) {
43260 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
43262 return PyLong_FromLongLong((PY_LONG_LONG)val);
43264 int one = 1; int little = (int)*(unsigned char *)&one;
43265 unsigned char *bytes = (unsigned char *)&val;
43266 return _PyLong_FromByteArray(bytes, sizeof(int32_t),
43267 little, !is_unsigned);
43271 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t val) {
43272 const uint32_t neg_one = (uint32_t)-1, const_zero = (uint32_t)0;
43273 const int is_unsigned = const_zero < neg_one;
43274 if ((sizeof(uint32_t) == sizeof(char)) ||
43275 (sizeof(uint32_t) == sizeof(short))) {
43276 return PyInt_FromLong((long)val);
43277 } else if ((sizeof(uint32_t) == sizeof(int)) ||
43278 (sizeof(uint32_t) == sizeof(long))) {
43280 return PyLong_FromUnsignedLong((unsigned long)val);
43282 return PyInt_FromLong((long)val);
43283 } else if (sizeof(uint32_t) == sizeof(PY_LONG_LONG)) {
43285 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
43287 return PyLong_FromLongLong((PY_LONG_LONG)val);
43289 int one = 1; int little = (int)*(unsigned char *)&one;
43290 unsigned char *bytes = (unsigned char *)&val;
43291 return _PyLong_FromByteArray(bytes, sizeof(uint32_t),
43292 little, !is_unsigned);
43296 static CYTHON_INLINE uint32_t __Pyx_PyInt_from_py_uint32_t(PyObject* x) {
43297 const uint32_t neg_one = (uint32_t)-1, const_zero = (uint32_t)0;
43298 const int is_unsigned = const_zero < neg_one;
43299 if (sizeof(uint32_t) == sizeof(char)) {
43301 return (uint32_t)__Pyx_PyInt_AsUnsignedChar(x);
43303 return (uint32_t)__Pyx_PyInt_AsSignedChar(x);
43304 } else if (sizeof(uint32_t) == sizeof(short)) {
43306 return (uint32_t)__Pyx_PyInt_AsUnsignedShort(x);
43308 return (uint32_t)__Pyx_PyInt_AsSignedShort(x);
43309 } else if (sizeof(uint32_t) == sizeof(int)) {
43311 return (uint32_t)__Pyx_PyInt_AsUnsignedInt(x);
43313 return (uint32_t)__Pyx_PyInt_AsSignedInt(x);
43314 } else if (sizeof(uint32_t) == sizeof(long)) {
43316 return (uint32_t)__Pyx_PyInt_AsUnsignedLong(x);
43318 return (uint32_t)__Pyx_PyInt_AsSignedLong(x);
43319 } else if (sizeof(uint32_t) == sizeof(PY_LONG_LONG)) {
43321 return (uint32_t)__Pyx_PyInt_AsUnsignedLongLong(x);
43323 return (uint32_t)__Pyx_PyInt_AsSignedLongLong(x);
43326 PyObject *v = __Pyx_PyNumber_Int(x);
43327 #if PY_VERSION_HEX < 0x03000000
43328 if (likely(v) && !PyLong_Check(v)) {
43330 v = PyNumber_Long(tmp);
43335 int one = 1; int is_little = (int)*(unsigned char *)&one;
43336 unsigned char *bytes = (unsigned char *)&val;
43337 int ret = _PyLong_AsByteArray((PyLongObject *)v,
43338 bytes, sizeof(val),
43339 is_little, !is_unsigned);
43344 return (uint32_t)-1;
43348 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int64_t(int64_t val) {
43349 const int64_t neg_one = (int64_t)-1, const_zero = (int64_t)0;
43350 const int is_unsigned = const_zero < neg_one;
43351 if ((sizeof(int64_t) == sizeof(char)) ||
43352 (sizeof(int64_t) == sizeof(short))) {
43353 return PyInt_FromLong((long)val);
43354 } else if ((sizeof(int64_t) == sizeof(int)) ||
43355 (sizeof(int64_t) == sizeof(long))) {
43357 return PyLong_FromUnsignedLong((unsigned long)val);
43359 return PyInt_FromLong((long)val);
43360 } else if (sizeof(int64_t) == sizeof(PY_LONG_LONG)) {
43362 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
43364 return PyLong_FromLongLong((PY_LONG_LONG)val);
43366 int one = 1; int little = (int)*(unsigned char *)&one;
43367 unsigned char *bytes = (unsigned char *)&val;
43368 return _PyLong_FromByteArray(bytes, sizeof(int64_t),
43369 little, !is_unsigned);
43373 static CYTHON_INLINE uint64_t __Pyx_PyInt_from_py_uint64_t(PyObject* x) {
43374 const uint64_t neg_one = (uint64_t)-1, const_zero = (uint64_t)0;
43375 const int is_unsigned = const_zero < neg_one;
43376 if (sizeof(uint64_t) == sizeof(char)) {
43378 return (uint64_t)__Pyx_PyInt_AsUnsignedChar(x);
43380 return (uint64_t)__Pyx_PyInt_AsSignedChar(x);
43381 } else if (sizeof(uint64_t) == sizeof(short)) {
43383 return (uint64_t)__Pyx_PyInt_AsUnsignedShort(x);
43385 return (uint64_t)__Pyx_PyInt_AsSignedShort(x);
43386 } else if (sizeof(uint64_t) == sizeof(int)) {
43388 return (uint64_t)__Pyx_PyInt_AsUnsignedInt(x);
43390 return (uint64_t)__Pyx_PyInt_AsSignedInt(x);
43391 } else if (sizeof(uint64_t) == sizeof(long)) {
43393 return (uint64_t)__Pyx_PyInt_AsUnsignedLong(x);
43395 return (uint64_t)__Pyx_PyInt_AsSignedLong(x);
43396 } else if (sizeof(uint64_t) == sizeof(PY_LONG_LONG)) {
43398 return (uint64_t)__Pyx_PyInt_AsUnsignedLongLong(x);
43400 return (uint64_t)__Pyx_PyInt_AsSignedLongLong(x);
43403 PyObject *v = __Pyx_PyNumber_Int(x);
43404 #if PY_VERSION_HEX < 0x03000000
43405 if (likely(v) && !PyLong_Check(v)) {
43407 v = PyNumber_Long(tmp);
43412 int one = 1; int is_little = (int)*(unsigned char *)&one;
43413 unsigned char *bytes = (unsigned char *)&val;
43414 int ret = _PyLong_AsByteArray((PyLongObject *)v,
43415 bytes, sizeof(val),
43416 is_little, !is_unsigned);
43421 return (uint64_t)-1;
43425 static CYTHON_INLINE uint8_t __Pyx_PyInt_from_py_uint8_t(PyObject* x) {
43426 const uint8_t neg_one = (uint8_t)-1, const_zero = (uint8_t)0;
43427 const int is_unsigned = const_zero < neg_one;
43428 if (sizeof(uint8_t) == sizeof(char)) {
43430 return (uint8_t)__Pyx_PyInt_AsUnsignedChar(x);
43432 return (uint8_t)__Pyx_PyInt_AsSignedChar(x);
43433 } else if (sizeof(uint8_t) == sizeof(short)) {
43435 return (uint8_t)__Pyx_PyInt_AsUnsignedShort(x);
43437 return (uint8_t)__Pyx_PyInt_AsSignedShort(x);
43438 } else if (sizeof(uint8_t) == sizeof(int)) {
43440 return (uint8_t)__Pyx_PyInt_AsUnsignedInt(x);
43442 return (uint8_t)__Pyx_PyInt_AsSignedInt(x);
43443 } else if (sizeof(uint8_t) == sizeof(long)) {
43445 return (uint8_t)__Pyx_PyInt_AsUnsignedLong(x);
43447 return (uint8_t)__Pyx_PyInt_AsSignedLong(x);
43448 } else if (sizeof(uint8_t) == sizeof(PY_LONG_LONG)) {
43450 return (uint8_t)__Pyx_PyInt_AsUnsignedLongLong(x);
43452 return (uint8_t)__Pyx_PyInt_AsSignedLongLong(x);
43455 PyObject *v = __Pyx_PyNumber_Int(x);
43456 #if PY_VERSION_HEX < 0x03000000
43457 if (likely(v) && !PyLong_Check(v)) {
43459 v = PyNumber_Long(tmp);
43464 int one = 1; int is_little = (int)*(unsigned char *)&one;
43465 unsigned char *bytes = (unsigned char *)&val;
43466 int ret = _PyLong_AsByteArray((PyLongObject *)v,
43467 bytes, sizeof(val),
43468 is_little, !is_unsigned);
43473 return (uint8_t)-1;
43477 static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject* x) {
43478 const int32_t neg_one = (int32_t)-1, const_zero = (int32_t)0;
43479 const int is_unsigned = const_zero < neg_one;
43480 if (sizeof(int32_t) == sizeof(char)) {
43482 return (int32_t)__Pyx_PyInt_AsUnsignedChar(x);
43484 return (int32_t)__Pyx_PyInt_AsSignedChar(x);
43485 } else if (sizeof(int32_t) == sizeof(short)) {
43487 return (int32_t)__Pyx_PyInt_AsUnsignedShort(x);
43489 return (int32_t)__Pyx_PyInt_AsSignedShort(x);
43490 } else if (sizeof(int32_t) == sizeof(int)) {
43492 return (int32_t)__Pyx_PyInt_AsUnsignedInt(x);
43494 return (int32_t)__Pyx_PyInt_AsSignedInt(x);
43495 } else if (sizeof(int32_t) == sizeof(long)) {
43497 return (int32_t)__Pyx_PyInt_AsUnsignedLong(x);
43499 return (int32_t)__Pyx_PyInt_AsSignedLong(x);
43500 } else if (sizeof(int32_t) == sizeof(PY_LONG_LONG)) {
43502 return (int32_t)__Pyx_PyInt_AsUnsignedLongLong(x);
43504 return (int32_t)__Pyx_PyInt_AsSignedLongLong(x);
43507 PyObject *v = __Pyx_PyNumber_Int(x);
43508 #if PY_VERSION_HEX < 0x03000000
43509 if (likely(v) && !PyLong_Check(v)) {
43511 v = PyNumber_Long(tmp);
43516 int one = 1; int is_little = (int)*(unsigned char *)&one;
43517 unsigned char *bytes = (unsigned char *)&val;
43518 int ret = _PyLong_AsByteArray((PyLongObject *)v,
43519 bytes, sizeof(val),
43520 is_little, !is_unsigned);
43525 return (int32_t)-1;
43529 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint64_t(uint64_t val) {
43530 const uint64_t neg_one = (uint64_t)-1, const_zero = (uint64_t)0;
43531 const int is_unsigned = const_zero < neg_one;
43532 if ((sizeof(uint64_t) == sizeof(char)) ||
43533 (sizeof(uint64_t) == sizeof(short))) {
43534 return PyInt_FromLong((long)val);
43535 } else if ((sizeof(uint64_t) == sizeof(int)) ||
43536 (sizeof(uint64_t) == sizeof(long))) {
43538 return PyLong_FromUnsignedLong((unsigned long)val);
43540 return PyInt_FromLong((long)val);
43541 } else if (sizeof(uint64_t) == sizeof(PY_LONG_LONG)) {
43543 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
43545 return PyLong_FromLongLong((PY_LONG_LONG)val);
43547 int one = 1; int little = (int)*(unsigned char *)&one;
43548 unsigned char *bytes = (unsigned char *)&val;
43549 return _PyLong_FromByteArray(bytes, sizeof(uint64_t),
43550 little, !is_unsigned);
43554 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
43555 const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
43556 const int is_unsigned = neg_one > const_zero;
43557 if (sizeof(unsigned char) < sizeof(long)) {
43558 long val = __Pyx_PyInt_AsLong(x);
43559 if (unlikely(val != (long)(unsigned char)val)) {
43560 if (!unlikely(val == -1 && PyErr_Occurred())) {
43561 PyErr_SetString(PyExc_OverflowError,
43562 (is_unsigned && unlikely(val < 0)) ?
43563 "can't convert negative value to unsigned char" :
43564 "value too large to convert to unsigned char");
43566 return (unsigned char)-1;
43568 return (unsigned char)val;
43570 return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
43573 static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
43574 const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
43575 const int is_unsigned = neg_one > const_zero;
43576 if (sizeof(unsigned short) < sizeof(long)) {
43577 long val = __Pyx_PyInt_AsLong(x);
43578 if (unlikely(val != (long)(unsigned short)val)) {
43579 if (!unlikely(val == -1 && PyErr_Occurred())) {
43580 PyErr_SetString(PyExc_OverflowError,
43581 (is_unsigned && unlikely(val < 0)) ?
43582 "can't convert negative value to unsigned short" :
43583 "value too large to convert to unsigned short");
43585 return (unsigned short)-1;
43587 return (unsigned short)val;
43589 return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
43592 static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
43593 const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
43594 const int is_unsigned = neg_one > const_zero;
43595 if (sizeof(unsigned int) < sizeof(long)) {
43596 long val = __Pyx_PyInt_AsLong(x);
43597 if (unlikely(val != (long)(unsigned int)val)) {
43598 if (!unlikely(val == -1 && PyErr_Occurred())) {
43599 PyErr_SetString(PyExc_OverflowError,
43600 (is_unsigned && unlikely(val < 0)) ?
43601 "can't convert negative value to unsigned int" :
43602 "value too large to convert to unsigned int");
43604 return (unsigned int)-1;
43606 return (unsigned int)val;
43608 return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
43611 static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
43612 const char neg_one = (char)-1, const_zero = 0;
43613 const int is_unsigned = neg_one > const_zero;
43614 if (sizeof(char) < sizeof(long)) {
43615 long val = __Pyx_PyInt_AsLong(x);
43616 if (unlikely(val != (long)(char)val)) {
43617 if (!unlikely(val == -1 && PyErr_Occurred())) {
43618 PyErr_SetString(PyExc_OverflowError,
43619 (is_unsigned && unlikely(val < 0)) ?
43620 "can't convert negative value to char" :
43621 "value too large to convert to char");
43627 return (char)__Pyx_PyInt_AsLong(x);
43630 static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
43631 const short neg_one = (short)-1, const_zero = 0;
43632 const int is_unsigned = neg_one > const_zero;
43633 if (sizeof(short) < sizeof(long)) {
43634 long val = __Pyx_PyInt_AsLong(x);
43635 if (unlikely(val != (long)(short)val)) {
43636 if (!unlikely(val == -1 && PyErr_Occurred())) {
43637 PyErr_SetString(PyExc_OverflowError,
43638 (is_unsigned && unlikely(val < 0)) ?
43639 "can't convert negative value to short" :
43640 "value too large to convert to short");
43646 return (short)__Pyx_PyInt_AsLong(x);
43649 static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
43650 const int neg_one = (int)-1, const_zero = 0;
43651 const int is_unsigned = neg_one > const_zero;
43652 if (sizeof(int) < sizeof(long)) {
43653 long val = __Pyx_PyInt_AsLong(x);
43654 if (unlikely(val != (long)(int)val)) {
43655 if (!unlikely(val == -1 && PyErr_Occurred())) {
43656 PyErr_SetString(PyExc_OverflowError,
43657 (is_unsigned && unlikely(val < 0)) ?
43658 "can't convert negative value to int" :
43659 "value too large to convert to int");
43665 return (int)__Pyx_PyInt_AsLong(x);
43668 static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
43669 const signed char neg_one = (signed char)-1, const_zero = 0;
43670 const int is_unsigned = neg_one > const_zero;
43671 if (sizeof(signed char) < sizeof(long)) {
43672 long val = __Pyx_PyInt_AsLong(x);
43673 if (unlikely(val != (long)(signed char)val)) {
43674 if (!unlikely(val == -1 && PyErr_Occurred())) {
43675 PyErr_SetString(PyExc_OverflowError,
43676 (is_unsigned && unlikely(val < 0)) ?
43677 "can't convert negative value to signed char" :
43678 "value too large to convert to signed char");
43680 return (signed char)-1;
43682 return (signed char)val;
43684 return (signed char)__Pyx_PyInt_AsSignedLong(x);
43687 static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
43688 const signed short neg_one = (signed short)-1, const_zero = 0;
43689 const int is_unsigned = neg_one > const_zero;
43690 if (sizeof(signed short) < sizeof(long)) {
43691 long val = __Pyx_PyInt_AsLong(x);
43692 if (unlikely(val != (long)(signed short)val)) {
43693 if (!unlikely(val == -1 && PyErr_Occurred())) {
43694 PyErr_SetString(PyExc_OverflowError,
43695 (is_unsigned && unlikely(val < 0)) ?
43696 "can't convert negative value to signed short" :
43697 "value too large to convert to signed short");
43699 return (signed short)-1;
43701 return (signed short)val;
43703 return (signed short)__Pyx_PyInt_AsSignedLong(x);
43706 static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
43707 const signed int neg_one = (signed int)-1, const_zero = 0;
43708 const int is_unsigned = neg_one > const_zero;
43709 if (sizeof(signed int) < sizeof(long)) {
43710 long val = __Pyx_PyInt_AsLong(x);
43711 if (unlikely(val != (long)(signed int)val)) {
43712 if (!unlikely(val == -1 && PyErr_Occurred())) {
43713 PyErr_SetString(PyExc_OverflowError,
43714 (is_unsigned && unlikely(val < 0)) ?
43715 "can't convert negative value to signed int" :
43716 "value too large to convert to signed int");
43718 return (signed int)-1;
43720 return (signed int)val;
43722 return (signed int)__Pyx_PyInt_AsSignedLong(x);
43725 static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
43726 const int neg_one = (int)-1, const_zero = 0;
43727 const int is_unsigned = neg_one > const_zero;
43728 if (sizeof(int) < sizeof(long)) {
43729 long val = __Pyx_PyInt_AsLong(x);
43730 if (unlikely(val != (long)(int)val)) {
43731 if (!unlikely(val == -1 && PyErr_Occurred())) {
43732 PyErr_SetString(PyExc_OverflowError,
43733 (is_unsigned && unlikely(val < 0)) ?
43734 "can't convert negative value to int" :
43735 "value too large to convert to int");
43741 return (int)__Pyx_PyInt_AsLong(x);
43744 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
43745 const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
43746 const int is_unsigned = neg_one > const_zero;
43747 #if PY_VERSION_HEX < 0x03000000
43748 if (likely(PyInt_Check(x))) {
43749 long val = PyInt_AS_LONG(x);
43750 if (is_unsigned && unlikely(val < 0)) {
43751 PyErr_SetString(PyExc_OverflowError,
43752 "can't convert negative value to unsigned long");
43753 return (unsigned long)-1;
43755 return (unsigned long)val;
43758 if (likely(PyLong_Check(x))) {
43760 if (unlikely(Py_SIZE(x) < 0)) {
43761 PyErr_SetString(PyExc_OverflowError,
43762 "can't convert negative value to unsigned long");
43763 return (unsigned long)-1;
43765 return (unsigned long)PyLong_AsUnsignedLong(x);
43767 return (unsigned long)PyLong_AsLong(x);
43771 PyObject *tmp = __Pyx_PyNumber_Int(x);
43772 if (!tmp) return (unsigned long)-1;
43773 val = __Pyx_PyInt_AsUnsignedLong(tmp);
43779 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
43780 const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
43781 const int is_unsigned = neg_one > const_zero;
43782 #if PY_VERSION_HEX < 0x03000000
43783 if (likely(PyInt_Check(x))) {
43784 long val = PyInt_AS_LONG(x);
43785 if (is_unsigned && unlikely(val < 0)) {
43786 PyErr_SetString(PyExc_OverflowError,
43787 "can't convert negative value to unsigned PY_LONG_LONG");
43788 return (unsigned PY_LONG_LONG)-1;
43790 return (unsigned PY_LONG_LONG)val;
43793 if (likely(PyLong_Check(x))) {
43795 if (unlikely(Py_SIZE(x) < 0)) {
43796 PyErr_SetString(PyExc_OverflowError,
43797 "can't convert negative value to unsigned PY_LONG_LONG");
43798 return (unsigned PY_LONG_LONG)-1;
43800 return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
43802 return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
43805 unsigned PY_LONG_LONG val;
43806 PyObject *tmp = __Pyx_PyNumber_Int(x);
43807 if (!tmp) return (unsigned PY_LONG_LONG)-1;
43808 val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
43814 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
43815 const long neg_one = (long)-1, const_zero = 0;
43816 const int is_unsigned = neg_one > const_zero;
43817 #if PY_VERSION_HEX < 0x03000000
43818 if (likely(PyInt_Check(x))) {
43819 long val = PyInt_AS_LONG(x);
43820 if (is_unsigned && unlikely(val < 0)) {
43821 PyErr_SetString(PyExc_OverflowError,
43822 "can't convert negative value to long");
43828 if (likely(PyLong_Check(x))) {
43830 if (unlikely(Py_SIZE(x) < 0)) {
43831 PyErr_SetString(PyExc_OverflowError,
43832 "can't convert negative value to long");
43835 return (long)PyLong_AsUnsignedLong(x);
43837 return (long)PyLong_AsLong(x);
43841 PyObject *tmp = __Pyx_PyNumber_Int(x);
43842 if (!tmp) return (long)-1;
43843 val = __Pyx_PyInt_AsLong(tmp);
43849 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
43850 const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
43851 const int is_unsigned = neg_one > const_zero;
43852 #if PY_VERSION_HEX < 0x03000000
43853 if (likely(PyInt_Check(x))) {
43854 long val = PyInt_AS_LONG(x);
43855 if (is_unsigned && unlikely(val < 0)) {
43856 PyErr_SetString(PyExc_OverflowError,
43857 "can't convert negative value to PY_LONG_LONG");
43858 return (PY_LONG_LONG)-1;
43860 return (PY_LONG_LONG)val;
43863 if (likely(PyLong_Check(x))) {
43865 if (unlikely(Py_SIZE(x) < 0)) {
43866 PyErr_SetString(PyExc_OverflowError,
43867 "can't convert negative value to PY_LONG_LONG");
43868 return (PY_LONG_LONG)-1;
43870 return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
43872 return (PY_LONG_LONG)PyLong_AsLongLong(x);
43876 PyObject *tmp = __Pyx_PyNumber_Int(x);
43877 if (!tmp) return (PY_LONG_LONG)-1;
43878 val = __Pyx_PyInt_AsLongLong(tmp);
43884 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
43885 const signed long neg_one = (signed long)-1, const_zero = 0;
43886 const int is_unsigned = neg_one > const_zero;
43887 #if PY_VERSION_HEX < 0x03000000
43888 if (likely(PyInt_Check(x))) {
43889 long val = PyInt_AS_LONG(x);
43890 if (is_unsigned && unlikely(val < 0)) {
43891 PyErr_SetString(PyExc_OverflowError,
43892 "can't convert negative value to signed long");
43893 return (signed long)-1;
43895 return (signed long)val;
43898 if (likely(PyLong_Check(x))) {
43900 if (unlikely(Py_SIZE(x) < 0)) {
43901 PyErr_SetString(PyExc_OverflowError,
43902 "can't convert negative value to signed long");
43903 return (signed long)-1;
43905 return (signed long)PyLong_AsUnsignedLong(x);
43907 return (signed long)PyLong_AsLong(x);
43911 PyObject *tmp = __Pyx_PyNumber_Int(x);
43912 if (!tmp) return (signed long)-1;
43913 val = __Pyx_PyInt_AsSignedLong(tmp);
43919 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
43920 const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
43921 const int is_unsigned = neg_one > const_zero;
43922 #if PY_VERSION_HEX < 0x03000000
43923 if (likely(PyInt_Check(x))) {
43924 long val = PyInt_AS_LONG(x);
43925 if (is_unsigned && unlikely(val < 0)) {
43926 PyErr_SetString(PyExc_OverflowError,
43927 "can't convert negative value to signed PY_LONG_LONG");
43928 return (signed PY_LONG_LONG)-1;
43930 return (signed PY_LONG_LONG)val;
43933 if (likely(PyLong_Check(x))) {
43935 if (unlikely(Py_SIZE(x) < 0)) {
43936 PyErr_SetString(PyExc_OverflowError,
43937 "can't convert negative value to signed PY_LONG_LONG");
43938 return (signed PY_LONG_LONG)-1;
43940 return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
43942 return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
43945 signed PY_LONG_LONG val;
43946 PyObject *tmp = __Pyx_PyNumber_Int(x);
43947 if (!tmp) return (signed PY_LONG_LONG)-1;
43948 val = __Pyx_PyInt_AsSignedLongLong(tmp);
43954 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
43955 PyObject *tmp_type, *tmp_value, *tmp_tb;
43956 PyThreadState *tstate = PyThreadState_GET();
43957 tmp_type = tstate->exc_type;
43958 tmp_value = tstate->exc_value;
43959 tmp_tb = tstate->exc_traceback;
43960 tstate->exc_type = *type;
43961 tstate->exc_value = *value;
43962 tstate->exc_traceback = *tb;
43964 *value = tmp_value;
43968 static PyObject *__Pyx_Generator_Next(PyObject *self);
43969 static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value);
43970 static PyObject *__Pyx_Generator_Close(PyObject *self);
43971 static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args);
43972 static CYTHON_INLINE
43973 void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self)
43975 PyObject *exc_type = self->exc_type;
43976 PyObject *exc_value = self->exc_value;
43977 PyObject *exc_traceback = self->exc_traceback;
43978 self->exc_type = NULL;
43979 self->exc_value = NULL;
43980 self->exc_traceback = NULL;
43981 Py_XDECREF(exc_type);
43982 Py_XDECREF(exc_value);
43983 Py_XDECREF(exc_traceback);
43985 static CYTHON_INLINE
43986 PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value)
43989 if (unlikely(self->is_running)) {
43990 PyErr_SetString(PyExc_ValueError,
43991 "generator already executing");
43994 if (unlikely(self->resume_label == 0)) {
43995 if (unlikely(value && value != Py_None)) {
43996 PyErr_SetString(PyExc_TypeError,
43997 "can't send non-None value to a "
43998 "just-started generator");
44002 if (unlikely(self->resume_label == -1)) {
44003 PyErr_SetNone(PyExc_StopIteration);
44007 __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback);
44009 __Pyx_Generator_ExceptionClear(self);
44010 self->is_running = 1;
44011 retval = self->body((PyObject *) self, value);
44012 self->is_running = 0;
44014 __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback);
44016 __Pyx_Generator_ExceptionClear(self);
44019 static PyObject *__Pyx_Generator_Next(PyObject *self)
44021 return __Pyx_Generator_SendEx((__pyx_GeneratorObject *) self, Py_None);
44023 static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value)
44025 return __Pyx_Generator_SendEx((__pyx_GeneratorObject *) self, value);
44027 static PyObject *__Pyx_Generator_Close(PyObject *self)
44029 __pyx_GeneratorObject *generator = (__pyx_GeneratorObject *) self;
44031 #if PY_VERSION_HEX < 0x02050000
44032 PyErr_SetNone(PyExc_StopIteration);
44034 PyErr_SetNone(PyExc_GeneratorExit);
44036 retval = __Pyx_Generator_SendEx(generator, NULL);
44039 PyErr_SetString(PyExc_RuntimeError,
44040 "generator ignored GeneratorExit");
44043 #if PY_VERSION_HEX < 0x02050000
44044 if (PyErr_ExceptionMatches(PyExc_StopIteration))
44046 if (PyErr_ExceptionMatches(PyExc_StopIteration)
44047 || PyErr_ExceptionMatches(PyExc_GeneratorExit))
44050 PyErr_Clear(); /* ignore these errors */
44051 Py_INCREF(Py_None);
44056 static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args)
44058 __pyx_GeneratorObject *generator = (__pyx_GeneratorObject *) self;
44060 PyObject *tb = NULL;
44061 PyObject *val = NULL;
44062 if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
44064 __Pyx_Raise(typ, val, tb, NULL);
44065 return __Pyx_Generator_SendEx(generator, NULL);
44068 __Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg)
44070 __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
44071 Py_VISIT(gen->closure);
44072 Py_VISIT(gen->classobj);
44073 Py_VISIT(gen->exc_type);
44074 Py_VISIT(gen->exc_value);
44075 Py_VISIT(gen->exc_traceback);
44079 __Pyx_Generator_dealloc(PyObject *self)
44081 __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
44082 PyObject_GC_UnTrack(gen);
44083 if (gen->gi_weakreflist != NULL)
44084 PyObject_ClearWeakRefs(self);
44085 PyObject_GC_Track(self);
44086 if (gen->resume_label > 0) {
44087 Py_TYPE(gen)->tp_del(self);
44088 if (self->ob_refcnt > 0)
44089 return; /* resurrected. :( */
44091 PyObject_GC_UnTrack(self);
44092 Py_CLEAR(gen->closure);
44093 Py_CLEAR(gen->classobj);
44094 Py_CLEAR(gen->exc_type);
44095 Py_CLEAR(gen->exc_value);
44096 Py_CLEAR(gen->exc_traceback);
44097 PyObject_GC_Del(gen);
44100 __Pyx_Generator_del(PyObject *self)
44103 PyObject *error_type, *error_value, *error_traceback;
44104 __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
44105 if (gen->resume_label <= 0)
44107 assert(self->ob_refcnt == 0);
44108 self->ob_refcnt = 1;
44109 __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
44110 res = __Pyx_Generator_Close(self);
44112 PyErr_WriteUnraisable(self);
44115 __Pyx_ErrRestore(error_type, error_value, error_traceback);
44116 /* Undo the temporary resurrection; can't use DECREF here, it would
44117 * cause a recursive call.
44119 assert(self->ob_refcnt > 0);
44120 if (--self->ob_refcnt == 0)
44121 return; /* this is the normal path out */
44122 /* close() resurrected it! Make it look like the original Py_DECREF
44126 Py_ssize_t refcnt = self->ob_refcnt;
44127 _Py_NewReference(self);
44128 self->ob_refcnt = refcnt;
44130 assert(PyType_IS_GC(self->ob_type) &&
44131 _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
44132 /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so
44133 * we need to undo that. */
44135 /* If Py_TRACE_REFS, _Py_NewReference re-added self to the object
44136 * chain, so no more to do there.
44137 * If COUNT_ALLOCS, the original decref bumped tp_frees, and
44138 * _Py_NewReference bumped tp_allocs: both of those need to be
44141 #ifdef COUNT_ALLOCS
44142 --self->ob_type->tp_frees;
44143 --self->ob_type->tp_allocs;
44146 static PyMemberDef __pyx_Generator_memberlist[] = {
44147 {(char *) "gi_running",
44149 offsetof(__pyx_GeneratorObject, is_running),
44154 static PyMethodDef __pyx_Generator_methods[] = {
44155 {__Pyx_NAMESTR("send"), (PyCFunction) __Pyx_Generator_Send, METH_O, 0},
44156 {__Pyx_NAMESTR("throw"), (PyCFunction) __Pyx_Generator_Throw, METH_VARARGS, 0},
44157 {__Pyx_NAMESTR("close"), (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0},
44160 static PyTypeObject __pyx_GeneratorType = {
44161 PyVarObject_HEAD_INIT(0, 0)
44162 __Pyx_NAMESTR("generator"), /*tp_name*/
44163 sizeof(__pyx_GeneratorObject), /*tp_basicsize*/
44165 (destructor) __Pyx_Generator_dealloc,/*tp_dealloc*/
44169 #if PY_MAJOR_VERSION < 3
44175 0, /*tp_as_number*/
44176 0, /*tp_as_sequence*/
44177 0, /*tp_as_mapping*/
44181 PyObject_GenericGetAttr, /*tp_getattro*/
44183 0, /*tp_as_buffer*/
44184 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
44186 (traverseproc) __Pyx_Generator_traverse, /*tp_traverse*/
44188 0, /*tp_richcompare*/
44189 offsetof(__pyx_GeneratorObject, gi_weakreflist), /* tp_weaklistoffse */
44190 PyObject_SelfIter, /*tp_iter*/
44191 (iternextfunc) __Pyx_Generator_Next, /*tp_iternext*/
44192 __pyx_Generator_methods, /*tp_methods*/
44193 __pyx_Generator_memberlist, /*tp_members*/
44197 0, /*tp_descr_get*/
44198 0, /*tp_descr_set*/
44199 0, /*tp_dictoffset*/
44208 0, /*tp_subclasses*/
44210 __Pyx_Generator_del, /*tp_del*/
44211 #if PY_VERSION_HEX >= 0x02060000
44212 0, /*tp_version_tag*/
44216 __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
44219 __pyx_GeneratorObject *gen =
44220 PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType);
44224 gen->closure = closure;
44225 Py_XINCREF(closure);
44226 gen->is_running = 0;
44227 gen->resume_label = 0;
44228 gen->classobj = NULL;
44229 gen->exc_type = NULL;
44230 gen->exc_value = NULL;
44231 gen->exc_traceback = NULL;
44232 gen->gi_weakreflist = NULL;
44233 PyObject_GC_Track(gen);
44236 static int __pyx_Generator_init(void)
44238 return PyType_Ready(&__pyx_GeneratorType);
44241 static void __Pyx_WriteUnraisable(const char *name, int clineno,
44242 int lineno, const char *filename) {
44243 PyObject *old_exc, *old_val, *old_tb;
44245 __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
44246 #if PY_MAJOR_VERSION < 3
44247 ctx = PyString_FromString(name);
44249 ctx = PyUnicode_FromString(name);
44251 __Pyx_ErrRestore(old_exc, old_val, old_tb);
44253 PyErr_WriteUnraisable(Py_None);
44255 PyErr_WriteUnraisable(ctx);
44260 static int __Pyx_check_binary_version(void) {
44261 char ctversion[4], rtversion[4];
44262 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
44263 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
44264 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
44266 PyOS_snprintf(message, sizeof(message),
44267 "compiletime version %s of module '%.100s' "
44268 "does not match runtime version %s",
44269 ctversion, __Pyx_MODULE_NAME, rtversion);
44270 #if PY_VERSION_HEX < 0x02050000
44271 return PyErr_Warn(NULL, message);
44273 return PyErr_WarnEx(NULL, message, 1);
44279 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
44280 #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
44281 PyObject *ob = PyCapsule_New(vtable, 0, 0);
44283 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
44287 if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
44296 #ifndef __PYX_HAVE_RT_ImportType
44297 #define __PYX_HAVE_RT_ImportType
44298 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
44299 size_t size, int strict)
44301 PyObject *py_module = 0;
44302 PyObject *result = 0;
44303 PyObject *py_name = 0;
44305 py_module = __Pyx_ImportModule(module_name);
44308 py_name = __Pyx_PyIdentifier_FromString(class_name);
44311 result = PyObject_GetAttr(py_module, py_name);
44312 Py_DECREF(py_name);
44314 Py_DECREF(py_module);
44318 if (!PyType_Check(result)) {
44319 PyErr_Format(PyExc_TypeError,
44320 "%s.%s is not a type object",
44321 module_name, class_name);
44324 if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) {
44325 PyOS_snprintf(warning, sizeof(warning),
44326 "%s.%s size changed, may indicate binary incompatibility",
44327 module_name, class_name);
44328 #if PY_VERSION_HEX < 0x02050000
44329 if (PyErr_Warn(NULL, warning) < 0) goto bad;
44331 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
44334 else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) {
44335 PyErr_Format(PyExc_ValueError,
44336 "%s.%s has the wrong size, try recompiling",
44337 module_name, class_name);
44340 return (PyTypeObject *)result;
44342 Py_XDECREF(py_module);
44343 Py_XDECREF(result);
44348 #ifndef __PYX_HAVE_RT_ImportModule
44349 #define __PYX_HAVE_RT_ImportModule
44350 static PyObject *__Pyx_ImportModule(const char *name) {
44351 PyObject *py_name = 0;
44352 PyObject *py_module = 0;
44353 py_name = __Pyx_PyIdentifier_FromString(name);
44356 py_module = PyImport_Import(py_name);
44357 Py_DECREF(py_name);
44360 Py_XDECREF(py_name);
44365 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
44366 int start = 0, mid = 0, end = count - 1;
44367 if (end >= 0 && code_line > entries[end].code_line) {
44370 while (start < end) {
44371 mid = (start + end) / 2;
44372 if (code_line < entries[mid].code_line) {
44374 } else if (code_line > entries[mid].code_line) {
44380 if (code_line <= entries[mid].code_line) {
44386 static PyCodeObject *__pyx_find_code_object(int code_line) {
44387 PyCodeObject* code_object;
44389 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
44392 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
44393 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
44396 code_object = __pyx_code_cache.entries[pos].code_object;
44397 Py_INCREF(code_object);
44398 return code_object;
44400 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
44402 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
44403 if (unlikely(!code_line)) {
44406 if (unlikely(!entries)) {
44407 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
44408 if (likely(entries)) {
44409 __pyx_code_cache.entries = entries;
44410 __pyx_code_cache.max_count = 64;
44411 __pyx_code_cache.count = 1;
44412 entries[0].code_line = code_line;
44413 entries[0].code_object = code_object;
44414 Py_INCREF(code_object);
44418 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
44419 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
44420 PyCodeObject* tmp = entries[pos].code_object;
44421 entries[pos].code_object = code_object;
44425 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
44426 int new_max = __pyx_code_cache.max_count + 64;
44427 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
44428 __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
44429 if (unlikely(!entries)) {
44432 __pyx_code_cache.entries = entries;
44433 __pyx_code_cache.max_count = new_max;
44435 for (i=__pyx_code_cache.count; i>pos; i--) {
44436 entries[i] = entries[i-1];
44438 entries[pos].code_line = code_line;
44439 entries[pos].code_object = code_object;
44440 __pyx_code_cache.count++;
44441 Py_INCREF(code_object);
44444 #include "compile.h"
44445 #include "frameobject.h"
44446 #include "traceback.h"
44447 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
44448 const char *funcname, int c_line,
44449 int py_line, const char *filename) {
44450 PyCodeObject *py_code = 0;
44451 PyObject *py_srcfile = 0;
44452 PyObject *py_funcname = 0;
44453 #if PY_MAJOR_VERSION < 3
44454 py_srcfile = PyString_FromString(filename);
44456 py_srcfile = PyUnicode_FromString(filename);
44458 if (!py_srcfile) goto bad;
44460 #if PY_MAJOR_VERSION < 3
44461 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
44463 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
44467 #if PY_MAJOR_VERSION < 3
44468 py_funcname = PyString_FromString(funcname);
44470 py_funcname = PyUnicode_FromString(funcname);
44473 if (!py_funcname) goto bad;
44474 py_code = __Pyx_PyCode_New(
44475 0, /*int argcount,*/
44476 0, /*int kwonlyargcount,*/
44477 0, /*int nlocals,*/
44478 0, /*int stacksize,*/
44480 __pyx_empty_bytes, /*PyObject *code,*/
44481 __pyx_empty_tuple, /*PyObject *consts,*/
44482 __pyx_empty_tuple, /*PyObject *names,*/
44483 __pyx_empty_tuple, /*PyObject *varnames,*/
44484 __pyx_empty_tuple, /*PyObject *freevars,*/
44485 __pyx_empty_tuple, /*PyObject *cellvars,*/
44486 py_srcfile, /*PyObject *filename,*/
44487 py_funcname, /*PyObject *name,*/
44488 py_line, /*int firstlineno,*/
44489 __pyx_empty_bytes /*PyObject *lnotab*/
44491 Py_DECREF(py_srcfile);
44492 Py_DECREF(py_funcname);
44495 Py_XDECREF(py_srcfile);
44496 Py_XDECREF(py_funcname);
44499 static void __Pyx_AddTraceback(const char *funcname, int c_line,
44500 int py_line, const char *filename) {
44501 PyCodeObject *py_code = 0;
44502 PyObject *py_globals = 0;
44503 PyFrameObject *py_frame = 0;
44504 py_code = __pyx_find_code_object(c_line ? c_line : py_line);
44506 py_code = __Pyx_CreateCodeObjectForTraceback(
44507 funcname, c_line, py_line, filename);
44508 if (!py_code) goto bad;
44509 __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
44511 py_globals = PyModule_GetDict(__pyx_m);
44512 if (!py_globals) goto bad;
44513 py_frame = PyFrame_New(
44514 PyThreadState_GET(), /*PyThreadState *tstate,*/
44515 py_code, /*PyCodeObject *code,*/
44516 py_globals, /*PyObject *globals,*/
44517 0 /*PyObject *locals*/
44519 if (!py_frame) goto bad;
44520 py_frame->f_lineno = py_line;
44521 PyTraceBack_Here(py_frame);
44523 Py_XDECREF(py_code);
44524 Py_XDECREF(py_frame);
44527 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
44529 #if PY_MAJOR_VERSION < 3
44530 if (t->is_unicode) {
44531 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
44532 } else if (t->intern) {
44533 *t->p = PyString_InternFromString(t->s);
44535 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
44537 #else /* Python 3+ has unicode identifiers */
44538 if (t->is_unicode | t->is_str) {
44540 *t->p = PyUnicode_InternFromString(t->s);
44541 } else if (t->encoding) {
44542 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
44544 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
44547 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
44558 /* Type Conversion Functions */
44560 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
44561 int is_true = x == Py_True;
44562 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
44563 else return PyObject_IsTrue(x);
44566 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
44567 PyNumberMethods *m;
44568 const char *name = NULL;
44569 PyObject *res = NULL;
44570 #if PY_VERSION_HEX < 0x03000000
44571 if (PyInt_Check(x) || PyLong_Check(x))
44573 if (PyLong_Check(x))
44575 return Py_INCREF(x), x;
44576 m = Py_TYPE(x)->tp_as_number;
44577 #if PY_VERSION_HEX < 0x03000000
44578 if (m && m->nb_int) {
44580 res = PyNumber_Int(x);
44582 else if (m && m->nb_long) {
44584 res = PyNumber_Long(x);
44587 if (m && m->nb_int) {
44589 res = PyNumber_Long(x);
44593 #if PY_VERSION_HEX < 0x03000000
44594 if (!PyInt_Check(res) && !PyLong_Check(res)) {
44596 if (!PyLong_Check(res)) {
44598 PyErr_Format(PyExc_TypeError,
44599 "__%s__ returned non-%s (type %.200s)",
44600 name, name, Py_TYPE(res)->tp_name);
44605 else if (!PyErr_Occurred()) {
44606 PyErr_SetString(PyExc_TypeError,
44607 "an integer is required");
44612 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
44614 PyObject* x = PyNumber_Index(b);
44616 ival = PyInt_AsSsize_t(x);
44621 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
44622 #if PY_VERSION_HEX < 0x02050000
44623 if (ival <= LONG_MAX)
44624 return PyInt_FromLong((long)ival);
44626 unsigned char *bytes = (unsigned char *) &ival;
44627 int one = 1; int little = (int)*(unsigned char*)&one;
44628 return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
44631 return PyInt_FromSize_t(ival);
44635 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
44636 unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
44637 if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
44639 } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
44640 PyErr_SetString(PyExc_OverflowError,
44641 "value too large to convert to size_t");
44644 return (size_t)val;
44648 #endif /* Py_PYTHON_H */