1 /* Generated by Cython 0.14.1 on Fri Nov 25 19:51:23 2011 */
3 #define PY_SSIZE_T_CLEAN
6 #error Python headers needed to compile C extensions, please install development version of Python.
9 #include <stddef.h> /* For offsetof */
11 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
14 #if !defined(WIN32) && !defined(MS_WINDOWS)
27 #define DL_IMPORT(t) t
30 #define DL_EXPORT(t) t
34 #define PY_LONG_LONG LONG_LONG
37 #if PY_VERSION_HEX < 0x02040000
38 #define METH_COEXIST 0
39 #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
40 #define PyDict_Contains(d,o) PySequence_Contains(d,o)
43 #if PY_VERSION_HEX < 0x02050000
44 typedef int Py_ssize_t;
45 #define PY_SSIZE_T_MAX INT_MAX
46 #define PY_SSIZE_T_MIN INT_MIN
47 #define PY_FORMAT_SIZE_T ""
48 #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
49 #define PyInt_AsSsize_t(o) PyInt_AsLong(o)
50 #define PyNumber_Index(o) PyNumber_Int(o)
51 #define PyIndex_Check(o) PyNumber_Check(o)
52 #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
55 #if PY_VERSION_HEX < 0x02060000
56 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
57 #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
58 #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
59 #define PyVarObject_HEAD_INIT(type, size) \
60 PyObject_HEAD_INIT(type) size,
61 #define PyType_Modified(t)
73 Py_ssize_t *suboffsets;
77 #define PyBUF_SIMPLE 0
78 #define PyBUF_WRITABLE 0x0001
79 #define PyBUF_FORMAT 0x0004
80 #define PyBUF_ND 0x0008
81 #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
82 #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
83 #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
84 #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
85 #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
89 #if PY_MAJOR_VERSION < 3
90 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
92 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
95 #if PY_MAJOR_VERSION >= 3
96 #define Py_TPFLAGS_CHECKTYPES 0
97 #define Py_TPFLAGS_HAVE_INDEX 0
100 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
101 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
104 #if PY_MAJOR_VERSION >= 3
105 #define PyBaseString_Type PyUnicode_Type
106 #define PyStringObject PyUnicodeObject
107 #define PyString_Type PyUnicode_Type
108 #define PyString_Check PyUnicode_Check
109 #define PyString_CheckExact PyUnicode_CheckExact
112 #if PY_VERSION_HEX < 0x02060000
113 #define PyBytesObject PyStringObject
114 #define PyBytes_Type PyString_Type
115 #define PyBytes_Check PyString_Check
116 #define PyBytes_CheckExact PyString_CheckExact
117 #define PyBytes_FromString PyString_FromString
118 #define PyBytes_FromStringAndSize PyString_FromStringAndSize
119 #define PyBytes_FromFormat PyString_FromFormat
120 #define PyBytes_DecodeEscape PyString_DecodeEscape
121 #define PyBytes_AsString PyString_AsString
122 #define PyBytes_AsStringAndSize PyString_AsStringAndSize
123 #define PyBytes_Size PyString_Size
124 #define PyBytes_AS_STRING PyString_AS_STRING
125 #define PyBytes_GET_SIZE PyString_GET_SIZE
126 #define PyBytes_Repr PyString_Repr
127 #define PyBytes_Concat PyString_Concat
128 #define PyBytes_ConcatAndDel PyString_ConcatAndDel
131 #if PY_VERSION_HEX < 0x02060000
132 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
133 #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
135 #ifndef PySet_CheckExact
136 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
139 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
141 #if PY_MAJOR_VERSION >= 3
142 #define PyIntObject PyLongObject
143 #define PyInt_Type PyLong_Type
144 #define PyInt_Check(op) PyLong_Check(op)
145 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
146 #define PyInt_FromString PyLong_FromString
147 #define PyInt_FromUnicode PyLong_FromUnicode
148 #define PyInt_FromLong PyLong_FromLong
149 #define PyInt_FromSize_t PyLong_FromSize_t
150 #define PyInt_FromSsize_t PyLong_FromSsize_t
151 #define PyInt_AsLong PyLong_AsLong
152 #define PyInt_AS_LONG PyLong_AS_LONG
153 #define PyInt_AsSsize_t PyLong_AsSsize_t
154 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
155 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
158 #if PY_MAJOR_VERSION >= 3
159 #define PyBoolObject PyLongObject
163 #if PY_MAJOR_VERSION >= 3
164 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
165 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
167 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
168 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
171 #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
172 #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
173 #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
174 #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
176 #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
177 (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
178 (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
179 (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
180 #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
181 (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
182 (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
183 (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
184 #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
185 (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
186 (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
187 (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
190 #if PY_MAJOR_VERSION >= 3
191 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
194 #if PY_VERSION_HEX < 0x02050000
195 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
196 #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
197 #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
199 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
200 #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
201 #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
204 #if PY_VERSION_HEX < 0x02050000
205 #define __Pyx_NAMESTR(n) ((char *)(n))
206 #define __Pyx_DOCSTR(n) ((char *)(n))
208 #define __Pyx_NAMESTR(n) (n)
209 #define __Pyx_DOCSTR(n) (n)
213 #define __PYX_EXTERN_C extern "C"
215 #define __PYX_EXTERN_C extern
218 #if defined(WIN32) || defined(MS_WINDOWS)
219 #define _USE_MATH_DEFINES
222 #define __PYX_HAVE_API__csamtools
229 #include "fileobject.h"
235 #include "pysam_util.h"
236 #include "pythread.h"
238 #ifdef PYREX_WITHOUT_ASSERTIONS
239 #define CYTHON_WITHOUT_ASSERTIONS
243 /* inline attribute */
244 #ifndef CYTHON_INLINE
245 #if defined(__GNUC__)
246 #define CYTHON_INLINE __inline__
247 #elif defined(_MSC_VER)
248 #define CYTHON_INLINE __inline
249 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
250 #define CYTHON_INLINE inline
252 #define CYTHON_INLINE
256 /* unused attribute */
257 #ifndef CYTHON_UNUSED
258 # if defined(__GNUC__)
259 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
260 # define CYTHON_UNUSED __attribute__ ((__unused__))
262 # define CYTHON_UNUSED
264 # elif defined(__ICC) || defined(__INTEL_COMPILER)
265 # define CYTHON_UNUSED __attribute__ ((__unused__))
267 # define CYTHON_UNUSED
271 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*/
274 /* Type Conversion Predeclarations */
276 #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
277 #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
279 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
280 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
281 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
283 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
284 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
285 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
287 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
291 /* Test for GCC > 2.95 */
292 #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
293 #define likely(x) __builtin_expect(!!(x), 1)
294 #define unlikely(x) __builtin_expect(!!(x), 0)
295 #else /* __GNUC__ > 2 ... */
296 #define likely(x) (x)
297 #define unlikely(x) (x)
298 #endif /* __GNUC__ > 2 ... */
300 #define likely(x) (x)
301 #define unlikely(x) (x)
302 #endif /* __GNUC__ */
304 static PyObject *__pyx_m;
305 static PyObject *__pyx_b;
306 static PyObject *__pyx_empty_tuple;
307 static PyObject *__pyx_empty_bytes;
308 static int __pyx_lineno;
309 static int __pyx_clineno = 0;
310 static const char * __pyx_cfilenm= __FILE__;
311 static const char *__pyx_filename;
314 static const char *__pyx_f[] = {
321 /* Type declarations */
323 /* "csamtools.pyx":388
326 * ctypedef struct MateData: # <<<<<<<<<<<<<<
335 } __pyx_t_9csamtools_MateData;
337 /* "csamtools.pyx":1537
338 * ##-------------------------------------------------------------------
339 * ##-------------------------------------------------------------------
340 * ctypedef struct __iterdata: # <<<<<<<<<<<<<<
341 * samfile_t * samfile
352 } __pyx_t_9csamtools___iterdata;
354 /* "csamtools.pyx":1717
355 * bam_plp_set_mask( self.pileup_iter, self.mask )
357 * cdef setupIteratorData( self, # <<<<<<<<<<<<<<
362 struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData {
367 /* "csamtools.pyx":91
370 * cdef class PileupRead # <<<<<<<<<<<<<<
371 * cdef makePileupRead( bam_pileup1_t * src ):
372 * '''fill a PileupRead object from a bam_pileup1_t * object.'''
375 struct __pyx_obj_9csamtools_PileupRead {
377 struct __pyx_obj_9csamtools_AlignedRead *_alignment;
386 /* "csamtools.pxd":423
387 * cdef char * _getrname( self, int tid )
389 * cdef class IteratorRow: # <<<<<<<<<<<<<<
394 struct __pyx_obj_9csamtools_IteratorRow {
398 /* "csamtools.pyx":1415
399 * if self.owns_samfile: samclose( self.fp )
401 * cdef class IteratorRowAllRefs(IteratorRow): # <<<<<<<<<<<<<<
402 * """iterates over all mapped reads by chaining iterators over each reference
406 struct __pyx_obj_9csamtools_IteratorRowAllRefs {
407 struct __pyx_obj_9csamtools_IteratorRow __pyx_base;
408 struct __pyx_obj_9csamtools_Samfile *samfile;
410 struct __pyx_obj_9csamtools_IteratorRowRegion *rowiter;
413 /* "csamtools.pxd":426
416 * cdef class IteratorRowAll(IteratorRow): # <<<<<<<<<<<<<<
418 * cdef samfile_t * fp
421 struct __pyx_obj_9csamtools_IteratorRowAll {
422 struct __pyx_obj_9csamtools_IteratorRow __pyx_base;
423 struct __pyx_vtabstruct_9csamtools_IteratorRowAll *__pyx_vtab;
429 /* "csamtools.pyx":82
432 * cdef class PileupProxy # <<<<<<<<<<<<<<
433 * cdef makePileupProxy( bam_pileup1_t * plp, int tid, int pos, int n ):
434 * cdef PileupProxy dest = PileupProxy.__new__(PileupProxy)
437 struct __pyx_obj_9csamtools_PileupProxy {
445 /* "csamtools.pyx":1265
448 * cdef class IteratorRowRegion(IteratorRow): # <<<<<<<<<<<<<<
449 * """*(Samfile samfile, int tid, int beg, int end, int reopen = True )*
453 struct __pyx_obj_9csamtools_IteratorRowRegion {
454 struct __pyx_obj_9csamtools_IteratorRow __pyx_base;
455 struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *__pyx_vtab;
459 struct __pyx_obj_9csamtools_Samfile *samfile;
464 /* "csamtools.pyx":244
466 * ######################################################################
467 * cdef class Fastafile: # <<<<<<<<<<<<<<
472 struct __pyx_obj_9csamtools_Fastafile {
474 struct __pyx_vtabstruct_9csamtools_Fastafile *__pyx_vtab;
479 /* "csamtools.pyx":1461
480 * raise StopIteration
482 * cdef class IteratorRowSelection(IteratorRow): # <<<<<<<<<<<<<<
483 * """*(Samfile samfile)*
487 struct __pyx_obj_9csamtools_IteratorRowSelection {
488 struct __pyx_obj_9csamtools_IteratorRow __pyx_base;
489 struct __pyx_vtabstruct_9csamtools_IteratorRowSelection *__pyx_vtab;
497 /* "csamtools.pyx":1601
500 * cdef class IteratorColumn: # <<<<<<<<<<<<<<
501 * '''abstract base class for iterators over columns.
505 struct __pyx_obj_9csamtools_IteratorColumn {
507 struct __pyx_vtabstruct_9csamtools_IteratorColumn *__pyx_vtab;
508 struct __pyx_obj_9csamtools_IteratorRowRegion *iter;
513 const bam_pileup1_t * plp;
514 bam_plp_t pileup_iter;
515 __pyx_t_9csamtools___iterdata iterdata;
516 struct __pyx_obj_9csamtools_Samfile *samfile;
517 struct __pyx_obj_9csamtools_Fastafile *fastafile;
522 /* "csamtools.pyx":1806
525 * cdef class IteratorColumnAllRefs(IteratorColumn): # <<<<<<<<<<<<<<
526 * """iterates over all columns by chaining iterators over each reference
530 struct __pyx_obj_9csamtools_IteratorColumnAllRefs {
531 struct __pyx_obj_9csamtools_IteratorColumn __pyx_base;
534 /* "csamtools.pxd":394
535 * cdef bam1_t * _delegate
537 * cdef class Samfile: # <<<<<<<<<<<<<<
538 * cdef char * _filename
539 * # pointer to samfile
542 struct __pyx_obj_9csamtools_Samfile {
544 struct __pyx_vtabstruct_9csamtools_Samfile *__pyx_vtab;
553 int64_t start_offset;
556 /* "csamtools.pyx":2902
557 * return retval, out_stderr, out_stdout
559 * cdef class SNPCall: # <<<<<<<<<<<<<<
560 * '''the results of a SNP call.'''
564 struct __pyx_obj_9csamtools_SNPCall {
568 char _reference_base;
570 int _consensus_quality;
572 int _rms_mapping_quality;
576 /* "csamtools.pyx":3456
579 * cdef class IndexedReads: # <<<<<<<<<<<<<<
580 * """index a bamfile by read.
584 struct __pyx_obj_9csamtools_IndexedReads {
586 struct __pyx_obj_9csamtools_Samfile *samfile;
592 /* "csamtools.pyx":1777
593 * self.iterdata.seq = NULL
595 * cdef class IteratorColumnRegion(IteratorColumn): # <<<<<<<<<<<<<<
596 * '''iterates over a region only.
600 struct __pyx_obj_9csamtools_IteratorColumnRegion {
601 struct __pyx_obj_9csamtools_IteratorColumn __pyx_base;
604 /* "csamtools.pxd":389
606 * # need to declare all C fields and methods here
607 * cdef class AlignedRead: # <<<<<<<<<<<<<<
609 * # object that this AlignedRead represents
612 struct __pyx_obj_9csamtools_AlignedRead {
618 /* "csamtools.pyx":1601
621 * cdef class IteratorColumn: # <<<<<<<<<<<<<<
622 * '''abstract base class for iterators over columns.
626 struct __pyx_vtabstruct_9csamtools_IteratorColumn {
627 int (*cnext)(struct __pyx_obj_9csamtools_IteratorColumn *);
628 char *(*getSequence)(struct __pyx_obj_9csamtools_IteratorColumn *);
629 PyObject *(*setMask)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *);
630 PyObject *(*setupIteratorData)(struct __pyx_obj_9csamtools_IteratorColumn *, int, int, int, struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData *__pyx_optional_args);
631 PyObject *(*reset)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *, PyObject *, PyObject *);
633 static struct __pyx_vtabstruct_9csamtools_IteratorColumn *__pyx_vtabptr_9csamtools_IteratorColumn;
636 /* "csamtools.pyx":1777
637 * self.iterdata.seq = NULL
639 * cdef class IteratorColumnRegion(IteratorColumn): # <<<<<<<<<<<<<<
640 * '''iterates over a region only.
644 struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion {
645 struct __pyx_vtabstruct_9csamtools_IteratorColumn __pyx_base;
647 static struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion *__pyx_vtabptr_9csamtools_IteratorColumnRegion;
650 /* "csamtools.pyx":1265
653 * cdef class IteratorRowRegion(IteratorRow): # <<<<<<<<<<<<<<
654 * """*(Samfile samfile, int tid, int beg, int end, int reopen = True )*
658 struct __pyx_vtabstruct_9csamtools_IteratorRowRegion {
659 bam1_t *(*getCurrent)(struct __pyx_obj_9csamtools_IteratorRowRegion *);
660 int (*cnext)(struct __pyx_obj_9csamtools_IteratorRowRegion *);
662 static struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *__pyx_vtabptr_9csamtools_IteratorRowRegion;
665 /* "csamtools.pyx":1461
666 * raise StopIteration
668 * cdef class IteratorRowSelection(IteratorRow): # <<<<<<<<<<<<<<
669 * """*(Samfile samfile)*
673 struct __pyx_vtabstruct_9csamtools_IteratorRowSelection {
674 bam1_t *(*getCurrent)(struct __pyx_obj_9csamtools_IteratorRowSelection *);
675 int (*cnext)(struct __pyx_obj_9csamtools_IteratorRowSelection *);
677 static struct __pyx_vtabstruct_9csamtools_IteratorRowSelection *__pyx_vtabptr_9csamtools_IteratorRowSelection;
680 /* "csamtools.pyx":1806
683 * cdef class IteratorColumnAllRefs(IteratorColumn): # <<<<<<<<<<<<<<
684 * """iterates over all columns by chaining iterators over each reference
688 struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs {
689 struct __pyx_vtabstruct_9csamtools_IteratorColumn __pyx_base;
691 static struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *__pyx_vtabptr_9csamtools_IteratorColumnAllRefs;
694 /* "csamtools.pyx":415
697 * cdef class Samfile: # <<<<<<<<<<<<<<
698 * '''*(filename, mode=None, template = None, referencenames = None, referencelengths = None, text = NULL, header = None,
699 * add_sq_text = False )*
702 struct __pyx_vtabstruct_9csamtools_Samfile {
703 bam_header_t *(*_buildHeader)(struct __pyx_obj_9csamtools_Samfile *, PyObject *);
704 bam1_t *(*getCurrent)(struct __pyx_obj_9csamtools_Samfile *);
705 int (*cnext)(struct __pyx_obj_9csamtools_Samfile *);
706 int (*write)(struct __pyx_obj_9csamtools_Samfile *, struct __pyx_obj_9csamtools_AlignedRead *, int __pyx_skip_dispatch);
707 char *(*_getrname)(struct __pyx_obj_9csamtools_Samfile *, int);
709 static struct __pyx_vtabstruct_9csamtools_Samfile *__pyx_vtabptr_9csamtools_Samfile;
712 /* "csamtools.pyx":244
714 * ######################################################################
715 * cdef class Fastafile: # <<<<<<<<<<<<<<
720 struct __pyx_vtabstruct_9csamtools_Fastafile {
721 char *(*_fetch)(struct __pyx_obj_9csamtools_Fastafile *, char *, int, int, int *);
723 static struct __pyx_vtabstruct_9csamtools_Fastafile *__pyx_vtabptr_9csamtools_Fastafile;
726 /* "csamtools.pyx":1351
727 * if self.owns_samfile: samclose( self.fp )
729 * cdef class IteratorRowAll(IteratorRow): # <<<<<<<<<<<<<<
730 * """*(Samfile samfile, int reopen = True)*
734 struct __pyx_vtabstruct_9csamtools_IteratorRowAll {
735 bam1_t *(*getCurrent)(struct __pyx_obj_9csamtools_IteratorRowAll *);
736 int (*cnext)(struct __pyx_obj_9csamtools_IteratorRowAll *);
738 static struct __pyx_vtabstruct_9csamtools_IteratorRowAll *__pyx_vtabptr_9csamtools_IteratorRowAll;
740 #ifndef CYTHON_REFNANNY
741 #define CYTHON_REFNANNY 0
746 void (*INCREF)(void*, PyObject*, int);
747 void (*DECREF)(void*, PyObject*, int);
748 void (*GOTREF)(void*, PyObject*, int);
749 void (*GIVEREF)(void*, PyObject*, int);
750 void* (*SetupContext)(const char*, int, const char*);
751 void (*FinishContext)(void**);
752 } __Pyx_RefNannyAPIStruct;
753 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
754 static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
755 PyObject *m = NULL, *p = NULL;
757 m = PyImport_ImportModule((char *)modname);
759 p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
761 r = PyLong_AsVoidPtr(p);
765 return (__Pyx_RefNannyAPIStruct *)r;
767 #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
768 #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
769 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
770 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
771 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
772 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
773 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
775 #define __Pyx_RefNannySetupContext(name)
776 #define __Pyx_RefNannyFinishContext()
777 #define __Pyx_INCREF(r) Py_INCREF(r)
778 #define __Pyx_DECREF(r) Py_DECREF(r)
779 #define __Pyx_GOTREF(r)
780 #define __Pyx_GIVEREF(r)
781 #define __Pyx_XDECREF(r) Py_XDECREF(r)
782 #endif /* CYTHON_REFNANNY */
783 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
784 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)
786 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
788 #ifndef CYTHON_PROFILE
789 #define CYTHON_PROFILE 1
792 #ifndef CYTHON_PROFILE_REUSE_FRAME
793 #define CYTHON_PROFILE_REUSE_FRAME 0
799 #include "frameobject.h"
800 #include "traceback.h"
802 #if CYTHON_PROFILE_REUSE_FRAME
803 #define CYTHON_FRAME_MODIFIER static
804 #define CYTHON_FRAME_DEL
806 #define CYTHON_FRAME_MODIFIER
807 #define CYTHON_FRAME_DEL Py_DECREF(__pyx_frame)
810 #define __Pyx_TraceDeclarations \
811 static PyCodeObject *__pyx_frame_code = NULL; \
812 CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL; \
813 int __Pyx_use_tracing = 0;
815 #define __Pyx_TraceCall(funcname, srcfile, firstlineno) \
816 if (unlikely(PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc)) { \
817 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, funcname, srcfile, firstlineno); \
820 #define __Pyx_TraceException() \
821 if (unlikely(__Pyx_use_tracing( && PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc) { \
822 PyObject *exc_info = __Pyx_GetExceptionTuple(); \
824 PyThreadState_GET()->c_profilefunc( \
825 PyThreadState_GET()->c_profileobj, __pyx_frame, PyTrace_EXCEPTION, exc_info); \
826 Py_DECREF(exc_info); \
830 #define __Pyx_TraceReturn(result) \
831 if (unlikely(__Pyx_use_tracing) && PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc) { \
832 PyThreadState_GET()->c_profilefunc( \
833 PyThreadState_GET()->c_profileobj, __pyx_frame, PyTrace_RETURN, (PyObject*)result); \
837 static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno); /*proto*/
838 static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, const char *funcname, const char *srcfile, int firstlineno); /*proto*/
842 #define __Pyx_TraceDeclarations
843 #define __Pyx_TraceCall(funcname, srcfile, firstlineno)
844 #define __Pyx_TraceException()
845 #define __Pyx_TraceReturn(result)
847 #endif /* CYTHON_PROFILE */
849 static CYTHON_INLINE PyObject* __Pyx_tp_new(PyObject* type_obj) {
850 return (PyObject*) (((PyTypeObject*)(type_obj))->tp_new(
851 (PyTypeObject*)(type_obj), __pyx_empty_tuple, NULL));
854 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
856 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
858 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
860 static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
861 static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/
863 static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict,
864 const char* function_name, int kw_allowed); /*proto*/
866 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
867 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
869 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
871 static void __Pyx_RaiseDoubleKeywordsError(
872 const char* func_name, PyObject* kw_name); /*proto*/
874 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/
876 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
877 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
879 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
880 const char *name, int exact); /*proto*/
882 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
885 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
888 r = PyObject_GetItem(o, j);
894 #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
895 __Pyx_GetItemInt_List_Fast(o, i) : \
896 __Pyx_GetItemInt_Generic(o, to_py_func(i)))
898 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
899 if (likely(o != Py_None)) {
900 if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
901 PyObject *r = PyList_GET_ITEM(o, i);
905 else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
906 PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
911 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
914 #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
915 __Pyx_GetItemInt_Tuple_Fast(o, i) : \
916 __Pyx_GetItemInt_Generic(o, to_py_func(i)))
918 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
919 if (likely(o != Py_None)) {
920 if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
921 PyObject *r = PyTuple_GET_ITEM(o, i);
925 else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
926 PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
931 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
935 #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
936 __Pyx_GetItemInt_Fast(o, i) : \
937 __Pyx_GetItemInt_Generic(o, to_py_func(i)))
939 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
941 if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
942 r = PyList_GET_ITEM(o, i);
945 else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
946 r = PyTuple_GET_ITEM(o, i);
949 else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
950 r = PySequence_GetItem(o, i);
953 r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
958 static CYTHON_INLINE long __Pyx_NegateNonNeg(long b) { return unlikely(b < 0) ? b : !b; }
959 static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
960 return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
963 static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
964 if (likely(PyList_CheckExact(L))) {
965 if (PyList_Append(L, x) < 0) return NULL;
967 return Py_None; /* this is just to have an accurate signature */
971 m = __Pyx_GetAttrString(L, "append");
973 r = PyObject_CallFunctionObjArgs(m, x, NULL);
979 static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);
981 #if PY_MAJOR_VERSION >= 3
982 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
984 if (unlikely(d == Py_None)) {
985 __Pyx_RaiseNoneIndexingError();
988 value = PyDict_GetItemWithError(d, key);
989 if (unlikely(!value)) {
990 if (!PyErr_Occurred())
991 PyErr_SetObject(PyExc_KeyError, key);
998 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1001 static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
1003 #if PY_MAJOR_VERSION >= 3
1004 value = PyDict_GetItemWithError(d, key);
1005 if (unlikely(!value)) {
1006 if (unlikely(PyErr_Occurred()))
1008 value = default_value;
1012 if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
1013 /* these presumably have safe hash functions */
1014 value = PyDict_GetItem(d, key);
1015 if (unlikely(!value)) {
1016 value = default_value;
1021 m = __Pyx_GetAttrString(d, "get");
1022 if (!m) return NULL;
1023 value = PyObject_CallFunctionObjArgs(m, key,
1024 (default_value == Py_None) ? NULL : default_value, NULL);
1031 static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
1033 static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */
1035 #define __Pyx_DelItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
1036 __Pyx_DelItemInt_Fast(o, i) : \
1037 __Pyx_DelItem_Generic(o, to_py_func(i)))
1039 static CYTHON_INLINE int __Pyx_DelItem_Generic(PyObject *o, PyObject *j) {
1042 r = PyObject_DelItem(o, j);
1047 static CYTHON_INLINE int __Pyx_DelItemInt_Fast(PyObject *o, Py_ssize_t i) {
1048 if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && likely(i >= 0))
1049 return PySequence_DelItem(o, i);
1051 PyObject *j = PyInt_FromSsize_t(i);
1052 return __Pyx_DelItem_Generic(o, j);
1056 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
1057 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
1059 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
1061 static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
1063 static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
1064 PyObject *modname); /*proto*/
1066 #define __pyx_binding_PyCFunctionType_USED 1
1069 PyCFunctionObject func;
1070 } __pyx_binding_PyCFunctionType_object;
1072 static PyTypeObject __pyx_binding_PyCFunctionType_type;
1073 static PyTypeObject *__pyx_binding_PyCFunctionType = NULL;
1075 static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module); /* proto */
1076 #define __pyx_binding_PyCFunctionType_New(ml, self) __pyx_binding_PyCFunctionType_NewEx(ml, self, NULL)
1078 static int __pyx_binding_PyCFunctionType_init(void); /* proto */
1080 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t);
1082 static CYTHON_INLINE uint32_t __Pyx_PyInt_from_py_uint32_t(PyObject *);
1084 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int32_t(int32_t);
1086 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int64_t(int64_t);
1088 static CYTHON_INLINE uint64_t __Pyx_PyInt_from_py_uint64_t(PyObject *);
1090 static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject *);
1092 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint8_t(uint8_t);
1094 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint64_t(uint64_t);
1096 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
1098 static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
1100 static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
1102 static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
1104 static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
1106 static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
1108 static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
1110 static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
1112 static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
1114 static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
1116 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
1118 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
1120 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
1122 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
1124 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
1126 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
1128 static void __Pyx_WriteUnraisable(const char *name); /*proto*/
1130 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/
1132 static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
1134 static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
1136 static void __Pyx_AddTraceback(const char *funcname); /*proto*/
1138 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
1139 /* Module declarations from __builtin__ */
1141 /* Module declarations from cpython.version */
1143 /* Module declarations from cpython.ref */
1145 /* Module declarations from cpython.exc */
1147 /* Module declarations from cpython.module */
1149 /* Module declarations from cpython.mem */
1151 /* Module declarations from cpython.tuple */
1153 /* Module declarations from cpython.list */
1155 /* Module declarations from libc.stdio */
1157 /* Module declarations from cpython.object */
1159 /* Module declarations from cpython.sequence */
1161 /* Module declarations from cpython.mapping */
1163 /* Module declarations from cpython.iterator */
1165 /* Module declarations from cpython.type */
1167 /* Module declarations from cpython.number */
1169 /* Module declarations from cpython.int */
1171 /* Module declarations from __builtin__ */
1173 /* Module declarations from cpython.bool */
1175 static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
1176 /* Module declarations from cpython.long */
1178 /* Module declarations from cpython.float */
1180 /* Module declarations from __builtin__ */
1182 /* Module declarations from cpython.complex */
1184 static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
1185 /* Module declarations from cpython.string */
1187 /* Module declarations from cpython.unicode */
1189 /* Module declarations from cpython.dict */
1191 /* Module declarations from cpython.instance */
1193 /* Module declarations from cpython.function */
1195 /* Module declarations from cpython.method */
1197 /* Module declarations from cpython.weakref */
1199 /* Module declarations from cpython.getargs */
1201 /* Module declarations from cpython.pythread */
1203 /* Module declarations from cpython.cobject */
1205 /* Module declarations from cpython.oldbuffer */
1207 /* Module declarations from cpython.set */
1209 /* Module declarations from cpython.buffer */
1211 /* Module declarations from cpython.bytes */
1213 /* Module declarations from cpython.pycapsule */
1215 /* Module declarations from cpython */
1217 /* Module declarations from csamtools */
1219 static PyTypeObject *__pyx_ptype_9csamtools_file = 0;
1220 static PyTypeObject *__pyx_ptype_9csamtools_AlignedRead = 0;
1221 static PyTypeObject *__pyx_ptype_9csamtools_Samfile = 0;
1222 static PyTypeObject *__pyx_ptype_9csamtools_IteratorRow = 0;
1223 static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowAll = 0;
1224 static PyTypeObject *__pyx_ptype_9csamtools_PileupProxy = 0;
1225 static PyTypeObject *__pyx_ptype_9csamtools_PileupRead = 0;
1226 static PyTypeObject *__pyx_ptype_9csamtools_Fastafile = 0;
1227 static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowRegion = 0;
1228 static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowAllRefs = 0;
1229 static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowSelection = 0;
1230 static PyTypeObject *__pyx_ptype_9csamtools_IteratorColumn = 0;
1231 static PyTypeObject *__pyx_ptype_9csamtools_IteratorColumnRegion = 0;
1232 static PyTypeObject *__pyx_ptype_9csamtools_IteratorColumnAllRefs = 0;
1233 static PyTypeObject *__pyx_ptype_9csamtools_SNPCall = 0;
1234 static PyTypeObject *__pyx_ptype_9csamtools_IndexedReads = 0;
1235 static char *__pyx_v_9csamtools_bam_nt16_rev_table;
1236 static int __pyx_v_9csamtools_max_pos;
1237 static PyObject *__pyx_f_9csamtools_makeAlignedRead(bam1_t *); /*proto*/
1238 static PyObject *__pyx_f_9csamtools_makePileupProxy(bam_pileup1_t *, int, int, int); /*proto*/
1239 static PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *); /*proto*/
1240 static int __pyx_f_9csamtools_fetch_callback(bam1_t *, void *); /*proto*/
1241 static int __pyx_f_9csamtools_pileup_callback(uint32_t, uint32_t, int, bam_pileup1_t *, void *); /*proto*/
1242 static int __pyx_f_9csamtools_pileup_fetch_callback(bam1_t *, void *); /*proto*/
1243 static int __pyx_f_9csamtools_count_callback(bam1_t *, void *); /*proto*/
1244 static int __pyx_f_9csamtools_mate_callback(bam1_t *, void *); /*proto*/
1245 static int __pyx_f_9csamtools___advance_all(void *, bam1_t *); /*proto*/
1246 static int __pyx_f_9csamtools___advance_snpcalls(void *, bam1_t *); /*proto*/
1247 static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *); /*proto*/
1248 static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *); /*proto*/
1249 static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_seq_range(bam1_t *, uint32_t, uint32_t); /*proto*/
1250 static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_qual_range(bam1_t *, uint32_t, uint32_t); /*proto*/
1251 #define __Pyx_MODULE_NAME "csamtools"
1252 static int __pyx_module_is_main_csamtools = 0;
1254 /* Implementation of csamtools */
1255 static PyObject *__pyx_builtin_open;
1256 static PyObject *__pyx_builtin_object;
1257 static PyObject *__pyx_builtin_map;
1258 static PyObject *__pyx_builtin_ValueError;
1259 static PyObject *__pyx_builtin_IOError;
1260 static PyObject *__pyx_builtin_OverflowError;
1261 static PyObject *__pyx_builtin_NotImplementedError;
1262 static PyObject *__pyx_builtin_OSError;
1263 static PyObject *__pyx_builtin_AttributeError;
1264 static PyObject *__pyx_builtin_KeyError;
1265 static PyObject *__pyx_builtin_StopIteration;
1266 static PyObject *__pyx_builtin_cmp;
1267 static PyObject *__pyx_builtin_chr;
1268 static PyObject *__pyx_builtin_TypeError;
1269 static char __pyx_k_1[] = "\t";
1270 static char __pyx_k_2[] = "\n";
1271 static char __pyx_k_3[] = "calling len() on closed file";
1272 static char __pyx_k_5[] = "could not open file `%s`";
1273 static char __pyx_k_6[] = "I/O operation on closed file";
1274 static char __pyx_k_9[] = "no sequence/region supplied.";
1275 static char __pyx_k_11[] = "invalid region: start (%i) > end (%i)";
1276 static char __pyx_k_12[] = "";
1277 static char __pyx_k_13[] = "start out of range (%i)";
1278 static char __pyx_k_14[] = "end out of range (%i)";
1279 static char __pyx_k_15[] = "%s:%i-%i";
1280 static char __pyx_k_17[] = "invalid file opening mode `%s`";
1281 static char __pyx_k_18[] = "-";
1282 static char __pyx_k_19[] = "http:";
1283 static char __pyx_k_20[] = "ftp:";
1284 static char __pyx_k_21[] = "either supply options `template`, `header` or both `referencenames` and `referencelengths` for writing";
1285 static char __pyx_k_22[] = "unequal names and lengths of reference sequences";
1286 static char __pyx_k_23[] = "@SQ\tSN:%s\tLN:%s\n";
1287 static char __pyx_k_24[] = "file `%s` not found";
1288 static char __pyx_k_25[] = "could not open file (mode='%s') - is it SAM/BAM format?";
1289 static char __pyx_k_26[] = "file does not have valid header (mode='%s') - is it SAM/BAM format?";
1290 static char __pyx_k_27[] = ".bai";
1291 static char __pyx_k_28[] = "error while opening index `%s` ";
1292 static char __pyx_k_31[] = "tid %i out of range 0<=tid<%i";
1293 static char __pyx_k_33[] = "[:-]";
1294 static char __pyx_k_35[] = "invalid reference `%s`";
1295 static char __pyx_k_36[] = "invalid coordinates: start (%i) > end (%i)";
1296 static char __pyx_k_38[] = "seek only available in bam files";
1297 static char __pyx_k_40[] = "seek no available in streams";
1298 static char __pyx_k_46[] = "fetch called on bamfile without index";
1299 static char __pyx_k_48[] = "callback functionality requires a region/reference";
1300 static char __pyx_k_50[] = "no index available for fetch";
1301 static char __pyx_k_52[] = "fetching by region is not available for sam files";
1302 static char __pyx_k_54[] = "fetch called for samfile without header";
1303 static char __pyx_k_56[] = "callback not implemented yet";
1304 static char __pyx_k_58[] = "read %s: is unpaired";
1305 static char __pyx_k_59[] = "mate %s: is unmapped";
1306 static char __pyx_k_60[] = "mate not found";
1307 static char __pyx_k_65[] = "counting functionality requires a region/reference";
1308 static char __pyx_k_68[] = "count for a region is not available for sam files";
1309 static char __pyx_k_71[] = "no index available for pileup";
1310 static char __pyx_k_74[] = "pileup of samfiles not implemented yet";
1311 static char __pyx_k_81[] = "Samfile.mapped only available in bam files";
1312 static char __pyx_k_84[] = "Samfile.unmapped only available in bam files";
1313 static char __pyx_k_89[] = "@";
1314 static char __pyx_k_91[] = "header line without '@': '%s'";
1315 static char __pyx_k_93[] = "header line with invalid type '%s': '%s'";
1316 static char __pyx_k_94[] = ":";
1317 static char __pyx_k_96[] = "unknown field code '%s' in record '%s'";
1318 static char __pyx_k_97[] = "multiple '%s' lines are not permitted";
1319 static char __pyx_k_98[] = "@%s";
1320 static char __pyx_k_99[] = "%s:%s";
1321 static char __pyx_k__A[] = "A";
1322 static char __pyx_k__C[] = "C";
1323 static char __pyx_k__D[] = "D";
1324 static char __pyx_k__F[] = "F";
1325 static char __pyx_k__I[] = "I";
1326 static char __pyx_k__S[] = "S";
1327 static char __pyx_k__Z[] = "Z";
1328 static char __pyx_k__b[] = "b";
1329 static char __pyx_k__c[] = "c";
1330 static char __pyx_k__d[] = "d";
1331 static char __pyx_k__f[] = "f";
1332 static char __pyx_k__i[] = "i";
1333 static char __pyx_k__n[] = "n";
1334 static char __pyx_k__r[] = "r";
1335 static char __pyx_k__s[] = "s";
1336 static char __pyx_k__w[] = "w";
1337 static char __pyx_k__x[] = "x";
1338 static char __pyx_k_100[] = "invalid type for record %s: %s, expected %s";
1339 static char __pyx_k_101[] = "incomplete sequence information in '%s'";
1340 static char __pyx_k_103[] = "can not iterate over samfile without header";
1341 static char __pyx_k_106[] = "no index available for iteration";
1342 static char __pyx_k_112[] = "can only use this iterator on bam files";
1343 static char __pyx_k_113[] = "reference sequence for '%s' (tid=%i) not found";
1344 static char __pyx_k_114[] = "unknown stepper option `%s` in IteratorColumn";
1345 static char __pyx_k_116[] = "error during iteration";
1346 static char __pyx_k_119[] = "Invalid clipping in CIGAR string";
1347 static char __pyx_k_120[] = "quality and sequence mismatch: %i != %i";
1348 static char __pyx_k_121[] = "%c";
1349 static char __pyx_k_122[] = "create_string_buffer";
1350 static char __pyx_k_123[] = "<cccf";
1351 static char __pyx_k_124[] = "<cccb";
1352 static char __pyx_k_125[] = "<ccch";
1353 static char __pyx_k_126[] = "integer %i out of range of BAM/SAM specification";
1354 static char __pyx_k_127[] = "<ccci";
1355 static char __pyx_k_128[] = "<cccB";
1356 static char __pyx_k_129[] = "<cccH";
1357 static char __pyx_k_130[] = "<cccI";
1358 static char __pyx_k_131[] = "<cccc";
1359 static char __pyx_k_132[] = "<ccc%is";
1360 static char __pyx_k_133[] = "tags field too large";
1361 static char __pyx_k_135[] = "tag '%s' not present";
1362 static char __pyx_k_136[] = "Contig index";
1363 static char __pyx_k_137[] = "Mapped position on contig";
1364 static char __pyx_k_138[] = "Contig index for mate pair";
1365 static char __pyx_k_139[] = "Position of mate pair";
1366 static char __pyx_k_140[] = "Insert size";
1367 static char __pyx_k_141[] = "Binary flag";
1368 static char __pyx_k_142[] = "Count of cigar entries";
1369 static char __pyx_k_143[] = "Cigar entries";
1370 static char __pyx_k_144[] = "Mapping quality";
1371 static char __pyx_k_145[] = "Bam index bin number";
1372 static char __pyx_k_146[] = "Length of query name";
1373 static char __pyx_k_147[] = "Query name";
1374 static char __pyx_k_148[] = "Length of query sequence";
1375 static char __pyx_k_149[] = "Query sequence";
1376 static char __pyx_k_150[] = "Quality scores";
1377 static char __pyx_k_151[] = "Length of auxilary data";
1378 static char __pyx_k_152[] = "Maximum data length";
1379 static char __pyx_k_153[] = "Current data length";
1380 static char __pyx_k_154[] = "%-30s %-10s= %s";
1381 static char __pyx_k_155[] = "(";
1382 static char __pyx_k_156[] = ")";
1383 static char __pyx_k_157[] = "This class cannot be instantiated from Python";
1384 static char __pyx_k_162[] = "No such file or directory: '%s'";
1385 static char __pyx_k_163[] = "-o";
1386 static char __pyx_k_164[] = "option -o is forbidden in samtools view";
1387 static char __pyx_k_166[] = "_rms_mapping_quality";
1388 static char __pyx_k_167[] = "can only IndexReads on bam files";
1389 static char __pyx_k_168[] = "read %s not found";
1390 static char __pyx_k_169[] = "the query name (None if not present)";
1391 static char __pyx_k_170[] = "the :term:`cigar` alignment (None if not present).\n ";
1392 static char __pyx_k_171[] = "read sequence bases, including :term:`soft clipped` bases (None if not present)";
1393 static char __pyx_k_172[] = "read sequence base qualities, including :term:`soft clipped` bases (None if not present)";
1394 static char __pyx_k_173[] = "aligned portion of the read and excludes any flanking bases that were :term:`soft clipped` (None if not present)\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.";
1395 static char __pyx_k_174[] = "aligned query sequence quality values (None if not present)";
1396 static char __pyx_k_175[] = "start index of the aligned query portion of the sequence (0-based, inclusive)";
1397 static char __pyx_k_176[] = "end index of the aligned query portion of the sequence (0-based, exclusive)";
1398 static char __pyx_k_177[] = "Length of the aligned query sequence";
1399 static char __pyx_k_178[] = "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 ";
1400 static char __pyx_k_179[] = "properties flag";
1401 static char __pyx_k_180[] = "\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 ";
1402 static char __pyx_k_181[] = "\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 ";
1403 static char __pyx_k_182[] = "0-based leftmost coordinate";
1404 static char __pyx_k_183[] = "properties bin";
1405 static char __pyx_k_184[] = "length of the read (read only). Returns 0 if not given.";
1406 static char __pyx_k_185[] = "aligned end position of the read on the reference genome. Returns\n None if not available.";
1407 static char __pyx_k_186[] = "aligned length of the read on the reference genome. Returns None if\n not available.";
1408 static char __pyx_k_187[] = "mapping quality";
1409 static char __pyx_k_188[] = "the :term:`reference` id of the mate \n deprecated, use RNEXT instead.\n ";
1410 static char __pyx_k_189[] = "the :term:`reference` id of the mate ";
1411 static char __pyx_k_190[] = "the position of the mate\n deprecated, use PNEXT instead.";
1412 static char __pyx_k_191[] = "the position of the mate";
1413 static char __pyx_k_192[] = "the insert size\n deprecated: use tlen instead";
1414 static char __pyx_k_193[] = "the insert size";
1415 static char __pyx_k_194[] = "true if read is paired in sequencing";
1416 static char __pyx_k_195[] = "true if read is mapped in a proper pair";
1417 static char __pyx_k_196[] = "true if read itself is unmapped";
1418 static char __pyx_k_197[] = "true if the mate is unmapped";
1419 static char __pyx_k_198[] = "true if read is mapped to reverse strand";
1420 static char __pyx_k_199[] = "true is read is mapped to reverse strand";
1421 static char __pyx_k_200[] = "true if this is read1";
1422 static char __pyx_k_201[] = "true if this is read2";
1423 static char __pyx_k_202[] = "true if not primary alignment";
1424 static char __pyx_k_203[] = "true if QC failure";
1425 static char __pyx_k_204[] = "true if optical or PCR duplicate";
1426 static char __pyx_k_205[] = "a list of reference positions that this read aligns to.";
1427 static char __pyx_k_206[] = "number of :term:`filename` associated with this object.";
1428 static char __pyx_k_207[] = "number of :term:`reference` sequences in the file.";
1429 static char __pyx_k_208[] = "tuple with the names of :term:`reference` sequences.";
1430 static char __pyx_k_209[] = "tuple of the lengths of the :term:`reference` sequences. The lengths are in the same order as \n :attr:`pysam.Samfile.references`\n ";
1431 static char __pyx_k_210[] = "total number of mapped reads in file.\n ";
1432 static char __pyx_k_211[] = "total number of unmapped reads in file.\n ";
1433 static char __pyx_k_212[] = "full contents of the :term:`sam file` header as a string.";
1434 static char __pyx_k_213[] = "header information within the :term:`sam file`. The records and fields are returned as \n a two-level dictionary.\n ";
1435 static char __pyx_k_214[] = "the chromosome ID as is defined in the header";
1436 static char __pyx_k_215[] = "number of reads mapping to this column.";
1437 static char __pyx_k_216[] = "list of reads (:class:`pysam.PileupRead`) aligned to this column";
1438 static char __pyx_k_217[] = "a :class:`pysam.AlignedRead` object of the aligned read";
1439 static char __pyx_k_218[] = "position of the read base at the pileup site, 0-based";
1440 static char __pyx_k_219[] = "indel length; 0 for no indel, positive for ins and negative for del";
1441 static char __pyx_k_220[] = "1 iff the base on the padded read is a deletion";
1442 static char __pyx_k_221[] = "current sequence length.";
1443 static char __pyx_k_222[] = "nucleotide position of SNP.";
1444 static char __pyx_k_223[] = "reference base at pos. ``N`` if no reference sequence supplied.";
1445 static char __pyx_k_224[] = "the genotype called.";
1446 static char __pyx_k_225[] = "the genotype quality (Phred-scaled).";
1447 static char __pyx_k_226[] = "the snp quality (Phred scaled) - probability of consensus being identical to reference sequence.";
1448 static char __pyx_k_227[] = "the root mean square (rms) of the mapping quality of all reads involved in the call.";
1449 static char __pyx_k_228[] = "coverage or read depth - the number of reads involved in the call.";
1450 static char __pyx_k_229[] = "=ACMGRSVTWYHKDBN";
1451 static char __pyx_k_230[] = "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 ";
1452 static char __pyx_k_231[] = "\n stderr is captured. \n ";
1453 static char __pyx_k_232[] = "does nothing. stderr can't be redirected on windows";
1454 static char __pyx_k_238[] = "http://mail.python.org/pipermail/python-list/2000-June/038406.html";
1455 static char __pyx_k__AS[] = "AS";
1456 static char __pyx_k__CL[] = "CL";
1457 static char __pyx_k__CN[] = "CN";
1458 static char __pyx_k__CO[] = "CO";
1459 static char __pyx_k__DS[] = "DS";
1460 static char __pyx_k__DT[] = "DT";
1461 static char __pyx_k__GO[] = "GO";
1462 static char __pyx_k__HD[] = "HD";
1463 static char __pyx_k__ID[] = "ID";
1464 static char __pyx_k__LB[] = "LB";
1465 static char __pyx_k__LN[] = "LN";
1466 static char __pyx_k__M5[] = "M5";
1467 static char __pyx_k__PG[] = "PG";
1468 static char __pyx_k__PI[] = "PI";
1469 static char __pyx_k__PL[] = "PL";
1470 static char __pyx_k__PN[] = "PN";
1471 static char __pyx_k__PU[] = "PU";
1472 static char __pyx_k__RG[] = "RG";
1473 static char __pyx_k__SM[] = "SM";
1474 static char __pyx_k__SN[] = "SN";
1475 static char __pyx_k__SO[] = "SO";
1476 static char __pyx_k__SP[] = "SP";
1477 static char __pyx_k__SQ[] = "SQ";
1478 static char __pyx_k__UR[] = "UR";
1479 static char __pyx_k__VN[] = "VN";
1480 static char __pyx_k__fd[] = "fd";
1481 static char __pyx_k__fp[] = "fp";
1482 static char __pyx_k__id[] = "id";
1483 static char __pyx_k__os[] = "os";
1484 static char __pyx_k__rU[] = "rU";
1485 static char __pyx_k__rb[] = "rb";
1486 static char __pyx_k__re[] = "re";
1487 static char __pyx_k__wb[] = "wb";
1488 static char __pyx_k__wh[] = "wh";
1489 static char __pyx_k__all[] = "all";
1490 static char __pyx_k__bam[] = "bam";
1491 static char __pyx_k__beg[] = "beg";
1492 static char __pyx_k__bin[] = "bin";
1493 static char __pyx_k__chr[] = "chr";
1494 static char __pyx_k__cmp[] = "cmp";
1495 static char __pyx_k__dup[] = "dup";
1496 static char __pyx_k__end[] = "end";
1497 static char __pyx_k__map[] = "map";
1498 static char __pyx_k__plp[] = "plp";
1499 static char __pyx_k__pos[] = "pos";
1500 static char __pyx_k__raw[] = "raw";
1501 static char __pyx_k__seq[] = "seq";
1502 static char __pyx_k__sys[] = "sys";
1503 static char __pyx_k__tid[] = "tid";
1504 static char __pyx_k__wbu[] = "wbu";
1505 static char __pyx_k__Outs[] = "Outs";
1506 static char __pyx_k___pos[] = "_pos";
1507 static char __pyx_k___tid[] = "_tid";
1508 static char __pyx_k__args[] = "args";
1509 static char __pyx_k__core[] = "core";
1510 static char __pyx_k__data[] = "data";
1511 static char __pyx_k__dup2[] = "dup2";
1512 static char __pyx_k__flag[] = "flag";
1513 static char __pyx_k__hash[] = "hash";
1514 static char __pyx_k__iter[] = "iter";
1515 static char __pyx_k__join[] = "join";
1516 static char __pyx_k__mapq[] = "mapq";
1517 static char __pyx_k__mask[] = "mask";
1518 static char __pyx_k__mate[] = "mate";
1519 static char __pyx_k__mode[] = "mode";
1520 static char __pyx_k__mpos[] = "mpos";
1521 static char __pyx_k__mrnm[] = "mrnm";
1522 static char __pyx_k__mtid[] = "mtid";
1523 static char __pyx_k__n_pu[] = "n_pu";
1524 static char __pyx_k__name[] = "name";
1525 static char __pyx_k__open[] = "open";
1526 static char __pyx_k__path[] = "path";
1527 static char __pyx_k__port[] = "port";
1528 static char __pyx_k__qpos[] = "qpos";
1529 static char __pyx_k__qseq[] = "qseq";
1530 static char __pyx_k__qual[] = "qual";
1531 static char __pyx_k__rlen[] = "rlen";
1532 static char __pyx_k__seek[] = "seek";
1533 static char __pyx_k__self[] = "self";
1534 static char __pyx_k__tags[] = "tags";
1535 static char __pyx_k__text[] = "text";
1536 static char __pyx_k__view[] = "view";
1537 static char __pyx_k___open[] = "_open";
1538 static char __pyx_k___qpos[] = "_qpos";
1539 static char __pyx_k__bqual[] = "bqual";
1540 static char __pyx_k__cigar[] = "cigar";
1541 static char __pyx_k__close[] = "close";
1542 static char __pyx_k__cnext[] = "cnext";
1543 static char __pyx_k__flush[] = "flush";
1544 static char __pyx_k__indel[] = "indel";
1545 static char __pyx_k__index[] = "index";
1546 static char __pyx_k__isbam[] = "isbam";
1547 static char __pyx_k__isize[] = "isize";
1548 static char __pyx_k__l_aux[] = "l_aux";
1549 static char __pyx_k__level[] = "level";
1550 static char __pyx_k__n_plp[] = "n_plp";
1551 static char __pyx_k__qname[] = "qname";
1552 static char __pyx_k__rname[] = "rname";
1553 static char __pyx_k__setfd[] = "setfd";
1554 static char __pyx_k__split[] = "split";
1555 static char __pyx_k__start[] = "start";
1556 static char __pyx_k__strip[] = "strip";
1557 static char __pyx_k__types[] = "types";
1558 static char __pyx_k__where[] = "where";
1559 static char __pyx_k__write[] = "write";
1560 static char __pyx_k___indel[] = "_indel";
1561 static char __pyx_k___level[] = "_level";
1562 static char __pyx_k__append[] = "append";
1563 static char __pyx_k__ctypes[] = "ctypes";
1564 static char __pyx_k__exists[] = "exists";
1565 static char __pyx_k__fields[] = "fields";
1566 static char __pyx_k__fileno[] = "fileno";
1567 static char __pyx_k__gettid[] = "gettid";
1568 static char __pyx_k__header[] = "header";
1569 static char __pyx_k__is_del[] = "is_del";
1570 static char __pyx_k__l_qseq[] = "l_qseq";
1571 static char __pyx_k__l_text[] = "l_text";
1572 static char __pyx_k__m_data[] = "m_data";
1573 static char __pyx_k__method[] = "method";
1574 static char __pyx_k__object[] = "object";
1575 static char __pyx_k__offset[] = "offset";
1576 static char __pyx_k__record[] = "record";
1577 static char __pyx_k__region[] = "region";
1578 static char __pyx_k__remove[] = "remove";
1579 static char __pyx_k__reopen[] = "reopen";
1580 static char __pyx_k__retval[] = "retval";
1581 static char __pyx_k__rg2lib[] = "rg2lib";
1582 static char __pyx_k__stderr[] = "stderr";
1583 static char __pyx_k__stdout[] = "stdout";
1584 static char __pyx_k__struct[] = "struct";
1585 static char __pyx_k__system[] = "system";
1586 static char __pyx_k__IOError[] = "IOError";
1587 static char __pyx_k__IntType[] = "IntType";
1588 static char __pyx_k__OSError[] = "OSError";
1589 static char __pyx_k__O_CREAT[] = "O_CREAT";
1590 static char __pyx_k__Samfile[] = "Samfile";
1591 static char __pyx_k__Windows[] = "Windows";
1592 static char __pyx_k____all__[] = "__all__";
1593 static char __pyx_k____del__[] = "__del__";
1594 static char __pyx_k____str__[] = "__str__";
1595 static char __pyx_k___isOpen[] = "_isOpen";
1596 static char __pyx_k___is_del[] = "_is_del";
1597 static char __pyx_k__devnull[] = "devnull";
1598 static char __pyx_k__is_head[] = "is_head";
1599 static char __pyx_k__is_tail[] = "is_tail";
1600 static char __pyx_k__isupper[] = "isupper";
1601 static char __pyx_k__l_qname[] = "l_qname";
1602 static char __pyx_k__mkstemp[] = "mkstemp";
1603 static char __pyx_k__n_cigar[] = "n_cigar";
1604 static char __pyx_k__pileups[] = "pileups";
1605 static char __pyx_k__release[] = "release";
1606 static char __pyx_k__restore[] = "restore";
1607 static char __pyx_k__rowiter[] = "rowiter";
1608 static char __pyx_k__samfile[] = "samfile";
1609 static char __pyx_k__seq_len[] = "seq_len";
1610 static char __pyx_k__setfile[] = "setfile";
1611 static char __pyx_k__stepper[] = "stepper";
1612 static char __pyx_k__streams[] = "streams";
1613 static char __pyx_k__DictType[] = "DictType";
1614 static char __pyx_k__KeyError[] = "KeyError";
1615 static char __pyx_k__O_WRONLY[] = "O_WRONLY";
1616 static char __pyx_k____dict__[] = "__dict__";
1617 static char __pyx_k____init__[] = "__init__";
1618 static char __pyx_k____main__[] = "__main__";
1619 static char __pyx_k____test__[] = "__test__";
1620 static char __pyx_k___is_head[] = "_is_head";
1621 static char __pyx_k___is_tail[] = "_is_tail";
1622 static char __pyx_k___logfile[] = "_logfile";
1623 static char __pyx_k__calcsize[] = "calcsize";
1624 static char __pyx_k__callback[] = "callback";
1625 static char __pyx_k__coverage[] = "coverage";
1626 static char __pyx_k__data_len[] = "data_len";
1627 static char __pyx_k__exc_type[] = "exc_type";
1628 static char __pyx_k__filename[] = "filename";
1629 static char __pyx_k__genotype[] = "genotype";
1630 static char __pyx_k__isremote[] = "isremote";
1631 static char __pyx_k__isstream[] = "isstream";
1632 static char __pyx_k__iterdata[] = "iterdata";
1633 static char __pyx_k__nextiter[] = "nextiter";
1634 static char __pyx_k__platform[] = "platform";
1635 static char __pyx_k__samtools[] = "samtools";
1636 static char __pyx_k__stderr_f[] = "stderr_f";
1637 static char __pyx_k__stderr_h[] = "stderr_h";
1638 static char __pyx_k__tempfile[] = "tempfile";
1639 static char __pyx_k__template[] = "template";
1640 static char __pyx_k__Fastafile[] = "Fastafile";
1641 static char __pyx_k__FloatType[] = "FloatType";
1642 static char __pyx_k__TypeError[] = "TypeError";
1643 static char __pyx_k___coverage[] = "_coverage";
1644 static char __pyx_k___delegate[] = "_delegate";
1645 static char __pyx_k___filename[] = "_filename";
1646 static char __pyx_k___genotype[] = "_genotype";
1647 static char __pyx_k___hasIndex[] = "_hasIndex";
1648 static char __pyx_k__alignment[] = "alignment";
1649 static char __pyx_k__csamtools[] = "csamtools";
1650 static char __pyx_k__exc_value[] = "exc_value";
1651 static char __pyx_k__fastafile[] = "fastafile";
1652 static char __pyx_k__itertools[] = "itertools";
1653 static char __pyx_k__max_depth[] = "max_depth";
1654 static char __pyx_k__n_targets[] = "n_targets";
1655 static char __pyx_k__pack_into[] = "pack_into";
1656 static char __pyx_k__positions[] = "positions";
1657 static char __pyx_k__readlines[] = "readlines";
1658 static char __pyx_k__reference[] = "reference";
1659 static char __pyx_k__setdevice[] = "setdevice";
1660 static char __pyx_k__traceback[] = "traceback";
1661 static char __pyx_k__until_eof[] = "until_eof";
1662 static char __pyx_k__PileupRead[] = "PileupRead";
1663 static char __pyx_k__ValueError[] = "ValueError";
1664 static char __pyx_k___alignment[] = "_alignment";
1665 static char __pyx_k___buildLine[] = "_buildLine";
1666 static char __pyx_k__startswith[] = "startswith";
1667 static char __pyx_k__target_len[] = "target_len";
1668 static char __pyx_k__AlignedRead[] = "AlignedRead";
1669 static char __pyx_k__IteratorRow[] = "IteratorRow";
1670 static char __pyx_k__PileupProxy[] = "PileupProxy";
1671 static char __pyx_k__StderrStore[] = "StderrStore";
1672 static char __pyx_k__add_sq_text[] = "add_sq_text";
1673 static char __pyx_k__collections[] = "collections";
1674 static char __pyx_k__current_pos[] = "current_pos";
1675 static char __pyx_k__defaultdict[] = "defaultdict";
1676 static char __pyx_k__nreferences[] = "nreferences";
1677 static char __pyx_k__pileup_iter[] = "pileup_iter";
1678 static char __pyx_k__snp_quality[] = "snp_quality";
1679 static char __pyx_k__stderr_save[] = "stderr_save";
1680 static char __pyx_k__target_name[] = "target_name";
1681 static char __pyx_k__IndexedReads[] = "IndexedReads";
1682 static char __pyx_k__PileupColumn[] = "PileupColumn";
1683 static char __pyx_k___buildHeader[] = "_buildHeader";
1684 static char __pyx_k___parseRegion[] = "_parseRegion";
1685 static char __pyx_k___snp_quality[] = "_snp_quality";
1686 static char __pyx_k__catch_stderr[] = "catch_stderr";
1687 static char __pyx_k__catch_stdout[] = "catch_stdout";
1688 static char __pyx_k__owns_samfile[] = "owns_samfile";
1689 static char __pyx_k__start_offset[] = "start_offset";
1690 static char __pyx_k__OverflowError[] = "OverflowError";
1691 static char __pyx_k__StopIteration[] = "StopIteration";
1692 static char __pyx_k__VALID_HEADERS[] = "VALID_HEADERS";
1693 static char __pyx_k__AttributeError[] = "AttributeError";
1694 static char __pyx_k__IteratorColumn[] = "IteratorColumn";
1695 static char __pyx_k__readAndRelease[] = "readAndRelease";
1696 static char __pyx_k__reference_base[] = "reference_base";
1697 static char __pyx_k__referencenames[] = "referencenames";
1698 static char __pyx_k___reference_base[] = "_reference_base";
1699 static char __pyx_k__mapping_quality[] = "mapping_quality";
1700 static char __pyx_k____getattribute__[] = "__getattribute__";
1701 static char __pyx_k__referencelengths[] = "referencelengths";
1702 static char __pyx_k__consensus_quality[] = "consensus_quality";
1703 static char __pyx_k__setupIteratorData[] = "setupIteratorData";
1704 static char __pyx_k__StderrStoreWindows[] = "StderrStoreWindows";
1705 static char __pyx_k__VALID_HEADER_ORDER[] = "VALID_HEADER_ORDER";
1706 static char __pyx_k__VALID_HEADER_TYPES[] = "VALID_HEADER_TYPES";
1707 static char __pyx_k___consensus_quality[] = "_consensus_quality";
1708 static char __pyx_k___samtools_dispatch[] = "_samtools_dispatch";
1709 static char __pyx_k__NotImplementedError[] = "NotImplementedError";
1710 static char __pyx_k__VALID_HEADER_FIELDS[] = "VALID_HEADER_FIELDS";
1711 static PyObject *__pyx_kp_s_1;
1712 static PyObject *__pyx_kp_s_100;
1713 static PyObject *__pyx_kp_s_101;
1714 static PyObject *__pyx_kp_s_103;
1715 static PyObject *__pyx_kp_s_106;
1716 static PyObject *__pyx_kp_s_11;
1717 static PyObject *__pyx_kp_s_112;
1718 static PyObject *__pyx_kp_s_113;
1719 static PyObject *__pyx_kp_s_114;
1720 static PyObject *__pyx_kp_s_116;
1721 static PyObject *__pyx_kp_s_12;
1722 static PyObject *__pyx_kp_s_120;
1723 static PyObject *__pyx_kp_s_121;
1724 static PyObject *__pyx_n_s_122;
1725 static PyObject *__pyx_kp_s_123;
1726 static PyObject *__pyx_kp_s_124;
1727 static PyObject *__pyx_kp_s_125;
1728 static PyObject *__pyx_kp_s_126;
1729 static PyObject *__pyx_kp_s_127;
1730 static PyObject *__pyx_kp_s_128;
1731 static PyObject *__pyx_kp_s_129;
1732 static PyObject *__pyx_kp_s_13;
1733 static PyObject *__pyx_kp_s_130;
1734 static PyObject *__pyx_kp_s_131;
1735 static PyObject *__pyx_kp_s_132;
1736 static PyObject *__pyx_kp_s_133;
1737 static PyObject *__pyx_kp_s_135;
1738 static PyObject *__pyx_kp_s_136;
1739 static PyObject *__pyx_kp_s_137;
1740 static PyObject *__pyx_kp_s_138;
1741 static PyObject *__pyx_kp_s_139;
1742 static PyObject *__pyx_kp_s_14;
1743 static PyObject *__pyx_kp_s_140;
1744 static PyObject *__pyx_kp_s_141;
1745 static PyObject *__pyx_kp_s_142;
1746 static PyObject *__pyx_kp_s_143;
1747 static PyObject *__pyx_kp_s_144;
1748 static PyObject *__pyx_kp_s_145;
1749 static PyObject *__pyx_kp_s_146;
1750 static PyObject *__pyx_kp_s_147;
1751 static PyObject *__pyx_kp_s_148;
1752 static PyObject *__pyx_kp_s_149;
1753 static PyObject *__pyx_kp_s_15;
1754 static PyObject *__pyx_kp_s_150;
1755 static PyObject *__pyx_kp_s_151;
1756 static PyObject *__pyx_kp_s_152;
1757 static PyObject *__pyx_kp_s_153;
1758 static PyObject *__pyx_kp_s_154;
1759 static PyObject *__pyx_kp_s_155;
1760 static PyObject *__pyx_kp_s_156;
1761 static PyObject *__pyx_kp_s_157;
1762 static PyObject *__pyx_kp_s_162;
1763 static PyObject *__pyx_kp_s_163;
1764 static PyObject *__pyx_kp_s_164;
1765 static PyObject *__pyx_n_s_166;
1766 static PyObject *__pyx_kp_s_167;
1767 static PyObject *__pyx_kp_s_168;
1768 static PyObject *__pyx_kp_s_17;
1769 static PyObject *__pyx_kp_s_2;
1770 static PyObject *__pyx_kp_s_21;
1771 static PyObject *__pyx_kp_s_22;
1772 static PyObject *__pyx_kp_s_23;
1773 static PyObject *__pyx_kp_s_230;
1774 static PyObject *__pyx_kp_s_231;
1775 static PyObject *__pyx_kp_s_232;
1776 static PyObject *__pyx_kp_s_238;
1777 static PyObject *__pyx_kp_s_24;
1778 static PyObject *__pyx_kp_s_25;
1779 static PyObject *__pyx_kp_s_26;
1780 static PyObject *__pyx_kp_s_27;
1781 static PyObject *__pyx_kp_s_28;
1782 static PyObject *__pyx_kp_s_3;
1783 static PyObject *__pyx_kp_s_31;
1784 static PyObject *__pyx_kp_s_33;
1785 static PyObject *__pyx_kp_s_35;
1786 static PyObject *__pyx_kp_s_36;
1787 static PyObject *__pyx_kp_s_38;
1788 static PyObject *__pyx_kp_s_40;
1789 static PyObject *__pyx_kp_s_46;
1790 static PyObject *__pyx_kp_s_48;
1791 static PyObject *__pyx_kp_s_5;
1792 static PyObject *__pyx_kp_s_50;
1793 static PyObject *__pyx_kp_s_52;
1794 static PyObject *__pyx_kp_s_54;
1795 static PyObject *__pyx_kp_s_56;
1796 static PyObject *__pyx_kp_s_58;
1797 static PyObject *__pyx_kp_s_59;
1798 static PyObject *__pyx_kp_s_6;
1799 static PyObject *__pyx_kp_s_60;
1800 static PyObject *__pyx_kp_s_65;
1801 static PyObject *__pyx_kp_s_68;
1802 static PyObject *__pyx_kp_s_71;
1803 static PyObject *__pyx_kp_s_74;
1804 static PyObject *__pyx_kp_s_81;
1805 static PyObject *__pyx_kp_s_84;
1806 static PyObject *__pyx_kp_s_89;
1807 static PyObject *__pyx_kp_s_9;
1808 static PyObject *__pyx_kp_s_91;
1809 static PyObject *__pyx_kp_s_93;
1810 static PyObject *__pyx_kp_s_94;
1811 static PyObject *__pyx_kp_s_96;
1812 static PyObject *__pyx_kp_s_97;
1813 static PyObject *__pyx_kp_s_98;
1814 static PyObject *__pyx_kp_s_99;
1815 static PyObject *__pyx_n_s__A;
1816 static PyObject *__pyx_n_s__AS;
1817 static PyObject *__pyx_n_s__AlignedRead;
1818 static PyObject *__pyx_n_s__AttributeError;
1819 static PyObject *__pyx_n_s__C;
1820 static PyObject *__pyx_n_s__CL;
1821 static PyObject *__pyx_n_s__CN;
1822 static PyObject *__pyx_n_s__CO;
1823 static PyObject *__pyx_n_s__D;
1824 static PyObject *__pyx_n_s__DS;
1825 static PyObject *__pyx_n_s__DT;
1826 static PyObject *__pyx_n_s__DictType;
1827 static PyObject *__pyx_n_s__F;
1828 static PyObject *__pyx_n_s__Fastafile;
1829 static PyObject *__pyx_n_s__FloatType;
1830 static PyObject *__pyx_n_s__GO;
1831 static PyObject *__pyx_n_s__HD;
1832 static PyObject *__pyx_n_s__I;
1833 static PyObject *__pyx_n_s__ID;
1834 static PyObject *__pyx_n_s__IOError;
1835 static PyObject *__pyx_n_s__IndexedReads;
1836 static PyObject *__pyx_n_s__IntType;
1837 static PyObject *__pyx_n_s__IteratorColumn;
1838 static PyObject *__pyx_n_s__IteratorRow;
1839 static PyObject *__pyx_n_s__KeyError;
1840 static PyObject *__pyx_n_s__LB;
1841 static PyObject *__pyx_n_s__LN;
1842 static PyObject *__pyx_n_s__M5;
1843 static PyObject *__pyx_n_s__NotImplementedError;
1844 static PyObject *__pyx_n_s__OSError;
1845 static PyObject *__pyx_n_s__O_CREAT;
1846 static PyObject *__pyx_n_s__O_WRONLY;
1847 static PyObject *__pyx_n_s__Outs;
1848 static PyObject *__pyx_n_s__OverflowError;
1849 static PyObject *__pyx_n_s__PG;
1850 static PyObject *__pyx_n_s__PI;
1851 static PyObject *__pyx_n_s__PL;
1852 static PyObject *__pyx_n_s__PN;
1853 static PyObject *__pyx_n_s__PU;
1854 static PyObject *__pyx_n_s__PileupColumn;
1855 static PyObject *__pyx_n_s__PileupProxy;
1856 static PyObject *__pyx_n_s__PileupRead;
1857 static PyObject *__pyx_n_s__RG;
1858 static PyObject *__pyx_n_s__S;
1859 static PyObject *__pyx_n_s__SM;
1860 static PyObject *__pyx_n_s__SN;
1861 static PyObject *__pyx_n_s__SO;
1862 static PyObject *__pyx_n_s__SP;
1863 static PyObject *__pyx_n_s__SQ;
1864 static PyObject *__pyx_n_s__Samfile;
1865 static PyObject *__pyx_n_s__StderrStore;
1866 static PyObject *__pyx_n_s__StderrStoreWindows;
1867 static PyObject *__pyx_n_s__StopIteration;
1868 static PyObject *__pyx_n_s__TypeError;
1869 static PyObject *__pyx_n_s__UR;
1870 static PyObject *__pyx_n_s__VALID_HEADERS;
1871 static PyObject *__pyx_n_s__VALID_HEADER_FIELDS;
1872 static PyObject *__pyx_n_s__VALID_HEADER_ORDER;
1873 static PyObject *__pyx_n_s__VALID_HEADER_TYPES;
1874 static PyObject *__pyx_n_s__VN;
1875 static PyObject *__pyx_n_s__ValueError;
1876 static PyObject *__pyx_n_s__Windows;
1877 static PyObject *__pyx_n_s__Z;
1878 static PyObject *__pyx_n_s____all__;
1879 static PyObject *__pyx_n_s____del__;
1880 static PyObject *__pyx_n_s____dict__;
1881 static PyObject *__pyx_n_s____getattribute__;
1882 static PyObject *__pyx_n_s____init__;
1883 static PyObject *__pyx_n_s____main__;
1884 static PyObject *__pyx_n_s____str__;
1885 static PyObject *__pyx_n_s____test__;
1886 static PyObject *__pyx_n_s___alignment;
1887 static PyObject *__pyx_n_s___buildHeader;
1888 static PyObject *__pyx_n_s___buildLine;
1889 static PyObject *__pyx_n_s___consensus_quality;
1890 static PyObject *__pyx_n_s___coverage;
1891 static PyObject *__pyx_n_s___delegate;
1892 static PyObject *__pyx_n_s___filename;
1893 static PyObject *__pyx_n_s___genotype;
1894 static PyObject *__pyx_n_s___hasIndex;
1895 static PyObject *__pyx_n_s___indel;
1896 static PyObject *__pyx_n_s___isOpen;
1897 static PyObject *__pyx_n_s___is_del;
1898 static PyObject *__pyx_n_s___is_head;
1899 static PyObject *__pyx_n_s___is_tail;
1900 static PyObject *__pyx_n_s___level;
1901 static PyObject *__pyx_n_s___logfile;
1902 static PyObject *__pyx_n_s___open;
1903 static PyObject *__pyx_n_s___parseRegion;
1904 static PyObject *__pyx_n_s___pos;
1905 static PyObject *__pyx_n_s___qpos;
1906 static PyObject *__pyx_n_s___reference_base;
1907 static PyObject *__pyx_n_s___samtools_dispatch;
1908 static PyObject *__pyx_n_s___snp_quality;
1909 static PyObject *__pyx_n_s___tid;
1910 static PyObject *__pyx_n_s__add_sq_text;
1911 static PyObject *__pyx_n_s__alignment;
1912 static PyObject *__pyx_n_s__all;
1913 static PyObject *__pyx_n_s__append;
1914 static PyObject *__pyx_n_s__args;
1915 static PyObject *__pyx_n_s__b;
1916 static PyObject *__pyx_n_s__bam;
1917 static PyObject *__pyx_n_s__beg;
1918 static PyObject *__pyx_n_s__bin;
1919 static PyObject *__pyx_n_s__bqual;
1920 static PyObject *__pyx_n_s__c;
1921 static PyObject *__pyx_n_s__calcsize;
1922 static PyObject *__pyx_n_s__callback;
1923 static PyObject *__pyx_n_s__catch_stderr;
1924 static PyObject *__pyx_n_s__catch_stdout;
1925 static PyObject *__pyx_n_s__chr;
1926 static PyObject *__pyx_n_s__cigar;
1927 static PyObject *__pyx_n_s__close;
1928 static PyObject *__pyx_n_s__cmp;
1929 static PyObject *__pyx_n_s__cnext;
1930 static PyObject *__pyx_n_s__collections;
1931 static PyObject *__pyx_n_s__consensus_quality;
1932 static PyObject *__pyx_n_s__core;
1933 static PyObject *__pyx_n_s__coverage;
1934 static PyObject *__pyx_n_s__csamtools;
1935 static PyObject *__pyx_n_s__ctypes;
1936 static PyObject *__pyx_n_s__current_pos;
1937 static PyObject *__pyx_n_s__d;
1938 static PyObject *__pyx_n_s__data;
1939 static PyObject *__pyx_n_s__data_len;
1940 static PyObject *__pyx_n_s__defaultdict;
1941 static PyObject *__pyx_n_s__devnull;
1942 static PyObject *__pyx_n_s__dup;
1943 static PyObject *__pyx_n_s__dup2;
1944 static PyObject *__pyx_n_s__end;
1945 static PyObject *__pyx_n_s__exc_type;
1946 static PyObject *__pyx_n_s__exc_value;
1947 static PyObject *__pyx_n_s__exists;
1948 static PyObject *__pyx_n_s__f;
1949 static PyObject *__pyx_n_s__fastafile;
1950 static PyObject *__pyx_n_s__fd;
1951 static PyObject *__pyx_n_s__fields;
1952 static PyObject *__pyx_n_s__filename;
1953 static PyObject *__pyx_n_s__fileno;
1954 static PyObject *__pyx_n_s__flag;
1955 static PyObject *__pyx_n_s__flush;
1956 static PyObject *__pyx_n_s__fp;
1957 static PyObject *__pyx_n_s__genotype;
1958 static PyObject *__pyx_n_s__gettid;
1959 static PyObject *__pyx_n_s__hash;
1960 static PyObject *__pyx_n_s__header;
1961 static PyObject *__pyx_n_s__i;
1962 static PyObject *__pyx_n_s__id;
1963 static PyObject *__pyx_n_s__indel;
1964 static PyObject *__pyx_n_s__index;
1965 static PyObject *__pyx_n_s__is_del;
1966 static PyObject *__pyx_n_s__is_head;
1967 static PyObject *__pyx_n_s__is_tail;
1968 static PyObject *__pyx_n_s__isbam;
1969 static PyObject *__pyx_n_s__isize;
1970 static PyObject *__pyx_n_s__isremote;
1971 static PyObject *__pyx_n_s__isstream;
1972 static PyObject *__pyx_n_s__isupper;
1973 static PyObject *__pyx_n_s__iter;
1974 static PyObject *__pyx_n_s__iterdata;
1975 static PyObject *__pyx_n_s__itertools;
1976 static PyObject *__pyx_n_s__join;
1977 static PyObject *__pyx_n_s__l_aux;
1978 static PyObject *__pyx_n_s__l_qname;
1979 static PyObject *__pyx_n_s__l_qseq;
1980 static PyObject *__pyx_n_s__l_text;
1981 static PyObject *__pyx_n_s__level;
1982 static PyObject *__pyx_n_s__m_data;
1983 static PyObject *__pyx_n_s__map;
1984 static PyObject *__pyx_n_s__mapping_quality;
1985 static PyObject *__pyx_n_s__mapq;
1986 static PyObject *__pyx_n_s__mask;
1987 static PyObject *__pyx_n_s__mate;
1988 static PyObject *__pyx_n_s__max_depth;
1989 static PyObject *__pyx_n_s__method;
1990 static PyObject *__pyx_n_s__mkstemp;
1991 static PyObject *__pyx_n_s__mode;
1992 static PyObject *__pyx_n_s__mpos;
1993 static PyObject *__pyx_n_s__mrnm;
1994 static PyObject *__pyx_n_s__mtid;
1995 static PyObject *__pyx_n_s__n;
1996 static PyObject *__pyx_n_s__n_cigar;
1997 static PyObject *__pyx_n_s__n_plp;
1998 static PyObject *__pyx_n_s__n_pu;
1999 static PyObject *__pyx_n_s__n_targets;
2000 static PyObject *__pyx_n_s__name;
2001 static PyObject *__pyx_n_s__nextiter;
2002 static PyObject *__pyx_n_s__nreferences;
2003 static PyObject *__pyx_n_s__object;
2004 static PyObject *__pyx_n_s__offset;
2005 static PyObject *__pyx_n_s__open;
2006 static PyObject *__pyx_n_s__os;
2007 static PyObject *__pyx_n_s__owns_samfile;
2008 static PyObject *__pyx_n_s__pack_into;
2009 static PyObject *__pyx_n_s__path;
2010 static PyObject *__pyx_n_s__pileup_iter;
2011 static PyObject *__pyx_n_s__pileups;
2012 static PyObject *__pyx_n_s__platform;
2013 static PyObject *__pyx_n_s__plp;
2014 static PyObject *__pyx_n_s__port;
2015 static PyObject *__pyx_n_s__pos;
2016 static PyObject *__pyx_n_s__positions;
2017 static PyObject *__pyx_n_s__qname;
2018 static PyObject *__pyx_n_s__qpos;
2019 static PyObject *__pyx_n_s__qseq;
2020 static PyObject *__pyx_n_s__qual;
2021 static PyObject *__pyx_n_s__r;
2022 static PyObject *__pyx_n_s__rU;
2023 static PyObject *__pyx_n_s__raw;
2024 static PyObject *__pyx_n_s__rb;
2025 static PyObject *__pyx_n_s__re;
2026 static PyObject *__pyx_n_s__readAndRelease;
2027 static PyObject *__pyx_n_s__readlines;
2028 static PyObject *__pyx_n_s__record;
2029 static PyObject *__pyx_n_s__reference;
2030 static PyObject *__pyx_n_s__reference_base;
2031 static PyObject *__pyx_n_s__referencelengths;
2032 static PyObject *__pyx_n_s__referencenames;
2033 static PyObject *__pyx_n_s__region;
2034 static PyObject *__pyx_n_s__release;
2035 static PyObject *__pyx_n_s__remove;
2036 static PyObject *__pyx_n_s__reopen;
2037 static PyObject *__pyx_n_s__restore;
2038 static PyObject *__pyx_n_s__retval;
2039 static PyObject *__pyx_n_s__rg2lib;
2040 static PyObject *__pyx_n_s__rlen;
2041 static PyObject *__pyx_n_s__rname;
2042 static PyObject *__pyx_n_s__rowiter;
2043 static PyObject *__pyx_n_s__s;
2044 static PyObject *__pyx_n_s__samfile;
2045 static PyObject *__pyx_n_s__samtools;
2046 static PyObject *__pyx_n_s__seek;
2047 static PyObject *__pyx_n_s__self;
2048 static PyObject *__pyx_n_s__seq;
2049 static PyObject *__pyx_n_s__seq_len;
2050 static PyObject *__pyx_n_s__setdevice;
2051 static PyObject *__pyx_n_s__setfd;
2052 static PyObject *__pyx_n_s__setfile;
2053 static PyObject *__pyx_n_s__setupIteratorData;
2054 static PyObject *__pyx_n_s__snp_quality;
2055 static PyObject *__pyx_n_s__split;
2056 static PyObject *__pyx_n_s__start;
2057 static PyObject *__pyx_n_s__start_offset;
2058 static PyObject *__pyx_n_s__startswith;
2059 static PyObject *__pyx_n_s__stderr;
2060 static PyObject *__pyx_n_s__stderr_f;
2061 static PyObject *__pyx_n_s__stderr_h;
2062 static PyObject *__pyx_n_s__stderr_save;
2063 static PyObject *__pyx_n_s__stdout;
2064 static PyObject *__pyx_n_s__stepper;
2065 static PyObject *__pyx_n_s__streams;
2066 static PyObject *__pyx_n_s__strip;
2067 static PyObject *__pyx_n_s__struct;
2068 static PyObject *__pyx_n_s__sys;
2069 static PyObject *__pyx_n_s__system;
2070 static PyObject *__pyx_n_s__tags;
2071 static PyObject *__pyx_n_s__target_len;
2072 static PyObject *__pyx_n_s__target_name;
2073 static PyObject *__pyx_n_s__tempfile;
2074 static PyObject *__pyx_n_s__template;
2075 static PyObject *__pyx_n_s__text;
2076 static PyObject *__pyx_n_s__tid;
2077 static PyObject *__pyx_n_s__traceback;
2078 static PyObject *__pyx_n_s__types;
2079 static PyObject *__pyx_n_s__until_eof;
2080 static PyObject *__pyx_n_s__view;
2081 static PyObject *__pyx_n_s__w;
2082 static PyObject *__pyx_n_s__wb;
2083 static PyObject *__pyx_n_s__wbu;
2084 static PyObject *__pyx_n_s__wh;
2085 static PyObject *__pyx_n_s__where;
2086 static PyObject *__pyx_n_s__write;
2087 static PyObject *__pyx_n_s__x;
2088 static PyObject *__pyx_int_0;
2089 static PyObject *__pyx_int_1;
2090 static PyObject *__pyx_int_2;
2091 static PyObject *__pyx_int_4;
2092 static PyObject *__pyx_int_8;
2093 static PyObject *__pyx_int_16;
2094 static PyObject *__pyx_int_32;
2095 static PyObject *__pyx_int_64;
2096 static PyObject *__pyx_int_128;
2097 static PyObject *__pyx_int_255;
2098 static PyObject *__pyx_int_256;
2099 static PyObject *__pyx_int_512;
2100 static PyObject *__pyx_int_neg_127;
2101 static PyObject *__pyx_int_0660;
2102 static PyObject *__pyx_int_1024;
2103 static PyObject *__pyx_int_8000;
2104 static PyObject *__pyx_int_65535;
2105 static PyObject *__pyx_int_neg_32767;
2106 static PyObject *__pyx_int_536870912;
2107 static PyObject *__pyx_int_4294967295;
2108 static PyObject *__pyx_int_neg_2147483648;
2109 static PyObject *__pyx_k_16;
2110 static PyObject *__pyx_k_44;
2111 static PyObject *__pyx_k_62;
2112 static int __pyx_k_115;
2113 static PyObject *__pyx_k_160;
2114 static PyObject *__pyx_k_161;
2115 static PyObject *__pyx_k_tuple_4;
2116 static PyObject *__pyx_k_tuple_7;
2117 static PyObject *__pyx_k_tuple_8;
2118 static PyObject *__pyx_k_tuple_10;
2119 static PyObject *__pyx_k_tuple_29;
2120 static PyObject *__pyx_k_tuple_30;
2121 static PyObject *__pyx_k_tuple_32;
2122 static PyObject *__pyx_k_tuple_34;
2123 static PyObject *__pyx_k_tuple_37;
2124 static PyObject *__pyx_k_tuple_39;
2125 static PyObject *__pyx_k_tuple_41;
2126 static PyObject *__pyx_k_tuple_42;
2127 static PyObject *__pyx_k_tuple_43;
2128 static PyObject *__pyx_k_tuple_45;
2129 static PyObject *__pyx_k_tuple_47;
2130 static PyObject *__pyx_k_tuple_49;
2131 static PyObject *__pyx_k_tuple_51;
2132 static PyObject *__pyx_k_tuple_53;
2133 static PyObject *__pyx_k_tuple_55;
2134 static PyObject *__pyx_k_tuple_57;
2135 static PyObject *__pyx_k_tuple_61;
2136 static PyObject *__pyx_k_tuple_63;
2137 static PyObject *__pyx_k_tuple_64;
2138 static PyObject *__pyx_k_tuple_66;
2139 static PyObject *__pyx_k_tuple_67;
2140 static PyObject *__pyx_k_tuple_69;
2141 static PyObject *__pyx_k_tuple_70;
2142 static PyObject *__pyx_k_tuple_72;
2143 static PyObject *__pyx_k_tuple_73;
2144 static PyObject *__pyx_k_tuple_75;
2145 static PyObject *__pyx_k_tuple_76;
2146 static PyObject *__pyx_k_tuple_77;
2147 static PyObject *__pyx_k_tuple_78;
2148 static PyObject *__pyx_k_tuple_79;
2149 static PyObject *__pyx_k_tuple_80;
2150 static PyObject *__pyx_k_tuple_82;
2151 static PyObject *__pyx_k_tuple_83;
2152 static PyObject *__pyx_k_tuple_85;
2153 static PyObject *__pyx_k_tuple_86;
2154 static PyObject *__pyx_k_tuple_87;
2155 static PyObject *__pyx_k_tuple_88;
2156 static PyObject *__pyx_k_tuple_90;
2157 static PyObject *__pyx_k_tuple_92;
2158 static PyObject *__pyx_k_tuple_95;
2159 static PyObject *__pyx_k_tuple_102;
2160 static PyObject *__pyx_k_tuple_104;
2161 static PyObject *__pyx_k_tuple_105;
2162 static PyObject *__pyx_k_tuple_107;
2163 static PyObject *__pyx_k_tuple_108;
2164 static PyObject *__pyx_k_tuple_109;
2165 static PyObject *__pyx_k_tuple_110;
2166 static PyObject *__pyx_k_tuple_111;
2167 static PyObject *__pyx_k_tuple_117;
2168 static PyObject *__pyx_k_tuple_118;
2169 static PyObject *__pyx_k_tuple_134;
2170 static PyObject *__pyx_k_tuple_158;
2171 static PyObject *__pyx_k_tuple_159;
2172 static PyObject *__pyx_k_tuple_165;
2173 static PyObject *__pyx_k_tuple_233;
2174 static PyObject *__pyx_k_tuple_234;
2175 static PyObject *__pyx_k_tuple_235;
2176 static PyObject *__pyx_k_tuple_236;
2177 static PyObject *__pyx_k_tuple_237;
2179 /* "csamtools.pyx":76
2180 * #####################################################################
2181 * cdef class AlignedRead
2182 * cdef makeAlignedRead(bam1_t * src): # <<<<<<<<<<<<<<
2183 * '''enter src into AlignedRead.'''
2184 * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
2187 static PyObject *__pyx_f_9csamtools_makeAlignedRead(bam1_t *__pyx_v_src) {
2188 struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_dest = 0;
2189 PyObject *__pyx_r = NULL;
2190 PyObject *__pyx_t_1 = NULL;
2191 __Pyx_TraceDeclarations
2192 __Pyx_RefNannySetupContext("makeAlignedRead");
2193 __Pyx_TraceCall("makeAlignedRead", __pyx_f[0], 76);
2195 /* "csamtools.pyx":78
2196 * cdef makeAlignedRead(bam1_t * src):
2197 * '''enter src into AlignedRead.'''
2198 * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead) # <<<<<<<<<<<<<<
2199 * dest._delegate = bam_dup1(src)
2202 __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_9csamtools_AlignedRead)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2203 __Pyx_GOTREF(__pyx_t_1);
2204 if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_9csamtools_AlignedRead)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2205 __pyx_v_dest = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_t_1);
2208 /* "csamtools.pyx":79
2209 * '''enter src into AlignedRead.'''
2210 * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
2211 * dest._delegate = bam_dup1(src) # <<<<<<<<<<<<<<
2215 __pyx_v_dest->_delegate = bam_dup1(__pyx_v_src);
2217 /* "csamtools.pyx":80
2218 * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
2219 * dest._delegate = bam_dup1(src)
2220 * return dest # <<<<<<<<<<<<<<
2222 * cdef class PileupProxy
2224 __Pyx_XDECREF(__pyx_r);
2225 __Pyx_INCREF(((PyObject *)__pyx_v_dest));
2226 __pyx_r = ((PyObject *)__pyx_v_dest);
2229 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2232 __Pyx_XDECREF(__pyx_t_1);
2233 __Pyx_AddTraceback("csamtools.makeAlignedRead");
2236 __Pyx_XDECREF((PyObject *)__pyx_v_dest);
2237 __Pyx_XGIVEREF(__pyx_r);
2238 __Pyx_TraceReturn(__pyx_r);
2239 __Pyx_RefNannyFinishContext();
2243 /* "csamtools.pyx":83
2245 * cdef class PileupProxy
2246 * cdef makePileupProxy( bam_pileup1_t * plp, int tid, int pos, int n ): # <<<<<<<<<<<<<<
2247 * cdef PileupProxy dest = PileupProxy.__new__(PileupProxy)
2251 static PyObject *__pyx_f_9csamtools_makePileupProxy(bam_pileup1_t *__pyx_v_plp, int __pyx_v_tid, int __pyx_v_pos, int __pyx_v_n) {
2252 struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_dest = 0;
2253 PyObject *__pyx_r = NULL;
2254 PyObject *__pyx_t_1 = NULL;
2255 __Pyx_TraceDeclarations
2256 __Pyx_RefNannySetupContext("makePileupProxy");
2257 __Pyx_TraceCall("makePileupProxy", __pyx_f[0], 83);
2259 /* "csamtools.pyx":84
2260 * cdef class PileupProxy
2261 * cdef makePileupProxy( bam_pileup1_t * plp, int tid, int pos, int n ):
2262 * cdef PileupProxy dest = PileupProxy.__new__(PileupProxy) # <<<<<<<<<<<<<<
2266 __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_9csamtools_PileupProxy)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2267 __Pyx_GOTREF(__pyx_t_1);
2268 if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_9csamtools_PileupProxy)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2269 __pyx_v_dest = ((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_t_1);
2272 /* "csamtools.pyx":85
2273 * cdef makePileupProxy( bam_pileup1_t * plp, int tid, int pos, int n ):
2274 * cdef PileupProxy dest = PileupProxy.__new__(PileupProxy)
2275 * dest.plp = plp # <<<<<<<<<<<<<<
2279 __pyx_v_dest->plp = __pyx_v_plp;
2281 /* "csamtools.pyx":86
2282 * cdef PileupProxy dest = PileupProxy.__new__(PileupProxy)
2284 * dest.tid = tid # <<<<<<<<<<<<<<
2288 __pyx_v_dest->tid = __pyx_v_tid;
2290 /* "csamtools.pyx":87
2293 * dest.pos = pos # <<<<<<<<<<<<<<
2297 __pyx_v_dest->pos = __pyx_v_pos;
2299 /* "csamtools.pyx":88
2302 * dest.n = n # <<<<<<<<<<<<<<
2306 __pyx_t_1 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2307 __Pyx_GOTREF(__pyx_t_1);
2308 if (PyObject_SetAttr(((PyObject *)__pyx_v_dest), __pyx_n_s__n, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2309 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2311 /* "csamtools.pyx":89
2314 * return dest # <<<<<<<<<<<<<<
2316 * cdef class PileupRead
2318 __Pyx_XDECREF(__pyx_r);
2319 __Pyx_INCREF(((PyObject *)__pyx_v_dest));
2320 __pyx_r = ((PyObject *)__pyx_v_dest);
2323 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2326 __Pyx_XDECREF(__pyx_t_1);
2327 __Pyx_AddTraceback("csamtools.makePileupProxy");
2330 __Pyx_XDECREF((PyObject *)__pyx_v_dest);
2331 __Pyx_XGIVEREF(__pyx_r);
2332 __Pyx_TraceReturn(__pyx_r);
2333 __Pyx_RefNannyFinishContext();
2337 /* "csamtools.pyx":92
2339 * cdef class PileupRead
2340 * cdef makePileupRead( bam_pileup1_t * src ): # <<<<<<<<<<<<<<
2341 * '''fill a PileupRead object from a bam_pileup1_t * object.'''
2342 * cdef PileupRead dest = PileupRead.__new__(PileupRead)
2345 static PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v_src) {
2346 struct __pyx_obj_9csamtools_PileupRead *__pyx_v_dest = 0;
2347 PyObject *__pyx_r = NULL;
2348 PyObject *__pyx_t_1 = NULL;
2349 __Pyx_TraceDeclarations
2350 __Pyx_RefNannySetupContext("makePileupRead");
2351 __Pyx_TraceCall("makePileupRead", __pyx_f[0], 92);
2353 /* "csamtools.pyx":94
2354 * cdef makePileupRead( bam_pileup1_t * src ):
2355 * '''fill a PileupRead object from a bam_pileup1_t * object.'''
2356 * cdef PileupRead dest = PileupRead.__new__(PileupRead) # <<<<<<<<<<<<<<
2357 * dest._alignment = makeAlignedRead( src.b )
2358 * dest._qpos = src.qpos
2360 __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_9csamtools_PileupRead)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2361 __Pyx_GOTREF(__pyx_t_1);
2362 if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_9csamtools_PileupRead)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2363 __pyx_v_dest = ((struct __pyx_obj_9csamtools_PileupRead *)__pyx_t_1);
2366 /* "csamtools.pyx":95
2367 * '''fill a PileupRead object from a bam_pileup1_t * object.'''
2368 * cdef PileupRead dest = PileupRead.__new__(PileupRead)
2369 * dest._alignment = makeAlignedRead( src.b ) # <<<<<<<<<<<<<<
2370 * dest._qpos = src.qpos
2371 * dest._indel = src.indel
2373 __pyx_t_1 = __pyx_f_9csamtools_makeAlignedRead(__pyx_v_src->b); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2374 __Pyx_GOTREF(__pyx_t_1);
2375 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_9csamtools_AlignedRead))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2376 __Pyx_GIVEREF(__pyx_t_1);
2377 __Pyx_GOTREF(__pyx_v_dest->_alignment);
2378 __Pyx_DECREF(((PyObject *)__pyx_v_dest->_alignment));
2379 __pyx_v_dest->_alignment = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_t_1);
2382 /* "csamtools.pyx":96
2383 * cdef PileupRead dest = PileupRead.__new__(PileupRead)
2384 * dest._alignment = makeAlignedRead( src.b )
2385 * dest._qpos = src.qpos # <<<<<<<<<<<<<<
2386 * dest._indel = src.indel
2387 * dest._level = src.level
2389 __pyx_v_dest->_qpos = __pyx_v_src->qpos;
2391 /* "csamtools.pyx":97
2392 * dest._alignment = makeAlignedRead( src.b )
2393 * dest._qpos = src.qpos
2394 * dest._indel = src.indel # <<<<<<<<<<<<<<
2395 * dest._level = src.level
2396 * dest._is_del = src.is_del
2398 __pyx_v_dest->_indel = __pyx_v_src->indel;
2400 /* "csamtools.pyx":98
2401 * dest._qpos = src.qpos
2402 * dest._indel = src.indel
2403 * dest._level = src.level # <<<<<<<<<<<<<<
2404 * dest._is_del = src.is_del
2405 * dest._is_head = src.is_head
2407 __pyx_v_dest->_level = __pyx_v_src->level;
2409 /* "csamtools.pyx":99
2410 * dest._indel = src.indel
2411 * dest._level = src.level
2412 * dest._is_del = src.is_del # <<<<<<<<<<<<<<
2413 * dest._is_head = src.is_head
2414 * dest._is_tail = src.is_tail
2416 __pyx_v_dest->_is_del = __pyx_v_src->is_del;
2418 /* "csamtools.pyx":100
2419 * dest._level = src.level
2420 * dest._is_del = src.is_del
2421 * dest._is_head = src.is_head # <<<<<<<<<<<<<<
2422 * dest._is_tail = src.is_tail
2425 __pyx_v_dest->_is_head = __pyx_v_src->is_head;
2427 /* "csamtools.pyx":101
2428 * dest._is_del = src.is_del
2429 * dest._is_head = src.is_head
2430 * dest._is_tail = src.is_tail # <<<<<<<<<<<<<<
2434 __pyx_v_dest->_is_tail = __pyx_v_src->is_tail;
2436 /* "csamtools.pyx":102
2437 * dest._is_head = src.is_head
2438 * dest._is_tail = src.is_tail
2439 * return dest # <<<<<<<<<<<<<<
2441 * #####################################################################
2443 __Pyx_XDECREF(__pyx_r);
2444 __Pyx_INCREF(((PyObject *)__pyx_v_dest));
2445 __pyx_r = ((PyObject *)__pyx_v_dest);
2448 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2451 __Pyx_XDECREF(__pyx_t_1);
2452 __Pyx_AddTraceback("csamtools.makePileupRead");
2455 __Pyx_XDECREF((PyObject *)__pyx_v_dest);
2456 __Pyx_XGIVEREF(__pyx_r);
2457 __Pyx_TraceReturn(__pyx_r);
2458 __Pyx_RefNannyFinishContext();
2462 /* "csamtools.pyx":109
2463 * ## Generic callbacks for inserting python callbacks.
2464 * #####################################################################
2465 * cdef int fetch_callback( bam1_t *alignment, void *f): # <<<<<<<<<<<<<<
2466 * '''callback for bam_fetch.
2470 static int __pyx_f_9csamtools_fetch_callback(bam1_t *__pyx_v_alignment, void *__pyx_v_f) {
2471 PyObject *__pyx_v_a;
2473 PyObject *__pyx_t_1 = NULL;
2474 PyObject *__pyx_t_2 = NULL;
2475 __Pyx_TraceDeclarations
2476 __Pyx_RefNannySetupContext("fetch_callback");
2477 __Pyx_TraceCall("fetch_callback", __pyx_f[0], 109);
2478 __pyx_v_a = Py_None; __Pyx_INCREF(Py_None);
2480 /* "csamtools.pyx":114
2481 * calls function in *f* with a new :class:`AlignedRead` object as parameter.
2483 * a = makeAlignedRead( alignment ) # <<<<<<<<<<<<<<
2487 __pyx_t_1 = __pyx_f_9csamtools_makeAlignedRead(__pyx_v_alignment); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2488 __Pyx_GOTREF(__pyx_t_1);
2489 __Pyx_DECREF(__pyx_v_a);
2490 __pyx_v_a = __pyx_t_1;
2493 /* "csamtools.pyx":115
2495 * a = makeAlignedRead( alignment )
2496 * (<object>f)(a) # <<<<<<<<<<<<<<
2498 * class PileupColumn(object):
2500 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2501 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
2502 __Pyx_INCREF(__pyx_v_a);
2503 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_a);
2504 __Pyx_GIVEREF(__pyx_v_a);
2505 __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 = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2506 __Pyx_GOTREF(__pyx_t_2);
2507 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
2508 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2513 __Pyx_XDECREF(__pyx_t_1);
2514 __Pyx_XDECREF(__pyx_t_2);
2515 __Pyx_WriteUnraisable("csamtools.fetch_callback");
2518 __Pyx_DECREF(__pyx_v_a);
2519 __Pyx_TraceReturn(Py_None);
2520 __Pyx_RefNannyFinishContext();
2524 /* "csamtools.pyx":130
2525 * list of reads (:class:`pysam.PileupRead`) aligned to this column
2527 * def __str__(self): # <<<<<<<<<<<<<<
2528 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
2529 * "\n" + "\n".join( map(str, self.pileups) )
2532 static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
2533 static char __pyx_doc_9csamtools_12PileupColumn___str__[] = "PileupColumn.__str__(self)";
2534 static PyMethodDef __pyx_mdef_9csamtools_12PileupColumn___str__ = {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pf_9csamtools_12PileupColumn___str__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_12PileupColumn___str__)};
2535 static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
2536 PyObject *__pyx_r = NULL;
2537 PyObject *__pyx_t_1 = NULL;
2538 PyObject *__pyx_t_2 = NULL;
2539 PyObject *__pyx_t_3 = NULL;
2540 PyObject *__pyx_t_4 = NULL;
2541 PyObject *__pyx_t_5 = NULL;
2542 __Pyx_TraceDeclarations
2543 __Pyx_RefNannySetupContext("__str__");
2544 __Pyx_TraceCall("__str__", __pyx_f[0], 130);
2545 __pyx_self = __pyx_self;
2547 /* "csamtools.pyx":131
2549 * def __str__(self):
2550 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ # <<<<<<<<<<<<<<
2551 * "\n" + "\n".join( map(str, self.pileups) )
2554 __Pyx_XDECREF(__pyx_r);
2556 /* "csamtools.pyx":132
2557 * def __str__(self):
2558 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
2559 * "\n" + "\n".join( map(str, self.pileups) ) # <<<<<<<<<<<<<<
2561 * cdef int pileup_callback( uint32_t tid, uint32_t pos, int n, bam_pileup1_t *pl, void *f):
2563 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2564 __Pyx_GOTREF(__pyx_t_1);
2566 /* "csamtools.pyx":131
2568 * def __str__(self):
2569 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ # <<<<<<<<<<<<<<
2570 * "\n" + "\n".join( map(str, self.pileups) )
2573 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2574 __Pyx_GOTREF(__pyx_t_2);
2575 __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2576 __Pyx_GOTREF(__pyx_t_3);
2577 __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2578 __Pyx_GOTREF(__pyx_t_4);
2579 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2580 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
2581 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
2582 __Pyx_GIVEREF(__pyx_t_2);
2583 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
2584 __Pyx_GIVEREF(__pyx_t_3);
2585 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
2586 __Pyx_GIVEREF(__pyx_t_4);
2590 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2591 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
2592 __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
2593 PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
2594 __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
2595 PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_5));
2596 __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
2598 __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 = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2599 __Pyx_GOTREF(__pyx_t_5);
2600 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
2601 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2602 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
2603 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
2604 __Pyx_GIVEREF(__pyx_t_5);
2606 __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 = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2607 __Pyx_GOTREF(__pyx_t_5);
2608 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2609 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
2610 __pyx_t_4 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2611 __Pyx_GOTREF(__pyx_t_4);
2612 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2614 /* "csamtools.pyx":132
2615 * def __str__(self):
2616 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
2617 * "\n" + "\n".join( map(str, self.pileups) ) # <<<<<<<<<<<<<<
2619 * cdef int pileup_callback( uint32_t tid, uint32_t pos, int n, bam_pileup1_t *pl, void *f):
2621 __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2622 __Pyx_GOTREF(__pyx_t_5);
2623 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pileups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2624 __Pyx_GOTREF(__pyx_t_1);
2625 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2626 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
2627 __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
2628 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
2629 __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
2630 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
2631 __Pyx_GIVEREF(__pyx_t_1);
2633 __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 = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2634 __Pyx_GOTREF(__pyx_t_1);
2635 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
2636 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2637 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
2638 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
2639 __Pyx_GIVEREF(__pyx_t_1);
2641 __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 = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2642 __Pyx_GOTREF(__pyx_t_1);
2643 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2644 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
2645 __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2646 __Pyx_GOTREF(__pyx_t_3);
2647 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2648 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2649 __pyx_r = __pyx_t_3;
2653 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2656 __Pyx_XDECREF(__pyx_t_1);
2657 __Pyx_XDECREF(__pyx_t_2);
2658 __Pyx_XDECREF(__pyx_t_3);
2659 __Pyx_XDECREF(__pyx_t_4);
2660 __Pyx_XDECREF(__pyx_t_5);
2661 __Pyx_AddTraceback("csamtools.PileupColumn.__str__");
2664 __Pyx_XGIVEREF(__pyx_r);
2665 __Pyx_TraceReturn(__pyx_r);
2666 __Pyx_RefNannyFinishContext();
2670 /* "csamtools.pyx":134
2671 * "\n" + "\n".join( map(str, self.pileups) )
2673 * cdef int pileup_callback( uint32_t tid, uint32_t pos, int n, bam_pileup1_t *pl, void *f): # <<<<<<<<<<<<<<
2674 * '''callback for pileup.
2678 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) {
2679 PyObject *__pyx_v_p;
2680 PyObject *__pyx_v_pileups;
2683 PyObject *__pyx_t_1 = NULL;
2684 PyObject *__pyx_t_2 = NULL;
2687 __Pyx_TraceDeclarations
2688 __Pyx_RefNannySetupContext("pileup_callback");
2689 __Pyx_TraceCall("pileup_callback", __pyx_f[0], 134);
2690 __pyx_v_p = Py_None; __Pyx_INCREF(Py_None);
2691 __pyx_v_pileups = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
2693 /* "csamtools.pyx":151
2696 * p = PileupColumn() # <<<<<<<<<<<<<<
2700 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__PileupColumn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2701 __Pyx_GOTREF(__pyx_t_1);
2702 __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 = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2703 __Pyx_GOTREF(__pyx_t_2);
2704 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2705 __Pyx_DECREF(__pyx_v_p);
2706 __pyx_v_p = __pyx_t_2;
2709 /* "csamtools.pyx":152
2711 * p = PileupColumn()
2712 * p.tid = tid # <<<<<<<<<<<<<<
2716 __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2717 __Pyx_GOTREF(__pyx_t_2);
2718 if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__tid, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2719 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2721 /* "csamtools.pyx":153
2722 * p = PileupColumn()
2724 * p.pos = pos # <<<<<<<<<<<<<<
2728 __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2729 __Pyx_GOTREF(__pyx_t_2);
2730 if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__pos, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2731 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2733 /* "csamtools.pyx":154
2736 * p.n = n # <<<<<<<<<<<<<<
2740 __pyx_t_2 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2741 __Pyx_GOTREF(__pyx_t_2);
2742 if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__n, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2743 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2745 /* "csamtools.pyx":155
2748 * pileups = [] # <<<<<<<<<<<<<<
2752 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2753 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
2754 __Pyx_DECREF(((PyObject *)__pyx_v_pileups));
2755 __pyx_v_pileups = __pyx_t_2;
2758 /* "csamtools.pyx":158
2761 * for x from 0 <= x < n: # <<<<<<<<<<<<<<
2762 * pileups.append( makePileupRead( &(pl[x]) ) )
2763 * p.pileups = pileups
2765 __pyx_t_3 = __pyx_v_n;
2766 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) {
2768 /* "csamtools.pyx":159
2770 * for x from 0 <= x < n:
2771 * pileups.append( makePileupRead( &(pl[x]) ) ) # <<<<<<<<<<<<<<
2772 * p.pileups = pileups
2775 if (unlikely(__pyx_v_pileups == Py_None)) {
2776 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2778 __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 = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2779 __Pyx_GOTREF(__pyx_t_2);
2780 __pyx_t_4 = PyList_Append(__pyx_v_pileups, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2781 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2784 /* "csamtools.pyx":160
2785 * for x from 0 <= x < n:
2786 * pileups.append( makePileupRead( &(pl[x]) ) )
2787 * p.pileups = pileups # <<<<<<<<<<<<<<
2791 if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__pileups, ((PyObject *)__pyx_v_pileups)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2793 /* "csamtools.pyx":162
2794 * p.pileups = pileups
2796 * (<object>f)(p) # <<<<<<<<<<<<<<
2798 * cdef int pileup_fetch_callback( bam1_t *b, void *data):
2800 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2801 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
2802 __Pyx_INCREF(__pyx_v_p);
2803 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_p);
2804 __Pyx_GIVEREF(__pyx_v_p);
2805 __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 = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2806 __Pyx_GOTREF(__pyx_t_1);
2807 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
2808 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2813 __Pyx_XDECREF(__pyx_t_1);
2814 __Pyx_XDECREF(__pyx_t_2);
2815 __Pyx_WriteUnraisable("csamtools.pileup_callback");
2818 __Pyx_DECREF(__pyx_v_p);
2819 __Pyx_DECREF(__pyx_v_pileups);
2820 __Pyx_TraceReturn(Py_None);
2821 __Pyx_RefNannyFinishContext();
2825 /* "csamtools.pyx":164
2828 * cdef int pileup_fetch_callback( bam1_t *b, void *data): # <<<<<<<<<<<<<<
2829 * '''callback for bam_fetch.
2833 static int __pyx_f_9csamtools_pileup_fetch_callback(bam1_t *__pyx_v_b, void *__pyx_v_data) {
2834 bam_plbuf_t *__pyx_v_buf;
2836 __Pyx_TraceDeclarations
2837 __Pyx_RefNannySetupContext("pileup_fetch_callback");
2838 __Pyx_TraceCall("pileup_fetch_callback", __pyx_f[0], 164);
2840 /* "csamtools.pyx":170
2842 * cdef bam_plbuf_t * buf
2843 * buf = <bam_plbuf_t*>data # <<<<<<<<<<<<<<
2844 * bam_plbuf_push(b, buf)
2847 __pyx_v_buf = ((bam_plbuf_t *)__pyx_v_data);
2849 /* "csamtools.pyx":171
2850 * cdef bam_plbuf_t * buf
2851 * buf = <bam_plbuf_t*>data
2852 * bam_plbuf_push(b, buf) # <<<<<<<<<<<<<<
2856 bam_plbuf_push(__pyx_v_b, __pyx_v_buf);
2858 /* "csamtools.pyx":172
2859 * buf = <bam_plbuf_t*>data
2860 * bam_plbuf_push(b, buf)
2861 * return 0 # <<<<<<<<<<<<<<
2863 * class StderrStore():
2870 __Pyx_TraceReturn(Py_None);
2871 __Pyx_RefNannyFinishContext();
2875 /* "csamtools.pyx":178
2876 * stderr is captured.
2878 * def __init__(self): # <<<<<<<<<<<<<<
2880 * self.stderr_h, self.stderr_f = tempfile.mkstemp()
2883 static PyObject *__pyx_pf_9csamtools_11StderrStore___init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
2884 static char __pyx_doc_9csamtools_11StderrStore___init__[] = "StderrStore.__init__(self)";
2885 static PyMethodDef __pyx_mdef_9csamtools_11StderrStore___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_9csamtools_11StderrStore___init__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore___init__)};
2886 static PyObject *__pyx_pf_9csamtools_11StderrStore___init__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
2887 PyObject *__pyx_r = NULL;
2888 PyObject *__pyx_t_1 = NULL;
2889 PyObject *__pyx_t_2 = NULL;
2890 PyObject *__pyx_t_3 = NULL;
2891 PyObject *__pyx_t_4 = NULL;
2892 __Pyx_TraceDeclarations
2893 __Pyx_RefNannySetupContext("__init__");
2894 __Pyx_TraceCall("__init__", __pyx_f[0], 178);
2895 __pyx_self = __pyx_self;
2897 /* "csamtools.pyx":179
2899 * def __init__(self):
2900 * return # <<<<<<<<<<<<<<
2901 * self.stderr_h, self.stderr_f = tempfile.mkstemp()
2902 * self.stderr_save = Outs( sys.stderr.fileno() )
2904 __Pyx_XDECREF(__pyx_r);
2905 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2908 /* "csamtools.pyx":180
2909 * def __init__(self):
2911 * self.stderr_h, self.stderr_f = tempfile.mkstemp() # <<<<<<<<<<<<<<
2912 * self.stderr_save = Outs( sys.stderr.fileno() )
2913 * self.stderr_save.setfd( self.stderr_h )
2915 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__tempfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2916 __Pyx_GOTREF(__pyx_t_1);
2917 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__mkstemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2918 __Pyx_GOTREF(__pyx_t_2);
2919 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2920 __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 = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2921 __Pyx_GOTREF(__pyx_t_1);
2922 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2923 if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
2924 PyObject* tuple = __pyx_t_1;
2925 __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
2926 __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
2927 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2928 if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__stderr_h, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2929 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2930 if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__stderr_f, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2931 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2933 __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2934 __Pyx_GOTREF(__pyx_t_4);
2935 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2936 __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_4, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2937 __Pyx_GOTREF(__pyx_t_2);
2938 __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_4, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2939 __Pyx_GOTREF(__pyx_t_3);
2940 if (__Pyx_EndUnpack(__pyx_t_4, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2941 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2942 if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__stderr_h, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2943 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2944 if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__stderr_f, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2945 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2948 /* "csamtools.pyx":181
2950 * self.stderr_h, self.stderr_f = tempfile.mkstemp()
2951 * self.stderr_save = Outs( sys.stderr.fileno() ) # <<<<<<<<<<<<<<
2952 * self.stderr_save.setfd( self.stderr_h )
2955 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__Outs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2956 __Pyx_GOTREF(__pyx_t_1);
2957 __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2958 __Pyx_GOTREF(__pyx_t_3);
2959 __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stderr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2960 __Pyx_GOTREF(__pyx_t_2);
2961 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2962 __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__fileno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2963 __Pyx_GOTREF(__pyx_t_3);
2964 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2965 __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 = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2966 __Pyx_GOTREF(__pyx_t_2);
2967 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2968 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2969 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
2970 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
2971 __Pyx_GIVEREF(__pyx_t_2);
2973 __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 = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2974 __Pyx_GOTREF(__pyx_t_2);
2975 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2976 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
2977 if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__stderr_save, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2978 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2980 /* "csamtools.pyx":182
2981 * self.stderr_h, self.stderr_f = tempfile.mkstemp()
2982 * self.stderr_save = Outs( sys.stderr.fileno() )
2983 * self.stderr_save.setfd( self.stderr_h ) # <<<<<<<<<<<<<<
2985 * def readAndRelease( self ):
2987 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_save); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2988 __Pyx_GOTREF(__pyx_t_2);
2989 __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__setfd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2990 __Pyx_GOTREF(__pyx_t_3);
2991 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2992 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_h); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2993 __Pyx_GOTREF(__pyx_t_2);
2994 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2995 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
2996 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
2997 __Pyx_GIVEREF(__pyx_t_2);
2999 __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 = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3000 __Pyx_GOTREF(__pyx_t_2);
3001 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3002 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
3003 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3005 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3008 __Pyx_XDECREF(__pyx_t_1);
3009 __Pyx_XDECREF(__pyx_t_2);
3010 __Pyx_XDECREF(__pyx_t_3);
3011 __Pyx_XDECREF(__pyx_t_4);
3012 __Pyx_AddTraceback("csamtools.StderrStore.__init__");
3015 __Pyx_XGIVEREF(__pyx_r);
3016 __Pyx_TraceReturn(__pyx_r);
3017 __Pyx_RefNannyFinishContext();
3021 /* "csamtools.pyx":184
3022 * self.stderr_save.setfd( self.stderr_h )
3024 * def readAndRelease( self ): # <<<<<<<<<<<<<<
3026 * self.stderr_save.restore()
3029 static PyObject *__pyx_pf_9csamtools_11StderrStore_1readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
3030 static char __pyx_doc_9csamtools_11StderrStore_1readAndRelease[] = "StderrStore.readAndRelease(self)";
3031 static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_1readAndRelease = {__Pyx_NAMESTR("readAndRelease"), (PyCFunction)__pyx_pf_9csamtools_11StderrStore_1readAndRelease, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_1readAndRelease)};
3032 static PyObject *__pyx_pf_9csamtools_11StderrStore_1readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self) {
3033 PyObject *__pyx_v_lines;
3034 PyObject *__pyx_r = NULL;
3035 PyObject *__pyx_t_1 = NULL;
3036 PyObject *__pyx_t_2 = NULL;
3037 PyObject *__pyx_t_3 = NULL;
3039 __Pyx_TraceDeclarations
3040 __Pyx_RefNannySetupContext("readAndRelease");
3041 __Pyx_TraceCall("readAndRelease", __pyx_f[0], 184);
3042 __pyx_self = __pyx_self;
3043 __pyx_v_lines = Py_None; __Pyx_INCREF(Py_None);
3045 /* "csamtools.pyx":185
3047 * def readAndRelease( self ):
3048 * return [] # <<<<<<<<<<<<<<
3049 * self.stderr_save.restore()
3052 __Pyx_XDECREF(__pyx_r);
3053 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3054 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
3055 __pyx_r = ((PyObject *)__pyx_t_1);
3059 /* "csamtools.pyx":186
3060 * def readAndRelease( self ):
3062 * self.stderr_save.restore() # <<<<<<<<<<<<<<
3064 * if os.path.exists(self.stderr_f):
3066 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_save); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3067 __Pyx_GOTREF(__pyx_t_1);
3068 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__restore); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3069 __Pyx_GOTREF(__pyx_t_2);
3070 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3071 __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 = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3072 __Pyx_GOTREF(__pyx_t_1);
3073 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3074 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3076 /* "csamtools.pyx":187
3078 * self.stderr_save.restore()
3079 * lines = [] # <<<<<<<<<<<<<<
3080 * if os.path.exists(self.stderr_f):
3081 * lines = open( self.stderr_f, "r" ).readlines()
3083 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3084 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
3085 __Pyx_DECREF(__pyx_v_lines);
3086 __pyx_v_lines = ((PyObject *)__pyx_t_1);
3089 /* "csamtools.pyx":188
3090 * self.stderr_save.restore()
3092 * if os.path.exists(self.stderr_f): # <<<<<<<<<<<<<<
3093 * lines = open( self.stderr_f, "r" ).readlines()
3094 * os.remove( self.stderr_f )
3096 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3097 __Pyx_GOTREF(__pyx_t_1);
3098 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3099 __Pyx_GOTREF(__pyx_t_2);
3100 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3101 __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3102 __Pyx_GOTREF(__pyx_t_1);
3103 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3104 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3105 __Pyx_GOTREF(__pyx_t_2);
3106 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3107 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
3108 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
3109 __Pyx_GIVEREF(__pyx_t_2);
3111 __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 = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3112 __Pyx_GOTREF(__pyx_t_2);
3113 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3114 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
3115 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3116 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3119 /* "csamtools.pyx":189
3121 * if os.path.exists(self.stderr_f):
3122 * lines = open( self.stderr_f, "r" ).readlines() # <<<<<<<<<<<<<<
3123 * os.remove( self.stderr_f )
3126 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3127 __Pyx_GOTREF(__pyx_t_2);
3128 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3129 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
3130 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
3131 __Pyx_GIVEREF(__pyx_t_2);
3132 __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
3133 PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__r));
3134 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
3136 __pyx_t_2 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3137 __Pyx_GOTREF(__pyx_t_2);
3138 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
3139 __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__readlines); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3140 __Pyx_GOTREF(__pyx_t_3);
3141 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3142 __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 = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3143 __Pyx_GOTREF(__pyx_t_2);
3144 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3145 __Pyx_DECREF(__pyx_v_lines);
3146 __pyx_v_lines = __pyx_t_2;
3149 /* "csamtools.pyx":190
3150 * if os.path.exists(self.stderr_f):
3151 * lines = open( self.stderr_f, "r" ).readlines()
3152 * os.remove( self.stderr_f ) # <<<<<<<<<<<<<<
3156 __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3157 __Pyx_GOTREF(__pyx_t_2);
3158 __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__remove); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3159 __Pyx_GOTREF(__pyx_t_3);
3160 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3161 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3162 __Pyx_GOTREF(__pyx_t_2);
3163 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3164 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
3165 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
3166 __Pyx_GIVEREF(__pyx_t_2);
3168 __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 = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3169 __Pyx_GOTREF(__pyx_t_2);
3170 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3171 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
3172 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3177 /* "csamtools.pyx":191
3178 * lines = open( self.stderr_f, "r" ).readlines()
3179 * os.remove( self.stderr_f )
3180 * return lines # <<<<<<<<<<<<<<
3182 * def release(self):
3184 __Pyx_XDECREF(__pyx_r);
3185 __Pyx_INCREF(__pyx_v_lines);
3186 __pyx_r = __pyx_v_lines;
3189 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3192 __Pyx_XDECREF(__pyx_t_1);
3193 __Pyx_XDECREF(__pyx_t_2);
3194 __Pyx_XDECREF(__pyx_t_3);
3195 __Pyx_AddTraceback("csamtools.StderrStore.readAndRelease");
3198 __Pyx_DECREF(__pyx_v_lines);
3199 __Pyx_XGIVEREF(__pyx_r);
3200 __Pyx_TraceReturn(__pyx_r);
3201 __Pyx_RefNannyFinishContext();
3205 /* "csamtools.pyx":193
3208 * def release(self): # <<<<<<<<<<<<<<
3210 * self.stderr_save.restore()
3213 static PyObject *__pyx_pf_9csamtools_11StderrStore_2release(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
3214 static char __pyx_doc_9csamtools_11StderrStore_2release[] = "StderrStore.release(self)";
3215 static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_2release = {__Pyx_NAMESTR("release"), (PyCFunction)__pyx_pf_9csamtools_11StderrStore_2release, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_2release)};
3216 static PyObject *__pyx_pf_9csamtools_11StderrStore_2release(PyObject *__pyx_self, PyObject *__pyx_v_self) {
3217 PyObject *__pyx_r = NULL;
3218 PyObject *__pyx_t_1 = NULL;
3219 PyObject *__pyx_t_2 = NULL;
3220 PyObject *__pyx_t_3 = NULL;
3222 __Pyx_TraceDeclarations
3223 __Pyx_RefNannySetupContext("release");
3224 __Pyx_TraceCall("release", __pyx_f[0], 193);
3225 __pyx_self = __pyx_self;
3227 /* "csamtools.pyx":194
3229 * def release(self):
3230 * return # <<<<<<<<<<<<<<
3231 * self.stderr_save.restore()
3232 * if os.path.exists(self.stderr_f):
3234 __Pyx_XDECREF(__pyx_r);
3235 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3238 /* "csamtools.pyx":195
3239 * def release(self):
3241 * self.stderr_save.restore() # <<<<<<<<<<<<<<
3242 * if os.path.exists(self.stderr_f):
3243 * os.remove( self.stderr_f )
3245 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_save); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3246 __Pyx_GOTREF(__pyx_t_1);
3247 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__restore); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3248 __Pyx_GOTREF(__pyx_t_2);
3249 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3250 __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 = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3251 __Pyx_GOTREF(__pyx_t_1);
3252 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3253 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3255 /* "csamtools.pyx":196
3257 * self.stderr_save.restore()
3258 * if os.path.exists(self.stderr_f): # <<<<<<<<<<<<<<
3259 * os.remove( self.stderr_f )
3262 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3263 __Pyx_GOTREF(__pyx_t_1);
3264 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3265 __Pyx_GOTREF(__pyx_t_2);
3266 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3267 __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3268 __Pyx_GOTREF(__pyx_t_1);
3269 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3270 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3271 __Pyx_GOTREF(__pyx_t_2);
3272 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3273 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
3274 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
3275 __Pyx_GIVEREF(__pyx_t_2);
3277 __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 = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3278 __Pyx_GOTREF(__pyx_t_2);
3279 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3280 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
3281 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3282 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3285 /* "csamtools.pyx":197
3286 * self.stderr_save.restore()
3287 * if os.path.exists(self.stderr_f):
3288 * os.remove( self.stderr_f ) # <<<<<<<<<<<<<<
3290 * def __del__(self):
3292 __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3293 __Pyx_GOTREF(__pyx_t_2);
3294 __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__remove); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3295 __Pyx_GOTREF(__pyx_t_3);
3296 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3297 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3298 __Pyx_GOTREF(__pyx_t_2);
3299 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3300 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
3301 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
3302 __Pyx_GIVEREF(__pyx_t_2);
3304 __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 = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3305 __Pyx_GOTREF(__pyx_t_2);
3306 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3307 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
3308 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3313 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3316 __Pyx_XDECREF(__pyx_t_1);
3317 __Pyx_XDECREF(__pyx_t_2);
3318 __Pyx_XDECREF(__pyx_t_3);
3319 __Pyx_AddTraceback("csamtools.StderrStore.release");
3322 __Pyx_XGIVEREF(__pyx_r);
3323 __Pyx_TraceReturn(__pyx_r);
3324 __Pyx_RefNannyFinishContext();
3328 /* "csamtools.pyx":199
3329 * os.remove( self.stderr_f )
3331 * def __del__(self): # <<<<<<<<<<<<<<
3336 static PyObject *__pyx_pf_9csamtools_11StderrStore_3__del__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
3337 static char __pyx_doc_9csamtools_11StderrStore_3__del__[] = "StderrStore.__del__(self)";
3338 static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_3__del__ = {__Pyx_NAMESTR("__del__"), (PyCFunction)__pyx_pf_9csamtools_11StderrStore_3__del__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_3__del__)};
3339 static PyObject *__pyx_pf_9csamtools_11StderrStore_3__del__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
3340 PyObject *__pyx_r = NULL;
3341 PyObject *__pyx_t_1 = NULL;
3342 PyObject *__pyx_t_2 = NULL;
3343 __Pyx_TraceDeclarations
3344 __Pyx_RefNannySetupContext("__del__");
3345 __Pyx_TraceCall("__del__", __pyx_f[0], 199);
3346 __pyx_self = __pyx_self;
3348 /* "csamtools.pyx":200
3350 * def __del__(self):
3351 * self.release() # <<<<<<<<<<<<<<
3353 * class StderrStoreWindows():
3355 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__release); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3356 __Pyx_GOTREF(__pyx_t_1);
3357 __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 = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3358 __Pyx_GOTREF(__pyx_t_2);
3359 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3360 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3362 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3365 __Pyx_XDECREF(__pyx_t_1);
3366 __Pyx_XDECREF(__pyx_t_2);
3367 __Pyx_AddTraceback("csamtools.StderrStore.__del__");
3370 __Pyx_XGIVEREF(__pyx_r);
3371 __Pyx_TraceReturn(__pyx_r);
3372 __Pyx_RefNannyFinishContext();
3376 /* "csamtools.pyx":204
3377 * class StderrStoreWindows():
3378 * '''does nothing. stderr can't be redirected on windows'''
3379 * def __init__(self): pass # <<<<<<<<<<<<<<
3380 * def readAndRelease(self): return []
3381 * def release(self): pass
3384 static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows___init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
3385 static char __pyx_doc_9csamtools_18StderrStoreWindows___init__[] = "StderrStoreWindows.__init__(self)";
3386 static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_9csamtools_18StderrStoreWindows___init__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows___init__)};
3387 static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows___init__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
3388 PyObject *__pyx_r = NULL;
3389 __Pyx_TraceDeclarations
3390 __Pyx_RefNannySetupContext("__init__");
3391 __Pyx_TraceCall("__init__", __pyx_f[0], 204);
3392 __pyx_self = __pyx_self;
3394 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3395 __Pyx_XGIVEREF(__pyx_r);
3396 __Pyx_TraceReturn(__pyx_r);
3397 __Pyx_RefNannyFinishContext();
3401 /* "csamtools.pyx":205
3402 * '''does nothing. stderr can't be redirected on windows'''
3403 * def __init__(self): pass
3404 * def readAndRelease(self): return [] # <<<<<<<<<<<<<<
3405 * def release(self): pass
3409 static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_1readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
3410 static char __pyx_doc_9csamtools_18StderrStoreWindows_1readAndRelease[] = "StderrStoreWindows.readAndRelease(self)";
3411 static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows_1readAndRelease = {__Pyx_NAMESTR("readAndRelease"), (PyCFunction)__pyx_pf_9csamtools_18StderrStoreWindows_1readAndRelease, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows_1readAndRelease)};
3412 static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_1readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self) {
3413 PyObject *__pyx_r = NULL;
3414 PyObject *__pyx_t_1 = NULL;
3415 __Pyx_TraceDeclarations
3416 __Pyx_RefNannySetupContext("readAndRelease");
3417 __Pyx_TraceCall("readAndRelease", __pyx_f[0], 205);
3418 __pyx_self = __pyx_self;
3419 __Pyx_XDECREF(__pyx_r);
3420 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3421 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
3422 __pyx_r = ((PyObject *)__pyx_t_1);
3426 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3429 __Pyx_XDECREF(__pyx_t_1);
3430 __Pyx_AddTraceback("csamtools.StderrStoreWindows.readAndRelease");
3433 __Pyx_XGIVEREF(__pyx_r);
3434 __Pyx_TraceReturn(__pyx_r);
3435 __Pyx_RefNannyFinishContext();
3439 /* "csamtools.pyx":206
3440 * def __init__(self): pass
3441 * def readAndRelease(self): return []
3442 * def release(self): pass # <<<<<<<<<<<<<<
3444 * if platform.system()=='Windows':
3447 static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_2release(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
3448 static char __pyx_doc_9csamtools_18StderrStoreWindows_2release[] = "StderrStoreWindows.release(self)";
3449 static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows_2release = {__Pyx_NAMESTR("release"), (PyCFunction)__pyx_pf_9csamtools_18StderrStoreWindows_2release, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows_2release)};
3450 static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_2release(PyObject *__pyx_self, PyObject *__pyx_v_self) {
3451 PyObject *__pyx_r = NULL;
3452 __Pyx_TraceDeclarations
3453 __Pyx_RefNannySetupContext("release");
3454 __Pyx_TraceCall("release", __pyx_f[0], 206);
3455 __pyx_self = __pyx_self;
3457 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3458 __Pyx_XGIVEREF(__pyx_r);
3459 __Pyx_TraceReturn(__pyx_r);
3460 __Pyx_RefNannyFinishContext();
3464 /* "csamtools.pyx":260
3465 * cdef faidx_t * fastafile
3467 * def __cinit__(self, *args, **kwargs ): # <<<<<<<<<<<<<<
3468 * self.fastafile = NULL
3469 * self._filename = NULL
3472 static int __pyx_pf_9csamtools_9Fastafile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3473 static int __pyx_pf_9csamtools_9Fastafile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3474 PyObject *__pyx_v_args = 0;
3475 PyObject *__pyx_v_kwargs = 0;
3477 PyObject *__pyx_t_1 = NULL;
3478 PyObject *__pyx_t_2 = NULL;
3479 PyObject *__pyx_t_3 = NULL;
3480 __Pyx_TraceDeclarations
3481 __Pyx_RefNannySetupContext("__cinit__");
3482 __Pyx_TraceCall("__cinit__", __pyx_f[0], 260);
3483 if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
3484 __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
3485 if (unlikely(!__pyx_v_kwargs)) return -1;
3486 __Pyx_GOTREF(__pyx_v_kwargs);
3487 __Pyx_INCREF(__pyx_args);
3488 __pyx_v_args = __pyx_args;
3490 /* "csamtools.pyx":261
3492 * def __cinit__(self, *args, **kwargs ):
3493 * self.fastafile = NULL # <<<<<<<<<<<<<<
3494 * self._filename = NULL
3495 * self._open( *args, **kwargs )
3497 ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile = NULL;
3499 /* "csamtools.pyx":262
3500 * def __cinit__(self, *args, **kwargs ):
3501 * self.fastafile = NULL
3502 * self._filename = NULL # <<<<<<<<<<<<<<
3503 * self._open( *args, **kwargs )
3506 ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename = NULL;
3508 /* "csamtools.pyx":263
3509 * self.fastafile = NULL
3510 * self._filename = NULL
3511 * self._open( *args, **kwargs ) # <<<<<<<<<<<<<<
3513 * def _isOpen( self ):
3515 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3516 __Pyx_GOTREF(__pyx_t_1);
3517 __pyx_t_2 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3518 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
3519 __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3520 __Pyx_GOTREF(__pyx_t_3);
3521 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3522 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
3523 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3528 __Pyx_XDECREF(__pyx_t_1);
3529 __Pyx_XDECREF(__pyx_t_2);
3530 __Pyx_XDECREF(__pyx_t_3);
3531 __Pyx_AddTraceback("csamtools.Fastafile.__cinit__");
3534 __Pyx_DECREF(__pyx_v_args);
3535 __Pyx_DECREF(__pyx_v_kwargs);
3536 __Pyx_TraceReturn(Py_None);
3537 __Pyx_RefNannyFinishContext();
3541 /* "csamtools.pyx":265
3542 * self._open( *args, **kwargs )
3544 * def _isOpen( self ): # <<<<<<<<<<<<<<
3545 * '''return true if samfile has been opened.'''
3546 * return self.fastafile != NULL
3549 static PyObject *__pyx_pf_9csamtools_9Fastafile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3550 static char __pyx_doc_9csamtools_9Fastafile_1_isOpen[] = "Fastafile._isOpen(self)\nreturn true if samfile has been opened.";
3551 static PyObject *__pyx_pf_9csamtools_9Fastafile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3552 PyObject *__pyx_r = NULL;
3553 PyObject *__pyx_t_1 = NULL;
3554 __Pyx_TraceDeclarations
3555 __Pyx_RefNannySetupContext("_isOpen");
3556 __Pyx_TraceCall("_isOpen", __pyx_f[0], 265);
3558 /* "csamtools.pyx":267
3559 * def _isOpen( self ):
3560 * '''return true if samfile has been opened.'''
3561 * return self.fastafile != NULL # <<<<<<<<<<<<<<
3563 * def __len__(self):
3565 __Pyx_XDECREF(__pyx_r);
3566 __pyx_t_1 = __Pyx_PyBool_FromLong((((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3567 __Pyx_GOTREF(__pyx_t_1);
3568 __pyx_r = __pyx_t_1;
3572 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3575 __Pyx_XDECREF(__pyx_t_1);
3576 __Pyx_AddTraceback("csamtools.Fastafile._isOpen");
3579 __Pyx_XGIVEREF(__pyx_r);
3580 __Pyx_TraceReturn(__pyx_r);
3581 __Pyx_RefNannyFinishContext();
3585 /* "csamtools.pyx":269
3586 * return self.fastafile != NULL
3588 * def __len__(self): # <<<<<<<<<<<<<<
3589 * if self.fastafile == NULL:
3590 * raise ValueError( "calling len() on closed file" )
3593 static Py_ssize_t __pyx_pf_9csamtools_9Fastafile_2__len__(PyObject *__pyx_v_self); /*proto*/
3594 static Py_ssize_t __pyx_pf_9csamtools_9Fastafile_2__len__(PyObject *__pyx_v_self) {
3597 PyObject *__pyx_t_2 = NULL;
3598 __Pyx_TraceDeclarations
3599 __Pyx_RefNannySetupContext("__len__");
3600 __Pyx_TraceCall("__len__", __pyx_f[0], 269);
3602 /* "csamtools.pyx":270
3604 * def __len__(self):
3605 * if self.fastafile == NULL: # <<<<<<<<<<<<<<
3606 * raise ValueError( "calling len() on closed file" )
3609 __pyx_t_1 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile == NULL);
3612 /* "csamtools.pyx":271
3613 * def __len__(self):
3614 * if self.fastafile == NULL:
3615 * raise ValueError( "calling len() on closed file" ) # <<<<<<<<<<<<<<
3617 * return faidx_fetch_nseq(self.fastafile)
3619 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3620 __Pyx_GOTREF(__pyx_t_2);
3621 __Pyx_Raise(__pyx_t_2, 0, 0);
3622 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3623 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3628 /* "csamtools.pyx":273
3629 * raise ValueError( "calling len() on closed file" )
3631 * return faidx_fetch_nseq(self.fastafile) # <<<<<<<<<<<<<<
3635 __pyx_r = faidx_fetch_nseq(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile);
3641 __Pyx_XDECREF(__pyx_t_2);
3642 __Pyx_AddTraceback("csamtools.Fastafile.__len__");
3645 __Pyx_TraceReturn(Py_None);
3646 __Pyx_RefNannyFinishContext();
3650 /* "csamtools.pyx":275
3651 * return faidx_fetch_nseq(self.fastafile)
3653 * def _open( self, # <<<<<<<<<<<<<<
3654 * char * filename ):
3655 * '''open an indexed fasta file.
3658 static PyObject *__pyx_pf_9csamtools_9Fastafile_3_open(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/
3659 static char __pyx_doc_9csamtools_9Fastafile_3_open[] = "Fastafile._open(self, char *filename)\nopen an indexed fasta file.\n\n This method expects an indexed fasta file.\n ";
3660 static PyObject *__pyx_pf_9csamtools_9Fastafile_3_open(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) {
3661 char *__pyx_v_filename;
3662 PyObject *__pyx_r = NULL;
3664 PyObject *__pyx_t_2 = NULL;
3665 PyObject *__pyx_t_3 = NULL;
3666 __Pyx_TraceDeclarations
3667 __Pyx_RefNannySetupContext("_open");
3668 __Pyx_TraceCall("_open", __pyx_f[0], 275);
3669 assert(__pyx_arg_filename); {
3670 __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3672 goto __pyx_L4_argument_unpacking_done;
3674 __Pyx_AddTraceback("csamtools.Fastafile._open");
3675 __Pyx_RefNannyFinishContext();
3677 __pyx_L4_argument_unpacking_done:;
3679 /* "csamtools.pyx":283
3681 * # close a previously opened file
3682 * if self.fastafile != NULL: self.close() # <<<<<<<<<<<<<<
3683 * if self._filename != NULL: free(self._filename)
3684 * self._filename = strdup(filename)
3686 __pyx_t_1 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile != NULL);
3688 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3689 __Pyx_GOTREF(__pyx_t_2);
3690 __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 = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3691 __Pyx_GOTREF(__pyx_t_3);
3692 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3693 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3698 /* "csamtools.pyx":284
3699 * # close a previously opened file
3700 * if self.fastafile != NULL: self.close()
3701 * if self._filename != NULL: free(self._filename) # <<<<<<<<<<<<<<
3702 * self._filename = strdup(filename)
3703 * self.fastafile = fai_load( filename )
3705 __pyx_t_1 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename != NULL);
3707 free(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename);
3712 /* "csamtools.pyx":285
3713 * if self.fastafile != NULL: self.close()
3714 * if self._filename != NULL: free(self._filename)
3715 * self._filename = strdup(filename) # <<<<<<<<<<<<<<
3716 * self.fastafile = fai_load( filename )
3719 ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename = strdup(__pyx_v_filename);
3721 /* "csamtools.pyx":286
3722 * if self._filename != NULL: free(self._filename)
3723 * self._filename = strdup(filename)
3724 * self.fastafile = fai_load( filename ) # <<<<<<<<<<<<<<
3726 * if self.fastafile == NULL:
3728 ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile = fai_load(__pyx_v_filename);
3730 /* "csamtools.pyx":288
3731 * self.fastafile = fai_load( filename )
3733 * if self.fastafile == NULL: # <<<<<<<<<<<<<<
3734 * raise IOError("could not open file `%s`" % filename )
3737 __pyx_t_1 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile == NULL);
3740 /* "csamtools.pyx":289
3742 * if self.fastafile == NULL:
3743 * raise IOError("could not open file `%s`" % filename ) # <<<<<<<<<<<<<<
3745 * def close( self ):
3747 __pyx_t_3 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3748 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
3749 __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3750 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
3751 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
3752 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3753 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
3754 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
3755 __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
3757 __pyx_t_2 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3758 __Pyx_GOTREF(__pyx_t_2);
3759 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
3760 __Pyx_Raise(__pyx_t_2, 0, 0);
3761 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3762 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3767 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3770 __Pyx_XDECREF(__pyx_t_2);
3771 __Pyx_XDECREF(__pyx_t_3);
3772 __Pyx_AddTraceback("csamtools.Fastafile._open");
3775 __Pyx_XGIVEREF(__pyx_r);
3776 __Pyx_TraceReturn(__pyx_r);
3777 __Pyx_RefNannyFinishContext();
3781 /* "csamtools.pyx":291
3782 * raise IOError("could not open file `%s`" % filename )
3784 * def close( self ): # <<<<<<<<<<<<<<
3785 * if self.fastafile != NULL:
3786 * fai_destroy( self.fastafile )
3789 static PyObject *__pyx_pf_9csamtools_9Fastafile_4close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3790 static char __pyx_doc_9csamtools_9Fastafile_4close[] = "Fastafile.close(self)";
3791 static PyObject *__pyx_pf_9csamtools_9Fastafile_4close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3792 PyObject *__pyx_r = NULL;
3794 __Pyx_TraceDeclarations
3795 __Pyx_RefNannySetupContext("close");
3796 __Pyx_TraceCall("close", __pyx_f[0], 291);
3798 /* "csamtools.pyx":292
3800 * def close( self ):
3801 * if self.fastafile != NULL: # <<<<<<<<<<<<<<
3802 * fai_destroy( self.fastafile )
3803 * self.fastafile = NULL
3805 __pyx_t_1 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile != NULL);
3808 /* "csamtools.pyx":293
3809 * def close( self ):
3810 * if self.fastafile != NULL:
3811 * fai_destroy( self.fastafile ) # <<<<<<<<<<<<<<
3812 * self.fastafile = NULL
3815 fai_destroy(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile);
3817 /* "csamtools.pyx":294
3818 * if self.fastafile != NULL:
3819 * fai_destroy( self.fastafile )
3820 * self.fastafile = NULL # <<<<<<<<<<<<<<
3822 * def __dealloc__(self):
3824 ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile = NULL;
3829 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3830 __Pyx_XGIVEREF(__pyx_r);
3831 __Pyx_TraceReturn(__pyx_r);
3832 __Pyx_RefNannyFinishContext();
3836 /* "csamtools.pyx":296
3837 * self.fastafile = NULL
3839 * def __dealloc__(self): # <<<<<<<<<<<<<<
3841 * if self._filename != NULL: free(self._filename)
3844 static void __pyx_pf_9csamtools_9Fastafile_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
3845 static void __pyx_pf_9csamtools_9Fastafile_5__dealloc__(PyObject *__pyx_v_self) {
3846 PyObject *__pyx_t_1 = NULL;
3847 PyObject *__pyx_t_2 = NULL;
3849 __Pyx_TraceDeclarations
3850 __Pyx_RefNannySetupContext("__dealloc__");
3851 __Pyx_TraceCall("__dealloc__", __pyx_f[0], 296);
3853 /* "csamtools.pyx":297
3855 * def __dealloc__(self):
3856 * self.close() # <<<<<<<<<<<<<<
3857 * if self._filename != NULL: free(self._filename)
3860 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3861 __Pyx_GOTREF(__pyx_t_1);
3862 __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 = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3863 __Pyx_GOTREF(__pyx_t_2);
3864 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3865 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3867 /* "csamtools.pyx":298
3868 * def __dealloc__(self):
3870 * if self._filename != NULL: free(self._filename) # <<<<<<<<<<<<<<
3872 * property filename:
3874 __pyx_t_3 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename != NULL);
3876 free(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename);
3883 __Pyx_XDECREF(__pyx_t_1);
3884 __Pyx_XDECREF(__pyx_t_2);
3885 __Pyx_AddTraceback("csamtools.Fastafile.__dealloc__");
3887 __Pyx_TraceReturn(Py_None);
3888 __Pyx_RefNannyFinishContext();
3891 /* "csamtools.pyx":302
3892 * property filename:
3893 * '''number of :term:`filename` associated with this object.'''
3894 * def __get__(self): # <<<<<<<<<<<<<<
3895 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
3896 * return self._filename
3899 static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(PyObject *__pyx_v_self); /*proto*/
3900 static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(PyObject *__pyx_v_self) {
3901 PyObject *__pyx_r = NULL;
3902 PyObject *__pyx_t_1 = NULL;
3903 PyObject *__pyx_t_2 = NULL;
3906 __Pyx_TraceDeclarations
3907 __Pyx_RefNannySetupContext("__get__");
3908 __Pyx_TraceCall("__get__", __pyx_f[0], 302);
3910 /* "csamtools.pyx":303
3911 * '''number of :term:`filename` associated with this object.'''
3912 * def __get__(self):
3913 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
3914 * return self._filename
3917 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3918 __Pyx_GOTREF(__pyx_t_1);
3919 __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 = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3920 __Pyx_GOTREF(__pyx_t_2);
3921 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3922 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3923 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3924 __pyx_t_4 = (!__pyx_t_3);
3926 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3927 __Pyx_GOTREF(__pyx_t_2);
3928 __Pyx_Raise(__pyx_t_2, 0, 0);
3929 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3930 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3935 /* "csamtools.pyx":304
3936 * def __get__(self):
3937 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
3938 * return self._filename # <<<<<<<<<<<<<<
3942 __Pyx_XDECREF(__pyx_r);
3943 __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3944 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
3945 __pyx_r = ((PyObject *)__pyx_t_2);
3949 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3952 __Pyx_XDECREF(__pyx_t_1);
3953 __Pyx_XDECREF(__pyx_t_2);
3954 __Pyx_AddTraceback("csamtools.Fastafile.filename.__get__");
3957 __Pyx_XGIVEREF(__pyx_r);
3958 __Pyx_TraceReturn(__pyx_r);
3959 __Pyx_RefNannyFinishContext();
3963 /* "csamtools.pyx":306
3964 * return self._filename
3966 * def fetch( self, # <<<<<<<<<<<<<<
3971 static PyObject *__pyx_pf_9csamtools_9Fastafile_6fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3972 static char __pyx_doc_9csamtools_9Fastafile_6fetch[] = "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 ";
3973 static PyObject *__pyx_pf_9csamtools_9Fastafile_6fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3974 PyObject *__pyx_v_reference = 0;
3975 PyObject *__pyx_v_start = 0;
3976 PyObject *__pyx_v_end = 0;
3977 PyObject *__pyx_v_region = 0;
3980 PyObject *__pyx_v_py_seq;
3981 PyObject *__pyx_r = NULL;
3982 PyObject *__pyx_t_1 = NULL;
3983 PyObject *__pyx_t_2 = NULL;
3987 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
3988 __Pyx_TraceDeclarations
3989 __Pyx_RefNannySetupContext("fetch");
3990 __Pyx_TraceCall("fetch", __pyx_f[0], 306);
3991 if (unlikely(__pyx_kwds)) {
3992 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
3993 PyObject* values[4] = {0,0,0,0};
3995 /* "csamtools.pyx":307
3998 * reference = None, # <<<<<<<<<<<<<<
4002 values[0] = ((PyObject *)Py_None);
4004 /* "csamtools.pyx":308
4007 * start = None, # <<<<<<<<<<<<<<
4011 values[1] = ((PyObject *)Py_None);
4013 /* "csamtools.pyx":309
4016 * end = None, # <<<<<<<<<<<<<<
4020 values[2] = ((PyObject *)Py_None);
4022 /* "csamtools.pyx":310
4025 * region = None): # <<<<<<<<<<<<<<
4027 * '''*(reference = None, start = None, end = None, region = None)*
4029 values[3] = ((PyObject *)Py_None);
4030 switch (PyTuple_GET_SIZE(__pyx_args)) {
4031 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4032 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4033 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4034 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4036 default: goto __pyx_L5_argtuple_error;
4038 switch (PyTuple_GET_SIZE(__pyx_args)) {
4041 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
4042 if (value) { values[0] = value; kw_args--; }
4046 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
4047 if (value) { values[1] = value; kw_args--; }
4051 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
4052 if (value) { values[2] = value; kw_args--; }
4056 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region);
4057 if (value) { values[3] = value; kw_args--; }
4060 if (unlikely(kw_args > 0)) {
4061 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4063 __pyx_v_reference = values[0];
4064 __pyx_v_start = values[1];
4065 __pyx_v_end = values[2];
4066 __pyx_v_region = values[3];
4069 /* "csamtools.pyx":307
4072 * reference = None, # <<<<<<<<<<<<<<
4076 __pyx_v_reference = ((PyObject *)Py_None);
4078 /* "csamtools.pyx":308
4081 * start = None, # <<<<<<<<<<<<<<
4085 __pyx_v_start = ((PyObject *)Py_None);
4087 /* "csamtools.pyx":309
4090 * end = None, # <<<<<<<<<<<<<<
4094 __pyx_v_end = ((PyObject *)Py_None);
4096 /* "csamtools.pyx":310
4099 * region = None): # <<<<<<<<<<<<<<
4101 * '''*(reference = None, start = None, end = None, region = None)*
4103 __pyx_v_region = ((PyObject *)Py_None);
4104 switch (PyTuple_GET_SIZE(__pyx_args)) {
4105 case 4: __pyx_v_region = PyTuple_GET_ITEM(__pyx_args, 3);
4106 case 3: __pyx_v_end = PyTuple_GET_ITEM(__pyx_args, 2);
4107 case 2: __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 1);
4108 case 1: __pyx_v_reference = PyTuple_GET_ITEM(__pyx_args, 0);
4110 default: goto __pyx_L5_argtuple_error;
4113 goto __pyx_L4_argument_unpacking_done;
4114 __pyx_L5_argtuple_error:;
4115 __Pyx_RaiseArgtupleInvalid("fetch", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4117 __Pyx_AddTraceback("csamtools.Fastafile.fetch");
4118 __Pyx_RefNannyFinishContext();
4120 __pyx_L4_argument_unpacking_done:;
4121 __Pyx_INCREF(__pyx_v_start);
4122 __Pyx_INCREF(__pyx_v_end);
4123 __Pyx_INCREF(__pyx_v_region);
4124 __pyx_v_py_seq = Py_None; __Pyx_INCREF(Py_None);
4126 /* "csamtools.pyx":327
4129 * if not self._isOpen(): # <<<<<<<<<<<<<<
4130 * raise ValueError( "I/O operation on closed file" )
4133 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4134 __Pyx_GOTREF(__pyx_t_1);
4135 __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 = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4136 __Pyx_GOTREF(__pyx_t_2);
4137 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4138 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4139 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4140 __pyx_t_4 = (!__pyx_t_3);
4143 /* "csamtools.pyx":328
4145 * if not self._isOpen():
4146 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
4150 __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 = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4151 __Pyx_GOTREF(__pyx_t_2);
4152 __Pyx_Raise(__pyx_t_2, 0, 0);
4153 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4154 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4159 /* "csamtools.pyx":333
4162 * if not region: # <<<<<<<<<<<<<<
4163 * if reference is None: raise ValueError( 'no sequence/region supplied.' )
4164 * if start is None: start = 0
4166 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4167 __pyx_t_3 = (!__pyx_t_4);
4170 /* "csamtools.pyx":334
4173 * if reference is None: raise ValueError( 'no sequence/region supplied.' ) # <<<<<<<<<<<<<<
4174 * if start is None: start = 0
4175 * if end is None: end = max_pos -1
4177 __pyx_t_3 = (__pyx_v_reference == Py_None);
4179 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4180 __Pyx_GOTREF(__pyx_t_2);
4181 __Pyx_Raise(__pyx_t_2, 0, 0);
4182 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4183 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4188 /* "csamtools.pyx":335
4190 * if reference is None: raise ValueError( 'no sequence/region supplied.' )
4191 * if start is None: start = 0 # <<<<<<<<<<<<<<
4192 * if end is None: end = max_pos -1
4195 __pyx_t_3 = (__pyx_v_start == Py_None);
4197 __Pyx_INCREF(__pyx_int_0);
4198 __Pyx_DECREF(__pyx_v_start);
4199 __pyx_v_start = __pyx_int_0;
4204 /* "csamtools.pyx":336
4205 * if reference is None: raise ValueError( 'no sequence/region supplied.' )
4206 * if start is None: start = 0
4207 * if end is None: end = max_pos -1 # <<<<<<<<<<<<<<
4209 * if start > end: raise ValueError( 'invalid region: start (%i) > end (%i)' % (start, end) )
4211 __pyx_t_3 = (__pyx_v_end == Py_None);
4213 __pyx_t_2 = PyInt_FromLong((__pyx_v_9csamtools_max_pos - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4214 __Pyx_GOTREF(__pyx_t_2);
4215 __Pyx_DECREF(__pyx_v_end);
4216 __pyx_v_end = __pyx_t_2;
4222 /* "csamtools.pyx":338
4223 * if end is None: end = max_pos -1
4225 * if start > end: raise ValueError( 'invalid region: start (%i) > end (%i)' % (start, end) ) # <<<<<<<<<<<<<<
4226 * if start == end: return ""
4227 * # valid ranges are from 0 to 2^29-1
4229 __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 = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4230 __Pyx_GOTREF(__pyx_t_2);
4231 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4232 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4234 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4235 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
4236 __Pyx_INCREF(__pyx_v_start);
4237 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_start);
4238 __Pyx_GIVEREF(__pyx_v_start);
4239 __Pyx_INCREF(__pyx_v_end);
4240 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_end);
4241 __Pyx_GIVEREF(__pyx_v_end);
4242 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4243 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
4244 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
4245 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4246 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
4247 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
4248 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
4250 __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 = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4251 __Pyx_GOTREF(__pyx_t_1);
4252 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
4253 __Pyx_Raise(__pyx_t_1, 0, 0);
4254 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4255 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4260 /* "csamtools.pyx":339
4262 * if start > end: raise ValueError( 'invalid region: start (%i) > end (%i)' % (start, end) )
4263 * if start == end: return "" # <<<<<<<<<<<<<<
4264 * # valid ranges are from 0 to 2^29-1
4265 * if not 0 <= start < max_pos: raise ValueError( 'start out of range (%i)' % start )
4267 __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 = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4268 __Pyx_GOTREF(__pyx_t_1);
4269 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4270 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4272 __Pyx_XDECREF(__pyx_r);
4273 __Pyx_INCREF(((PyObject *)__pyx_kp_s_12));
4274 __pyx_r = ((PyObject *)__pyx_kp_s_12);
4280 /* "csamtools.pyx":341
4281 * if start == end: return ""
4282 * # valid ranges are from 0 to 2^29-1
4283 * if not 0 <= start < max_pos: raise ValueError( 'start out of range (%i)' % start ) # <<<<<<<<<<<<<<
4284 * if not 0 <= end < max_pos: raise ValueError( 'end out of range (%i)' % end )
4285 * # note: faidx_fetch_seq has a bug such that out-of-range access
4287 __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 = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4288 __Pyx_GOTREF(__pyx_t_1);
4289 if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
4290 __Pyx_DECREF(__pyx_t_1);
4291 __pyx_t_2 = PyInt_FromLong(__pyx_v_9csamtools_max_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4292 __Pyx_GOTREF(__pyx_t_2);
4293 __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 = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4294 __Pyx_GOTREF(__pyx_t_1);
4295 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4297 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4298 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4299 __pyx_t_4 = (!__pyx_t_3);
4301 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4302 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
4303 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4304 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
4305 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
4306 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
4308 __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 = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4309 __Pyx_GOTREF(__pyx_t_1);
4310 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
4311 __Pyx_Raise(__pyx_t_1, 0, 0);
4312 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4313 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4318 /* "csamtools.pyx":342
4319 * # valid ranges are from 0 to 2^29-1
4320 * if not 0 <= start < max_pos: raise ValueError( 'start out of range (%i)' % start )
4321 * if not 0 <= end < max_pos: raise ValueError( 'end out of range (%i)' % end ) # <<<<<<<<<<<<<<
4322 * # note: faidx_fetch_seq has a bug such that out-of-range access
4323 * # always returns the last residue. Hence do not use faidx_fetch_seq,
4325 __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 = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4326 __Pyx_GOTREF(__pyx_t_1);
4327 if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
4328 __Pyx_DECREF(__pyx_t_1);
4329 __pyx_t_2 = PyInt_FromLong(__pyx_v_9csamtools_max_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4330 __Pyx_GOTREF(__pyx_t_2);
4331 __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 = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4332 __Pyx_GOTREF(__pyx_t_1);
4333 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4335 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4336 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4337 __pyx_t_3 = (!__pyx_t_4);
4339 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __pyx_v_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4340 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
4341 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4342 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
4343 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
4344 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
4346 __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 = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4347 __Pyx_GOTREF(__pyx_t_1);
4348 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
4349 __Pyx_Raise(__pyx_t_1, 0, 0);
4350 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4351 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4356 /* "csamtools.pyx":351
4359 * region = "%s:%i-%i" % (reference, start+1, end) # <<<<<<<<<<<<<<
4360 * seq = fai_fetch( self.fastafile,
4363 __pyx_t_1 = PyNumber_Add(__pyx_v_start, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4364 __Pyx_GOTREF(__pyx_t_1);
4365 __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4366 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
4367 __Pyx_INCREF(__pyx_v_reference);
4368 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_reference);
4369 __Pyx_GIVEREF(__pyx_v_reference);
4370 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
4371 __Pyx_GIVEREF(__pyx_t_1);
4372 __Pyx_INCREF(__pyx_v_end);
4373 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_end);
4374 __Pyx_GIVEREF(__pyx_v_end);
4376 __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 = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4377 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
4378 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
4379 __Pyx_DECREF(__pyx_v_region);
4380 __pyx_v_region = ((PyObject *)__pyx_t_1);
4383 /* "csamtools.pyx":353
4384 * region = "%s:%i-%i" % (reference, start+1, end)
4385 * seq = fai_fetch( self.fastafile,
4386 * region, # <<<<<<<<<<<<<<
4390 __pyx_t_5 = PyBytes_AsString(__pyx_v_region); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4392 /* "csamtools.pyx":354
4393 * seq = fai_fetch( self.fastafile,
4395 * &length ) # <<<<<<<<<<<<<<
4397 * # samtools adds a '\0' at the end
4399 __pyx_v_seq = fai_fetch(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile, __pyx_t_5, (&__pyx_v_length));
4404 /* "csamtools.pyx":357
4406 * # samtools adds a '\0' at the end
4407 * seq = fai_fetch( self.fastafile, region, &length ) # <<<<<<<<<<<<<<
4411 __pyx_t_5 = PyBytes_AsString(__pyx_v_region); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4412 __pyx_v_seq = fai_fetch(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile, __pyx_t_5, (&__pyx_v_length));
4416 /* "csamtools.pyx":360
4419 * if seq == NULL: # <<<<<<<<<<<<<<
4423 __pyx_t_3 = (__pyx_v_seq == NULL);
4426 /* "csamtools.pyx":361
4429 * return "" # <<<<<<<<<<<<<<
4433 __Pyx_XDECREF(__pyx_r);
4434 __Pyx_INCREF(((PyObject *)__pyx_kp_s_12));
4435 __pyx_r = ((PyObject *)__pyx_kp_s_12);
4441 /* "csamtools.pyx":363
4444 * try: # <<<<<<<<<<<<<<
4445 * py_seq = PyString_FromStringAndSize(seq, length)
4450 /* "csamtools.pyx":364
4453 * py_seq = PyString_FromStringAndSize(seq, length) # <<<<<<<<<<<<<<
4457 __pyx_t_1 = PyString_FromStringAndSize(__pyx_v_seq, __pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L17;}
4458 __Pyx_GOTREF(__pyx_t_1);
4459 __Pyx_DECREF(__pyx_v_py_seq);
4460 __pyx_v_py_seq = __pyx_t_1;
4464 /* "csamtools.pyx":366
4465 * py_seq = PyString_FromStringAndSize(seq, length)
4467 * free(seq) # <<<<<<<<<<<<<<
4473 PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
4474 int __pyx_exc_lineno;
4475 __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
4476 __pyx_why = 0; goto __pyx_L18;
4479 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4480 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4481 __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
4482 __pyx_exc_lineno = __pyx_lineno;
4487 switch (__pyx_why) {
4489 __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
4490 __pyx_lineno = __pyx_exc_lineno;
4492 __pyx_exc_value = 0;
4494 goto __pyx_L1_error;
4501 /* "csamtools.pyx":368
4504 * return py_seq # <<<<<<<<<<<<<<
4506 * cdef char * _fetch( self, char * reference, int start, int end, int * length ):
4508 __Pyx_XDECREF(__pyx_r);
4509 __Pyx_INCREF(__pyx_v_py_seq);
4510 __pyx_r = __pyx_v_py_seq;
4513 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4516 __Pyx_XDECREF(__pyx_t_1);
4517 __Pyx_XDECREF(__pyx_t_2);
4518 __Pyx_AddTraceback("csamtools.Fastafile.fetch");
4521 __Pyx_DECREF(__pyx_v_py_seq);
4522 __Pyx_DECREF(__pyx_v_start);
4523 __Pyx_DECREF(__pyx_v_end);
4524 __Pyx_DECREF(__pyx_v_region);
4525 __Pyx_XGIVEREF(__pyx_r);
4526 __Pyx_TraceReturn(__pyx_r);
4527 __Pyx_RefNannyFinishContext();
4531 /* "csamtools.pyx":370
4534 * cdef char * _fetch( self, char * reference, int start, int end, int * length ): # <<<<<<<<<<<<<<
4535 * '''fetch sequence for reference, start and end'''
4539 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) {
4541 __Pyx_TraceDeclarations
4542 __Pyx_RefNannySetupContext("_fetch");
4543 __Pyx_TraceCall("_fetch", __pyx_f[0], 370);
4545 /* "csamtools.pyx":377
4548 * length ) # <<<<<<<<<<<<<<
4550 * #------------------------------------------------------------------------
4552 __pyx_r = faidx_fetch_seq(__pyx_v_self->fastafile, __pyx_v_reference, __pyx_v_start, (__pyx_v_end - 1), __pyx_v_length);
4557 __Pyx_TraceReturn(Py_None);
4558 __Pyx_RefNannyFinishContext();
4562 /* "csamtools.pyx":382
4563 * #------------------------------------------------------------------------
4564 * #------------------------------------------------------------------------
4565 * cdef int count_callback( bam1_t *alignment, void *f): # <<<<<<<<<<<<<<
4566 * '''callback for bam_fetch - count number of reads.
4570 static int __pyx_f_9csamtools_count_callback(bam1_t *__pyx_v_alignment, void *__pyx_v_f) {
4571 int *__pyx_v_counter;
4574 __Pyx_TraceDeclarations
4575 __Pyx_RefNannySetupContext("count_callback");
4576 __Pyx_TraceCall("count_callback", __pyx_f[0], 382);
4578 /* "csamtools.pyx":385
4579 * '''callback for bam_fetch - count number of reads.
4581 * cdef int* counter = (<int*>f) # <<<<<<<<<<<<<<
4585 __pyx_v_counter = ((int *)__pyx_v_f);
4587 /* "csamtools.pyx":386
4589 * cdef int* counter = (<int*>f)
4590 * counter[0] += 1; # <<<<<<<<<<<<<<
4592 * ctypedef struct MateData:
4595 (__pyx_v_counter[__pyx_t_1]) = ((__pyx_v_counter[__pyx_t_1]) + 1);
4598 __Pyx_TraceReturn(Py_None);
4599 __Pyx_RefNannyFinishContext();
4603 /* "csamtools.pyx":396
4604 * #------------------------------------------------------------------------
4605 * #------------------------------------------------------------------------
4606 * cdef int mate_callback( bam1_t *alignment, void *f): # <<<<<<<<<<<<<<
4607 * '''callback for bam_fetch = filter mate
4611 static int __pyx_f_9csamtools_mate_callback(bam1_t *__pyx_v_alignment, void *__pyx_v_f) {
4612 __pyx_t_9csamtools_MateData *__pyx_v_d;
4617 __Pyx_TraceDeclarations
4618 __Pyx_RefNannySetupContext("mate_callback");
4619 __Pyx_TraceCall("mate_callback", __pyx_f[0], 396);
4621 /* "csamtools.pyx":399
4622 * '''callback for bam_fetch = filter mate
4624 * cdef MateData * d = (<MateData*>f) # <<<<<<<<<<<<<<
4625 * # printf("mate = %p, name1 = %s, name2=%s\t%i\t%i\t%i\n",
4626 * # d.mate, d.name, bam1_qname(alignment),
4628 __pyx_v_d = ((__pyx_t_9csamtools_MateData *)__pyx_v_f);
4630 /* "csamtools.pyx":404
4631 * # d.flag, alignment.core.flag, alignment.core.flag & d.flag)
4633 * if d.mate == NULL: # <<<<<<<<<<<<<<
4634 * # could be sped up by comparing the lengths of query strings first
4637 __pyx_t_1 = (__pyx_v_d->mate == NULL);
4640 /* "csamtools.pyx":410
4641 * # also, make sure that we get the other read by comparing
4643 * if alignment.core.flag & d.flag != 0 and \ # <<<<<<<<<<<<<<
4644 * strcmp( bam1_qname( alignment ), d.name ) == 0:
4645 * d.mate = bam_dup1( alignment )
4647 __pyx_t_1 = ((__pyx_v_alignment->core.flag & __pyx_v_d->flag) != 0);
4650 /* "csamtools.pyx":411
4652 * if alignment.core.flag & d.flag != 0 and \
4653 * strcmp( bam1_qname( alignment ), d.name ) == 0: # <<<<<<<<<<<<<<
4654 * d.mate = bam_dup1( alignment )
4657 __pyx_t_2 = (strcmp(bam1_qname(__pyx_v_alignment), __pyx_v_d->name) == 0);
4658 __pyx_t_3 = __pyx_t_2;
4660 __pyx_t_3 = __pyx_t_1;
4664 /* "csamtools.pyx":412
4665 * if alignment.core.flag & d.flag != 0 and \
4666 * strcmp( bam1_qname( alignment ), d.name ) == 0:
4667 * d.mate = bam_dup1( alignment ) # <<<<<<<<<<<<<<
4671 __pyx_v_d->mate = bam_dup1(__pyx_v_alignment);
4680 __Pyx_TraceReturn(Py_None);
4681 __Pyx_RefNannyFinishContext();
4685 /* "csamtools.pyx":458
4688 * def __cinit__(self, *args, **kwargs ): # <<<<<<<<<<<<<<
4689 * self.samfile = NULL
4690 * self._filename = NULL
4693 static int __pyx_pf_9csamtools_7Samfile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4694 static int __pyx_pf_9csamtools_7Samfile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4695 PyObject *__pyx_v_args = 0;
4696 PyObject *__pyx_v_kwargs = 0;
4698 PyObject *__pyx_t_1 = NULL;
4699 PyObject *__pyx_t_2 = NULL;
4700 PyObject *__pyx_t_3 = NULL;
4701 __Pyx_TraceDeclarations
4702 __Pyx_RefNannySetupContext("__cinit__");
4703 __Pyx_TraceCall("__cinit__", __pyx_f[0], 458);
4704 if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
4705 __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
4706 if (unlikely(!__pyx_v_kwargs)) return -1;
4707 __Pyx_GOTREF(__pyx_v_kwargs);
4708 __Pyx_INCREF(__pyx_args);
4709 __pyx_v_args = __pyx_args;
4711 /* "csamtools.pyx":459
4713 * def __cinit__(self, *args, **kwargs ):
4714 * self.samfile = NULL # <<<<<<<<<<<<<<
4715 * self._filename = NULL
4716 * self.isbam = False
4718 ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = NULL;
4720 /* "csamtools.pyx":460
4721 * def __cinit__(self, *args, **kwargs ):
4722 * self.samfile = NULL
4723 * self._filename = NULL # <<<<<<<<<<<<<<
4724 * self.isbam = False
4725 * self.isstream = False
4727 ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename = NULL;
4729 /* "csamtools.pyx":461
4730 * self.samfile = NULL
4731 * self._filename = NULL
4732 * self.isbam = False # <<<<<<<<<<<<<<
4733 * self.isstream = False
4734 * self._open( *args, **kwargs )
4736 ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam = 0;
4738 /* "csamtools.pyx":462
4739 * self._filename = NULL
4740 * self.isbam = False
4741 * self.isstream = False # <<<<<<<<<<<<<<
4742 * self._open( *args, **kwargs )
4745 ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream = 0;
4747 /* "csamtools.pyx":463
4748 * self.isbam = False
4749 * self.isstream = False
4750 * self._open( *args, **kwargs ) # <<<<<<<<<<<<<<
4752 * # allocate memory for iterator
4754 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4755 __Pyx_GOTREF(__pyx_t_1);
4756 __pyx_t_2 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4757 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
4758 __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4759 __Pyx_GOTREF(__pyx_t_3);
4760 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4761 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
4762 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4764 /* "csamtools.pyx":466
4766 * # allocate memory for iterator
4767 * self.b = <bam1_t*>calloc(1, sizeof(bam1_t)) # <<<<<<<<<<<<<<
4769 * def _isOpen( self ):
4771 ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->b = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
4776 __Pyx_XDECREF(__pyx_t_1);
4777 __Pyx_XDECREF(__pyx_t_2);
4778 __Pyx_XDECREF(__pyx_t_3);
4779 __Pyx_AddTraceback("csamtools.Samfile.__cinit__");
4782 __Pyx_DECREF(__pyx_v_args);
4783 __Pyx_DECREF(__pyx_v_kwargs);
4784 __Pyx_TraceReturn(Py_None);
4785 __Pyx_RefNannyFinishContext();
4789 /* "csamtools.pyx":468
4790 * self.b = <bam1_t*>calloc(1, sizeof(bam1_t))
4792 * def _isOpen( self ): # <<<<<<<<<<<<<<
4793 * '''return true if samfile has been opened.'''
4794 * return self.samfile != NULL
4797 static PyObject *__pyx_pf_9csamtools_7Samfile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
4798 static char __pyx_doc_9csamtools_7Samfile_1_isOpen[] = "Samfile._isOpen(self)\nreturn true if samfile has been opened.";
4799 static PyObject *__pyx_pf_9csamtools_7Samfile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4800 PyObject *__pyx_r = NULL;
4801 PyObject *__pyx_t_1 = NULL;
4802 __Pyx_TraceDeclarations
4803 __Pyx_RefNannySetupContext("_isOpen");
4804 __Pyx_TraceCall("_isOpen", __pyx_f[0], 468);
4806 /* "csamtools.pyx":470
4807 * def _isOpen( self ):
4808 * '''return true if samfile has been opened.'''
4809 * return self.samfile != NULL # <<<<<<<<<<<<<<
4811 * def _hasIndex( self ):
4813 __Pyx_XDECREF(__pyx_r);
4814 __pyx_t_1 = __Pyx_PyBool_FromLong((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4815 __Pyx_GOTREF(__pyx_t_1);
4816 __pyx_r = __pyx_t_1;
4820 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4823 __Pyx_XDECREF(__pyx_t_1);
4824 __Pyx_AddTraceback("csamtools.Samfile._isOpen");
4827 __Pyx_XGIVEREF(__pyx_r);
4828 __Pyx_TraceReturn(__pyx_r);
4829 __Pyx_RefNannyFinishContext();
4833 /* "csamtools.pyx":472
4834 * return self.samfile != NULL
4836 * def _hasIndex( self ): # <<<<<<<<<<<<<<
4837 * '''return true if samfile has an existing (and opened) index.'''
4838 * return self.index != NULL
4841 static PyObject *__pyx_pf_9csamtools_7Samfile_2_hasIndex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
4842 static char __pyx_doc_9csamtools_7Samfile_2_hasIndex[] = "Samfile._hasIndex(self)\nreturn true if samfile has an existing (and opened) index.";
4843 static PyObject *__pyx_pf_9csamtools_7Samfile_2_hasIndex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4844 PyObject *__pyx_r = NULL;
4845 PyObject *__pyx_t_1 = NULL;
4846 __Pyx_TraceDeclarations
4847 __Pyx_RefNannySetupContext("_hasIndex");
4848 __Pyx_TraceCall("_hasIndex", __pyx_f[0], 472);
4850 /* "csamtools.pyx":474
4851 * def _hasIndex( self ):
4852 * '''return true if samfile has an existing (and opened) index.'''
4853 * return self.index != NULL # <<<<<<<<<<<<<<
4857 __Pyx_XDECREF(__pyx_r);
4858 __pyx_t_1 = __Pyx_PyBool_FromLong((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4859 __Pyx_GOTREF(__pyx_t_1);
4860 __pyx_r = __pyx_t_1;
4864 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4867 __Pyx_XDECREF(__pyx_t_1);
4868 __Pyx_AddTraceback("csamtools.Samfile._hasIndex");
4871 __Pyx_XGIVEREF(__pyx_r);
4872 __Pyx_TraceReturn(__pyx_r);
4873 __Pyx_RefNannyFinishContext();
4877 /* "csamtools.pyx":476
4878 * return self.index != NULL
4880 * def _open( self, # <<<<<<<<<<<<<<
4885 static PyObject *__pyx_pf_9csamtools_7Samfile_3_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4886 static char __pyx_doc_9csamtools_7Samfile_3_open[] = "Samfile._open(self, char *filename, mode=None, Samfile template=None, referencenames=None, referencelengths=None, text=None, header=None, port=None, add_sq_text=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 ";
4887 static PyObject *__pyx_pf_9csamtools_7Samfile_3_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4888 char *__pyx_v_filename;
4889 PyObject *__pyx_v_mode = 0;
4890 struct __pyx_obj_9csamtools_Samfile *__pyx_v_template = 0;
4891 PyObject *__pyx_v_referencenames = 0;
4892 PyObject *__pyx_v_referencelengths = 0;
4893 PyObject *__pyx_v_text = 0;
4894 PyObject *__pyx_v_header = 0;
4895 PyObject *__pyx_v_port = 0;
4896 PyObject *__pyx_v_add_sq_text = 0;
4897 PyObject *__pyx_v_msg;
4898 bam_header_t *__pyx_v_header_to_write;
4899 char *__pyx_v_ctext;
4900 PyObject *__pyx_v_n;
4901 PyObject *__pyx_v_x;
4902 PyObject *__pyx_v_name;
4903 PyObject *__pyx_v_store;
4904 PyObject *__pyx_r = NULL;
4906 PyObject *__pyx_t_2 = NULL;
4907 PyObject *__pyx_t_3 = NULL;
4908 PyObject *__pyx_t_4 = NULL;
4909 PyObject *__pyx_t_5 = NULL;
4913 Py_ssize_t __pyx_t_9;
4914 Py_ssize_t __pyx_t_10;
4918 uint32_t __pyx_t_14;
4921 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,0};
4922 __Pyx_TraceDeclarations
4923 __Pyx_RefNannySetupContext("_open");
4924 __Pyx_TraceCall("_open", __pyx_f[0], 476);
4925 if (unlikely(__pyx_kwds)) {
4926 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
4927 PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
4929 /* "csamtools.pyx":478
4932 * mode = None, # <<<<<<<<<<<<<<
4933 * Samfile template = None,
4934 * referencenames = None,
4936 values[1] = ((PyObject *)Py_None);
4938 /* "csamtools.pyx":479
4941 * Samfile template = None, # <<<<<<<<<<<<<<
4942 * referencenames = None,
4943 * referencelengths = None,
4945 values[2] = (PyObject *)((struct __pyx_obj_9csamtools_Samfile *)Py_None);
4947 /* "csamtools.pyx":480
4949 * Samfile template = None,
4950 * referencenames = None, # <<<<<<<<<<<<<<
4951 * referencelengths = None,
4954 values[3] = ((PyObject *)Py_None);
4956 /* "csamtools.pyx":481
4957 * Samfile template = None,
4958 * referencenames = None,
4959 * referencelengths = None, # <<<<<<<<<<<<<<
4963 values[4] = ((PyObject *)Py_None);
4965 /* "csamtools.pyx":482
4966 * referencenames = None,
4967 * referencelengths = None,
4968 * text = None, # <<<<<<<<<<<<<<
4972 values[5] = ((PyObject *)Py_None);
4974 /* "csamtools.pyx":483
4975 * referencelengths = None,
4977 * header = None, # <<<<<<<<<<<<<<
4979 * add_sq_text = True,
4981 values[6] = ((PyObject *)Py_None);
4983 /* "csamtools.pyx":484
4986 * port = None, # <<<<<<<<<<<<<<
4987 * add_sq_text = True,
4990 values[7] = ((PyObject *)Py_None);
4991 values[8] = __pyx_k_16;
4992 switch (PyTuple_GET_SIZE(__pyx_args)) {
4993 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
4994 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
4995 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
4996 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4997 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4998 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4999 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5000 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5001 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5003 default: goto __pyx_L5_argtuple_error;
5005 switch (PyTuple_GET_SIZE(__pyx_args)) {
5007 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
5008 if (likely(values[0])) kw_args--;
5009 else goto __pyx_L5_argtuple_error;
5012 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode);
5013 if (value) { values[1] = value; kw_args--; }
5017 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__template);
5018 if (value) { values[2] = value; kw_args--; }
5022 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__referencenames);
5023 if (value) { values[3] = value; kw_args--; }
5027 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__referencelengths);
5028 if (value) { values[4] = value; kw_args--; }
5032 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__text);
5033 if (value) { values[5] = value; kw_args--; }
5037 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__header);
5038 if (value) { values[6] = value; kw_args--; }
5042 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__port);
5043 if (value) { values[7] = value; kw_args--; }
5047 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__add_sq_text);
5048 if (value) { values[8] = value; kw_args--; }
5051 if (unlikely(kw_args > 0)) {
5052 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_open") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5054 __pyx_v_filename = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5055 __pyx_v_mode = values[1];
5056 __pyx_v_template = ((struct __pyx_obj_9csamtools_Samfile *)values[2]);
5057 __pyx_v_referencenames = values[3];
5058 __pyx_v_referencelengths = values[4];
5059 __pyx_v_text = values[5];
5060 __pyx_v_header = values[6];
5061 __pyx_v_port = values[7];
5062 __pyx_v_add_sq_text = values[8];
5065 /* "csamtools.pyx":478
5068 * mode = None, # <<<<<<<<<<<<<<
5069 * Samfile template = None,
5070 * referencenames = None,
5072 __pyx_v_mode = ((PyObject *)Py_None);
5074 /* "csamtools.pyx":479
5077 * Samfile template = None, # <<<<<<<<<<<<<<
5078 * referencenames = None,
5079 * referencelengths = None,
5081 __pyx_v_template = ((struct __pyx_obj_9csamtools_Samfile *)Py_None);
5083 /* "csamtools.pyx":480
5085 * Samfile template = None,
5086 * referencenames = None, # <<<<<<<<<<<<<<
5087 * referencelengths = None,
5090 __pyx_v_referencenames = ((PyObject *)Py_None);
5092 /* "csamtools.pyx":481
5093 * Samfile template = None,
5094 * referencenames = None,
5095 * referencelengths = None, # <<<<<<<<<<<<<<
5099 __pyx_v_referencelengths = ((PyObject *)Py_None);
5101 /* "csamtools.pyx":482
5102 * referencenames = None,
5103 * referencelengths = None,
5104 * text = None, # <<<<<<<<<<<<<<
5108 __pyx_v_text = ((PyObject *)Py_None);
5110 /* "csamtools.pyx":483
5111 * referencelengths = None,
5113 * header = None, # <<<<<<<<<<<<<<
5115 * add_sq_text = True,
5117 __pyx_v_header = ((PyObject *)Py_None);
5119 /* "csamtools.pyx":484
5122 * port = None, # <<<<<<<<<<<<<<
5123 * add_sq_text = True,
5126 __pyx_v_port = ((PyObject *)Py_None);
5127 __pyx_v_add_sq_text = __pyx_k_16;
5128 switch (PyTuple_GET_SIZE(__pyx_args)) {
5129 case 9: __pyx_v_add_sq_text = PyTuple_GET_ITEM(__pyx_args, 8);
5130 case 8: __pyx_v_port = PyTuple_GET_ITEM(__pyx_args, 7);
5131 case 7: __pyx_v_header = PyTuple_GET_ITEM(__pyx_args, 6);
5132 case 6: __pyx_v_text = PyTuple_GET_ITEM(__pyx_args, 5);
5133 case 5: __pyx_v_referencelengths = PyTuple_GET_ITEM(__pyx_args, 4);
5134 case 4: __pyx_v_referencenames = PyTuple_GET_ITEM(__pyx_args, 3);
5135 case 3: __pyx_v_template = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 2));
5136 case 2: __pyx_v_mode = PyTuple_GET_ITEM(__pyx_args, 1);
5137 case 1: __pyx_v_filename = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5139 default: goto __pyx_L5_argtuple_error;
5142 goto __pyx_L4_argument_unpacking_done;
5143 __pyx_L5_argtuple_error:;
5144 __Pyx_RaiseArgtupleInvalid("_open", 0, 1, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5146 __Pyx_AddTraceback("csamtools.Samfile._open");
5147 __Pyx_RefNannyFinishContext();
5149 __pyx_L4_argument_unpacking_done:;
5150 __Pyx_INCREF(__pyx_v_text);
5151 __pyx_v_msg = Py_None; __Pyx_INCREF(Py_None);
5152 __pyx_v_n = Py_None; __Pyx_INCREF(Py_None);
5153 __pyx_v_x = Py_None; __Pyx_INCREF(Py_None);
5154 __pyx_v_name = Py_None; __Pyx_INCREF(Py_None);
5155 __pyx_v_store = Py_None; __Pyx_INCREF(Py_None);
5156 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_template), __pyx_ptype_9csamtools_Samfile, 1, "template", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5158 /* "csamtools.pyx":494
5160 * # read mode autodetection
5161 * if mode is None: # <<<<<<<<<<<<<<
5163 * self._open(filename, 'rb', template=template,
5165 __pyx_t_1 = (__pyx_v_mode == Py_None);
5168 /* "csamtools.pyx":495
5169 * # read mode autodetection
5171 * try: # <<<<<<<<<<<<<<
5172 * self._open(filename, 'rb', template=template,
5173 * referencenames=referencenames,
5176 PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
5177 __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
5178 __Pyx_XGOTREF(__pyx_save_exc_type);
5179 __Pyx_XGOTREF(__pyx_save_exc_value);
5180 __Pyx_XGOTREF(__pyx_save_exc_tb);
5183 /* "csamtools.pyx":496
5186 * self._open(filename, 'rb', template=template, # <<<<<<<<<<<<<<
5187 * referencenames=referencenames,
5188 * referencelengths=referencelengths,
5190 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
5191 __Pyx_GOTREF(__pyx_t_2);
5192 __pyx_t_3 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
5193 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
5194 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
5195 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
5196 PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
5197 __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
5198 __Pyx_INCREF(((PyObject *)__pyx_n_s__rb));
5199 PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__rb));
5200 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rb));
5202 __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
5203 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
5204 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__template), ((PyObject *)__pyx_v_template)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
5206 /* "csamtools.pyx":497
5208 * self._open(filename, 'rb', template=template,
5209 * referencenames=referencenames, # <<<<<<<<<<<<<<
5210 * referencelengths=referencelengths,
5211 * text=text, header=header, port=port)
5213 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__referencenames), __pyx_v_referencenames) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
5215 /* "csamtools.pyx":498
5216 * self._open(filename, 'rb', template=template,
5217 * referencenames=referencenames,
5218 * referencelengths=referencelengths, # <<<<<<<<<<<<<<
5219 * text=text, header=header, port=port)
5222 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__referencelengths), __pyx_v_referencelengths) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
5224 /* "csamtools.pyx":499
5225 * referencenames=referencenames,
5226 * referencelengths=referencelengths,
5227 * text=text, header=header, port=port) # <<<<<<<<<<<<<<
5229 * except ValueError, msg:
5231 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__text), __pyx_v_text) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
5232 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__header), __pyx_v_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
5233 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__port), __pyx_v_port) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
5234 __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
5235 __Pyx_GOTREF(__pyx_t_5);
5236 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5237 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
5238 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
5239 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5241 /* "csamtools.pyx":500
5242 * referencelengths=referencelengths,
5243 * text=text, header=header, port=port)
5244 * return # <<<<<<<<<<<<<<
5245 * except ValueError, msg:
5248 __Pyx_XDECREF(__pyx_r);
5249 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5250 goto __pyx_L11_try_return;
5252 __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
5253 __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
5254 __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
5255 goto __pyx_L14_try_end;
5256 __pyx_L11_try_return:;
5257 __Pyx_XGIVEREF(__pyx_save_exc_type);
5258 __Pyx_XGIVEREF(__pyx_save_exc_value);
5259 __Pyx_XGIVEREF(__pyx_save_exc_tb);
5260 __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
5263 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5264 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5265 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5266 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5268 /* "csamtools.pyx":501
5269 * text=text, header=header, port=port)
5271 * except ValueError, msg: # <<<<<<<<<<<<<<
5275 __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
5277 __Pyx_AddTraceback("csamtools.Samfile._open");
5278 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
5279 __Pyx_GOTREF(__pyx_t_5);
5280 __Pyx_GOTREF(__pyx_t_3);
5281 __Pyx_GOTREF(__pyx_t_4);
5282 __Pyx_INCREF(__pyx_t_3);
5283 __Pyx_DECREF(__pyx_v_msg);
5284 __pyx_v_msg = __pyx_t_3;
5285 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5286 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5287 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5288 goto __pyx_L8_exception_handled;
5290 __pyx_L9_except_error:;
5291 __Pyx_XGIVEREF(__pyx_save_exc_type);
5292 __Pyx_XGIVEREF(__pyx_save_exc_value);
5293 __Pyx_XGIVEREF(__pyx_save_exc_tb);
5294 __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
5295 goto __pyx_L1_error;
5296 __pyx_L8_exception_handled:;
5297 __Pyx_XGIVEREF(__pyx_save_exc_type);
5298 __Pyx_XGIVEREF(__pyx_save_exc_value);
5299 __Pyx_XGIVEREF(__pyx_save_exc_tb);
5300 __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
5304 /* "csamtools.pyx":504
5307 * self._open(filename, 'r', template=template, # <<<<<<<<<<<<<<
5308 * referencenames=referencenames,
5309 * referencelengths=referencelengths,
5311 __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5312 __Pyx_GOTREF(__pyx_t_4);
5313 __pyx_t_3 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5314 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
5315 __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5316 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
5317 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3));
5318 __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
5319 __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
5320 PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__r));
5321 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
5323 __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5324 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
5325 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__template), ((PyObject *)__pyx_v_template)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5327 /* "csamtools.pyx":505
5329 * self._open(filename, 'r', template=template,
5330 * referencenames=referencenames, # <<<<<<<<<<<<<<
5331 * referencelengths=referencelengths,
5332 * text=text, header=header, port=port)
5334 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__referencenames), __pyx_v_referencenames) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5336 /* "csamtools.pyx":506
5337 * self._open(filename, 'r', template=template,
5338 * referencenames=referencenames,
5339 * referencelengths=referencelengths, # <<<<<<<<<<<<<<
5340 * text=text, header=header, port=port)
5343 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__referencelengths), __pyx_v_referencelengths) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5345 /* "csamtools.pyx":507
5346 * referencenames=referencenames,
5347 * referencelengths=referencelengths,
5348 * text=text, header=header, port=port) # <<<<<<<<<<<<<<
5352 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__text), __pyx_v_text) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5353 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__header), __pyx_v_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5354 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__port), __pyx_v_port) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5355 __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5356 __Pyx_GOTREF(__pyx_t_2);
5357 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5358 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
5359 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
5360 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5362 /* "csamtools.pyx":508
5363 * referencelengths=referencelengths,
5364 * text=text, header=header, port=port)
5365 * return # <<<<<<<<<<<<<<
5367 * assert mode in ( "r","w","rb","wb", "wh", "wbu", "rU" ), "invalid file opening mode `%s`" % mode
5369 __Pyx_XDECREF(__pyx_r);
5370 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5376 /* "csamtools.pyx":510
5379 * assert mode in ( "r","w","rb","wb", "wh", "wbu", "rU" ), "invalid file opening mode `%s`" % mode # <<<<<<<<<<<<<<
5380 * assert filename != NULL
5383 #ifndef CYTHON_WITHOUT_ASSERTIONS
5384 __Pyx_INCREF(__pyx_v_mode);
5385 __pyx_t_2 = __pyx_v_mode;
5386 __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5387 __Pyx_GOTREF(__pyx_t_3);
5388 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5389 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5390 __pyx_t_7 = __pyx_t_1;
5392 __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__w), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5393 __Pyx_GOTREF(__pyx_t_3);
5394 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5395 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5396 __pyx_t_8 = __pyx_t_1;
5397 __pyx_t_1 = __pyx_t_8;
5399 __pyx_t_1 = __pyx_t_7;
5402 __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__rb), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5403 __Pyx_GOTREF(__pyx_t_3);
5404 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5405 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5406 __pyx_t_8 = __pyx_t_7;
5407 __pyx_t_7 = __pyx_t_8;
5409 __pyx_t_7 = __pyx_t_1;
5412 __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__wb), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5413 __Pyx_GOTREF(__pyx_t_3);
5414 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5415 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5416 __pyx_t_8 = __pyx_t_1;
5417 __pyx_t_1 = __pyx_t_8;
5419 __pyx_t_1 = __pyx_t_7;
5422 __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__wh), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5423 __Pyx_GOTREF(__pyx_t_3);
5424 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5425 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5426 __pyx_t_8 = __pyx_t_7;
5427 __pyx_t_7 = __pyx_t_8;
5429 __pyx_t_7 = __pyx_t_1;
5432 __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__wbu), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5433 __Pyx_GOTREF(__pyx_t_3);
5434 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5435 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5436 __pyx_t_8 = __pyx_t_1;
5437 __pyx_t_1 = __pyx_t_8;
5439 __pyx_t_1 = __pyx_t_7;
5442 __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__rU), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5443 __Pyx_GOTREF(__pyx_t_3);
5444 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5445 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5446 __pyx_t_8 = __pyx_t_7;
5447 __pyx_t_7 = __pyx_t_8;
5449 __pyx_t_7 = __pyx_t_1;
5451 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5452 if (unlikely(!__pyx_t_7)) {
5453 __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_v_mode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5454 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
5455 PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_2));
5456 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
5457 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5461 /* "csamtools.pyx":511
5463 * assert mode in ( "r","w","rb","wb", "wh", "wbu", "rU" ), "invalid file opening mode `%s`" % mode
5464 * assert filename != NULL # <<<<<<<<<<<<<<
5466 * # close a previously opened file
5468 #ifndef CYTHON_WITHOUT_ASSERTIONS
5469 if (unlikely(!(__pyx_v_filename != NULL))) {
5470 PyErr_SetNone(PyExc_AssertionError);
5471 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5475 /* "csamtools.pyx":514
5477 * # close a previously opened file
5478 * if self.samfile != NULL: self.close() # <<<<<<<<<<<<<<
5479 * self.samfile = NULL
5482 __pyx_t_7 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile != NULL);
5484 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5485 __Pyx_GOTREF(__pyx_t_2);
5486 __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 = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5487 __Pyx_GOTREF(__pyx_t_3);
5488 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5489 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5494 /* "csamtools.pyx":515
5495 * # close a previously opened file
5496 * if self.samfile != NULL: self.close()
5497 * self.samfile = NULL # <<<<<<<<<<<<<<
5499 * cdef bam_header_t * header_to_write
5501 ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = NULL;
5503 /* "csamtools.pyx":518
5505 * cdef bam_header_t * header_to_write
5506 * header_to_write = NULL # <<<<<<<<<<<<<<
5508 * if self._filename != NULL: free(self._filename )
5510 __pyx_v_header_to_write = NULL;
5512 /* "csamtools.pyx":520
5513 * header_to_write = NULL
5515 * if self._filename != NULL: free(self._filename ) # <<<<<<<<<<<<<<
5516 * self._filename = strdup( filename )
5517 * self.isstream = strcmp( filename, "-" ) == 0
5519 __pyx_t_7 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename != NULL);
5521 free(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename);
5526 /* "csamtools.pyx":521
5528 * if self._filename != NULL: free(self._filename )
5529 * self._filename = strdup( filename ) # <<<<<<<<<<<<<<
5530 * self.isstream = strcmp( filename, "-" ) == 0
5533 ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename = strdup(__pyx_v_filename);
5535 /* "csamtools.pyx":522
5536 * if self._filename != NULL: free(self._filename )
5537 * self._filename = strdup( filename )
5538 * self.isstream = strcmp( filename, "-" ) == 0 # <<<<<<<<<<<<<<
5540 * self.isbam = len(mode) > 1 and mode[1] == 'b'
5542 ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream = (strcmp(__pyx_v_filename, __pyx_k_18) == 0);
5544 /* "csamtools.pyx":524
5545 * self.isstream = strcmp( filename, "-" ) == 0
5547 * self.isbam = len(mode) > 1 and mode[1] == 'b' # <<<<<<<<<<<<<<
5549 * self.isremote = strncmp(filename,"http:",5) == 0 or \
5551 __pyx_t_9 = PyObject_Length(__pyx_v_mode); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5552 __pyx_t_3 = __Pyx_PyBool_FromLong((__pyx_t_9 > 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5553 __Pyx_GOTREF(__pyx_t_3);
5554 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5556 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5557 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5558 __Pyx_GOTREF(__pyx_t_2);
5559 __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__b), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5560 __Pyx_GOTREF(__pyx_t_5);
5561 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5562 __pyx_t_2 = __pyx_t_5;
5565 __pyx_t_2 = __pyx_t_3;
5568 __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5569 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5570 ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam = __pyx_t_6;
5572 /* "csamtools.pyx":526
5573 * self.isbam = len(mode) > 1 and mode[1] == 'b'
5575 * self.isremote = strncmp(filename,"http:",5) == 0 or \ # <<<<<<<<<<<<<<
5576 * strncmp(filename,"ftp:",4) == 0
5579 __pyx_t_7 = (strncmp(__pyx_v_filename, __pyx_k_19, 5) == 0);
5582 /* "csamtools.pyx":527
5584 * self.isremote = strncmp(filename,"http:",5) == 0 or \
5585 * strncmp(filename,"ftp:",4) == 0 # <<<<<<<<<<<<<<
5589 __pyx_t_1 = (strncmp(__pyx_v_filename, __pyx_k_20, 4) == 0);
5590 __pyx_t_8 = __pyx_t_1;
5592 __pyx_t_8 = __pyx_t_7;
5595 /* "csamtools.pyx":526
5596 * self.isbam = len(mode) > 1 and mode[1] == 'b'
5598 * self.isremote = strncmp(filename,"http:",5) == 0 or \ # <<<<<<<<<<<<<<
5599 * strncmp(filename,"ftp:",4) == 0
5602 ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote = __pyx_t_8;
5604 /* "csamtools.pyx":530
5607 * ctext = NULL # <<<<<<<<<<<<<<
5609 * if mode[0] == 'w':
5611 __pyx_v_ctext = NULL;
5613 /* "csamtools.pyx":532
5616 * if mode[0] == 'w': # <<<<<<<<<<<<<<
5617 * # open file for writing
5620 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5621 __Pyx_GOTREF(__pyx_t_2);
5622 __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__w), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5623 __Pyx_GOTREF(__pyx_t_3);
5624 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5625 __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5626 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5629 /* "csamtools.pyx":536
5631 * # header structure (used for writing)
5632 * if template: # <<<<<<<<<<<<<<
5633 * # copy header from another file
5634 * header_to_write = template.samfile.header
5636 __pyx_t_8 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_template)); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5639 /* "csamtools.pyx":538
5641 * # copy header from another file
5642 * header_to_write = template.samfile.header # <<<<<<<<<<<<<<
5646 __pyx_v_header_to_write = __pyx_v_template->samfile->header;
5650 /* "csamtools.pyx":540
5651 * header_to_write = template.samfile.header
5653 * elif header: # <<<<<<<<<<<<<<
5654 * header_to_write = self._buildHeader( header )
5657 __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_header); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5660 /* "csamtools.pyx":541
5663 * header_to_write = self._buildHeader( header ) # <<<<<<<<<<<<<<
5667 __pyx_v_header_to_write = ((struct __pyx_vtabstruct_9csamtools_Samfile *)((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->__pyx_vtab)->_buildHeader(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_header);
5672 /* "csamtools.pyx":545
5674 * # build header from a target names and lengths
5675 * assert referencenames and referencelengths, "either supply options `template`, `header` or both `referencenames` and `referencelengths` for writing" # <<<<<<<<<<<<<<
5676 * assert len(referencenames) == len(referencelengths), "unequal names and lengths of reference sequences"
5679 #ifndef CYTHON_WITHOUT_ASSERTIONS
5680 __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_referencenames); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5682 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_referencelengths); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5683 __pyx_t_1 = __pyx_t_7;
5685 __pyx_t_1 = __pyx_t_8;
5687 if (unlikely(!__pyx_t_1)) {
5688 PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_21));
5689 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5693 /* "csamtools.pyx":546
5694 * # build header from a target names and lengths
5695 * assert referencenames and referencelengths, "either supply options `template`, `header` or both `referencenames` and `referencelengths` for writing"
5696 * assert len(referencenames) == len(referencelengths), "unequal names and lengths of reference sequences" # <<<<<<<<<<<<<<
5698 * # allocate and fill header
5700 #ifndef CYTHON_WITHOUT_ASSERTIONS
5701 __pyx_t_9 = PyObject_Length(__pyx_v_referencenames); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5702 __pyx_t_10 = PyObject_Length(__pyx_v_referencelengths); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5703 if (unlikely(!(__pyx_t_9 == __pyx_t_10))) {
5704 PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_22));
5705 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5709 /* "csamtools.pyx":549
5711 * # allocate and fill header
5712 * header_to_write = bam_header_init() # <<<<<<<<<<<<<<
5713 * header_to_write.n_targets = len(referencenames)
5716 __pyx_v_header_to_write = bam_header_init();
5718 /* "csamtools.pyx":550
5719 * # allocate and fill header
5720 * header_to_write = bam_header_init()
5721 * header_to_write.n_targets = len(referencenames) # <<<<<<<<<<<<<<
5723 * for x in referencenames: n += len(x) + 1
5725 __pyx_t_10 = PyObject_Length(__pyx_v_referencenames); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5726 __pyx_v_header_to_write->n_targets = __pyx_t_10;
5728 /* "csamtools.pyx":551
5729 * header_to_write = bam_header_init()
5730 * header_to_write.n_targets = len(referencenames)
5731 * n = 0 # <<<<<<<<<<<<<<
5732 * for x in referencenames: n += len(x) + 1
5733 * header_to_write.target_name = <char**>calloc(n, sizeof(char*))
5735 __Pyx_INCREF(__pyx_int_0);
5736 __Pyx_DECREF(__pyx_v_n);
5737 __pyx_v_n = __pyx_int_0;
5739 /* "csamtools.pyx":552
5740 * header_to_write.n_targets = len(referencenames)
5742 * for x in referencenames: n += len(x) + 1 # <<<<<<<<<<<<<<
5743 * header_to_write.target_name = <char**>calloc(n, sizeof(char*))
5744 * header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
5746 if (PyList_CheckExact(__pyx_v_referencenames) || PyTuple_CheckExact(__pyx_v_referencenames)) {
5747 __pyx_t_10 = 0; __pyx_t_3 = __pyx_v_referencenames; __Pyx_INCREF(__pyx_t_3);
5749 __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_referencenames); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5750 __Pyx_GOTREF(__pyx_t_3);
5753 if (likely(PyList_CheckExact(__pyx_t_3))) {
5754 if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break;
5755 __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_2); __pyx_t_10++;
5756 } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
5757 if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
5758 __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_2); __pyx_t_10++;
5760 __pyx_t_2 = PyIter_Next(__pyx_t_3);
5762 if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5765 __Pyx_GOTREF(__pyx_t_2);
5767 __Pyx_DECREF(__pyx_v_x);
5768 __pyx_v_x = __pyx_t_2;
5770 __pyx_t_9 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5771 __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_9 + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5772 __Pyx_GOTREF(__pyx_t_2);
5773 __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_n, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5774 __Pyx_GOTREF(__pyx_t_5);
5775 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5776 __Pyx_DECREF(__pyx_v_n);
5777 __pyx_v_n = __pyx_t_5;
5780 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5782 /* "csamtools.pyx":553
5784 * for x in referencenames: n += len(x) + 1
5785 * header_to_write.target_name = <char**>calloc(n, sizeof(char*)) # <<<<<<<<<<<<<<
5786 * header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
5787 * for x from 0 <= x < header_to_write.n_targets:
5789 __pyx_t_11 = __Pyx_PyInt_AsSize_t(__pyx_v_n); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5790 __pyx_v_header_to_write->target_name = ((char **)calloc(__pyx_t_11, (sizeof(char *))));
5792 /* "csamtools.pyx":554
5793 * for x in referencenames: n += len(x) + 1
5794 * header_to_write.target_name = <char**>calloc(n, sizeof(char*))
5795 * header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t)) # <<<<<<<<<<<<<<
5796 * for x from 0 <= x < header_to_write.n_targets:
5797 * header_to_write.target_len[x] = referencelengths[x]
5799 __pyx_t_11 = __Pyx_PyInt_AsSize_t(__pyx_v_n); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5800 __pyx_v_header_to_write->target_len = ((uint32_t *)calloc(__pyx_t_11, (sizeof(uint32_t))));
5802 /* "csamtools.pyx":555
5803 * header_to_write.target_name = <char**>calloc(n, sizeof(char*))
5804 * header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
5805 * for x from 0 <= x < header_to_write.n_targets: # <<<<<<<<<<<<<<
5806 * header_to_write.target_len[x] = referencelengths[x]
5807 * name = referencenames[x]
5809 __pyx_t_12 = __pyx_v_header_to_write->n_targets;
5810 for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13++) {
5811 __pyx_t_3 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5812 __Pyx_GOTREF(__pyx_t_3);
5813 __Pyx_DECREF(__pyx_v_x);
5814 __pyx_v_x = __pyx_t_3;
5817 /* "csamtools.pyx":556
5818 * header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
5819 * for x from 0 <= x < header_to_write.n_targets:
5820 * header_to_write.target_len[x] = referencelengths[x] # <<<<<<<<<<<<<<
5821 * name = referencenames[x]
5822 * header_to_write.target_name[x] = <char*>calloc(len(name)+1, sizeof(char))
5824 __pyx_t_3 = PyObject_GetItem(__pyx_v_referencelengths, __pyx_v_x); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5825 __Pyx_GOTREF(__pyx_t_3);
5826 __pyx_t_14 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_3); if (unlikely((__pyx_t_14 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5827 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5828 __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5829 (__pyx_v_header_to_write->target_len[__pyx_t_10]) = __pyx_t_14;
5831 /* "csamtools.pyx":557
5832 * for x from 0 <= x < header_to_write.n_targets:
5833 * header_to_write.target_len[x] = referencelengths[x]
5834 * name = referencenames[x] # <<<<<<<<<<<<<<
5835 * header_to_write.target_name[x] = <char*>calloc(len(name)+1, sizeof(char))
5836 * strncpy( header_to_write.target_name[x], name, len(name) )
5838 __pyx_t_3 = PyObject_GetItem(__pyx_v_referencenames, __pyx_v_x); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5839 __Pyx_GOTREF(__pyx_t_3);
5840 __Pyx_DECREF(__pyx_v_name);
5841 __pyx_v_name = __pyx_t_3;
5844 /* "csamtools.pyx":558
5845 * header_to_write.target_len[x] = referencelengths[x]
5846 * name = referencenames[x]
5847 * header_to_write.target_name[x] = <char*>calloc(len(name)+1, sizeof(char)) # <<<<<<<<<<<<<<
5848 * strncpy( header_to_write.target_name[x], name, len(name) )
5851 __pyx_t_10 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5852 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5853 (__pyx_v_header_to_write->target_name[__pyx_t_9]) = ((char *)calloc((__pyx_t_10 + 1), (sizeof(char))));
5855 /* "csamtools.pyx":559
5856 * name = referencenames[x]
5857 * header_to_write.target_name[x] = <char*>calloc(len(name)+1, sizeof(char))
5858 * strncpy( header_to_write.target_name[x], name, len(name) ) # <<<<<<<<<<<<<<
5860 * # Optionally, if there is no text, add a SAM compatible header to output
5862 __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5863 __pyx_t_15 = PyBytes_AsString(__pyx_v_name); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5864 __pyx_t_9 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5865 strncpy((__pyx_v_header_to_write->target_name[__pyx_t_10]), __pyx_t_15, __pyx_t_9);
5866 __pyx_t_13 = __Pyx_PyInt_AsLong(__pyx_v_x); if (unlikely((__pyx_t_13 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5869 /* "csamtools.pyx":555
5870 * header_to_write.target_name = <char**>calloc(n, sizeof(char*))
5871 * header_to_write.target_len = <uint32_t*>calloc(n, sizeof(uint32_t))
5872 * for x from 0 <= x < header_to_write.n_targets: # <<<<<<<<<<<<<<
5873 * header_to_write.target_len[x] = referencelengths[x]
5874 * name = referencenames[x]
5876 __pyx_t_3 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5877 __Pyx_GOTREF(__pyx_t_3);
5878 __Pyx_DECREF(__pyx_v_x);
5879 __pyx_v_x = __pyx_t_3;
5882 /* "csamtools.pyx":563
5883 * # Optionally, if there is no text, add a SAM compatible header to output
5885 * if text is None and add_sq_text: # <<<<<<<<<<<<<<
5887 * for x from 0 <= x < header_to_write.n_targets:
5889 __pyx_t_1 = (__pyx_v_text == Py_None);
5891 __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_add_sq_text); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5892 __pyx_t_7 = __pyx_t_8;
5894 __pyx_t_7 = __pyx_t_1;
5898 /* "csamtools.pyx":564
5900 * if text is None and add_sq_text:
5901 * text = '' # <<<<<<<<<<<<<<
5902 * for x from 0 <= x < header_to_write.n_targets:
5903 * text += "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] )
5905 __Pyx_INCREF(((PyObject *)__pyx_kp_s_12));
5906 __Pyx_DECREF(__pyx_v_text);
5907 __pyx_v_text = ((PyObject *)__pyx_kp_s_12);
5909 /* "csamtools.pyx":565
5910 * if text is None and add_sq_text:
5912 * for x from 0 <= x < header_to_write.n_targets: # <<<<<<<<<<<<<<
5913 * text += "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] )
5916 __pyx_t_12 = __pyx_v_header_to_write->n_targets;
5917 for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13++) {
5918 __pyx_t_3 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5919 __Pyx_GOTREF(__pyx_t_3);
5920 __Pyx_DECREF(__pyx_v_x);
5921 __pyx_v_x = __pyx_t_3;
5924 /* "csamtools.pyx":566
5926 * for x from 0 <= x < header_to_write.n_targets:
5927 * text += "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] ) # <<<<<<<<<<<<<<
5931 __pyx_t_3 = PyObject_GetItem(__pyx_v_referencenames, __pyx_v_x); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5932 __Pyx_GOTREF(__pyx_t_3);
5933 __pyx_t_5 = PyObject_GetItem(__pyx_v_referencelengths, __pyx_v_x); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5934 __Pyx_GOTREF(__pyx_t_5);
5935 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5936 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
5937 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
5938 __Pyx_GIVEREF(__pyx_t_3);
5939 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
5940 __Pyx_GIVEREF(__pyx_t_5);
5943 __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5944 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
5945 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
5946 __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_text, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5947 __Pyx_GOTREF(__pyx_t_2);
5948 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
5949 __Pyx_DECREF(__pyx_v_text);
5950 __pyx_v_text = __pyx_t_2;
5952 __pyx_t_13 = __Pyx_PyInt_AsLong(__pyx_v_x); if (unlikely((__pyx_t_13 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5955 /* "csamtools.pyx":565
5956 * if text is None and add_sq_text:
5958 * for x from 0 <= x < header_to_write.n_targets: # <<<<<<<<<<<<<<
5959 * text += "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] )
5962 __pyx_t_2 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5963 __Pyx_GOTREF(__pyx_t_2);
5964 __Pyx_DECREF(__pyx_v_x);
5965 __pyx_v_x = __pyx_t_2;
5971 /* "csamtools.pyx":568
5972 * text += "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] )
5974 * if text != None: # <<<<<<<<<<<<<<
5978 __pyx_t_2 = PyObject_RichCompare(__pyx_v_text, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5979 __Pyx_GOTREF(__pyx_t_2);
5980 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5981 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5984 /* "csamtools.pyx":570
5987 * ctext = text # <<<<<<<<<<<<<<
5988 * header_to_write.l_text = strlen(ctext)
5989 * header_to_write.text = <char*>calloc( strlen(ctext), sizeof(char) )
5991 __pyx_t_15 = PyBytes_AsString(__pyx_v_text); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5992 __pyx_v_ctext = __pyx_t_15;
5994 /* "csamtools.pyx":571
5997 * header_to_write.l_text = strlen(ctext) # <<<<<<<<<<<<<<
5998 * header_to_write.text = <char*>calloc( strlen(ctext), sizeof(char) )
5999 * memcpy( header_to_write.text, ctext, strlen(ctext) )
6001 __pyx_v_header_to_write->l_text = strlen(__pyx_v_ctext);
6003 /* "csamtools.pyx":572
6005 * header_to_write.l_text = strlen(ctext)
6006 * header_to_write.text = <char*>calloc( strlen(ctext), sizeof(char) ) # <<<<<<<<<<<<<<
6007 * memcpy( header_to_write.text, ctext, strlen(ctext) )
6010 __pyx_v_header_to_write->text = ((char *)calloc(strlen(__pyx_v_ctext), (sizeof(char))));
6012 /* "csamtools.pyx":573
6013 * header_to_write.l_text = strlen(ctext)
6014 * header_to_write.text = <char*>calloc( strlen(ctext), sizeof(char) )
6015 * memcpy( header_to_write.text, ctext, strlen(ctext) ) # <<<<<<<<<<<<<<
6017 * header_to_write.hash = NULL
6019 memcpy(__pyx_v_header_to_write->text, __pyx_v_ctext, strlen(__pyx_v_ctext));
6024 /* "csamtools.pyx":575
6025 * memcpy( header_to_write.text, ctext, strlen(ctext) )
6027 * header_to_write.hash = NULL # <<<<<<<<<<<<<<
6028 * header_to_write.rg2lib = NULL
6031 __pyx_v_header_to_write->hash = NULL;
6033 /* "csamtools.pyx":576
6035 * header_to_write.hash = NULL
6036 * header_to_write.rg2lib = NULL # <<<<<<<<<<<<<<
6038 * # open file. Header gets written to file at the same time for bam files
6040 __pyx_v_header_to_write->rg2lib = NULL;
6044 /* "csamtools.pyx":580
6045 * # open file. Header gets written to file at the same time for bam files
6046 * # and sam files (in the latter case, the mode needs to be wh)
6047 * store = StderrStore() # <<<<<<<<<<<<<<
6048 * self.samfile = samopen( filename, mode, header_to_write )
6051 __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6052 __Pyx_GOTREF(__pyx_t_2);
6053 __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6054 __Pyx_GOTREF(__pyx_t_5);
6055 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6056 __Pyx_DECREF(__pyx_v_store);
6057 __pyx_v_store = __pyx_t_5;
6060 /* "csamtools.pyx":581
6061 * # and sam files (in the latter case, the mode needs to be wh)
6062 * store = StderrStore()
6063 * self.samfile = samopen( filename, mode, header_to_write ) # <<<<<<<<<<<<<<
6067 __pyx_t_15 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6068 ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = samopen(__pyx_v_filename, __pyx_t_15, __pyx_v_header_to_write);
6070 /* "csamtools.pyx":582
6071 * store = StderrStore()
6072 * self.samfile = samopen( filename, mode, header_to_write )
6073 * store.release() # <<<<<<<<<<<<<<
6075 * # bam_header_destroy takes care of cleaning up of all the members
6077 __pyx_t_5 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6078 __Pyx_GOTREF(__pyx_t_5);
6079 __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 = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6080 __Pyx_GOTREF(__pyx_t_2);
6081 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6082 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6084 /* "csamtools.pyx":585
6086 * # bam_header_destroy takes care of cleaning up of all the members
6087 * if not template and header_to_write != NULL: # <<<<<<<<<<<<<<
6088 * bam_header_destroy( header_to_write )
6091 __pyx_t_7 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_template)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6092 __pyx_t_1 = (!__pyx_t_7);
6094 __pyx_t_7 = (__pyx_v_header_to_write != NULL);
6095 __pyx_t_8 = __pyx_t_7;
6097 __pyx_t_8 = __pyx_t_1;
6101 /* "csamtools.pyx":586
6102 * # bam_header_destroy takes care of cleaning up of all the members
6103 * if not template and header_to_write != NULL:
6104 * bam_header_destroy( header_to_write ) # <<<<<<<<<<<<<<
6106 * elif mode[0] == "r":
6108 bam_header_destroy(__pyx_v_header_to_write);
6115 /* "csamtools.pyx":588
6116 * bam_header_destroy( header_to_write )
6118 * elif mode[0] == "r": # <<<<<<<<<<<<<<
6119 * # open file for reading
6120 * if strncmp( filename, "-", 1) != 0 and \
6122 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6123 __Pyx_GOTREF(__pyx_t_2);
6124 __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6125 __Pyx_GOTREF(__pyx_t_5);
6126 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6127 __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6128 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6131 /* "csamtools.pyx":590
6132 * elif mode[0] == "r":
6133 * # open file for reading
6134 * if strncmp( filename, "-", 1) != 0 and \ # <<<<<<<<<<<<<<
6135 * not self.isremote and \
6136 * not os.path.exists( filename ):
6138 __pyx_t_8 = (strncmp(__pyx_v_filename, __pyx_k_18, 1) != 0);
6141 /* "csamtools.pyx":591
6142 * # open file for reading
6143 * if strncmp( filename, "-", 1) != 0 and \
6144 * not self.isremote and \ # <<<<<<<<<<<<<<
6145 * not os.path.exists( filename ):
6146 * raise IOError( "file `%s` not found" % filename)
6148 __pyx_t_1 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote);
6151 /* "csamtools.pyx":592
6152 * if strncmp( filename, "-", 1) != 0 and \
6153 * not self.isremote and \
6154 * not os.path.exists( filename ): # <<<<<<<<<<<<<<
6155 * raise IOError( "file `%s` not found" % filename)
6158 __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6159 __Pyx_GOTREF(__pyx_t_5);
6160 __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6161 __Pyx_GOTREF(__pyx_t_2);
6162 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6163 __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6164 __Pyx_GOTREF(__pyx_t_5);
6165 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6166 __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6167 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
6168 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6169 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
6170 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
6171 __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
6173 __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6174 __Pyx_GOTREF(__pyx_t_2);
6175 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6176 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
6177 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6178 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6179 __pyx_t_16 = (!__pyx_t_7);
6180 __pyx_t_7 = __pyx_t_16;
6182 __pyx_t_7 = __pyx_t_1;
6184 __pyx_t_1 = __pyx_t_7;
6186 __pyx_t_1 = __pyx_t_8;
6190 /* "csamtools.pyx":593
6191 * not self.isremote and \
6192 * not os.path.exists( filename ):
6193 * raise IOError( "file `%s` not found" % filename) # <<<<<<<<<<<<<<
6195 * # try to detect errors
6197 __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6198 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
6199 __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_24), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6200 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
6201 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
6202 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6203 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
6204 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
6205 __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
6207 __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 = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6208 __Pyx_GOTREF(__pyx_t_3);
6209 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
6210 __Pyx_Raise(__pyx_t_3, 0, 0);
6211 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6212 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6217 /* "csamtools.pyx":596
6219 * # try to detect errors
6220 * self.samfile = samopen( filename, mode, NULL ) # <<<<<<<<<<<<<<
6221 * if self.samfile == NULL:
6222 * raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode)
6224 __pyx_t_15 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6225 ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = samopen(__pyx_v_filename, __pyx_t_15, NULL);
6227 /* "csamtools.pyx":597
6228 * # try to detect errors
6229 * self.samfile = samopen( filename, mode, NULL )
6230 * if self.samfile == NULL: # <<<<<<<<<<<<<<
6231 * raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode)
6234 __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile == NULL);
6237 /* "csamtools.pyx":598
6238 * self.samfile = samopen( filename, mode, NULL )
6239 * if self.samfile == NULL:
6240 * raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode) # <<<<<<<<<<<<<<
6242 * if self.samfile.header == NULL:
6244 __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_25), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6245 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
6246 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6247 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
6248 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
6249 __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
6251 __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 = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6252 __Pyx_GOTREF(__pyx_t_3);
6253 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
6254 __Pyx_Raise(__pyx_t_3, 0, 0);
6255 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6256 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6261 /* "csamtools.pyx":600
6262 * raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode)
6264 * if self.samfile.header == NULL: # <<<<<<<<<<<<<<
6265 * raise ValueError( "file does not have valid header (mode='%s') - is it SAM/BAM format?" % mode )
6268 __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header == NULL);
6271 /* "csamtools.pyx":601
6273 * if self.samfile.header == NULL:
6274 * raise ValueError( "file does not have valid header (mode='%s') - is it SAM/BAM format?" % mode ) # <<<<<<<<<<<<<<
6276 * #disabled for autodetection to work
6278 __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_26), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6279 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
6280 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6281 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
6282 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
6283 __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
6285 __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 = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6286 __Pyx_GOTREF(__pyx_t_3);
6287 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
6288 __Pyx_Raise(__pyx_t_3, 0, 0);
6289 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6290 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6298 /* "csamtools.pyx":608
6299 * # raise ValueError( "file header is empty (mode='%s') - is it SAM/BAM format?" % mode)
6301 * if self.samfile == NULL: # <<<<<<<<<<<<<<
6302 * raise IOError("could not open file `%s`" % filename )
6305 __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile == NULL);
6308 /* "csamtools.pyx":609
6310 * if self.samfile == NULL:
6311 * raise IOError("could not open file `%s`" % filename ) # <<<<<<<<<<<<<<
6313 * # check for index and open if present
6315 __pyx_t_3 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6316 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
6317 __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6318 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
6319 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
6320 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6321 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
6322 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
6323 __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
6325 __pyx_t_2 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6326 __Pyx_GOTREF(__pyx_t_2);
6327 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
6328 __Pyx_Raise(__pyx_t_2, 0, 0);
6329 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6330 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6335 /* "csamtools.pyx":612
6337 * # check for index and open if present
6338 * if mode[0] == "r" and self.isbam: # <<<<<<<<<<<<<<
6340 * if not self.isremote:
6342 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6343 __Pyx_GOTREF(__pyx_t_2);
6344 __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6345 __Pyx_GOTREF(__pyx_t_3);
6346 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6347 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6348 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6350 __pyx_t_8 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam;
6352 __pyx_t_8 = __pyx_t_1;
6356 /* "csamtools.pyx":614
6357 * if mode[0] == "r" and self.isbam:
6359 * if not self.isremote: # <<<<<<<<<<<<<<
6360 * if not os.path.exists(filename +".bai"):
6363 __pyx_t_8 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote);
6366 /* "csamtools.pyx":615
6368 * if not self.isremote:
6369 * if not os.path.exists(filename +".bai"): # <<<<<<<<<<<<<<
6373 __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6374 __Pyx_GOTREF(__pyx_t_3);
6375 __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6376 __Pyx_GOTREF(__pyx_t_2);
6377 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6378 __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6379 __Pyx_GOTREF(__pyx_t_3);
6380 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6381 __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6382 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
6383 __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_kp_s_27)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6384 __Pyx_GOTREF(__pyx_t_5);
6385 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
6386 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6387 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
6388 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
6389 __Pyx_GIVEREF(__pyx_t_5);
6391 __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6392 __Pyx_GOTREF(__pyx_t_5);
6393 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6394 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
6395 __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6396 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6397 __pyx_t_1 = (!__pyx_t_8);
6400 /* "csamtools.pyx":616
6401 * if not self.isremote:
6402 * if not os.path.exists(filename +".bai"):
6403 * self.index = NULL # <<<<<<<<<<<<<<
6405 * # returns NULL if there is no index or index could not be opened
6407 ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index = NULL;
6412 /* "csamtools.pyx":619
6414 * # returns NULL if there is no index or index could not be opened
6415 * self.index = bam_index_load(filename) # <<<<<<<<<<<<<<
6416 * if self.index == NULL:
6417 * raise IOError("error while opening index `%s` " % filename )
6419 ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index = bam_index_load(__pyx_v_filename);
6421 /* "csamtools.pyx":620
6422 * # returns NULL if there is no index or index could not be opened
6423 * self.index = bam_index_load(filename)
6424 * if self.index == NULL: # <<<<<<<<<<<<<<
6425 * raise IOError("error while opening index `%s` " % filename )
6428 __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index == NULL);
6431 /* "csamtools.pyx":621
6432 * self.index = bam_index_load(filename)
6433 * if self.index == NULL:
6434 * raise IOError("error while opening index `%s` " % filename ) # <<<<<<<<<<<<<<
6436 * self.index = bam_index_load(filename)
6438 __pyx_t_5 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6439 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
6440 __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_28), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6441 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
6442 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
6443 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6444 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
6445 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2));
6446 __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
6448 __pyx_t_2 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6449 __Pyx_GOTREF(__pyx_t_2);
6450 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
6451 __Pyx_Raise(__pyx_t_2, 0, 0);
6452 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6453 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6463 /* "csamtools.pyx":623
6464 * raise IOError("error while opening index `%s` " % filename )
6466 * self.index = bam_index_load(filename) # <<<<<<<<<<<<<<
6467 * if self.index == NULL:
6468 * raise IOError("error while opening index `%s` " % filename )
6470 ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index = bam_index_load(__pyx_v_filename);
6472 /* "csamtools.pyx":624
6474 * self.index = bam_index_load(filename)
6475 * if self.index == NULL: # <<<<<<<<<<<<<<
6476 * raise IOError("error while opening index `%s` " % filename )
6479 __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index == NULL);
6482 /* "csamtools.pyx":625
6483 * self.index = bam_index_load(filename)
6484 * if self.index == NULL:
6485 * raise IOError("error while opening index `%s` " % filename ) # <<<<<<<<<<<<<<
6487 * if not self.isstream:
6489 __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6490 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
6491 __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_28), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6492 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
6493 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
6494 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6495 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
6496 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_5));
6497 __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
6499 __pyx_t_5 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6500 __Pyx_GOTREF(__pyx_t_5);
6501 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
6502 __Pyx_Raise(__pyx_t_5, 0, 0);
6503 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6504 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6511 /* "csamtools.pyx":627
6512 * raise IOError("error while opening index `%s` " % filename )
6514 * if not self.isstream: # <<<<<<<<<<<<<<
6515 * self.start_offset = bam_tell( self.samfile.x.bam )
6518 __pyx_t_1 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream);
6521 /* "csamtools.pyx":628
6523 * if not self.isstream:
6524 * self.start_offset = bam_tell( self.samfile.x.bam ) # <<<<<<<<<<<<<<
6526 * def gettid( self, reference ):
6528 ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->start_offset = bam_tell(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam);
6536 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6539 __Pyx_XDECREF(__pyx_t_2);
6540 __Pyx_XDECREF(__pyx_t_3);
6541 __Pyx_XDECREF(__pyx_t_4);
6542 __Pyx_XDECREF(__pyx_t_5);
6543 __Pyx_AddTraceback("csamtools.Samfile._open");
6546 __Pyx_DECREF(__pyx_v_msg);
6547 __Pyx_DECREF(__pyx_v_n);
6548 __Pyx_DECREF(__pyx_v_x);
6549 __Pyx_DECREF(__pyx_v_name);
6550 __Pyx_DECREF(__pyx_v_store);
6551 __Pyx_DECREF(__pyx_v_text);
6552 __Pyx_XGIVEREF(__pyx_r);
6553 __Pyx_TraceReturn(__pyx_r);
6554 __Pyx_RefNannyFinishContext();
6558 /* "csamtools.pyx":630
6559 * self.start_offset = bam_tell( self.samfile.x.bam )
6561 * def gettid( self, reference ): # <<<<<<<<<<<<<<
6563 * convert :term:`reference` name into numerical :term:`tid`
6566 static PyObject *__pyx_pf_9csamtools_7Samfile_4gettid(PyObject *__pyx_v_self, PyObject *__pyx_v_reference); /*proto*/
6567 static char __pyx_doc_9csamtools_7Samfile_4gettid[] = "Samfile.gettid(self, reference)\n\n convert :term:`reference` name into numerical :term:`tid`\n\n returns -1 if reference is not known.\n ";
6568 static PyObject *__pyx_pf_9csamtools_7Samfile_4gettid(PyObject *__pyx_v_self, PyObject *__pyx_v_reference) {
6569 PyObject *__pyx_r = NULL;
6570 PyObject *__pyx_t_1 = NULL;
6571 PyObject *__pyx_t_2 = NULL;
6575 __Pyx_TraceDeclarations
6576 __Pyx_RefNannySetupContext("gettid");
6577 __Pyx_TraceCall("gettid", __pyx_f[0], 630);
6579 /* "csamtools.pyx":636
6580 * returns -1 if reference is not known.
6582 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
6583 * return pysam_reference2tid( self.samfile.header, reference )
6586 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6587 __Pyx_GOTREF(__pyx_t_1);
6588 __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 = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6589 __Pyx_GOTREF(__pyx_t_2);
6590 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6591 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6592 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6593 __pyx_t_4 = (!__pyx_t_3);
6595 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6596 __Pyx_GOTREF(__pyx_t_2);
6597 __Pyx_Raise(__pyx_t_2, 0, 0);
6598 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6599 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6604 /* "csamtools.pyx":637
6606 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
6607 * return pysam_reference2tid( self.samfile.header, reference ) # <<<<<<<<<<<<<<
6609 * def getrname( self, tid ):
6611 __Pyx_XDECREF(__pyx_r);
6612 __pyx_t_5 = PyBytes_AsString(__pyx_v_reference); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6613 __pyx_t_2 = PyInt_FromLong(pysam_reference2tid(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header, __pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6614 __Pyx_GOTREF(__pyx_t_2);
6615 __pyx_r = __pyx_t_2;
6619 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6622 __Pyx_XDECREF(__pyx_t_1);
6623 __Pyx_XDECREF(__pyx_t_2);
6624 __Pyx_AddTraceback("csamtools.Samfile.gettid");
6627 __Pyx_XGIVEREF(__pyx_r);
6628 __Pyx_TraceReturn(__pyx_r);
6629 __Pyx_RefNannyFinishContext();
6633 /* "csamtools.pyx":639
6634 * return pysam_reference2tid( self.samfile.header, reference )
6636 * def getrname( self, tid ): # <<<<<<<<<<<<<<
6638 * convert numerical :term:`tid` into :term:`reference` name.'''
6641 static PyObject *__pyx_pf_9csamtools_7Samfile_5getrname(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
6642 static char __pyx_doc_9csamtools_7Samfile_5getrname[] = "Samfile.getrname(self, tid)\n\n convert numerical :term:`tid` into :term:`reference` name.";
6643 static PyObject *__pyx_pf_9csamtools_7Samfile_5getrname(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) {
6644 PyObject *__pyx_r = NULL;
6645 PyObject *__pyx_t_1 = NULL;
6646 PyObject *__pyx_t_2 = NULL;
6649 Py_ssize_t __pyx_t_5;
6650 __Pyx_TraceDeclarations
6651 __Pyx_RefNannySetupContext("getrname");
6652 __Pyx_TraceCall("getrname", __pyx_f[0], 639);
6654 /* "csamtools.pyx":642
6656 * convert numerical :term:`tid` into :term:`reference` name.'''
6657 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
6658 * if not 0 <= tid < self.samfile.header.n_targets:
6659 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
6661 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6662 __Pyx_GOTREF(__pyx_t_1);
6663 __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 = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6664 __Pyx_GOTREF(__pyx_t_2);
6665 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6666 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6667 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6668 __pyx_t_4 = (!__pyx_t_3);
6670 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6671 __Pyx_GOTREF(__pyx_t_2);
6672 __Pyx_Raise(__pyx_t_2, 0, 0);
6673 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6674 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6679 /* "csamtools.pyx":643
6680 * convert numerical :term:`tid` into :term:`reference` name.'''
6681 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
6682 * if not 0 <= tid < self.samfile.header.n_targets: # <<<<<<<<<<<<<<
6683 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
6684 * return self.samfile.header.target_name[tid]
6686 __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 = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6687 __Pyx_GOTREF(__pyx_t_2);
6688 if (__Pyx_PyObject_IsTrue(__pyx_t_2)) {
6689 __Pyx_DECREF(__pyx_t_2);
6690 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6691 __Pyx_GOTREF(__pyx_t_1);
6692 __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 = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6693 __Pyx_GOTREF(__pyx_t_2);
6694 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6696 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6697 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6698 __pyx_t_3 = (!__pyx_t_4);
6701 /* "csamtools.pyx":644
6702 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
6703 * if not 0 <= tid < self.samfile.header.n_targets:
6704 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) ) # <<<<<<<<<<<<<<
6705 * return self.samfile.header.target_name[tid]
6708 __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6709 __Pyx_GOTREF(__pyx_t_2);
6710 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6711 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
6712 __Pyx_INCREF(__pyx_v_tid);
6713 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tid);
6714 __Pyx_GIVEREF(__pyx_v_tid);
6715 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
6716 __Pyx_GIVEREF(__pyx_t_2);
6718 __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6719 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
6720 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
6721 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6722 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
6723 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
6724 __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
6726 __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 = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6727 __Pyx_GOTREF(__pyx_t_2);
6728 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
6729 __Pyx_Raise(__pyx_t_2, 0, 0);
6730 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6731 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6736 /* "csamtools.pyx":645
6737 * if not 0 <= tid < self.samfile.header.n_targets:
6738 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
6739 * return self.samfile.header.target_name[tid] # <<<<<<<<<<<<<<
6741 * cdef char * _getrname( self, int tid ):
6743 __Pyx_XDECREF(__pyx_r);
6744 __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 = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6745 __pyx_t_2 = PyBytes_FromString((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->target_name[__pyx_t_5])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6746 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
6747 __pyx_r = ((PyObject *)__pyx_t_2);
6751 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6754 __Pyx_XDECREF(__pyx_t_1);
6755 __Pyx_XDECREF(__pyx_t_2);
6756 __Pyx_AddTraceback("csamtools.Samfile.getrname");
6759 __Pyx_XGIVEREF(__pyx_r);
6760 __Pyx_TraceReturn(__pyx_r);
6761 __Pyx_RefNannyFinishContext();
6765 /* "csamtools.pyx":647
6766 * return self.samfile.header.target_name[tid]
6768 * cdef char * _getrname( self, int tid ): # <<<<<<<<<<<<<<
6770 * convert numerical :term:`tid` into :term:`reference` name.'''
6773 static char *__pyx_f_9csamtools_7Samfile__getrname(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, int __pyx_v_tid) {
6775 PyObject *__pyx_t_1 = NULL;
6776 PyObject *__pyx_t_2 = NULL;
6779 PyObject *__pyx_t_5 = NULL;
6780 __Pyx_TraceDeclarations
6781 __Pyx_RefNannySetupContext("_getrname");
6782 __Pyx_TraceCall("_getrname", __pyx_f[0], 647);
6784 /* "csamtools.pyx":650
6786 * convert numerical :term:`tid` into :term:`reference` name.'''
6787 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
6788 * if not 0 <= tid < self.samfile.header.n_targets:
6789 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
6791 __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 = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6792 __Pyx_GOTREF(__pyx_t_1);
6793 __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 = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6794 __Pyx_GOTREF(__pyx_t_2);
6795 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6796 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6797 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6798 __pyx_t_4 = (!__pyx_t_3);
6800 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6801 __Pyx_GOTREF(__pyx_t_2);
6802 __Pyx_Raise(__pyx_t_2, 0, 0);
6803 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6804 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6809 /* "csamtools.pyx":651
6810 * convert numerical :term:`tid` into :term:`reference` name.'''
6811 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
6812 * if not 0 <= tid < self.samfile.header.n_targets: # <<<<<<<<<<<<<<
6813 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
6814 * return self.samfile.header.target_name[tid]
6816 __pyx_t_4 = (0 <= __pyx_v_tid);
6818 __pyx_t_4 = (__pyx_v_tid < __pyx_v_self->samfile->header->n_targets);
6820 __pyx_t_3 = (!__pyx_t_4);
6823 /* "csamtools.pyx":652
6824 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
6825 * if not 0 <= tid < self.samfile.header.n_targets:
6826 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) ) # <<<<<<<<<<<<<<
6827 * return self.samfile.header.target_name[tid]
6830 __pyx_t_2 = PyInt_FromLong(__pyx_v_tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6831 __Pyx_GOTREF(__pyx_t_2);
6832 __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 = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6833 __Pyx_GOTREF(__pyx_t_1);
6834 __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6835 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
6836 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
6837 __Pyx_GIVEREF(__pyx_t_2);
6838 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
6839 __Pyx_GIVEREF(__pyx_t_1);
6842 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6843 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
6844 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
6845 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6846 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
6847 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1));
6848 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
6850 __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 = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6851 __Pyx_GOTREF(__pyx_t_1);
6852 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
6853 __Pyx_Raise(__pyx_t_1, 0, 0);
6854 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6855 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6860 /* "csamtools.pyx":653
6861 * if not 0 <= tid < self.samfile.header.n_targets:
6862 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
6863 * return self.samfile.header.target_name[tid] # <<<<<<<<<<<<<<
6865 * def _parseRegion( self,
6867 __pyx_r = (__pyx_v_self->samfile->header->target_name[__pyx_v_tid]);
6873 __Pyx_XDECREF(__pyx_t_1);
6874 __Pyx_XDECREF(__pyx_t_2);
6875 __Pyx_XDECREF(__pyx_t_5);
6876 __Pyx_WriteUnraisable("csamtools.Samfile._getrname");
6879 __Pyx_TraceReturn(Py_None);
6880 __Pyx_RefNannyFinishContext();
6884 /* "csamtools.pyx":655
6885 * return self.samfile.header.target_name[tid]
6887 * def _parseRegion( self, # <<<<<<<<<<<<<<
6892 static PyObject *__pyx_pf_9csamtools_7Samfile_6_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6893 static char __pyx_doc_9csamtools_7Samfile_6_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 ";
6894 static PyObject *__pyx_pf_9csamtools_7Samfile_6_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6895 PyObject *__pyx_v_reference = 0;
6896 PyObject *__pyx_v_start = 0;
6897 PyObject *__pyx_v_end = 0;
6898 PyObject *__pyx_v_region = 0;
6900 PY_LONG_LONG __pyx_v_rstart;
6901 PY_LONG_LONG __pyx_v_rend;
6902 PyObject *__pyx_v_parts;
6903 PyObject *__pyx_r = NULL;
6904 PyObject *__pyx_t_1 = NULL;
6906 PY_LONG_LONG __pyx_t_3;
6908 PyObject *__pyx_t_5 = NULL;
6909 PyObject *__pyx_t_6 = NULL;
6910 PyObject *__pyx_t_7 = NULL;
6911 PyObject *__pyx_t_8 = NULL;
6912 Py_ssize_t __pyx_t_9;
6914 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
6915 __Pyx_TraceDeclarations
6916 __Pyx_RefNannySetupContext("_parseRegion");
6917 __Pyx_TraceCall("_parseRegion", __pyx_f[0], 655);
6918 if (unlikely(__pyx_kwds)) {
6919 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
6920 PyObject* values[4] = {0,0,0,0};
6922 /* "csamtools.pyx":656
6924 * def _parseRegion( self,
6925 * reference = None, # <<<<<<<<<<<<<<
6929 values[0] = ((PyObject *)Py_None);
6931 /* "csamtools.pyx":657
6932 * def _parseRegion( self,
6934 * start = None, # <<<<<<<<<<<<<<
6938 values[1] = ((PyObject *)Py_None);
6940 /* "csamtools.pyx":658
6943 * end = None, # <<<<<<<<<<<<<<
6947 values[2] = ((PyObject *)Py_None);
6949 /* "csamtools.pyx":659
6952 * region = None ): # <<<<<<<<<<<<<<
6954 * parse region information.
6956 values[3] = ((PyObject *)Py_None);
6957 switch (PyTuple_GET_SIZE(__pyx_args)) {
6958 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6959 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6960 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6961 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6963 default: goto __pyx_L5_argtuple_error;
6965 switch (PyTuple_GET_SIZE(__pyx_args)) {
6968 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
6969 if (value) { values[0] = value; kw_args--; }
6973 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
6974 if (value) { values[1] = value; kw_args--; }
6978 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
6979 if (value) { values[2] = value; kw_args--; }
6983 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region);
6984 if (value) { values[3] = value; kw_args--; }
6987 if (unlikely(kw_args > 0)) {
6988 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_parseRegion") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
6990 __pyx_v_reference = values[0];
6991 __pyx_v_start = values[1];
6992 __pyx_v_end = values[2];
6993 __pyx_v_region = values[3];
6996 /* "csamtools.pyx":656
6998 * def _parseRegion( self,
6999 * reference = None, # <<<<<<<<<<<<<<
7003 __pyx_v_reference = ((PyObject *)Py_None);
7005 /* "csamtools.pyx":657
7006 * def _parseRegion( self,
7008 * start = None, # <<<<<<<<<<<<<<
7012 __pyx_v_start = ((PyObject *)Py_None);
7014 /* "csamtools.pyx":658
7017 * end = None, # <<<<<<<<<<<<<<
7021 __pyx_v_end = ((PyObject *)Py_None);
7023 /* "csamtools.pyx":659
7026 * region = None ): # <<<<<<<<<<<<<<
7028 * parse region information.
7030 __pyx_v_region = ((PyObject *)Py_None);
7031 switch (PyTuple_GET_SIZE(__pyx_args)) {
7032 case 4: __pyx_v_region = PyTuple_GET_ITEM(__pyx_args, 3);
7033 case 3: __pyx_v_end = PyTuple_GET_ITEM(__pyx_args, 2);
7034 case 2: __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 1);
7035 case 1: __pyx_v_reference = PyTuple_GET_ITEM(__pyx_args, 0);
7037 default: goto __pyx_L5_argtuple_error;
7040 goto __pyx_L4_argument_unpacking_done;
7041 __pyx_L5_argtuple_error:;
7042 __Pyx_RaiseArgtupleInvalid("_parseRegion", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7044 __Pyx_AddTraceback("csamtools.Samfile._parseRegion");
7045 __Pyx_RefNannyFinishContext();
7047 __pyx_L4_argument_unpacking_done:;
7048 __Pyx_INCREF(__pyx_v_reference);
7049 __pyx_v_parts = Py_None; __Pyx_INCREF(Py_None);
7051 /* "csamtools.pyx":678
7052 * cdef long long rend
7054 * rtid = -1 # <<<<<<<<<<<<<<
7060 /* "csamtools.pyx":679
7063 * rstart = 0 # <<<<<<<<<<<<<<
7069 /* "csamtools.pyx":680
7072 * rend = max_pos # <<<<<<<<<<<<<<
7076 __pyx_v_rend = __pyx_v_9csamtools_max_pos;
7078 /* "csamtools.pyx":681
7081 * if start != None: # <<<<<<<<<<<<<<
7085 __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7086 __Pyx_GOTREF(__pyx_t_1);
7087 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7088 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7091 /* "csamtools.pyx":682
7094 * try: # <<<<<<<<<<<<<<
7096 * except OverflowError:
7099 PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
7100 __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
7101 __Pyx_XGOTREF(__pyx_save_exc_type);
7102 __Pyx_XGOTREF(__pyx_save_exc_value);
7103 __Pyx_XGOTREF(__pyx_save_exc_tb);
7106 /* "csamtools.pyx":683
7109 * rstart = start # <<<<<<<<<<<<<<
7110 * except OverflowError:
7111 * raise ValueError( 'start out of range (%i)' % start )
7113 __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_v_start); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
7114 __pyx_v_rstart = __pyx_t_3;
7116 __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
7117 __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
7118 __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
7119 goto __pyx_L14_try_end;
7121 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7123 /* "csamtools.pyx":684
7126 * except OverflowError: # <<<<<<<<<<<<<<
7127 * raise ValueError( 'start out of range (%i)' % start )
7130 __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
7132 __Pyx_AddTraceback("csamtools.Samfile._parseRegion");
7133 if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
7134 __Pyx_GOTREF(__pyx_t_1);
7135 __Pyx_GOTREF(__pyx_t_5);
7136 __Pyx_GOTREF(__pyx_t_6);
7138 /* "csamtools.pyx":685
7140 * except OverflowError:
7141 * raise ValueError( 'start out of range (%i)' % start ) # <<<<<<<<<<<<<<
7145 __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_v_start); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
7146 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
7147 __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
7148 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
7149 PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7));
7150 __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
7152 __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 = 685; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
7153 __Pyx_GOTREF(__pyx_t_7);
7154 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
7155 __Pyx_Raise(__pyx_t_7, 0, 0);
7156 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7157 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
7158 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7159 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7160 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7161 goto __pyx_L8_exception_handled;
7163 __pyx_L9_except_error:;
7164 __Pyx_XGIVEREF(__pyx_save_exc_type);
7165 __Pyx_XGIVEREF(__pyx_save_exc_value);
7166 __Pyx_XGIVEREF(__pyx_save_exc_tb);
7167 __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
7168 goto __pyx_L1_error;
7169 __pyx_L8_exception_handled:;
7170 __Pyx_XGIVEREF(__pyx_save_exc_type);
7171 __Pyx_XGIVEREF(__pyx_save_exc_value);
7172 __Pyx_XGIVEREF(__pyx_save_exc_tb);
7173 __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
7180 /* "csamtools.pyx":687
7181 * raise ValueError( 'start out of range (%i)' % start )
7183 * if end != None: # <<<<<<<<<<<<<<
7187 __pyx_t_6 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7188 __Pyx_GOTREF(__pyx_t_6);
7189 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7190 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7193 /* "csamtools.pyx":688
7196 * try: # <<<<<<<<<<<<<<
7198 * except OverflowError:
7201 PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
7202 __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
7203 __Pyx_XGOTREF(__pyx_save_exc_type);
7204 __Pyx_XGOTREF(__pyx_save_exc_value);
7205 __Pyx_XGOTREF(__pyx_save_exc_tb);
7208 /* "csamtools.pyx":689
7211 * rend = end # <<<<<<<<<<<<<<
7212 * except OverflowError:
7213 * raise ValueError( 'end out of range (%i)' % end )
7215 __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_v_end); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
7216 __pyx_v_rend = __pyx_t_3;
7218 __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
7219 __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
7220 __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
7221 goto __pyx_L25_try_end;
7223 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
7224 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
7225 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7226 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
7227 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7229 /* "csamtools.pyx":690
7232 * except OverflowError: # <<<<<<<<<<<<<<
7233 * raise ValueError( 'end out of range (%i)' % end )
7236 __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
7238 __Pyx_AddTraceback("csamtools.Samfile._parseRegion");
7239 if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
7240 __Pyx_GOTREF(__pyx_t_6);
7241 __Pyx_GOTREF(__pyx_t_5);
7242 __Pyx_GOTREF(__pyx_t_1);
7244 /* "csamtools.pyx":691
7246 * except OverflowError:
7247 * raise ValueError( 'end out of range (%i)' % end ) # <<<<<<<<<<<<<<
7251 __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __pyx_v_end); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
7252 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
7253 __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
7254 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
7255 PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7));
7256 __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
7258 __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 = 691; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
7259 __Pyx_GOTREF(__pyx_t_7);
7260 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
7261 __Pyx_Raise(__pyx_t_7, 0, 0);
7262 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7263 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
7264 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7265 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7266 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7267 goto __pyx_L19_exception_handled;
7269 __pyx_L20_except_error:;
7270 __Pyx_XGIVEREF(__pyx_save_exc_type);
7271 __Pyx_XGIVEREF(__pyx_save_exc_value);
7272 __Pyx_XGIVEREF(__pyx_save_exc_tb);
7273 __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
7274 goto __pyx_L1_error;
7275 __pyx_L19_exception_handled:;
7276 __Pyx_XGIVEREF(__pyx_save_exc_type);
7277 __Pyx_XGIVEREF(__pyx_save_exc_value);
7278 __Pyx_XGIVEREF(__pyx_save_exc_tb);
7279 __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
7286 /* "csamtools.pyx":693
7287 * raise ValueError( 'end out of range (%i)' % end )
7289 * if region: # <<<<<<<<<<<<<<
7290 * parts = re.split( "[:-]", region )
7291 * reference = parts[0]
7293 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7296 /* "csamtools.pyx":694
7299 * parts = re.split( "[:-]", region ) # <<<<<<<<<<<<<<
7300 * reference = parts[0]
7301 * if len(parts) >= 2: rstart = int(parts[1]) - 1
7303 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__re); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7304 __Pyx_GOTREF(__pyx_t_1);
7305 __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7306 __Pyx_GOTREF(__pyx_t_5);
7307 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7308 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7309 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
7310 __Pyx_INCREF(((PyObject *)__pyx_kp_s_33));
7311 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_33));
7312 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_33));
7313 __Pyx_INCREF(__pyx_v_region);
7314 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_region);
7315 __Pyx_GIVEREF(__pyx_v_region);
7316 __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7317 __Pyx_GOTREF(__pyx_t_6);
7318 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7319 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
7320 __Pyx_DECREF(__pyx_v_parts);
7321 __pyx_v_parts = __pyx_t_6;
7324 /* "csamtools.pyx":695
7326 * parts = re.split( "[:-]", region )
7327 * reference = parts[0] # <<<<<<<<<<<<<<
7328 * if len(parts) >= 2: rstart = int(parts[1]) - 1
7329 * if len(parts) >= 3: rend = int(parts[2])
7331 __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_parts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7332 __Pyx_GOTREF(__pyx_t_6);
7333 __Pyx_DECREF(__pyx_v_reference);
7334 __pyx_v_reference = __pyx_t_6;
7337 /* "csamtools.pyx":696
7338 * parts = re.split( "[:-]", region )
7339 * reference = parts[0]
7340 * if len(parts) >= 2: rstart = int(parts[1]) - 1 # <<<<<<<<<<<<<<
7341 * if len(parts) >= 3: rend = int(parts[2])
7344 __pyx_t_9 = PyObject_Length(__pyx_v_parts); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7345 __pyx_t_2 = (__pyx_t_9 >= 2);
7347 __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_parts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7348 __Pyx_GOTREF(__pyx_t_6);
7349 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7350 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
7351 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
7352 __Pyx_GIVEREF(__pyx_t_6);
7354 __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7355 __Pyx_GOTREF(__pyx_t_6);
7356 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
7357 __pyx_t_1 = PyNumber_Subtract(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7358 __Pyx_GOTREF(__pyx_t_1);
7359 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7360 __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_t_1); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7361 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7362 __pyx_v_rstart = __pyx_t_3;
7367 /* "csamtools.pyx":697
7368 * reference = parts[0]
7369 * if len(parts) >= 2: rstart = int(parts[1]) - 1
7370 * if len(parts) >= 3: rend = int(parts[2]) # <<<<<<<<<<<<<<
7372 * if not reference: return 0, 0, 0, 0
7374 __pyx_t_9 = PyObject_Length(__pyx_v_parts); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7375 __pyx_t_2 = (__pyx_t_9 >= 3);
7377 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_parts, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7378 __Pyx_GOTREF(__pyx_t_1);
7379 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7380 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
7381 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
7382 __Pyx_GIVEREF(__pyx_t_1);
7384 __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7385 __Pyx_GOTREF(__pyx_t_1);
7386 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
7387 __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_t_1); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7388 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7389 __pyx_v_rend = __pyx_t_3;
7397 /* "csamtools.pyx":699
7398 * if len(parts) >= 3: rend = int(parts[2])
7400 * if not reference: return 0, 0, 0, 0 # <<<<<<<<<<<<<<
7402 * rtid = self.gettid( reference )
7404 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_reference); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7405 __pyx_t_10 = (!__pyx_t_2);
7407 __Pyx_XDECREF(__pyx_r);
7408 __Pyx_INCREF(((PyObject *)__pyx_k_tuple_34));
7409 __pyx_r = ((PyObject *)__pyx_k_tuple_34);
7415 /* "csamtools.pyx":701
7416 * if not reference: return 0, 0, 0, 0
7418 * rtid = self.gettid( reference ) # <<<<<<<<<<<<<<
7419 * if rtid < 0: raise ValueError( "invalid reference `%s`" % reference )
7420 * if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) )
7422 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__gettid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7423 __Pyx_GOTREF(__pyx_t_1);
7424 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7425 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
7426 __Pyx_INCREF(__pyx_v_reference);
7427 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_reference);
7428 __Pyx_GIVEREF(__pyx_v_reference);
7429 __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7430 __Pyx_GOTREF(__pyx_t_5);
7431 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7432 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
7433 __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7434 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7435 __pyx_v_rtid = __pyx_t_4;
7437 /* "csamtools.pyx":702
7439 * rtid = self.gettid( reference )
7440 * if rtid < 0: raise ValueError( "invalid reference `%s`" % reference ) # <<<<<<<<<<<<<<
7441 * if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) )
7442 * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart )
7444 __pyx_t_10 = (__pyx_v_rtid < 0);
7446 __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_35), __pyx_v_reference); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7447 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
7448 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7449 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
7450 PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
7451 __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
7453 __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 = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7454 __Pyx_GOTREF(__pyx_t_5);
7455 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
7456 __Pyx_Raise(__pyx_t_5, 0, 0);
7457 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7458 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7463 /* "csamtools.pyx":703
7464 * rtid = self.gettid( reference )
7465 * if rtid < 0: raise ValueError( "invalid reference `%s`" % reference )
7466 * if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) ) # <<<<<<<<<<<<<<
7467 * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart )
7468 * if not 0 <= rend <= max_pos: raise ValueError( 'end out of range (%i)' % rend )
7470 __pyx_t_10 = (__pyx_v_rstart > __pyx_v_rend);
7472 __pyx_t_5 = PyLong_FromLongLong(__pyx_v_rstart); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7473 __Pyx_GOTREF(__pyx_t_5);
7474 __pyx_t_6 = PyLong_FromLongLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7475 __Pyx_GOTREF(__pyx_t_6);
7476 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7477 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
7478 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
7479 __Pyx_GIVEREF(__pyx_t_5);
7480 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
7481 __Pyx_GIVEREF(__pyx_t_6);
7484 __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_36), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7485 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
7486 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
7487 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7488 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
7489 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6));
7490 __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
7492 __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 = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7493 __Pyx_GOTREF(__pyx_t_6);
7494 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
7495 __Pyx_Raise(__pyx_t_6, 0, 0);
7496 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7497 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7502 /* "csamtools.pyx":704
7503 * if rtid < 0: raise ValueError( "invalid reference `%s`" % reference )
7504 * if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) )
7505 * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart ) # <<<<<<<<<<<<<<
7506 * if not 0 <= rend <= max_pos: raise ValueError( 'end out of range (%i)' % rend )
7509 __pyx_t_10 = (0 <= __pyx_v_rstart);
7511 __pyx_t_10 = (__pyx_v_rstart < __pyx_v_9csamtools_max_pos);
7513 __pyx_t_2 = (!__pyx_t_10);
7515 __pyx_t_6 = PyLong_FromLongLong(__pyx_v_rstart); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7516 __Pyx_GOTREF(__pyx_t_6);
7517 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7518 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
7519 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7520 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7521 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
7522 PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1));
7523 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
7525 __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 = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7526 __Pyx_GOTREF(__pyx_t_1);
7527 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
7528 __Pyx_Raise(__pyx_t_1, 0, 0);
7529 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7530 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7535 /* "csamtools.pyx":705
7536 * if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) )
7537 * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart )
7538 * if not 0 <= rend <= max_pos: raise ValueError( 'end out of range (%i)' % rend ) # <<<<<<<<<<<<<<
7540 * return 1, rtid, rstart, rend
7542 __pyx_t_2 = (0 <= __pyx_v_rend);
7544 __pyx_t_2 = (__pyx_v_rend <= __pyx_v_9csamtools_max_pos);
7546 __pyx_t_10 = (!__pyx_t_2);
7548 __pyx_t_1 = PyLong_FromLongLong(__pyx_v_rend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7549 __Pyx_GOTREF(__pyx_t_1);
7550 __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7551 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
7552 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7553 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7554 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
7555 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6));
7556 __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
7558 __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 = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7559 __Pyx_GOTREF(__pyx_t_6);
7560 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
7561 __Pyx_Raise(__pyx_t_6, 0, 0);
7562 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7563 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7568 /* "csamtools.pyx":707
7569 * if not 0 <= rend <= max_pos: raise ValueError( 'end out of range (%i)' % rend )
7571 * return 1, rtid, rstart, rend # <<<<<<<<<<<<<<
7573 * def reset( self ):
7575 __Pyx_XDECREF(__pyx_r);
7576 __pyx_t_6 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7577 __Pyx_GOTREF(__pyx_t_6);
7578 __pyx_t_1 = PyLong_FromLongLong(__pyx_v_rstart); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7579 __Pyx_GOTREF(__pyx_t_1);
7580 __pyx_t_5 = PyLong_FromLongLong(__pyx_v_rend); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7581 __Pyx_GOTREF(__pyx_t_5);
7582 __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7583 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
7584 __Pyx_INCREF(__pyx_int_1);
7585 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_int_1);
7586 __Pyx_GIVEREF(__pyx_int_1);
7587 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
7588 __Pyx_GIVEREF(__pyx_t_6);
7589 PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_1);
7590 __Pyx_GIVEREF(__pyx_t_1);
7591 PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_5);
7592 __Pyx_GIVEREF(__pyx_t_5);
7596 __pyx_r = ((PyObject *)__pyx_t_7);
7600 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7603 __Pyx_XDECREF(__pyx_t_1);
7604 __Pyx_XDECREF(__pyx_t_5);
7605 __Pyx_XDECREF(__pyx_t_6);
7606 __Pyx_XDECREF(__pyx_t_7);
7607 __Pyx_XDECREF(__pyx_t_8);
7608 __Pyx_AddTraceback("csamtools.Samfile._parseRegion");
7611 __Pyx_DECREF(__pyx_v_parts);
7612 __Pyx_DECREF(__pyx_v_reference);
7613 __Pyx_XGIVEREF(__pyx_r);
7614 __Pyx_TraceReturn(__pyx_r);
7615 __Pyx_RefNannyFinishContext();
7619 /* "csamtools.pyx":709
7620 * return 1, rtid, rstart, rend
7622 * def reset( self ): # <<<<<<<<<<<<<<
7623 * '''reset file position to beginning of read section.'''
7624 * return self.seek( self.start_offset, 0 )
7627 static PyObject *__pyx_pf_9csamtools_7Samfile_7reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
7628 static char __pyx_doc_9csamtools_7Samfile_7reset[] = "Samfile.reset(self)\nreset file position to beginning of read section.";
7629 static PyObject *__pyx_pf_9csamtools_7Samfile_7reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7630 PyObject *__pyx_r = NULL;
7631 PyObject *__pyx_t_1 = NULL;
7632 PyObject *__pyx_t_2 = NULL;
7633 PyObject *__pyx_t_3 = NULL;
7634 __Pyx_TraceDeclarations
7635 __Pyx_RefNannySetupContext("reset");
7636 __Pyx_TraceCall("reset", __pyx_f[0], 709);
7638 /* "csamtools.pyx":711
7639 * def reset( self ):
7640 * '''reset file position to beginning of read section.'''
7641 * return self.seek( self.start_offset, 0 ) # <<<<<<<<<<<<<<
7643 * def seek( self, uint64_t offset, int where = 0):
7645 __Pyx_XDECREF(__pyx_r);
7646 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7647 __Pyx_GOTREF(__pyx_t_1);
7648 __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->start_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7649 __Pyx_GOTREF(__pyx_t_2);
7650 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7651 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
7652 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
7653 __Pyx_GIVEREF(__pyx_t_2);
7654 __Pyx_INCREF(__pyx_int_0);
7655 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
7656 __Pyx_GIVEREF(__pyx_int_0);
7658 __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 = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7659 __Pyx_GOTREF(__pyx_t_2);
7660 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7661 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
7662 __pyx_r = __pyx_t_2;
7666 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7669 __Pyx_XDECREF(__pyx_t_1);
7670 __Pyx_XDECREF(__pyx_t_2);
7671 __Pyx_XDECREF(__pyx_t_3);
7672 __Pyx_AddTraceback("csamtools.Samfile.reset");
7675 __Pyx_XGIVEREF(__pyx_r);
7676 __Pyx_TraceReturn(__pyx_r);
7677 __Pyx_RefNannyFinishContext();
7681 /* "csamtools.pyx":713
7682 * return self.seek( self.start_offset, 0 )
7684 * def seek( self, uint64_t offset, int where = 0): # <<<<<<<<<<<<<<
7686 * move file pointer to position *offset*, see :meth:`pysam.Samfile.tell`.
7689 static PyObject *__pyx_pf_9csamtools_7Samfile_8seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7690 static char __pyx_doc_9csamtools_7Samfile_8seek[] = "Samfile.seek(self, uint64_t offset, int where=0)\n\n move file pointer to position *offset*, see :meth:`pysam.Samfile.tell`.\n ";
7691 static PyObject *__pyx_pf_9csamtools_7Samfile_8seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7692 uint64_t __pyx_v_offset;
7694 PyObject *__pyx_r = NULL;
7695 PyObject *__pyx_t_1 = NULL;
7696 PyObject *__pyx_t_2 = NULL;
7699 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__offset,&__pyx_n_s__where,0};
7700 __Pyx_TraceDeclarations
7701 __Pyx_RefNannySetupContext("seek");
7702 __Pyx_TraceCall("seek", __pyx_f[0], 713);
7703 if (unlikely(__pyx_kwds)) {
7704 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
7705 PyObject* values[2] = {0,0};
7706 switch (PyTuple_GET_SIZE(__pyx_args)) {
7707 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7708 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7710 default: goto __pyx_L5_argtuple_error;
7712 switch (PyTuple_GET_SIZE(__pyx_args)) {
7714 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset);
7715 if (likely(values[0])) kw_args--;
7716 else goto __pyx_L5_argtuple_error;
7719 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__where);
7720 if (value) { values[1] = value; kw_args--; }
7723 if (unlikely(kw_args > 0)) {
7724 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "seek") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7726 __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 = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7728 __pyx_v_where = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_where == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7730 __pyx_v_where = ((int)0);
7733 __pyx_v_where = ((int)0);
7734 switch (PyTuple_GET_SIZE(__pyx_args)) {
7735 case 2: __pyx_v_where = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_where == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7736 case 1: __pyx_v_offset = __Pyx_PyInt_from_py_uint64_t(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_offset == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7738 default: goto __pyx_L5_argtuple_error;
7741 goto __pyx_L4_argument_unpacking_done;
7742 __pyx_L5_argtuple_error:;
7743 __Pyx_RaiseArgtupleInvalid("seek", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7745 __Pyx_AddTraceback("csamtools.Samfile.seek");
7746 __Pyx_RefNannyFinishContext();
7748 __pyx_L4_argument_unpacking_done:;
7750 /* "csamtools.pyx":718
7753 * if not self._isOpen(): # <<<<<<<<<<<<<<
7754 * raise ValueError( "I/O operation on closed file" )
7755 * if not self.isbam:
7757 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7758 __Pyx_GOTREF(__pyx_t_1);
7759 __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 = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7760 __Pyx_GOTREF(__pyx_t_2);
7761 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7762 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7763 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7764 __pyx_t_4 = (!__pyx_t_3);
7767 /* "csamtools.pyx":719
7769 * if not self._isOpen():
7770 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
7771 * if not self.isbam:
7772 * raise NotImplementedError("seek only available in bam files")
7774 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7775 __Pyx_GOTREF(__pyx_t_2);
7776 __Pyx_Raise(__pyx_t_2, 0, 0);
7777 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7778 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7783 /* "csamtools.pyx":720
7784 * if not self._isOpen():
7785 * raise ValueError( "I/O operation on closed file" )
7786 * if not self.isbam: # <<<<<<<<<<<<<<
7787 * raise NotImplementedError("seek only available in bam files")
7790 __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam);
7793 /* "csamtools.pyx":721
7794 * raise ValueError( "I/O operation on closed file" )
7795 * if not self.isbam:
7796 * raise NotImplementedError("seek only available in bam files") # <<<<<<<<<<<<<<
7798 * raise OSError("seek no available in streams")
7800 __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_39), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7801 __Pyx_GOTREF(__pyx_t_2);
7802 __Pyx_Raise(__pyx_t_2, 0, 0);
7803 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7804 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7809 /* "csamtools.pyx":722
7810 * if not self.isbam:
7811 * raise NotImplementedError("seek only available in bam files")
7812 * if self.isstream: # <<<<<<<<<<<<<<
7813 * raise OSError("seek no available in streams")
7816 if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream) {
7818 /* "csamtools.pyx":723
7819 * raise NotImplementedError("seek only available in bam files")
7821 * raise OSError("seek no available in streams") # <<<<<<<<<<<<<<
7823 * return bam_seek( self.samfile.x.bam, offset, where )
7825 __pyx_t_2 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7826 __Pyx_GOTREF(__pyx_t_2);
7827 __Pyx_Raise(__pyx_t_2, 0, 0);
7828 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7829 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7834 /* "csamtools.pyx":725
7835 * raise OSError("seek no available in streams")
7837 * return bam_seek( self.samfile.x.bam, offset, where ) # <<<<<<<<<<<<<<
7841 __Pyx_XDECREF(__pyx_r);
7842 __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(bam_seek(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, __pyx_v_offset, __pyx_v_where)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7843 __Pyx_GOTREF(__pyx_t_2);
7844 __pyx_r = __pyx_t_2;
7848 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7851 __Pyx_XDECREF(__pyx_t_1);
7852 __Pyx_XDECREF(__pyx_t_2);
7853 __Pyx_AddTraceback("csamtools.Samfile.seek");
7856 __Pyx_XGIVEREF(__pyx_r);
7857 __Pyx_TraceReturn(__pyx_r);
7858 __Pyx_RefNannyFinishContext();
7862 /* "csamtools.pyx":727
7863 * return bam_seek( self.samfile.x.bam, offset, where )
7865 * def tell( self ): # <<<<<<<<<<<<<<
7867 * return current file position
7870 static PyObject *__pyx_pf_9csamtools_7Samfile_9tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
7871 static char __pyx_doc_9csamtools_7Samfile_9tell[] = "Samfile.tell(self)\n\n return current file position\n ";
7872 static PyObject *__pyx_pf_9csamtools_7Samfile_9tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7873 PyObject *__pyx_r = NULL;
7874 PyObject *__pyx_t_1 = NULL;
7875 PyObject *__pyx_t_2 = NULL;
7878 __Pyx_TraceDeclarations
7879 __Pyx_RefNannySetupContext("tell");
7880 __Pyx_TraceCall("tell", __pyx_f[0], 727);
7882 /* "csamtools.pyx":731
7883 * return current file position
7885 * if not self._isOpen(): # <<<<<<<<<<<<<<
7886 * raise ValueError( "I/O operation on closed file" )
7887 * if not self.isbam:
7889 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7890 __Pyx_GOTREF(__pyx_t_1);
7891 __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 = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7892 __Pyx_GOTREF(__pyx_t_2);
7893 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7894 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7895 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7896 __pyx_t_4 = (!__pyx_t_3);
7899 /* "csamtools.pyx":732
7901 * if not self._isOpen():
7902 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
7903 * if not self.isbam:
7904 * raise NotImplementedError("seek only available in bam files")
7906 __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 = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7907 __Pyx_GOTREF(__pyx_t_2);
7908 __Pyx_Raise(__pyx_t_2, 0, 0);
7909 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7910 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7915 /* "csamtools.pyx":733
7916 * if not self._isOpen():
7917 * raise ValueError( "I/O operation on closed file" )
7918 * if not self.isbam: # <<<<<<<<<<<<<<
7919 * raise NotImplementedError("seek only available in bam files")
7922 __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam);
7925 /* "csamtools.pyx":734
7926 * raise ValueError( "I/O operation on closed file" )
7927 * if not self.isbam:
7928 * raise NotImplementedError("seek only available in bam files") # <<<<<<<<<<<<<<
7930 * return bam_tell( self.samfile.x.bam )
7932 __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_43), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7933 __Pyx_GOTREF(__pyx_t_2);
7934 __Pyx_Raise(__pyx_t_2, 0, 0);
7935 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7936 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7941 /* "csamtools.pyx":736
7942 * raise NotImplementedError("seek only available in bam files")
7944 * return bam_tell( self.samfile.x.bam ) # <<<<<<<<<<<<<<
7948 __Pyx_XDECREF(__pyx_r);
7949 __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(bam_tell(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7950 __Pyx_GOTREF(__pyx_t_2);
7951 __pyx_r = __pyx_t_2;
7955 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7958 __Pyx_XDECREF(__pyx_t_1);
7959 __Pyx_XDECREF(__pyx_t_2);
7960 __Pyx_AddTraceback("csamtools.Samfile.tell");
7963 __Pyx_XGIVEREF(__pyx_r);
7964 __Pyx_TraceReturn(__pyx_r);
7965 __Pyx_RefNannyFinishContext();
7969 /* "csamtools.pyx":738
7970 * return bam_tell( self.samfile.x.bam )
7972 * def fetch( self, # <<<<<<<<<<<<<<
7977 static PyObject *__pyx_pf_9csamtools_7Samfile_10fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7978 static char __pyx_doc_9csamtools_7Samfile_10fetch[] = "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 ";
7979 static PyObject *__pyx_pf_9csamtools_7Samfile_10fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7980 PyObject *__pyx_v_reference = 0;
7981 PyObject *__pyx_v_start = 0;
7982 PyObject *__pyx_v_end = 0;
7983 PyObject *__pyx_v_region = 0;
7984 PyObject *__pyx_v_callback = 0;
7985 PyObject *__pyx_v_until_eof = 0;
7989 int __pyx_v_has_coord;
7991 PyObject *__pyx_r = NULL;
7992 PyObject *__pyx_t_1 = NULL;
7993 PyObject *__pyx_t_2 = NULL;
7996 PyObject *__pyx_t_5 = NULL;
7997 PyObject *__pyx_t_6 = NULL;
7998 PyObject *__pyx_t_7 = NULL;
8003 PyObject *__pyx_t_12 = NULL;
8006 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};
8007 __Pyx_TraceDeclarations
8008 __Pyx_RefNannySetupContext("fetch");
8009 __Pyx_TraceCall("fetch", __pyx_f[0], 738);
8010 if (unlikely(__pyx_kwds)) {
8011 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
8012 PyObject* values[6] = {0,0,0,0,0,0};
8014 /* "csamtools.pyx":739
8017 * reference = None, # <<<<<<<<<<<<<<
8021 values[0] = ((PyObject *)Py_None);
8023 /* "csamtools.pyx":740
8026 * start = None, # <<<<<<<<<<<<<<
8030 values[1] = ((PyObject *)Py_None);
8032 /* "csamtools.pyx":741
8035 * end = None, # <<<<<<<<<<<<<<
8039 values[2] = ((PyObject *)Py_None);
8041 /* "csamtools.pyx":742
8044 * region = None, # <<<<<<<<<<<<<<
8046 * until_eof = False ):
8048 values[3] = ((PyObject *)Py_None);
8050 /* "csamtools.pyx":743
8053 * callback = None, # <<<<<<<<<<<<<<
8054 * until_eof = False ):
8057 values[4] = ((PyObject *)Py_None);
8058 values[5] = __pyx_k_44;
8059 switch (PyTuple_GET_SIZE(__pyx_args)) {
8060 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8061 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8062 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8063 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8064 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8065 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8067 default: goto __pyx_L5_argtuple_error;
8069 switch (PyTuple_GET_SIZE(__pyx_args)) {
8072 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
8073 if (value) { values[0] = value; kw_args--; }
8077 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
8078 if (value) { values[1] = value; kw_args--; }
8082 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
8083 if (value) { values[2] = value; kw_args--; }
8087 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region);
8088 if (value) { values[3] = value; kw_args--; }
8092 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback);
8093 if (value) { values[4] = value; kw_args--; }
8097 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__until_eof);
8098 if (value) { values[5] = value; kw_args--; }
8101 if (unlikely(kw_args > 0)) {
8102 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8104 __pyx_v_reference = values[0];
8105 __pyx_v_start = values[1];
8106 __pyx_v_end = values[2];
8107 __pyx_v_region = values[3];
8108 __pyx_v_callback = values[4];
8109 __pyx_v_until_eof = values[5];
8112 /* "csamtools.pyx":739
8115 * reference = None, # <<<<<<<<<<<<<<
8119 __pyx_v_reference = ((PyObject *)Py_None);
8121 /* "csamtools.pyx":740
8124 * start = None, # <<<<<<<<<<<<<<
8128 __pyx_v_start = ((PyObject *)Py_None);
8130 /* "csamtools.pyx":741
8133 * end = None, # <<<<<<<<<<<<<<
8137 __pyx_v_end = ((PyObject *)Py_None);
8139 /* "csamtools.pyx":742
8142 * region = None, # <<<<<<<<<<<<<<
8144 * until_eof = False ):
8146 __pyx_v_region = ((PyObject *)Py_None);
8148 /* "csamtools.pyx":743
8151 * callback = None, # <<<<<<<<<<<<<<
8152 * until_eof = False ):
8155 __pyx_v_callback = ((PyObject *)Py_None);
8156 __pyx_v_until_eof = __pyx_k_44;
8157 switch (PyTuple_GET_SIZE(__pyx_args)) {
8158 case 6: __pyx_v_until_eof = PyTuple_GET_ITEM(__pyx_args, 5);
8159 case 5: __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 4);
8160 case 4: __pyx_v_region = PyTuple_GET_ITEM(__pyx_args, 3);
8161 case 3: __pyx_v_end = PyTuple_GET_ITEM(__pyx_args, 2);
8162 case 2: __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 1);
8163 case 1: __pyx_v_reference = PyTuple_GET_ITEM(__pyx_args, 0);
8165 default: goto __pyx_L5_argtuple_error;
8168 goto __pyx_L4_argument_unpacking_done;
8169 __pyx_L5_argtuple_error:;
8170 __Pyx_RaiseArgtupleInvalid("fetch", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8172 __Pyx_AddTraceback("csamtools.Samfile.fetch");
8173 __Pyx_RefNannyFinishContext();
8175 __pyx_L4_argument_unpacking_done:;
8177 /* "csamtools.pyx":768
8178 * cdef int rtid, rstart, rend, has_coord
8180 * if not self._isOpen(): # <<<<<<<<<<<<<<
8181 * raise ValueError( "I/O operation on closed file" )
8184 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8185 __Pyx_GOTREF(__pyx_t_1);
8186 __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 = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8187 __Pyx_GOTREF(__pyx_t_2);
8188 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8189 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8190 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8191 __pyx_t_4 = (!__pyx_t_3);
8194 /* "csamtools.pyx":769
8196 * if not self._isOpen():
8197 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
8199 * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
8201 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_45), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8202 __Pyx_GOTREF(__pyx_t_2);
8203 __Pyx_Raise(__pyx_t_2, 0, 0);
8204 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8205 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8210 /* "csamtools.pyx":771
8211 * raise ValueError( "I/O operation on closed file" )
8213 * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) # <<<<<<<<<<<<<<
8215 * if self.isstream: reopen = False
8217 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8218 __Pyx_GOTREF(__pyx_t_2);
8219 __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8220 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
8221 __Pyx_INCREF(__pyx_v_reference);
8222 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference);
8223 __Pyx_GIVEREF(__pyx_v_reference);
8224 __Pyx_INCREF(__pyx_v_start);
8225 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start);
8226 __Pyx_GIVEREF(__pyx_v_start);
8227 __Pyx_INCREF(__pyx_v_end);
8228 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end);
8229 __Pyx_GIVEREF(__pyx_v_end);
8230 __Pyx_INCREF(__pyx_v_region);
8231 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_region);
8232 __Pyx_GIVEREF(__pyx_v_region);
8233 __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 = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8234 __Pyx_GOTREF(__pyx_t_5);
8235 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8236 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
8237 if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 4)) {
8238 PyObject* tuple = __pyx_t_5;
8239 __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
8240 __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8241 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8242 __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
8243 __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8244 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8245 __pyx_t_6 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_6);
8246 __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8247 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8248 __pyx_t_7 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_7);
8249 __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8250 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8251 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8252 __pyx_v_has_coord = __pyx_t_8;
8253 __pyx_v_rtid = __pyx_t_9;
8254 __pyx_v_rstart = __pyx_t_10;
8255 __pyx_v_rend = __pyx_t_11;
8257 __pyx_t_12 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8258 __Pyx_GOTREF(__pyx_t_12);
8259 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8260 __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_12, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8261 __Pyx_GOTREF(__pyx_t_1);
8262 __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8263 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8264 __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_12, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8265 __Pyx_GOTREF(__pyx_t_2);
8266 __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 = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8267 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8268 __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_12, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8269 __Pyx_GOTREF(__pyx_t_6);
8270 __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8271 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8272 __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_12, 3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8273 __Pyx_GOTREF(__pyx_t_7);
8274 __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8275 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8276 if (__Pyx_EndUnpack(__pyx_t_12, 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8277 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
8278 __pyx_v_has_coord = __pyx_t_11;
8279 __pyx_v_rtid = __pyx_t_10;
8280 __pyx_v_rstart = __pyx_t_9;
8281 __pyx_v_rend = __pyx_t_8;
8284 /* "csamtools.pyx":773
8285 * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
8287 * if self.isstream: reopen = False # <<<<<<<<<<<<<<
8288 * else: reopen = True
8291 if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream) {
8297 /* "csamtools.pyx":774
8299 * if self.isstream: reopen = False
8300 * else: reopen = True # <<<<<<<<<<<<<<
8308 /* "csamtools.pyx":776
8309 * else: reopen = True
8311 * if self.isbam: # <<<<<<<<<<<<<<
8312 * if not until_eof and not self._hasIndex() and not self.isremote:
8313 * raise ValueError( "fetch called on bamfile without index" )
8315 if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam) {
8317 /* "csamtools.pyx":777
8320 * if not until_eof and not self._hasIndex() and not self.isremote: # <<<<<<<<<<<<<<
8321 * raise ValueError( "fetch called on bamfile without index" )
8324 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_until_eof); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8325 __pyx_t_3 = (!__pyx_t_4);
8327 __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8328 __Pyx_GOTREF(__pyx_t_5);
8329 __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 = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8330 __Pyx_GOTREF(__pyx_t_7);
8331 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8332 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8333 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8334 __pyx_t_13 = (!__pyx_t_4);
8336 __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote);
8337 __pyx_t_14 = __pyx_t_4;
8339 __pyx_t_14 = __pyx_t_13;
8341 __pyx_t_13 = __pyx_t_14;
8343 __pyx_t_13 = __pyx_t_3;
8347 /* "csamtools.pyx":778
8349 * if not until_eof and not self._hasIndex() and not self.isremote:
8350 * raise ValueError( "fetch called on bamfile without index" ) # <<<<<<<<<<<<<<
8354 __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_47), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8355 __Pyx_GOTREF(__pyx_t_7);
8356 __Pyx_Raise(__pyx_t_7, 0, 0);
8357 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8358 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8363 /* "csamtools.pyx":780
8364 * raise ValueError( "fetch called on bamfile without index" )
8366 * if callback: # <<<<<<<<<<<<<<
8367 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
8368 * if not self._hasIndex(): raise ValueError( "no index available for fetch" )
8370 __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_callback); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8373 /* "csamtools.pyx":781
8376 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) # <<<<<<<<<<<<<<
8377 * if not self._hasIndex(): raise ValueError( "no index available for fetch" )
8378 * return bam_fetch(self.samfile.x.bam,
8380 __pyx_t_13 = (!__pyx_v_has_coord);
8382 __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8383 __Pyx_GOTREF(__pyx_t_7);
8384 __Pyx_Raise(__pyx_t_7, 0, 0);
8385 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8386 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8391 /* "csamtools.pyx":782
8393 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
8394 * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) # <<<<<<<<<<<<<<
8395 * return bam_fetch(self.samfile.x.bam,
8398 __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8399 __Pyx_GOTREF(__pyx_t_7);
8400 __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 = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8401 __Pyx_GOTREF(__pyx_t_5);
8402 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8403 __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8404 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8405 __pyx_t_3 = (!__pyx_t_13);
8407 __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8408 __Pyx_GOTREF(__pyx_t_5);
8409 __Pyx_Raise(__pyx_t_5, 0, 0);
8410 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8411 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8416 /* "csamtools.pyx":783
8417 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
8418 * if not self._hasIndex(): raise ValueError( "no index available for fetch" )
8419 * return bam_fetch(self.samfile.x.bam, # <<<<<<<<<<<<<<
8423 __Pyx_XDECREF(__pyx_r);
8425 /* "csamtools.pyx":789
8428 * fetch_callback ) # <<<<<<<<<<<<<<
8432 __pyx_t_5 = PyInt_FromLong(bam_fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, ((struct __pyx_obj_9csamtools_Samfile *)__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 = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8433 __Pyx_GOTREF(__pyx_t_5);
8434 __pyx_r = __pyx_t_5;
8441 /* "csamtools.pyx":791
8444 * if has_coord: # <<<<<<<<<<<<<<
8445 * return IteratorRowRegion( self, rtid, rstart, rend, reopen=reopen )
8448 if (__pyx_v_has_coord) {
8450 /* "csamtools.pyx":792
8453 * return IteratorRowRegion( self, rtid, rstart, rend, reopen=reopen ) # <<<<<<<<<<<<<<
8457 __Pyx_XDECREF(__pyx_r);
8458 __pyx_t_5 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8459 __Pyx_GOTREF(__pyx_t_5);
8460 __pyx_t_7 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8461 __Pyx_GOTREF(__pyx_t_7);
8462 __pyx_t_6 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8463 __Pyx_GOTREF(__pyx_t_6);
8464 __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8465 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
8466 __Pyx_INCREF(__pyx_v_self);
8467 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
8468 __Pyx_GIVEREF(__pyx_v_self);
8469 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
8470 __Pyx_GIVEREF(__pyx_t_5);
8471 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_7);
8472 __Pyx_GIVEREF(__pyx_t_7);
8473 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_6);
8474 __Pyx_GIVEREF(__pyx_t_6);
8478 __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8479 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
8480 __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8481 __Pyx_GOTREF(__pyx_t_7);
8482 if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__reopen), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8483 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8484 __pyx_t_7 = PyEval_CallObjectWithKeywords(((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 = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8485 __Pyx_GOTREF(__pyx_t_7);
8486 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
8487 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
8488 __pyx_r = __pyx_t_7;
8495 /* "csamtools.pyx":794
8496 * return IteratorRowRegion( self, rtid, rstart, rend, reopen=reopen )
8498 * if until_eof: # <<<<<<<<<<<<<<
8499 * return IteratorRowAll( self, reopen=reopen )
8502 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_until_eof); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8505 /* "csamtools.pyx":795
8508 * return IteratorRowAll( self, reopen=reopen ) # <<<<<<<<<<<<<<
8510 * # AH: check - reason why no reopen for AllRefs?
8512 __Pyx_XDECREF(__pyx_r);
8513 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8514 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
8515 __Pyx_INCREF(__pyx_v_self);
8516 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self);
8517 __Pyx_GIVEREF(__pyx_v_self);
8518 __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8519 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
8520 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8521 __Pyx_GOTREF(__pyx_t_2);
8522 if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__reopen), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8523 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8524 __pyx_t_2 = PyEval_CallObjectWithKeywords(((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 = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8525 __Pyx_GOTREF(__pyx_t_2);
8526 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
8527 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
8528 __pyx_r = __pyx_t_2;
8535 /* "csamtools.pyx":798
8537 * # AH: check - reason why no reopen for AllRefs?
8538 * return IteratorRowAllRefs(self ) # , reopen=reopen ) # <<<<<<<<<<<<<<
8540 * # check if header is present - otherwise sam_read1 aborts
8542 __Pyx_XDECREF(__pyx_r);
8543 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8544 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
8545 __Pyx_INCREF(__pyx_v_self);
8546 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
8547 __Pyx_GIVEREF(__pyx_v_self);
8548 __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 = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8549 __Pyx_GOTREF(__pyx_t_6);
8550 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
8551 __pyx_r = __pyx_t_6;
8564 /* "csamtools.pyx":802
8565 * # check if header is present - otherwise sam_read1 aborts
8566 * # this happens if a bamfile is opened with mode 'r'
8567 * if has_coord: # <<<<<<<<<<<<<<
8568 * raise ValueError ("fetching by region is not available for sam files" )
8571 if (__pyx_v_has_coord) {
8573 /* "csamtools.pyx":803
8574 * # this happens if a bamfile is opened with mode 'r'
8576 * raise ValueError ("fetching by region is not available for sam files" ) # <<<<<<<<<<<<<<
8578 * if self.samfile.header.n_targets == 0:
8580 __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8581 __Pyx_GOTREF(__pyx_t_6);
8582 __Pyx_Raise(__pyx_t_6, 0, 0);
8583 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8584 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8589 /* "csamtools.pyx":805
8590 * raise ValueError ("fetching by region is not available for sam files" )
8592 * if self.samfile.header.n_targets == 0: # <<<<<<<<<<<<<<
8593 * raise ValueError( "fetch called for samfile without header")
8596 __pyx_t_3 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets == 0);
8599 /* "csamtools.pyx":806
8601 * if self.samfile.header.n_targets == 0:
8602 * raise ValueError( "fetch called for samfile without header") # <<<<<<<<<<<<<<
8606 __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8607 __Pyx_GOTREF(__pyx_t_6);
8608 __Pyx_Raise(__pyx_t_6, 0, 0);
8609 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8610 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8615 /* "csamtools.pyx":808
8616 * raise ValueError( "fetch called for samfile without header")
8618 * if callback: # <<<<<<<<<<<<<<
8619 * raise NotImplementedError( "callback not implemented yet" )
8622 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_callback); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8625 /* "csamtools.pyx":809
8628 * raise NotImplementedError( "callback not implemented yet" ) # <<<<<<<<<<<<<<
8630 * return IteratorRowAll( self, reopen=reopen )
8632 __pyx_t_6 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_57), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8633 __Pyx_GOTREF(__pyx_t_6);
8634 __Pyx_Raise(__pyx_t_6, 0, 0);
8635 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8636 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8641 /* "csamtools.pyx":811
8642 * raise NotImplementedError( "callback not implemented yet" )
8644 * return IteratorRowAll( self, reopen=reopen ) # <<<<<<<<<<<<<<
8648 __Pyx_XDECREF(__pyx_r);
8649 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8650 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
8651 __Pyx_INCREF(__pyx_v_self);
8652 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_self);
8653 __Pyx_GIVEREF(__pyx_v_self);
8654 __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8655 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
8656 __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8657 __Pyx_GOTREF(__pyx_t_7);
8658 if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reopen), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8659 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8660 __pyx_t_7 = PyEval_CallObjectWithKeywords(((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 = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8661 __Pyx_GOTREF(__pyx_t_7);
8662 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
8663 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
8664 __pyx_r = __pyx_t_7;
8672 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8675 __Pyx_XDECREF(__pyx_t_1);
8676 __Pyx_XDECREF(__pyx_t_2);
8677 __Pyx_XDECREF(__pyx_t_5);
8678 __Pyx_XDECREF(__pyx_t_6);
8679 __Pyx_XDECREF(__pyx_t_7);
8680 __Pyx_XDECREF(__pyx_t_12);
8681 __Pyx_AddTraceback("csamtools.Samfile.fetch");
8684 __Pyx_XGIVEREF(__pyx_r);
8685 __Pyx_TraceReturn(__pyx_r);
8686 __Pyx_RefNannyFinishContext();
8690 /* "csamtools.pyx":813
8691 * return IteratorRowAll( self, reopen=reopen )
8693 * def mate( self, # <<<<<<<<<<<<<<
8694 * AlignedRead read ):
8695 * '''return the mate of :class:`AlignedRead` *read*.
8698 static PyObject *__pyx_pf_9csamtools_7Samfile_11mate(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
8699 static char __pyx_doc_9csamtools_7Samfile_11mate[] = "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 ";
8700 static PyObject *__pyx_pf_9csamtools_7Samfile_11mate(PyObject *__pyx_v_self, PyObject *__pyx_v_read) {
8701 uint32_t __pyx_v_flag;
8702 __pyx_t_9csamtools_MateData __pyx_v_mate_data;
8704 struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_dest = 0;
8705 PyObject *__pyx_r = NULL;
8707 PyObject *__pyx_t_2 = NULL;
8708 PyObject *__pyx_t_3 = NULL;
8709 __Pyx_TraceDeclarations
8710 __Pyx_RefNannySetupContext("mate");
8711 __Pyx_TraceCall("mate", __pyx_f[0], 813);
8712 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_read), __pyx_ptype_9csamtools_AlignedRead, 1, "read", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8714 /* "csamtools.pyx":826
8717 * cdef uint32_t flag = read._delegate.core.flag # <<<<<<<<<<<<<<
8719 * if flag & BAM_FPAIRED == 0:
8721 __pyx_v_flag = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate->core.flag;
8723 /* "csamtools.pyx":828
8724 * cdef uint32_t flag = read._delegate.core.flag
8726 * if flag & BAM_FPAIRED == 0: # <<<<<<<<<<<<<<
8727 * raise ValueError( "read %s: is unpaired" % (read.qname))
8728 * if flag & BAM_FMUNMAP != 0:
8730 __pyx_t_1 = ((__pyx_v_flag & 1) == 0);
8733 /* "csamtools.pyx":829
8735 * if flag & BAM_FPAIRED == 0:
8736 * raise ValueError( "read %s: is unpaired" % (read.qname)) # <<<<<<<<<<<<<<
8737 * if flag & BAM_FMUNMAP != 0:
8738 * raise ValueError( "mate %s: is unmapped" % (read.qname))
8740 __pyx_t_2 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__qname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8741 __Pyx_GOTREF(__pyx_t_2);
8742 __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_58), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8743 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
8744 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8745 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8746 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
8747 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
8748 __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
8750 __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 = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8751 __Pyx_GOTREF(__pyx_t_3);
8752 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
8753 __Pyx_Raise(__pyx_t_3, 0, 0);
8754 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8755 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8760 /* "csamtools.pyx":830
8761 * if flag & BAM_FPAIRED == 0:
8762 * raise ValueError( "read %s: is unpaired" % (read.qname))
8763 * if flag & BAM_FMUNMAP != 0: # <<<<<<<<<<<<<<
8764 * raise ValueError( "mate %s: is unmapped" % (read.qname))
8767 __pyx_t_1 = ((__pyx_v_flag & 8) != 0);
8770 /* "csamtools.pyx":831
8771 * raise ValueError( "read %s: is unpaired" % (read.qname))
8772 * if flag & BAM_FMUNMAP != 0:
8773 * raise ValueError( "mate %s: is unmapped" % (read.qname)) # <<<<<<<<<<<<<<
8775 * cdef MateData mate_data
8777 __pyx_t_3 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__qname); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8778 __Pyx_GOTREF(__pyx_t_3);
8779 __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_59), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8780 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
8781 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8782 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8783 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
8784 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
8785 __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
8787 __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 = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8788 __Pyx_GOTREF(__pyx_t_2);
8789 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
8790 __Pyx_Raise(__pyx_t_2, 0, 0);
8791 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8792 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8797 /* "csamtools.pyx":835
8798 * cdef MateData mate_data
8800 * mate_data.name = <char *>bam1_qname(read._delegate) # <<<<<<<<<<<<<<
8801 * mate_data.mate = NULL
8802 * # xor flags to get the other mate
8804 __pyx_v_mate_data.name = bam1_qname(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate);
8806 /* "csamtools.pyx":836
8808 * mate_data.name = <char *>bam1_qname(read._delegate)
8809 * mate_data.mate = NULL # <<<<<<<<<<<<<<
8810 * # xor flags to get the other mate
8811 * cdef int x = BAM_FREAD1 + BAM_FREAD2
8813 __pyx_v_mate_data.mate = NULL;
8815 /* "csamtools.pyx":838
8816 * mate_data.mate = NULL
8817 * # xor flags to get the other mate
8818 * cdef int x = BAM_FREAD1 + BAM_FREAD2 # <<<<<<<<<<<<<<
8819 * mate_data.flag = ( flag ^ x) & x
8824 /* "csamtools.pyx":839
8825 * # xor flags to get the other mate
8826 * cdef int x = BAM_FREAD1 + BAM_FREAD2
8827 * mate_data.flag = ( flag ^ x) & x # <<<<<<<<<<<<<<
8829 * bam_fetch(self.samfile.x.bam,
8831 __pyx_v_mate_data.flag = ((__pyx_v_flag ^ __pyx_v_x) & __pyx_v_x);
8833 /* "csamtools.pyx":847
8834 * read._delegate.core.mpos + 1,
8835 * <void*>&mate_data,
8836 * mate_callback ) # <<<<<<<<<<<<<<
8838 * if mate_data.mate == NULL:
8840 bam_fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate->core.mtid, ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate->core.mpos, (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate->core.mpos + 1), ((void *)(&__pyx_v_mate_data)), __pyx_f_9csamtools_mate_callback);
8842 /* "csamtools.pyx":849
8845 * if mate_data.mate == NULL: # <<<<<<<<<<<<<<
8846 * raise ValueError( "mate not found" )
8849 __pyx_t_1 = (__pyx_v_mate_data.mate == NULL);
8852 /* "csamtools.pyx":850
8854 * if mate_data.mate == NULL:
8855 * raise ValueError( "mate not found" ) # <<<<<<<<<<<<<<
8857 * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
8859 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8860 __Pyx_GOTREF(__pyx_t_2);
8861 __Pyx_Raise(__pyx_t_2, 0, 0);
8862 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8863 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8868 /* "csamtools.pyx":852
8869 * raise ValueError( "mate not found" )
8871 * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead) # <<<<<<<<<<<<<<
8872 * dest._delegate = mate_data.mate
8875 __pyx_t_2 = __Pyx_tp_new(((PyObject*)__pyx_ptype_9csamtools_AlignedRead)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8876 __Pyx_GOTREF(__pyx_t_2);
8877 if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9csamtools_AlignedRead)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8878 __pyx_v_dest = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_t_2);
8881 /* "csamtools.pyx":853
8883 * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
8884 * dest._delegate = mate_data.mate # <<<<<<<<<<<<<<
8888 __pyx_v_dest->_delegate = __pyx_v_mate_data.mate;
8890 /* "csamtools.pyx":854
8891 * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
8892 * dest._delegate = mate_data.mate
8893 * return dest # <<<<<<<<<<<<<<
8897 __Pyx_XDECREF(__pyx_r);
8898 __Pyx_INCREF(((PyObject *)__pyx_v_dest));
8899 __pyx_r = ((PyObject *)__pyx_v_dest);
8902 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8905 __Pyx_XDECREF(__pyx_t_2);
8906 __Pyx_XDECREF(__pyx_t_3);
8907 __Pyx_AddTraceback("csamtools.Samfile.mate");
8910 __Pyx_XDECREF((PyObject *)__pyx_v_dest);
8911 __Pyx_XGIVEREF(__pyx_r);
8912 __Pyx_TraceReturn(__pyx_r);
8913 __Pyx_RefNannyFinishContext();
8917 /* "csamtools.pyx":856
8920 * def count( self, # <<<<<<<<<<<<<<
8925 static PyObject *__pyx_pf_9csamtools_7Samfile_12count(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8926 static char __pyx_doc_9csamtools_7Samfile_12count[] = "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 ";
8927 static PyObject *__pyx_pf_9csamtools_7Samfile_12count(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8928 PyObject *__pyx_v_reference = 0;
8929 PyObject *__pyx_v_start = 0;
8930 PyObject *__pyx_v_end = 0;
8931 PyObject *__pyx_v_region = 0;
8932 PyObject *__pyx_v_until_eof = 0;
8936 int __pyx_v_counter;
8937 PyObject *__pyx_r = NULL;
8938 PyObject *__pyx_t_1 = NULL;
8939 PyObject *__pyx_t_2 = NULL;
8942 PyObject *__pyx_t_5 = NULL;
8943 PyObject *__pyx_t_6 = NULL;
8944 PyObject *__pyx_t_7 = NULL;
8948 PyObject *__pyx_t_11 = NULL;
8951 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};
8952 __Pyx_TraceDeclarations
8953 __Pyx_RefNannySetupContext("count");
8954 __Pyx_TraceCall("count", __pyx_f[0], 856);
8955 if (unlikely(__pyx_kwds)) {
8956 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
8957 PyObject* values[5] = {0,0,0,0,0};
8959 /* "csamtools.pyx":857
8962 * reference = None, # <<<<<<<<<<<<<<
8966 values[0] = ((PyObject *)Py_None);
8968 /* "csamtools.pyx":858
8971 * start = None, # <<<<<<<<<<<<<<
8975 values[1] = ((PyObject *)Py_None);
8977 /* "csamtools.pyx":859
8980 * end = None, # <<<<<<<<<<<<<<
8982 * until_eof = False ):
8984 values[2] = ((PyObject *)Py_None);
8986 /* "csamtools.pyx":860
8989 * region = None, # <<<<<<<<<<<<<<
8990 * until_eof = False ):
8991 * '''*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)*
8993 values[3] = ((PyObject *)Py_None);
8994 values[4] = __pyx_k_62;
8995 switch (PyTuple_GET_SIZE(__pyx_args)) {
8996 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8997 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8998 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8999 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9000 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9002 default: goto __pyx_L5_argtuple_error;
9004 switch (PyTuple_GET_SIZE(__pyx_args)) {
9007 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
9008 if (value) { values[0] = value; kw_args--; }
9012 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
9013 if (value) { values[1] = value; kw_args--; }
9017 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
9018 if (value) { values[2] = value; kw_args--; }
9022 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region);
9023 if (value) { values[3] = value; kw_args--; }
9027 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__until_eof);
9028 if (value) { values[4] = value; kw_args--; }
9031 if (unlikely(kw_args > 0)) {
9032 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "count") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
9034 __pyx_v_reference = values[0];
9035 __pyx_v_start = values[1];
9036 __pyx_v_end = values[2];
9037 __pyx_v_region = values[3];
9038 __pyx_v_until_eof = values[4];
9041 /* "csamtools.pyx":857
9044 * reference = None, # <<<<<<<<<<<<<<
9048 __pyx_v_reference = ((PyObject *)Py_None);
9050 /* "csamtools.pyx":858
9053 * start = None, # <<<<<<<<<<<<<<
9057 __pyx_v_start = ((PyObject *)Py_None);
9059 /* "csamtools.pyx":859
9062 * end = None, # <<<<<<<<<<<<<<
9064 * until_eof = False ):
9066 __pyx_v_end = ((PyObject *)Py_None);
9068 /* "csamtools.pyx":860
9071 * region = None, # <<<<<<<<<<<<<<
9072 * until_eof = False ):
9073 * '''*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)*
9075 __pyx_v_region = ((PyObject *)Py_None);
9076 __pyx_v_until_eof = __pyx_k_62;
9077 switch (PyTuple_GET_SIZE(__pyx_args)) {
9078 case 5: __pyx_v_until_eof = PyTuple_GET_ITEM(__pyx_args, 4);
9079 case 4: __pyx_v_region = PyTuple_GET_ITEM(__pyx_args, 3);
9080 case 3: __pyx_v_end = PyTuple_GET_ITEM(__pyx_args, 2);
9081 case 2: __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 1);
9082 case 1: __pyx_v_reference = PyTuple_GET_ITEM(__pyx_args, 0);
9084 default: goto __pyx_L5_argtuple_error;
9087 goto __pyx_L4_argument_unpacking_done;
9088 __pyx_L5_argtuple_error:;
9089 __Pyx_RaiseArgtupleInvalid("count", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
9091 __Pyx_AddTraceback("csamtools.Samfile.count");
9092 __Pyx_RefNannyFinishContext();
9094 __pyx_L4_argument_unpacking_done:;
9095 __Pyx_INCREF(__pyx_v_region);
9097 /* "csamtools.pyx":874
9100 * if not self._isOpen(): # <<<<<<<<<<<<<<
9101 * raise ValueError( "I/O operation on closed file" )
9104 __pyx_t_1 = PyObject_GetAttr(__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;}
9105 __Pyx_GOTREF(__pyx_t_1);
9106 __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;}
9107 __Pyx_GOTREF(__pyx_t_2);
9108 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9109 __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;}
9110 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9111 __pyx_t_4 = (!__pyx_t_3);
9114 /* "csamtools.pyx":875
9116 * if not self._isOpen():
9117 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
9119 * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
9121 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_63), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9122 __Pyx_GOTREF(__pyx_t_2);
9123 __Pyx_Raise(__pyx_t_2, 0, 0);
9124 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9125 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9130 /* "csamtools.pyx":877
9131 * raise ValueError( "I/O operation on closed file" )
9133 * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) # <<<<<<<<<<<<<<
9137 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9138 __Pyx_GOTREF(__pyx_t_2);
9139 __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9140 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
9141 __Pyx_INCREF(__pyx_v_reference);
9142 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference);
9143 __Pyx_GIVEREF(__pyx_v_reference);
9144 __Pyx_INCREF(__pyx_v_start);
9145 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start);
9146 __Pyx_GIVEREF(__pyx_v_start);
9147 __Pyx_INCREF(__pyx_v_end);
9148 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end);
9149 __Pyx_GIVEREF(__pyx_v_end);
9150 __Pyx_INCREF(__pyx_v_region);
9151 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_region);
9152 __Pyx_GIVEREF(__pyx_v_region);
9153 __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 = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9154 __Pyx_GOTREF(__pyx_t_5);
9155 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9156 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
9157 if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 4)) {
9158 PyObject* tuple = __pyx_t_5;
9159 __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
9160 __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
9161 __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9162 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9163 __pyx_t_6 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_6);
9164 __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9165 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9166 __pyx_t_7 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_7);
9167 __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 = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9168 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9169 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9170 __Pyx_DECREF(__pyx_v_region);
9171 __pyx_v_region = __pyx_t_1;
9173 __pyx_v_rtid = __pyx_t_8;
9174 __pyx_v_rstart = __pyx_t_9;
9175 __pyx_v_rend = __pyx_t_10;
9177 __pyx_t_11 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9178 __Pyx_GOTREF(__pyx_t_11);
9179 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9180 __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_11, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9181 __Pyx_GOTREF(__pyx_t_1);
9182 __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_11, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9183 __Pyx_GOTREF(__pyx_t_2);
9184 __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 = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9185 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9186 __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_11, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9187 __Pyx_GOTREF(__pyx_t_6);
9188 __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9189 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9190 __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_11, 3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9191 __Pyx_GOTREF(__pyx_t_7);
9192 __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9193 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9194 if (__Pyx_EndUnpack(__pyx_t_11, 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9195 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
9196 __Pyx_DECREF(__pyx_v_region);
9197 __pyx_v_region = __pyx_t_1;
9199 __pyx_v_rtid = __pyx_t_10;
9200 __pyx_v_rstart = __pyx_t_9;
9201 __pyx_v_rend = __pyx_t_8;
9204 /* "csamtools.pyx":880
9207 * counter = 0; # <<<<<<<<<<<<<<
9211 __pyx_v_counter = 0;
9213 /* "csamtools.pyx":882
9216 * if self.isbam: # <<<<<<<<<<<<<<
9217 * if not until_eof and not self._hasIndex() and not self.isremote:
9218 * raise ValueError( "fetch called on bamfile without index" )
9220 if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam) {
9222 /* "csamtools.pyx":883
9225 * if not until_eof and not self._hasIndex() and not self.isremote: # <<<<<<<<<<<<<<
9226 * raise ValueError( "fetch called on bamfile without index" )
9229 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_until_eof); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9230 __pyx_t_3 = (!__pyx_t_4);
9232 __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9233 __Pyx_GOTREF(__pyx_t_5);
9234 __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 = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9235 __Pyx_GOTREF(__pyx_t_7);
9236 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9237 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9238 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9239 __pyx_t_12 = (!__pyx_t_4);
9241 __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote);
9242 __pyx_t_13 = __pyx_t_4;
9244 __pyx_t_13 = __pyx_t_12;
9246 __pyx_t_12 = __pyx_t_13;
9248 __pyx_t_12 = __pyx_t_3;
9252 /* "csamtools.pyx":884
9254 * if not until_eof and not self._hasIndex() and not self.isremote:
9255 * raise ValueError( "fetch called on bamfile without index" ) # <<<<<<<<<<<<<<
9259 __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_64), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9260 __Pyx_GOTREF(__pyx_t_7);
9261 __Pyx_Raise(__pyx_t_7, 0, 0);
9262 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9263 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9268 /* "csamtools.pyx":886
9269 * raise ValueError( "fetch called on bamfile without index" )
9271 * if not region: # <<<<<<<<<<<<<<
9272 * raise ValueError( "counting functionality requires a region/reference" )
9273 * if not self._hasIndex(): raise ValueError( "no index available for fetch" )
9275 __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9276 __pyx_t_3 = (!__pyx_t_12);
9279 /* "csamtools.pyx":887
9282 * raise ValueError( "counting functionality requires a region/reference" ) # <<<<<<<<<<<<<<
9283 * if not self._hasIndex(): raise ValueError( "no index available for fetch" )
9284 * bam_fetch(self.samfile.x.bam,
9286 __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_66), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9287 __Pyx_GOTREF(__pyx_t_7);
9288 __Pyx_Raise(__pyx_t_7, 0, 0);
9289 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9290 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9295 /* "csamtools.pyx":888
9297 * raise ValueError( "counting functionality requires a region/reference" )
9298 * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) # <<<<<<<<<<<<<<
9299 * bam_fetch(self.samfile.x.bam,
9302 __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9303 __Pyx_GOTREF(__pyx_t_7);
9304 __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 = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9305 __Pyx_GOTREF(__pyx_t_5);
9306 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9307 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9308 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9309 __pyx_t_12 = (!__pyx_t_3);
9311 __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_67), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9312 __Pyx_GOTREF(__pyx_t_5);
9313 __Pyx_Raise(__pyx_t_5, 0, 0);
9314 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9315 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9320 /* "csamtools.pyx":895
9323 * count_callback ) # <<<<<<<<<<<<<<
9327 bam_fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_rtid, __pyx_v_rstart, __pyx_v_rend, ((void *)(&__pyx_v_counter)), __pyx_f_9csamtools_count_callback);
9329 /* "csamtools.pyx":896
9332 * return counter # <<<<<<<<<<<<<<
9334 * raise ValueError ("count for a region is not available for sam files" )
9336 __Pyx_XDECREF(__pyx_r);
9337 __pyx_t_5 = PyInt_FromLong(__pyx_v_counter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9338 __Pyx_GOTREF(__pyx_t_5);
9339 __pyx_r = __pyx_t_5;
9346 /* "csamtools.pyx":898
9349 * raise ValueError ("count for a region is not available for sam files" ) # <<<<<<<<<<<<<<
9353 __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_69), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9354 __Pyx_GOTREF(__pyx_t_5);
9355 __Pyx_Raise(__pyx_t_5, 0, 0);
9356 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9357 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9361 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9364 __Pyx_XDECREF(__pyx_t_1);
9365 __Pyx_XDECREF(__pyx_t_2);
9366 __Pyx_XDECREF(__pyx_t_5);
9367 __Pyx_XDECREF(__pyx_t_6);
9368 __Pyx_XDECREF(__pyx_t_7);
9369 __Pyx_XDECREF(__pyx_t_11);
9370 __Pyx_AddTraceback("csamtools.Samfile.count");
9373 __Pyx_DECREF(__pyx_v_region);
9374 __Pyx_XGIVEREF(__pyx_r);
9375 __Pyx_TraceReturn(__pyx_r);
9376 __Pyx_RefNannyFinishContext();
9380 /* "csamtools.pyx":900
9381 * raise ValueError ("count for a region is not available for sam files" )
9383 * def pileup( self, # <<<<<<<<<<<<<<
9388 static PyObject *__pyx_pf_9csamtools_7Samfile_13pileup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9389 static char __pyx_doc_9csamtools_7Samfile_13pileup[] = "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.\n\n max_depth\n Maximum read depth permitted. The default limit is *8000*.\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 ";
9390 static PyObject *__pyx_pf_9csamtools_7Samfile_13pileup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9391 PyObject *__pyx_v_reference = 0;
9392 PyObject *__pyx_v_start = 0;
9393 PyObject *__pyx_v_end = 0;
9394 PyObject *__pyx_v_region = 0;
9395 PyObject *__pyx_v_callback = 0;
9396 PyObject *__pyx_v_kwargs = 0;
9400 int __pyx_v_has_coord;
9401 bam_plbuf_t *__pyx_v_buf;
9402 PyObject *__pyx_r = NULL;
9403 PyObject *__pyx_t_1 = NULL;
9404 PyObject *__pyx_t_2 = NULL;
9407 PyObject *__pyx_t_5 = NULL;
9408 PyObject *__pyx_t_6 = NULL;
9409 PyObject *__pyx_t_7 = NULL;
9414 PyObject *__pyx_t_12 = NULL;
9415 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};
9416 __Pyx_TraceDeclarations
9417 __Pyx_RefNannySetupContext("pileup");
9418 __Pyx_TraceCall("pileup", __pyx_f[0], 900);
9419 __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
9420 __Pyx_GOTREF(__pyx_v_kwargs);
9421 if (unlikely(__pyx_kwds)) {
9422 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
9423 PyObject* values[5] = {0,0,0,0,0};
9425 /* "csamtools.pyx":901
9428 * reference = None, # <<<<<<<<<<<<<<
9432 values[0] = ((PyObject *)Py_None);
9434 /* "csamtools.pyx":902
9437 * start = None, # <<<<<<<<<<<<<<
9441 values[1] = ((PyObject *)Py_None);
9443 /* "csamtools.pyx":903
9446 * end = None, # <<<<<<<<<<<<<<
9450 values[2] = ((PyObject *)Py_None);
9452 /* "csamtools.pyx":904
9455 * region = None, # <<<<<<<<<<<<<<
9459 values[3] = ((PyObject *)Py_None);
9461 /* "csamtools.pyx":905
9464 * callback = None, # <<<<<<<<<<<<<<
9468 values[4] = ((PyObject *)Py_None);
9469 switch (PyTuple_GET_SIZE(__pyx_args)) {
9470 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
9471 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9472 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9473 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9474 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9476 default: goto __pyx_L5_argtuple_error;
9478 switch (PyTuple_GET_SIZE(__pyx_args)) {
9481 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
9482 if (value) { values[0] = value; kw_args--; }
9486 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
9487 if (value) { values[1] = value; kw_args--; }
9491 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
9492 if (value) { values[2] = value; kw_args--; }
9496 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region);
9497 if (value) { values[3] = value; kw_args--; }
9501 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback);
9502 if (value) { values[4] = value; kw_args--; }
9505 if (unlikely(kw_args > 0)) {
9506 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "pileup") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
9508 __pyx_v_reference = values[0];
9509 __pyx_v_start = values[1];
9510 __pyx_v_end = values[2];
9511 __pyx_v_region = values[3];
9512 __pyx_v_callback = values[4];
9515 /* "csamtools.pyx":901
9518 * reference = None, # <<<<<<<<<<<<<<
9522 __pyx_v_reference = ((PyObject *)Py_None);
9524 /* "csamtools.pyx":902
9527 * start = None, # <<<<<<<<<<<<<<
9531 __pyx_v_start = ((PyObject *)Py_None);
9533 /* "csamtools.pyx":903
9536 * end = None, # <<<<<<<<<<<<<<
9540 __pyx_v_end = ((PyObject *)Py_None);
9542 /* "csamtools.pyx":904
9545 * region = None, # <<<<<<<<<<<<<<
9549 __pyx_v_region = ((PyObject *)Py_None);
9551 /* "csamtools.pyx":905
9554 * callback = None, # <<<<<<<<<<<<<<
9558 __pyx_v_callback = ((PyObject *)Py_None);
9559 switch (PyTuple_GET_SIZE(__pyx_args)) {
9560 case 5: __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 4);
9561 case 4: __pyx_v_region = PyTuple_GET_ITEM(__pyx_args, 3);
9562 case 3: __pyx_v_end = PyTuple_GET_ITEM(__pyx_args, 2);
9563 case 2: __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 1);
9564 case 1: __pyx_v_reference = PyTuple_GET_ITEM(__pyx_args, 0);
9566 default: goto __pyx_L5_argtuple_error;
9569 goto __pyx_L4_argument_unpacking_done;
9570 __pyx_L5_argtuple_error:;
9571 __Pyx_RaiseArgtupleInvalid("pileup", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
9573 __Pyx_DECREF(__pyx_v_kwargs);
9574 __Pyx_AddTraceback("csamtools.Samfile.pileup");
9575 __Pyx_RefNannyFinishContext();
9577 __pyx_L4_argument_unpacking_done:;
9579 /* "csamtools.pyx":951
9580 * cdef bam_plbuf_t *buf
9582 * if not self._isOpen(): # <<<<<<<<<<<<<<
9583 * raise ValueError( "I/O operation on closed file" )
9586 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9587 __Pyx_GOTREF(__pyx_t_1);
9588 __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 = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9589 __Pyx_GOTREF(__pyx_t_2);
9590 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9591 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9592 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9593 __pyx_t_4 = (!__pyx_t_3);
9596 /* "csamtools.pyx":952
9598 * if not self._isOpen():
9599 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
9601 * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
9603 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_70), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9604 __Pyx_GOTREF(__pyx_t_2);
9605 __Pyx_Raise(__pyx_t_2, 0, 0);
9606 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9607 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9612 /* "csamtools.pyx":954
9613 * raise ValueError( "I/O operation on closed file" )
9615 * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) # <<<<<<<<<<<<<<
9619 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9620 __Pyx_GOTREF(__pyx_t_2);
9621 __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9622 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
9623 __Pyx_INCREF(__pyx_v_reference);
9624 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference);
9625 __Pyx_GIVEREF(__pyx_v_reference);
9626 __Pyx_INCREF(__pyx_v_start);
9627 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start);
9628 __Pyx_GIVEREF(__pyx_v_start);
9629 __Pyx_INCREF(__pyx_v_end);
9630 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end);
9631 __Pyx_GIVEREF(__pyx_v_end);
9632 __Pyx_INCREF(__pyx_v_region);
9633 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_region);
9634 __Pyx_GIVEREF(__pyx_v_region);
9635 __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 = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9636 __Pyx_GOTREF(__pyx_t_5);
9637 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9638 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
9639 if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 4)) {
9640 PyObject* tuple = __pyx_t_5;
9641 __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
9642 __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9643 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9644 __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
9645 __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9646 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9647 __pyx_t_6 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_6);
9648 __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9649 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9650 __pyx_t_7 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_7);
9651 __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9652 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9653 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9654 __pyx_v_has_coord = __pyx_t_8;
9655 __pyx_v_rtid = __pyx_t_9;
9656 __pyx_v_rstart = __pyx_t_10;
9657 __pyx_v_rend = __pyx_t_11;
9659 __pyx_t_12 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9660 __Pyx_GOTREF(__pyx_t_12);
9661 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9662 __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_12, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9663 __Pyx_GOTREF(__pyx_t_1);
9664 __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9665 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9666 __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_12, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9667 __Pyx_GOTREF(__pyx_t_2);
9668 __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 = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9669 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9670 __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_12, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9671 __Pyx_GOTREF(__pyx_t_6);
9672 __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9673 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9674 __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_12, 3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9675 __Pyx_GOTREF(__pyx_t_7);
9676 __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9677 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9678 if (__Pyx_EndUnpack(__pyx_t_12, 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9679 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
9680 __pyx_v_has_coord = __pyx_t_11;
9681 __pyx_v_rtid = __pyx_t_10;
9682 __pyx_v_rstart = __pyx_t_9;
9683 __pyx_v_rend = __pyx_t_8;
9686 /* "csamtools.pyx":956
9687 * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
9689 * if self.isbam: # <<<<<<<<<<<<<<
9690 * if not self._hasIndex(): raise ValueError( "no index available for pileup" )
9693 if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam) {
9695 /* "csamtools.pyx":957
9698 * if not self._hasIndex(): raise ValueError( "no index available for pileup" ) # <<<<<<<<<<<<<<
9702 __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9703 __Pyx_GOTREF(__pyx_t_5);
9704 __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 = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9705 __Pyx_GOTREF(__pyx_t_7);
9706 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9707 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9708 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9709 __pyx_t_3 = (!__pyx_t_4);
9711 __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_72), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9712 __Pyx_GOTREF(__pyx_t_7);
9713 __Pyx_Raise(__pyx_t_7, 0, 0);
9714 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9715 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9720 /* "csamtools.pyx":959
9721 * if not self._hasIndex(): raise ValueError( "no index available for pileup" )
9723 * if callback: # <<<<<<<<<<<<<<
9724 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
9727 __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;}
9730 /* "csamtools.pyx":960
9733 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) # <<<<<<<<<<<<<<
9735 * buf = bam_plbuf_init( <bam_pileup_f>pileup_callback, <void*>callback )
9737 __pyx_t_3 = (!__pyx_v_has_coord);
9739 __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_73), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9740 __Pyx_GOTREF(__pyx_t_7);
9741 __Pyx_Raise(__pyx_t_7, 0, 0);
9742 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9743 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9748 /* "csamtools.pyx":962
9749 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
9751 * buf = bam_plbuf_init( <bam_pileup_f>pileup_callback, <void*>callback ) # <<<<<<<<<<<<<<
9752 * bam_fetch(self.samfile.x.bam,
9753 * self.index, rtid, rstart, rend,
9755 __pyx_v_buf = bam_plbuf_init(((bam_pileup_f)__pyx_f_9csamtools_pileup_callback), ((void *)__pyx_v_callback));
9757 /* "csamtools.pyx":965
9758 * bam_fetch(self.samfile.x.bam,
9759 * self.index, rtid, rstart, rend,
9760 * buf, pileup_fetch_callback ) # <<<<<<<<<<<<<<
9764 bam_fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_rtid, __pyx_v_rstart, __pyx_v_rend, __pyx_v_buf, __pyx_f_9csamtools_pileup_fetch_callback);
9766 /* "csamtools.pyx":968
9769 * bam_plbuf_push( NULL, buf) # <<<<<<<<<<<<<<
9770 * bam_plbuf_destroy(buf)
9773 bam_plbuf_push(NULL, __pyx_v_buf);
9775 /* "csamtools.pyx":969
9777 * bam_plbuf_push( NULL, buf)
9778 * bam_plbuf_destroy(buf) # <<<<<<<<<<<<<<
9782 bam_plbuf_destroy(__pyx_v_buf);
9787 /* "csamtools.pyx":971
9788 * bam_plbuf_destroy(buf)
9790 * if has_coord: # <<<<<<<<<<<<<<
9791 * return IteratorColumnRegion( self,
9794 if (__pyx_v_has_coord) {
9796 /* "csamtools.pyx":972
9799 * return IteratorColumnRegion( self, # <<<<<<<<<<<<<<
9803 __Pyx_XDECREF(__pyx_r);
9804 __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9805 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
9806 __Pyx_INCREF(__pyx_v_self);
9807 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self);
9808 __Pyx_GIVEREF(__pyx_v_self);
9809 __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9810 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
9812 /* "csamtools.pyx":973
9814 * return IteratorColumnRegion( self,
9815 * tid = rtid, # <<<<<<<<<<<<<<
9819 __pyx_t_6 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9820 __Pyx_GOTREF(__pyx_t_6);
9821 if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__tid), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9822 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9824 /* "csamtools.pyx":974
9825 * return IteratorColumnRegion( self,
9827 * start = rstart, # <<<<<<<<<<<<<<
9831 __pyx_t_6 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9832 __Pyx_GOTREF(__pyx_t_6);
9833 if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__start), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9834 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9836 /* "csamtools.pyx":975
9839 * end = rend, # <<<<<<<<<<<<<<
9843 __pyx_t_6 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9844 __Pyx_GOTREF(__pyx_t_6);
9845 if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__end), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9846 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9848 /* "csamtools.pyx":976
9851 * **kwargs ) # <<<<<<<<<<<<<<
9853 * return IteratorColumnAllRefs(self, **kwargs )
9855 if (PyDict_Update(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_v_kwargs)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9856 __pyx_t_6 = PyEval_CallObjectWithKeywords(((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 = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9857 __Pyx_GOTREF(__pyx_t_6);
9858 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
9859 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
9860 __pyx_r = __pyx_t_6;
9867 /* "csamtools.pyx":978
9870 * return IteratorColumnAllRefs(self, **kwargs ) # <<<<<<<<<<<<<<
9874 __Pyx_XDECREF(__pyx_r);
9875 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9876 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
9877 __Pyx_INCREF(__pyx_v_self);
9878 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_self);
9879 __Pyx_GIVEREF(__pyx_v_self);
9880 __pyx_t_5 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorColumnAllRefs)), ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9881 __Pyx_GOTREF(__pyx_t_5);
9882 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
9883 __pyx_r = __pyx_t_5;
9894 /* "csamtools.pyx":981
9897 * raise NotImplementedError( "pileup of samfiles not implemented yet" ) # <<<<<<<<<<<<<<
9899 * def close( self ):
9901 __pyx_t_5 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_75), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9902 __Pyx_GOTREF(__pyx_t_5);
9903 __Pyx_Raise(__pyx_t_5, 0, 0);
9904 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9905 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9909 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9912 __Pyx_XDECREF(__pyx_t_1);
9913 __Pyx_XDECREF(__pyx_t_2);
9914 __Pyx_XDECREF(__pyx_t_5);
9915 __Pyx_XDECREF(__pyx_t_6);
9916 __Pyx_XDECREF(__pyx_t_7);
9917 __Pyx_XDECREF(__pyx_t_12);
9918 __Pyx_AddTraceback("csamtools.Samfile.pileup");
9921 __Pyx_DECREF(__pyx_v_kwargs);
9922 __Pyx_XGIVEREF(__pyx_r);
9923 __Pyx_TraceReturn(__pyx_r);
9924 __Pyx_RefNannyFinishContext();
9928 /* "csamtools.pyx":983
9929 * raise NotImplementedError( "pileup of samfiles not implemented yet" )
9931 * def close( self ): # <<<<<<<<<<<<<<
9933 * closes the :class:`pysam.Samfile`.'''
9936 static PyObject *__pyx_pf_9csamtools_7Samfile_14close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
9937 static char __pyx_doc_9csamtools_7Samfile_14close[] = "Samfile.close(self)\n\n closes the :class:`pysam.Samfile`.";
9938 static PyObject *__pyx_pf_9csamtools_7Samfile_14close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9939 PyObject *__pyx_r = NULL;
9941 __Pyx_TraceDeclarations
9942 __Pyx_RefNannySetupContext("close");
9943 __Pyx_TraceCall("close", __pyx_f[0], 983);
9945 /* "csamtools.pyx":986
9947 * closes the :class:`pysam.Samfile`.'''
9948 * if self.samfile != NULL: # <<<<<<<<<<<<<<
9949 * samclose( self.samfile )
9950 * bam_index_destroy(self.index);
9952 __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile != NULL);
9955 /* "csamtools.pyx":987
9956 * closes the :class:`pysam.Samfile`.'''
9957 * if self.samfile != NULL:
9958 * samclose( self.samfile ) # <<<<<<<<<<<<<<
9959 * bam_index_destroy(self.index);
9960 * self.samfile = NULL
9962 samclose(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile);
9964 /* "csamtools.pyx":988
9965 * if self.samfile != NULL:
9966 * samclose( self.samfile )
9967 * bam_index_destroy(self.index); # <<<<<<<<<<<<<<
9968 * self.samfile = NULL
9971 bam_index_destroy(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index);
9973 /* "csamtools.pyx":989
9974 * samclose( self.samfile )
9975 * bam_index_destroy(self.index);
9976 * self.samfile = NULL # <<<<<<<<<<<<<<
9978 * def __dealloc__( self ):
9980 ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = NULL;
9985 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9986 __Pyx_XGIVEREF(__pyx_r);
9987 __Pyx_TraceReturn(__pyx_r);
9988 __Pyx_RefNannyFinishContext();
9992 /* "csamtools.pyx":991
9993 * self.samfile = NULL
9995 * def __dealloc__( self ): # <<<<<<<<<<<<<<
9996 * # remember: dealloc cannot call other methods
9997 * # note: no doc string
10000 static void __pyx_pf_9csamtools_7Samfile_15__dealloc__(PyObject *__pyx_v_self); /*proto*/
10001 static void __pyx_pf_9csamtools_7Samfile_15__dealloc__(PyObject *__pyx_v_self) {
10002 PyObject *__pyx_t_1 = NULL;
10003 PyObject *__pyx_t_2 = NULL;
10005 __Pyx_TraceDeclarations
10006 __Pyx_RefNannySetupContext("__dealloc__");
10007 __Pyx_TraceCall("__dealloc__", __pyx_f[0], 991);
10009 /* "csamtools.pyx":995
10010 * # note: no doc string
10011 * # note: __del__ is not called.
10012 * self.close() # <<<<<<<<<<<<<<
10013 * bam_destroy1(self.b)
10014 * if self._filename != NULL: free( self._filename )
10016 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10017 __Pyx_GOTREF(__pyx_t_1);
10018 __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 = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10019 __Pyx_GOTREF(__pyx_t_2);
10020 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10021 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10023 /* "csamtools.pyx":996
10024 * # note: __del__ is not called.
10026 * bam_destroy1(self.b) # <<<<<<<<<<<<<<
10027 * if self._filename != NULL: free( self._filename )
10030 bam_destroy1(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->b);
10032 /* "csamtools.pyx":997
10034 * bam_destroy1(self.b)
10035 * if self._filename != NULL: free( self._filename ) # <<<<<<<<<<<<<<
10037 * cpdef int write( self, AlignedRead read ) except -1:
10039 __pyx_t_3 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename != NULL);
10041 free(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename);
10048 __Pyx_XDECREF(__pyx_t_1);
10049 __Pyx_XDECREF(__pyx_t_2);
10050 __Pyx_AddTraceback("csamtools.Samfile.__dealloc__");
10052 __Pyx_TraceReturn(Py_None);
10053 __Pyx_RefNannyFinishContext();
10056 /* "csamtools.pyx":999
10057 * if self._filename != NULL: free( self._filename )
10059 * cpdef int write( self, AlignedRead read ) except -1: # <<<<<<<<<<<<<<
10061 * write a single :class:`pysam.AlignedRead` to disk.
10064 static PyObject *__pyx_pf_9csamtools_7Samfile_16write(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
10065 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) {
10067 PyObject *__pyx_t_1 = NULL;
10068 PyObject *__pyx_t_2 = NULL;
10069 PyObject *__pyx_t_3 = NULL;
10073 __Pyx_TraceDeclarations
10074 __Pyx_RefNannySetupContext("write");
10075 __Pyx_TraceCall("write", __pyx_f[0], 999);
10076 /* Check if called by wrapper */
10077 if (unlikely(__pyx_skip_dispatch)) ;
10078 /* Check if overriden in Python */
10079 else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
10080 __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 = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10081 __Pyx_GOTREF(__pyx_t_1);
10082 if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_9csamtools_7Samfile_16write)) {
10083 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10084 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
10085 __Pyx_INCREF(((PyObject *)__pyx_v_read));
10086 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_read));
10087 __Pyx_GIVEREF(((PyObject *)__pyx_v_read));
10088 __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 = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10089 __Pyx_GOTREF(__pyx_t_3);
10090 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
10091 __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 = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10092 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10093 __pyx_r = __pyx_t_4;
10094 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10097 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10100 /* "csamtools.pyx":1005
10101 * returns the number of bytes written.
10103 * if not self._isOpen(): # <<<<<<<<<<<<<<
10107 __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 = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10108 __Pyx_GOTREF(__pyx_t_1);
10109 __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 = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10110 __Pyx_GOTREF(__pyx_t_3);
10111 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10112 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10113 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10114 __pyx_t_6 = (!__pyx_t_5);
10117 /* "csamtools.pyx":1006
10119 * if not self._isOpen():
10120 * return 0 # <<<<<<<<<<<<<<
10122 * return samwrite( self.samfile, read._delegate )
10130 /* "csamtools.pyx":1008
10133 * return samwrite( self.samfile, read._delegate ) # <<<<<<<<<<<<<<
10135 * def __enter__(self):
10137 __pyx_r = samwrite(__pyx_v_self->samfile, __pyx_v_read->_delegate);
10143 __Pyx_XDECREF(__pyx_t_1);
10144 __Pyx_XDECREF(__pyx_t_2);
10145 __Pyx_XDECREF(__pyx_t_3);
10146 __Pyx_WriteUnraisable("csamtools.Samfile.write");
10149 __Pyx_TraceReturn(Py_None);
10150 __Pyx_RefNannyFinishContext();
10154 /* "csamtools.pyx":999
10155 * if self._filename != NULL: free( self._filename )
10157 * cpdef int write( self, AlignedRead read ) except -1: # <<<<<<<<<<<<<<
10159 * write a single :class:`pysam.AlignedRead` to disk.
10162 static PyObject *__pyx_pf_9csamtools_7Samfile_16write(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/
10163 static char __pyx_doc_9csamtools_7Samfile_16write[] = "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 ";
10164 static PyObject *__pyx_pf_9csamtools_7Samfile_16write(PyObject *__pyx_v_self, PyObject *__pyx_v_read) {
10165 PyObject *__pyx_r = NULL;
10166 PyObject *__pyx_t_1 = NULL;
10167 __Pyx_TraceDeclarations
10168 __Pyx_RefNannySetupContext("write");
10169 __Pyx_TraceCall("write", __pyx_f[0], 999);
10170 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_read), __pyx_ptype_9csamtools_AlignedRead, 1, "read", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10171 __Pyx_XDECREF(__pyx_r);
10172 __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_9csamtools_Samfile *)((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->__pyx_vtab)->write(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10173 __Pyx_GOTREF(__pyx_t_1);
10174 __pyx_r = __pyx_t_1;
10178 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10181 __Pyx_XDECREF(__pyx_t_1);
10182 __Pyx_AddTraceback("csamtools.Samfile.write");
10185 __Pyx_XGIVEREF(__pyx_r);
10186 __Pyx_TraceReturn(__pyx_r);
10187 __Pyx_RefNannyFinishContext();
10191 /* "csamtools.pyx":1010
10192 * return samwrite( self.samfile, read._delegate )
10194 * def __enter__(self): # <<<<<<<<<<<<<<
10199 static PyObject *__pyx_pf_9csamtools_7Samfile_17__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
10200 static char __pyx_doc_9csamtools_7Samfile_17__enter__[] = "Samfile.__enter__(self)";
10201 static PyObject *__pyx_pf_9csamtools_7Samfile_17__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
10202 PyObject *__pyx_r = NULL;
10203 __Pyx_TraceDeclarations
10204 __Pyx_RefNannySetupContext("__enter__");
10205 __Pyx_TraceCall("__enter__", __pyx_f[0], 1010);
10207 /* "csamtools.pyx":1011
10209 * def __enter__(self):
10210 * return self # <<<<<<<<<<<<<<
10212 * def __exit__(self, exc_type, exc_value, traceback):
10214 __Pyx_XDECREF(__pyx_r);
10215 __Pyx_INCREF(__pyx_v_self);
10216 __pyx_r = __pyx_v_self;
10219 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10221 __Pyx_XGIVEREF(__pyx_r);
10222 __Pyx_TraceReturn(__pyx_r);
10223 __Pyx_RefNannyFinishContext();
10227 /* "csamtools.pyx":1013
10230 * def __exit__(self, exc_type, exc_value, traceback): # <<<<<<<<<<<<<<
10235 static PyObject *__pyx_pf_9csamtools_7Samfile_18__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
10236 static char __pyx_doc_9csamtools_7Samfile_18__exit__[] = "Samfile.__exit__(self, exc_type, exc_value, traceback)";
10237 static PyObject *__pyx_pf_9csamtools_7Samfile_18__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10238 PyObject *__pyx_v_exc_type = 0;
10239 PyObject *__pyx_v_exc_value = 0;
10240 PyObject *__pyx_v_traceback = 0;
10241 PyObject *__pyx_r = NULL;
10242 PyObject *__pyx_t_1 = NULL;
10243 PyObject *__pyx_t_2 = NULL;
10244 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__exc_type,&__pyx_n_s__exc_value,&__pyx_n_s__traceback,0};
10245 __Pyx_TraceDeclarations
10246 __Pyx_RefNannySetupContext("__exit__");
10247 __Pyx_TraceCall("__exit__", __pyx_f[0], 1013);
10248 if (unlikely(__pyx_kwds)) {
10249 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
10250 PyObject* values[3] = {0,0,0};
10251 switch (PyTuple_GET_SIZE(__pyx_args)) {
10252 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10253 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10254 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10256 default: goto __pyx_L5_argtuple_error;
10258 switch (PyTuple_GET_SIZE(__pyx_args)) {
10260 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exc_type);
10261 if (likely(values[0])) kw_args--;
10262 else goto __pyx_L5_argtuple_error;
10264 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exc_value);
10265 if (likely(values[1])) kw_args--;
10267 __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10270 values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__traceback);
10271 if (likely(values[2])) kw_args--;
10273 __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10276 if (unlikely(kw_args > 0)) {
10277 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10279 __pyx_v_exc_type = values[0];
10280 __pyx_v_exc_value = values[1];
10281 __pyx_v_traceback = values[2];
10282 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
10283 goto __pyx_L5_argtuple_error;
10285 __pyx_v_exc_type = PyTuple_GET_ITEM(__pyx_args, 0);
10286 __pyx_v_exc_value = PyTuple_GET_ITEM(__pyx_args, 1);
10287 __pyx_v_traceback = PyTuple_GET_ITEM(__pyx_args, 2);
10289 goto __pyx_L4_argument_unpacking_done;
10290 __pyx_L5_argtuple_error:;
10291 __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
10293 __Pyx_AddTraceback("csamtools.Samfile.__exit__");
10294 __Pyx_RefNannyFinishContext();
10296 __pyx_L4_argument_unpacking_done:;
10298 /* "csamtools.pyx":1014
10300 * def __exit__(self, exc_type, exc_value, traceback):
10301 * self.close() # <<<<<<<<<<<<<<
10305 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10306 __Pyx_GOTREF(__pyx_t_1);
10307 __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 = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10308 __Pyx_GOTREF(__pyx_t_2);
10309 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10310 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10312 /* "csamtools.pyx":1015
10313 * def __exit__(self, exc_type, exc_value, traceback):
10315 * return False # <<<<<<<<<<<<<<
10317 * ###############################################################
10319 __Pyx_XDECREF(__pyx_r);
10320 __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10321 __Pyx_GOTREF(__pyx_t_2);
10322 __pyx_r = __pyx_t_2;
10326 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10329 __Pyx_XDECREF(__pyx_t_1);
10330 __Pyx_XDECREF(__pyx_t_2);
10331 __Pyx_AddTraceback("csamtools.Samfile.__exit__");
10334 __Pyx_XGIVEREF(__pyx_r);
10335 __Pyx_TraceReturn(__pyx_r);
10336 __Pyx_RefNannyFinishContext();
10340 /* "csamtools.pyx":1024
10341 * property filename:
10342 * '''number of :term:`filename` associated with this object.'''
10343 * def __get__(self): # <<<<<<<<<<<<<<
10344 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
10345 * return self._filename
10348 static PyObject *__pyx_pf_9csamtools_7Samfile_8filename___get__(PyObject *__pyx_v_self); /*proto*/
10349 static PyObject *__pyx_pf_9csamtools_7Samfile_8filename___get__(PyObject *__pyx_v_self) {
10350 PyObject *__pyx_r = NULL;
10351 PyObject *__pyx_t_1 = NULL;
10352 PyObject *__pyx_t_2 = NULL;
10355 __Pyx_TraceDeclarations
10356 __Pyx_RefNannySetupContext("__get__");
10357 __Pyx_TraceCall("__get__", __pyx_f[0], 1024);
10359 /* "csamtools.pyx":1025
10360 * '''number of :term:`filename` associated with this object.'''
10361 * def __get__(self):
10362 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
10363 * return self._filename
10366 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10367 __Pyx_GOTREF(__pyx_t_1);
10368 __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 = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10369 __Pyx_GOTREF(__pyx_t_2);
10370 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10371 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10372 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10373 __pyx_t_4 = (!__pyx_t_3);
10375 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_76), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10376 __Pyx_GOTREF(__pyx_t_2);
10377 __Pyx_Raise(__pyx_t_2, 0, 0);
10378 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10379 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10384 /* "csamtools.pyx":1026
10385 * def __get__(self):
10386 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
10387 * return self._filename # <<<<<<<<<<<<<<
10389 * property nreferences:
10391 __Pyx_XDECREF(__pyx_r);
10392 __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10393 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
10394 __pyx_r = ((PyObject *)__pyx_t_2);
10398 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10401 __Pyx_XDECREF(__pyx_t_1);
10402 __Pyx_XDECREF(__pyx_t_2);
10403 __Pyx_AddTraceback("csamtools.Samfile.filename.__get__");
10406 __Pyx_XGIVEREF(__pyx_r);
10407 __Pyx_TraceReturn(__pyx_r);
10408 __Pyx_RefNannyFinishContext();
10412 /* "csamtools.pyx":1030
10413 * property nreferences:
10414 * '''number of :term:`reference` sequences in the file.'''
10415 * def __get__(self): # <<<<<<<<<<<<<<
10416 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
10417 * return self.samfile.header.n_targets
10420 static PyObject *__pyx_pf_9csamtools_7Samfile_11nreferences___get__(PyObject *__pyx_v_self); /*proto*/
10421 static PyObject *__pyx_pf_9csamtools_7Samfile_11nreferences___get__(PyObject *__pyx_v_self) {
10422 PyObject *__pyx_r = NULL;
10423 PyObject *__pyx_t_1 = NULL;
10424 PyObject *__pyx_t_2 = NULL;
10427 __Pyx_TraceDeclarations
10428 __Pyx_RefNannySetupContext("__get__");
10429 __Pyx_TraceCall("__get__", __pyx_f[0], 1030);
10431 /* "csamtools.pyx":1031
10432 * '''number of :term:`reference` sequences in the file.'''
10433 * def __get__(self):
10434 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
10435 * return self.samfile.header.n_targets
10438 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10439 __Pyx_GOTREF(__pyx_t_1);
10440 __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 = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10441 __Pyx_GOTREF(__pyx_t_2);
10442 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10443 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10444 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10445 __pyx_t_4 = (!__pyx_t_3);
10447 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_77), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10448 __Pyx_GOTREF(__pyx_t_2);
10449 __Pyx_Raise(__pyx_t_2, 0, 0);
10450 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10451 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10456 /* "csamtools.pyx":1032
10457 * def __get__(self):
10458 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
10459 * return self.samfile.header.n_targets # <<<<<<<<<<<<<<
10461 * property references:
10463 __Pyx_XDECREF(__pyx_r);
10464 __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10465 __Pyx_GOTREF(__pyx_t_2);
10466 __pyx_r = __pyx_t_2;
10470 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10473 __Pyx_XDECREF(__pyx_t_1);
10474 __Pyx_XDECREF(__pyx_t_2);
10475 __Pyx_AddTraceback("csamtools.Samfile.nreferences.__get__");
10478 __Pyx_XGIVEREF(__pyx_r);
10479 __Pyx_TraceReturn(__pyx_r);
10480 __Pyx_RefNannyFinishContext();
10484 /* "csamtools.pyx":1036
10485 * property references:
10486 * """tuple with the names of :term:`reference` sequences."""
10487 * def __get__(self): # <<<<<<<<<<<<<<
10488 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
10492 static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(PyObject *__pyx_v_self); /*proto*/
10493 static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(PyObject *__pyx_v_self) {
10494 PyObject *__pyx_v_t;
10496 PyObject *__pyx_r = NULL;
10497 PyObject *__pyx_t_1 = NULL;
10498 PyObject *__pyx_t_2 = NULL;
10503 __Pyx_TraceDeclarations
10504 __Pyx_RefNannySetupContext("__get__");
10505 __Pyx_TraceCall("__get__", __pyx_f[0], 1036);
10506 __pyx_v_t = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
10508 /* "csamtools.pyx":1037
10509 * """tuple with the names of :term:`reference` sequences."""
10510 * def __get__(self):
10511 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
10513 * for x from 0 <= x < self.samfile.header.n_targets:
10515 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10516 __Pyx_GOTREF(__pyx_t_1);
10517 __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 = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10518 __Pyx_GOTREF(__pyx_t_2);
10519 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10520 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10521 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10522 __pyx_t_4 = (!__pyx_t_3);
10524 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_78), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10525 __Pyx_GOTREF(__pyx_t_2);
10526 __Pyx_Raise(__pyx_t_2, 0, 0);
10527 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10528 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10533 /* "csamtools.pyx":1038
10534 * def __get__(self):
10535 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
10536 * t = [] # <<<<<<<<<<<<<<
10537 * for x from 0 <= x < self.samfile.header.n_targets:
10538 * t.append( self.samfile.header.target_name[x] )
10540 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10541 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
10542 __Pyx_DECREF(((PyObject *)__pyx_v_t));
10543 __pyx_v_t = __pyx_t_2;
10546 /* "csamtools.pyx":1039
10547 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
10549 * for x from 0 <= x < self.samfile.header.n_targets: # <<<<<<<<<<<<<<
10550 * t.append( self.samfile.header.target_name[x] )
10553 __pyx_t_5 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets;
10554 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_5; __pyx_v_x++) {
10556 /* "csamtools.pyx":1040
10558 * for x from 0 <= x < self.samfile.header.n_targets:
10559 * t.append( self.samfile.header.target_name[x] ) # <<<<<<<<<<<<<<
10563 if (unlikely(__pyx_v_t == Py_None)) {
10564 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10566 __pyx_t_2 = PyBytes_FromString((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->target_name[__pyx_v_x])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10567 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
10568 __pyx_t_6 = PyList_Append(__pyx_v_t, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10569 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
10572 /* "csamtools.pyx":1041
10573 * for x from 0 <= x < self.samfile.header.n_targets:
10574 * t.append( self.samfile.header.target_name[x] )
10575 * return tuple(t) # <<<<<<<<<<<<<<
10577 * property lengths:
10579 __Pyx_XDECREF(__pyx_r);
10580 if (unlikely(__pyx_v_t == Py_None)) {
10581 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10583 __pyx_t_2 = ((PyObject *)PyList_AsTuple(__pyx_v_t)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10584 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
10585 __pyx_r = ((PyObject *)__pyx_t_2);
10589 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10592 __Pyx_XDECREF(__pyx_t_1);
10593 __Pyx_XDECREF(__pyx_t_2);
10594 __Pyx_AddTraceback("csamtools.Samfile.references.__get__");
10597 __Pyx_DECREF(__pyx_v_t);
10598 __Pyx_XGIVEREF(__pyx_r);
10599 __Pyx_TraceReturn(__pyx_r);
10600 __Pyx_RefNannyFinishContext();
10604 /* "csamtools.pyx":1047
10605 * :attr:`pysam.Samfile.references`
10607 * def __get__(self): # <<<<<<<<<<<<<<
10608 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
10612 static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(PyObject *__pyx_v_self); /*proto*/
10613 static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(PyObject *__pyx_v_self) {
10614 PyObject *__pyx_v_t;
10616 PyObject *__pyx_r = NULL;
10617 PyObject *__pyx_t_1 = NULL;
10618 PyObject *__pyx_t_2 = NULL;
10623 __Pyx_TraceDeclarations
10624 __Pyx_RefNannySetupContext("__get__");
10625 __Pyx_TraceCall("__get__", __pyx_f[0], 1047);
10626 __pyx_v_t = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
10628 /* "csamtools.pyx":1048
10630 * def __get__(self):
10631 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
10633 * for x from 0 <= x < self.samfile.header.n_targets:
10635 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10636 __Pyx_GOTREF(__pyx_t_1);
10637 __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 = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10638 __Pyx_GOTREF(__pyx_t_2);
10639 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10640 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10641 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10642 __pyx_t_4 = (!__pyx_t_3);
10644 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_79), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10645 __Pyx_GOTREF(__pyx_t_2);
10646 __Pyx_Raise(__pyx_t_2, 0, 0);
10647 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10648 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10653 /* "csamtools.pyx":1049
10654 * def __get__(self):
10655 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
10656 * t = [] # <<<<<<<<<<<<<<
10657 * for x from 0 <= x < self.samfile.header.n_targets:
10658 * t.append( self.samfile.header.target_len[x] )
10660 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10661 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
10662 __Pyx_DECREF(((PyObject *)__pyx_v_t));
10663 __pyx_v_t = __pyx_t_2;
10666 /* "csamtools.pyx":1050
10667 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
10669 * for x from 0 <= x < self.samfile.header.n_targets: # <<<<<<<<<<<<<<
10670 * t.append( self.samfile.header.target_len[x] )
10673 __pyx_t_5 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets;
10674 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_5; __pyx_v_x++) {
10676 /* "csamtools.pyx":1051
10678 * for x from 0 <= x < self.samfile.header.n_targets:
10679 * t.append( self.samfile.header.target_len[x] ) # <<<<<<<<<<<<<<
10683 if (unlikely(__pyx_v_t == Py_None)) {
10684 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10686 __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->target_len[__pyx_v_x])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10687 __Pyx_GOTREF(__pyx_t_2);
10688 __pyx_t_6 = PyList_Append(__pyx_v_t, __pyx_t_2); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10689 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10692 /* "csamtools.pyx":1052
10693 * for x from 0 <= x < self.samfile.header.n_targets:
10694 * t.append( self.samfile.header.target_len[x] )
10695 * return tuple(t) # <<<<<<<<<<<<<<
10699 __Pyx_XDECREF(__pyx_r);
10700 if (unlikely(__pyx_v_t == Py_None)) {
10701 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10703 __pyx_t_2 = ((PyObject *)PyList_AsTuple(__pyx_v_t)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10704 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
10705 __pyx_r = ((PyObject *)__pyx_t_2);
10709 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10712 __Pyx_XDECREF(__pyx_t_1);
10713 __Pyx_XDECREF(__pyx_t_2);
10714 __Pyx_AddTraceback("csamtools.Samfile.lengths.__get__");
10717 __Pyx_DECREF(__pyx_v_t);
10718 __Pyx_XGIVEREF(__pyx_r);
10719 __Pyx_TraceReturn(__pyx_r);
10720 __Pyx_RefNannyFinishContext();
10724 /* "csamtools.pyx":1057
10725 * """total number of mapped reads in file.
10727 * def __get__(self): # <<<<<<<<<<<<<<
10728 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
10729 * if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" )
10732 static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(PyObject *__pyx_v_self); /*proto*/
10733 static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(PyObject *__pyx_v_self) {
10735 uint32_t __pyx_v_total;
10736 PyObject *__pyx_r = NULL;
10737 PyObject *__pyx_t_1 = NULL;
10738 PyObject *__pyx_t_2 = NULL;
10742 __Pyx_TraceDeclarations
10743 __Pyx_RefNannySetupContext("__get__");
10744 __Pyx_TraceCall("__get__", __pyx_f[0], 1057);
10746 /* "csamtools.pyx":1058
10748 * def __get__(self):
10749 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
10750 * if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" )
10753 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10754 __Pyx_GOTREF(__pyx_t_1);
10755 __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 = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10756 __Pyx_GOTREF(__pyx_t_2);
10757 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10758 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10759 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10760 __pyx_t_4 = (!__pyx_t_3);
10762 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_80), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10763 __Pyx_GOTREF(__pyx_t_2);
10764 __Pyx_Raise(__pyx_t_2, 0, 0);
10765 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10766 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10771 /* "csamtools.pyx":1059
10772 * def __get__(self):
10773 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
10774 * if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" ) # <<<<<<<<<<<<<<
10778 __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam);
10780 __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_82), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10781 __Pyx_GOTREF(__pyx_t_2);
10782 __Pyx_Raise(__pyx_t_2, 0, 0);
10783 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10784 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10789 /* "csamtools.pyx":1062
10792 * cdef uint32_t total = 0 # <<<<<<<<<<<<<<
10793 * for tid from 0 <= tid < self.samfile.header.n_targets:
10794 * total += pysam_get_mapped( self.index, tid )
10798 /* "csamtools.pyx":1063
10800 * cdef uint32_t total = 0
10801 * for tid from 0 <= tid < self.samfile.header.n_targets: # <<<<<<<<<<<<<<
10802 * total += pysam_get_mapped( self.index, tid )
10805 __pyx_t_5 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets;
10806 for (__pyx_v_tid = 0; __pyx_v_tid < __pyx_t_5; __pyx_v_tid++) {
10808 /* "csamtools.pyx":1064
10809 * cdef uint32_t total = 0
10810 * for tid from 0 <= tid < self.samfile.header.n_targets:
10811 * total += pysam_get_mapped( self.index, tid ) # <<<<<<<<<<<<<<
10815 __pyx_v_total = (__pyx_v_total + pysam_get_mapped(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_tid));
10818 /* "csamtools.pyx":1065
10819 * for tid from 0 <= tid < self.samfile.header.n_targets:
10820 * total += pysam_get_mapped( self.index, tid )
10821 * return total # <<<<<<<<<<<<<<
10823 * property unmapped:
10825 __Pyx_XDECREF(__pyx_r);
10826 __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_total); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10827 __Pyx_GOTREF(__pyx_t_2);
10828 __pyx_r = __pyx_t_2;
10832 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10835 __Pyx_XDECREF(__pyx_t_1);
10836 __Pyx_XDECREF(__pyx_t_2);
10837 __Pyx_AddTraceback("csamtools.Samfile.mapped.__get__");
10840 __Pyx_XGIVEREF(__pyx_r);
10841 __Pyx_TraceReturn(__pyx_r);
10842 __Pyx_RefNannyFinishContext();
10846 /* "csamtools.pyx":1070
10847 * """total number of unmapped reads in file.
10849 * def __get__(self): # <<<<<<<<<<<<<<
10850 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
10851 * if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )
10854 static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(PyObject *__pyx_v_self); /*proto*/
10855 static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(PyObject *__pyx_v_self) {
10857 uint32_t __pyx_v_total;
10858 PyObject *__pyx_r = NULL;
10859 PyObject *__pyx_t_1 = NULL;
10860 PyObject *__pyx_t_2 = NULL;
10864 __Pyx_TraceDeclarations
10865 __Pyx_RefNannySetupContext("__get__");
10866 __Pyx_TraceCall("__get__", __pyx_f[0], 1070);
10868 /* "csamtools.pyx":1071
10870 * def __get__(self):
10871 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
10872 * if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )
10875 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10876 __Pyx_GOTREF(__pyx_t_1);
10877 __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 = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10878 __Pyx_GOTREF(__pyx_t_2);
10879 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10880 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10881 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10882 __pyx_t_4 = (!__pyx_t_3);
10884 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_83), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10885 __Pyx_GOTREF(__pyx_t_2);
10886 __Pyx_Raise(__pyx_t_2, 0, 0);
10887 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10888 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10893 /* "csamtools.pyx":1072
10894 * def __get__(self):
10895 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
10896 * if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" ) # <<<<<<<<<<<<<<
10898 * cdef uint32_t total = 0
10900 __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam);
10902 __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_85), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10903 __Pyx_GOTREF(__pyx_t_2);
10904 __Pyx_Raise(__pyx_t_2, 0, 0);
10905 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10906 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10911 /* "csamtools.pyx":1074
10912 * if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )
10914 * cdef uint32_t total = 0 # <<<<<<<<<<<<<<
10915 * for tid from 0 <= tid < self.samfile.header.n_targets:
10916 * total += pysam_get_unmapped( self.index, tid )
10920 /* "csamtools.pyx":1075
10922 * cdef uint32_t total = 0
10923 * for tid from 0 <= tid < self.samfile.header.n_targets: # <<<<<<<<<<<<<<
10924 * total += pysam_get_unmapped( self.index, tid )
10925 * # get unmapped reads without coordinates
10927 __pyx_t_5 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets;
10928 for (__pyx_v_tid = 0; __pyx_v_tid < __pyx_t_5; __pyx_v_tid++) {
10930 /* "csamtools.pyx":1076
10931 * cdef uint32_t total = 0
10932 * for tid from 0 <= tid < self.samfile.header.n_targets:
10933 * total += pysam_get_unmapped( self.index, tid ) # <<<<<<<<<<<<<<
10934 * # get unmapped reads without coordinates
10935 * total += pysam_get_unmapped( self.index, -1 )
10937 __pyx_v_total = (__pyx_v_total + pysam_get_unmapped(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_tid));
10940 /* "csamtools.pyx":1078
10941 * total += pysam_get_unmapped( self.index, tid )
10942 * # get unmapped reads without coordinates
10943 * total += pysam_get_unmapped( self.index, -1 ) # <<<<<<<<<<<<<<
10947 __pyx_v_total = (__pyx_v_total + pysam_get_unmapped(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, -1));
10949 /* "csamtools.pyx":1079
10950 * # get unmapped reads without coordinates
10951 * total += pysam_get_unmapped( self.index, -1 )
10952 * return total # <<<<<<<<<<<<<<
10956 __Pyx_XDECREF(__pyx_r);
10957 __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_total); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
10958 __Pyx_GOTREF(__pyx_t_2);
10959 __pyx_r = __pyx_t_2;
10963 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10966 __Pyx_XDECREF(__pyx_t_1);
10967 __Pyx_XDECREF(__pyx_t_2);
10968 __Pyx_AddTraceback("csamtools.Samfile.unmapped.__get__");
10971 __Pyx_XGIVEREF(__pyx_r);
10972 __Pyx_TraceReturn(__pyx_r);
10973 __Pyx_RefNannyFinishContext();
10977 /* "csamtools.pyx":1083
10979 * '''full contents of the :term:`sam file` header as a string.'''
10980 * def __get__(self): # <<<<<<<<<<<<<<
10981 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
10982 * return PyString_FromStringAndSize(self.samfile.header.text, self.samfile.header.l_text)
10985 static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(PyObject *__pyx_v_self); /*proto*/
10986 static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(PyObject *__pyx_v_self) {
10987 PyObject *__pyx_r = NULL;
10988 PyObject *__pyx_t_1 = NULL;
10989 PyObject *__pyx_t_2 = NULL;
10992 __Pyx_TraceDeclarations
10993 __Pyx_RefNannySetupContext("__get__");
10994 __Pyx_TraceCall("__get__", __pyx_f[0], 1083);
10996 /* "csamtools.pyx":1084
10997 * '''full contents of the :term:`sam file` header as a string.'''
10998 * def __get__(self):
10999 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
11000 * return PyString_FromStringAndSize(self.samfile.header.text, self.samfile.header.l_text)
11003 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11004 __Pyx_GOTREF(__pyx_t_1);
11005 __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 = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11006 __Pyx_GOTREF(__pyx_t_2);
11007 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11008 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11009 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11010 __pyx_t_4 = (!__pyx_t_3);
11012 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_86), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11013 __Pyx_GOTREF(__pyx_t_2);
11014 __Pyx_Raise(__pyx_t_2, 0, 0);
11015 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11016 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11021 /* "csamtools.pyx":1085
11022 * def __get__(self):
11023 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
11024 * return PyString_FromStringAndSize(self.samfile.header.text, self.samfile.header.l_text) # <<<<<<<<<<<<<<
11028 __Pyx_XDECREF(__pyx_r);
11029 __pyx_t_2 = PyString_FromStringAndSize(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->text, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->l_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11030 __Pyx_GOTREF(__pyx_t_2);
11031 __pyx_r = __pyx_t_2;
11035 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11038 __Pyx_XDECREF(__pyx_t_1);
11039 __Pyx_XDECREF(__pyx_t_2);
11040 __Pyx_AddTraceback("csamtools.Samfile.text.__get__");
11043 __Pyx_XGIVEREF(__pyx_r);
11044 __Pyx_TraceReturn(__pyx_r);
11045 __Pyx_RefNannyFinishContext();
11049 /* "csamtools.pyx":1091
11050 * a two-level dictionary.
11052 * def __get__(self): # <<<<<<<<<<<<<<
11053 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
11057 static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(PyObject *__pyx_v_self); /*proto*/
11058 static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(PyObject *__pyx_v_self) {
11059 PyObject *__pyx_v_result;
11060 PyObject *__pyx_v_t;
11061 PyObject *__pyx_v_line;
11062 PyObject *__pyx_v_fields;
11063 PyObject *__pyx_v_record;
11064 PyObject *__pyx_v_x;
11065 PyObject *__pyx_v_field;
11066 PyObject *__pyx_v_key;
11067 PyObject *__pyx_v_value;
11068 PyObject *__pyx_r = NULL;
11069 PyObject *__pyx_t_1 = NULL;
11070 PyObject *__pyx_t_2 = NULL;
11073 Py_ssize_t __pyx_t_5;
11074 PyObject *__pyx_t_6 = NULL;
11075 PyObject *__pyx_t_7 = NULL;
11076 PyObject *__pyx_t_8 = NULL;
11077 Py_ssize_t __pyx_t_9;
11078 PyObject *__pyx_t_10 = NULL;
11079 __Pyx_TraceDeclarations
11080 __Pyx_RefNannySetupContext("__get__");
11081 __Pyx_TraceCall("__get__", __pyx_f[0], 1091);
11082 __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
11083 __pyx_v_t = Py_None; __Pyx_INCREF(Py_None);
11084 __pyx_v_line = Py_None; __Pyx_INCREF(Py_None);
11085 __pyx_v_fields = Py_None; __Pyx_INCREF(Py_None);
11086 __pyx_v_record = Py_None; __Pyx_INCREF(Py_None);
11087 __pyx_v_x = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
11088 __pyx_v_field = Py_None; __Pyx_INCREF(Py_None);
11089 __pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
11090 __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);
11092 /* "csamtools.pyx":1092
11094 * def __get__(self):
11095 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
11099 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11100 __Pyx_GOTREF(__pyx_t_1);
11101 __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 = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11102 __Pyx_GOTREF(__pyx_t_2);
11103 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11104 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11105 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11106 __pyx_t_4 = (!__pyx_t_3);
11108 __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 = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11109 __Pyx_GOTREF(__pyx_t_2);
11110 __Pyx_Raise(__pyx_t_2, 0, 0);
11111 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11112 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11117 /* "csamtools.pyx":1094
11118 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
11120 * result = {} # <<<<<<<<<<<<<<
11122 * if self.samfile.header.text != NULL:
11124 __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11125 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
11126 __Pyx_DECREF(((PyObject *)__pyx_v_result));
11127 __pyx_v_result = __pyx_t_2;
11130 /* "csamtools.pyx":1096
11133 * if self.samfile.header.text != NULL: # <<<<<<<<<<<<<<
11134 * # convert to python string (note: call self.text to create 0-terminated string)
11137 __pyx_t_4 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->text != NULL);
11140 /* "csamtools.pyx":1098
11141 * if self.samfile.header.text != NULL:
11142 * # convert to python string (note: call self.text to create 0-terminated string)
11143 * t = self.text # <<<<<<<<<<<<<<
11144 * for line in t.split("\n"):
11145 * if not line.strip(): continue
11147 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11148 __Pyx_GOTREF(__pyx_t_2);
11149 __Pyx_DECREF(__pyx_v_t);
11150 __pyx_v_t = __pyx_t_2;
11153 /* "csamtools.pyx":1099
11154 * # convert to python string (note: call self.text to create 0-terminated string)
11156 * for line in t.split("\n"): # <<<<<<<<<<<<<<
11157 * if not line.strip(): continue
11158 * assert line.startswith("@"), "header line without '@': '%s'" % line
11160 __pyx_t_2 = PyObject_GetAttr(__pyx_v_t, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11161 __Pyx_GOTREF(__pyx_t_2);
11162 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_88), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11163 __Pyx_GOTREF(__pyx_t_1);
11164 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11165 if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
11166 __pyx_t_5 = 0; __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
11168 __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11169 __Pyx_GOTREF(__pyx_t_2);
11171 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11173 if (likely(PyList_CheckExact(__pyx_t_2))) {
11174 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
11175 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
11176 } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
11177 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
11178 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
11180 __pyx_t_1 = PyIter_Next(__pyx_t_2);
11182 if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11185 __Pyx_GOTREF(__pyx_t_1);
11187 __Pyx_DECREF(__pyx_v_line);
11188 __pyx_v_line = __pyx_t_1;
11191 /* "csamtools.pyx":1100
11193 * for line in t.split("\n"):
11194 * if not line.strip(): continue # <<<<<<<<<<<<<<
11195 * assert line.startswith("@"), "header line without '@': '%s'" % line
11196 * fields = line[1:].split("\t")
11198 __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11199 __Pyx_GOTREF(__pyx_t_1);
11200 __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11201 __Pyx_GOTREF(__pyx_t_6);
11202 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11203 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11204 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11205 __pyx_t_3 = (!__pyx_t_4);
11207 goto __pyx_L7_continue;
11212 /* "csamtools.pyx":1101
11213 * for line in t.split("\n"):
11214 * if not line.strip(): continue
11215 * assert line.startswith("@"), "header line without '@': '%s'" % line # <<<<<<<<<<<<<<
11216 * fields = line[1:].split("\t")
11217 * record = fields[0]
11219 #ifndef CYTHON_WITHOUT_ASSERTIONS
11220 __pyx_t_6 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11221 __Pyx_GOTREF(__pyx_t_6);
11222 __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_90), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11223 __Pyx_GOTREF(__pyx_t_1);
11224 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11225 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11226 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11227 if (unlikely(!__pyx_t_3)) {
11228 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_91), __pyx_v_line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11229 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
11230 PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_1));
11231 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
11232 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11236 /* "csamtools.pyx":1102
11237 * if not line.strip(): continue
11238 * assert line.startswith("@"), "header line without '@': '%s'" % line
11239 * fields = line[1:].split("\t") # <<<<<<<<<<<<<<
11240 * record = fields[0]
11241 * assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line)
11243 __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 = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11244 __Pyx_GOTREF(__pyx_t_1);
11245 __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11246 __Pyx_GOTREF(__pyx_t_6);
11247 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11248 __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_92), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11249 __Pyx_GOTREF(__pyx_t_1);
11250 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11251 __Pyx_DECREF(__pyx_v_fields);
11252 __pyx_v_fields = __pyx_t_1;
11255 /* "csamtools.pyx":1103
11256 * assert line.startswith("@"), "header line without '@': '%s'" % line
11257 * fields = line[1:].split("\t")
11258 * record = fields[0] # <<<<<<<<<<<<<<
11259 * assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line)
11262 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fields, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11263 __Pyx_GOTREF(__pyx_t_1);
11264 __Pyx_DECREF(__pyx_v_record);
11265 __pyx_v_record = __pyx_t_1;
11268 /* "csamtools.pyx":1104
11269 * fields = line[1:].split("\t")
11270 * record = fields[0]
11271 * assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line) # <<<<<<<<<<<<<<
11275 #ifndef CYTHON_WITHOUT_ASSERTIONS
11276 __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 = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11277 __Pyx_GOTREF(__pyx_t_1);
11278 __pyx_t_3 = ((PySequence_Contains(__pyx_t_1, __pyx_v_record))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11279 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11280 if (unlikely(!__pyx_t_3)) {
11281 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11282 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
11283 __Pyx_INCREF(__pyx_v_record);
11284 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_record);
11285 __Pyx_GIVEREF(__pyx_v_record);
11286 __Pyx_INCREF(__pyx_v_line);
11287 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_line);
11288 __Pyx_GIVEREF(__pyx_v_line);
11289 __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_93), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11290 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
11291 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
11292 PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_6));
11293 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
11294 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11298 /* "csamtools.pyx":1107
11301 * if record == "CO": # <<<<<<<<<<<<<<
11302 * if record not in result: result[record] = []
11303 * result[record].append( "\t".join( fields[1:] ) )
11305 __pyx_t_6 = PyObject_RichCompare(__pyx_v_record, ((PyObject *)__pyx_n_s__CO), Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11306 __Pyx_GOTREF(__pyx_t_6);
11307 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11308 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11311 /* "csamtools.pyx":1108
11313 * if record == "CO":
11314 * if record not in result: result[record] = [] # <<<<<<<<<<<<<<
11315 * result[record].append( "\t".join( fields[1:] ) )
11318 if (unlikely(__pyx_v_result == Py_None)) {
11319 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11321 __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 = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11323 __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11324 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
11325 if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11326 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
11331 /* "csamtools.pyx":1109
11332 * if record == "CO":
11333 * if record not in result: result[record] = []
11334 * result[record].append( "\t".join( fields[1:] ) ) # <<<<<<<<<<<<<<
11338 __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_record); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11339 __Pyx_GOTREF(__pyx_t_6);
11340 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11341 __Pyx_GOTREF(__pyx_t_1);
11342 __pyx_t_7 = __Pyx_PySequence_GetSlice(__pyx_v_fields, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11343 __Pyx_GOTREF(__pyx_t_7);
11344 __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11345 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
11346 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
11347 __Pyx_GIVEREF(__pyx_t_7);
11349 __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 = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11350 __Pyx_GOTREF(__pyx_t_7);
11351 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11352 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
11353 __pyx_t_8 = __Pyx_PyObject_Append(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11354 __Pyx_GOTREF(__pyx_t_8);
11355 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11356 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11357 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11359 /* "csamtools.pyx":1110
11360 * if record not in result: result[record] = []
11361 * result[record].append( "\t".join( fields[1:] ) )
11362 * continue # <<<<<<<<<<<<<<
11364 * # the following is clumsy as generators do not work?
11366 goto __pyx_L7_continue;
11371 /* "csamtools.pyx":1113
11373 * # the following is clumsy as generators do not work?
11374 * x = {} # <<<<<<<<<<<<<<
11375 * for field in fields[1:]:
11376 * key, value = field.split(":",1)
11378 __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11379 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
11380 __Pyx_DECREF(((PyObject *)__pyx_v_x));
11381 __pyx_v_x = __pyx_t_8;
11384 /* "csamtools.pyx":1114
11385 * # the following is clumsy as generators do not work?
11387 * for field in fields[1:]: # <<<<<<<<<<<<<<
11388 * key, value = field.split(":",1)
11389 * # uppercase keys must be valid
11391 __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 = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11392 __Pyx_GOTREF(__pyx_t_8);
11393 if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) {
11394 __pyx_t_9 = 0; __pyx_t_7 = __pyx_t_8; __Pyx_INCREF(__pyx_t_7);
11396 __pyx_t_9 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11397 __Pyx_GOTREF(__pyx_t_7);
11399 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11401 if (likely(PyList_CheckExact(__pyx_t_7))) {
11402 if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_7)) break;
11403 __pyx_t_8 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++;
11404 } else if (likely(PyTuple_CheckExact(__pyx_t_7))) {
11405 if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
11406 __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++;
11408 __pyx_t_8 = PyIter_Next(__pyx_t_7);
11410 if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11413 __Pyx_GOTREF(__pyx_t_8);
11415 __Pyx_DECREF(__pyx_v_field);
11416 __pyx_v_field = __pyx_t_8;
11419 /* "csamtools.pyx":1115
11421 * for field in fields[1:]:
11422 * key, value = field.split(":",1) # <<<<<<<<<<<<<<
11423 * # uppercase keys must be valid
11424 * # lowercase are permitted for user fields
11426 __pyx_t_8 = PyObject_GetAttr(__pyx_v_field, __pyx_n_s__split); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11427 __Pyx_GOTREF(__pyx_t_8);
11428 __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_95), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11429 __Pyx_GOTREF(__pyx_t_6);
11430 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11431 if (PyTuple_CheckExact(__pyx_t_6) && likely(PyTuple_GET_SIZE(__pyx_t_6) == 2)) {
11432 PyObject* tuple = __pyx_t_6;
11433 __pyx_t_8 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_8);
11434 __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1);
11435 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11436 __Pyx_DECREF(__pyx_v_key);
11437 __pyx_v_key = __pyx_t_8;
11439 __Pyx_DECREF(__pyx_v_value);
11440 __pyx_v_value = __pyx_t_1;
11443 __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11444 __Pyx_GOTREF(__pyx_t_10);
11445 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11446 __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_10, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11447 __Pyx_GOTREF(__pyx_t_8);
11448 __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_10, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11449 __Pyx_GOTREF(__pyx_t_1);
11450 if (__Pyx_EndUnpack(__pyx_t_10, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11451 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
11452 __Pyx_DECREF(__pyx_v_key);
11453 __pyx_v_key = __pyx_t_8;
11455 __Pyx_DECREF(__pyx_v_value);
11456 __pyx_v_value = __pyx_t_1;
11460 /* "csamtools.pyx":1118
11461 * # uppercase keys must be valid
11462 * # lowercase are permitted for user fields
11463 * if key in VALID_HEADER_FIELDS[record]: # <<<<<<<<<<<<<<
11464 * x[key] = VALID_HEADER_FIELDS[record][key](value)
11465 * elif not key.isupper():
11467 __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11468 __Pyx_GOTREF(__pyx_t_6);
11469 __pyx_t_1 = PyObject_GetItem(__pyx_t_6, __pyx_v_record); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11470 __Pyx_GOTREF(__pyx_t_1);
11471 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11472 __pyx_t_3 = ((PySequence_Contains(__pyx_t_1, __pyx_v_key))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11473 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11476 /* "csamtools.pyx":1119
11477 * # lowercase are permitted for user fields
11478 * if key in VALID_HEADER_FIELDS[record]:
11479 * x[key] = VALID_HEADER_FIELDS[record][key](value) # <<<<<<<<<<<<<<
11480 * elif not key.isupper():
11483 __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 = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11484 __Pyx_GOTREF(__pyx_t_1);
11485 __pyx_t_6 = PyObject_GetItem(__pyx_t_1, __pyx_v_record); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11486 __Pyx_GOTREF(__pyx_t_6);
11487 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11488 __pyx_t_1 = PyObject_GetItem(__pyx_t_6, __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11489 __Pyx_GOTREF(__pyx_t_1);
11490 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11491 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11492 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
11493 __Pyx_INCREF(__pyx_v_value);
11494 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_value);
11495 __Pyx_GIVEREF(__pyx_v_value);
11496 __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11497 __Pyx_GOTREF(__pyx_t_8);
11498 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11499 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
11500 if (PyDict_SetItem(((PyObject *)__pyx_v_x), __pyx_v_key, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11501 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11505 /* "csamtools.pyx":1120
11506 * if key in VALID_HEADER_FIELDS[record]:
11507 * x[key] = VALID_HEADER_FIELDS[record][key](value)
11508 * elif not key.isupper(): # <<<<<<<<<<<<<<
11512 __pyx_t_8 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__isupper); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11513 __Pyx_GOTREF(__pyx_t_8);
11514 __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11515 __Pyx_GOTREF(__pyx_t_6);
11516 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11517 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11518 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11519 __pyx_t_4 = (!__pyx_t_3);
11522 /* "csamtools.pyx":1121
11523 * x[key] = VALID_HEADER_FIELDS[record][key](value)
11524 * elif not key.isupper():
11525 * x[key] = value # <<<<<<<<<<<<<<
11527 * raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) )
11529 if (PyDict_SetItem(((PyObject *)__pyx_v_x), __pyx_v_key, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11534 /* "csamtools.pyx":1123
11537 * raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) ) # <<<<<<<<<<<<<<
11539 * if VALID_HEADER_TYPES[record] == dict:
11541 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11542 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
11543 __Pyx_INCREF(__pyx_v_key);
11544 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_key);
11545 __Pyx_GIVEREF(__pyx_v_key);
11546 __Pyx_INCREF(__pyx_v_record);
11547 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_record);
11548 __Pyx_GIVEREF(__pyx_v_record);
11549 __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_96), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11550 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
11551 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
11552 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11553 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
11554 PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_8));
11555 __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
11557 __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11558 __Pyx_GOTREF(__pyx_t_8);
11559 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
11560 __Pyx_Raise(__pyx_t_8, 0, 0);
11561 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11562 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11566 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11568 /* "csamtools.pyx":1125
11569 * raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) )
11571 * if VALID_HEADER_TYPES[record] == dict: # <<<<<<<<<<<<<<
11572 * if record in result:
11573 * raise ValueError( "multiple '%s' lines are not permitted" % record )
11575 __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11576 __Pyx_GOTREF(__pyx_t_7);
11577 __pyx_t_8 = PyObject_GetItem(__pyx_t_7, __pyx_v_record); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11578 __Pyx_GOTREF(__pyx_t_8);
11579 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11580 __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)((PyObject*)(&PyDict_Type))), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11581 __Pyx_GOTREF(__pyx_t_7);
11582 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11583 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11584 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11587 /* "csamtools.pyx":1126
11589 * if VALID_HEADER_TYPES[record] == dict:
11590 * if record in result: # <<<<<<<<<<<<<<
11591 * raise ValueError( "multiple '%s' lines are not permitted" % record )
11592 * result[record] = x
11594 if (unlikely(__pyx_v_result == Py_None)) {
11595 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11597 __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 = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11600 /* "csamtools.pyx":1127
11601 * if VALID_HEADER_TYPES[record] == dict:
11602 * if record in result:
11603 * raise ValueError( "multiple '%s' lines are not permitted" % record ) # <<<<<<<<<<<<<<
11604 * result[record] = x
11605 * elif VALID_HEADER_TYPES[record] == list:
11607 __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_97), __pyx_v_record); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11608 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
11609 __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11610 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
11611 PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7));
11612 __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
11614 __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 = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11615 __Pyx_GOTREF(__pyx_t_7);
11616 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
11617 __Pyx_Raise(__pyx_t_7, 0, 0);
11618 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11619 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11624 /* "csamtools.pyx":1128
11625 * if record in result:
11626 * raise ValueError( "multiple '%s' lines are not permitted" % record )
11627 * result[record] = x # <<<<<<<<<<<<<<
11628 * elif VALID_HEADER_TYPES[record] == list:
11629 * if record not in result: result[record] = []
11631 if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_v_x)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11635 /* "csamtools.pyx":1129
11636 * raise ValueError( "multiple '%s' lines are not permitted" % record )
11637 * result[record] = x
11638 * elif VALID_HEADER_TYPES[record] == list: # <<<<<<<<<<<<<<
11639 * if record not in result: result[record] = []
11640 * result[record].append( x )
11642 __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11643 __Pyx_GOTREF(__pyx_t_7);
11644 __pyx_t_8 = PyObject_GetItem(__pyx_t_7, __pyx_v_record); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11645 __Pyx_GOTREF(__pyx_t_8);
11646 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11647 __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)((PyObject*)(&PyList_Type))), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11648 __Pyx_GOTREF(__pyx_t_7);
11649 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11650 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11651 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11654 /* "csamtools.pyx":1130
11655 * result[record] = x
11656 * elif VALID_HEADER_TYPES[record] == list:
11657 * if record not in result: result[record] = [] # <<<<<<<<<<<<<<
11658 * result[record].append( x )
11661 if (unlikely(__pyx_v_result == Py_None)) {
11662 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11664 __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 = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11666 __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11667 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
11668 if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11669 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
11674 /* "csamtools.pyx":1131
11675 * elif VALID_HEADER_TYPES[record] == list:
11676 * if record not in result: result[record] = []
11677 * result[record].append( x ) # <<<<<<<<<<<<<<
11681 __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_record); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11682 __Pyx_GOTREF(__pyx_t_7);
11683 __pyx_t_8 = __Pyx_PyObject_Append(__pyx_t_7, ((PyObject *)__pyx_v_x)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11684 __Pyx_GOTREF(__pyx_t_8);
11685 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11686 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11690 __pyx_L7_continue:;
11692 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11697 /* "csamtools.pyx":1133
11698 * result[record].append( x )
11700 * return result # <<<<<<<<<<<<<<
11702 * def _buildLine( self, fields, record ):
11704 __Pyx_XDECREF(__pyx_r);
11705 __Pyx_INCREF(((PyObject *)__pyx_v_result));
11706 __pyx_r = ((PyObject *)__pyx_v_result);
11709 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11712 __Pyx_XDECREF(__pyx_t_1);
11713 __Pyx_XDECREF(__pyx_t_2);
11714 __Pyx_XDECREF(__pyx_t_6);
11715 __Pyx_XDECREF(__pyx_t_7);
11716 __Pyx_XDECREF(__pyx_t_8);
11717 __Pyx_XDECREF(__pyx_t_10);
11718 __Pyx_AddTraceback("csamtools.Samfile.header.__get__");
11721 __Pyx_DECREF(__pyx_v_result);
11722 __Pyx_DECREF(__pyx_v_t);
11723 __Pyx_DECREF(__pyx_v_line);
11724 __Pyx_DECREF(__pyx_v_fields);
11725 __Pyx_DECREF(__pyx_v_record);
11726 __Pyx_DECREF(__pyx_v_x);
11727 __Pyx_DECREF(__pyx_v_field);
11728 __Pyx_DECREF(__pyx_v_key);
11729 __Pyx_DECREF(__pyx_v_value);
11730 __Pyx_XGIVEREF(__pyx_r);
11731 __Pyx_TraceReturn(__pyx_r);
11732 __Pyx_RefNannyFinishContext();
11736 /* "csamtools.pyx":1135
11739 * def _buildLine( self, fields, record ): # <<<<<<<<<<<<<<
11740 * '''build a header line from *fields* dictionary for *record*'''
11744 static PyObject *__pyx_pf_9csamtools_7Samfile_19_buildLine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11745 static char __pyx_doc_9csamtools_7Samfile_19_buildLine[] = "Samfile._buildLine(self, fields, record)\nbuild a header line from *fields* dictionary for *record*";
11746 static PyObject *__pyx_pf_9csamtools_7Samfile_19_buildLine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11747 PyObject *__pyx_v_fields = 0;
11748 PyObject *__pyx_v_record = 0;
11749 PyObject *__pyx_v_line;
11750 PyObject *__pyx_v_key;
11751 PyObject *__pyx_r = NULL;
11752 PyObject *__pyx_t_1 = NULL;
11753 PyObject *__pyx_t_2 = NULL;
11756 Py_ssize_t __pyx_t_5;
11757 PyObject *__pyx_t_6 = NULL;
11759 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fields,&__pyx_n_s__record,0};
11760 __Pyx_TraceDeclarations
11761 __Pyx_RefNannySetupContext("_buildLine");
11762 __Pyx_TraceCall("_buildLine", __pyx_f[0], 1135);
11763 if (unlikely(__pyx_kwds)) {
11764 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
11765 PyObject* values[2] = {0,0};
11766 switch (PyTuple_GET_SIZE(__pyx_args)) {
11767 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11768 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11770 default: goto __pyx_L5_argtuple_error;
11772 switch (PyTuple_GET_SIZE(__pyx_args)) {
11774 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fields);
11775 if (likely(values[0])) kw_args--;
11776 else goto __pyx_L5_argtuple_error;
11778 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__record);
11779 if (likely(values[1])) kw_args--;
11781 __Pyx_RaiseArgtupleInvalid("_buildLine", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
11784 if (unlikely(kw_args > 0)) {
11785 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_buildLine") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
11787 __pyx_v_fields = values[0];
11788 __pyx_v_record = values[1];
11789 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
11790 goto __pyx_L5_argtuple_error;
11792 __pyx_v_fields = PyTuple_GET_ITEM(__pyx_args, 0);
11793 __pyx_v_record = PyTuple_GET_ITEM(__pyx_args, 1);
11795 goto __pyx_L4_argument_unpacking_done;
11796 __pyx_L5_argtuple_error:;
11797 __Pyx_RaiseArgtupleInvalid("_buildLine", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
11799 __Pyx_AddTraceback("csamtools.Samfile._buildLine");
11800 __Pyx_RefNannyFinishContext();
11802 __pyx_L4_argument_unpacking_done:;
11803 __pyx_v_line = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
11804 __pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
11806 /* "csamtools.pyx":1139
11808 * # TODO: add checking for field and sort order
11809 * line = ["@%s" % record ] # <<<<<<<<<<<<<<
11810 * if record == "CO":
11811 * line.append( fields )
11813 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_98), __pyx_v_record); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11814 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
11815 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11816 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
11817 PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
11818 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
11820 __Pyx_DECREF(((PyObject *)__pyx_v_line));
11821 __pyx_v_line = __pyx_t_2;
11824 /* "csamtools.pyx":1140
11825 * # TODO: add checking for field and sort order
11826 * line = ["@%s" % record ]
11827 * if record == "CO": # <<<<<<<<<<<<<<
11828 * line.append( fields )
11831 __pyx_t_2 = PyObject_RichCompare(__pyx_v_record, ((PyObject *)__pyx_n_s__CO), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11832 __Pyx_GOTREF(__pyx_t_2);
11833 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11834 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11837 /* "csamtools.pyx":1141
11838 * line = ["@%s" % record ]
11839 * if record == "CO":
11840 * line.append( fields ) # <<<<<<<<<<<<<<
11842 * # write fields of the specification
11844 if (unlikely(__pyx_v_line == Py_None)) {
11845 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11847 __pyx_t_4 = PyList_Append(__pyx_v_line, __pyx_v_fields); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11852 /* "csamtools.pyx":1144
11854 * # write fields of the specification
11855 * for key in VALID_HEADER_ORDER[record]: # <<<<<<<<<<<<<<
11856 * if key in fields:
11857 * line.append( "%s:%s" % (key, str(fields[key])))
11859 __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_ORDER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11860 __Pyx_GOTREF(__pyx_t_2);
11861 __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_record); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11862 __Pyx_GOTREF(__pyx_t_1);
11863 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11864 if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
11865 __pyx_t_5 = 0; __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
11867 __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11868 __Pyx_GOTREF(__pyx_t_2);
11870 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11872 if (likely(PyList_CheckExact(__pyx_t_2))) {
11873 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
11874 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
11875 } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
11876 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
11877 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
11879 __pyx_t_1 = PyIter_Next(__pyx_t_2);
11881 if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11884 __Pyx_GOTREF(__pyx_t_1);
11886 __Pyx_DECREF(__pyx_v_key);
11887 __pyx_v_key = __pyx_t_1;
11890 /* "csamtools.pyx":1145
11891 * # write fields of the specification
11892 * for key in VALID_HEADER_ORDER[record]:
11893 * if key in fields: # <<<<<<<<<<<<<<
11894 * line.append( "%s:%s" % (key, str(fields[key])))
11895 * # write user fields
11897 __pyx_t_3 = ((PySequence_Contains(__pyx_v_fields, __pyx_v_key))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11900 /* "csamtools.pyx":1146
11901 * for key in VALID_HEADER_ORDER[record]:
11902 * if key in fields:
11903 * line.append( "%s:%s" % (key, str(fields[key]))) # <<<<<<<<<<<<<<
11904 * # write user fields
11905 * for key in fields:
11907 if (unlikely(__pyx_v_line == Py_None)) {
11908 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11910 __pyx_t_1 = PyObject_GetItem(__pyx_v_fields, __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11911 __Pyx_GOTREF(__pyx_t_1);
11912 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11913 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
11914 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
11915 __Pyx_GIVEREF(__pyx_t_1);
11917 __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11918 __Pyx_GOTREF(__pyx_t_1);
11919 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
11920 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11921 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
11922 __Pyx_INCREF(__pyx_v_key);
11923 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_key);
11924 __Pyx_GIVEREF(__pyx_v_key);
11925 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
11926 __Pyx_GIVEREF(__pyx_t_1);
11928 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_99), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11929 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
11930 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
11931 __pyx_t_4 = PyList_Append(__pyx_v_line, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11932 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
11937 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11939 /* "csamtools.pyx":1148
11940 * line.append( "%s:%s" % (key, str(fields[key])))
11941 * # write user fields
11942 * for key in fields: # <<<<<<<<<<<<<<
11943 * if not key.isupper():
11944 * line.append( "%s:%s" % (key, str(fields[key])))
11946 if (PyList_CheckExact(__pyx_v_fields) || PyTuple_CheckExact(__pyx_v_fields)) {
11947 __pyx_t_5 = 0; __pyx_t_2 = __pyx_v_fields; __Pyx_INCREF(__pyx_t_2);
11949 __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_fields); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11950 __Pyx_GOTREF(__pyx_t_2);
11953 if (likely(PyList_CheckExact(__pyx_t_2))) {
11954 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
11955 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
11956 } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
11957 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
11958 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
11960 __pyx_t_1 = PyIter_Next(__pyx_t_2);
11962 if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11965 __Pyx_GOTREF(__pyx_t_1);
11967 __Pyx_DECREF(__pyx_v_key);
11968 __pyx_v_key = __pyx_t_1;
11971 /* "csamtools.pyx":1149
11972 * # write user fields
11973 * for key in fields:
11974 * if not key.isupper(): # <<<<<<<<<<<<<<
11975 * line.append( "%s:%s" % (key, str(fields[key])))
11978 __pyx_t_1 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__isupper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11979 __Pyx_GOTREF(__pyx_t_1);
11980 __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11981 __Pyx_GOTREF(__pyx_t_6);
11982 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11983 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11984 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11985 __pyx_t_7 = (!__pyx_t_3);
11988 /* "csamtools.pyx":1150
11989 * for key in fields:
11990 * if not key.isupper():
11991 * line.append( "%s:%s" % (key, str(fields[key]))) # <<<<<<<<<<<<<<
11993 * return "\t".join( line )
11995 if (unlikely(__pyx_v_line == Py_None)) {
11996 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11998 __pyx_t_6 = PyObject_GetItem(__pyx_v_fields, __pyx_v_key); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11999 __Pyx_GOTREF(__pyx_t_6);
12000 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12001 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
12002 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
12003 __Pyx_GIVEREF(__pyx_t_6);
12005 __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12006 __Pyx_GOTREF(__pyx_t_6);
12007 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
12008 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12009 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
12010 __Pyx_INCREF(__pyx_v_key);
12011 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_key);
12012 __Pyx_GIVEREF(__pyx_v_key);
12013 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
12014 __Pyx_GIVEREF(__pyx_t_6);
12016 __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_99), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12017 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
12018 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
12019 __pyx_t_4 = PyList_Append(__pyx_v_line, ((PyObject *)__pyx_t_6)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12020 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
12025 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12029 /* "csamtools.pyx":1152
12030 * line.append( "%s:%s" % (key, str(fields[key])))
12032 * return "\t".join( line ) # <<<<<<<<<<<<<<
12034 * cdef bam_header_t * _buildHeader( self, new_header ):
12036 __Pyx_XDECREF(__pyx_r);
12037 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12038 __Pyx_GOTREF(__pyx_t_2);
12039 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12040 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
12041 __Pyx_INCREF(((PyObject *)__pyx_v_line));
12042 PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_line));
12043 __Pyx_GIVEREF(((PyObject *)__pyx_v_line));
12044 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12045 __Pyx_GOTREF(__pyx_t_1);
12046 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12047 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
12048 __pyx_r = __pyx_t_1;
12052 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12055 __Pyx_XDECREF(__pyx_t_1);
12056 __Pyx_XDECREF(__pyx_t_2);
12057 __Pyx_XDECREF(__pyx_t_6);
12058 __Pyx_AddTraceback("csamtools.Samfile._buildLine");
12061 __Pyx_DECREF(__pyx_v_line);
12062 __Pyx_DECREF(__pyx_v_key);
12063 __Pyx_XGIVEREF(__pyx_r);
12064 __Pyx_TraceReturn(__pyx_r);
12065 __Pyx_RefNannyFinishContext();
12069 /* "csamtools.pyx":1154
12070 * return "\t".join( line )
12072 * cdef bam_header_t * _buildHeader( self, new_header ): # <<<<<<<<<<<<<<
12073 * '''return a new header built from a dictionary in *new_header*.
12077 static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_new_header) {
12078 PyObject *__pyx_v_lines;
12079 bam_header_t *__pyx_v_dest;
12080 PyObject *__pyx_v_record;
12081 PyObject *__pyx_v_ttype;
12082 PyObject *__pyx_v_data;
12083 PyObject *__pyx_v_fields;
12084 PyObject *__pyx_v_text;
12085 PyObject *__pyx_v_seqs;
12087 PyObject *__pyx_v_seqname;
12088 PyObject *__pyx_v_seqlen;
12089 bam_header_t *__pyx_r;
12090 PyObject *__pyx_t_1 = NULL;
12091 Py_ssize_t __pyx_t_2;
12092 PyObject *__pyx_t_3 = NULL;
12094 PyObject *__pyx_t_5 = NULL;
12095 PyObject *__pyx_t_6 = NULL;
12097 Py_ssize_t __pyx_t_8;
12098 PyObject *__pyx_t_9 = NULL;
12100 PyObject *__pyx_t_11 = NULL;
12101 int32_t __pyx_t_12;
12102 uint32_t __pyx_t_13;
12103 __Pyx_TraceDeclarations
12104 __Pyx_RefNannySetupContext("_buildHeader");
12105 __Pyx_TraceCall("_buildHeader", __pyx_f[0], 1154);
12106 __pyx_v_lines = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
12107 __pyx_v_record = Py_None; __Pyx_INCREF(Py_None);
12108 __pyx_v_ttype = Py_None; __Pyx_INCREF(Py_None);
12109 __pyx_v_data = Py_None; __Pyx_INCREF(Py_None);
12110 __pyx_v_fields = Py_None; __Pyx_INCREF(Py_None);
12111 __pyx_v_text = Py_None; __Pyx_INCREF(Py_None);
12112 __pyx_v_seqs = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
12113 __pyx_v_seqname = Py_None; __Pyx_INCREF(Py_None);
12114 __pyx_v_seqlen = Py_None; __Pyx_INCREF(Py_None);
12116 /* "csamtools.pyx":1160
12119 * lines = [] # <<<<<<<<<<<<<<
12121 * # check if hash exists
12123 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12124 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
12125 __Pyx_DECREF(((PyObject *)__pyx_v_lines));
12126 __pyx_v_lines = __pyx_t_1;
12129 /* "csamtools.pyx":1167
12130 * cdef bam_header_t * dest
12132 * dest = bam_header_init() # <<<<<<<<<<<<<<
12134 * for record in VALID_HEADERS:
12136 __pyx_v_dest = bam_header_init();
12138 /* "csamtools.pyx":1169
12139 * dest = bam_header_init()
12141 * for record in VALID_HEADERS: # <<<<<<<<<<<<<<
12142 * if record in new_header:
12143 * ttype = VALID_HEADER_TYPES[record]
12145 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADERS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12146 __Pyx_GOTREF(__pyx_t_1);
12147 if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
12148 __pyx_t_2 = 0; __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3);
12150 __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12151 __Pyx_GOTREF(__pyx_t_3);
12153 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12155 if (likely(PyList_CheckExact(__pyx_t_3))) {
12156 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
12157 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++;
12158 } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
12159 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
12160 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++;
12162 __pyx_t_1 = PyIter_Next(__pyx_t_3);
12164 if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12167 __Pyx_GOTREF(__pyx_t_1);
12169 __Pyx_DECREF(__pyx_v_record);
12170 __pyx_v_record = __pyx_t_1;
12173 /* "csamtools.pyx":1170
12175 * for record in VALID_HEADERS:
12176 * if record in new_header: # <<<<<<<<<<<<<<
12177 * ttype = VALID_HEADER_TYPES[record]
12178 * data = new_header[record]
12180 __pyx_t_4 = ((PySequence_Contains(__pyx_v_new_header, __pyx_v_record))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12183 /* "csamtools.pyx":1171
12184 * for record in VALID_HEADERS:
12185 * if record in new_header:
12186 * ttype = VALID_HEADER_TYPES[record] # <<<<<<<<<<<<<<
12187 * data = new_header[record]
12188 * if type( data ) != type( ttype() ):
12190 __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 = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12191 __Pyx_GOTREF(__pyx_t_1);
12192 __pyx_t_5 = PyObject_GetItem(__pyx_t_1, __pyx_v_record); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12193 __Pyx_GOTREF(__pyx_t_5);
12194 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12195 __Pyx_DECREF(__pyx_v_ttype);
12196 __pyx_v_ttype = __pyx_t_5;
12199 /* "csamtools.pyx":1172
12200 * if record in new_header:
12201 * ttype = VALID_HEADER_TYPES[record]
12202 * data = new_header[record] # <<<<<<<<<<<<<<
12203 * if type( data ) != type( ttype() ):
12204 * raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) )
12206 __pyx_t_5 = PyObject_GetItem(__pyx_v_new_header, __pyx_v_record); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12207 __Pyx_GOTREF(__pyx_t_5);
12208 __Pyx_DECREF(__pyx_v_data);
12209 __pyx_v_data = __pyx_t_5;
12212 /* "csamtools.pyx":1173
12213 * ttype = VALID_HEADER_TYPES[record]
12214 * data = new_header[record]
12215 * if type( data ) != type( ttype() ): # <<<<<<<<<<<<<<
12216 * raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) )
12217 * if type( data ) == types.DictType:
12219 __pyx_t_5 = PyObject_Call(__pyx_v_ttype, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12220 __Pyx_GOTREF(__pyx_t_5);
12221 __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_data)), ((PyObject *)Py_TYPE(__pyx_t_5)), Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12222 __Pyx_GOTREF(__pyx_t_1);
12223 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12224 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12225 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12228 /* "csamtools.pyx":1174
12229 * data = new_header[record]
12230 * if type( data ) != type( ttype() ):
12231 * raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) ) # <<<<<<<<<<<<<<
12232 * if type( data ) == types.DictType:
12233 * lines.append( self._buildLine( data, record ) )
12235 __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 = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12236 __Pyx_GOTREF(__pyx_t_1);
12237 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12238 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
12239 __Pyx_INCREF(__pyx_v_record);
12240 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_record);
12241 __Pyx_GIVEREF(__pyx_v_record);
12242 __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_data)));
12243 PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)Py_TYPE(__pyx_v_data)));
12244 __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_data)));
12245 __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_t_1)));
12246 PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)Py_TYPE(__pyx_t_1)));
12247 __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_t_1)));
12248 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12249 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_100), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12250 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
12251 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
12252 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12253 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
12254 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1));
12255 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
12257 __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 = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12258 __Pyx_GOTREF(__pyx_t_1);
12259 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
12260 __Pyx_Raise(__pyx_t_1, 0, 0);
12261 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12262 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12267 /* "csamtools.pyx":1175
12268 * if type( data ) != type( ttype() ):
12269 * raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) )
12270 * if type( data ) == types.DictType: # <<<<<<<<<<<<<<
12271 * lines.append( self._buildLine( data, record ) )
12274 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__types); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12275 __Pyx_GOTREF(__pyx_t_1);
12276 __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__DictType); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12277 __Pyx_GOTREF(__pyx_t_5);
12278 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12279 __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_data)), __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12280 __Pyx_GOTREF(__pyx_t_1);
12281 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12282 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12283 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12286 /* "csamtools.pyx":1176
12287 * raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) )
12288 * if type( data ) == types.DictType:
12289 * lines.append( self._buildLine( data, record ) ) # <<<<<<<<<<<<<<
12291 * for fields in new_header[record]:
12293 if (unlikely(__pyx_v_lines == Py_None)) {
12294 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12296 __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 = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12297 __Pyx_GOTREF(__pyx_t_1);
12298 __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12299 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
12300 __Pyx_INCREF(__pyx_v_data);
12301 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_data);
12302 __Pyx_GIVEREF(__pyx_v_data);
12303 __Pyx_INCREF(__pyx_v_record);
12304 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_record);
12305 __Pyx_GIVEREF(__pyx_v_record);
12306 __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12307 __Pyx_GOTREF(__pyx_t_6);
12308 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12309 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
12310 __pyx_t_7 = PyList_Append(__pyx_v_lines, __pyx_t_6); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12311 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12316 /* "csamtools.pyx":1178
12317 * lines.append( self._buildLine( data, record ) )
12319 * for fields in new_header[record]: # <<<<<<<<<<<<<<
12320 * lines.append( self._buildLine( fields, record ) )
12323 __pyx_t_6 = PyObject_GetItem(__pyx_v_new_header, __pyx_v_record); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12324 __Pyx_GOTREF(__pyx_t_6);
12325 if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
12326 __pyx_t_8 = 0; __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5);
12328 __pyx_t_8 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12329 __Pyx_GOTREF(__pyx_t_5);
12331 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12333 if (likely(PyList_CheckExact(__pyx_t_5))) {
12334 if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break;
12335 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++;
12336 } else if (likely(PyTuple_CheckExact(__pyx_t_5))) {
12337 if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
12338 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++;
12340 __pyx_t_6 = PyIter_Next(__pyx_t_5);
12342 if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12345 __Pyx_GOTREF(__pyx_t_6);
12347 __Pyx_DECREF(__pyx_v_fields);
12348 __pyx_v_fields = __pyx_t_6;
12351 /* "csamtools.pyx":1179
12353 * for fields in new_header[record]:
12354 * lines.append( self._buildLine( fields, record ) ) # <<<<<<<<<<<<<<
12356 * text = "\n".join(lines) + "\n"
12358 if (unlikely(__pyx_v_lines == Py_None)) {
12359 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12361 __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 = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12362 __Pyx_GOTREF(__pyx_t_6);
12363 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12364 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
12365 __Pyx_INCREF(__pyx_v_fields);
12366 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fields);
12367 __Pyx_GIVEREF(__pyx_v_fields);
12368 __Pyx_INCREF(__pyx_v_record);
12369 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_record);
12370 __Pyx_GIVEREF(__pyx_v_record);
12371 __pyx_t_9 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12372 __Pyx_GOTREF(__pyx_t_9);
12373 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12374 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
12375 __pyx_t_7 = PyList_Append(__pyx_v_lines, __pyx_t_9); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12376 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12378 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12385 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12387 /* "csamtools.pyx":1181
12388 * lines.append( self._buildLine( fields, record ) )
12390 * text = "\n".join(lines) + "\n" # <<<<<<<<<<<<<<
12391 * if dest.text != NULL: free( dest.text )
12392 * dest.text = <char*>calloc( len(text), sizeof(char))
12394 __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12395 __Pyx_GOTREF(__pyx_t_3);
12396 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12397 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
12398 __Pyx_INCREF(((PyObject *)__pyx_v_lines));
12399 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_lines));
12400 __Pyx_GIVEREF(((PyObject *)__pyx_v_lines));
12401 __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12402 __Pyx_GOTREF(__pyx_t_9);
12403 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12404 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
12405 __pyx_t_5 = PyNumber_Add(__pyx_t_9, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12406 __Pyx_GOTREF(__pyx_t_5);
12407 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12408 __Pyx_DECREF(__pyx_v_text);
12409 __pyx_v_text = __pyx_t_5;
12412 /* "csamtools.pyx":1182
12414 * text = "\n".join(lines) + "\n"
12415 * if dest.text != NULL: free( dest.text ) # <<<<<<<<<<<<<<
12416 * dest.text = <char*>calloc( len(text), sizeof(char))
12417 * dest.l_text = len(text)
12419 __pyx_t_4 = (__pyx_v_dest->text != NULL);
12421 free(__pyx_v_dest->text);
12426 /* "csamtools.pyx":1183
12427 * text = "\n".join(lines) + "\n"
12428 * if dest.text != NULL: free( dest.text )
12429 * dest.text = <char*>calloc( len(text), sizeof(char)) # <<<<<<<<<<<<<<
12430 * dest.l_text = len(text)
12431 * strncpy( dest.text, text, dest.l_text )
12433 __pyx_t_2 = PyObject_Length(__pyx_v_text); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12434 __pyx_v_dest->text = ((char *)calloc(__pyx_t_2, (sizeof(char))));
12436 /* "csamtools.pyx":1184
12437 * if dest.text != NULL: free( dest.text )
12438 * dest.text = <char*>calloc( len(text), sizeof(char))
12439 * dest.l_text = len(text) # <<<<<<<<<<<<<<
12440 * strncpy( dest.text, text, dest.l_text )
12443 __pyx_t_2 = PyObject_Length(__pyx_v_text); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12444 __pyx_v_dest->l_text = __pyx_t_2;
12446 /* "csamtools.pyx":1185
12447 * dest.text = <char*>calloc( len(text), sizeof(char))
12448 * dest.l_text = len(text)
12449 * strncpy( dest.text, text, dest.l_text ) # <<<<<<<<<<<<<<
12451 * # collect targets
12453 __pyx_t_10 = PyBytes_AsString(__pyx_v_text); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12454 strncpy(__pyx_v_dest->text, __pyx_t_10, __pyx_v_dest->l_text);
12456 /* "csamtools.pyx":1188
12458 * # collect targets
12459 * if "SQ" in new_header: # <<<<<<<<<<<<<<
12461 * for fields in new_header["SQ"]:
12463 __pyx_t_4 = ((PySequence_Contains(__pyx_v_new_header, ((PyObject *)__pyx_n_s__SQ)))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12466 /* "csamtools.pyx":1189
12467 * # collect targets
12468 * if "SQ" in new_header:
12469 * seqs = [] # <<<<<<<<<<<<<<
12470 * for fields in new_header["SQ"]:
12473 __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12474 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
12475 __Pyx_DECREF(((PyObject *)__pyx_v_seqs));
12476 __pyx_v_seqs = __pyx_t_5;
12479 /* "csamtools.pyx":1190
12480 * if "SQ" in new_header:
12482 * for fields in new_header["SQ"]: # <<<<<<<<<<<<<<
12484 * seqs.append( (fields["SN"], fields["LN"] ) )
12486 __pyx_t_5 = PyObject_GetItem(__pyx_v_new_header, ((PyObject *)__pyx_n_s__SQ)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12487 __Pyx_GOTREF(__pyx_t_5);
12488 if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) {
12489 __pyx_t_2 = 0; __pyx_t_9 = __pyx_t_5; __Pyx_INCREF(__pyx_t_9);
12491 __pyx_t_2 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12492 __Pyx_GOTREF(__pyx_t_9);
12494 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12496 if (likely(PyList_CheckExact(__pyx_t_9))) {
12497 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_9)) break;
12498 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++;
12499 } else if (likely(PyTuple_CheckExact(__pyx_t_9))) {
12500 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
12501 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++;
12503 __pyx_t_5 = PyIter_Next(__pyx_t_9);
12505 if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12508 __Pyx_GOTREF(__pyx_t_5);
12510 __Pyx_DECREF(__pyx_v_fields);
12511 __pyx_v_fields = __pyx_t_5;
12514 /* "csamtools.pyx":1191
12516 * for fields in new_header["SQ"]:
12517 * try: # <<<<<<<<<<<<<<
12518 * seqs.append( (fields["SN"], fields["LN"] ) )
12522 PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
12523 __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
12524 __Pyx_XGOTREF(__pyx_save_exc_type);
12525 __Pyx_XGOTREF(__pyx_save_exc_value);
12526 __Pyx_XGOTREF(__pyx_save_exc_tb);
12529 /* "csamtools.pyx":1192
12530 * for fields in new_header["SQ"]:
12532 * seqs.append( (fields["SN"], fields["LN"] ) ) # <<<<<<<<<<<<<<
12534 * raise KeyError( "incomplete sequence information in '%s'" % str(fields))
12536 if (unlikely(__pyx_v_seqs == Py_None)) {
12537 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
12539 __pyx_t_5 = PyObject_GetItem(__pyx_v_fields, ((PyObject *)__pyx_n_s__SN)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
12540 __Pyx_GOTREF(__pyx_t_5);
12541 __pyx_t_3 = PyObject_GetItem(__pyx_v_fields, ((PyObject *)__pyx_n_s__LN)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
12542 __Pyx_GOTREF(__pyx_t_3);
12543 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
12544 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
12545 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
12546 __Pyx_GIVEREF(__pyx_t_5);
12547 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
12548 __Pyx_GIVEREF(__pyx_t_3);
12551 __pyx_t_7 = PyList_Append(__pyx_v_seqs, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
12552 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
12554 __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
12555 __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
12556 __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
12557 goto __pyx_L21_try_end;
12559 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
12560 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12561 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
12562 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
12564 /* "csamtools.pyx":1193
12566 * seqs.append( (fields["SN"], fields["LN"] ) )
12567 * except KeyError: # <<<<<<<<<<<<<<
12568 * raise KeyError( "incomplete sequence information in '%s'" % str(fields))
12571 __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
12573 __Pyx_AddTraceback("csamtools.Samfile._buildHeader");
12574 if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
12575 __Pyx_GOTREF(__pyx_t_1);
12576 __Pyx_GOTREF(__pyx_t_3);
12577 __Pyx_GOTREF(__pyx_t_5);
12579 /* "csamtools.pyx":1194
12580 * seqs.append( (fields["SN"], fields["LN"] ) )
12582 * raise KeyError( "incomplete sequence information in '%s'" % str(fields)) # <<<<<<<<<<<<<<
12584 * dest.n_targets = len(seqs)
12586 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
12587 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
12588 __Pyx_INCREF(__pyx_v_fields);
12589 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_fields);
12590 __Pyx_GIVEREF(__pyx_v_fields);
12591 __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
12592 __Pyx_GOTREF(__pyx_t_11);
12593 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
12594 __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_101), __pyx_t_11); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
12595 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
12596 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
12597 __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
12598 __Pyx_GOTREF(((PyObject *)__pyx_t_11));
12599 PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_t_6));
12600 __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
12602 __pyx_t_6 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
12603 __Pyx_GOTREF(__pyx_t_6);
12604 __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
12605 __Pyx_Raise(__pyx_t_6, 0, 0);
12606 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12607 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
12608 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12609 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12610 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12611 goto __pyx_L15_exception_handled;
12613 __pyx_L16_except_error:;
12614 __Pyx_XGIVEREF(__pyx_save_exc_type);
12615 __Pyx_XGIVEREF(__pyx_save_exc_value);
12616 __Pyx_XGIVEREF(__pyx_save_exc_tb);
12617 __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
12618 goto __pyx_L1_error;
12619 __pyx_L15_exception_handled:;
12620 __Pyx_XGIVEREF(__pyx_save_exc_type);
12621 __Pyx_XGIVEREF(__pyx_save_exc_value);
12622 __Pyx_XGIVEREF(__pyx_save_exc_tb);
12623 __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
12624 __pyx_L21_try_end:;
12627 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12629 /* "csamtools.pyx":1196
12630 * raise KeyError( "incomplete sequence information in '%s'" % str(fields))
12632 * dest.n_targets = len(seqs) # <<<<<<<<<<<<<<
12633 * dest.target_name = <char**>calloc( dest.n_targets, sizeof(char*) )
12634 * dest.target_len = <uint32_t*>calloc( dest.n_targets, sizeof(uint32_t) )
12636 if (unlikely(__pyx_v_seqs == Py_None)) {
12637 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12639 __pyx_t_2 = PyList_GET_SIZE(((PyObject *)__pyx_v_seqs));
12640 __pyx_v_dest->n_targets = __pyx_t_2;
12642 /* "csamtools.pyx":1197
12644 * dest.n_targets = len(seqs)
12645 * dest.target_name = <char**>calloc( dest.n_targets, sizeof(char*) ) # <<<<<<<<<<<<<<
12646 * dest.target_len = <uint32_t*>calloc( dest.n_targets, sizeof(uint32_t) )
12649 __pyx_v_dest->target_name = ((char **)calloc(__pyx_v_dest->n_targets, (sizeof(char *))));
12651 /* "csamtools.pyx":1198
12652 * dest.n_targets = len(seqs)
12653 * dest.target_name = <char**>calloc( dest.n_targets, sizeof(char*) )
12654 * dest.target_len = <uint32_t*>calloc( dest.n_targets, sizeof(uint32_t) ) # <<<<<<<<<<<<<<
12656 * for x from 0 <= x < dest.n_targets:
12658 __pyx_v_dest->target_len = ((uint32_t *)calloc(__pyx_v_dest->n_targets, (sizeof(uint32_t))));
12660 /* "csamtools.pyx":1200
12661 * dest.target_len = <uint32_t*>calloc( dest.n_targets, sizeof(uint32_t) )
12663 * for x from 0 <= x < dest.n_targets: # <<<<<<<<<<<<<<
12664 * seqname, seqlen = seqs[x]
12665 * dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) )
12667 __pyx_t_12 = __pyx_v_dest->n_targets;
12668 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_12; __pyx_v_x++) {
12670 /* "csamtools.pyx":1201
12672 * for x from 0 <= x < dest.n_targets:
12673 * seqname, seqlen = seqs[x] # <<<<<<<<<<<<<<
12674 * dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) )
12675 * strncpy( dest.target_name[x], seqname, len(seqname) + 1 )
12677 __pyx_t_9 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_seqs), __pyx_v_x, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12678 __Pyx_GOTREF(__pyx_t_9);
12679 if (PyTuple_CheckExact(__pyx_t_9) && likely(PyTuple_GET_SIZE(__pyx_t_9) == 2)) {
12680 PyObject* tuple = __pyx_t_9;
12681 __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
12682 __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
12683 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12684 __Pyx_DECREF(__pyx_v_seqname);
12685 __pyx_v_seqname = __pyx_t_5;
12687 __Pyx_DECREF(__pyx_v_seqlen);
12688 __pyx_v_seqlen = __pyx_t_3;
12691 __pyx_t_1 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12692 __Pyx_GOTREF(__pyx_t_1);
12693 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12694 __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_1, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12695 __Pyx_GOTREF(__pyx_t_5);
12696 __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_1, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12697 __Pyx_GOTREF(__pyx_t_3);
12698 if (__Pyx_EndUnpack(__pyx_t_1, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12699 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12700 __Pyx_DECREF(__pyx_v_seqname);
12701 __pyx_v_seqname = __pyx_t_5;
12703 __Pyx_DECREF(__pyx_v_seqlen);
12704 __pyx_v_seqlen = __pyx_t_3;
12708 /* "csamtools.pyx":1202
12709 * for x from 0 <= x < dest.n_targets:
12710 * seqname, seqlen = seqs[x]
12711 * dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) ) # <<<<<<<<<<<<<<
12712 * strncpy( dest.target_name[x], seqname, len(seqname) + 1 )
12713 * dest.target_len[x] = seqlen
12715 __pyx_t_2 = PyObject_Length(__pyx_v_seqname); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12716 (__pyx_v_dest->target_name[__pyx_v_x]) = ((char *)calloc((__pyx_t_2 + 1), (sizeof(char))));
12718 /* "csamtools.pyx":1203
12719 * seqname, seqlen = seqs[x]
12720 * dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) )
12721 * strncpy( dest.target_name[x], seqname, len(seqname) + 1 ) # <<<<<<<<<<<<<<
12722 * dest.target_len[x] = seqlen
12725 __pyx_t_10 = PyBytes_AsString(__pyx_v_seqname); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12726 __pyx_t_2 = PyObject_Length(__pyx_v_seqname); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12727 strncpy((__pyx_v_dest->target_name[__pyx_v_x]), __pyx_t_10, (__pyx_t_2 + 1));
12729 /* "csamtools.pyx":1204
12730 * dest.target_name[x] = <char*>calloc( len( seqname ) + 1, sizeof(char) )
12731 * strncpy( dest.target_name[x], seqname, len(seqname) + 1 )
12732 * dest.target_len[x] = seqlen # <<<<<<<<<<<<<<
12736 __pyx_t_13 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_seqlen); if (unlikely((__pyx_t_13 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12737 (__pyx_v_dest->target_len[__pyx_v_x]) = __pyx_t_13;
12743 /* "csamtools.pyx":1206
12744 * dest.target_len[x] = seqlen
12746 * return dest # <<<<<<<<<<<<<<
12748 * ###############################################################
12750 __pyx_r = __pyx_v_dest;
12756 __Pyx_XDECREF(__pyx_t_1);
12757 __Pyx_XDECREF(__pyx_t_3);
12758 __Pyx_XDECREF(__pyx_t_5);
12759 __Pyx_XDECREF(__pyx_t_6);
12760 __Pyx_XDECREF(__pyx_t_9);
12761 __Pyx_XDECREF(__pyx_t_11);
12762 __Pyx_WriteUnraisable("csamtools.Samfile._buildHeader");
12765 __Pyx_DECREF(__pyx_v_lines);
12766 __Pyx_DECREF(__pyx_v_record);
12767 __Pyx_DECREF(__pyx_v_ttype);
12768 __Pyx_DECREF(__pyx_v_data);
12769 __Pyx_DECREF(__pyx_v_fields);
12770 __Pyx_DECREF(__pyx_v_text);
12771 __Pyx_DECREF(__pyx_v_seqs);
12772 __Pyx_DECREF(__pyx_v_seqname);
12773 __Pyx_DECREF(__pyx_v_seqlen);
12774 __Pyx_TraceReturn(Py_None);
12775 __Pyx_RefNannyFinishContext();
12779 /* "csamtools.pyx":1216
12780 * ## Possible solutions: deprecate or open new file handle
12781 * ###############################################################
12782 * def __iter__(self): # <<<<<<<<<<<<<<
12783 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
12784 * if not self.isbam and self.samfile.header.n_targets == 0:
12787 static PyObject *__pyx_pf_9csamtools_7Samfile_20__iter__(PyObject *__pyx_v_self); /*proto*/
12788 static PyObject *__pyx_pf_9csamtools_7Samfile_20__iter__(PyObject *__pyx_v_self) {
12789 PyObject *__pyx_r = NULL;
12790 PyObject *__pyx_t_1 = NULL;
12791 PyObject *__pyx_t_2 = NULL;
12795 __Pyx_TraceDeclarations
12796 __Pyx_RefNannySetupContext("__iter__");
12797 __Pyx_TraceCall("__iter__", __pyx_f[0], 1216);
12799 /* "csamtools.pyx":1217
12800 * ###############################################################
12801 * def __iter__(self):
12802 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
12803 * if not self.isbam and self.samfile.header.n_targets == 0:
12804 * raise NotImplementedError( "can not iterate over samfile without header")
12806 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12807 __Pyx_GOTREF(__pyx_t_1);
12808 __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 = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12809 __Pyx_GOTREF(__pyx_t_2);
12810 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12811 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12812 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12813 __pyx_t_4 = (!__pyx_t_3);
12815 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_102), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12816 __Pyx_GOTREF(__pyx_t_2);
12817 __Pyx_Raise(__pyx_t_2, 0, 0);
12818 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12819 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12824 /* "csamtools.pyx":1218
12825 * def __iter__(self):
12826 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
12827 * if not self.isbam and self.samfile.header.n_targets == 0: # <<<<<<<<<<<<<<
12828 * raise NotImplementedError( "can not iterate over samfile without header")
12831 __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam);
12833 __pyx_t_3 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets == 0);
12834 __pyx_t_5 = __pyx_t_3;
12836 __pyx_t_5 = __pyx_t_4;
12840 /* "csamtools.pyx":1219
12841 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
12842 * if not self.isbam and self.samfile.header.n_targets == 0:
12843 * raise NotImplementedError( "can not iterate over samfile without header") # <<<<<<<<<<<<<<
12847 __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_104), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12848 __Pyx_GOTREF(__pyx_t_2);
12849 __Pyx_Raise(__pyx_t_2, 0, 0);
12850 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12851 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12856 /* "csamtools.pyx":1220
12857 * if not self.isbam and self.samfile.header.n_targets == 0:
12858 * raise NotImplementedError( "can not iterate over samfile without header")
12859 * return self # <<<<<<<<<<<<<<
12861 * cdef bam1_t * getCurrent( self ):
12863 __Pyx_XDECREF(__pyx_r);
12864 __Pyx_INCREF(__pyx_v_self);
12865 __pyx_r = __pyx_v_self;
12868 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12871 __Pyx_XDECREF(__pyx_t_1);
12872 __Pyx_XDECREF(__pyx_t_2);
12873 __Pyx_AddTraceback("csamtools.Samfile.__iter__");
12876 __Pyx_XGIVEREF(__pyx_r);
12877 __Pyx_TraceReturn(__pyx_r);
12878 __Pyx_RefNannyFinishContext();
12882 /* "csamtools.pyx":1222
12885 * cdef bam1_t * getCurrent( self ): # <<<<<<<<<<<<<<
12890 static bam1_t *__pyx_f_9csamtools_7Samfile_getCurrent(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
12892 __Pyx_TraceDeclarations
12893 __Pyx_RefNannySetupContext("getCurrent");
12894 __Pyx_TraceCall("getCurrent", __pyx_f[0], 1222);
12896 /* "csamtools.pyx":1223
12898 * cdef bam1_t * getCurrent( self ):
12899 * return self.b # <<<<<<<<<<<<<<
12901 * cdef int cnext(self):
12903 __pyx_r = __pyx_v_self->b;
12908 __Pyx_TraceReturn(Py_None);
12909 __Pyx_RefNannyFinishContext();
12913 /* "csamtools.pyx":1225
12916 * cdef int cnext(self): # <<<<<<<<<<<<<<
12918 * cversion of iterator. Used by :class:`pysam.Samfile.IteratorColumn`.
12921 static int __pyx_f_9csamtools_7Samfile_cnext(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) {
12923 __Pyx_TraceDeclarations
12924 __Pyx_RefNannySetupContext("cnext");
12925 __Pyx_TraceCall("cnext", __pyx_f[0], 1225);
12927 /* "csamtools.pyx":1230
12930 * return samread(self.samfile, self.b) # <<<<<<<<<<<<<<
12932 * def __next__(self):
12934 __pyx_r = samread(__pyx_v_self->samfile, __pyx_v_self->b);
12939 __Pyx_TraceReturn(Py_None);
12940 __Pyx_RefNannyFinishContext();
12944 /* "csamtools.pyx":1232
12945 * return samread(self.samfile, self.b)
12947 * def __next__(self): # <<<<<<<<<<<<<<
12949 * python version of next().
12952 static PyObject *__pyx_pf_9csamtools_7Samfile_21__next__(PyObject *__pyx_v_self); /*proto*/
12953 static char __pyx_doc_9csamtools_7Samfile_21__next__[] = "\n python version of next().\n ";
12954 struct wrapperbase __pyx_wrapperbase_9csamtools_7Samfile_21__next__;
12955 static PyObject *__pyx_pf_9csamtools_7Samfile_21__next__(PyObject *__pyx_v_self) {
12957 PyObject *__pyx_r = NULL;
12959 PyObject *__pyx_t_2 = NULL;
12960 __Pyx_TraceDeclarations
12961 __Pyx_RefNannySetupContext("__next__");
12962 __Pyx_TraceCall("__next__", __pyx_f[0], 1232);
12964 /* "csamtools.pyx":1237
12967 * ret = samread(self.samfile, self.b) # <<<<<<<<<<<<<<
12969 * return makeAlignedRead( self.b )
12971 __pyx_v_ret = samread(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->b);
12973 /* "csamtools.pyx":1238
12975 * ret = samread(self.samfile, self.b)
12976 * if (ret > 0): # <<<<<<<<<<<<<<
12977 * return makeAlignedRead( self.b )
12980 __pyx_t_1 = (__pyx_v_ret > 0);
12983 /* "csamtools.pyx":1239
12984 * ret = samread(self.samfile, self.b)
12986 * return makeAlignedRead( self.b ) # <<<<<<<<<<<<<<
12988 * raise StopIteration
12990 __Pyx_XDECREF(__pyx_r);
12991 __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12992 __Pyx_GOTREF(__pyx_t_2);
12993 __pyx_r = __pyx_t_2;
13000 /* "csamtools.pyx":1241
13001 * return makeAlignedRead( self.b )
13003 * raise StopIteration # <<<<<<<<<<<<<<
13005 * ##-------------------------------------------------------------------
13007 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
13008 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13012 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13015 __Pyx_XDECREF(__pyx_t_2);
13016 __Pyx_AddTraceback("csamtools.Samfile.__next__");
13019 __Pyx_XGIVEREF(__pyx_r);
13020 __Pyx_TraceReturn(__pyx_r);
13021 __Pyx_RefNannyFinishContext();
13025 /* "csamtools.pyx":1293
13026 * cdef int owns_samfile
13028 * def __cinit__(self, Samfile samfile, int tid, int beg, int end, int reopen = True ): # <<<<<<<<<<<<<<
13030 * if not samfile._isOpen():
13033 static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
13034 static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
13035 struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
13039 int __pyx_v_reopen;
13040 PyObject *__pyx_v_mode;
13041 PyObject *__pyx_v_store;
13043 PyObject *__pyx_t_1 = NULL;
13044 PyObject *__pyx_t_2 = NULL;
13048 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};
13049 __Pyx_TraceDeclarations
13050 __Pyx_RefNannySetupContext("__cinit__");
13051 __Pyx_TraceCall("__cinit__", __pyx_f[0], 1293);
13052 if (unlikely(__pyx_kwds)) {
13053 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
13054 PyObject* values[5] = {0,0,0,0,0};
13055 switch (PyTuple_GET_SIZE(__pyx_args)) {
13056 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
13057 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13058 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13059 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13060 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13062 default: goto __pyx_L5_argtuple_error;
13064 switch (PyTuple_GET_SIZE(__pyx_args)) {
13066 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
13067 if (likely(values[0])) kw_args--;
13068 else goto __pyx_L5_argtuple_error;
13070 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid);
13071 if (likely(values[1])) kw_args--;
13073 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13076 values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beg);
13077 if (likely(values[2])) kw_args--;
13079 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13082 values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
13083 if (likely(values[3])) kw_args--;
13085 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13089 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reopen);
13090 if (value) { values[4] = value; kw_args--; }
13093 if (unlikely(kw_args > 0)) {
13094 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13096 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
13097 __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13098 __pyx_v_beg = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_beg == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13099 __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13101 __pyx_v_reopen = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13103 __pyx_v_reopen = ((int)1);
13106 __pyx_v_reopen = ((int)1);
13107 switch (PyTuple_GET_SIZE(__pyx_args)) {
13109 __pyx_v_reopen = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13111 __pyx_v_end = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13112 __pyx_v_beg = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_beg == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13113 __pyx_v_tid = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13114 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0));
13116 default: goto __pyx_L5_argtuple_error;
13119 goto __pyx_L4_argument_unpacking_done;
13120 __pyx_L5_argtuple_error:;
13121 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13123 __Pyx_AddTraceback("csamtools.IteratorRowRegion.__cinit__");
13124 __Pyx_RefNannyFinishContext();
13126 __pyx_L4_argument_unpacking_done:;
13127 __pyx_v_mode = Py_None; __Pyx_INCREF(Py_None);
13128 __pyx_v_store = Py_None; __Pyx_INCREF(Py_None);
13129 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13131 /* "csamtools.pyx":1295
13132 * def __cinit__(self, Samfile samfile, int tid, int beg, int end, int reopen = True ):
13134 * if not samfile._isOpen(): # <<<<<<<<<<<<<<
13135 * raise ValueError( "I/O operation on closed file" )
13138 __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 = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13139 __Pyx_GOTREF(__pyx_t_1);
13140 __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 = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13141 __Pyx_GOTREF(__pyx_t_2);
13142 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13143 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13144 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13145 __pyx_t_4 = (!__pyx_t_3);
13148 /* "csamtools.pyx":1296
13150 * if not samfile._isOpen():
13151 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
13153 * if not samfile._hasIndex():
13155 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_105), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13156 __Pyx_GOTREF(__pyx_t_2);
13157 __Pyx_Raise(__pyx_t_2, 0, 0);
13158 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13159 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13164 /* "csamtools.pyx":1298
13165 * raise ValueError( "I/O operation on closed file" )
13167 * if not samfile._hasIndex(): # <<<<<<<<<<<<<<
13168 * raise ValueError( "no index available for iteration" )
13171 __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 = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13172 __Pyx_GOTREF(__pyx_t_2);
13173 __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 = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13174 __Pyx_GOTREF(__pyx_t_1);
13175 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13176 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13177 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13178 __pyx_t_3 = (!__pyx_t_4);
13181 /* "csamtools.pyx":1299
13183 * if not samfile._hasIndex():
13184 * raise ValueError( "no index available for iteration" ) # <<<<<<<<<<<<<<
13186 * # makes sure that samfile stays alive as long as the
13188 __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_107), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13189 __Pyx_GOTREF(__pyx_t_1);
13190 __Pyx_Raise(__pyx_t_1, 0, 0);
13191 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13192 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13197 /* "csamtools.pyx":1303
13198 * # makes sure that samfile stays alive as long as the
13199 * # iterator is alive
13200 * self.samfile = samfile # <<<<<<<<<<<<<<
13202 * if samfile.isbam: mode = "rb"
13204 __Pyx_INCREF(((PyObject *)__pyx_v_samfile));
13205 __Pyx_GIVEREF(((PyObject *)__pyx_v_samfile));
13206 __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile);
13207 __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile));
13208 ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile = __pyx_v_samfile;
13210 /* "csamtools.pyx":1305
13211 * self.samfile = samfile
13213 * if samfile.isbam: mode = "rb" # <<<<<<<<<<<<<<
13217 if (__pyx_v_samfile->isbam) {
13218 __Pyx_INCREF(((PyObject *)__pyx_n_s__rb));
13219 __Pyx_DECREF(__pyx_v_mode);
13220 __pyx_v_mode = ((PyObject *)__pyx_n_s__rb);
13225 /* "csamtools.pyx":1306
13227 * if samfile.isbam: mode = "rb"
13228 * else: mode = "r" # <<<<<<<<<<<<<<
13230 * # reopen the file - note that this makes the iterator
13232 __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
13233 __Pyx_DECREF(__pyx_v_mode);
13234 __pyx_v_mode = ((PyObject *)__pyx_n_s__r);
13238 /* "csamtools.pyx":1310
13239 * # reopen the file - note that this makes the iterator
13240 * # slow and causes pileup to slow down significantly.
13241 * if reopen: # <<<<<<<<<<<<<<
13242 * store = StderrStore()
13243 * self.fp = samopen( samfile._filename, mode, NULL )
13245 if (__pyx_v_reopen) {
13247 /* "csamtools.pyx":1311
13248 * # slow and causes pileup to slow down significantly.
13250 * store = StderrStore() # <<<<<<<<<<<<<<
13251 * self.fp = samopen( samfile._filename, mode, NULL )
13254 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13255 __Pyx_GOTREF(__pyx_t_1);
13256 __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 = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13257 __Pyx_GOTREF(__pyx_t_2);
13258 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13259 __Pyx_DECREF(__pyx_v_store);
13260 __pyx_v_store = __pyx_t_2;
13263 /* "csamtools.pyx":1312
13265 * store = StderrStore()
13266 * self.fp = samopen( samfile._filename, mode, NULL ) # <<<<<<<<<<<<<<
13268 * assert self.fp != NULL
13270 __pyx_t_5 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13271 ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_5, NULL);
13273 /* "csamtools.pyx":1313
13274 * store = StderrStore()
13275 * self.fp = samopen( samfile._filename, mode, NULL )
13276 * store.release() # <<<<<<<<<<<<<<
13277 * assert self.fp != NULL
13278 * self.owns_samfile = True
13280 __pyx_t_2 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13281 __Pyx_GOTREF(__pyx_t_2);
13282 __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 = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13283 __Pyx_GOTREF(__pyx_t_1);
13284 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13285 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13287 /* "csamtools.pyx":1314
13288 * self.fp = samopen( samfile._filename, mode, NULL )
13290 * assert self.fp != NULL # <<<<<<<<<<<<<<
13291 * self.owns_samfile = True
13294 #ifndef CYTHON_WITHOUT_ASSERTIONS
13295 if (unlikely(!(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->fp != NULL))) {
13296 PyErr_SetNone(PyExc_AssertionError);
13297 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13301 /* "csamtools.pyx":1315
13303 * assert self.fp != NULL
13304 * self.owns_samfile = True # <<<<<<<<<<<<<<
13306 * self.fp = self.samfile.samfile
13308 ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->owns_samfile = 1;
13313 /* "csamtools.pyx":1317
13314 * self.owns_samfile = True
13316 * self.fp = self.samfile.samfile # <<<<<<<<<<<<<<
13317 * self.owns_samfile = False
13320 ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->fp = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile->samfile;
13322 /* "csamtools.pyx":1318
13324 * self.fp = self.samfile.samfile
13325 * self.owns_samfile = False # <<<<<<<<<<<<<<
13329 ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->owns_samfile = 0;
13333 /* "csamtools.pyx":1320
13334 * self.owns_samfile = False
13336 * self.retval = 0 # <<<<<<<<<<<<<<
13338 * self.iter = bam_iter_query(self.samfile.index,
13340 ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->retval = 0;
13342 /* "csamtools.pyx":1322
13345 * self.iter = bam_iter_query(self.samfile.index, # <<<<<<<<<<<<<<
13349 ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->iter = bam_iter_query(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile->index, __pyx_v_tid, __pyx_v_beg, __pyx_v_end);
13351 /* "csamtools.pyx":1326
13354 * self.b = bam_init1() # <<<<<<<<<<<<<<
13356 * def __iter__(self):
13358 ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->b = bam_init1();
13363 __Pyx_XDECREF(__pyx_t_1);
13364 __Pyx_XDECREF(__pyx_t_2);
13365 __Pyx_AddTraceback("csamtools.IteratorRowRegion.__cinit__");
13368 __Pyx_DECREF(__pyx_v_mode);
13369 __Pyx_DECREF(__pyx_v_store);
13370 __Pyx_TraceReturn(Py_None);
13371 __Pyx_RefNannyFinishContext();
13375 /* "csamtools.pyx":1328
13376 * self.b = bam_init1()
13378 * def __iter__(self): # <<<<<<<<<<<<<<
13383 static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_1__iter__(PyObject *__pyx_v_self); /*proto*/
13384 static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_1__iter__(PyObject *__pyx_v_self) {
13385 PyObject *__pyx_r = NULL;
13386 __Pyx_TraceDeclarations
13387 __Pyx_RefNannySetupContext("__iter__");
13388 __Pyx_TraceCall("__iter__", __pyx_f[0], 1328);
13390 /* "csamtools.pyx":1329
13392 * def __iter__(self):
13393 * return self # <<<<<<<<<<<<<<
13395 * cdef bam1_t * getCurrent( self ):
13397 __Pyx_XDECREF(__pyx_r);
13398 __Pyx_INCREF(__pyx_v_self);
13399 __pyx_r = __pyx_v_self;
13402 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13404 __Pyx_XGIVEREF(__pyx_r);
13405 __Pyx_TraceReturn(__pyx_r);
13406 __Pyx_RefNannyFinishContext();
13410 /* "csamtools.pyx":1331
13413 * cdef bam1_t * getCurrent( self ): # <<<<<<<<<<<<<<
13418 static bam1_t *__pyx_f_9csamtools_17IteratorRowRegion_getCurrent(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self) {
13420 __Pyx_TraceDeclarations
13421 __Pyx_RefNannySetupContext("getCurrent");
13422 __Pyx_TraceCall("getCurrent", __pyx_f[0], 1331);
13424 /* "csamtools.pyx":1332
13426 * cdef bam1_t * getCurrent( self ):
13427 * return self.b # <<<<<<<<<<<<<<
13429 * cdef int cnext(self):
13431 __pyx_r = __pyx_v_self->b;
13436 __Pyx_TraceReturn(Py_None);
13437 __Pyx_RefNannyFinishContext();
13441 /* "csamtools.pyx":1334
13444 * cdef int cnext(self): # <<<<<<<<<<<<<<
13445 * '''cversion of iterator. Used by IteratorColumn'''
13446 * self.retval = bam_iter_read( self.fp.x.bam,
13449 static int __pyx_f_9csamtools_17IteratorRowRegion_cnext(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self) {
13451 __Pyx_TraceDeclarations
13452 __Pyx_RefNannySetupContext("cnext");
13453 __Pyx_TraceCall("cnext", __pyx_f[0], 1334);
13455 /* "csamtools.pyx":1336
13456 * cdef int cnext(self):
13457 * '''cversion of iterator. Used by IteratorColumn'''
13458 * self.retval = bam_iter_read( self.fp.x.bam, # <<<<<<<<<<<<<<
13462 __pyx_v_self->retval = bam_iter_read(__pyx_v_self->fp->x.bam, __pyx_v_self->iter, __pyx_v_self->b);
13465 __Pyx_TraceReturn(Py_None);
13466 __Pyx_RefNannyFinishContext();
13470 /* "csamtools.pyx":1340
13473 * def __next__(self): # <<<<<<<<<<<<<<
13474 * """python version of next().
13478 static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_2__next__(PyObject *__pyx_v_self); /*proto*/
13479 static char __pyx_doc_9csamtools_17IteratorRowRegion_2__next__[] = "python version of next().\n ";
13480 struct wrapperbase __pyx_wrapperbase_9csamtools_17IteratorRowRegion_2__next__;
13481 static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_2__next__(PyObject *__pyx_v_self) {
13482 PyObject *__pyx_r = NULL;
13484 PyObject *__pyx_t_2 = NULL;
13485 __Pyx_TraceDeclarations
13486 __Pyx_RefNannySetupContext("__next__");
13487 __Pyx_TraceCall("__next__", __pyx_f[0], 1340);
13489 /* "csamtools.pyx":1343
13490 * """python version of next().
13492 * self.cnext() # <<<<<<<<<<<<<<
13493 * if self.retval < 0: raise StopIteration
13494 * return makeAlignedRead( self.b )
13496 ((struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *)((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->__pyx_vtab)->cnext(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self));
13498 /* "csamtools.pyx":1344
13501 * if self.retval < 0: raise StopIteration # <<<<<<<<<<<<<<
13502 * return makeAlignedRead( self.b )
13505 __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->retval < 0);
13507 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
13508 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13513 /* "csamtools.pyx":1345
13515 * if self.retval < 0: raise StopIteration
13516 * return makeAlignedRead( self.b ) # <<<<<<<<<<<<<<
13518 * def __dealloc__(self):
13520 __Pyx_XDECREF(__pyx_r);
13521 __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13522 __Pyx_GOTREF(__pyx_t_2);
13523 __pyx_r = __pyx_t_2;
13527 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13530 __Pyx_XDECREF(__pyx_t_2);
13531 __Pyx_AddTraceback("csamtools.IteratorRowRegion.__next__");
13534 __Pyx_XGIVEREF(__pyx_r);
13535 __Pyx_TraceReturn(__pyx_r);
13536 __Pyx_RefNannyFinishContext();
13540 /* "csamtools.pyx":1347
13541 * return makeAlignedRead( self.b )
13543 * def __dealloc__(self): # <<<<<<<<<<<<<<
13544 * bam_destroy1(self.b)
13545 * if self.owns_samfile: samclose( self.fp )
13548 static void __pyx_pf_9csamtools_17IteratorRowRegion_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
13549 static void __pyx_pf_9csamtools_17IteratorRowRegion_3__dealloc__(PyObject *__pyx_v_self) {
13550 __Pyx_TraceDeclarations
13551 __Pyx_RefNannySetupContext("__dealloc__");
13552 __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1347);
13554 /* "csamtools.pyx":1348
13556 * def __dealloc__(self):
13557 * bam_destroy1(self.b) # <<<<<<<<<<<<<<
13558 * if self.owns_samfile: samclose( self.fp )
13561 bam_destroy1(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->b);
13563 /* "csamtools.pyx":1349
13564 * def __dealloc__(self):
13565 * bam_destroy1(self.b)
13566 * if self.owns_samfile: samclose( self.fp ) # <<<<<<<<<<<<<<
13568 * cdef class IteratorRowAll(IteratorRow):
13570 if (((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->owns_samfile) {
13571 samclose(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->fp);
13576 __Pyx_TraceReturn(Py_None);
13577 __Pyx_RefNannyFinishContext();
13580 /* "csamtools.pyx":1366
13581 * # cdef int owns_samfile
13583 * def __cinit__(self, Samfile samfile, int reopen = True ): # <<<<<<<<<<<<<<
13585 * if not samfile._isOpen():
13588 static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
13589 static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
13590 struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
13591 int __pyx_v_reopen;
13592 PyObject *__pyx_v_mode;
13593 PyObject *__pyx_v_store;
13595 PyObject *__pyx_t_1 = NULL;
13596 PyObject *__pyx_t_2 = NULL;
13600 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__reopen,0};
13601 __Pyx_TraceDeclarations
13602 __Pyx_RefNannySetupContext("__cinit__");
13603 __Pyx_TraceCall("__cinit__", __pyx_f[0], 1366);
13604 if (unlikely(__pyx_kwds)) {
13605 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
13606 PyObject* values[2] = {0,0};
13607 switch (PyTuple_GET_SIZE(__pyx_args)) {
13608 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13609 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13611 default: goto __pyx_L5_argtuple_error;
13613 switch (PyTuple_GET_SIZE(__pyx_args)) {
13615 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
13616 if (likely(values[0])) kw_args--;
13617 else goto __pyx_L5_argtuple_error;
13620 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reopen);
13621 if (value) { values[1] = value; kw_args--; }
13624 if (unlikely(kw_args > 0)) {
13625 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13627 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
13629 __pyx_v_reopen = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13631 __pyx_v_reopen = ((int)1);
13634 __pyx_v_reopen = ((int)1);
13635 switch (PyTuple_GET_SIZE(__pyx_args)) {
13636 case 2: __pyx_v_reopen = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13637 case 1: __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0));
13639 default: goto __pyx_L5_argtuple_error;
13642 goto __pyx_L4_argument_unpacking_done;
13643 __pyx_L5_argtuple_error:;
13644 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
13646 __Pyx_AddTraceback("csamtools.IteratorRowAll.__cinit__");
13647 __Pyx_RefNannyFinishContext();
13649 __pyx_L4_argument_unpacking_done:;
13650 __pyx_v_mode = Py_None; __Pyx_INCREF(Py_None);
13651 __pyx_v_store = Py_None; __Pyx_INCREF(Py_None);
13652 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13654 /* "csamtools.pyx":1368
13655 * def __cinit__(self, Samfile samfile, int reopen = True ):
13657 * if not samfile._isOpen(): # <<<<<<<<<<<<<<
13658 * raise ValueError( "I/O operation on closed file" )
13661 __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 = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13662 __Pyx_GOTREF(__pyx_t_1);
13663 __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 = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13664 __Pyx_GOTREF(__pyx_t_2);
13665 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13666 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13667 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13668 __pyx_t_4 = (!__pyx_t_3);
13671 /* "csamtools.pyx":1369
13673 * if not samfile._isOpen():
13674 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
13676 * if samfile.isbam: mode = "rb"
13678 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_108), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13679 __Pyx_GOTREF(__pyx_t_2);
13680 __Pyx_Raise(__pyx_t_2, 0, 0);
13681 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13682 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13687 /* "csamtools.pyx":1371
13688 * raise ValueError( "I/O operation on closed file" )
13690 * if samfile.isbam: mode = "rb" # <<<<<<<<<<<<<<
13694 if (__pyx_v_samfile->isbam) {
13695 __Pyx_INCREF(((PyObject *)__pyx_n_s__rb));
13696 __Pyx_DECREF(__pyx_v_mode);
13697 __pyx_v_mode = ((PyObject *)__pyx_n_s__rb);
13702 /* "csamtools.pyx":1372
13704 * if samfile.isbam: mode = "rb"
13705 * else: mode = "r" # <<<<<<<<<<<<<<
13707 * # reopen the file to avoid iterator conflict
13709 __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
13710 __Pyx_DECREF(__pyx_v_mode);
13711 __pyx_v_mode = ((PyObject *)__pyx_n_s__r);
13715 /* "csamtools.pyx":1375
13717 * # reopen the file to avoid iterator conflict
13718 * if reopen: # <<<<<<<<<<<<<<
13719 * store = StderrStore()
13720 * self.fp = samopen( samfile._filename, mode, NULL )
13722 if (__pyx_v_reopen) {
13724 /* "csamtools.pyx":1376
13725 * # reopen the file to avoid iterator conflict
13727 * store = StderrStore() # <<<<<<<<<<<<<<
13728 * self.fp = samopen( samfile._filename, mode, NULL )
13731 __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13732 __Pyx_GOTREF(__pyx_t_2);
13733 __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 = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13734 __Pyx_GOTREF(__pyx_t_1);
13735 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13736 __Pyx_DECREF(__pyx_v_store);
13737 __pyx_v_store = __pyx_t_1;
13740 /* "csamtools.pyx":1377
13742 * store = StderrStore()
13743 * self.fp = samopen( samfile._filename, mode, NULL ) # <<<<<<<<<<<<<<
13745 * assert self.fp != NULL
13747 __pyx_t_5 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13748 ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_5, NULL);
13750 /* "csamtools.pyx":1378
13751 * store = StderrStore()
13752 * self.fp = samopen( samfile._filename, mode, NULL )
13753 * store.release() # <<<<<<<<<<<<<<
13754 * assert self.fp != NULL
13755 * self.owns_samfile = True
13757 __pyx_t_1 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13758 __Pyx_GOTREF(__pyx_t_1);
13759 __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 = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13760 __Pyx_GOTREF(__pyx_t_2);
13761 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13762 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13764 /* "csamtools.pyx":1379
13765 * self.fp = samopen( samfile._filename, mode, NULL )
13767 * assert self.fp != NULL # <<<<<<<<<<<<<<
13768 * self.owns_samfile = True
13771 #ifndef CYTHON_WITHOUT_ASSERTIONS
13772 if (unlikely(!(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp != NULL))) {
13773 PyErr_SetNone(PyExc_AssertionError);
13774 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13778 /* "csamtools.pyx":1380
13780 * assert self.fp != NULL
13781 * self.owns_samfile = True # <<<<<<<<<<<<<<
13783 * self.fp = samfile.samfile
13785 ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->owns_samfile = 1;
13790 /* "csamtools.pyx":1382
13791 * self.owns_samfile = True
13793 * self.fp = samfile.samfile # <<<<<<<<<<<<<<
13794 * self.owns_samfile = False
13797 ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp = __pyx_v_samfile->samfile;
13799 /* "csamtools.pyx":1383
13801 * self.fp = samfile.samfile
13802 * self.owns_samfile = False # <<<<<<<<<<<<<<
13804 * # allocate memory for alignment
13806 ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->owns_samfile = 0;
13810 /* "csamtools.pyx":1386
13812 * # allocate memory for alignment
13813 * self.b = <bam1_t*>calloc(1, sizeof(bam1_t)) # <<<<<<<<<<<<<<
13815 * def __iter__(self):
13817 ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->b = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
13822 __Pyx_XDECREF(__pyx_t_1);
13823 __Pyx_XDECREF(__pyx_t_2);
13824 __Pyx_AddTraceback("csamtools.IteratorRowAll.__cinit__");
13827 __Pyx_DECREF(__pyx_v_mode);
13828 __Pyx_DECREF(__pyx_v_store);
13829 __Pyx_TraceReturn(Py_None);
13830 __Pyx_RefNannyFinishContext();
13834 /* "csamtools.pyx":1388
13835 * self.b = <bam1_t*>calloc(1, sizeof(bam1_t))
13837 * def __iter__(self): # <<<<<<<<<<<<<<
13842 static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_1__iter__(PyObject *__pyx_v_self); /*proto*/
13843 static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_1__iter__(PyObject *__pyx_v_self) {
13844 PyObject *__pyx_r = NULL;
13845 __Pyx_TraceDeclarations
13846 __Pyx_RefNannySetupContext("__iter__");
13847 __Pyx_TraceCall("__iter__", __pyx_f[0], 1388);
13849 /* "csamtools.pyx":1389
13851 * def __iter__(self):
13852 * return self # <<<<<<<<<<<<<<
13854 * cdef bam1_t * getCurrent( self ):
13856 __Pyx_XDECREF(__pyx_r);
13857 __Pyx_INCREF(__pyx_v_self);
13858 __pyx_r = __pyx_v_self;
13861 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13863 __Pyx_XGIVEREF(__pyx_r);
13864 __Pyx_TraceReturn(__pyx_r);
13865 __Pyx_RefNannyFinishContext();
13869 /* "csamtools.pyx":1391
13872 * cdef bam1_t * getCurrent( self ): # <<<<<<<<<<<<<<
13877 static bam1_t *__pyx_f_9csamtools_14IteratorRowAll_getCurrent(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self) {
13879 __Pyx_TraceDeclarations
13880 __Pyx_RefNannySetupContext("getCurrent");
13881 __Pyx_TraceCall("getCurrent", __pyx_f[0], 1391);
13883 /* "csamtools.pyx":1392
13885 * cdef bam1_t * getCurrent( self ):
13886 * return self.b # <<<<<<<<<<<<<<
13888 * cdef int cnext(self):
13890 __pyx_r = __pyx_v_self->b;
13895 __Pyx_TraceReturn(Py_None);
13896 __Pyx_RefNannyFinishContext();
13900 /* "csamtools.pyx":1394
13903 * cdef int cnext(self): # <<<<<<<<<<<<<<
13904 * '''cversion of iterator. Used by IteratorColumn'''
13908 static int __pyx_f_9csamtools_14IteratorRowAll_cnext(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self) {
13910 __Pyx_TraceDeclarations
13911 __Pyx_RefNannySetupContext("cnext");
13912 __Pyx_TraceCall("cnext", __pyx_f[0], 1394);
13914 /* "csamtools.pyx":1397
13915 * '''cversion of iterator. Used by IteratorColumn'''
13917 * return samread(self.fp, self.b) # <<<<<<<<<<<<<<
13919 * def __next__(self):
13921 __pyx_r = samread(__pyx_v_self->fp, __pyx_v_self->b);
13926 __Pyx_TraceReturn(Py_None);
13927 __Pyx_RefNannyFinishContext();
13931 /* "csamtools.pyx":1399
13932 * return samread(self.fp, self.b)
13934 * def __next__(self): # <<<<<<<<<<<<<<
13935 * """python version of next().
13939 static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_2__next__(PyObject *__pyx_v_self); /*proto*/
13940 static char __pyx_doc_9csamtools_14IteratorRowAll_2__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n ";
13941 struct wrapperbase __pyx_wrapperbase_9csamtools_14IteratorRowAll_2__next__;
13942 static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_2__next__(PyObject *__pyx_v_self) {
13944 PyObject *__pyx_r = NULL;
13946 PyObject *__pyx_t_2 = NULL;
13947 __Pyx_TraceDeclarations
13948 __Pyx_RefNannySetupContext("__next__");
13949 __Pyx_TraceCall("__next__", __pyx_f[0], 1399);
13951 /* "csamtools.pyx":1405
13954 * ret = samread(self.fp, self.b) # <<<<<<<<<<<<<<
13956 * return makeAlignedRead( self.b )
13958 __pyx_v_ret = samread(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp, ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->b);
13960 /* "csamtools.pyx":1406
13962 * ret = samread(self.fp, self.b)
13963 * if (ret > 0): # <<<<<<<<<<<<<<
13964 * return makeAlignedRead( self.b )
13967 __pyx_t_1 = (__pyx_v_ret > 0);
13970 /* "csamtools.pyx":1407
13971 * ret = samread(self.fp, self.b)
13973 * return makeAlignedRead( self.b ) # <<<<<<<<<<<<<<
13975 * raise StopIteration
13977 __Pyx_XDECREF(__pyx_r);
13978 __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13979 __Pyx_GOTREF(__pyx_t_2);
13980 __pyx_r = __pyx_t_2;
13987 /* "csamtools.pyx":1409
13988 * return makeAlignedRead( self.b )
13990 * raise StopIteration # <<<<<<<<<<<<<<
13992 * def __dealloc__(self):
13994 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
13995 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
13999 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14002 __Pyx_XDECREF(__pyx_t_2);
14003 __Pyx_AddTraceback("csamtools.IteratorRowAll.__next__");
14006 __Pyx_XGIVEREF(__pyx_r);
14007 __Pyx_TraceReturn(__pyx_r);
14008 __Pyx_RefNannyFinishContext();
14012 /* "csamtools.pyx":1411
14013 * raise StopIteration
14015 * def __dealloc__(self): # <<<<<<<<<<<<<<
14016 * bam_destroy1(self.b)
14017 * if self.owns_samfile: samclose( self.fp )
14020 static void __pyx_pf_9csamtools_14IteratorRowAll_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
14021 static void __pyx_pf_9csamtools_14IteratorRowAll_3__dealloc__(PyObject *__pyx_v_self) {
14022 __Pyx_TraceDeclarations
14023 __Pyx_RefNannySetupContext("__dealloc__");
14024 __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1411);
14026 /* "csamtools.pyx":1412
14028 * def __dealloc__(self):
14029 * bam_destroy1(self.b) # <<<<<<<<<<<<<<
14030 * if self.owns_samfile: samclose( self.fp )
14033 bam_destroy1(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->b);
14035 /* "csamtools.pyx":1413
14036 * def __dealloc__(self):
14037 * bam_destroy1(self.b)
14038 * if self.owns_samfile: samclose( self.fp ) # <<<<<<<<<<<<<<
14040 * cdef class IteratorRowAllRefs(IteratorRow):
14042 if (((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->owns_samfile) {
14043 samclose(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp);
14048 __Pyx_TraceReturn(Py_None);
14049 __Pyx_RefNannyFinishContext();
14052 /* "csamtools.pyx":1422
14053 * cdef IteratorRowRegion rowiter
14055 * def __cinit__(self, Samfile samfile): # <<<<<<<<<<<<<<
14056 * assert samfile._isOpen()
14057 * if not samfile._hasIndex(): raise ValueError("no index available for fetch")
14060 static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
14061 static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
14062 struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
14064 PyObject *__pyx_t_1 = NULL;
14065 PyObject *__pyx_t_2 = NULL;
14068 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0};
14069 __Pyx_TraceDeclarations
14070 __Pyx_RefNannySetupContext("__cinit__");
14071 __Pyx_TraceCall("__cinit__", __pyx_f[0], 1422);
14072 if (unlikely(__pyx_kwds)) {
14073 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
14074 PyObject* values[1] = {0};
14075 switch (PyTuple_GET_SIZE(__pyx_args)) {
14076 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14078 default: goto __pyx_L5_argtuple_error;
14080 switch (PyTuple_GET_SIZE(__pyx_args)) {
14082 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
14083 if (likely(values[0])) kw_args--;
14084 else goto __pyx_L5_argtuple_error;
14086 if (unlikely(kw_args > 0)) {
14087 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14089 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
14090 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
14091 goto __pyx_L5_argtuple_error;
14093 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0));
14095 goto __pyx_L4_argument_unpacking_done;
14096 __pyx_L5_argtuple_error:;
14097 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14099 __Pyx_AddTraceback("csamtools.IteratorRowAllRefs.__cinit__");
14100 __Pyx_RefNannyFinishContext();
14102 __pyx_L4_argument_unpacking_done:;
14103 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14105 /* "csamtools.pyx":1423
14107 * def __cinit__(self, Samfile samfile):
14108 * assert samfile._isOpen() # <<<<<<<<<<<<<<
14109 * if not samfile._hasIndex(): raise ValueError("no index available for fetch")
14110 * self.samfile = samfile
14112 #ifndef CYTHON_WITHOUT_ASSERTIONS
14113 __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 = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14114 __Pyx_GOTREF(__pyx_t_1);
14115 __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 = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14116 __Pyx_GOTREF(__pyx_t_2);
14117 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14118 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14119 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14120 if (unlikely(!__pyx_t_3)) {
14121 PyErr_SetNone(PyExc_AssertionError);
14122 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14126 /* "csamtools.pyx":1424
14127 * def __cinit__(self, Samfile samfile):
14128 * assert samfile._isOpen()
14129 * if not samfile._hasIndex(): raise ValueError("no index available for fetch") # <<<<<<<<<<<<<<
14130 * self.samfile = samfile
14133 __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 = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14134 __Pyx_GOTREF(__pyx_t_2);
14135 __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 = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14136 __Pyx_GOTREF(__pyx_t_1);
14137 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14138 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14139 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14140 __pyx_t_4 = (!__pyx_t_3);
14142 __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_109), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14143 __Pyx_GOTREF(__pyx_t_1);
14144 __Pyx_Raise(__pyx_t_1, 0, 0);
14145 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14146 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14151 /* "csamtools.pyx":1425
14152 * assert samfile._isOpen()
14153 * if not samfile._hasIndex(): raise ValueError("no index available for fetch")
14154 * self.samfile = samfile # <<<<<<<<<<<<<<
14158 __Pyx_INCREF(((PyObject *)__pyx_v_samfile));
14159 __Pyx_GIVEREF(((PyObject *)__pyx_v_samfile));
14160 __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile);
14161 __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile));
14162 ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile = __pyx_v_samfile;
14164 /* "csamtools.pyx":1426
14165 * if not samfile._hasIndex(): raise ValueError("no index available for fetch")
14166 * self.samfile = samfile
14167 * self.tid = -1 # <<<<<<<<<<<<<<
14169 * def nextiter(self):
14171 ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid = -1;
14176 __Pyx_XDECREF(__pyx_t_1);
14177 __Pyx_XDECREF(__pyx_t_2);
14178 __Pyx_AddTraceback("csamtools.IteratorRowAllRefs.__cinit__");
14181 __Pyx_TraceReturn(Py_None);
14182 __Pyx_RefNannyFinishContext();
14186 /* "csamtools.pyx":1428
14189 * def nextiter(self): # <<<<<<<<<<<<<<
14190 * self.rowiter = IteratorRowRegion(self.samfile, self.tid, 0, 1<<29)
14194 static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_1nextiter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
14195 static char __pyx_doc_9csamtools_18IteratorRowAllRefs_1nextiter[] = "IteratorRowAllRefs.nextiter(self)";
14196 static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_1nextiter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14197 PyObject *__pyx_r = NULL;
14198 PyObject *__pyx_t_1 = NULL;
14199 PyObject *__pyx_t_2 = NULL;
14200 __Pyx_TraceDeclarations
14201 __Pyx_RefNannySetupContext("nextiter");
14202 __Pyx_TraceCall("nextiter", __pyx_f[0], 1428);
14204 /* "csamtools.pyx":1429
14206 * def nextiter(self):
14207 * self.rowiter = IteratorRowRegion(self.samfile, self.tid, 0, 1<<29) # <<<<<<<<<<<<<<
14209 * def __iter__(self):
14211 __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14212 __Pyx_GOTREF(__pyx_t_1);
14213 __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14214 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
14215 __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile));
14216 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile));
14217 __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile));
14218 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
14219 __Pyx_GIVEREF(__pyx_t_1);
14220 __Pyx_INCREF(__pyx_int_0);
14221 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_int_0);
14222 __Pyx_GIVEREF(__pyx_int_0);
14223 __Pyx_INCREF(__pyx_int_536870912);
14224 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_int_536870912);
14225 __Pyx_GIVEREF(__pyx_int_536870912);
14227 __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 = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14228 __Pyx_GOTREF(__pyx_t_1);
14229 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
14230 __Pyx_GIVEREF(__pyx_t_1);
14231 __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter);
14232 __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter));
14233 ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_t_1);
14236 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14239 __Pyx_XDECREF(__pyx_t_1);
14240 __Pyx_XDECREF(__pyx_t_2);
14241 __Pyx_AddTraceback("csamtools.IteratorRowAllRefs.nextiter");
14244 __Pyx_XGIVEREF(__pyx_r);
14245 __Pyx_TraceReturn(__pyx_r);
14246 __Pyx_RefNannyFinishContext();
14250 /* "csamtools.pyx":1431
14251 * self.rowiter = IteratorRowRegion(self.samfile, self.tid, 0, 1<<29)
14253 * def __iter__(self): # <<<<<<<<<<<<<<
14258 static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_2__iter__(PyObject *__pyx_v_self); /*proto*/
14259 static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_2__iter__(PyObject *__pyx_v_self) {
14260 PyObject *__pyx_r = NULL;
14261 __Pyx_TraceDeclarations
14262 __Pyx_RefNannySetupContext("__iter__");
14263 __Pyx_TraceCall("__iter__", __pyx_f[0], 1431);
14265 /* "csamtools.pyx":1432
14267 * def __iter__(self):
14268 * return self # <<<<<<<<<<<<<<
14270 * def __next__(self):
14272 __Pyx_XDECREF(__pyx_r);
14273 __Pyx_INCREF(__pyx_v_self);
14274 __pyx_r = __pyx_v_self;
14277 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14279 __Pyx_XGIVEREF(__pyx_r);
14280 __Pyx_TraceReturn(__pyx_r);
14281 __Pyx_RefNannyFinishContext();
14285 /* "csamtools.pyx":1434
14288 * def __next__(self): # <<<<<<<<<<<<<<
14289 * """python version of next().
14293 static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_3__next__(PyObject *__pyx_v_self); /*proto*/
14294 static char __pyx_doc_9csamtools_18IteratorRowAllRefs_3__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n ";
14295 struct wrapperbase __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_3__next__;
14296 static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_3__next__(PyObject *__pyx_v_self) {
14297 PyObject *__pyx_r = NULL;
14299 PyObject *__pyx_t_2 = NULL;
14301 PyObject *__pyx_t_4 = NULL;
14302 PyObject *__pyx_t_5 = NULL;
14303 __Pyx_TraceDeclarations
14304 __Pyx_RefNannySetupContext("__next__");
14305 __Pyx_TraceCall("__next__", __pyx_f[0], 1434);
14307 /* "csamtools.pyx":1440
14309 * # Create an initial iterator
14310 * if self.tid==-1: # <<<<<<<<<<<<<<
14311 * if not self.samfile.nreferences:
14312 * raise StopIteration
14314 __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid == -1);
14317 /* "csamtools.pyx":1441
14318 * # Create an initial iterator
14320 * if not self.samfile.nreferences: # <<<<<<<<<<<<<<
14321 * raise StopIteration
14324 __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14325 __Pyx_GOTREF(__pyx_t_2);
14326 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14327 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14328 __pyx_t_3 = (!__pyx_t_1);
14331 /* "csamtools.pyx":1442
14333 * if not self.samfile.nreferences:
14334 * raise StopIteration # <<<<<<<<<<<<<<
14338 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
14339 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14344 /* "csamtools.pyx":1443
14345 * if not self.samfile.nreferences:
14346 * raise StopIteration
14347 * self.tid = 0 # <<<<<<<<<<<<<<
14351 ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid = 0;
14353 /* "csamtools.pyx":1444
14354 * raise StopIteration
14356 * self.nextiter() # <<<<<<<<<<<<<<
14360 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nextiter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14361 __Pyx_GOTREF(__pyx_t_2);
14362 __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 = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14363 __Pyx_GOTREF(__pyx_t_4);
14364 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14365 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14370 /* "csamtools.pyx":1446
14373 * while 1: # <<<<<<<<<<<<<<
14374 * self.rowiter.cnext()
14380 /* "csamtools.pyx":1447
14383 * self.rowiter.cnext() # <<<<<<<<<<<<<<
14385 * # If current iterator is not exhausted, return aligned read
14387 ((struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter->__pyx_vtab)->cnext(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter);
14389 /* "csamtools.pyx":1450
14391 * # If current iterator is not exhausted, return aligned read
14392 * if self.rowiter.retval>0: # <<<<<<<<<<<<<<
14393 * return makeAlignedRead(self.rowiter.b)
14396 __pyx_t_3 = (((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter->retval > 0);
14399 /* "csamtools.pyx":1451
14400 * # If current iterator is not exhausted, return aligned read
14401 * if self.rowiter.retval>0:
14402 * return makeAlignedRead(self.rowiter.b) # <<<<<<<<<<<<<<
14406 __Pyx_XDECREF(__pyx_r);
14407 __pyx_t_4 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter->b); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14408 __Pyx_GOTREF(__pyx_t_4);
14409 __pyx_r = __pyx_t_4;
14416 /* "csamtools.pyx":1453
14417 * return makeAlignedRead(self.rowiter.b)
14419 * self.tid += 1 # <<<<<<<<<<<<<<
14421 * # Otherwise, proceed to next reference or stop
14423 ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid = (((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid + 1);
14425 /* "csamtools.pyx":1456
14427 * # Otherwise, proceed to next reference or stop
14428 * if self.tid<self.samfile.nreferences: # <<<<<<<<<<<<<<
14432 __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14433 __Pyx_GOTREF(__pyx_t_4);
14434 __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14435 __Pyx_GOTREF(__pyx_t_2);
14436 __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 = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14437 __Pyx_GOTREF(__pyx_t_5);
14438 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14439 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14440 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14441 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14444 /* "csamtools.pyx":1457
14445 * # Otherwise, proceed to next reference or stop
14446 * if self.tid<self.samfile.nreferences:
14447 * self.nextiter() # <<<<<<<<<<<<<<
14449 * raise StopIteration
14451 __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nextiter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14452 __Pyx_GOTREF(__pyx_t_5);
14453 __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 = 1457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14454 __Pyx_GOTREF(__pyx_t_2);
14455 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14456 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14461 /* "csamtools.pyx":1459
14464 * raise StopIteration # <<<<<<<<<<<<<<
14466 * cdef class IteratorRowSelection(IteratorRow):
14468 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
14469 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14474 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14477 __Pyx_XDECREF(__pyx_t_2);
14478 __Pyx_XDECREF(__pyx_t_4);
14479 __Pyx_XDECREF(__pyx_t_5);
14480 __Pyx_AddTraceback("csamtools.IteratorRowAllRefs.__next__");
14483 __Pyx_XGIVEREF(__pyx_r);
14484 __Pyx_TraceReturn(__pyx_r);
14485 __Pyx_RefNannyFinishContext();
14489 /* "csamtools.pyx":1474
14490 * cdef int owns_samfile
14492 * def __cinit__(self, Samfile samfile, positions, int reopen = True ): # <<<<<<<<<<<<<<
14494 * if not samfile._isOpen():
14497 static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
14498 static int __pyx_pf_9csamtools_20IteratorRowSelection___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
14499 struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
14500 PyObject *__pyx_v_positions = 0;
14501 int __pyx_v_reopen;
14502 PyObject *__pyx_v_mode;
14503 PyObject *__pyx_v_store;
14505 PyObject *__pyx_t_1 = NULL;
14506 PyObject *__pyx_t_2 = NULL;
14510 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__positions,&__pyx_n_s__reopen,0};
14511 __Pyx_TraceDeclarations
14512 __Pyx_RefNannySetupContext("__cinit__");
14513 __Pyx_TraceCall("__cinit__", __pyx_f[0], 1474);
14514 if (unlikely(__pyx_kwds)) {
14515 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
14516 PyObject* values[3] = {0,0,0};
14517 switch (PyTuple_GET_SIZE(__pyx_args)) {
14518 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14519 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14520 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14522 default: goto __pyx_L5_argtuple_error;
14524 switch (PyTuple_GET_SIZE(__pyx_args)) {
14526 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
14527 if (likely(values[0])) kw_args--;
14528 else goto __pyx_L5_argtuple_error;
14530 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__positions);
14531 if (likely(values[1])) kw_args--;
14533 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14537 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reopen);
14538 if (value) { values[2] = value; kw_args--; }
14541 if (unlikely(kw_args > 0)) {
14542 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14544 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
14545 __pyx_v_positions = values[1];
14547 __pyx_v_reopen = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14549 __pyx_v_reopen = ((int)1);
14552 __pyx_v_reopen = ((int)1);
14553 switch (PyTuple_GET_SIZE(__pyx_args)) {
14555 __pyx_v_reopen = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14557 __pyx_v_positions = PyTuple_GET_ITEM(__pyx_args, 1);
14558 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0));
14560 default: goto __pyx_L5_argtuple_error;
14563 goto __pyx_L4_argument_unpacking_done;
14564 __pyx_L5_argtuple_error:;
14565 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
14567 __Pyx_AddTraceback("csamtools.IteratorRowSelection.__cinit__");
14568 __Pyx_RefNannyFinishContext();
14570 __pyx_L4_argument_unpacking_done:;
14571 __pyx_v_mode = Py_None; __Pyx_INCREF(Py_None);
14572 __pyx_v_store = Py_None; __Pyx_INCREF(Py_None);
14573 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14575 /* "csamtools.pyx":1476
14576 * def __cinit__(self, Samfile samfile, positions, int reopen = True ):
14578 * if not samfile._isOpen(): # <<<<<<<<<<<<<<
14579 * raise ValueError( "I/O operation on closed file" )
14582 __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 = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14583 __Pyx_GOTREF(__pyx_t_1);
14584 __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 = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14585 __Pyx_GOTREF(__pyx_t_2);
14586 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14587 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14588 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14589 __pyx_t_4 = (!__pyx_t_3);
14592 /* "csamtools.pyx":1477
14594 * if not samfile._isOpen():
14595 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
14597 * if not samfile._isOpen():
14599 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_110), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14600 __Pyx_GOTREF(__pyx_t_2);
14601 __Pyx_Raise(__pyx_t_2, 0, 0);
14602 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14603 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14608 /* "csamtools.pyx":1479
14609 * raise ValueError( "I/O operation on closed file" )
14611 * if not samfile._isOpen(): # <<<<<<<<<<<<<<
14612 * raise ValueError( "I/O operation on closed file" )
14615 __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 = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14616 __Pyx_GOTREF(__pyx_t_2);
14617 __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 = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14618 __Pyx_GOTREF(__pyx_t_1);
14619 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14620 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14621 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14622 __pyx_t_3 = (!__pyx_t_4);
14625 /* "csamtools.pyx":1480
14627 * if not samfile._isOpen():
14628 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
14630 * assert samfile.isbam, "can only use this iterator on bam files"
14632 __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14633 __Pyx_GOTREF(__pyx_t_1);
14634 __Pyx_Raise(__pyx_t_1, 0, 0);
14635 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14636 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14641 /* "csamtools.pyx":1482
14642 * raise ValueError( "I/O operation on closed file" )
14644 * assert samfile.isbam, "can only use this iterator on bam files" # <<<<<<<<<<<<<<
14648 #ifndef CYTHON_WITHOUT_ASSERTIONS
14649 if (unlikely(!__pyx_v_samfile->isbam)) {
14650 PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_112));
14651 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14655 /* "csamtools.pyx":1483
14657 * assert samfile.isbam, "can only use this iterator on bam files"
14658 * mode = "rb" # <<<<<<<<<<<<<<
14660 * # reopen the file to avoid iterator conflict
14662 __Pyx_INCREF(((PyObject *)__pyx_n_s__rb));
14663 __Pyx_DECREF(__pyx_v_mode);
14664 __pyx_v_mode = ((PyObject *)__pyx_n_s__rb);
14666 /* "csamtools.pyx":1486
14668 * # reopen the file to avoid iterator conflict
14669 * if reopen: # <<<<<<<<<<<<<<
14670 * store = StderrStore()
14671 * self.fp = samopen( samfile._filename, mode, NULL )
14673 if (__pyx_v_reopen) {
14675 /* "csamtools.pyx":1487
14676 * # reopen the file to avoid iterator conflict
14678 * store = StderrStore() # <<<<<<<<<<<<<<
14679 * self.fp = samopen( samfile._filename, mode, NULL )
14682 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14683 __Pyx_GOTREF(__pyx_t_1);
14684 __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 = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14685 __Pyx_GOTREF(__pyx_t_2);
14686 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14687 __Pyx_DECREF(__pyx_v_store);
14688 __pyx_v_store = __pyx_t_2;
14691 /* "csamtools.pyx":1488
14693 * store = StderrStore()
14694 * self.fp = samopen( samfile._filename, mode, NULL ) # <<<<<<<<<<<<<<
14696 * assert self.fp != NULL
14698 __pyx_t_5 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14699 ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_5, NULL);
14701 /* "csamtools.pyx":1489
14702 * store = StderrStore()
14703 * self.fp = samopen( samfile._filename, mode, NULL )
14704 * store.release() # <<<<<<<<<<<<<<
14705 * assert self.fp != NULL
14706 * self.owns_samfile = True
14708 __pyx_t_2 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14709 __Pyx_GOTREF(__pyx_t_2);
14710 __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 = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14711 __Pyx_GOTREF(__pyx_t_1);
14712 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14713 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14715 /* "csamtools.pyx":1490
14716 * self.fp = samopen( samfile._filename, mode, NULL )
14718 * assert self.fp != NULL # <<<<<<<<<<<<<<
14719 * self.owns_samfile = True
14722 #ifndef CYTHON_WITHOUT_ASSERTIONS
14723 if (unlikely(!(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->fp != NULL))) {
14724 PyErr_SetNone(PyExc_AssertionError);
14725 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14729 /* "csamtools.pyx":1491
14731 * assert self.fp != NULL
14732 * self.owns_samfile = True # <<<<<<<<<<<<<<
14734 * self.fp = samfile.samfile
14736 ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->owns_samfile = 1;
14741 /* "csamtools.pyx":1493
14742 * self.owns_samfile = True
14744 * self.fp = samfile.samfile # <<<<<<<<<<<<<<
14745 * self.owns_samfile = False
14748 ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->fp = __pyx_v_samfile->samfile;
14750 /* "csamtools.pyx":1494
14752 * self.fp = samfile.samfile
14753 * self.owns_samfile = False # <<<<<<<<<<<<<<
14755 * # allocate memory for alignment
14757 ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->owns_samfile = 0;
14761 /* "csamtools.pyx":1497
14763 * # allocate memory for alignment
14764 * self.b = <bam1_t*>calloc(1, sizeof(bam1_t)) # <<<<<<<<<<<<<<
14766 * self.positions = positions
14768 ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->b = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
14770 /* "csamtools.pyx":1499
14771 * self.b = <bam1_t*>calloc(1, sizeof(bam1_t))
14773 * self.positions = positions # <<<<<<<<<<<<<<
14774 * self.current_pos = 0
14777 __Pyx_INCREF(__pyx_v_positions);
14778 __Pyx_GIVEREF(__pyx_v_positions);
14779 __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->positions);
14780 __Pyx_DECREF(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->positions);
14781 ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->positions = __pyx_v_positions;
14783 /* "csamtools.pyx":1500
14785 * self.positions = positions
14786 * self.current_pos = 0 # <<<<<<<<<<<<<<
14788 * def __iter__(self):
14790 ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->current_pos = 0;
14795 __Pyx_XDECREF(__pyx_t_1);
14796 __Pyx_XDECREF(__pyx_t_2);
14797 __Pyx_AddTraceback("csamtools.IteratorRowSelection.__cinit__");
14800 __Pyx_DECREF(__pyx_v_mode);
14801 __Pyx_DECREF(__pyx_v_store);
14802 __Pyx_TraceReturn(Py_None);
14803 __Pyx_RefNannyFinishContext();
14807 /* "csamtools.pyx":1502
14808 * self.current_pos = 0
14810 * def __iter__(self): # <<<<<<<<<<<<<<
14815 static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_1__iter__(PyObject *__pyx_v_self); /*proto*/
14816 static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_1__iter__(PyObject *__pyx_v_self) {
14817 PyObject *__pyx_r = NULL;
14818 __Pyx_TraceDeclarations
14819 __Pyx_RefNannySetupContext("__iter__");
14820 __Pyx_TraceCall("__iter__", __pyx_f[0], 1502);
14822 /* "csamtools.pyx":1503
14824 * def __iter__(self):
14825 * return self # <<<<<<<<<<<<<<
14827 * cdef bam1_t * getCurrent( self ):
14829 __Pyx_XDECREF(__pyx_r);
14830 __Pyx_INCREF(__pyx_v_self);
14831 __pyx_r = __pyx_v_self;
14834 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14836 __Pyx_XGIVEREF(__pyx_r);
14837 __Pyx_TraceReturn(__pyx_r);
14838 __Pyx_RefNannyFinishContext();
14842 /* "csamtools.pyx":1505
14845 * cdef bam1_t * getCurrent( self ): # <<<<<<<<<<<<<<
14850 static bam1_t *__pyx_f_9csamtools_20IteratorRowSelection_getCurrent(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self) {
14852 __Pyx_TraceDeclarations
14853 __Pyx_RefNannySetupContext("getCurrent");
14854 __Pyx_TraceCall("getCurrent", __pyx_f[0], 1505);
14856 /* "csamtools.pyx":1506
14858 * cdef bam1_t * getCurrent( self ):
14859 * return self.b # <<<<<<<<<<<<<<
14861 * cdef int cnext(self):
14863 __pyx_r = __pyx_v_self->b;
14868 __Pyx_TraceReturn(Py_None);
14869 __Pyx_RefNannyFinishContext();
14873 /* "csamtools.pyx":1508
14876 * cdef int cnext(self): # <<<<<<<<<<<<<<
14877 * '''cversion of iterator'''
14881 static int __pyx_f_9csamtools_20IteratorRowSelection_cnext(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self) {
14883 PyObject *__pyx_t_1 = NULL;
14884 Py_ssize_t __pyx_t_2;
14886 uint64_t __pyx_t_4;
14887 __Pyx_TraceDeclarations
14888 __Pyx_RefNannySetupContext("cnext");
14889 __Pyx_TraceCall("cnext", __pyx_f[0], 1508);
14891 /* "csamtools.pyx":1512
14893 * # end iteration if out of positions
14894 * if self.current_pos >= len(self.positions): return -1 # <<<<<<<<<<<<<<
14896 * bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 )
14898 __pyx_t_1 = __pyx_v_self->positions;
14899 __Pyx_INCREF(__pyx_t_1);
14900 __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14901 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14902 __pyx_t_3 = (__pyx_v_self->current_pos >= __pyx_t_2);
14910 /* "csamtools.pyx":1514
14911 * if self.current_pos >= len(self.positions): return -1
14913 * bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 ) # <<<<<<<<<<<<<<
14914 * self.current_pos += 1
14915 * return samread(self.fp, self.b)
14917 __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 = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14918 __Pyx_GOTREF(__pyx_t_1);
14919 __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 = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
14920 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14921 bam_seek(__pyx_v_self->fp->x.bam, __pyx_t_4, 0);
14923 /* "csamtools.pyx":1515
14925 * bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 )
14926 * self.current_pos += 1 # <<<<<<<<<<<<<<
14927 * return samread(self.fp, self.b)
14930 __pyx_v_self->current_pos = (__pyx_v_self->current_pos + 1);
14932 /* "csamtools.pyx":1516
14933 * bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 )
14934 * self.current_pos += 1
14935 * return samread(self.fp, self.b) # <<<<<<<<<<<<<<
14937 * def __next__(self):
14939 __pyx_r = samread(__pyx_v_self->fp, __pyx_v_self->b);
14945 __Pyx_XDECREF(__pyx_t_1);
14946 __Pyx_WriteUnraisable("csamtools.IteratorRowSelection.cnext");
14949 __Pyx_TraceReturn(Py_None);
14950 __Pyx_RefNannyFinishContext();
14954 /* "csamtools.pyx":1518
14955 * return samread(self.fp, self.b)
14957 * def __next__(self): # <<<<<<<<<<<<<<
14958 * """python version of next().
14962 static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_2__next__(PyObject *__pyx_v_self); /*proto*/
14963 static char __pyx_doc_9csamtools_20IteratorRowSelection_2__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n ";
14964 struct wrapperbase __pyx_wrapperbase_9csamtools_20IteratorRowSelection_2__next__;
14965 static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_2__next__(PyObject *__pyx_v_self) {
14967 PyObject *__pyx_r = NULL;
14969 PyObject *__pyx_t_2 = NULL;
14970 __Pyx_TraceDeclarations
14971 __Pyx_RefNannySetupContext("__next__");
14972 __Pyx_TraceCall("__next__", __pyx_f[0], 1518);
14974 /* "csamtools.pyx":1524
14977 * cdef int ret = self.cnext() # <<<<<<<<<<<<<<
14979 * return makeAlignedRead( self.b )
14981 __pyx_v_ret = ((struct __pyx_vtabstruct_9csamtools_IteratorRowSelection *)((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->__pyx_vtab)->cnext(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self));
14983 /* "csamtools.pyx":1525
14985 * cdef int ret = self.cnext()
14986 * if (ret > 0): # <<<<<<<<<<<<<<
14987 * return makeAlignedRead( self.b )
14990 __pyx_t_1 = (__pyx_v_ret > 0);
14993 /* "csamtools.pyx":1526
14994 * cdef int ret = self.cnext()
14996 * return makeAlignedRead( self.b ) # <<<<<<<<<<<<<<
14998 * raise StopIteration
15000 __Pyx_XDECREF(__pyx_r);
15001 __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15002 __Pyx_GOTREF(__pyx_t_2);
15003 __pyx_r = __pyx_t_2;
15010 /* "csamtools.pyx":1528
15011 * return makeAlignedRead( self.b )
15013 * raise StopIteration # <<<<<<<<<<<<<<
15015 * def __dealloc__(self):
15017 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
15018 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15022 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15025 __Pyx_XDECREF(__pyx_t_2);
15026 __Pyx_AddTraceback("csamtools.IteratorRowSelection.__next__");
15029 __Pyx_XGIVEREF(__pyx_r);
15030 __Pyx_TraceReturn(__pyx_r);
15031 __Pyx_RefNannyFinishContext();
15035 /* "csamtools.pyx":1530
15036 * raise StopIteration
15038 * def __dealloc__(self): # <<<<<<<<<<<<<<
15039 * bam_destroy1(self.b)
15040 * if self.owns_samfile: samclose( self.fp )
15043 static void __pyx_pf_9csamtools_20IteratorRowSelection_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
15044 static void __pyx_pf_9csamtools_20IteratorRowSelection_3__dealloc__(PyObject *__pyx_v_self) {
15045 __Pyx_TraceDeclarations
15046 __Pyx_RefNannySetupContext("__dealloc__");
15047 __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1530);
15049 /* "csamtools.pyx":1531
15051 * def __dealloc__(self):
15052 * bam_destroy1(self.b) # <<<<<<<<<<<<<<
15053 * if self.owns_samfile: samclose( self.fp )
15056 bam_destroy1(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->b);
15058 /* "csamtools.pyx":1532
15059 * def __dealloc__(self):
15060 * bam_destroy1(self.b)
15061 * if self.owns_samfile: samclose( self.fp ) # <<<<<<<<<<<<<<
15063 * ##-------------------------------------------------------------------
15065 if (((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->owns_samfile) {
15066 samclose(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->fp);
15071 __Pyx_TraceReturn(Py_None);
15072 __Pyx_RefNannyFinishContext();
15075 /* "csamtools.pyx":1545
15078 * cdef int __advance_all( void * data, bam1_t * b ): # <<<<<<<<<<<<<<
15079 * '''advance without any read filtering.
15083 static int __pyx_f_9csamtools___advance_all(void *__pyx_v_data, bam1_t *__pyx_v_b) {
15084 __pyx_t_9csamtools___iterdata *__pyx_v_d;
15086 __Pyx_TraceDeclarations
15087 __Pyx_RefNannySetupContext("__advance_all");
15088 __Pyx_TraceCall("__advance_all", __pyx_f[0], 1545);
15090 /* "csamtools.pyx":1549
15092 * cdef __iterdata * d
15093 * d = <__iterdata*>data # <<<<<<<<<<<<<<
15094 * return bam_iter_read( d.samfile.x.bam, d.iter, b )
15097 __pyx_v_d = ((__pyx_t_9csamtools___iterdata *)__pyx_v_data);
15099 /* "csamtools.pyx":1550
15100 * cdef __iterdata * d
15101 * d = <__iterdata*>data
15102 * return bam_iter_read( d.samfile.x.bam, d.iter, b ) # <<<<<<<<<<<<<<
15104 * cdef int __advance_snpcalls( void * data, bam1_t * b ):
15106 __pyx_r = bam_iter_read(__pyx_v_d->samfile->x.bam, __pyx_v_d->iter, __pyx_v_b);
15111 __Pyx_TraceReturn(Py_None);
15112 __Pyx_RefNannyFinishContext();
15116 /* "csamtools.pyx":1552
15117 * return bam_iter_read( d.samfile.x.bam, d.iter, b )
15119 * cdef int __advance_snpcalls( void * data, bam1_t * b ): # <<<<<<<<<<<<<<
15120 * '''advance using same filter and read processing as in
15121 * the samtools pileup.
15124 static int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__pyx_v_b) {
15125 __pyx_t_9csamtools___iterdata *__pyx_v_d;
15129 int __pyx_v_is_cns;
15130 int __pyx_v_is_nobaq;
15131 int __pyx_v_capQ_thres;
15136 PyObject *__pyx_t_4 = NULL;
15137 PyObject *__pyx_t_5 = NULL;
15138 PyObject *__pyx_t_6 = NULL;
15140 __Pyx_TraceDeclarations
15141 __Pyx_RefNannySetupContext("__advance_snpcalls");
15142 __Pyx_TraceCall("__advance_snpcalls", __pyx_f[0], 1552);
15144 /* "csamtools.pyx":1557
15146 * cdef __iterdata * d
15147 * d = <__iterdata*>data # <<<<<<<<<<<<<<
15149 * cdef int ret = bam_iter_read( d.samfile.x.bam, d.iter, b )
15151 __pyx_v_d = ((__pyx_t_9csamtools___iterdata *)__pyx_v_data);
15153 /* "csamtools.pyx":1559
15154 * d = <__iterdata*>data
15156 * cdef int ret = bam_iter_read( d.samfile.x.bam, d.iter, b ) # <<<<<<<<<<<<<<
15157 * cdef int skip = 0
15160 __pyx_v_ret = bam_iter_read(__pyx_v_d->samfile->x.bam, __pyx_v_d->iter, __pyx_v_b);
15162 /* "csamtools.pyx":1560
15164 * cdef int ret = bam_iter_read( d.samfile.x.bam, d.iter, b )
15165 * cdef int skip = 0 # <<<<<<<<<<<<<<
15167 * cdef int is_cns = 1
15171 /* "csamtools.pyx":1562
15172 * cdef int skip = 0
15174 * cdef int is_cns = 1 # <<<<<<<<<<<<<<
15175 * cdef int is_nobaq = 0
15176 * cdef int capQ_thres = 0
15178 __pyx_v_is_cns = 1;
15180 /* "csamtools.pyx":1563
15182 * cdef int is_cns = 1
15183 * cdef int is_nobaq = 0 # <<<<<<<<<<<<<<
15184 * cdef int capQ_thres = 0
15187 __pyx_v_is_nobaq = 0;
15189 /* "csamtools.pyx":1564
15190 * cdef int is_cns = 1
15191 * cdef int is_nobaq = 0
15192 * cdef int capQ_thres = 0 # <<<<<<<<<<<<<<
15194 * # reload sequence
15196 __pyx_v_capQ_thres = 0;
15198 /* "csamtools.pyx":1567
15200 * # reload sequence
15201 * if d.fastafile != NULL and b.core.tid != d.tid: # <<<<<<<<<<<<<<
15202 * if d.seq != NULL: free(d.seq)
15203 * d.tid = b.core.tid
15205 __pyx_t_1 = (__pyx_v_d->fastafile != NULL);
15207 __pyx_t_2 = (__pyx_v_b->core.tid != __pyx_v_d->tid);
15208 __pyx_t_3 = __pyx_t_2;
15210 __pyx_t_3 = __pyx_t_1;
15214 /* "csamtools.pyx":1568
15215 * # reload sequence
15216 * if d.fastafile != NULL and b.core.tid != d.tid:
15217 * if d.seq != NULL: free(d.seq) # <<<<<<<<<<<<<<
15218 * d.tid = b.core.tid
15219 * d.seq = faidx_fetch_seq(d.fastafile,
15221 __pyx_t_3 = (__pyx_v_d->seq != NULL);
15223 free(__pyx_v_d->seq);
15228 /* "csamtools.pyx":1569
15229 * if d.fastafile != NULL and b.core.tid != d.tid:
15230 * if d.seq != NULL: free(d.seq)
15231 * d.tid = b.core.tid # <<<<<<<<<<<<<<
15232 * d.seq = faidx_fetch_seq(d.fastafile,
15233 * d.samfile.header.target_name[d.tid],
15235 __pyx_v_d->tid = __pyx_v_b->core.tid;
15237 /* "csamtools.pyx":1570
15238 * if d.seq != NULL: free(d.seq)
15239 * d.tid = b.core.tid
15240 * d.seq = faidx_fetch_seq(d.fastafile, # <<<<<<<<<<<<<<
15241 * d.samfile.header.target_name[d.tid],
15244 __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));
15246 /* "csamtools.pyx":1574
15249 * if d.seq == NULL: # <<<<<<<<<<<<<<
15250 * raise ValueError( "reference sequence for '%s' (tid=%i) not found" % \
15251 * (d.samfile.header.target_name[d.tid],
15253 __pyx_t_3 = (__pyx_v_d->seq == NULL);
15256 /* "csamtools.pyx":1576
15257 * if d.seq == NULL:
15258 * raise ValueError( "reference sequence for '%s' (tid=%i) not found" % \
15259 * (d.samfile.header.target_name[d.tid], # <<<<<<<<<<<<<<
15263 __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 = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15264 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
15266 /* "csamtools.pyx":1577
15267 * raise ValueError( "reference sequence for '%s' (tid=%i) not found" % \
15268 * (d.samfile.header.target_name[d.tid],
15269 * d.tid)) # <<<<<<<<<<<<<<
15273 __pyx_t_5 = PyInt_FromLong(__pyx_v_d->tid); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15274 __Pyx_GOTREF(__pyx_t_5);
15275 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15276 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
15277 PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4));
15278 __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
15279 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
15280 __Pyx_GIVEREF(__pyx_t_5);
15283 __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_113), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15284 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
15285 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
15286 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15287 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
15288 PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
15289 __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
15291 __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 = 1575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15292 __Pyx_GOTREF(__pyx_t_5);
15293 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
15294 __Pyx_Raise(__pyx_t_5, 0, 0);
15295 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
15296 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15304 /* "csamtools.pyx":1580
15307 * while ret >= 0: # <<<<<<<<<<<<<<
15312 __pyx_t_3 = (__pyx_v_ret >= 0);
15313 if (!__pyx_t_3) break;
15315 /* "csamtools.pyx":1582
15318 * skip = 0 # <<<<<<<<<<<<<<
15320 * # realign read - changes base qualities
15324 /* "csamtools.pyx":1585
15326 * # realign read - changes base qualities
15327 * if d.seq != NULL and is_cns and not is_nobaq: bam_prob_realn( b, d.seq ) # <<<<<<<<<<<<<<
15329 * if d.seq != NULL and capQ_thres > 10:
15331 __pyx_t_3 = (__pyx_v_d->seq != NULL);
15333 if (__pyx_v_is_cns) {
15334 __pyx_t_1 = (!__pyx_v_is_nobaq);
15335 __pyx_t_2 = __pyx_t_1;
15337 __pyx_t_2 = __pyx_v_is_cns;
15339 __pyx_t_1 = __pyx_t_2;
15341 __pyx_t_1 = __pyx_t_3;
15344 bam_prob_realn(__pyx_v_b, __pyx_v_d->seq);
15349 /* "csamtools.pyx":1587
15350 * if d.seq != NULL and is_cns and not is_nobaq: bam_prob_realn( b, d.seq )
15352 * if d.seq != NULL and capQ_thres > 10: # <<<<<<<<<<<<<<
15353 * q = bam_cap_mapQ(b, d.seq, capQ_thres)
15354 * if q < 0: skip = 1
15356 __pyx_t_1 = (__pyx_v_d->seq != NULL);
15358 __pyx_t_3 = (__pyx_v_capQ_thres > 10);
15359 __pyx_t_2 = __pyx_t_3;
15361 __pyx_t_2 = __pyx_t_1;
15365 /* "csamtools.pyx":1588
15367 * if d.seq != NULL and capQ_thres > 10:
15368 * q = bam_cap_mapQ(b, d.seq, capQ_thres) # <<<<<<<<<<<<<<
15369 * if q < 0: skip = 1
15370 * elif b.core.qual > q: b.core.qual = q
15372 __pyx_v_q = bam_cap_mapQ(__pyx_v_b, __pyx_v_d->seq, __pyx_v_capQ_thres);
15374 /* "csamtools.pyx":1589
15375 * if d.seq != NULL and capQ_thres > 10:
15376 * q = bam_cap_mapQ(b, d.seq, capQ_thres)
15377 * if q < 0: skip = 1 # <<<<<<<<<<<<<<
15378 * elif b.core.qual > q: b.core.qual = q
15379 * if b.core.flag & BAM_FUNMAP: skip = 1
15381 __pyx_t_2 = (__pyx_v_q < 0);
15387 /* "csamtools.pyx":1590
15388 * q = bam_cap_mapQ(b, d.seq, capQ_thres)
15389 * if q < 0: skip = 1
15390 * elif b.core.qual > q: b.core.qual = q # <<<<<<<<<<<<<<
15391 * if b.core.flag & BAM_FUNMAP: skip = 1
15392 * elif b.core.flag & 1 and not b.core.flag & 2: skip = 1
15394 __pyx_t_2 = (__pyx_v_b->core.qual > __pyx_v_q);
15396 __pyx_v_b->core.qual = __pyx_v_q;
15404 /* "csamtools.pyx":1591
15405 * if q < 0: skip = 1
15406 * elif b.core.qual > q: b.core.qual = q
15407 * if b.core.flag & BAM_FUNMAP: skip = 1 # <<<<<<<<<<<<<<
15408 * elif b.core.flag & 1 and not b.core.flag & 2: skip = 1
15411 __pyx_t_7 = (__pyx_v_b->core.flag & 4);
15417 /* "csamtools.pyx":1592
15418 * elif b.core.qual > q: b.core.qual = q
15419 * if b.core.flag & BAM_FUNMAP: skip = 1
15420 * elif b.core.flag & 1 and not b.core.flag & 2: skip = 1 # <<<<<<<<<<<<<<
15422 * if not skip: break
15424 if ((__pyx_v_b->core.flag & 1)) {
15425 __pyx_t_2 = (!(__pyx_v_b->core.flag & 2));
15426 __pyx_t_1 = __pyx_t_2;
15428 __pyx_t_1 = (__pyx_v_b->core.flag & 1);
15436 /* "csamtools.pyx":1594
15437 * elif b.core.flag & 1 and not b.core.flag & 2: skip = 1
15439 * if not skip: break # <<<<<<<<<<<<<<
15440 * # additional filters
15443 __pyx_t_1 = (!__pyx_v_skip);
15445 goto __pyx_L7_break;
15450 /* "csamtools.pyx":1597
15451 * # additional filters
15453 * ret = bam_iter_read( d.samfile.x.bam, d.iter, b ) # <<<<<<<<<<<<<<
15457 __pyx_v_ret = bam_iter_read(__pyx_v_d->samfile->x.bam, __pyx_v_d->iter, __pyx_v_b);
15461 /* "csamtools.pyx":1599
15462 * ret = bam_iter_read( d.samfile.x.bam, d.iter, b )
15464 * return ret # <<<<<<<<<<<<<<
15466 * cdef class IteratorColumn:
15468 __pyx_r = __pyx_v_ret;
15474 __Pyx_XDECREF(__pyx_t_4);
15475 __Pyx_XDECREF(__pyx_t_5);
15476 __Pyx_XDECREF(__pyx_t_6);
15477 __Pyx_WriteUnraisable("csamtools.__advance_snpcalls");
15480 __Pyx_TraceReturn(Py_None);
15481 __Pyx_RefNannyFinishContext();
15485 /* "csamtools.pyx":1659
15486 * cdef int max_depth
15488 * def __cinit__( self, Samfile samfile, **kwargs ): # <<<<<<<<<<<<<<
15489 * self.samfile = samfile
15490 * self.mask = kwargs.get("mask", BAM_DEF_MASK )
15493 static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15494 static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15495 struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
15496 PyObject *__pyx_v_kwargs = 0;
15498 PyObject *__pyx_t_1 = NULL;
15499 PyObject *__pyx_t_2 = NULL;
15501 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0};
15502 __Pyx_TraceDeclarations
15503 __Pyx_RefNannySetupContext("__cinit__");
15504 __Pyx_TraceCall("__cinit__", __pyx_f[0], 1659);
15505 __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
15506 __Pyx_GOTREF(__pyx_v_kwargs);
15507 if (unlikely(__pyx_kwds)) {
15508 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
15509 PyObject* values[1] = {0};
15510 switch (PyTuple_GET_SIZE(__pyx_args)) {
15511 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15513 default: goto __pyx_L5_argtuple_error;
15515 switch (PyTuple_GET_SIZE(__pyx_args)) {
15517 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
15518 if (likely(values[0])) kw_args--;
15519 else goto __pyx_L5_argtuple_error;
15521 if (unlikely(kw_args > 0)) {
15522 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15524 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
15525 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
15526 goto __pyx_L5_argtuple_error;
15528 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0));
15530 goto __pyx_L4_argument_unpacking_done;
15531 __pyx_L5_argtuple_error:;
15532 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
15534 __Pyx_DECREF(__pyx_v_kwargs);
15535 __Pyx_AddTraceback("csamtools.IteratorColumn.__cinit__");
15536 __Pyx_RefNannyFinishContext();
15538 __pyx_L4_argument_unpacking_done:;
15539 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15541 /* "csamtools.pyx":1660
15543 * def __cinit__( self, Samfile samfile, **kwargs ):
15544 * self.samfile = samfile # <<<<<<<<<<<<<<
15545 * self.mask = kwargs.get("mask", BAM_DEF_MASK )
15546 * self.fastafile = kwargs.get( "fastafile", None )
15548 __Pyx_INCREF(((PyObject *)__pyx_v_samfile));
15549 __Pyx_GIVEREF(((PyObject *)__pyx_v_samfile));
15550 __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->samfile);
15551 __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->samfile));
15552 ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->samfile = __pyx_v_samfile;
15554 /* "csamtools.pyx":1661
15555 * def __cinit__( self, Samfile samfile, **kwargs ):
15556 * self.samfile = samfile
15557 * self.mask = kwargs.get("mask", BAM_DEF_MASK ) # <<<<<<<<<<<<<<
15558 * self.fastafile = kwargs.get( "fastafile", None )
15559 * self.stepper = kwargs.get( "stepper", None )
15561 if (unlikely(__pyx_v_kwargs == Py_None)) {
15562 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15564 __pyx_t_1 = PyInt_FromLong(BAM_DEF_MASK); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15565 __Pyx_GOTREF(__pyx_t_1);
15566 __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 = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15567 __Pyx_GOTREF(__pyx_t_2);
15568 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15569 __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 = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15570 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15571 ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->mask = __pyx_t_3;
15573 /* "csamtools.pyx":1662
15574 * self.samfile = samfile
15575 * self.mask = kwargs.get("mask", BAM_DEF_MASK )
15576 * self.fastafile = kwargs.get( "fastafile", None ) # <<<<<<<<<<<<<<
15577 * self.stepper = kwargs.get( "stepper", None )
15578 * self.max_depth = kwargs.get( "max_depth", 8000 )
15580 if (unlikely(__pyx_v_kwargs == Py_None)) {
15581 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15583 __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 = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15584 __Pyx_GOTREF(__pyx_t_2);
15585 if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9csamtools_Fastafile))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15586 __Pyx_GIVEREF(__pyx_t_2);
15587 __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile);
15588 __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile));
15589 ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_t_2);
15592 /* "csamtools.pyx":1663
15593 * self.mask = kwargs.get("mask", BAM_DEF_MASK )
15594 * self.fastafile = kwargs.get( "fastafile", None )
15595 * self.stepper = kwargs.get( "stepper", None ) # <<<<<<<<<<<<<<
15596 * self.max_depth = kwargs.get( "max_depth", 8000 )
15597 * self.iterdata.seq = NULL
15599 if (unlikely(__pyx_v_kwargs == Py_None)) {
15600 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15602 __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 = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15603 __Pyx_GOTREF(__pyx_t_2);
15604 __Pyx_GIVEREF(__pyx_t_2);
15605 __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->stepper);
15606 __Pyx_DECREF(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->stepper);
15607 ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->stepper = __pyx_t_2;
15610 /* "csamtools.pyx":1664
15611 * self.fastafile = kwargs.get( "fastafile", None )
15612 * self.stepper = kwargs.get( "stepper", None )
15613 * self.max_depth = kwargs.get( "max_depth", 8000 ) # <<<<<<<<<<<<<<
15614 * self.iterdata.seq = NULL
15617 if (unlikely(__pyx_v_kwargs == Py_None)) {
15618 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15620 __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 = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15621 __Pyx_GOTREF(__pyx_t_2);
15622 __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 = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15623 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15624 ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->max_depth = __pyx_t_3;
15626 /* "csamtools.pyx":1665
15627 * self.stepper = kwargs.get( "stepper", None )
15628 * self.max_depth = kwargs.get( "max_depth", 8000 )
15629 * self.iterdata.seq = NULL # <<<<<<<<<<<<<<
15633 ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq = NULL;
15635 /* "csamtools.pyx":1666
15636 * self.max_depth = kwargs.get( "max_depth", 8000 )
15637 * self.iterdata.seq = NULL
15638 * self.tid = 0 # <<<<<<<<<<<<<<
15642 ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->tid = 0;
15644 /* "csamtools.pyx":1667
15645 * self.iterdata.seq = NULL
15647 * self.pos = 0 # <<<<<<<<<<<<<<
15651 ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pos = 0;
15653 /* "csamtools.pyx":1668
15656 * self.n_plp = 0 # <<<<<<<<<<<<<<
15658 * self.pileup_iter = <bam_plp_t>NULL
15660 ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->n_plp = 0;
15662 /* "csamtools.pyx":1669
15665 * self.plp = NULL # <<<<<<<<<<<<<<
15666 * self.pileup_iter = <bam_plp_t>NULL
15669 ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->plp = NULL;
15671 /* "csamtools.pyx":1670
15674 * self.pileup_iter = <bam_plp_t>NULL # <<<<<<<<<<<<<<
15678 ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter = ((bam_plp_t)NULL);
15683 __Pyx_XDECREF(__pyx_t_1);
15684 __Pyx_XDECREF(__pyx_t_2);
15685 __Pyx_AddTraceback("csamtools.IteratorColumn.__cinit__");
15688 __Pyx_DECREF(__pyx_v_kwargs);
15689 __Pyx_TraceReturn(Py_None);
15690 __Pyx_RefNannyFinishContext();
15694 /* "csamtools.pyx":1673
15697 * def __iter__(self): # <<<<<<<<<<<<<<
15702 static PyObject *__pyx_pf_9csamtools_14IteratorColumn_1__iter__(PyObject *__pyx_v_self); /*proto*/
15703 static PyObject *__pyx_pf_9csamtools_14IteratorColumn_1__iter__(PyObject *__pyx_v_self) {
15704 PyObject *__pyx_r = NULL;
15705 __Pyx_TraceDeclarations
15706 __Pyx_RefNannySetupContext("__iter__");
15707 __Pyx_TraceCall("__iter__", __pyx_f[0], 1673);
15709 /* "csamtools.pyx":1674
15711 * def __iter__(self):
15712 * return self # <<<<<<<<<<<<<<
15714 * cdef int cnext(self):
15716 __Pyx_XDECREF(__pyx_r);
15717 __Pyx_INCREF(__pyx_v_self);
15718 __pyx_r = __pyx_v_self;
15721 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15723 __Pyx_XGIVEREF(__pyx_r);
15724 __Pyx_TraceReturn(__pyx_r);
15725 __Pyx_RefNannyFinishContext();
15729 /* "csamtools.pyx":1676
15732 * cdef int cnext(self): # <<<<<<<<<<<<<<
15733 * '''perform next iteration.
15737 static int __pyx_f_9csamtools_14IteratorColumn_cnext(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self) {
15739 __Pyx_TraceDeclarations
15740 __Pyx_RefNannySetupContext("cnext");
15741 __Pyx_TraceCall("cnext", __pyx_f[0], 1676);
15743 /* "csamtools.pyx":1682
15744 * It has been re-implemented to permit for filtering.
15746 * self.plp = bam_plp_auto( self.pileup_iter, # <<<<<<<<<<<<<<
15750 __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));
15753 __Pyx_TraceReturn(Py_None);
15754 __Pyx_RefNannyFinishContext();
15758 /* "csamtools.pyx":1687
15761 * cdef char * getSequence( self ): # <<<<<<<<<<<<<<
15762 * '''return current reference sequence underlying the iterator.
15766 static char *__pyx_f_9csamtools_14IteratorColumn_getSequence(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self) {
15768 __Pyx_TraceDeclarations
15769 __Pyx_RefNannySetupContext("getSequence");
15770 __Pyx_TraceCall("getSequence", __pyx_f[0], 1687);
15772 /* "csamtools.pyx":1690
15773 * '''return current reference sequence underlying the iterator.
15775 * return self.iterdata.seq # <<<<<<<<<<<<<<
15777 * property seq_len:
15779 __pyx_r = __pyx_v_self->iterdata.seq;
15784 __Pyx_TraceReturn(Py_None);
15785 __Pyx_RefNannyFinishContext();
15789 /* "csamtools.pyx":1694
15790 * property seq_len:
15791 * '''current sequence length.'''
15792 * def __get__(self): return self.iterdata.seq_len # <<<<<<<<<<<<<<
15794 * def addReference( self, Fastafile fastafile ):
15797 static PyObject *__pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(PyObject *__pyx_v_self); /*proto*/
15798 static PyObject *__pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(PyObject *__pyx_v_self) {
15799 PyObject *__pyx_r = NULL;
15800 PyObject *__pyx_t_1 = NULL;
15801 __Pyx_TraceDeclarations
15802 __Pyx_RefNannySetupContext("__get__");
15803 __Pyx_TraceCall("__get__", __pyx_f[0], 1694);
15804 __Pyx_XDECREF(__pyx_r);
15805 __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15806 __Pyx_GOTREF(__pyx_t_1);
15807 __pyx_r = __pyx_t_1;
15811 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15814 __Pyx_XDECREF(__pyx_t_1);
15815 __Pyx_AddTraceback("csamtools.IteratorColumn.seq_len.__get__");
15818 __Pyx_XGIVEREF(__pyx_r);
15819 __Pyx_TraceReturn(__pyx_r);
15820 __Pyx_RefNannyFinishContext();
15824 /* "csamtools.pyx":1696
15825 * def __get__(self): return self.iterdata.seq_len
15827 * def addReference( self, Fastafile fastafile ): # <<<<<<<<<<<<<<
15829 * add reference sequences in *fastafile* to iterator.'''
15832 static PyObject *__pyx_pf_9csamtools_14IteratorColumn_2addReference(PyObject *__pyx_v_self, PyObject *__pyx_v_fastafile); /*proto*/
15833 static char __pyx_doc_9csamtools_14IteratorColumn_2addReference[] = "IteratorColumn.addReference(self, Fastafile fastafile)\n\n add reference sequences in *fastafile* to iterator.";
15834 static PyObject *__pyx_pf_9csamtools_14IteratorColumn_2addReference(PyObject *__pyx_v_self, PyObject *__pyx_v_fastafile) {
15835 PyObject *__pyx_r = NULL;
15837 __Pyx_TraceDeclarations
15838 __Pyx_RefNannySetupContext("addReference");
15839 __Pyx_TraceCall("addReference", __pyx_f[0], 1696);
15840 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fastafile), __pyx_ptype_9csamtools_Fastafile, 1, "fastafile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15842 /* "csamtools.pyx":1699
15844 * add reference sequences in *fastafile* to iterator.'''
15845 * self.fastafile = fastafile # <<<<<<<<<<<<<<
15846 * if self.iterdata.seq != NULL: free(self.iterdata.seq)
15847 * self.iterdata.tid = -1
15849 __Pyx_INCREF(__pyx_v_fastafile);
15850 __Pyx_GIVEREF(__pyx_v_fastafile);
15851 __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile);
15852 __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile));
15853 ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_fastafile);
15855 /* "csamtools.pyx":1700
15856 * add reference sequences in *fastafile* to iterator.'''
15857 * self.fastafile = fastafile
15858 * if self.iterdata.seq != NULL: free(self.iterdata.seq) # <<<<<<<<<<<<<<
15859 * self.iterdata.tid = -1
15860 * self.iterdata.fastafile = self.fastafile.fastafile
15862 __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq != NULL);
15864 free(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq);
15869 /* "csamtools.pyx":1701
15870 * self.fastafile = fastafile
15871 * if self.iterdata.seq != NULL: free(self.iterdata.seq)
15872 * self.iterdata.tid = -1 # <<<<<<<<<<<<<<
15873 * self.iterdata.fastafile = self.fastafile.fastafile
15876 ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.tid = -1;
15878 /* "csamtools.pyx":1702
15879 * if self.iterdata.seq != NULL: free(self.iterdata.seq)
15880 * self.iterdata.tid = -1
15881 * self.iterdata.fastafile = self.fastafile.fastafile # <<<<<<<<<<<<<<
15883 * def hasReference( self ):
15885 ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.fastafile = ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile->fastafile;
15887 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15890 __Pyx_AddTraceback("csamtools.IteratorColumn.addReference");
15893 __Pyx_XGIVEREF(__pyx_r);
15894 __Pyx_TraceReturn(__pyx_r);
15895 __Pyx_RefNannyFinishContext();
15899 /* "csamtools.pyx":1704
15900 * self.iterdata.fastafile = self.fastafile.fastafile
15902 * def hasReference( self ): # <<<<<<<<<<<<<<
15904 * return true if iterator is associated with a reference'''
15907 static PyObject *__pyx_pf_9csamtools_14IteratorColumn_3hasReference(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
15908 static char __pyx_doc_9csamtools_14IteratorColumn_3hasReference[] = "IteratorColumn.hasReference(self)\n\n return true if iterator is associated with a reference";
15909 static PyObject *__pyx_pf_9csamtools_14IteratorColumn_3hasReference(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
15910 PyObject *__pyx_r = NULL;
15911 __Pyx_TraceDeclarations
15912 __Pyx_RefNannySetupContext("hasReference");
15913 __Pyx_TraceCall("hasReference", __pyx_f[0], 1704);
15915 /* "csamtools.pyx":1707
15917 * return true if iterator is associated with a reference'''
15918 * return self.fastafile # <<<<<<<<<<<<<<
15920 * cdef setMask( self, mask ):
15922 __Pyx_XDECREF(__pyx_r);
15923 __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile));
15924 __pyx_r = ((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile);
15927 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15929 __Pyx_XGIVEREF(__pyx_r);
15930 __Pyx_TraceReturn(__pyx_r);
15931 __Pyx_RefNannyFinishContext();
15935 /* "csamtools.pyx":1709
15936 * return self.fastafile
15938 * cdef setMask( self, mask ): # <<<<<<<<<<<<<<
15939 * '''set masking flag in iterator.
15943 static PyObject *__pyx_f_9csamtools_14IteratorColumn_setMask(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self, PyObject *__pyx_v_mask) {
15944 PyObject *__pyx_r = NULL;
15946 __Pyx_TraceDeclarations
15947 __Pyx_RefNannySetupContext("setMask");
15948 __Pyx_TraceCall("setMask", __pyx_f[0], 1709);
15950 /* "csamtools.pyx":1714
15951 * reads with bits set in *mask* will be skipped.
15953 * self.mask = mask # <<<<<<<<<<<<<<
15954 * bam_plp_set_mask( self.pileup_iter, self.mask )
15957 __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 = 1714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
15958 __pyx_v_self->mask = __pyx_t_1;
15960 /* "csamtools.pyx":1715
15963 * bam_plp_set_mask( self.pileup_iter, self.mask ) # <<<<<<<<<<<<<<
15965 * cdef setupIteratorData( self,
15967 bam_plp_set_mask(__pyx_v_self->pileup_iter, __pyx_v_self->mask);
15969 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15972 __Pyx_AddTraceback("csamtools.IteratorColumn.setMask");
15975 __Pyx_XGIVEREF(__pyx_r);
15976 __Pyx_TraceReturn(__pyx_r);
15977 __Pyx_RefNannyFinishContext();
15981 /* "csamtools.pyx":1717
15982 * bam_plp_set_mask( self.pileup_iter, self.mask )
15984 * cdef setupIteratorData( self, # <<<<<<<<<<<<<<
15989 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) {
15990 int __pyx_v_reopen = ((int)0);
15991 PyObject *__pyx_r = NULL;
15992 PyObject *__pyx_t_1 = NULL;
15993 PyObject *__pyx_t_2 = NULL;
15994 PyObject *__pyx_t_3 = NULL;
15995 PyObject *__pyx_t_4 = NULL;
15996 PyObject *__pyx_t_5 = NULL;
16000 __Pyx_TraceDeclarations
16001 __Pyx_RefNannySetupContext("setupIteratorData");
16002 __Pyx_TraceCall("setupIteratorData", __pyx_f[0], 1717);
16003 if (__pyx_optional_args) {
16004 if (__pyx_optional_args->__pyx_n > 0) {
16005 __pyx_v_reopen = __pyx_optional_args->reopen;
16009 /* "csamtools.pyx":1724
16010 * '''setup the iterator structure'''
16012 * self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen ) # <<<<<<<<<<<<<<
16013 * self.iterdata.samfile = self.samfile.samfile
16014 * self.iterdata.iter = self.iter.iter
16016 __pyx_t_1 = PyInt_FromLong(__pyx_v_tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16017 __Pyx_GOTREF(__pyx_t_1);
16018 __pyx_t_2 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16019 __Pyx_GOTREF(__pyx_t_2);
16020 __pyx_t_3 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16021 __Pyx_GOTREF(__pyx_t_3);
16022 __pyx_t_4 = PyInt_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16023 __Pyx_GOTREF(__pyx_t_4);
16024 __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16025 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
16026 __Pyx_INCREF(((PyObject *)__pyx_v_self->samfile));
16027 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self->samfile));
16028 __Pyx_GIVEREF(((PyObject *)__pyx_v_self->samfile));
16029 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
16030 __Pyx_GIVEREF(__pyx_t_1);
16031 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_2);
16032 __Pyx_GIVEREF(__pyx_t_2);
16033 PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_3);
16034 __Pyx_GIVEREF(__pyx_t_3);
16035 PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_4);
16036 __Pyx_GIVEREF(__pyx_t_4);
16041 __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 = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16042 __Pyx_GOTREF(__pyx_t_4);
16043 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
16044 __Pyx_GIVEREF(__pyx_t_4);
16045 __Pyx_GOTREF(__pyx_v_self->iter);
16046 __Pyx_DECREF(((PyObject *)__pyx_v_self->iter));
16047 __pyx_v_self->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_t_4);
16050 /* "csamtools.pyx":1725
16052 * self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen )
16053 * self.iterdata.samfile = self.samfile.samfile # <<<<<<<<<<<<<<
16054 * self.iterdata.iter = self.iter.iter
16055 * self.iterdata.seq = NULL
16057 __pyx_v_self->iterdata.samfile = __pyx_v_self->samfile->samfile;
16059 /* "csamtools.pyx":1726
16060 * self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen )
16061 * self.iterdata.samfile = self.samfile.samfile
16062 * self.iterdata.iter = self.iter.iter # <<<<<<<<<<<<<<
16063 * self.iterdata.seq = NULL
16064 * self.iterdata.tid = -1
16066 __pyx_v_self->iterdata.iter = __pyx_v_self->iter->iter;
16068 /* "csamtools.pyx":1727
16069 * self.iterdata.samfile = self.samfile.samfile
16070 * self.iterdata.iter = self.iter.iter
16071 * self.iterdata.seq = NULL # <<<<<<<<<<<<<<
16072 * self.iterdata.tid = -1
16075 __pyx_v_self->iterdata.seq = NULL;
16077 /* "csamtools.pyx":1728
16078 * self.iterdata.iter = self.iter.iter
16079 * self.iterdata.seq = NULL
16080 * self.iterdata.tid = -1 # <<<<<<<<<<<<<<
16082 * if self.fastafile != None:
16084 __pyx_v_self->iterdata.tid = -1;
16086 /* "csamtools.pyx":1730
16087 * self.iterdata.tid = -1
16089 * if self.fastafile != None: # <<<<<<<<<<<<<<
16090 * self.iterdata.fastafile = self.fastafile.fastafile
16093 __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 = 1730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16094 __Pyx_GOTREF(__pyx_t_4);
16095 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16096 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16099 /* "csamtools.pyx":1731
16101 * if self.fastafile != None:
16102 * self.iterdata.fastafile = self.fastafile.fastafile # <<<<<<<<<<<<<<
16104 * self.iterdata.fastafile = NULL
16106 __pyx_v_self->iterdata.fastafile = __pyx_v_self->fastafile->fastafile;
16111 /* "csamtools.pyx":1733
16112 * self.iterdata.fastafile = self.fastafile.fastafile
16114 * self.iterdata.fastafile = NULL # <<<<<<<<<<<<<<
16116 * if self.stepper == None or self.stepper == "all":
16118 __pyx_v_self->iterdata.fastafile = NULL;
16122 /* "csamtools.pyx":1735
16123 * self.iterdata.fastafile = NULL
16125 * if self.stepper == None or self.stepper == "all": # <<<<<<<<<<<<<<
16126 * self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata )
16127 * elif self.stepper == "samtools":
16129 __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 = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16130 __Pyx_GOTREF(__pyx_t_4);
16131 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16132 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16134 __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->stepper, ((PyObject *)__pyx_n_s__all), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16135 __Pyx_GOTREF(__pyx_t_4);
16136 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16137 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16138 __pyx_t_8 = __pyx_t_7;
16140 __pyx_t_8 = __pyx_t_6;
16144 /* "csamtools.pyx":1736
16146 * if self.stepper == None or self.stepper == "all":
16147 * self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata ) # <<<<<<<<<<<<<<
16148 * elif self.stepper == "samtools":
16149 * self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata )
16151 __pyx_v_self->pileup_iter = bam_plp_init((&__pyx_f_9csamtools___advance_all), (&__pyx_v_self->iterdata));
16155 /* "csamtools.pyx":1737
16156 * if self.stepper == None or self.stepper == "all":
16157 * self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata )
16158 * elif self.stepper == "samtools": # <<<<<<<<<<<<<<
16159 * self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata )
16162 __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->stepper, ((PyObject *)__pyx_n_s__samtools), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16163 __Pyx_GOTREF(__pyx_t_4);
16164 __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16165 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16168 /* "csamtools.pyx":1738
16169 * self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata )
16170 * elif self.stepper == "samtools":
16171 * self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata ) # <<<<<<<<<<<<<<
16173 * raise ValueError( "unknown stepper option `%s` in IteratorColumn" % self.stepper)
16175 __pyx_v_self->pileup_iter = bam_plp_init((&__pyx_f_9csamtools___advance_snpcalls), (&__pyx_v_self->iterdata));
16180 /* "csamtools.pyx":1740
16181 * self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata )
16183 * raise ValueError( "unknown stepper option `%s` in IteratorColumn" % self.stepper) # <<<<<<<<<<<<<<
16185 * if self.max_depth:
16187 __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_114), __pyx_v_self->stepper); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16188 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
16189 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16190 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
16191 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
16192 __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
16194 __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 = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16195 __Pyx_GOTREF(__pyx_t_4);
16196 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
16197 __Pyx_Raise(__pyx_t_4, 0, 0);
16198 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16199 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16203 /* "csamtools.pyx":1742
16204 * raise ValueError( "unknown stepper option `%s` in IteratorColumn" % self.stepper)
16206 * if self.max_depth: # <<<<<<<<<<<<<<
16207 * bam_plp_set_maxcnt( self.pileup_iter, self.max_depth )
16210 if (__pyx_v_self->max_depth) {
16212 /* "csamtools.pyx":1743
16214 * if self.max_depth:
16215 * bam_plp_set_maxcnt( self.pileup_iter, self.max_depth ) # <<<<<<<<<<<<<<
16217 * bam_plp_set_mask( self.pileup_iter, self.mask )
16219 bam_plp_set_maxcnt(__pyx_v_self->pileup_iter, __pyx_v_self->max_depth);
16224 /* "csamtools.pyx":1745
16225 * bam_plp_set_maxcnt( self.pileup_iter, self.max_depth )
16227 * bam_plp_set_mask( self.pileup_iter, self.mask ) # <<<<<<<<<<<<<<
16229 * cdef reset( self, tid, start, end ):
16231 bam_plp_set_mask(__pyx_v_self->pileup_iter, __pyx_v_self->mask);
16233 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16236 __Pyx_XDECREF(__pyx_t_1);
16237 __Pyx_XDECREF(__pyx_t_2);
16238 __Pyx_XDECREF(__pyx_t_3);
16239 __Pyx_XDECREF(__pyx_t_4);
16240 __Pyx_XDECREF(__pyx_t_5);
16241 __Pyx_AddTraceback("csamtools.IteratorColumn.setupIteratorData");
16244 __Pyx_XGIVEREF(__pyx_r);
16245 __Pyx_TraceReturn(__pyx_r);
16246 __Pyx_RefNannyFinishContext();
16250 /* "csamtools.pyx":1747
16251 * bam_plp_set_mask( self.pileup_iter, self.mask )
16253 * cdef reset( self, tid, start, end ): # <<<<<<<<<<<<<<
16254 * '''reset iterator position.
16258 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) {
16259 PyObject *__pyx_r = NULL;
16260 PyObject *__pyx_t_1 = NULL;
16261 PyObject *__pyx_t_2 = NULL;
16262 PyObject *__pyx_t_3 = NULL;
16264 __Pyx_TraceDeclarations
16265 __Pyx_RefNannySetupContext("reset");
16266 __Pyx_TraceCall("reset", __pyx_f[0], 1747);
16268 /* "csamtools.pyx":1753
16269 * having to incur the full set-up costs.
16271 * self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen = 0 ) # <<<<<<<<<<<<<<
16272 * self.iterdata.iter = self.iter.iter
16275 __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16276 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
16277 __Pyx_INCREF(((PyObject *)__pyx_v_self->samfile));
16278 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->samfile));
16279 __Pyx_GIVEREF(((PyObject *)__pyx_v_self->samfile));
16280 __Pyx_INCREF(__pyx_v_tid);
16281 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_tid);
16282 __Pyx_GIVEREF(__pyx_v_tid);
16283 __Pyx_INCREF(__pyx_v_start);
16284 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_start);
16285 __Pyx_GIVEREF(__pyx_v_start);
16286 __Pyx_INCREF(__pyx_v_end);
16287 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_end);
16288 __Pyx_GIVEREF(__pyx_v_end);
16289 __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16290 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
16291 if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reopen), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16292 __pyx_t_3 = PyEval_CallObjectWithKeywords(((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 = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16293 __Pyx_GOTREF(__pyx_t_3);
16294 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
16295 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
16296 __Pyx_GIVEREF(__pyx_t_3);
16297 __Pyx_GOTREF(__pyx_v_self->iter);
16298 __Pyx_DECREF(((PyObject *)__pyx_v_self->iter));
16299 __pyx_v_self->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_t_3);
16302 /* "csamtools.pyx":1754
16304 * self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen = 0 )
16305 * self.iterdata.iter = self.iter.iter # <<<<<<<<<<<<<<
16307 * # invalidate sequence if different tid
16309 __pyx_v_self->iterdata.iter = __pyx_v_self->iter->iter;
16311 /* "csamtools.pyx":1757
16313 * # invalidate sequence if different tid
16314 * if self.tid != tid: # <<<<<<<<<<<<<<
16315 * if self.iterdata.seq != NULL: free( self.iterdata.seq )
16316 * self.iterdata.seq = NULL
16318 __pyx_t_3 = PyInt_FromLong(__pyx_v_self->tid); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16319 __Pyx_GOTREF(__pyx_t_3);
16320 __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 = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16321 __Pyx_GOTREF(__pyx_t_2);
16322 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16323 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16324 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16327 /* "csamtools.pyx":1758
16328 * # invalidate sequence if different tid
16329 * if self.tid != tid:
16330 * if self.iterdata.seq != NULL: free( self.iterdata.seq ) # <<<<<<<<<<<<<<
16331 * self.iterdata.seq = NULL
16332 * self.iterdata.tid = -1
16334 __pyx_t_4 = (__pyx_v_self->iterdata.seq != NULL);
16336 free(__pyx_v_self->iterdata.seq);
16341 /* "csamtools.pyx":1759
16342 * if self.tid != tid:
16343 * if self.iterdata.seq != NULL: free( self.iterdata.seq )
16344 * self.iterdata.seq = NULL # <<<<<<<<<<<<<<
16345 * self.iterdata.tid = -1
16348 __pyx_v_self->iterdata.seq = NULL;
16350 /* "csamtools.pyx":1760
16351 * if self.iterdata.seq != NULL: free( self.iterdata.seq )
16352 * self.iterdata.seq = NULL
16353 * self.iterdata.tid = -1 # <<<<<<<<<<<<<<
16355 * # self.pileup_iter = bam_plp_init( &__advancepileup, &self.iterdata )
16357 __pyx_v_self->iterdata.tid = -1;
16362 /* "csamtools.pyx":1763
16364 * # self.pileup_iter = bam_plp_init( &__advancepileup, &self.iterdata )
16365 * bam_plp_reset(self.pileup_iter) # <<<<<<<<<<<<<<
16367 * def __dealloc__(self):
16369 bam_plp_reset(__pyx_v_self->pileup_iter);
16371 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16374 __Pyx_XDECREF(__pyx_t_1);
16375 __Pyx_XDECREF(__pyx_t_2);
16376 __Pyx_XDECREF(__pyx_t_3);
16377 __Pyx_AddTraceback("csamtools.IteratorColumn.reset");
16380 __Pyx_XGIVEREF(__pyx_r);
16381 __Pyx_TraceReturn(__pyx_r);
16382 __Pyx_RefNannyFinishContext();
16386 /* "csamtools.pyx":1765
16387 * bam_plp_reset(self.pileup_iter)
16389 * def __dealloc__(self): # <<<<<<<<<<<<<<
16390 * # reset in order to avoid memory leak messages for iterators that have
16391 * # not been fully consumed
16394 static void __pyx_pf_9csamtools_14IteratorColumn_4__dealloc__(PyObject *__pyx_v_self); /*proto*/
16395 static void __pyx_pf_9csamtools_14IteratorColumn_4__dealloc__(PyObject *__pyx_v_self) {
16397 __Pyx_TraceDeclarations
16398 __Pyx_RefNannySetupContext("__dealloc__");
16399 __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1765);
16401 /* "csamtools.pyx":1768
16402 * # reset in order to avoid memory leak messages for iterators that have
16403 * # not been fully consumed
16404 * if self.pileup_iter != <bam_plp_t>NULL: # <<<<<<<<<<<<<<
16405 * bam_plp_reset(self.pileup_iter)
16406 * bam_plp_destroy(self.pileup_iter)
16408 __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter != ((bam_plp_t)NULL));
16411 /* "csamtools.pyx":1769
16412 * # not been fully consumed
16413 * if self.pileup_iter != <bam_plp_t>NULL:
16414 * bam_plp_reset(self.pileup_iter) # <<<<<<<<<<<<<<
16415 * bam_plp_destroy(self.pileup_iter)
16416 * self.pileup_iter = <bam_plp_t>NULL
16418 bam_plp_reset(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter);
16420 /* "csamtools.pyx":1770
16421 * if self.pileup_iter != <bam_plp_t>NULL:
16422 * bam_plp_reset(self.pileup_iter)
16423 * bam_plp_destroy(self.pileup_iter) # <<<<<<<<<<<<<<
16424 * self.pileup_iter = <bam_plp_t>NULL
16427 bam_plp_destroy(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter);
16429 /* "csamtools.pyx":1771
16430 * bam_plp_reset(self.pileup_iter)
16431 * bam_plp_destroy(self.pileup_iter)
16432 * self.pileup_iter = <bam_plp_t>NULL # <<<<<<<<<<<<<<
16434 * if self.iterdata.seq != NULL:
16436 ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter = ((bam_plp_t)NULL);
16441 /* "csamtools.pyx":1773
16442 * self.pileup_iter = <bam_plp_t>NULL
16444 * if self.iterdata.seq != NULL: # <<<<<<<<<<<<<<
16445 * free(self.iterdata.seq)
16446 * self.iterdata.seq = NULL
16448 __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq != NULL);
16451 /* "csamtools.pyx":1774
16453 * if self.iterdata.seq != NULL:
16454 * free(self.iterdata.seq) # <<<<<<<<<<<<<<
16455 * self.iterdata.seq = NULL
16458 free(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq);
16460 /* "csamtools.pyx":1775
16461 * if self.iterdata.seq != NULL:
16462 * free(self.iterdata.seq)
16463 * self.iterdata.seq = NULL # <<<<<<<<<<<<<<
16465 * cdef class IteratorColumnRegion(IteratorColumn):
16467 ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq = NULL;
16472 __Pyx_TraceReturn(Py_None);
16473 __Pyx_RefNannyFinishContext();
16476 /* "csamtools.pyx":1780
16477 * '''iterates over a region only.
16479 * def __cinit__(self, Samfile samfile, # <<<<<<<<<<<<<<
16484 static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16485 static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16486 struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
16490 PyObject *__pyx_v_kwargs = 0;
16492 PyObject *__pyx_t_1 = NULL;
16493 struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData __pyx_t_2;
16494 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,0};
16495 __Pyx_TraceDeclarations
16496 __Pyx_RefNannySetupContext("__cinit__");
16497 __Pyx_TraceCall("__cinit__", __pyx_f[0], 1780);
16498 __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
16499 __Pyx_GOTREF(__pyx_v_kwargs);
16500 if (unlikely(__pyx_kwds)) {
16501 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
16502 PyObject* values[4] = {0,0,0,0};
16503 switch (PyTuple_GET_SIZE(__pyx_args)) {
16504 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16505 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16506 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16507 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16509 default: goto __pyx_L5_argtuple_error;
16511 switch (PyTuple_GET_SIZE(__pyx_args)) {
16513 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
16514 if (likely(values[0])) kw_args--;
16515 else goto __pyx_L5_argtuple_error;
16518 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid);
16519 if (value) { values[1] = value; kw_args--; }
16523 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
16524 if (value) { values[2] = value; kw_args--; }
16528 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
16529 if (value) { values[3] = value; kw_args--; }
16532 if (unlikely(kw_args > 0)) {
16533 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16535 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
16537 __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16539 __pyx_v_tid = ((int)0);
16542 __pyx_v_start = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16544 __pyx_v_start = ((int)0);
16547 __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16549 __pyx_v_end = __pyx_k_115;
16552 __pyx_v_tid = ((int)0);
16553 __pyx_v_start = ((int)0);
16554 __pyx_v_end = __pyx_k_115;
16555 switch (PyTuple_GET_SIZE(__pyx_args)) {
16556 case 4: __pyx_v_end = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16557 case 3: __pyx_v_start = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16558 case 2: __pyx_v_tid = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16559 case 1: __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0));
16561 default: goto __pyx_L5_argtuple_error;
16564 goto __pyx_L4_argument_unpacking_done;
16565 __pyx_L5_argtuple_error:;
16566 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16568 __Pyx_DECREF(__pyx_v_kwargs);
16569 __Pyx_AddTraceback("csamtools.IteratorColumnRegion.__cinit__");
16570 __Pyx_RefNannyFinishContext();
16572 __pyx_L4_argument_unpacking_done:;
16573 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16575 /* "csamtools.pyx":1787
16577 * # initialize iterator
16578 * self.setupIteratorData( tid, start, end, 1 ) # <<<<<<<<<<<<<<
16580 * def __next__(self):
16582 __pyx_t_2.__pyx_n = 1;
16583 __pyx_t_2.reopen = 1;
16584 __pyx_t_1 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion *)((struct __pyx_obj_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 = 1787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16585 __Pyx_GOTREF(__pyx_t_1);
16586 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16591 __Pyx_XDECREF(__pyx_t_1);
16592 __Pyx_AddTraceback("csamtools.IteratorColumnRegion.__cinit__");
16595 __Pyx_DECREF(__pyx_v_kwargs);
16596 __Pyx_TraceReturn(Py_None);
16597 __Pyx_RefNannyFinishContext();
16601 /* "csamtools.pyx":1789
16602 * self.setupIteratorData( tid, start, end, 1 )
16604 * def __next__(self): # <<<<<<<<<<<<<<
16605 * """python version of next().
16609 static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_1__next__(PyObject *__pyx_v_self); /*proto*/
16610 static char __pyx_doc_9csamtools_20IteratorColumnRegion_1__next__[] = "python version of next().\n ";
16611 struct wrapperbase __pyx_wrapperbase_9csamtools_20IteratorColumnRegion_1__next__;
16612 static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_1__next__(PyObject *__pyx_v_self) {
16613 PyObject *__pyx_r = NULL;
16615 PyObject *__pyx_t_2 = NULL;
16616 __Pyx_TraceDeclarations
16617 __Pyx_RefNannySetupContext("__next__");
16618 __Pyx_TraceCall("__next__", __pyx_f[0], 1789);
16620 /* "csamtools.pyx":1793
16623 * while 1: # <<<<<<<<<<<<<<
16625 * if self.n_plp < 0:
16630 /* "csamtools.pyx":1794
16633 * self.cnext() # <<<<<<<<<<<<<<
16634 * if self.n_plp < 0:
16635 * raise ValueError("error during iteration" )
16637 ((struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion *)((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.cnext(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self));
16639 /* "csamtools.pyx":1795
16642 * if self.n_plp < 0: # <<<<<<<<<<<<<<
16643 * raise ValueError("error during iteration" )
16646 __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.n_plp < 0);
16649 /* "csamtools.pyx":1796
16651 * if self.n_plp < 0:
16652 * raise ValueError("error during iteration" ) # <<<<<<<<<<<<<<
16654 * if self.plp == NULL:
16656 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_117), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16657 __Pyx_GOTREF(__pyx_t_2);
16658 __Pyx_Raise(__pyx_t_2, 0, 0);
16659 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16660 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16665 /* "csamtools.pyx":1798
16666 * raise ValueError("error during iteration" )
16668 * if self.plp == NULL: # <<<<<<<<<<<<<<
16669 * raise StopIteration
16672 __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.plp == NULL);
16675 /* "csamtools.pyx":1799
16677 * if self.plp == NULL:
16678 * raise StopIteration # <<<<<<<<<<<<<<
16680 * return makePileupProxy( <bam_pileup1_t*>self.plp,
16682 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
16683 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16688 /* "csamtools.pyx":1801
16689 * raise StopIteration
16691 * return makePileupProxy( <bam_pileup1_t*>self.plp, # <<<<<<<<<<<<<<
16695 __Pyx_XDECREF(__pyx_r);
16697 /* "csamtools.pyx":1804
16700 * self.n_plp ) # <<<<<<<<<<<<<<
16702 * cdef class IteratorColumnAllRefs(IteratorColumn):
16704 __pyx_t_2 = __pyx_f_9csamtools_makePileupProxy(((bam_pileup1_t *)((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.plp), ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.tid, ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.pos, ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.n_plp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16705 __Pyx_GOTREF(__pyx_t_2);
16706 __pyx_r = __pyx_t_2;
16711 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16714 __Pyx_XDECREF(__pyx_t_2);
16715 __Pyx_AddTraceback("csamtools.IteratorColumnRegion.__next__");
16718 __Pyx_XGIVEREF(__pyx_r);
16719 __Pyx_TraceReturn(__pyx_r);
16720 __Pyx_RefNannyFinishContext();
16724 /* "csamtools.pyx":1810
16727 * def __cinit__(self, # <<<<<<<<<<<<<<
16732 static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16733 static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16734 struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
16735 PyObject *__pyx_v_kwargs = 0;
16737 PyObject *__pyx_t_1 = NULL;
16740 struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData __pyx_t_4;
16741 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0};
16742 __Pyx_TraceDeclarations
16743 __Pyx_RefNannySetupContext("__cinit__");
16744 __Pyx_TraceCall("__cinit__", __pyx_f[0], 1810);
16745 __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
16746 __Pyx_GOTREF(__pyx_v_kwargs);
16747 if (unlikely(__pyx_kwds)) {
16748 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
16749 PyObject* values[1] = {0};
16750 switch (PyTuple_GET_SIZE(__pyx_args)) {
16751 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16753 default: goto __pyx_L5_argtuple_error;
16755 switch (PyTuple_GET_SIZE(__pyx_args)) {
16757 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
16758 if (likely(values[0])) kw_args--;
16759 else goto __pyx_L5_argtuple_error;
16761 if (unlikely(kw_args > 0)) {
16762 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16764 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
16765 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
16766 goto __pyx_L5_argtuple_error;
16768 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0));
16770 goto __pyx_L4_argument_unpacking_done;
16771 __pyx_L5_argtuple_error:;
16772 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
16774 __Pyx_DECREF(__pyx_v_kwargs);
16775 __Pyx_AddTraceback("csamtools.IteratorColumnAllRefs.__cinit__");
16776 __Pyx_RefNannyFinishContext();
16778 __pyx_L4_argument_unpacking_done:;
16779 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16781 /* "csamtools.pyx":1815
16783 * # no iteration over empty files
16784 * if not samfile.nreferences: raise StopIteration # <<<<<<<<<<<<<<
16786 * # initialize iterator
16788 __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 = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16789 __Pyx_GOTREF(__pyx_t_1);
16790 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16791 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16792 __pyx_t_3 = (!__pyx_t_2);
16794 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
16795 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16800 /* "csamtools.pyx":1818
16802 * # initialize iterator
16803 * self.setupIteratorData( self.tid, 0, max_pos, 1 ) # <<<<<<<<<<<<<<
16805 * def __next__(self):
16807 __pyx_t_4.__pyx_n = 1;
16808 __pyx_t_4.reopen = 1;
16809 __pyx_t_1 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__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 = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16810 __Pyx_GOTREF(__pyx_t_1);
16811 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16816 __Pyx_XDECREF(__pyx_t_1);
16817 __Pyx_AddTraceback("csamtools.IteratorColumnAllRefs.__cinit__");
16820 __Pyx_DECREF(__pyx_v_kwargs);
16821 __Pyx_TraceReturn(Py_None);
16822 __Pyx_RefNannyFinishContext();
16826 /* "csamtools.pyx":1820
16827 * self.setupIteratorData( self.tid, 0, max_pos, 1 )
16829 * def __next__(self): # <<<<<<<<<<<<<<
16830 * """python version of next().
16834 static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_1__next__(PyObject *__pyx_v_self); /*proto*/
16835 static char __pyx_doc_9csamtools_21IteratorColumnAllRefs_1__next__[] = "python version of next().\n ";
16836 struct wrapperbase __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_1__next__;
16837 static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_1__next__(PyObject *__pyx_v_self) {
16838 PyObject *__pyx_r = NULL;
16840 PyObject *__pyx_t_2 = NULL;
16841 PyObject *__pyx_t_3 = NULL;
16842 PyObject *__pyx_t_4 = NULL;
16843 struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData __pyx_t_5;
16844 __Pyx_TraceDeclarations
16845 __Pyx_RefNannySetupContext("__next__");
16846 __Pyx_TraceCall("__next__", __pyx_f[0], 1820);
16848 /* "csamtools.pyx":1824
16851 * while 1: # <<<<<<<<<<<<<<
16858 /* "csamtools.pyx":1825
16861 * self.cnext() # <<<<<<<<<<<<<<
16863 * if self.n_plp < 0:
16865 ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.cnext(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self));
16867 /* "csamtools.pyx":1827
16870 * if self.n_plp < 0: # <<<<<<<<<<<<<<
16871 * raise ValueError("error during iteration" )
16874 __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.n_plp < 0);
16877 /* "csamtools.pyx":1828
16879 * if self.n_plp < 0:
16880 * raise ValueError("error during iteration" ) # <<<<<<<<<<<<<<
16882 * # return result, if within same reference
16884 __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 = 1828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16885 __Pyx_GOTREF(__pyx_t_2);
16886 __Pyx_Raise(__pyx_t_2, 0, 0);
16887 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16888 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16893 /* "csamtools.pyx":1831
16895 * # return result, if within same reference
16896 * if self.plp != NULL: # <<<<<<<<<<<<<<
16897 * return makePileupProxy( <bam_pileup1_t*>self.plp,
16900 __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.plp != NULL);
16903 /* "csamtools.pyx":1832
16904 * # return result, if within same reference
16905 * if self.plp != NULL:
16906 * return makePileupProxy( <bam_pileup1_t*>self.plp, # <<<<<<<<<<<<<<
16910 __Pyx_XDECREF(__pyx_r);
16912 /* "csamtools.pyx":1835
16915 * self.n_plp ) # <<<<<<<<<<<<<<
16917 * # otherwise, proceed to next reference or stop
16919 __pyx_t_2 = __pyx_f_9csamtools_makePileupProxy(((bam_pileup1_t *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.plp), ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid, ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.pos, ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.n_plp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16920 __Pyx_GOTREF(__pyx_t_2);
16921 __pyx_r = __pyx_t_2;
16928 /* "csamtools.pyx":1838
16930 * # otherwise, proceed to next reference or stop
16931 * self.tid += 1 # <<<<<<<<<<<<<<
16932 * if self.tid < self.samfile.nreferences:
16933 * self.setupIteratorData( self.tid, 0, max_pos, 0 )
16935 ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid = (((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid + 1);
16937 /* "csamtools.pyx":1839
16938 * # otherwise, proceed to next reference or stop
16940 * if self.tid < self.samfile.nreferences: # <<<<<<<<<<<<<<
16941 * self.setupIteratorData( self.tid, 0, max_pos, 0 )
16944 __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16945 __Pyx_GOTREF(__pyx_t_2);
16946 __pyx_t_3 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16947 __Pyx_GOTREF(__pyx_t_3);
16948 __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 = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16949 __Pyx_GOTREF(__pyx_t_4);
16950 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16951 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16952 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16953 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16956 /* "csamtools.pyx":1840
16958 * if self.tid < self.samfile.nreferences:
16959 * self.setupIteratorData( self.tid, 0, max_pos, 0 ) # <<<<<<<<<<<<<<
16961 * raise StopIteration
16963 __pyx_t_5.__pyx_n = 1;
16964 __pyx_t_5.reopen = 0;
16965 __pyx_t_4 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__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 = 1840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16966 __Pyx_GOTREF(__pyx_t_4);
16967 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16972 /* "csamtools.pyx":1842
16973 * self.setupIteratorData( self.tid, 0, max_pos, 0 )
16975 * raise StopIteration # <<<<<<<<<<<<<<
16977 * ##-------------------------------------------------------------------
16979 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
16980 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
16985 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16988 __Pyx_XDECREF(__pyx_t_2);
16989 __Pyx_XDECREF(__pyx_t_3);
16990 __Pyx_XDECREF(__pyx_t_4);
16991 __Pyx_AddTraceback("csamtools.IteratorColumnAllRefs.__next__");
16994 __Pyx_XGIVEREF(__pyx_r);
16995 __Pyx_TraceReturn(__pyx_r);
16996 __Pyx_RefNannyFinishContext();
17000 /* "csamtools.pyx":1847
17001 * ##-------------------------------------------------------------------
17002 * ##-------------------------------------------------------------------
17003 * cdef inline int32_t query_start(bam1_t *src) except -1: # <<<<<<<<<<<<<<
17004 * cdef uint32_t * cigar_p, op
17008 static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *__pyx_v_src) {
17009 uint32_t *__pyx_v_cigar_p;
17010 uint32_t __pyx_v_op;
17011 uint32_t __pyx_v_k;
17012 uint32_t __pyx_v_start_offset;
17014 uint32_t __pyx_t_1;
17018 __Pyx_TraceDeclarations
17019 __Pyx_RefNannySetupContext("query_start");
17020 __Pyx_TraceCall("query_start", __pyx_f[0], 1847);
17022 /* "csamtools.pyx":1850
17023 * cdef uint32_t * cigar_p, op
17025 * cdef uint32_t start_offset = 0 # <<<<<<<<<<<<<<
17027 * if src.core.n_cigar:
17029 __pyx_v_start_offset = 0;
17031 /* "csamtools.pyx":1852
17032 * cdef uint32_t start_offset = 0
17034 * if src.core.n_cigar: # <<<<<<<<<<<<<<
17035 * cigar_p = bam1_cigar(src);
17036 * for k from 0 <= k < src.core.n_cigar:
17038 if (__pyx_v_src->core.n_cigar) {
17040 /* "csamtools.pyx":1853
17042 * if src.core.n_cigar:
17043 * cigar_p = bam1_cigar(src); # <<<<<<<<<<<<<<
17044 * for k from 0 <= k < src.core.n_cigar:
17045 * op = cigar_p[k] & BAM_CIGAR_MASK
17047 __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
17049 /* "csamtools.pyx":1854
17050 * if src.core.n_cigar:
17051 * cigar_p = bam1_cigar(src);
17052 * for k from 0 <= k < src.core.n_cigar: # <<<<<<<<<<<<<<
17053 * op = cigar_p[k] & BAM_CIGAR_MASK
17054 * if op==BAM_CHARD_CLIP:
17056 __pyx_t_1 = __pyx_v_src->core.n_cigar;
17057 for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_1; __pyx_v_k++) {
17059 /* "csamtools.pyx":1855
17060 * cigar_p = bam1_cigar(src);
17061 * for k from 0 <= k < src.core.n_cigar:
17062 * op = cigar_p[k] & BAM_CIGAR_MASK # <<<<<<<<<<<<<<
17063 * if op==BAM_CHARD_CLIP:
17064 * if start_offset!=0 and start_offset!=src.core.l_qseq:
17066 __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);
17068 /* "csamtools.pyx":1860
17069 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
17071 * elif op==BAM_CSOFT_CLIP: # <<<<<<<<<<<<<<
17072 * start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT
17075 switch (__pyx_v_op) {
17077 /* "csamtools.pyx":1856
17078 * for k from 0 <= k < src.core.n_cigar:
17079 * op = cigar_p[k] & BAM_CIGAR_MASK
17080 * if op==BAM_CHARD_CLIP: # <<<<<<<<<<<<<<
17081 * if start_offset!=0 and start_offset!=src.core.l_qseq:
17082 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
17086 /* "csamtools.pyx":1857
17087 * op = cigar_p[k] & BAM_CIGAR_MASK
17088 * if op==BAM_CHARD_CLIP:
17089 * if start_offset!=0 and start_offset!=src.core.l_qseq: # <<<<<<<<<<<<<<
17090 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
17093 __pyx_t_2 = (__pyx_v_start_offset != 0);
17095 __pyx_t_3 = (__pyx_v_start_offset != __pyx_v_src->core.l_qseq);
17096 __pyx_t_4 = __pyx_t_3;
17098 __pyx_t_4 = __pyx_t_2;
17102 /* "csamtools.pyx":1858
17103 * if op==BAM_CHARD_CLIP:
17104 * if start_offset!=0 and start_offset!=src.core.l_qseq:
17105 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string') # <<<<<<<<<<<<<<
17107 * elif op==BAM_CSOFT_CLIP:
17109 PyErr_SetString(__pyx_builtin_ValueError, __pyx_k_119);
17111 /* "csamtools.pyx":1859
17112 * if start_offset!=0 and start_offset!=src.core.l_qseq:
17113 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
17114 * return -1 # <<<<<<<<<<<<<<
17115 * elif op==BAM_CSOFT_CLIP:
17116 * start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT
17125 /* "csamtools.pyx":1860
17126 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
17128 * elif op==BAM_CSOFT_CLIP: # <<<<<<<<<<<<<<
17129 * start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT
17134 /* "csamtools.pyx":1861
17136 * elif op==BAM_CSOFT_CLIP:
17137 * start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT # <<<<<<<<<<<<<<
17141 __pyx_v_start_offset = (__pyx_v_start_offset + ((__pyx_v_cigar_p[__pyx_v_k]) >> 4));
17145 /* "csamtools.pyx":1863
17146 * start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT
17148 * break # <<<<<<<<<<<<<<
17150 * return start_offset
17152 goto __pyx_L5_break;
17161 /* "csamtools.pyx":1865
17164 * return start_offset # <<<<<<<<<<<<<<
17166 * ##-------------------------------------------------------------------
17168 __pyx_r = __pyx_v_start_offset;
17173 __Pyx_TraceReturn(Py_None);
17174 __Pyx_RefNannyFinishContext();
17178 /* "csamtools.pyx":1870
17179 * ##-------------------------------------------------------------------
17180 * ##-------------------------------------------------------------------
17181 * cdef inline int32_t query_end(bam1_t *src) except -1: # <<<<<<<<<<<<<<
17182 * cdef uint32_t * cigar_p, op
17186 static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *__pyx_v_src) {
17187 uint32_t *__pyx_v_cigar_p;
17188 uint32_t __pyx_v_op;
17189 uint32_t __pyx_v_k;
17190 uint32_t __pyx_v_end_offset;
17195 __Pyx_TraceDeclarations
17196 __Pyx_RefNannySetupContext("query_end");
17197 __Pyx_TraceCall("query_end", __pyx_f[0], 1870);
17199 /* "csamtools.pyx":1873
17200 * cdef uint32_t * cigar_p, op
17202 * cdef uint32_t end_offset = src.core.l_qseq # <<<<<<<<<<<<<<
17204 * if src.core.n_cigar>1:
17206 __pyx_v_end_offset = __pyx_v_src->core.l_qseq;
17208 /* "csamtools.pyx":1875
17209 * cdef uint32_t end_offset = src.core.l_qseq
17211 * if src.core.n_cigar>1: # <<<<<<<<<<<<<<
17212 * cigar_p = bam1_cigar(src);
17213 * for k from src.core.n_cigar > k >= 1:
17215 __pyx_t_1 = (__pyx_v_src->core.n_cigar > 1);
17218 /* "csamtools.pyx":1876
17220 * if src.core.n_cigar>1:
17221 * cigar_p = bam1_cigar(src); # <<<<<<<<<<<<<<
17222 * for k from src.core.n_cigar > k >= 1:
17223 * op = cigar_p[k] & BAM_CIGAR_MASK
17225 __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
17227 /* "csamtools.pyx":1877
17228 * if src.core.n_cigar>1:
17229 * cigar_p = bam1_cigar(src);
17230 * for k from src.core.n_cigar > k >= 1: # <<<<<<<<<<<<<<
17231 * op = cigar_p[k] & BAM_CIGAR_MASK
17232 * if op==BAM_CHARD_CLIP:
17234 for (__pyx_v_k = __pyx_v_src->core.n_cigar-1; __pyx_v_k >= 1; __pyx_v_k--) {
17236 /* "csamtools.pyx":1878
17237 * cigar_p = bam1_cigar(src);
17238 * for k from src.core.n_cigar > k >= 1:
17239 * op = cigar_p[k] & BAM_CIGAR_MASK # <<<<<<<<<<<<<<
17240 * if op==BAM_CHARD_CLIP:
17241 * if end_offset!=0 and end_offset!=src.core.l_qseq:
17243 __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);
17245 /* "csamtools.pyx":1883
17246 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
17248 * elif op==BAM_CSOFT_CLIP: # <<<<<<<<<<<<<<
17249 * end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT
17252 switch (__pyx_v_op) {
17254 /* "csamtools.pyx":1879
17255 * for k from src.core.n_cigar > k >= 1:
17256 * op = cigar_p[k] & BAM_CIGAR_MASK
17257 * if op==BAM_CHARD_CLIP: # <<<<<<<<<<<<<<
17258 * if end_offset!=0 and end_offset!=src.core.l_qseq:
17259 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
17263 /* "csamtools.pyx":1880
17264 * op = cigar_p[k] & BAM_CIGAR_MASK
17265 * if op==BAM_CHARD_CLIP:
17266 * if end_offset!=0 and end_offset!=src.core.l_qseq: # <<<<<<<<<<<<<<
17267 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
17270 __pyx_t_1 = (__pyx_v_end_offset != 0);
17272 __pyx_t_2 = (__pyx_v_end_offset != __pyx_v_src->core.l_qseq);
17273 __pyx_t_3 = __pyx_t_2;
17275 __pyx_t_3 = __pyx_t_1;
17279 /* "csamtools.pyx":1881
17280 * if op==BAM_CHARD_CLIP:
17281 * if end_offset!=0 and end_offset!=src.core.l_qseq:
17282 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string') # <<<<<<<<<<<<<<
17284 * elif op==BAM_CSOFT_CLIP:
17286 PyErr_SetString(__pyx_builtin_ValueError, __pyx_k_119);
17288 /* "csamtools.pyx":1882
17289 * if end_offset!=0 and end_offset!=src.core.l_qseq:
17290 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
17291 * return -1 # <<<<<<<<<<<<<<
17292 * elif op==BAM_CSOFT_CLIP:
17293 * end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT
17302 /* "csamtools.pyx":1883
17303 * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string')
17305 * elif op==BAM_CSOFT_CLIP: # <<<<<<<<<<<<<<
17306 * end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT
17311 /* "csamtools.pyx":1884
17313 * elif op==BAM_CSOFT_CLIP:
17314 * end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT # <<<<<<<<<<<<<<
17318 __pyx_v_end_offset = (__pyx_v_end_offset - ((__pyx_v_cigar_p[__pyx_v_k]) >> 4));
17322 /* "csamtools.pyx":1886
17323 * end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT
17325 * break # <<<<<<<<<<<<<<
17327 * if end_offset==0:
17329 goto __pyx_L5_break;
17338 /* "csamtools.pyx":1888
17341 * if end_offset==0: # <<<<<<<<<<<<<<
17342 * end_offset = src.core.l_qseq
17345 __pyx_t_3 = (__pyx_v_end_offset == 0);
17348 /* "csamtools.pyx":1889
17350 * if end_offset==0:
17351 * end_offset = src.core.l_qseq # <<<<<<<<<<<<<<
17353 * return end_offset
17355 __pyx_v_end_offset = __pyx_v_src->core.l_qseq;
17360 /* "csamtools.pyx":1891
17361 * end_offset = src.core.l_qseq
17363 * return end_offset # <<<<<<<<<<<<<<
17367 __pyx_r = __pyx_v_end_offset;
17372 __Pyx_TraceReturn(Py_None);
17373 __Pyx_RefNannyFinishContext();
17377 /* "csamtools.pyx":1894
17380 * cdef inline object get_seq_range(bam1_t *src, uint32_t start, uint32_t end): # <<<<<<<<<<<<<<
17385 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) {
17386 uint8_t *__pyx_v_p;
17387 uint32_t __pyx_v_k;
17389 PyObject *__pyx_v_seq;
17390 PyObject *__pyx_r = NULL;
17392 PyObject *__pyx_t_2 = NULL;
17393 uint32_t __pyx_t_3;
17394 __Pyx_TraceDeclarations
17395 __Pyx_RefNannySetupContext("get_seq_range");
17396 __Pyx_TraceCall("get_seq_range", __pyx_f[0], 1894);
17397 __pyx_v_seq = Py_None; __Pyx_INCREF(Py_None);
17399 /* "csamtools.pyx":1899
17402 * if not src.core.l_qseq: # <<<<<<<<<<<<<<
17406 __pyx_t_1 = (!__pyx_v_src->core.l_qseq);
17409 /* "csamtools.pyx":1900
17411 * if not src.core.l_qseq:
17412 * return None # <<<<<<<<<<<<<<
17414 * seq = PyString_FromStringAndSize(NULL, end-start)
17416 __Pyx_XDECREF(__pyx_r);
17417 __Pyx_INCREF(Py_None);
17424 /* "csamtools.pyx":1902
17427 * seq = PyString_FromStringAndSize(NULL, end-start) # <<<<<<<<<<<<<<
17428 * s = PyString_AS_STRING(seq)
17429 * p = bam1_seq(src)
17431 __pyx_t_2 = PyString_FromStringAndSize(NULL, (__pyx_v_end - __pyx_v_start)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17432 __Pyx_GOTREF(__pyx_t_2);
17433 __Pyx_DECREF(__pyx_v_seq);
17434 __pyx_v_seq = __pyx_t_2;
17437 /* "csamtools.pyx":1903
17439 * seq = PyString_FromStringAndSize(NULL, end-start)
17440 * s = PyString_AS_STRING(seq) # <<<<<<<<<<<<<<
17441 * p = bam1_seq(src)
17444 __pyx_v_s = PyString_AS_STRING(__pyx_v_seq);
17446 /* "csamtools.pyx":1904
17447 * seq = PyString_FromStringAndSize(NULL, end-start)
17448 * s = PyString_AS_STRING(seq)
17449 * p = bam1_seq(src) # <<<<<<<<<<<<<<
17451 * for k from start <= k < end:
17453 __pyx_v_p = bam1_seq(__pyx_v_src);
17455 /* "csamtools.pyx":1906
17456 * p = bam1_seq(src)
17458 * for k from start <= k < end: # <<<<<<<<<<<<<<
17459 * # equivalent to bam_nt16_rev_table[bam1_seqi(s, i)] (see bam.c)
17460 * # note: do not use string literal as it will be a python string
17462 __pyx_t_3 = __pyx_v_end;
17463 for (__pyx_v_k = __pyx_v_start; __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
17465 /* "csamtools.pyx":1909
17466 * # equivalent to bam_nt16_rev_table[bam1_seqi(s, i)] (see bam.c)
17467 * # note: do not use string literal as it will be a python string
17468 * s[k-start] = bam_nt16_rev_table[p[k/2] >> 4 * (1 - k%2) & 0xf] # <<<<<<<<<<<<<<
17472 (__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)]);
17475 /* "csamtools.pyx":1911
17476 * s[k-start] = bam_nt16_rev_table[p[k/2] >> 4 * (1 - k%2) & 0xf]
17478 * return seq # <<<<<<<<<<<<<<
17482 __Pyx_XDECREF(__pyx_r);
17483 __Pyx_INCREF(__pyx_v_seq);
17484 __pyx_r = __pyx_v_seq;
17487 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17490 __Pyx_XDECREF(__pyx_t_2);
17491 __Pyx_AddTraceback("csamtools.get_seq_range");
17494 __Pyx_DECREF(__pyx_v_seq);
17495 __Pyx_XGIVEREF(__pyx_r);
17496 __Pyx_TraceReturn(__pyx_r);
17497 __Pyx_RefNannyFinishContext();
17501 /* "csamtools.pyx":1914
17504 * cdef inline object get_qual_range(bam1_t *src, uint32_t start, uint32_t end): # <<<<<<<<<<<<<<
17509 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) {
17510 uint8_t *__pyx_v_p;
17511 uint32_t __pyx_v_k;
17513 PyObject *__pyx_v_qual;
17514 PyObject *__pyx_r = NULL;
17516 PyObject *__pyx_t_2 = NULL;
17517 uint32_t __pyx_t_3;
17518 __Pyx_TraceDeclarations
17519 __Pyx_RefNannySetupContext("get_qual_range");
17520 __Pyx_TraceCall("get_qual_range", __pyx_f[0], 1914);
17521 __pyx_v_qual = Py_None; __Pyx_INCREF(Py_None);
17523 /* "csamtools.pyx":1919
17526 * p = bam1_qual(src) # <<<<<<<<<<<<<<
17530 __pyx_v_p = bam1_qual(__pyx_v_src);
17532 /* "csamtools.pyx":1920
17534 * p = bam1_qual(src)
17535 * if p[0] == 0xff: # <<<<<<<<<<<<<<
17539 __pyx_t_1 = ((__pyx_v_p[0]) == 0xff);
17542 /* "csamtools.pyx":1921
17543 * p = bam1_qual(src)
17545 * return None # <<<<<<<<<<<<<<
17547 * qual = PyString_FromStringAndSize(NULL, end-start)
17549 __Pyx_XDECREF(__pyx_r);
17550 __Pyx_INCREF(Py_None);
17557 /* "csamtools.pyx":1923
17560 * qual = PyString_FromStringAndSize(NULL, end-start) # <<<<<<<<<<<<<<
17561 * q = PyString_AS_STRING(qual)
17564 __pyx_t_2 = PyString_FromStringAndSize(NULL, (__pyx_v_end - __pyx_v_start)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17565 __Pyx_GOTREF(__pyx_t_2);
17566 __Pyx_DECREF(__pyx_v_qual);
17567 __pyx_v_qual = __pyx_t_2;
17570 /* "csamtools.pyx":1924
17572 * qual = PyString_FromStringAndSize(NULL, end-start)
17573 * q = PyString_AS_STRING(qual) # <<<<<<<<<<<<<<
17575 * for k from start <= k < end:
17577 __pyx_v_q = PyString_AS_STRING(__pyx_v_qual);
17579 /* "csamtools.pyx":1926
17580 * q = PyString_AS_STRING(qual)
17582 * for k from start <= k < end: # <<<<<<<<<<<<<<
17583 * ## equivalent to t[i] + 33 (see bam.c)
17584 * q[k-start] = p[k] + 33
17586 __pyx_t_3 = __pyx_v_end;
17587 for (__pyx_v_k = __pyx_v_start; __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
17589 /* "csamtools.pyx":1928
17590 * for k from start <= k < end:
17591 * ## equivalent to t[i] + 33 (see bam.c)
17592 * q[k-start] = p[k] + 33 # <<<<<<<<<<<<<<
17596 (__pyx_v_q[(__pyx_v_k - __pyx_v_start)]) = ((__pyx_v_p[__pyx_v_k]) + 33);
17599 /* "csamtools.pyx":1930
17600 * q[k-start] = p[k] + 33
17602 * return qual # <<<<<<<<<<<<<<
17604 * cdef class AlignedRead:
17606 __Pyx_XDECREF(__pyx_r);
17607 __Pyx_INCREF(__pyx_v_qual);
17608 __pyx_r = __pyx_v_qual;
17611 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17614 __Pyx_XDECREF(__pyx_t_2);
17615 __Pyx_AddTraceback("csamtools.get_qual_range");
17618 __Pyx_DECREF(__pyx_v_qual);
17619 __Pyx_XGIVEREF(__pyx_r);
17620 __Pyx_TraceReturn(__pyx_r);
17621 __Pyx_RefNannyFinishContext();
17625 /* "csamtools.pyx":1955
17627 * # Now only called when instances are created from Python
17628 * def __init__(self): # <<<<<<<<<<<<<<
17630 * self._delegate = <bam1_t*>calloc( 1, sizeof( bam1_t) )
17633 static int __pyx_pf_9csamtools_11AlignedRead___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
17634 static int __pyx_pf_9csamtools_11AlignedRead___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17636 __Pyx_TraceDeclarations
17637 __Pyx_RefNannySetupContext("__init__");
17638 __Pyx_TraceCall("__init__", __pyx_f[0], 1955);
17639 if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
17640 __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
17641 if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
17643 /* "csamtools.pyx":1957
17644 * def __init__(self):
17646 * self._delegate = <bam1_t*>calloc( 1, sizeof( bam1_t) ) # <<<<<<<<<<<<<<
17647 * # allocate some memory
17648 * # If size is 0, calloc does not return a pointer that can be passed to free()
17650 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
17652 /* "csamtools.pyx":1961
17653 * # If size is 0, calloc does not return a pointer that can be passed to free()
17654 * # so allocate 40 bytes for a new read
17655 * self._delegate.m_data = 40 # <<<<<<<<<<<<<<
17656 * self._delegate.data = <uint8_t *>calloc( self._delegate.m_data, 1 )
17657 * self._delegate.data_len = 0
17659 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->m_data = 40;
17661 /* "csamtools.pyx":1962
17662 * # so allocate 40 bytes for a new read
17663 * self._delegate.m_data = 40
17664 * self._delegate.data = <uint8_t *>calloc( self._delegate.m_data, 1 ) # <<<<<<<<<<<<<<
17665 * self._delegate.data_len = 0
17668 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->data = ((uint8_t *)calloc(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->m_data, 1));
17670 /* "csamtools.pyx":1963
17671 * self._delegate.m_data = 40
17672 * self._delegate.data = <uint8_t *>calloc( self._delegate.m_data, 1 )
17673 * self._delegate.data_len = 0 # <<<<<<<<<<<<<<
17675 * def __dealloc__(self):
17677 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->data_len = 0;
17680 __Pyx_TraceReturn(Py_None);
17681 __Pyx_RefNannyFinishContext();
17685 /* "csamtools.pyx":1965
17686 * self._delegate.data_len = 0
17688 * def __dealloc__(self): # <<<<<<<<<<<<<<
17689 * bam_destroy1(self._delegate)
17693 static void __pyx_pf_9csamtools_11AlignedRead_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
17694 static void __pyx_pf_9csamtools_11AlignedRead_1__dealloc__(PyObject *__pyx_v_self) {
17695 __Pyx_TraceDeclarations
17696 __Pyx_RefNannySetupContext("__dealloc__");
17697 __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1965);
17699 /* "csamtools.pyx":1966
17701 * def __dealloc__(self):
17702 * bam_destroy1(self._delegate) # <<<<<<<<<<<<<<
17704 * def __str__(self):
17706 bam_destroy1(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate);
17708 __Pyx_TraceReturn(Py_None);
17709 __Pyx_RefNannyFinishContext();
17712 /* "csamtools.pyx":1968
17713 * bam_destroy1(self._delegate)
17715 * def __str__(self): # <<<<<<<<<<<<<<
17716 * """return string representation of alignment.
17720 static PyObject *__pyx_pf_9csamtools_11AlignedRead_2__str__(PyObject *__pyx_v_self); /*proto*/
17721 static char __pyx_doc_9csamtools_11AlignedRead_2__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 ";
17722 struct wrapperbase __pyx_wrapperbase_9csamtools_11AlignedRead_2__str__;
17723 static PyObject *__pyx_pf_9csamtools_11AlignedRead_2__str__(PyObject *__pyx_v_self) {
17724 PyObject *__pyx_r = NULL;
17725 PyObject *__pyx_t_1 = NULL;
17726 PyObject *__pyx_t_2 = NULL;
17727 PyObject *__pyx_t_3 = NULL;
17728 PyObject *__pyx_t_4 = NULL;
17729 PyObject *__pyx_t_5 = NULL;
17730 PyObject *__pyx_t_6 = NULL;
17731 PyObject *__pyx_t_7 = NULL;
17732 PyObject *__pyx_t_8 = NULL;
17733 PyObject *__pyx_t_9 = NULL;
17734 PyObject *__pyx_t_10 = NULL;
17735 PyObject *__pyx_t_11 = NULL;
17736 PyObject *__pyx_t_12 = NULL;
17737 PyObject *__pyx_t_13 = NULL;
17738 PyObject *__pyx_t_14 = NULL;
17739 __Pyx_TraceDeclarations
17740 __Pyx_RefNannySetupContext("__str__");
17741 __Pyx_TraceCall("__str__", __pyx_f[0], 1968);
17743 /* "csamtools.pyx":1980
17744 * # sam-parsing is done in sam.c/bam_format1_core which
17745 * # requires a valid header.
17746 * return "\t".join(map(str, (self.qname, # <<<<<<<<<<<<<<
17750 __Pyx_XDECREF(__pyx_r);
17751 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17752 __Pyx_GOTREF(__pyx_t_1);
17753 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__qname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17754 __Pyx_GOTREF(__pyx_t_2);
17756 /* "csamtools.pyx":1981
17757 * # requires a valid header.
17758 * return "\t".join(map(str, (self.qname,
17759 * self.flag, # <<<<<<<<<<<<<<
17763 __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17764 __Pyx_GOTREF(__pyx_t_3);
17766 /* "csamtools.pyx":1982
17767 * return "\t".join(map(str, (self.qname,
17769 * self.rname, # <<<<<<<<<<<<<<
17773 __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__rname); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17774 __Pyx_GOTREF(__pyx_t_4);
17776 /* "csamtools.pyx":1983
17779 * self.pos, # <<<<<<<<<<<<<<
17783 __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17784 __Pyx_GOTREF(__pyx_t_5);
17786 /* "csamtools.pyx":1984
17789 * self.mapq, # <<<<<<<<<<<<<<
17793 __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mapq); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17794 __Pyx_GOTREF(__pyx_t_6);
17796 /* "csamtools.pyx":1985
17799 * self.cigar, # <<<<<<<<<<<<<<
17803 __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cigar); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17804 __Pyx_GOTREF(__pyx_t_7);
17806 /* "csamtools.pyx":1986
17809 * self.mrnm, # <<<<<<<<<<<<<<
17813 __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mrnm); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17814 __Pyx_GOTREF(__pyx_t_8);
17816 /* "csamtools.pyx":1987
17819 * self.mpos, # <<<<<<<<<<<<<<
17823 __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mpos); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17824 __Pyx_GOTREF(__pyx_t_9);
17826 /* "csamtools.pyx":1988
17829 * self.rlen, # <<<<<<<<<<<<<<
17833 __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__rlen); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17834 __Pyx_GOTREF(__pyx_t_10);
17836 /* "csamtools.pyx":1989
17839 * self.seq, # <<<<<<<<<<<<<<
17843 __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__seq); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17844 __Pyx_GOTREF(__pyx_t_11);
17846 /* "csamtools.pyx":1990
17849 * self.qual, # <<<<<<<<<<<<<<
17853 __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__qual); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17854 __Pyx_GOTREF(__pyx_t_12);
17856 /* "csamtools.pyx":1991
17859 * self.tags ))) # <<<<<<<<<<<<<<
17861 * def compare(self, AlignedRead other):
17863 __pyx_t_13 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tags); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17864 __Pyx_GOTREF(__pyx_t_13);
17865 __pyx_t_14 = PyTuple_New(12); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17866 __Pyx_GOTREF(((PyObject *)__pyx_t_14));
17867 PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_2);
17868 __Pyx_GIVEREF(__pyx_t_2);
17869 PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_3);
17870 __Pyx_GIVEREF(__pyx_t_3);
17871 PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_4);
17872 __Pyx_GIVEREF(__pyx_t_4);
17873 PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_5);
17874 __Pyx_GIVEREF(__pyx_t_5);
17875 PyTuple_SET_ITEM(__pyx_t_14, 4, __pyx_t_6);
17876 __Pyx_GIVEREF(__pyx_t_6);
17877 PyTuple_SET_ITEM(__pyx_t_14, 5, __pyx_t_7);
17878 __Pyx_GIVEREF(__pyx_t_7);
17879 PyTuple_SET_ITEM(__pyx_t_14, 6, __pyx_t_8);
17880 __Pyx_GIVEREF(__pyx_t_8);
17881 PyTuple_SET_ITEM(__pyx_t_14, 7, __pyx_t_9);
17882 __Pyx_GIVEREF(__pyx_t_9);
17883 PyTuple_SET_ITEM(__pyx_t_14, 8, __pyx_t_10);
17884 __Pyx_GIVEREF(__pyx_t_10);
17885 PyTuple_SET_ITEM(__pyx_t_14, 9, __pyx_t_11);
17886 __Pyx_GIVEREF(__pyx_t_11);
17887 PyTuple_SET_ITEM(__pyx_t_14, 10, __pyx_t_12);
17888 __Pyx_GIVEREF(__pyx_t_12);
17889 PyTuple_SET_ITEM(__pyx_t_14, 11, __pyx_t_13);
17890 __Pyx_GIVEREF(__pyx_t_13);
17903 __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17904 __Pyx_GOTREF(((PyObject *)__pyx_t_13));
17905 __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
17906 PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
17907 __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
17908 PyTuple_SET_ITEM(__pyx_t_13, 1, ((PyObject *)__pyx_t_14));
17909 __Pyx_GIVEREF(((PyObject *)__pyx_t_14));
17911 __pyx_t_14 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17912 __Pyx_GOTREF(__pyx_t_14);
17913 __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
17914 __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17915 __Pyx_GOTREF(((PyObject *)__pyx_t_13));
17916 PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_14);
17917 __Pyx_GIVEREF(__pyx_t_14);
17919 __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17920 __Pyx_GOTREF(__pyx_t_14);
17921 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17922 __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
17923 __pyx_r = __pyx_t_14;
17927 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17930 __Pyx_XDECREF(__pyx_t_1);
17931 __Pyx_XDECREF(__pyx_t_2);
17932 __Pyx_XDECREF(__pyx_t_3);
17933 __Pyx_XDECREF(__pyx_t_4);
17934 __Pyx_XDECREF(__pyx_t_5);
17935 __Pyx_XDECREF(__pyx_t_6);
17936 __Pyx_XDECREF(__pyx_t_7);
17937 __Pyx_XDECREF(__pyx_t_8);
17938 __Pyx_XDECREF(__pyx_t_9);
17939 __Pyx_XDECREF(__pyx_t_10);
17940 __Pyx_XDECREF(__pyx_t_11);
17941 __Pyx_XDECREF(__pyx_t_12);
17942 __Pyx_XDECREF(__pyx_t_13);
17943 __Pyx_XDECREF(__pyx_t_14);
17944 __Pyx_AddTraceback("csamtools.AlignedRead.__str__");
17947 __Pyx_XGIVEREF(__pyx_r);
17948 __Pyx_TraceReturn(__pyx_r);
17949 __Pyx_RefNannyFinishContext();
17953 /* "csamtools.pyx":1993
17956 * def compare(self, AlignedRead other): # <<<<<<<<<<<<<<
17957 * '''return -1,0,1, if contents in this are binary <,=,> to *other*'''
17961 static PyObject *__pyx_pf_9csamtools_11AlignedRead_3compare(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
17962 static char __pyx_doc_9csamtools_11AlignedRead_3compare[] = "AlignedRead.compare(self, AlignedRead other)\nreturn -1,0,1, if contents in this are binary <,=,> to *other*";
17963 static PyObject *__pyx_pf_9csamtools_11AlignedRead_3compare(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
17964 int __pyx_v_retval;
17967 PyObject *__pyx_r = NULL;
17969 PyObject *__pyx_t_2 = NULL;
17970 PyObject *__pyx_t_3 = NULL;
17971 PyObject *__pyx_t_4 = NULL;
17973 __Pyx_TraceDeclarations
17974 __Pyx_RefNannySetupContext("compare");
17975 __Pyx_TraceCall("compare", __pyx_f[0], 1993);
17976 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_9csamtools_AlignedRead, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
17978 /* "csamtools.pyx":1999
17979 * cdef bam1_t *t, *o
17981 * t = self._delegate # <<<<<<<<<<<<<<
17982 * o = other._delegate
17985 __pyx_v_t = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
17987 /* "csamtools.pyx":2000
17989 * t = self._delegate
17990 * o = other._delegate # <<<<<<<<<<<<<<
17992 * # uncomment for debugging purposes
17994 __pyx_v_o = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_other)->_delegate;
17996 /* "csamtools.pyx":2012
17998 * # Fast-path test for object identity
17999 * if t==o: # <<<<<<<<<<<<<<
18003 __pyx_t_1 = (__pyx_v_t == __pyx_v_o);
18006 /* "csamtools.pyx":2013
18007 * # Fast-path test for object identity
18009 * return 0 # <<<<<<<<<<<<<<
18011 * retval = memcmp(&t.core, &o.core, sizeof(bam1_core_t))
18013 __Pyx_XDECREF(__pyx_r);
18014 __Pyx_INCREF(__pyx_int_0);
18015 __pyx_r = __pyx_int_0;
18021 /* "csamtools.pyx":2015
18024 * retval = memcmp(&t.core, &o.core, sizeof(bam1_core_t)) # <<<<<<<<<<<<<<
18026 * if retval: return retval
18028 __pyx_v_retval = memcmp((&__pyx_v_t->core), (&__pyx_v_o->core), (sizeof(bam1_core_t)));
18030 /* "csamtools.pyx":2017
18031 * retval = memcmp(&t.core, &o.core, sizeof(bam1_core_t))
18033 * if retval: return retval # <<<<<<<<<<<<<<
18034 * retval = cmp(t.data_len, o.data_len)
18035 * if retval: return retval
18037 if (__pyx_v_retval) {
18038 __Pyx_XDECREF(__pyx_r);
18039 __pyx_t_2 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18040 __Pyx_GOTREF(__pyx_t_2);
18041 __pyx_r = __pyx_t_2;
18048 /* "csamtools.pyx":2018
18050 * if retval: return retval
18051 * retval = cmp(t.data_len, o.data_len) # <<<<<<<<<<<<<<
18052 * if retval: return retval
18053 * return memcmp(t.data, o.data, t.data_len)
18055 __pyx_t_2 = PyInt_FromLong(__pyx_v_t->data_len); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18056 __Pyx_GOTREF(__pyx_t_2);
18057 __pyx_t_3 = PyInt_FromLong(__pyx_v_o->data_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18058 __Pyx_GOTREF(__pyx_t_3);
18059 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18060 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
18061 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
18062 __Pyx_GIVEREF(__pyx_t_2);
18063 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
18064 __Pyx_GIVEREF(__pyx_t_3);
18067 __pyx_t_3 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18068 __Pyx_GOTREF(__pyx_t_3);
18069 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
18070 __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18071 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18072 __pyx_v_retval = __pyx_t_5;
18074 /* "csamtools.pyx":2019
18075 * if retval: return retval
18076 * retval = cmp(t.data_len, o.data_len)
18077 * if retval: return retval # <<<<<<<<<<<<<<
18078 * return memcmp(t.data, o.data, t.data_len)
18081 if (__pyx_v_retval) {
18082 __Pyx_XDECREF(__pyx_r);
18083 __pyx_t_3 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18084 __Pyx_GOTREF(__pyx_t_3);
18085 __pyx_r = __pyx_t_3;
18092 /* "csamtools.pyx":2020
18093 * retval = cmp(t.data_len, o.data_len)
18094 * if retval: return retval
18095 * return memcmp(t.data, o.data, t.data_len) # <<<<<<<<<<<<<<
18097 * # Disabled so long as __cmp__ is a special method
18099 __Pyx_XDECREF(__pyx_r);
18100 __pyx_t_3 = PyInt_FromLong(memcmp(__pyx_v_t->data, __pyx_v_o->data, __pyx_v_t->data_len)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18101 __Pyx_GOTREF(__pyx_t_3);
18102 __pyx_r = __pyx_t_3;
18106 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18109 __Pyx_XDECREF(__pyx_t_2);
18110 __Pyx_XDECREF(__pyx_t_3);
18111 __Pyx_XDECREF(__pyx_t_4);
18112 __Pyx_AddTraceback("csamtools.AlignedRead.compare");
18115 __Pyx_XGIVEREF(__pyx_r);
18116 __Pyx_TraceReturn(__pyx_r);
18117 __Pyx_RefNannyFinishContext();
18121 /* "csamtools.pyx":2023
18123 * # Disabled so long as __cmp__ is a special method
18124 * def __hash__(self): # <<<<<<<<<<<<<<
18125 * return _Py_HashPointer(<void *>self)
18129 static long __pyx_pf_9csamtools_11AlignedRead_4__hash__(PyObject *__pyx_v_self); /*proto*/
18130 static long __pyx_pf_9csamtools_11AlignedRead_4__hash__(PyObject *__pyx_v_self) {
18132 __Pyx_TraceDeclarations
18133 __Pyx_RefNannySetupContext("__hash__");
18134 __Pyx_TraceCall("__hash__", __pyx_f[0], 2023);
18136 /* "csamtools.pyx":2024
18137 * # Disabled so long as __cmp__ is a special method
18138 * def __hash__(self):
18139 * return _Py_HashPointer(<void *>self) # <<<<<<<<<<<<<<
18143 __pyx_r = _Py_HashPointer(((void *)__pyx_v_self));
18148 if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
18149 __Pyx_TraceReturn(Py_None);
18150 __Pyx_RefNannyFinishContext();
18154 /* "csamtools.pyx":2028
18156 * """the query name (None if not present)"""
18157 * def __get__(self): # <<<<<<<<<<<<<<
18158 * cdef bam1_t * src
18159 * src = self._delegate
18162 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(PyObject *__pyx_v_self); /*proto*/
18163 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(PyObject *__pyx_v_self) {
18164 bam1_t *__pyx_v_src;
18165 PyObject *__pyx_r = NULL;
18167 PyObject *__pyx_t_2 = NULL;
18168 __Pyx_TraceDeclarations
18169 __Pyx_RefNannySetupContext("__get__");
18170 __Pyx_TraceCall("__get__", __pyx_f[0], 2028);
18172 /* "csamtools.pyx":2030
18173 * def __get__(self):
18174 * cdef bam1_t * src
18175 * src = self._delegate # <<<<<<<<<<<<<<
18176 * if src.core.l_qname == 0: return None
18177 * return <char *>bam1_qname( src )
18179 __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
18181 /* "csamtools.pyx":2031
18182 * cdef bam1_t * src
18183 * src = self._delegate
18184 * if src.core.l_qname == 0: return None # <<<<<<<<<<<<<<
18185 * return <char *>bam1_qname( src )
18188 __pyx_t_1 = (__pyx_v_src->core.l_qname == 0);
18190 __Pyx_XDECREF(__pyx_r);
18191 __Pyx_INCREF(Py_None);
18198 /* "csamtools.pyx":2032
18199 * src = self._delegate
18200 * if src.core.l_qname == 0: return None
18201 * return <char *>bam1_qname( src ) # <<<<<<<<<<<<<<
18203 * def __set__(self, qname ):
18205 __Pyx_XDECREF(__pyx_r);
18206 __pyx_t_2 = PyBytes_FromString(bam1_qname(__pyx_v_src)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18207 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
18208 __pyx_r = ((PyObject *)__pyx_t_2);
18212 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18215 __Pyx_XDECREF(__pyx_t_2);
18216 __Pyx_AddTraceback("csamtools.AlignedRead.qname.__get__");
18219 __Pyx_XGIVEREF(__pyx_r);
18220 __Pyx_TraceReturn(__pyx_r);
18221 __Pyx_RefNannyFinishContext();
18225 /* "csamtools.pyx":2034
18226 * return <char *>bam1_qname( src )
18228 * def __set__(self, qname ): # <<<<<<<<<<<<<<
18229 * if qname == None or len(qname) == 0: return
18230 * cdef bam1_t * src
18233 static int __pyx_pf_9csamtools_11AlignedRead_5qname_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qname); /*proto*/
18234 static int __pyx_pf_9csamtools_11AlignedRead_5qname_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qname) {
18235 bam1_t *__pyx_v_src;
18239 PyObject *__pyx_t_1 = NULL;
18241 Py_ssize_t __pyx_t_3;
18245 __Pyx_TraceDeclarations
18246 __Pyx_RefNannySetupContext("__set__");
18247 __Pyx_TraceCall("__set__", __pyx_f[0], 2034);
18249 /* "csamtools.pyx":2035
18251 * def __set__(self, qname ):
18252 * if qname == None or len(qname) == 0: return # <<<<<<<<<<<<<<
18253 * cdef bam1_t * src
18256 __pyx_t_1 = PyObject_RichCompare(__pyx_v_qname, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18257 __Pyx_GOTREF(__pyx_t_1);
18258 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18259 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18261 __pyx_t_3 = PyObject_Length(__pyx_v_qname); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18262 __pyx_t_4 = (__pyx_t_3 == 0);
18263 __pyx_t_5 = __pyx_t_4;
18265 __pyx_t_5 = __pyx_t_2;
18274 /* "csamtools.pyx":2040
18277 * src = self._delegate # <<<<<<<<<<<<<<
18278 * p = bam1_qname( src )
18281 __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
18283 /* "csamtools.pyx":2041
18285 * src = self._delegate
18286 * p = bam1_qname( src ) # <<<<<<<<<<<<<<
18288 * # the qname is \0 terminated
18290 __pyx_v_p = bam1_qname(__pyx_v_src);
18292 /* "csamtools.pyx":2044
18294 * # the qname is \0 terminated
18295 * l = len(qname) + 1 # <<<<<<<<<<<<<<
18296 * pysam_bam_update( src,
18297 * src.core.l_qname,
18299 __pyx_t_3 = PyObject_Length(__pyx_v_qname); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18300 __pyx_v_l = (__pyx_t_3 + 1);
18302 /* "csamtools.pyx":2048
18303 * src.core.l_qname,
18305 * <uint8_t*>p ) # <<<<<<<<<<<<<<
18307 * src.core.l_qname = l
18309 pysam_bam_update(__pyx_v_src, __pyx_v_src->core.l_qname, __pyx_v_l, ((uint8_t *)__pyx_v_p));
18311 /* "csamtools.pyx":2050
18314 * src.core.l_qname = l # <<<<<<<<<<<<<<
18316 * # re-acquire pointer to location in memory
18318 __pyx_v_src->core.l_qname = __pyx_v_l;
18320 /* "csamtools.pyx":2054
18321 * # re-acquire pointer to location in memory
18322 * # as it might have moved
18323 * p = bam1_qname(src) # <<<<<<<<<<<<<<
18325 * strncpy( p, qname, l )
18327 __pyx_v_p = bam1_qname(__pyx_v_src);
18329 /* "csamtools.pyx":2056
18330 * p = bam1_qname(src)
18332 * strncpy( p, qname, l ) # <<<<<<<<<<<<<<
18336 __pyx_t_6 = PyBytes_AsString(__pyx_v_qname); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18337 strncpy(__pyx_v_p, __pyx_t_6, __pyx_v_l);
18342 __Pyx_XDECREF(__pyx_t_1);
18343 __Pyx_AddTraceback("csamtools.AlignedRead.qname.__set__");
18346 __Pyx_TraceReturn(Py_None);
18347 __Pyx_RefNannyFinishContext();
18351 /* "csamtools.pyx":2061
18352 * """the :term:`cigar` alignment (None if not present).
18354 * def __get__(self): # <<<<<<<<<<<<<<
18355 * cdef uint32_t * cigar_p
18356 * cdef bam1_t * src
18359 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(PyObject *__pyx_v_self); /*proto*/
18360 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(PyObject *__pyx_v_self) {
18361 uint32_t *__pyx_v_cigar_p;
18362 bam1_t *__pyx_v_src;
18363 PyObject *__pyx_v_op;
18364 PyObject *__pyx_v_l;
18365 PyObject *__pyx_v_cigar;
18367 PyObject *__pyx_r = NULL;
18369 PyObject *__pyx_t_2 = NULL;
18370 uint32_t __pyx_t_3;
18371 PyObject *__pyx_t_4 = NULL;
18372 __Pyx_TraceDeclarations
18373 __Pyx_RefNannySetupContext("__get__");
18374 __Pyx_TraceCall("__get__", __pyx_f[0], 2061);
18375 __pyx_v_op = Py_None; __Pyx_INCREF(Py_None);
18376 __pyx_v_l = Py_None; __Pyx_INCREF(Py_None);
18377 __pyx_v_cigar = Py_None; __Pyx_INCREF(Py_None);
18379 /* "csamtools.pyx":2067
18382 * src = self._delegate # <<<<<<<<<<<<<<
18383 * if src.core.n_cigar == 0: return None
18386 __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
18388 /* "csamtools.pyx":2068
18390 * src = self._delegate
18391 * if src.core.n_cigar == 0: return None # <<<<<<<<<<<<<<
18395 __pyx_t_1 = (__pyx_v_src->core.n_cigar == 0);
18397 __Pyx_XDECREF(__pyx_r);
18398 __Pyx_INCREF(Py_None);
18405 /* "csamtools.pyx":2070
18406 * if src.core.n_cigar == 0: return None
18408 * cigar = [] # <<<<<<<<<<<<<<
18409 * cigar_p = bam1_cigar(src);
18410 * for k from 0 <= k < src.core.n_cigar:
18412 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18413 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
18414 __Pyx_DECREF(__pyx_v_cigar);
18415 __pyx_v_cigar = ((PyObject *)__pyx_t_2);
18418 /* "csamtools.pyx":2071
18421 * cigar_p = bam1_cigar(src); # <<<<<<<<<<<<<<
18422 * for k from 0 <= k < src.core.n_cigar:
18423 * op = cigar_p[k] & BAM_CIGAR_MASK
18425 __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
18427 /* "csamtools.pyx":2072
18429 * cigar_p = bam1_cigar(src);
18430 * for k from 0 <= k < src.core.n_cigar: # <<<<<<<<<<<<<<
18431 * op = cigar_p[k] & BAM_CIGAR_MASK
18432 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
18434 __pyx_t_3 = __pyx_v_src->core.n_cigar;
18435 for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
18437 /* "csamtools.pyx":2073
18438 * cigar_p = bam1_cigar(src);
18439 * for k from 0 <= k < src.core.n_cigar:
18440 * op = cigar_p[k] & BAM_CIGAR_MASK # <<<<<<<<<<<<<<
18441 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
18442 * cigar.append((op, l))
18444 __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 = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18445 __Pyx_GOTREF(__pyx_t_2);
18446 __Pyx_DECREF(__pyx_v_op);
18447 __pyx_v_op = __pyx_t_2;
18450 /* "csamtools.pyx":2074
18451 * for k from 0 <= k < src.core.n_cigar:
18452 * op = cigar_p[k] & BAM_CIGAR_MASK
18453 * l = cigar_p[k] >> BAM_CIGAR_SHIFT # <<<<<<<<<<<<<<
18454 * cigar.append((op, l))
18457 __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 = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18458 __Pyx_GOTREF(__pyx_t_2);
18459 __Pyx_DECREF(__pyx_v_l);
18460 __pyx_v_l = __pyx_t_2;
18463 /* "csamtools.pyx":2075
18464 * op = cigar_p[k] & BAM_CIGAR_MASK
18465 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
18466 * cigar.append((op, l)) # <<<<<<<<<<<<<<
18470 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18471 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
18472 __Pyx_INCREF(__pyx_v_op);
18473 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_op);
18474 __Pyx_GIVEREF(__pyx_v_op);
18475 __Pyx_INCREF(__pyx_v_l);
18476 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_l);
18477 __Pyx_GIVEREF(__pyx_v_l);
18478 __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 = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18479 __Pyx_GOTREF(__pyx_t_4);
18480 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
18481 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18484 /* "csamtools.pyx":2076
18485 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
18486 * cigar.append((op, l))
18487 * return cigar # <<<<<<<<<<<<<<
18489 * def __set__(self, values ):
18491 __Pyx_XDECREF(__pyx_r);
18492 __Pyx_INCREF(__pyx_v_cigar);
18493 __pyx_r = __pyx_v_cigar;
18496 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18499 __Pyx_XDECREF(__pyx_t_2);
18500 __Pyx_XDECREF(__pyx_t_4);
18501 __Pyx_AddTraceback("csamtools.AlignedRead.cigar.__get__");
18504 __Pyx_DECREF(__pyx_v_op);
18505 __Pyx_DECREF(__pyx_v_l);
18506 __Pyx_DECREF(__pyx_v_cigar);
18507 __Pyx_XGIVEREF(__pyx_r);
18508 __Pyx_TraceReturn(__pyx_r);
18509 __Pyx_RefNannyFinishContext();
18513 /* "csamtools.pyx":2078
18516 * def __set__(self, values ): # <<<<<<<<<<<<<<
18517 * if values == None or len(values) == 0: return
18518 * cdef uint32_t * p
18521 static int __pyx_pf_9csamtools_11AlignedRead_5cigar_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_values); /*proto*/
18522 static int __pyx_pf_9csamtools_11AlignedRead_5cigar_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_values) {
18523 uint32_t *__pyx_v_p;
18524 bam1_t *__pyx_v_src;
18525 PyObject *__pyx_v_op;
18526 PyObject *__pyx_v_l;
18529 PyObject *__pyx_t_1 = NULL;
18531 Py_ssize_t __pyx_t_3;
18534 PyObject *__pyx_t_6 = NULL;
18535 PyObject *__pyx_t_7 = NULL;
18536 PyObject *__pyx_t_8 = NULL;
18537 PyObject *__pyx_t_9 = NULL;
18538 uint32_t __pyx_t_10;
18539 __Pyx_TraceDeclarations
18540 __Pyx_RefNannySetupContext("__set__");
18541 __Pyx_TraceCall("__set__", __pyx_f[0], 2078);
18542 __pyx_v_op = Py_None; __Pyx_INCREF(Py_None);
18543 __pyx_v_l = Py_None; __Pyx_INCREF(Py_None);
18545 /* "csamtools.pyx":2079
18547 * def __set__(self, values ):
18548 * if values == None or len(values) == 0: return # <<<<<<<<<<<<<<
18549 * cdef uint32_t * p
18550 * cdef bam1_t * src
18552 __pyx_t_1 = PyObject_RichCompare(__pyx_v_values, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18553 __Pyx_GOTREF(__pyx_t_1);
18554 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18555 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18557 __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18558 __pyx_t_4 = (__pyx_t_3 == 0);
18559 __pyx_t_5 = __pyx_t_4;
18561 __pyx_t_5 = __pyx_t_2;
18570 /* "csamtools.pyx":2085
18573 * k = 0 # <<<<<<<<<<<<<<
18575 * src = self._delegate
18579 /* "csamtools.pyx":2087
18582 * src = self._delegate # <<<<<<<<<<<<<<
18584 * # get location of cigar string
18586 __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
18588 /* "csamtools.pyx":2090
18590 * # get location of cigar string
18591 * p = bam1_cigar(src) # <<<<<<<<<<<<<<
18593 * # create space for cigar data within src.data
18595 __pyx_v_p = bam1_cigar(__pyx_v_src);
18597 /* "csamtools.pyx":2095
18598 * pysam_bam_update( src,
18599 * src.core.n_cigar * 4,
18600 * len(values) * 4, # <<<<<<<<<<<<<<
18604 __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18606 /* "csamtools.pyx":2096
18607 * src.core.n_cigar * 4,
18609 * <uint8_t*>p ) # <<<<<<<<<<<<<<
18611 * # length is number of cigar operations, not bytes
18613 pysam_bam_update(__pyx_v_src, (__pyx_v_src->core.n_cigar * 4), (__pyx_t_3 * 4), ((uint8_t *)__pyx_v_p));
18615 /* "csamtools.pyx":2099
18617 * # length is number of cigar operations, not bytes
18618 * src.core.n_cigar = len(values) # <<<<<<<<<<<<<<
18620 * # re-acquire pointer to location in memory
18622 __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18623 __pyx_v_src->core.n_cigar = __pyx_t_3;
18625 /* "csamtools.pyx":2103
18626 * # re-acquire pointer to location in memory
18627 * # as it might have moved
18628 * p = bam1_cigar(src) # <<<<<<<<<<<<<<
18630 * # insert cigar operations
18632 __pyx_v_p = bam1_cigar(__pyx_v_src);
18634 /* "csamtools.pyx":2106
18636 * # insert cigar operations
18637 * for op, l in values: # <<<<<<<<<<<<<<
18638 * p[k] = l << BAM_CIGAR_SHIFT | op
18641 if (PyList_CheckExact(__pyx_v_values) || PyTuple_CheckExact(__pyx_v_values)) {
18642 __pyx_t_3 = 0; __pyx_t_1 = __pyx_v_values; __Pyx_INCREF(__pyx_t_1);
18644 __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18645 __Pyx_GOTREF(__pyx_t_1);
18648 if (likely(PyList_CheckExact(__pyx_t_1))) {
18649 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
18650 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
18651 } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
18652 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
18653 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++;
18655 __pyx_t_6 = PyIter_Next(__pyx_t_1);
18657 if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18660 __Pyx_GOTREF(__pyx_t_6);
18662 if (PyTuple_CheckExact(__pyx_t_6) && likely(PyTuple_GET_SIZE(__pyx_t_6) == 2)) {
18663 PyObject* tuple = __pyx_t_6;
18664 __pyx_t_7 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_7);
18665 __pyx_t_8 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_8);
18666 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18667 __Pyx_DECREF(__pyx_v_op);
18668 __pyx_v_op = __pyx_t_7;
18670 __Pyx_DECREF(__pyx_v_l);
18671 __pyx_v_l = __pyx_t_8;
18674 __pyx_t_9 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18675 __Pyx_GOTREF(__pyx_t_9);
18676 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18677 __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_9, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18678 __Pyx_GOTREF(__pyx_t_7);
18679 __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_9, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18680 __Pyx_GOTREF(__pyx_t_8);
18681 if (__Pyx_EndUnpack(__pyx_t_9, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18682 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18683 __Pyx_DECREF(__pyx_v_op);
18684 __pyx_v_op = __pyx_t_7;
18686 __Pyx_DECREF(__pyx_v_l);
18687 __pyx_v_l = __pyx_t_8;
18691 /* "csamtools.pyx":2107
18692 * # insert cigar operations
18693 * for op, l in values:
18694 * p[k] = l << BAM_CIGAR_SHIFT | op # <<<<<<<<<<<<<<
18698 __pyx_t_6 = PyNumber_Lshift(__pyx_v_l, __pyx_int_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18699 __Pyx_GOTREF(__pyx_t_6);
18700 __pyx_t_8 = PyNumber_Or(__pyx_t_6, __pyx_v_op); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18701 __Pyx_GOTREF(__pyx_t_8);
18702 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18703 __pyx_t_10 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_8); if (unlikely((__pyx_t_10 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18704 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
18705 (__pyx_v_p[__pyx_v_k]) = __pyx_t_10;
18707 /* "csamtools.pyx":2108
18708 * for op, l in values:
18709 * p[k] = l << BAM_CIGAR_SHIFT | op
18710 * k += 1 # <<<<<<<<<<<<<<
18712 * ## setting the cigar string also updates the "bin" attribute
18714 __pyx_v_k = (__pyx_v_k + 1);
18716 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18718 /* "csamtools.pyx":2111
18720 * ## setting the cigar string also updates the "bin" attribute
18721 * src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, p)) # <<<<<<<<<<<<<<
18725 __pyx_v_src->core.bin = bam_reg2bin(__pyx_v_src->core.pos, bam_calend((&__pyx_v_src->core), __pyx_v_p));
18730 __Pyx_XDECREF(__pyx_t_1);
18731 __Pyx_XDECREF(__pyx_t_6);
18732 __Pyx_XDECREF(__pyx_t_7);
18733 __Pyx_XDECREF(__pyx_t_8);
18734 __Pyx_XDECREF(__pyx_t_9);
18735 __Pyx_AddTraceback("csamtools.AlignedRead.cigar.__set__");
18738 __Pyx_DECREF(__pyx_v_op);
18739 __Pyx_DECREF(__pyx_v_l);
18740 __Pyx_TraceReturn(Py_None);
18741 __Pyx_RefNannyFinishContext();
18745 /* "csamtools.pyx":2115
18747 * """read sequence bases, including :term:`soft clipped` bases (None if not present)"""
18748 * def __get__(self): # <<<<<<<<<<<<<<
18749 * cdef bam1_t * src
18753 static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(PyObject *__pyx_v_self); /*proto*/
18754 static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(PyObject *__pyx_v_self) {
18755 bam1_t *__pyx_v_src;
18756 PyObject *__pyx_r = NULL;
18758 PyObject *__pyx_t_2 = NULL;
18759 __Pyx_TraceDeclarations
18760 __Pyx_RefNannySetupContext("__get__");
18761 __Pyx_TraceCall("__get__", __pyx_f[0], 2115);
18763 /* "csamtools.pyx":2118
18764 * cdef bam1_t * src
18766 * src = self._delegate # <<<<<<<<<<<<<<
18768 * if src.core.l_qseq == 0: return None
18770 __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
18772 /* "csamtools.pyx":2120
18773 * src = self._delegate
18775 * if src.core.l_qseq == 0: return None # <<<<<<<<<<<<<<
18777 * return get_seq_range(src, 0, src.core.l_qseq)
18779 __pyx_t_1 = (__pyx_v_src->core.l_qseq == 0);
18781 __Pyx_XDECREF(__pyx_r);
18782 __Pyx_INCREF(Py_None);
18789 /* "csamtools.pyx":2122
18790 * if src.core.l_qseq == 0: return None
18792 * return get_seq_range(src, 0, src.core.l_qseq) # <<<<<<<<<<<<<<
18794 * def __set__(self,seq):
18796 __Pyx_XDECREF(__pyx_r);
18797 __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 = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18798 __Pyx_GOTREF(__pyx_t_2);
18799 __pyx_r = __pyx_t_2;
18803 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18806 __Pyx_XDECREF(__pyx_t_2);
18807 __Pyx_AddTraceback("csamtools.AlignedRead.seq.__get__");
18810 __Pyx_XGIVEREF(__pyx_r);
18811 __Pyx_TraceReturn(__pyx_r);
18812 __Pyx_RefNannyFinishContext();
18816 /* "csamtools.pyx":2124
18817 * return get_seq_range(src, 0, src.core.l_qseq)
18819 * def __set__(self,seq): # <<<<<<<<<<<<<<
18820 * # samtools manages sequence and quality length memory together
18821 * # if no quality information is present, the first byte says 0xff.
18824 static int __pyx_pf_9csamtools_11AlignedRead_3seq_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq); /*proto*/
18825 static int __pyx_pf_9csamtools_11AlignedRead_3seq_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq) {
18826 bam1_t *__pyx_v_src;
18827 uint8_t *__pyx_v_p;
18831 int __pyx_v_nbytes_new;
18832 int __pyx_v_nbytes_old;
18834 PyObject *__pyx_t_1 = NULL;
18836 Py_ssize_t __pyx_t_3;
18842 __Pyx_TraceDeclarations
18843 __Pyx_RefNannySetupContext("__set__");
18844 __Pyx_TraceCall("__set__", __pyx_f[0], 2124);
18846 /* "csamtools.pyx":2128
18847 * # if no quality information is present, the first byte says 0xff.
18849 * if seq == None or len(seq) == 0: return # <<<<<<<<<<<<<<
18850 * cdef bam1_t * src
18853 __pyx_t_1 = PyObject_RichCompare(__pyx_v_seq, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18854 __Pyx_GOTREF(__pyx_t_1);
18855 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18856 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18858 __pyx_t_3 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18859 __pyx_t_4 = (__pyx_t_3 == 0);
18860 __pyx_t_5 = __pyx_t_4;
18862 __pyx_t_5 = __pyx_t_2;
18871 /* "csamtools.pyx":2134
18872 * cdef int l, k, nbytes_new, nbytes_old
18874 * src = self._delegate # <<<<<<<<<<<<<<
18878 __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
18880 /* "csamtools.pyx":2136
18881 * src = self._delegate
18883 * l = len(seq) # <<<<<<<<<<<<<<
18885 * # as the sequence is stored in half-bytes, the total length (sequence
18887 __pyx_t_3 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18888 __pyx_v_l = __pyx_t_3;
18890 /* "csamtools.pyx":2140
18891 * # as the sequence is stored in half-bytes, the total length (sequence
18892 * # plus quality scores) is (l+1)/2 + l
18893 * nbytes_new = (l+1)/2 + l # <<<<<<<<<<<<<<
18894 * nbytes_old = (src.core.l_qseq+1)/2 + src.core.l_qseq
18895 * # acquire pointer to location in memory
18897 __pyx_v_nbytes_new = (__Pyx_div_long((__pyx_v_l + 1), 2) + __pyx_v_l);
18899 /* "csamtools.pyx":2141
18900 * # plus quality scores) is (l+1)/2 + l
18901 * nbytes_new = (l+1)/2 + l
18902 * nbytes_old = (src.core.l_qseq+1)/2 + src.core.l_qseq # <<<<<<<<<<<<<<
18903 * # acquire pointer to location in memory
18904 * p = bam1_seq( src )
18906 __pyx_v_nbytes_old = (__Pyx_div_long((__pyx_v_src->core.l_qseq + 1), 2) + __pyx_v_src->core.l_qseq);
18908 /* "csamtools.pyx":2143
18909 * nbytes_old = (src.core.l_qseq+1)/2 + src.core.l_qseq
18910 * # acquire pointer to location in memory
18911 * p = bam1_seq( src ) # <<<<<<<<<<<<<<
18912 * src.core.l_qseq = l
18915 __pyx_v_p = bam1_seq(__pyx_v_src);
18917 /* "csamtools.pyx":2144
18918 * # acquire pointer to location in memory
18919 * p = bam1_seq( src )
18920 * src.core.l_qseq = l # <<<<<<<<<<<<<<
18922 * pysam_bam_update( src,
18924 __pyx_v_src->core.l_qseq = __pyx_v_l;
18926 /* "csamtools.pyx":2149
18929 * p) # <<<<<<<<<<<<<<
18930 * # re-acquire pointer to location in memory
18931 * # as it might have moved
18933 pysam_bam_update(__pyx_v_src, __pyx_v_nbytes_old, __pyx_v_nbytes_new, __pyx_v_p);
18935 /* "csamtools.pyx":2152
18936 * # re-acquire pointer to location in memory
18937 * # as it might have moved
18938 * p = bam1_seq( src ) # <<<<<<<<<<<<<<
18939 * for k from 0 <= k < nbytes_new: p[k] = 0
18940 * # convert to C string
18942 __pyx_v_p = bam1_seq(__pyx_v_src);
18944 /* "csamtools.pyx":2153
18945 * # as it might have moved
18946 * p = bam1_seq( src )
18947 * for k from 0 <= k < nbytes_new: p[k] = 0 # <<<<<<<<<<<<<<
18948 * # convert to C string
18951 __pyx_t_6 = __pyx_v_nbytes_new;
18952 for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_6; __pyx_v_k++) {
18953 (__pyx_v_p[__pyx_v_k]) = 0;
18956 /* "csamtools.pyx":2155
18957 * for k from 0 <= k < nbytes_new: p[k] = 0
18958 * # convert to C string
18959 * s = seq # <<<<<<<<<<<<<<
18960 * for k from 0 <= k < l:
18961 * p[k/2] |= pysam_translate_sequence(s[k]) << 4 * (1 - k % 2)
18963 __pyx_t_7 = PyBytes_AsString(__pyx_v_seq); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
18964 __pyx_v_s = __pyx_t_7;
18966 /* "csamtools.pyx":2156
18967 * # convert to C string
18969 * for k from 0 <= k < l: # <<<<<<<<<<<<<<
18970 * p[k/2] |= pysam_translate_sequence(s[k]) << 4 * (1 - k % 2)
18973 __pyx_t_6 = __pyx_v_l;
18974 for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_6; __pyx_v_k++) {
18976 /* "csamtools.pyx":2157
18978 * for k from 0 <= k < l:
18979 * p[k/2] |= pysam_translate_sequence(s[k]) << 4 * (1 - k % 2) # <<<<<<<<<<<<<<
18981 * # erase qualities
18983 __pyx_t_8 = __Pyx_div_long(__pyx_v_k, 2);
18984 (__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)))));
18987 /* "csamtools.pyx":2160
18989 * # erase qualities
18990 * p = bam1_qual( src ) # <<<<<<<<<<<<<<
18994 __pyx_v_p = bam1_qual(__pyx_v_src);
18996 /* "csamtools.pyx":2161
18997 * # erase qualities
18998 * p = bam1_qual( src )
18999 * p[0] = 0xff # <<<<<<<<<<<<<<
19003 (__pyx_v_p[0]) = 0xff;
19008 __Pyx_XDECREF(__pyx_t_1);
19009 __Pyx_AddTraceback("csamtools.AlignedRead.seq.__set__");
19012 __Pyx_TraceReturn(Py_None);
19013 __Pyx_RefNannyFinishContext();
19017 /* "csamtools.pyx":2166
19019 * """read sequence base qualities, including :term:`soft clipped` bases (None if not present)"""
19020 * def __get__(self): # <<<<<<<<<<<<<<
19022 * cdef bam1_t * src
19025 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(PyObject *__pyx_v_self); /*proto*/
19026 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(PyObject *__pyx_v_self) {
19027 bam1_t *__pyx_v_src;
19028 PyObject *__pyx_r = NULL;
19030 PyObject *__pyx_t_2 = NULL;
19031 __Pyx_TraceDeclarations
19032 __Pyx_RefNannySetupContext("__get__");
19033 __Pyx_TraceCall("__get__", __pyx_f[0], 2166);
19035 /* "csamtools.pyx":2171
19038 * src = self._delegate # <<<<<<<<<<<<<<
19040 * if src.core.l_qseq == 0: return None
19042 __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
19044 /* "csamtools.pyx":2173
19045 * src = self._delegate
19047 * if src.core.l_qseq == 0: return None # <<<<<<<<<<<<<<
19049 * return get_qual_range(src, 0, src.core.l_qseq)
19051 __pyx_t_1 = (__pyx_v_src->core.l_qseq == 0);
19053 __Pyx_XDECREF(__pyx_r);
19054 __Pyx_INCREF(Py_None);
19061 /* "csamtools.pyx":2175
19062 * if src.core.l_qseq == 0: return None
19064 * return get_qual_range(src, 0, src.core.l_qseq) # <<<<<<<<<<<<<<
19066 * def __set__(self,qual):
19068 __Pyx_XDECREF(__pyx_r);
19069 __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 = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19070 __Pyx_GOTREF(__pyx_t_2);
19071 __pyx_r = __pyx_t_2;
19075 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19078 __Pyx_XDECREF(__pyx_t_2);
19079 __Pyx_AddTraceback("csamtools.AlignedRead.qual.__get__");
19082 __Pyx_XGIVEREF(__pyx_r);
19083 __Pyx_TraceReturn(__pyx_r);
19084 __Pyx_RefNannyFinishContext();
19088 /* "csamtools.pyx":2177
19089 * return get_qual_range(src, 0, src.core.l_qseq)
19091 * def __set__(self,qual): # <<<<<<<<<<<<<<
19092 * # note that space is already allocated via the sequences
19093 * cdef bam1_t * src
19096 static int __pyx_pf_9csamtools_11AlignedRead_4qual_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual); /*proto*/
19097 static int __pyx_pf_9csamtools_11AlignedRead_4qual_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual) {
19098 bam1_t *__pyx_v_src;
19099 uint8_t *__pyx_v_p;
19104 PyObject *__pyx_t_1 = NULL;
19106 Py_ssize_t __pyx_t_3;
19110 PyObject *__pyx_t_7 = NULL;
19111 PyObject *__pyx_t_8 = NULL;
19113 __Pyx_TraceDeclarations
19114 __Pyx_RefNannySetupContext("__set__");
19115 __Pyx_TraceCall("__set__", __pyx_f[0], 2177);
19117 /* "csamtools.pyx":2184
19120 * src = self._delegate # <<<<<<<<<<<<<<
19121 * p = bam1_qual( src )
19122 * if qual == None or len(qual) == 0:
19124 __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
19126 /* "csamtools.pyx":2185
19128 * src = self._delegate
19129 * p = bam1_qual( src ) # <<<<<<<<<<<<<<
19130 * if qual == None or len(qual) == 0:
19131 * # if absent - set to 0xff
19133 __pyx_v_p = bam1_qual(__pyx_v_src);
19135 /* "csamtools.pyx":2186
19136 * src = self._delegate
19137 * p = bam1_qual( src )
19138 * if qual == None or len(qual) == 0: # <<<<<<<<<<<<<<
19139 * # if absent - set to 0xff
19142 __pyx_t_1 = PyObject_RichCompare(__pyx_v_qual, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19143 __Pyx_GOTREF(__pyx_t_1);
19144 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19145 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19147 __pyx_t_3 = PyObject_Length(__pyx_v_qual); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19148 __pyx_t_4 = (__pyx_t_3 == 0);
19149 __pyx_t_5 = __pyx_t_4;
19151 __pyx_t_5 = __pyx_t_2;
19155 /* "csamtools.pyx":2188
19156 * if qual == None or len(qual) == 0:
19157 * # if absent - set to 0xff
19158 * p[0] = 0xff # <<<<<<<<<<<<<<
19162 (__pyx_v_p[0]) = 0xff;
19164 /* "csamtools.pyx":2189
19165 * # if absent - set to 0xff
19167 * return # <<<<<<<<<<<<<<
19169 * # convert to C string
19177 /* "csamtools.pyx":2192
19179 * # convert to C string
19180 * q = qual # <<<<<<<<<<<<<<
19182 * if src.core.l_qseq != l:
19184 __pyx_t_6 = PyBytes_AsString(__pyx_v_qual); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19185 __pyx_v_q = __pyx_t_6;
19187 /* "csamtools.pyx":2193
19188 * # convert to C string
19190 * l = len(qual) # <<<<<<<<<<<<<<
19191 * if src.core.l_qseq != l:
19192 * raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq))
19194 __pyx_t_3 = PyObject_Length(__pyx_v_qual); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19195 __pyx_v_l = __pyx_t_3;
19197 /* "csamtools.pyx":2194
19200 * if src.core.l_qseq != l: # <<<<<<<<<<<<<<
19201 * raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq))
19202 * assert src.core.l_qseq == l
19204 __pyx_t_5 = (__pyx_v_src->core.l_qseq != __pyx_v_l);
19207 /* "csamtools.pyx":2195
19209 * if src.core.l_qseq != l:
19210 * raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq)) # <<<<<<<<<<<<<<
19211 * assert src.core.l_qseq == l
19212 * for k from 0 <= k < l:
19214 __pyx_t_1 = PyInt_FromLong(__pyx_v_l); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19215 __Pyx_GOTREF(__pyx_t_1);
19216 __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 = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19217 __Pyx_GOTREF(__pyx_t_7);
19218 __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19219 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
19220 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
19221 __Pyx_GIVEREF(__pyx_t_1);
19222 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
19223 __Pyx_GIVEREF(__pyx_t_7);
19226 __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_120), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19227 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
19228 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
19229 __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19230 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
19231 PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7));
19232 __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
19234 __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 = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19235 __Pyx_GOTREF(__pyx_t_7);
19236 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
19237 __Pyx_Raise(__pyx_t_7, 0, 0);
19238 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
19239 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19244 /* "csamtools.pyx":2196
19245 * if src.core.l_qseq != l:
19246 * raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq))
19247 * assert src.core.l_qseq == l # <<<<<<<<<<<<<<
19248 * for k from 0 <= k < l:
19249 * p[k] = <uint8_t>q[k] - 33
19251 #ifndef CYTHON_WITHOUT_ASSERTIONS
19252 if (unlikely(!(__pyx_v_src->core.l_qseq == __pyx_v_l))) {
19253 PyErr_SetNone(PyExc_AssertionError);
19254 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19258 /* "csamtools.pyx":2197
19259 * raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq))
19260 * assert src.core.l_qseq == l
19261 * for k from 0 <= k < l: # <<<<<<<<<<<<<<
19262 * p[k] = <uint8_t>q[k] - 33
19265 __pyx_t_9 = __pyx_v_l;
19266 for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_9; __pyx_v_k++) {
19268 /* "csamtools.pyx":2198
19269 * assert src.core.l_qseq == l
19270 * for k from 0 <= k < l:
19271 * p[k] = <uint8_t>q[k] - 33 # <<<<<<<<<<<<<<
19275 (__pyx_v_p[__pyx_v_k]) = (((uint8_t)(__pyx_v_q[__pyx_v_k])) - 33);
19281 __Pyx_XDECREF(__pyx_t_1);
19282 __Pyx_XDECREF(__pyx_t_7);
19283 __Pyx_XDECREF(__pyx_t_8);
19284 __Pyx_AddTraceback("csamtools.AlignedRead.qual.__set__");
19287 __Pyx_TraceReturn(Py_None);
19288 __Pyx_RefNannyFinishContext();
19292 /* "csamtools.pyx":2210
19293 * were not considered for alignment may have been retained."""
19295 * def __get__(self): # <<<<<<<<<<<<<<
19296 * cdef bam1_t * src
19297 * cdef uint32_t start, end
19300 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(PyObject *__pyx_v_self); /*proto*/
19301 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(PyObject *__pyx_v_self) {
19302 bam1_t *__pyx_v_src;
19303 uint32_t __pyx_v_start;
19304 uint32_t __pyx_v_end;
19305 PyObject *__pyx_r = NULL;
19308 PyObject *__pyx_t_3 = NULL;
19309 __Pyx_TraceDeclarations
19310 __Pyx_RefNannySetupContext("__get__");
19311 __Pyx_TraceCall("__get__", __pyx_f[0], 2210);
19313 /* "csamtools.pyx":2215
19316 * src = self._delegate # <<<<<<<<<<<<<<
19318 * if src.core.l_qseq == 0: return None
19320 __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
19322 /* "csamtools.pyx":2217
19323 * src = self._delegate
19325 * if src.core.l_qseq == 0: return None # <<<<<<<<<<<<<<
19327 * start = query_start(src)
19329 __pyx_t_1 = (__pyx_v_src->core.l_qseq == 0);
19331 __Pyx_XDECREF(__pyx_r);
19332 __Pyx_INCREF(Py_None);
19339 /* "csamtools.pyx":2219
19340 * if src.core.l_qseq == 0: return None
19342 * start = query_start(src) # <<<<<<<<<<<<<<
19343 * end = query_end(src)
19346 __pyx_t_2 = __pyx_f_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19347 __pyx_v_start = __pyx_t_2;
19349 /* "csamtools.pyx":2220
19351 * start = query_start(src)
19352 * end = query_end(src) # <<<<<<<<<<<<<<
19354 * return get_seq_range(src, start, end)
19356 __pyx_t_2 = __pyx_f_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19357 __pyx_v_end = __pyx_t_2;
19359 /* "csamtools.pyx":2222
19360 * end = query_end(src)
19362 * return get_seq_range(src, start, end) # <<<<<<<<<<<<<<
19366 __Pyx_XDECREF(__pyx_r);
19367 __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 = 2222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19368 __Pyx_GOTREF(__pyx_t_3);
19369 __pyx_r = __pyx_t_3;
19373 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19376 __Pyx_XDECREF(__pyx_t_3);
19377 __Pyx_AddTraceback("csamtools.AlignedRead.query.__get__");
19380 __Pyx_XGIVEREF(__pyx_r);
19381 __Pyx_TraceReturn(__pyx_r);
19382 __Pyx_RefNannyFinishContext();
19386 /* "csamtools.pyx":2226
19388 * """aligned query sequence quality values (None if not present)"""
19389 * def __get__(self): # <<<<<<<<<<<<<<
19390 * cdef bam1_t * src
19391 * cdef uint32_t start, end
19394 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(PyObject *__pyx_v_self); /*proto*/
19395 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(PyObject *__pyx_v_self) {
19396 bam1_t *__pyx_v_src;
19397 uint32_t __pyx_v_start;
19398 uint32_t __pyx_v_end;
19399 PyObject *__pyx_r = NULL;
19402 PyObject *__pyx_t_3 = NULL;
19403 __Pyx_TraceDeclarations
19404 __Pyx_RefNannySetupContext("__get__");
19405 __Pyx_TraceCall("__get__", __pyx_f[0], 2226);
19407 /* "csamtools.pyx":2231
19410 * src = self._delegate # <<<<<<<<<<<<<<
19412 * if src.core.l_qseq == 0: return None
19414 __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
19416 /* "csamtools.pyx":2233
19417 * src = self._delegate
19419 * if src.core.l_qseq == 0: return None # <<<<<<<<<<<<<<
19421 * start = query_start(src)
19423 __pyx_t_1 = (__pyx_v_src->core.l_qseq == 0);
19425 __Pyx_XDECREF(__pyx_r);
19426 __Pyx_INCREF(Py_None);
19433 /* "csamtools.pyx":2235
19434 * if src.core.l_qseq == 0: return None
19436 * start = query_start(src) # <<<<<<<<<<<<<<
19437 * end = query_end(src)
19440 __pyx_t_2 = __pyx_f_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19441 __pyx_v_start = __pyx_t_2;
19443 /* "csamtools.pyx":2236
19445 * start = query_start(src)
19446 * end = query_end(src) # <<<<<<<<<<<<<<
19448 * return get_qual_range(src, start, end)
19450 __pyx_t_2 = __pyx_f_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19451 __pyx_v_end = __pyx_t_2;
19453 /* "csamtools.pyx":2238
19454 * end = query_end(src)
19456 * return get_qual_range(src, start, end) # <<<<<<<<<<<<<<
19460 __Pyx_XDECREF(__pyx_r);
19461 __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 = 2238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19462 __Pyx_GOTREF(__pyx_t_3);
19463 __pyx_r = __pyx_t_3;
19467 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19470 __Pyx_XDECREF(__pyx_t_3);
19471 __Pyx_AddTraceback("csamtools.AlignedRead.qqual.__get__");
19474 __Pyx_XGIVEREF(__pyx_r);
19475 __Pyx_TraceReturn(__pyx_r);
19476 __Pyx_RefNannyFinishContext();
19480 /* "csamtools.pyx":2242
19482 * """start index of the aligned query portion of the sequence (0-based, inclusive)"""
19483 * def __get__(self): # <<<<<<<<<<<<<<
19484 * return query_start(self._delegate)
19488 static PyObject *__pyx_pf_9csamtools_11AlignedRead_6qstart___get__(PyObject *__pyx_v_self); /*proto*/
19489 static PyObject *__pyx_pf_9csamtools_11AlignedRead_6qstart___get__(PyObject *__pyx_v_self) {
19490 PyObject *__pyx_r = NULL;
19492 PyObject *__pyx_t_2 = NULL;
19493 __Pyx_TraceDeclarations
19494 __Pyx_RefNannySetupContext("__get__");
19495 __Pyx_TraceCall("__get__", __pyx_f[0], 2242);
19497 /* "csamtools.pyx":2243
19498 * """start index of the aligned query portion of the sequence (0-based, inclusive)"""
19499 * def __get__(self):
19500 * return query_start(self._delegate) # <<<<<<<<<<<<<<
19504 __Pyx_XDECREF(__pyx_r);
19505 __pyx_t_1 = __pyx_f_9csamtools_query_start(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19506 __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19507 __Pyx_GOTREF(__pyx_t_2);
19508 __pyx_r = __pyx_t_2;
19512 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19515 __Pyx_XDECREF(__pyx_t_2);
19516 __Pyx_AddTraceback("csamtools.AlignedRead.qstart.__get__");
19519 __Pyx_XGIVEREF(__pyx_r);
19520 __Pyx_TraceReturn(__pyx_r);
19521 __Pyx_RefNannyFinishContext();
19525 /* "csamtools.pyx":2247
19527 * """end index of the aligned query portion of the sequence (0-based, exclusive)"""
19528 * def __get__(self): # <<<<<<<<<<<<<<
19529 * return query_end(self._delegate)
19533 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qend___get__(PyObject *__pyx_v_self); /*proto*/
19534 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qend___get__(PyObject *__pyx_v_self) {
19535 PyObject *__pyx_r = NULL;
19537 PyObject *__pyx_t_2 = NULL;
19538 __Pyx_TraceDeclarations
19539 __Pyx_RefNannySetupContext("__get__");
19540 __Pyx_TraceCall("__get__", __pyx_f[0], 2247);
19542 /* "csamtools.pyx":2248
19543 * """end index of the aligned query portion of the sequence (0-based, exclusive)"""
19544 * def __get__(self):
19545 * return query_end(self._delegate) # <<<<<<<<<<<<<<
19549 __Pyx_XDECREF(__pyx_r);
19550 __pyx_t_1 = __pyx_f_9csamtools_query_end(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19551 __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19552 __Pyx_GOTREF(__pyx_t_2);
19553 __pyx_r = __pyx_t_2;
19557 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19560 __Pyx_XDECREF(__pyx_t_2);
19561 __Pyx_AddTraceback("csamtools.AlignedRead.qend.__get__");
19564 __Pyx_XGIVEREF(__pyx_r);
19565 __Pyx_TraceReturn(__pyx_r);
19566 __Pyx_RefNannyFinishContext();
19570 /* "csamtools.pyx":2252
19572 * """Length of the aligned query sequence"""
19573 * def __get__(self): # <<<<<<<<<<<<<<
19574 * cdef bam1_t * src
19575 * src = self._delegate
19578 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qlen___get__(PyObject *__pyx_v_self); /*proto*/
19579 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qlen___get__(PyObject *__pyx_v_self) {
19580 bam1_t *__pyx_v_src;
19581 PyObject *__pyx_r = NULL;
19584 PyObject *__pyx_t_3 = NULL;
19585 __Pyx_TraceDeclarations
19586 __Pyx_RefNannySetupContext("__get__");
19587 __Pyx_TraceCall("__get__", __pyx_f[0], 2252);
19589 /* "csamtools.pyx":2254
19590 * def __get__(self):
19591 * cdef bam1_t * src
19592 * src = self._delegate # <<<<<<<<<<<<<<
19593 * return query_end(src)-query_start(src)
19596 __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
19598 /* "csamtools.pyx":2255
19599 * cdef bam1_t * src
19600 * src = self._delegate
19601 * return query_end(src)-query_start(src) # <<<<<<<<<<<<<<
19605 __Pyx_XDECREF(__pyx_r);
19606 __pyx_t_1 = __pyx_f_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19607 __pyx_t_2 = __pyx_f_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19608 __pyx_t_3 = __Pyx_PyInt_to_py_int32_t((__pyx_t_1 - __pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19609 __Pyx_GOTREF(__pyx_t_3);
19610 __pyx_r = __pyx_t_3;
19614 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19617 __Pyx_XDECREF(__pyx_t_3);
19618 __Pyx_AddTraceback("csamtools.AlignedRead.qlen.__get__");
19621 __Pyx_XGIVEREF(__pyx_r);
19622 __Pyx_TraceReturn(__pyx_r);
19623 __Pyx_RefNannyFinishContext();
19627 /* "csamtools.pyx":2272
19630 * def __get__(self): # <<<<<<<<<<<<<<
19632 * cdef bam1_t * src
19635 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx_v_self); /*proto*/
19636 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx_v_self) {
19637 bam1_t *__pyx_v_src;
19638 uint8_t *__pyx_v_s;
19639 char __pyx_v_auxtag[3];
19640 char __pyx_v_auxtype;
19641 PyObject *__pyx_v_result;
19642 PyObject *__pyx_v_value;
19643 PyObject *__pyx_r = NULL;
19645 PyObject *__pyx_t_2 = NULL;
19649 PyObject *__pyx_t_6 = NULL;
19650 Py_ssize_t __pyx_t_7;
19652 __Pyx_TraceDeclarations
19653 __Pyx_RefNannySetupContext("__get__");
19654 __Pyx_TraceCall("__get__", __pyx_f[0], 2272);
19655 __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
19656 __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);
19658 /* "csamtools.pyx":2279
19659 * cdef char auxtype
19661 * src = self._delegate # <<<<<<<<<<<<<<
19662 * if src.l_aux == 0: return []
19665 __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
19667 /* "csamtools.pyx":2280
19669 * src = self._delegate
19670 * if src.l_aux == 0: return [] # <<<<<<<<<<<<<<
19672 * s = bam1_aux( src )
19674 __pyx_t_1 = (__pyx_v_src->l_aux == 0);
19676 __Pyx_XDECREF(__pyx_r);
19677 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19678 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
19679 __pyx_r = ((PyObject *)__pyx_t_2);
19686 /* "csamtools.pyx":2282
19687 * if src.l_aux == 0: return []
19689 * s = bam1_aux( src ) # <<<<<<<<<<<<<<
19693 __pyx_v_s = bam1_aux(__pyx_v_src);
19695 /* "csamtools.pyx":2283
19697 * s = bam1_aux( src )
19698 * result = [] # <<<<<<<<<<<<<<
19700 * while s < (src.data + src.data_len):
19702 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19703 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
19704 __Pyx_DECREF(((PyObject *)__pyx_v_result));
19705 __pyx_v_result = __pyx_t_2;
19708 /* "csamtools.pyx":2284
19709 * s = bam1_aux( src )
19711 * auxtag[2] = 0 # <<<<<<<<<<<<<<
19712 * while s < (src.data + src.data_len):
19715 (__pyx_v_auxtag[2]) = 0;
19717 /* "csamtools.pyx":2285
19720 * while s < (src.data + src.data_len): # <<<<<<<<<<<<<<
19725 __pyx_t_1 = (__pyx_v_s < (__pyx_v_src->data + __pyx_v_src->data_len));
19726 if (!__pyx_t_1) break;
19728 /* "csamtools.pyx":2287
19729 * while s < (src.data + src.data_len):
19731 * auxtag[0] = s[0] # <<<<<<<<<<<<<<
19735 (__pyx_v_auxtag[0]) = (__pyx_v_s[0]);
19737 /* "csamtools.pyx":2288
19740 * auxtag[1] = s[1] # <<<<<<<<<<<<<<
19744 (__pyx_v_auxtag[1]) = (__pyx_v_s[1]);
19746 /* "csamtools.pyx":2289
19749 * s += 2 # <<<<<<<<<<<<<<
19753 __pyx_v_s = (__pyx_v_s + 2);
19755 /* "csamtools.pyx":2290
19758 * auxtype = s[0] # <<<<<<<<<<<<<<
19760 * if auxtype in ('c', 'C'):
19762 __pyx_v_auxtype = (__pyx_v_s[0]);
19764 /* "csamtools.pyx":2292
19767 * if auxtype in ('c', 'C'): # <<<<<<<<<<<<<<
19768 * value = <int>bam_aux2i(s)
19771 __pyx_t_3 = __pyx_v_auxtype;
19772 __pyx_t_1 = (__pyx_t_3 == 'c');
19774 __pyx_t_4 = (__pyx_t_3 == 'C');
19775 __pyx_t_5 = __pyx_t_4;
19777 __pyx_t_5 = __pyx_t_1;
19779 __pyx_t_1 = __pyx_t_5;
19782 /* "csamtools.pyx":2293
19784 * if auxtype in ('c', 'C'):
19785 * value = <int>bam_aux2i(s) # <<<<<<<<<<<<<<
19787 * elif auxtype in ('s', 'S'):
19789 __pyx_t_2 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19790 __Pyx_GOTREF(__pyx_t_2);
19791 __Pyx_DECREF(__pyx_v_value);
19792 __pyx_v_value = __pyx_t_2;
19795 /* "csamtools.pyx":2294
19796 * if auxtype in ('c', 'C'):
19797 * value = <int>bam_aux2i(s)
19798 * s += 1 # <<<<<<<<<<<<<<
19799 * elif auxtype in ('s', 'S'):
19800 * value = <int>bam_aux2i(s)
19802 __pyx_v_s = (__pyx_v_s + 1);
19806 /* "csamtools.pyx":2295
19807 * value = <int>bam_aux2i(s)
19809 * elif auxtype in ('s', 'S'): # <<<<<<<<<<<<<<
19810 * value = <int>bam_aux2i(s)
19813 __pyx_t_3 = __pyx_v_auxtype;
19814 __pyx_t_1 = (__pyx_t_3 == 's');
19816 __pyx_t_5 = (__pyx_t_3 == 'S');
19817 __pyx_t_4 = __pyx_t_5;
19819 __pyx_t_4 = __pyx_t_1;
19821 __pyx_t_1 = __pyx_t_4;
19824 /* "csamtools.pyx":2296
19826 * elif auxtype in ('s', 'S'):
19827 * value = <int>bam_aux2i(s) # <<<<<<<<<<<<<<
19829 * elif auxtype in ('i', 'I'):
19831 __pyx_t_2 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19832 __Pyx_GOTREF(__pyx_t_2);
19833 __Pyx_DECREF(__pyx_v_value);
19834 __pyx_v_value = __pyx_t_2;
19837 /* "csamtools.pyx":2297
19838 * elif auxtype in ('s', 'S'):
19839 * value = <int>bam_aux2i(s)
19840 * s += 2 # <<<<<<<<<<<<<<
19841 * elif auxtype in ('i', 'I'):
19842 * value = <float>bam_aux2i(s)
19844 __pyx_v_s = (__pyx_v_s + 2);
19848 /* "csamtools.pyx":2298
19849 * value = <int>bam_aux2i(s)
19851 * elif auxtype in ('i', 'I'): # <<<<<<<<<<<<<<
19852 * value = <float>bam_aux2i(s)
19855 __pyx_t_3 = __pyx_v_auxtype;
19856 __pyx_t_1 = (__pyx_t_3 == 'i');
19858 __pyx_t_4 = (__pyx_t_3 == 'I');
19859 __pyx_t_5 = __pyx_t_4;
19861 __pyx_t_5 = __pyx_t_1;
19863 __pyx_t_1 = __pyx_t_5;
19866 /* "csamtools.pyx":2299
19868 * elif auxtype in ('i', 'I'):
19869 * value = <float>bam_aux2i(s) # <<<<<<<<<<<<<<
19871 * elif auxtype == 'f':
19873 __pyx_t_2 = PyFloat_FromDouble(((float)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19874 __Pyx_GOTREF(__pyx_t_2);
19875 __Pyx_DECREF(__pyx_v_value);
19876 __pyx_v_value = __pyx_t_2;
19879 /* "csamtools.pyx":2300
19880 * elif auxtype in ('i', 'I'):
19881 * value = <float>bam_aux2i(s)
19882 * s += 4 # <<<<<<<<<<<<<<
19883 * elif auxtype == 'f':
19884 * value = <float>bam_aux2f(s)
19886 __pyx_v_s = (__pyx_v_s + 4);
19890 /* "csamtools.pyx":2301
19891 * value = <float>bam_aux2i(s)
19893 * elif auxtype == 'f': # <<<<<<<<<<<<<<
19894 * value = <float>bam_aux2f(s)
19897 __pyx_t_1 = (__pyx_v_auxtype == 'f');
19900 /* "csamtools.pyx":2302
19902 * elif auxtype == 'f':
19903 * value = <float>bam_aux2f(s) # <<<<<<<<<<<<<<
19905 * elif auxtype == 'd':
19907 __pyx_t_2 = PyFloat_FromDouble(bam_aux2f(__pyx_v_s)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19908 __Pyx_GOTREF(__pyx_t_2);
19909 __Pyx_DECREF(__pyx_v_value);
19910 __pyx_v_value = __pyx_t_2;
19913 /* "csamtools.pyx":2303
19914 * elif auxtype == 'f':
19915 * value = <float>bam_aux2f(s)
19916 * s += 4 # <<<<<<<<<<<<<<
19917 * elif auxtype == 'd':
19918 * value = <double>bam_aux2d(s)
19920 __pyx_v_s = (__pyx_v_s + 4);
19924 /* "csamtools.pyx":2304
19925 * value = <float>bam_aux2f(s)
19927 * elif auxtype == 'd': # <<<<<<<<<<<<<<
19928 * value = <double>bam_aux2d(s)
19931 __pyx_t_1 = (__pyx_v_auxtype == 'd');
19934 /* "csamtools.pyx":2305
19936 * elif auxtype == 'd':
19937 * value = <double>bam_aux2d(s) # <<<<<<<<<<<<<<
19939 * elif auxtype == 'A':
19941 __pyx_t_2 = PyFloat_FromDouble(bam_aux2d(__pyx_v_s)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19942 __Pyx_GOTREF(__pyx_t_2);
19943 __Pyx_DECREF(__pyx_v_value);
19944 __pyx_v_value = __pyx_t_2;
19947 /* "csamtools.pyx":2306
19948 * elif auxtype == 'd':
19949 * value = <double>bam_aux2d(s)
19950 * s += 8 # <<<<<<<<<<<<<<
19951 * elif auxtype == 'A':
19952 * value = "%c" % <char>bam_aux2A(s)
19954 __pyx_v_s = (__pyx_v_s + 8);
19958 /* "csamtools.pyx":2307
19959 * value = <double>bam_aux2d(s)
19961 * elif auxtype == 'A': # <<<<<<<<<<<<<<
19962 * value = "%c" % <char>bam_aux2A(s)
19965 __pyx_t_1 = (__pyx_v_auxtype == 'A');
19968 /* "csamtools.pyx":2308
19970 * elif auxtype == 'A':
19971 * value = "%c" % <char>bam_aux2A(s) # <<<<<<<<<<<<<<
19973 * elif auxtype in ('Z', 'H'):
19975 __pyx_t_2 = PyInt_FromLong(bam_aux2A(__pyx_v_s)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19976 __Pyx_GOTREF(__pyx_t_2);
19977 __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_121), __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
19978 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
19979 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19980 __Pyx_DECREF(__pyx_v_value);
19981 __pyx_v_value = ((PyObject *)__pyx_t_6);
19984 /* "csamtools.pyx":2309
19985 * elif auxtype == 'A':
19986 * value = "%c" % <char>bam_aux2A(s)
19987 * s += 1 # <<<<<<<<<<<<<<
19988 * elif auxtype in ('Z', 'H'):
19989 * value = <char*>bam_aux2Z(s)
19991 __pyx_v_s = (__pyx_v_s + 1);
19995 /* "csamtools.pyx":2310
19996 * value = "%c" % <char>bam_aux2A(s)
19998 * elif auxtype in ('Z', 'H'): # <<<<<<<<<<<<<<
19999 * value = <char*>bam_aux2Z(s)
20000 * # +1 for NULL terminated string
20002 __pyx_t_3 = __pyx_v_auxtype;
20003 __pyx_t_1 = (__pyx_t_3 == 'Z');
20005 __pyx_t_5 = (__pyx_t_3 == 'H');
20006 __pyx_t_4 = __pyx_t_5;
20008 __pyx_t_4 = __pyx_t_1;
20010 __pyx_t_1 = __pyx_t_4;
20013 /* "csamtools.pyx":2311
20015 * elif auxtype in ('Z', 'H'):
20016 * value = <char*>bam_aux2Z(s) # <<<<<<<<<<<<<<
20017 * # +1 for NULL terminated string
20018 * s += len(value) + 1
20020 __pyx_t_6 = PyBytes_FromString(bam_aux2Z(__pyx_v_s)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20021 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
20022 __Pyx_DECREF(__pyx_v_value);
20023 __pyx_v_value = ((PyObject *)__pyx_t_6);
20026 /* "csamtools.pyx":2313
20027 * value = <char*>bam_aux2Z(s)
20028 * # +1 for NULL terminated string
20029 * s += len(value) + 1 # <<<<<<<<<<<<<<
20033 __pyx_t_7 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20034 __pyx_v_s = (__pyx_v_s + (__pyx_t_7 + 1));
20039 /* "csamtools.pyx":2315
20040 * s += len(value) + 1
20042 * s += 1 # <<<<<<<<<<<<<<
20044 * result.append( (auxtag, value) )
20046 __pyx_v_s = (__pyx_v_s + 1);
20048 /* "csamtools.pyx":2317
20051 * result.append( (auxtag, value) ) # <<<<<<<<<<<<<<
20055 if (unlikely(__pyx_v_result == Py_None)) {
20056 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20058 __pyx_t_6 = PyBytes_FromString(__pyx_v_auxtag); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20059 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
20060 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20061 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
20062 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_6));
20063 __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
20064 __Pyx_INCREF(__pyx_v_value);
20065 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_value);
20066 __Pyx_GIVEREF(__pyx_v_value);
20068 __pyx_t_8 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20069 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
20072 /* "csamtools.pyx":2319
20073 * result.append( (auxtag, value) )
20075 * return result # <<<<<<<<<<<<<<
20077 * def __set__(self, tags):
20079 __Pyx_XDECREF(__pyx_r);
20080 __Pyx_INCREF(((PyObject *)__pyx_v_result));
20081 __pyx_r = ((PyObject *)__pyx_v_result);
20084 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20087 __Pyx_XDECREF(__pyx_t_2);
20088 __Pyx_XDECREF(__pyx_t_6);
20089 __Pyx_AddTraceback("csamtools.AlignedRead.tags.__get__");
20092 __Pyx_DECREF(__pyx_v_result);
20093 __Pyx_DECREF(__pyx_v_value);
20094 __Pyx_XGIVEREF(__pyx_r);
20095 __Pyx_TraceReturn(__pyx_r);
20096 __Pyx_RefNannyFinishContext();
20100 /* "csamtools.pyx":2321
20103 * def __set__(self, tags): # <<<<<<<<<<<<<<
20105 * cdef bam1_t * src
20108 static int __pyx_pf_9csamtools_11AlignedRead_4tags_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tags); /*proto*/
20109 static int __pyx_pf_9csamtools_11AlignedRead_4tags_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tags) {
20110 bam1_t *__pyx_v_src;
20111 uint8_t *__pyx_v_s;
20112 char *__pyx_v_temp;
20113 int __pyx_v_max_size;
20115 int __pyx_v_offset;
20116 PyObject *__pyx_v_buffer;
20117 PyObject *__pyx_v_pytag;
20118 PyObject *__pyx_v_value;
20119 PyObject *__pyx_v_t;
20120 PyObject *__pyx_v_fmt;
20121 PyObject *__pyx_v_pytype;
20123 PyObject *__pyx_t_1 = NULL;
20125 PyObject *__pyx_t_3 = NULL;
20126 PyObject *__pyx_t_4 = NULL;
20127 Py_ssize_t __pyx_t_5;
20128 PyObject *__pyx_t_6 = NULL;
20129 PyObject *__pyx_t_7 = NULL;
20130 Py_ssize_t __pyx_t_8;
20132 PyObject *__pyx_t_10 = NULL;
20134 __Pyx_TraceDeclarations
20135 __Pyx_RefNannySetupContext("__set__");
20136 __Pyx_TraceCall("__set__", __pyx_f[0], 2321);
20137 __pyx_v_buffer = Py_None; __Pyx_INCREF(Py_None);
20138 __pyx_v_pytag = Py_None; __Pyx_INCREF(Py_None);
20139 __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);
20140 __pyx_v_t = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
20141 __pyx_v_fmt = Py_None; __Pyx_INCREF(Py_None);
20142 __pyx_v_pytype = Py_None; __Pyx_INCREF(Py_None);
20144 /* "csamtools.pyx":2330
20145 * cdef int max_size, size, offset
20147 * src = self._delegate # <<<<<<<<<<<<<<
20151 __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
20153 /* "csamtools.pyx":2331
20155 * src = self._delegate
20156 * max_size = 4000 # <<<<<<<<<<<<<<
20160 __pyx_v_max_size = 4000;
20162 /* "csamtools.pyx":2332
20163 * src = self._delegate
20165 * offset = 0 # <<<<<<<<<<<<<<
20169 __pyx_v_offset = 0;
20171 /* "csamtools.pyx":2334
20174 * if tags != None: # <<<<<<<<<<<<<<
20176 * # map samtools code to python.struct code and byte size
20178 __pyx_t_1 = PyObject_RichCompare(__pyx_v_tags, Py_None, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20179 __Pyx_GOTREF(__pyx_t_1);
20180 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20181 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20184 /* "csamtools.pyx":2337
20186 * # map samtools code to python.struct code and byte size
20187 * buffer = ctypes.create_string_buffer(max_size) # <<<<<<<<<<<<<<
20189 * for pytag, value in tags:
20191 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ctypes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20192 __Pyx_GOTREF(__pyx_t_1);
20193 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_122); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20194 __Pyx_GOTREF(__pyx_t_3);
20195 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20196 __pyx_t_1 = PyInt_FromLong(__pyx_v_max_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20197 __Pyx_GOTREF(__pyx_t_1);
20198 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20199 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
20200 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
20201 __Pyx_GIVEREF(__pyx_t_1);
20203 __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20204 __Pyx_GOTREF(__pyx_t_1);
20205 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20206 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
20207 __Pyx_DECREF(__pyx_v_buffer);
20208 __pyx_v_buffer = __pyx_t_1;
20211 /* "csamtools.pyx":2339
20212 * buffer = ctypes.create_string_buffer(max_size)
20214 * for pytag, value in tags: # <<<<<<<<<<<<<<
20216 * if t == types.FloatType:
20218 if (PyList_CheckExact(__pyx_v_tags) || PyTuple_CheckExact(__pyx_v_tags)) {
20219 __pyx_t_5 = 0; __pyx_t_1 = __pyx_v_tags; __Pyx_INCREF(__pyx_t_1);
20221 __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_tags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20222 __Pyx_GOTREF(__pyx_t_1);
20225 if (likely(PyList_CheckExact(__pyx_t_1))) {
20226 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
20227 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++;
20228 } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
20229 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
20230 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++;
20232 __pyx_t_4 = PyIter_Next(__pyx_t_1);
20234 if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20237 __Pyx_GOTREF(__pyx_t_4);
20239 if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
20240 PyObject* tuple = __pyx_t_4;
20241 __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3);
20242 __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6);
20243 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20244 __Pyx_DECREF(__pyx_v_pytag);
20245 __pyx_v_pytag = __pyx_t_3;
20247 __Pyx_DECREF(__pyx_v_value);
20248 __pyx_v_value = __pyx_t_6;
20251 __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20252 __Pyx_GOTREF(__pyx_t_7);
20253 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20254 __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20255 __Pyx_GOTREF(__pyx_t_3);
20256 __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20257 __Pyx_GOTREF(__pyx_t_6);
20258 if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20259 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20260 __Pyx_DECREF(__pyx_v_pytag);
20261 __pyx_v_pytag = __pyx_t_3;
20263 __Pyx_DECREF(__pyx_v_value);
20264 __pyx_v_value = __pyx_t_6;
20268 /* "csamtools.pyx":2340
20270 * for pytag, value in tags:
20271 * t = type(value) # <<<<<<<<<<<<<<
20272 * if t == types.FloatType:
20273 * fmt, pytype = "<cccf", 'f'
20275 __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value)));
20276 __Pyx_DECREF(((PyObject *)__pyx_v_t));
20277 __pyx_v_t = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_value)));
20279 /* "csamtools.pyx":2341
20280 * for pytag, value in tags:
20282 * if t == types.FloatType: # <<<<<<<<<<<<<<
20283 * fmt, pytype = "<cccf", 'f'
20284 * elif t == types.IntType:
20286 __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__types); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20287 __Pyx_GOTREF(__pyx_t_4);
20288 __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__FloatType); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20289 __Pyx_GOTREF(__pyx_t_6);
20290 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20291 __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_t), __pyx_t_6, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20292 __Pyx_GOTREF(__pyx_t_4);
20293 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20294 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20295 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20298 /* "csamtools.pyx":2342
20300 * if t == types.FloatType:
20301 * fmt, pytype = "<cccf", 'f' # <<<<<<<<<<<<<<
20302 * elif t == types.IntType:
20305 __pyx_t_4 = ((PyObject *)__pyx_kp_s_123);
20306 __Pyx_INCREF(__pyx_t_4);
20307 __pyx_t_6 = ((PyObject *)__pyx_n_s__f);
20308 __Pyx_INCREF(__pyx_t_6);
20309 __Pyx_DECREF(__pyx_v_fmt);
20310 __pyx_v_fmt = __pyx_t_4;
20312 __Pyx_DECREF(__pyx_v_pytype);
20313 __pyx_v_pytype = __pyx_t_6;
20318 /* "csamtools.pyx":2343
20319 * if t == types.FloatType:
20320 * fmt, pytype = "<cccf", 'f'
20321 * elif t == types.IntType: # <<<<<<<<<<<<<<
20323 * if value >= -127: fmt, pytype = "<cccb", 'c'
20325 __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__types); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20326 __Pyx_GOTREF(__pyx_t_6);
20327 __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__IntType); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20328 __Pyx_GOTREF(__pyx_t_4);
20329 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20330 __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_v_t), __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20331 __Pyx_GOTREF(__pyx_t_6);
20332 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20333 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20334 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20337 /* "csamtools.pyx":2344
20338 * fmt, pytype = "<cccf", 'f'
20339 * elif t == types.IntType:
20340 * if value < 0: # <<<<<<<<<<<<<<
20341 * if value >= -127: fmt, pytype = "<cccb", 'c'
20342 * elif value >= -32767: fmt, pytype = "<ccch", 's'
20344 __pyx_t_6 = PyObject_RichCompare(__pyx_v_value, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20345 __Pyx_GOTREF(__pyx_t_6);
20346 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20347 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20350 /* "csamtools.pyx":2345
20351 * elif t == types.IntType:
20353 * if value >= -127: fmt, pytype = "<cccb", 'c' # <<<<<<<<<<<<<<
20354 * elif value >= -32767: fmt, pytype = "<ccch", 's'
20355 * elif value < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
20357 __pyx_t_6 = PyObject_RichCompare(__pyx_v_value, __pyx_int_neg_127, Py_GE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20358 __Pyx_GOTREF(__pyx_t_6);
20359 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20360 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20362 __pyx_t_6 = ((PyObject *)__pyx_kp_s_124);
20363 __Pyx_INCREF(__pyx_t_6);
20364 __pyx_t_4 = ((PyObject *)__pyx_n_s__c);
20365 __Pyx_INCREF(__pyx_t_4);
20366 __Pyx_DECREF(__pyx_v_fmt);
20367 __pyx_v_fmt = __pyx_t_6;
20369 __Pyx_DECREF(__pyx_v_pytype);
20370 __pyx_v_pytype = __pyx_t_4;
20375 /* "csamtools.pyx":2346
20377 * if value >= -127: fmt, pytype = "<cccb", 'c'
20378 * elif value >= -32767: fmt, pytype = "<ccch", 's' # <<<<<<<<<<<<<<
20379 * elif value < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
20380 * else: fmt, pytype = "<ccci", 'i'[0]
20382 __pyx_t_4 = PyObject_RichCompare(__pyx_v_value, __pyx_int_neg_32767, Py_GE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20383 __Pyx_GOTREF(__pyx_t_4);
20384 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20385 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20387 __pyx_t_4 = ((PyObject *)__pyx_kp_s_125);
20388 __Pyx_INCREF(__pyx_t_4);
20389 __pyx_t_6 = ((PyObject *)__pyx_n_s__s);
20390 __Pyx_INCREF(__pyx_t_6);
20391 __Pyx_DECREF(__pyx_v_fmt);
20392 __pyx_v_fmt = __pyx_t_4;
20394 __Pyx_DECREF(__pyx_v_pytype);
20395 __pyx_v_pytype = __pyx_t_6;
20400 /* "csamtools.pyx":2347
20401 * if value >= -127: fmt, pytype = "<cccb", 'c'
20402 * elif value >= -32767: fmt, pytype = "<ccch", 's'
20403 * elif value < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value ) # <<<<<<<<<<<<<<
20404 * else: fmt, pytype = "<ccci", 'i'[0]
20407 __pyx_t_6 = PyObject_RichCompare(__pyx_v_value, __pyx_int_neg_2147483648, Py_LT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20408 __Pyx_GOTREF(__pyx_t_6);
20409 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20410 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20412 __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_126), __pyx_v_value); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20413 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
20414 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20415 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
20416 PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_6));
20417 __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
20419 __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20420 __Pyx_GOTREF(__pyx_t_6);
20421 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
20422 __Pyx_Raise(__pyx_t_6, 0, 0);
20423 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20424 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20429 /* "csamtools.pyx":2348
20430 * elif value >= -32767: fmt, pytype = "<ccch", 's'
20431 * elif value < -2147483648: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
20432 * else: fmt, pytype = "<ccci", 'i'[0] # <<<<<<<<<<<<<<
20434 * if value <= 255: fmt, pytype = "<cccB", 'C'
20436 __pyx_t_6 = ((PyObject *)__pyx_kp_s_127);
20437 __Pyx_INCREF(__pyx_t_6);
20438 __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_n_s__i), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20439 __Pyx_GOTREF(__pyx_t_4);
20440 __Pyx_DECREF(__pyx_v_fmt);
20441 __pyx_v_fmt = __pyx_t_6;
20443 __Pyx_DECREF(__pyx_v_pytype);
20444 __pyx_v_pytype = __pyx_t_4;
20452 /* "csamtools.pyx":2350
20453 * else: fmt, pytype = "<ccci", 'i'[0]
20455 * if value <= 255: fmt, pytype = "<cccB", 'C' # <<<<<<<<<<<<<<
20456 * elif value <= 65535: fmt, pytype = "<cccH", 'S'
20457 * elif value > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
20459 __pyx_t_4 = PyObject_RichCompare(__pyx_v_value, __pyx_int_255, Py_LE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20460 __Pyx_GOTREF(__pyx_t_4);
20461 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20462 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20464 __pyx_t_4 = ((PyObject *)__pyx_kp_s_128);
20465 __Pyx_INCREF(__pyx_t_4);
20466 __pyx_t_6 = ((PyObject *)__pyx_n_s__C);
20467 __Pyx_INCREF(__pyx_t_6);
20468 __Pyx_DECREF(__pyx_v_fmt);
20469 __pyx_v_fmt = __pyx_t_4;
20471 __Pyx_DECREF(__pyx_v_pytype);
20472 __pyx_v_pytype = __pyx_t_6;
20477 /* "csamtools.pyx":2351
20479 * if value <= 255: fmt, pytype = "<cccB", 'C'
20480 * elif value <= 65535: fmt, pytype = "<cccH", 'S' # <<<<<<<<<<<<<<
20481 * elif value > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
20482 * else: fmt, pytype = "<cccI", 'I'
20484 __pyx_t_6 = PyObject_RichCompare(__pyx_v_value, __pyx_int_65535, Py_LE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20485 __Pyx_GOTREF(__pyx_t_6);
20486 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20487 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20489 __pyx_t_6 = ((PyObject *)__pyx_kp_s_129);
20490 __Pyx_INCREF(__pyx_t_6);
20491 __pyx_t_4 = ((PyObject *)__pyx_n_s__S);
20492 __Pyx_INCREF(__pyx_t_4);
20493 __Pyx_DECREF(__pyx_v_fmt);
20494 __pyx_v_fmt = __pyx_t_6;
20496 __Pyx_DECREF(__pyx_v_pytype);
20497 __pyx_v_pytype = __pyx_t_4;
20502 /* "csamtools.pyx":2352
20503 * if value <= 255: fmt, pytype = "<cccB", 'C'
20504 * elif value <= 65535: fmt, pytype = "<cccH", 'S'
20505 * elif value > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value ) # <<<<<<<<<<<<<<
20506 * else: fmt, pytype = "<cccI", 'I'
20509 __pyx_t_4 = PyObject_RichCompare(__pyx_v_value, __pyx_int_4294967295, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20510 __Pyx_GOTREF(__pyx_t_4);
20511 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20512 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20514 __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_126), __pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20515 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
20516 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20517 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
20518 PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4));
20519 __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
20521 __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20522 __Pyx_GOTREF(__pyx_t_4);
20523 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
20524 __Pyx_Raise(__pyx_t_4, 0, 0);
20525 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20526 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20531 /* "csamtools.pyx":2353
20532 * elif value <= 65535: fmt, pytype = "<cccH", 'S'
20533 * elif value > 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value )
20534 * else: fmt, pytype = "<cccI", 'I' # <<<<<<<<<<<<<<
20536 * # Note: hex strings (H) are not supported yet
20538 __pyx_t_4 = ((PyObject *)__pyx_kp_s_130);
20539 __Pyx_INCREF(__pyx_t_4);
20540 __pyx_t_6 = ((PyObject *)__pyx_n_s__I);
20541 __Pyx_INCREF(__pyx_t_6);
20542 __Pyx_DECREF(__pyx_v_fmt);
20543 __pyx_v_fmt = __pyx_t_4;
20545 __Pyx_DECREF(__pyx_v_pytype);
20546 __pyx_v_pytype = __pyx_t_6;
20556 /* "csamtools.pyx":2356
20558 * # Note: hex strings (H) are not supported yet
20559 * if len(value) == 1: # <<<<<<<<<<<<<<
20560 * fmt, pytype = "<cccc", 'A'
20563 __pyx_t_8 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20564 __pyx_t_2 = (__pyx_t_8 == 1);
20567 /* "csamtools.pyx":2357
20568 * # Note: hex strings (H) are not supported yet
20569 * if len(value) == 1:
20570 * fmt, pytype = "<cccc", 'A' # <<<<<<<<<<<<<<
20572 * fmt, pytype = "<ccc%is" % (len(value)+1), 'Z'
20574 __pyx_t_6 = ((PyObject *)__pyx_kp_s_131);
20575 __Pyx_INCREF(__pyx_t_6);
20576 __pyx_t_4 = ((PyObject *)__pyx_n_s__A);
20577 __Pyx_INCREF(__pyx_t_4);
20578 __Pyx_DECREF(__pyx_v_fmt);
20579 __pyx_v_fmt = __pyx_t_6;
20581 __Pyx_DECREF(__pyx_v_pytype);
20582 __pyx_v_pytype = __pyx_t_4;
20588 /* "csamtools.pyx":2359
20589 * fmt, pytype = "<cccc", 'A'
20591 * fmt, pytype = "<ccc%is" % (len(value)+1), 'Z' # <<<<<<<<<<<<<<
20593 * size = struct.calcsize(fmt)
20595 __pyx_t_8 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20596 __pyx_t_4 = PyInt_FromSsize_t((__pyx_t_8 + 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20597 __Pyx_GOTREF(__pyx_t_4);
20598 __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_132), __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20599 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
20600 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20601 __pyx_t_4 = ((PyObject *)__pyx_n_s__Z);
20602 __Pyx_INCREF(__pyx_t_4);
20603 __Pyx_DECREF(__pyx_v_fmt);
20604 __pyx_v_fmt = ((PyObject *)__pyx_t_6);
20606 __Pyx_DECREF(__pyx_v_pytype);
20607 __pyx_v_pytype = __pyx_t_4;
20614 /* "csamtools.pyx":2361
20615 * fmt, pytype = "<ccc%is" % (len(value)+1), 'Z'
20617 * size = struct.calcsize(fmt) # <<<<<<<<<<<<<<
20618 * if offset + size > max_size:
20619 * raise NotImplementedError("tags field too large")
20621 __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__struct); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20622 __Pyx_GOTREF(__pyx_t_4);
20623 __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__calcsize); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20624 __Pyx_GOTREF(__pyx_t_6);
20625 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20626 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20627 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
20628 __Pyx_INCREF(__pyx_v_fmt);
20629 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_fmt);
20630 __Pyx_GIVEREF(__pyx_v_fmt);
20631 __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20632 __Pyx_GOTREF(__pyx_t_3);
20633 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20634 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
20635 __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20636 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20637 __pyx_v_size = __pyx_t_9;
20639 /* "csamtools.pyx":2362
20641 * size = struct.calcsize(fmt)
20642 * if offset + size > max_size: # <<<<<<<<<<<<<<
20643 * raise NotImplementedError("tags field too large")
20646 __pyx_t_2 = ((__pyx_v_offset + __pyx_v_size) > __pyx_v_max_size);
20649 /* "csamtools.pyx":2363
20650 * size = struct.calcsize(fmt)
20651 * if offset + size > max_size:
20652 * raise NotImplementedError("tags field too large") # <<<<<<<<<<<<<<
20654 * struct.pack_into( fmt,
20656 __pyx_t_3 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_134), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20657 __Pyx_GOTREF(__pyx_t_3);
20658 __Pyx_Raise(__pyx_t_3, 0, 0);
20659 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20660 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20665 /* "csamtools.pyx":2365
20666 * raise NotImplementedError("tags field too large")
20668 * struct.pack_into( fmt, # <<<<<<<<<<<<<<
20672 __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__struct); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20673 __Pyx_GOTREF(__pyx_t_3);
20674 __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__pack_into); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20675 __Pyx_GOTREF(__pyx_t_4);
20676 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20678 /* "csamtools.pyx":2367
20679 * struct.pack_into( fmt,
20681 * offset, # <<<<<<<<<<<<<<
20685 __pyx_t_3 = PyInt_FromLong(__pyx_v_offset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20686 __Pyx_GOTREF(__pyx_t_3);
20688 /* "csamtools.pyx":2368
20691 * pytag[0], # <<<<<<<<<<<<<<
20695 __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_pytag, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20696 __Pyx_GOTREF(__pyx_t_6);
20698 /* "csamtools.pyx":2369
20701 * pytag[1], # <<<<<<<<<<<<<<
20705 __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_pytag, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20706 __Pyx_GOTREF(__pyx_t_7);
20708 /* "csamtools.pyx":2371
20711 * value ) # <<<<<<<<<<<<<<
20715 __pyx_t_10 = PyTuple_New(7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20716 __Pyx_GOTREF(((PyObject *)__pyx_t_10));
20717 __Pyx_INCREF(__pyx_v_fmt);
20718 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_fmt);
20719 __Pyx_GIVEREF(__pyx_v_fmt);
20720 __Pyx_INCREF(__pyx_v_buffer);
20721 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_buffer);
20722 __Pyx_GIVEREF(__pyx_v_buffer);
20723 PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_3);
20724 __Pyx_GIVEREF(__pyx_t_3);
20725 PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_6);
20726 __Pyx_GIVEREF(__pyx_t_6);
20727 PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_7);
20728 __Pyx_GIVEREF(__pyx_t_7);
20729 __Pyx_INCREF(__pyx_v_pytype);
20730 PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_v_pytype);
20731 __Pyx_GIVEREF(__pyx_v_pytype);
20732 __Pyx_INCREF(__pyx_v_value);
20733 PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_v_value);
20734 __Pyx_GIVEREF(__pyx_v_value);
20738 __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20739 __Pyx_GOTREF(__pyx_t_7);
20740 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20741 __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
20742 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20744 /* "csamtools.pyx":2372
20747 * offset += size # <<<<<<<<<<<<<<
20749 * # delete the old data and allocate new
20751 __pyx_v_offset = (__pyx_v_offset + __pyx_v_size);
20753 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20758 /* "csamtools.pyx":2380
20761 * bam1_aux( src ) ) # <<<<<<<<<<<<<<
20763 * src.l_aux = offset
20765 pysam_bam_update(__pyx_v_src, __pyx_v_src->l_aux, __pyx_v_offset, bam1_aux(__pyx_v_src));
20767 /* "csamtools.pyx":2382
20768 * bam1_aux( src ) )
20770 * src.l_aux = offset # <<<<<<<<<<<<<<
20772 * # copy data only if there is any
20774 __pyx_v_src->l_aux = __pyx_v_offset;
20776 /* "csamtools.pyx":2385
20778 * # copy data only if there is any
20779 * if offset != 0: # <<<<<<<<<<<<<<
20781 * # get location of new data
20783 __pyx_t_2 = (__pyx_v_offset != 0);
20786 /* "csamtools.pyx":2388
20788 * # get location of new data
20789 * s = bam1_aux( src ) # <<<<<<<<<<<<<<
20791 * # check if there is direct path from buffer.raw to tmp
20793 __pyx_v_s = bam1_aux(__pyx_v_src);
20795 /* "csamtools.pyx":2391
20797 * # check if there is direct path from buffer.raw to tmp
20798 * temp = buffer.raw # <<<<<<<<<<<<<<
20799 * memcpy( s, temp, offset )
20802 __pyx_t_1 = PyObject_GetAttr(__pyx_v_buffer, __pyx_n_s__raw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20803 __Pyx_GOTREF(__pyx_t_1);
20804 __pyx_t_11 = PyBytes_AsString(__pyx_t_1); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20805 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20806 __pyx_v_temp = __pyx_t_11;
20808 /* "csamtools.pyx":2392
20809 * # check if there is direct path from buffer.raw to tmp
20810 * temp = buffer.raw
20811 * memcpy( s, temp, offset ) # <<<<<<<<<<<<<<
20815 memcpy(__pyx_v_s, __pyx_v_temp, __pyx_v_offset);
20823 __Pyx_XDECREF(__pyx_t_1);
20824 __Pyx_XDECREF(__pyx_t_3);
20825 __Pyx_XDECREF(__pyx_t_4);
20826 __Pyx_XDECREF(__pyx_t_6);
20827 __Pyx_XDECREF(__pyx_t_7);
20828 __Pyx_XDECREF(__pyx_t_10);
20829 __Pyx_AddTraceback("csamtools.AlignedRead.tags.__set__");
20832 __Pyx_DECREF(__pyx_v_buffer);
20833 __Pyx_DECREF(__pyx_v_pytag);
20834 __Pyx_DECREF(__pyx_v_value);
20835 __Pyx_DECREF(__pyx_v_t);
20836 __Pyx_DECREF(__pyx_v_fmt);
20837 __Pyx_DECREF(__pyx_v_pytype);
20838 __Pyx_TraceReturn(Py_None);
20839 __Pyx_RefNannyFinishContext();
20843 /* "csamtools.pyx":2396
20845 * """properties flag"""
20846 * def __get__(self): return self._delegate.core.flag # <<<<<<<<<<<<<<
20847 * def __set__(self, flag): self._delegate.core.flag = flag
20851 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4flag___get__(PyObject *__pyx_v_self); /*proto*/
20852 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4flag___get__(PyObject *__pyx_v_self) {
20853 PyObject *__pyx_r = NULL;
20854 PyObject *__pyx_t_1 = NULL;
20855 __Pyx_TraceDeclarations
20856 __Pyx_RefNannySetupContext("__get__");
20857 __Pyx_TraceCall("__get__", __pyx_f[0], 2396);
20858 __Pyx_XDECREF(__pyx_r);
20859 __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20860 __Pyx_GOTREF(__pyx_t_1);
20861 __pyx_r = __pyx_t_1;
20865 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20868 __Pyx_XDECREF(__pyx_t_1);
20869 __Pyx_AddTraceback("csamtools.AlignedRead.flag.__get__");
20872 __Pyx_XGIVEREF(__pyx_r);
20873 __Pyx_TraceReturn(__pyx_r);
20874 __Pyx_RefNannyFinishContext();
20878 /* "csamtools.pyx":2397
20879 * """properties flag"""
20880 * def __get__(self): return self._delegate.core.flag
20881 * def __set__(self, flag): self._delegate.core.flag = flag # <<<<<<<<<<<<<<
20886 static int __pyx_pf_9csamtools_11AlignedRead_4flag_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_flag); /*proto*/
20887 static int __pyx_pf_9csamtools_11AlignedRead_4flag_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_flag) {
20889 uint32_t __pyx_t_1;
20890 __Pyx_TraceDeclarations
20891 __Pyx_RefNannySetupContext("__set__");
20892 __Pyx_TraceCall("__set__", __pyx_f[0], 2397);
20893 __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 = 2397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20894 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = __pyx_t_1;
20899 __Pyx_AddTraceback("csamtools.AlignedRead.flag.__set__");
20902 __Pyx_TraceReturn(Py_None);
20903 __Pyx_RefNannyFinishContext();
20907 /* "csamtools.pyx":2415
20910 * def __get__(self): return self._delegate.core.tid # <<<<<<<<<<<<<<
20911 * def __set__(self, tid): self._delegate.core.tid = tid
20915 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rname___get__(PyObject *__pyx_v_self); /*proto*/
20916 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rname___get__(PyObject *__pyx_v_self) {
20917 PyObject *__pyx_r = NULL;
20918 PyObject *__pyx_t_1 = NULL;
20919 __Pyx_TraceDeclarations
20920 __Pyx_RefNannySetupContext("__get__");
20921 __Pyx_TraceCall("__get__", __pyx_f[0], 2415);
20922 __Pyx_XDECREF(__pyx_r);
20923 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20924 __Pyx_GOTREF(__pyx_t_1);
20925 __pyx_r = __pyx_t_1;
20929 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20932 __Pyx_XDECREF(__pyx_t_1);
20933 __Pyx_AddTraceback("csamtools.AlignedRead.rname.__get__");
20936 __Pyx_XGIVEREF(__pyx_r);
20937 __Pyx_TraceReturn(__pyx_r);
20938 __Pyx_RefNannyFinishContext();
20942 /* "csamtools.pyx":2416
20944 * def __get__(self): return self._delegate.core.tid
20945 * def __set__(self, tid): self._delegate.core.tid = tid # <<<<<<<<<<<<<<
20950 static int __pyx_pf_9csamtools_11AlignedRead_5rname_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
20951 static int __pyx_pf_9csamtools_11AlignedRead_5rname_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) {
20954 __Pyx_TraceDeclarations
20955 __Pyx_RefNannySetupContext("__set__");
20956 __Pyx_TraceCall("__set__", __pyx_f[0], 2416);
20957 __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 = 2416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20958 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.tid = __pyx_t_1;
20963 __Pyx_AddTraceback("csamtools.AlignedRead.rname.__set__");
20966 __Pyx_TraceReturn(Py_None);
20967 __Pyx_RefNannyFinishContext();
20971 /* "csamtools.pyx":2429
20974 * def __get__(self): return self._delegate.core.tid # <<<<<<<<<<<<<<
20975 * def __set__(self, tid): self._delegate.core.tid = tid
20979 static PyObject *__pyx_pf_9csamtools_11AlignedRead_3tid___get__(PyObject *__pyx_v_self); /*proto*/
20980 static PyObject *__pyx_pf_9csamtools_11AlignedRead_3tid___get__(PyObject *__pyx_v_self) {
20981 PyObject *__pyx_r = NULL;
20982 PyObject *__pyx_t_1 = NULL;
20983 __Pyx_TraceDeclarations
20984 __Pyx_RefNannySetupContext("__get__");
20985 __Pyx_TraceCall("__get__", __pyx_f[0], 2429);
20986 __Pyx_XDECREF(__pyx_r);
20987 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
20988 __Pyx_GOTREF(__pyx_t_1);
20989 __pyx_r = __pyx_t_1;
20993 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20996 __Pyx_XDECREF(__pyx_t_1);
20997 __Pyx_AddTraceback("csamtools.AlignedRead.tid.__get__");
21000 __Pyx_XGIVEREF(__pyx_r);
21001 __Pyx_TraceReturn(__pyx_r);
21002 __Pyx_RefNannyFinishContext();
21006 /* "csamtools.pyx":2430
21008 * def __get__(self): return self._delegate.core.tid
21009 * def __set__(self, tid): self._delegate.core.tid = tid # <<<<<<<<<<<<<<
21014 static int __pyx_pf_9csamtools_11AlignedRead_3tid_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/
21015 static int __pyx_pf_9csamtools_11AlignedRead_3tid_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) {
21018 __Pyx_TraceDeclarations
21019 __Pyx_RefNannySetupContext("__set__");
21020 __Pyx_TraceCall("__set__", __pyx_f[0], 2430);
21021 __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 = 2430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21022 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.tid = __pyx_t_1;
21027 __Pyx_AddTraceback("csamtools.AlignedRead.tid.__set__");
21030 __Pyx_TraceReturn(Py_None);
21031 __Pyx_RefNannyFinishContext();
21035 /* "csamtools.pyx":2434
21037 * """0-based leftmost coordinate"""
21038 * def __get__(self): return self._delegate.core.pos # <<<<<<<<<<<<<<
21039 * def __set__(self, pos):
21040 * ## setting the cigar string also updates the "bin" attribute
21043 static PyObject *__pyx_pf_9csamtools_11AlignedRead_3pos___get__(PyObject *__pyx_v_self); /*proto*/
21044 static PyObject *__pyx_pf_9csamtools_11AlignedRead_3pos___get__(PyObject *__pyx_v_self) {
21045 PyObject *__pyx_r = NULL;
21046 PyObject *__pyx_t_1 = NULL;
21047 __Pyx_TraceDeclarations
21048 __Pyx_RefNannySetupContext("__get__");
21049 __Pyx_TraceCall("__get__", __pyx_f[0], 2434);
21050 __Pyx_XDECREF(__pyx_r);
21051 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21052 __Pyx_GOTREF(__pyx_t_1);
21053 __pyx_r = __pyx_t_1;
21057 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21060 __Pyx_XDECREF(__pyx_t_1);
21061 __Pyx_AddTraceback("csamtools.AlignedRead.pos.__get__");
21064 __Pyx_XGIVEREF(__pyx_r);
21065 __Pyx_TraceReturn(__pyx_r);
21066 __Pyx_RefNannyFinishContext();
21070 /* "csamtools.pyx":2435
21071 * """0-based leftmost coordinate"""
21072 * def __get__(self): return self._delegate.core.pos
21073 * def __set__(self, pos): # <<<<<<<<<<<<<<
21074 * ## setting the cigar string also updates the "bin" attribute
21075 * cdef bam1_t * src
21078 static int __pyx_pf_9csamtools_11AlignedRead_3pos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pos); /*proto*/
21079 static int __pyx_pf_9csamtools_11AlignedRead_3pos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pos) {
21080 bam1_t *__pyx_v_src;
21083 __Pyx_TraceDeclarations
21084 __Pyx_RefNannySetupContext("__set__");
21085 __Pyx_TraceCall("__set__", __pyx_f[0], 2435);
21087 /* "csamtools.pyx":2438
21088 * ## setting the cigar string also updates the "bin" attribute
21089 * cdef bam1_t * src
21090 * src = self._delegate # <<<<<<<<<<<<<<
21091 * if src.core.n_cigar:
21092 * src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) )
21094 __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
21096 /* "csamtools.pyx":2439
21097 * cdef bam1_t * src
21098 * src = self._delegate
21099 * if src.core.n_cigar: # <<<<<<<<<<<<<<
21100 * src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) )
21103 if (__pyx_v_src->core.n_cigar) {
21105 /* "csamtools.pyx":2440
21106 * src = self._delegate
21107 * if src.core.n_cigar:
21108 * src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) ) # <<<<<<<<<<<<<<
21110 * src.core.bin = bam_reg2bin( src.core.pos, src.core.pos + 1)
21112 __pyx_v_src->core.bin = bam_reg2bin(__pyx_v_src->core.pos, bam_calend((&__pyx_v_src->core), bam1_cigar(__pyx_v_src)));
21117 /* "csamtools.pyx":2442
21118 * src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) )
21120 * src.core.bin = bam_reg2bin( src.core.pos, src.core.pos + 1) # <<<<<<<<<<<<<<
21121 * self._delegate.core.pos = pos
21124 __pyx_v_src->core.bin = bam_reg2bin(__pyx_v_src->core.pos, (__pyx_v_src->core.pos + 1));
21128 /* "csamtools.pyx":2443
21130 * src.core.bin = bam_reg2bin( src.core.pos, src.core.pos + 1)
21131 * self._delegate.core.pos = pos # <<<<<<<<<<<<<<
21133 * """properties bin"""
21135 __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 = 2443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21136 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.pos = __pyx_t_1;
21141 __Pyx_AddTraceback("csamtools.AlignedRead.pos.__set__");
21144 __Pyx_TraceReturn(Py_None);
21145 __Pyx_RefNannyFinishContext();
21149 /* "csamtools.pyx":2446
21151 * """properties bin"""
21152 * def __get__(self): return self._delegate.core.bin # <<<<<<<<<<<<<<
21153 * def __set__(self, bin): self._delegate.core.bin = bin
21157 static PyObject *__pyx_pf_9csamtools_11AlignedRead_3bin___get__(PyObject *__pyx_v_self); /*proto*/
21158 static PyObject *__pyx_pf_9csamtools_11AlignedRead_3bin___get__(PyObject *__pyx_v_self) {
21159 PyObject *__pyx_r = NULL;
21160 PyObject *__pyx_t_1 = NULL;
21161 __Pyx_TraceDeclarations
21162 __Pyx_RefNannySetupContext("__get__");
21163 __Pyx_TraceCall("__get__", __pyx_f[0], 2446);
21164 __Pyx_XDECREF(__pyx_r);
21165 __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.bin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21166 __Pyx_GOTREF(__pyx_t_1);
21167 __pyx_r = __pyx_t_1;
21171 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21174 __Pyx_XDECREF(__pyx_t_1);
21175 __Pyx_AddTraceback("csamtools.AlignedRead.bin.__get__");
21178 __Pyx_XGIVEREF(__pyx_r);
21179 __Pyx_TraceReturn(__pyx_r);
21180 __Pyx_RefNannyFinishContext();
21184 /* "csamtools.pyx":2447
21185 * """properties bin"""
21186 * def __get__(self): return self._delegate.core.bin
21187 * def __set__(self, bin): self._delegate.core.bin = bin # <<<<<<<<<<<<<<
21189 * '''length of the read (read only). Returns 0 if not given.'''
21192 static int __pyx_pf_9csamtools_11AlignedRead_3bin_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_bin); /*proto*/
21193 static int __pyx_pf_9csamtools_11AlignedRead_3bin_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_bin) {
21195 uint32_t __pyx_t_1;
21196 __Pyx_TraceDeclarations
21197 __Pyx_RefNannySetupContext("__set__");
21198 __Pyx_TraceCall("__set__", __pyx_f[0], 2447);
21199 __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 = 2447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21200 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.bin = __pyx_t_1;
21205 __Pyx_AddTraceback("csamtools.AlignedRead.bin.__set__");
21208 __Pyx_TraceReturn(Py_None);
21209 __Pyx_RefNannyFinishContext();
21213 /* "csamtools.pyx":2450
21215 * '''length of the read (read only). Returns 0 if not given.'''
21216 * def __get__(self): return self._delegate.core.l_qseq # <<<<<<<<<<<<<<
21218 * '''aligned end position of the read on the reference genome. Returns
21221 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4rlen___get__(PyObject *__pyx_v_self); /*proto*/
21222 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4rlen___get__(PyObject *__pyx_v_self) {
21223 PyObject *__pyx_r = NULL;
21224 PyObject *__pyx_t_1 = NULL;
21225 __Pyx_TraceDeclarations
21226 __Pyx_RefNannySetupContext("__get__");
21227 __Pyx_TraceCall("__get__", __pyx_f[0], 2450);
21228 __Pyx_XDECREF(__pyx_r);
21229 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.l_qseq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21230 __Pyx_GOTREF(__pyx_t_1);
21231 __pyx_r = __pyx_t_1;
21235 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21238 __Pyx_XDECREF(__pyx_t_1);
21239 __Pyx_AddTraceback("csamtools.AlignedRead.rlen.__get__");
21242 __Pyx_XGIVEREF(__pyx_r);
21243 __Pyx_TraceReturn(__pyx_r);
21244 __Pyx_RefNannyFinishContext();
21248 /* "csamtools.pyx":2454
21249 * '''aligned end position of the read on the reference genome. Returns
21250 * None if not available.'''
21251 * def __get__(self): # <<<<<<<<<<<<<<
21252 * cdef bam1_t * src
21253 * src = self._delegate
21256 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(PyObject *__pyx_v_self); /*proto*/
21257 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(PyObject *__pyx_v_self) {
21258 bam1_t *__pyx_v_src;
21259 PyObject *__pyx_r = NULL;
21260 PyObject *__pyx_t_1 = NULL;
21261 PyObject *__pyx_t_2 = NULL;
21265 __Pyx_TraceDeclarations
21266 __Pyx_RefNannySetupContext("__get__");
21267 __Pyx_TraceCall("__get__", __pyx_f[0], 2454);
21269 /* "csamtools.pyx":2456
21270 * def __get__(self):
21271 * cdef bam1_t * src
21272 * src = self._delegate # <<<<<<<<<<<<<<
21273 * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
21276 __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
21278 /* "csamtools.pyx":2457
21279 * cdef bam1_t * src
21280 * src = self._delegate
21281 * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0: # <<<<<<<<<<<<<<
21283 * return bam_calend(&src.core, bam1_cigar(src))
21285 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21286 __Pyx_GOTREF(__pyx_t_1);
21287 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21288 __Pyx_GOTREF(__pyx_t_2);
21289 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21290 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21291 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21293 __pyx_t_4 = (__pyx_v_src->core.n_cigar == 0);
21294 __pyx_t_5 = __pyx_t_4;
21296 __pyx_t_5 = __pyx_t_3;
21300 /* "csamtools.pyx":2458
21301 * src = self._delegate
21302 * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
21303 * return None # <<<<<<<<<<<<<<
21304 * return bam_calend(&src.core, bam1_cigar(src))
21307 __Pyx_XDECREF(__pyx_r);
21308 __Pyx_INCREF(Py_None);
21315 /* "csamtools.pyx":2459
21316 * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
21318 * return bam_calend(&src.core, bam1_cigar(src)) # <<<<<<<<<<<<<<
21320 * '''aligned length of the read on the reference genome. Returns None if
21322 __Pyx_XDECREF(__pyx_r);
21323 __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 = 2459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21324 __Pyx_GOTREF(__pyx_t_2);
21325 __pyx_r = __pyx_t_2;
21329 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21332 __Pyx_XDECREF(__pyx_t_1);
21333 __Pyx_XDECREF(__pyx_t_2);
21334 __Pyx_AddTraceback("csamtools.AlignedRead.aend.__get__");
21337 __Pyx_XGIVEREF(__pyx_r);
21338 __Pyx_TraceReturn(__pyx_r);
21339 __Pyx_RefNannyFinishContext();
21343 /* "csamtools.pyx":2463
21344 * '''aligned length of the read on the reference genome. Returns None if
21345 * not available.'''
21346 * def __get__(self): # <<<<<<<<<<<<<<
21347 * cdef bam1_t * src
21348 * src = self._delegate
21351 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(PyObject *__pyx_v_self); /*proto*/
21352 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(PyObject *__pyx_v_self) {
21353 bam1_t *__pyx_v_src;
21354 PyObject *__pyx_r = NULL;
21355 PyObject *__pyx_t_1 = NULL;
21356 PyObject *__pyx_t_2 = NULL;
21360 __Pyx_TraceDeclarations
21361 __Pyx_RefNannySetupContext("__get__");
21362 __Pyx_TraceCall("__get__", __pyx_f[0], 2463);
21364 /* "csamtools.pyx":2465
21365 * def __get__(self):
21366 * cdef bam1_t * src
21367 * src = self._delegate # <<<<<<<<<<<<<<
21368 * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
21371 __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
21373 /* "csamtools.pyx":2466
21374 * cdef bam1_t * src
21375 * src = self._delegate
21376 * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0: # <<<<<<<<<<<<<<
21378 * return bam_calend(&src.core,
21380 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21381 __Pyx_GOTREF(__pyx_t_1);
21382 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21383 __Pyx_GOTREF(__pyx_t_2);
21384 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21385 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21386 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21388 __pyx_t_4 = (__pyx_v_src->core.n_cigar == 0);
21389 __pyx_t_5 = __pyx_t_4;
21391 __pyx_t_5 = __pyx_t_3;
21395 /* "csamtools.pyx":2467
21396 * src = self._delegate
21397 * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
21398 * return None # <<<<<<<<<<<<<<
21399 * return bam_calend(&src.core,
21400 * bam1_cigar(src)) - \
21402 __Pyx_XDECREF(__pyx_r);
21403 __Pyx_INCREF(Py_None);
21410 /* "csamtools.pyx":2468
21411 * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0:
21413 * return bam_calend(&src.core, # <<<<<<<<<<<<<<
21414 * bam1_cigar(src)) - \
21415 * self._delegate.core.pos
21417 __Pyx_XDECREF(__pyx_r);
21419 /* "csamtools.pyx":2470
21420 * return bam_calend(&src.core,
21421 * bam1_cigar(src)) - \
21422 * self._delegate.core.pos # <<<<<<<<<<<<<<
21426 __pyx_t_2 = __Pyx_PyInt_to_py_int32_t((bam_calend((&__pyx_v_src->core), bam1_cigar(__pyx_v_src)) - ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.pos)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21427 __Pyx_GOTREF(__pyx_t_2);
21428 __pyx_r = __pyx_t_2;
21432 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21435 __Pyx_XDECREF(__pyx_t_1);
21436 __Pyx_XDECREF(__pyx_t_2);
21437 __Pyx_AddTraceback("csamtools.AlignedRead.alen.__get__");
21440 __Pyx_XGIVEREF(__pyx_r);
21441 __Pyx_TraceReturn(__pyx_r);
21442 __Pyx_RefNannyFinishContext();
21446 /* "csamtools.pyx":2474
21448 * """mapping quality"""
21449 * def __get__(self): return self._delegate.core.qual # <<<<<<<<<<<<<<
21450 * def __set__(self, qual): self._delegate.core.qual = qual
21454 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mapq___get__(PyObject *__pyx_v_self); /*proto*/
21455 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mapq___get__(PyObject *__pyx_v_self) {
21456 PyObject *__pyx_r = NULL;
21457 PyObject *__pyx_t_1 = NULL;
21458 __Pyx_TraceDeclarations
21459 __Pyx_RefNannySetupContext("__get__");
21460 __Pyx_TraceCall("__get__", __pyx_f[0], 2474);
21461 __Pyx_XDECREF(__pyx_r);
21462 __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.qual); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21463 __Pyx_GOTREF(__pyx_t_1);
21464 __pyx_r = __pyx_t_1;
21468 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21471 __Pyx_XDECREF(__pyx_t_1);
21472 __Pyx_AddTraceback("csamtools.AlignedRead.mapq.__get__");
21475 __Pyx_XGIVEREF(__pyx_r);
21476 __Pyx_TraceReturn(__pyx_r);
21477 __Pyx_RefNannyFinishContext();
21481 /* "csamtools.pyx":2475
21482 * """mapping quality"""
21483 * def __get__(self): return self._delegate.core.qual
21484 * def __set__(self, qual): self._delegate.core.qual = qual # <<<<<<<<<<<<<<
21486 * """the :term:`reference` id of the mate
21489 static int __pyx_pf_9csamtools_11AlignedRead_4mapq_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual); /*proto*/
21490 static int __pyx_pf_9csamtools_11AlignedRead_4mapq_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual) {
21492 uint32_t __pyx_t_1;
21493 __Pyx_TraceDeclarations
21494 __Pyx_RefNannySetupContext("__set__");
21495 __Pyx_TraceCall("__set__", __pyx_f[0], 2475);
21496 __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 = 2475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21497 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.qual = __pyx_t_1;
21502 __Pyx_AddTraceback("csamtools.AlignedRead.mapq.__set__");
21505 __Pyx_TraceReturn(Py_None);
21506 __Pyx_RefNannyFinishContext();
21510 /* "csamtools.pyx":2480
21511 * deprecated, use RNEXT instead.
21513 * def __get__(self): return self._delegate.core.mtid # <<<<<<<<<<<<<<
21514 * def __set__(self, mtid): self._delegate.core.mtid = mtid
21518 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(PyObject *__pyx_v_self); /*proto*/
21519 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(PyObject *__pyx_v_self) {
21520 PyObject *__pyx_r = NULL;
21521 PyObject *__pyx_t_1 = NULL;
21522 __Pyx_TraceDeclarations
21523 __Pyx_RefNannySetupContext("__get__");
21524 __Pyx_TraceCall("__get__", __pyx_f[0], 2480);
21525 __Pyx_XDECREF(__pyx_r);
21526 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mtid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21527 __Pyx_GOTREF(__pyx_t_1);
21528 __pyx_r = __pyx_t_1;
21532 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21535 __Pyx_XDECREF(__pyx_t_1);
21536 __Pyx_AddTraceback("csamtools.AlignedRead.mrnm.__get__");
21539 __Pyx_XGIVEREF(__pyx_r);
21540 __Pyx_TraceReturn(__pyx_r);
21541 __Pyx_RefNannyFinishContext();
21545 /* "csamtools.pyx":2481
21547 * def __get__(self): return self._delegate.core.mtid
21548 * def __set__(self, mtid): self._delegate.core.mtid = mtid # <<<<<<<<<<<<<<
21550 * """the :term:`reference` id of the mate """
21553 static int __pyx_pf_9csamtools_11AlignedRead_4mrnm_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid); /*proto*/
21554 static int __pyx_pf_9csamtools_11AlignedRead_4mrnm_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid) {
21557 __Pyx_TraceDeclarations
21558 __Pyx_RefNannySetupContext("__set__");
21559 __Pyx_TraceCall("__set__", __pyx_f[0], 2481);
21560 __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 = 2481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21561 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mtid = __pyx_t_1;
21566 __Pyx_AddTraceback("csamtools.AlignedRead.mrnm.__set__");
21569 __Pyx_TraceReturn(Py_None);
21570 __Pyx_RefNannyFinishContext();
21574 /* "csamtools.pyx":2484
21576 * """the :term:`reference` id of the mate """
21577 * def __get__(self): return self._delegate.core.mtid # <<<<<<<<<<<<<<
21578 * def __set__(self, mtid): self._delegate.core.mtid = mtid
21582 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rnext___get__(PyObject *__pyx_v_self); /*proto*/
21583 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rnext___get__(PyObject *__pyx_v_self) {
21584 PyObject *__pyx_r = NULL;
21585 PyObject *__pyx_t_1 = NULL;
21586 __Pyx_TraceDeclarations
21587 __Pyx_RefNannySetupContext("__get__");
21588 __Pyx_TraceCall("__get__", __pyx_f[0], 2484);
21589 __Pyx_XDECREF(__pyx_r);
21590 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mtid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21591 __Pyx_GOTREF(__pyx_t_1);
21592 __pyx_r = __pyx_t_1;
21596 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21599 __Pyx_XDECREF(__pyx_t_1);
21600 __Pyx_AddTraceback("csamtools.AlignedRead.rnext.__get__");
21603 __Pyx_XGIVEREF(__pyx_r);
21604 __Pyx_TraceReturn(__pyx_r);
21605 __Pyx_RefNannyFinishContext();
21609 /* "csamtools.pyx":2485
21610 * """the :term:`reference` id of the mate """
21611 * def __get__(self): return self._delegate.core.mtid
21612 * def __set__(self, mtid): self._delegate.core.mtid = mtid # <<<<<<<<<<<<<<
21614 * """the position of the mate
21617 static int __pyx_pf_9csamtools_11AlignedRead_5rnext_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid); /*proto*/
21618 static int __pyx_pf_9csamtools_11AlignedRead_5rnext_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid) {
21621 __Pyx_TraceDeclarations
21622 __Pyx_RefNannySetupContext("__set__");
21623 __Pyx_TraceCall("__set__", __pyx_f[0], 2485);
21624 __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 = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21625 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mtid = __pyx_t_1;
21630 __Pyx_AddTraceback("csamtools.AlignedRead.rnext.__set__");
21633 __Pyx_TraceReturn(Py_None);
21634 __Pyx_RefNannyFinishContext();
21638 /* "csamtools.pyx":2489
21639 * """the position of the mate
21640 * deprecated, use PNEXT instead."""
21641 * def __get__(self): return self._delegate.core.mpos # <<<<<<<<<<<<<<
21642 * def __set__(self, mpos): self._delegate.core.mpos = mpos
21646 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mpos___get__(PyObject *__pyx_v_self); /*proto*/
21647 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mpos___get__(PyObject *__pyx_v_self) {
21648 PyObject *__pyx_r = NULL;
21649 PyObject *__pyx_t_1 = NULL;
21650 __Pyx_TraceDeclarations
21651 __Pyx_RefNannySetupContext("__get__");
21652 __Pyx_TraceCall("__get__", __pyx_f[0], 2489);
21653 __Pyx_XDECREF(__pyx_r);
21654 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21655 __Pyx_GOTREF(__pyx_t_1);
21656 __pyx_r = __pyx_t_1;
21660 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21663 __Pyx_XDECREF(__pyx_t_1);
21664 __Pyx_AddTraceback("csamtools.AlignedRead.mpos.__get__");
21667 __Pyx_XGIVEREF(__pyx_r);
21668 __Pyx_TraceReturn(__pyx_r);
21669 __Pyx_RefNannyFinishContext();
21673 /* "csamtools.pyx":2490
21674 * deprecated, use PNEXT instead."""
21675 * def __get__(self): return self._delegate.core.mpos
21676 * def __set__(self, mpos): self._delegate.core.mpos = mpos # <<<<<<<<<<<<<<
21678 * """the position of the mate"""
21681 static int __pyx_pf_9csamtools_11AlignedRead_4mpos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos); /*proto*/
21682 static int __pyx_pf_9csamtools_11AlignedRead_4mpos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos) {
21685 __Pyx_TraceDeclarations
21686 __Pyx_RefNannySetupContext("__set__");
21687 __Pyx_TraceCall("__set__", __pyx_f[0], 2490);
21688 __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 = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21689 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mpos = __pyx_t_1;
21694 __Pyx_AddTraceback("csamtools.AlignedRead.mpos.__set__");
21697 __Pyx_TraceReturn(Py_None);
21698 __Pyx_RefNannyFinishContext();
21702 /* "csamtools.pyx":2493
21704 * """the position of the mate"""
21705 * def __get__(self): return self._delegate.core.mpos # <<<<<<<<<<<<<<
21706 * def __set__(self, mpos): self._delegate.core.mpos = mpos
21710 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5pnext___get__(PyObject *__pyx_v_self); /*proto*/
21711 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5pnext___get__(PyObject *__pyx_v_self) {
21712 PyObject *__pyx_r = NULL;
21713 PyObject *__pyx_t_1 = NULL;
21714 __Pyx_TraceDeclarations
21715 __Pyx_RefNannySetupContext("__get__");
21716 __Pyx_TraceCall("__get__", __pyx_f[0], 2493);
21717 __Pyx_XDECREF(__pyx_r);
21718 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21719 __Pyx_GOTREF(__pyx_t_1);
21720 __pyx_r = __pyx_t_1;
21724 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21727 __Pyx_XDECREF(__pyx_t_1);
21728 __Pyx_AddTraceback("csamtools.AlignedRead.pnext.__get__");
21731 __Pyx_XGIVEREF(__pyx_r);
21732 __Pyx_TraceReturn(__pyx_r);
21733 __Pyx_RefNannyFinishContext();
21737 /* "csamtools.pyx":2494
21738 * """the position of the mate"""
21739 * def __get__(self): return self._delegate.core.mpos
21740 * def __set__(self, mpos): self._delegate.core.mpos = mpos # <<<<<<<<<<<<<<
21742 * """the insert size
21745 static int __pyx_pf_9csamtools_11AlignedRead_5pnext_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos); /*proto*/
21746 static int __pyx_pf_9csamtools_11AlignedRead_5pnext_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos) {
21749 __Pyx_TraceDeclarations
21750 __Pyx_RefNannySetupContext("__set__");
21751 __Pyx_TraceCall("__set__", __pyx_f[0], 2494);
21752 __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 = 2494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21753 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mpos = __pyx_t_1;
21758 __Pyx_AddTraceback("csamtools.AlignedRead.pnext.__set__");
21761 __Pyx_TraceReturn(Py_None);
21762 __Pyx_RefNannyFinishContext();
21766 /* "csamtools.pyx":2498
21767 * """the insert size
21768 * deprecated: use tlen instead"""
21769 * def __get__(self): return self._delegate.core.isize # <<<<<<<<<<<<<<
21770 * def __set__(self, isize): self._delegate.core.isize = isize
21774 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5isize___get__(PyObject *__pyx_v_self); /*proto*/
21775 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5isize___get__(PyObject *__pyx_v_self) {
21776 PyObject *__pyx_r = NULL;
21777 PyObject *__pyx_t_1 = NULL;
21778 __Pyx_TraceDeclarations
21779 __Pyx_RefNannySetupContext("__get__");
21780 __Pyx_TraceCall("__get__", __pyx_f[0], 2498);
21781 __Pyx_XDECREF(__pyx_r);
21782 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.isize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21783 __Pyx_GOTREF(__pyx_t_1);
21784 __pyx_r = __pyx_t_1;
21788 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21791 __Pyx_XDECREF(__pyx_t_1);
21792 __Pyx_AddTraceback("csamtools.AlignedRead.isize.__get__");
21795 __Pyx_XGIVEREF(__pyx_r);
21796 __Pyx_TraceReturn(__pyx_r);
21797 __Pyx_RefNannyFinishContext();
21801 /* "csamtools.pyx":2499
21802 * deprecated: use tlen instead"""
21803 * def __get__(self): return self._delegate.core.isize
21804 * def __set__(self, isize): self._delegate.core.isize = isize # <<<<<<<<<<<<<<
21806 * """the insert size"""
21809 static int __pyx_pf_9csamtools_11AlignedRead_5isize_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize); /*proto*/
21810 static int __pyx_pf_9csamtools_11AlignedRead_5isize_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize) {
21813 __Pyx_TraceDeclarations
21814 __Pyx_RefNannySetupContext("__set__");
21815 __Pyx_TraceCall("__set__", __pyx_f[0], 2499);
21816 __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 = 2499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21817 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.isize = __pyx_t_1;
21822 __Pyx_AddTraceback("csamtools.AlignedRead.isize.__set__");
21825 __Pyx_TraceReturn(Py_None);
21826 __Pyx_RefNannyFinishContext();
21830 /* "csamtools.pyx":2502
21832 * """the insert size"""
21833 * def __get__(self): return self._delegate.core.isize # <<<<<<<<<<<<<<
21834 * def __set__(self, isize): self._delegate.core.isize = isize
21835 * property is_paired:
21838 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tlen___get__(PyObject *__pyx_v_self); /*proto*/
21839 static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tlen___get__(PyObject *__pyx_v_self) {
21840 PyObject *__pyx_r = NULL;
21841 PyObject *__pyx_t_1 = NULL;
21842 __Pyx_TraceDeclarations
21843 __Pyx_RefNannySetupContext("__get__");
21844 __Pyx_TraceCall("__get__", __pyx_f[0], 2502);
21845 __Pyx_XDECREF(__pyx_r);
21846 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.isize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21847 __Pyx_GOTREF(__pyx_t_1);
21848 __pyx_r = __pyx_t_1;
21852 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21855 __Pyx_XDECREF(__pyx_t_1);
21856 __Pyx_AddTraceback("csamtools.AlignedRead.tlen.__get__");
21859 __Pyx_XGIVEREF(__pyx_r);
21860 __Pyx_TraceReturn(__pyx_r);
21861 __Pyx_RefNannyFinishContext();
21865 /* "csamtools.pyx":2503
21866 * """the insert size"""
21867 * def __get__(self): return self._delegate.core.isize
21868 * def __set__(self, isize): self._delegate.core.isize = isize # <<<<<<<<<<<<<<
21869 * property is_paired:
21870 * """true if read is paired in sequencing"""
21873 static int __pyx_pf_9csamtools_11AlignedRead_4tlen_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize); /*proto*/
21874 static int __pyx_pf_9csamtools_11AlignedRead_4tlen_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize) {
21877 __Pyx_TraceDeclarations
21878 __Pyx_RefNannySetupContext("__set__");
21879 __Pyx_TraceCall("__set__", __pyx_f[0], 2503);
21880 __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 = 2503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21881 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.isize = __pyx_t_1;
21886 __Pyx_AddTraceback("csamtools.AlignedRead.tlen.__set__");
21889 __Pyx_TraceReturn(Py_None);
21890 __Pyx_RefNannyFinishContext();
21894 /* "csamtools.pyx":2506
21895 * property is_paired:
21896 * """true if read is paired in sequencing"""
21897 * def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0 # <<<<<<<<<<<<<<
21898 * def __set__(self,val):
21899 * if val: self._delegate.core.flag |= BAM_FPAIRED
21902 static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(PyObject *__pyx_v_self); /*proto*/
21903 static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(PyObject *__pyx_v_self) {
21904 PyObject *__pyx_r = NULL;
21905 PyObject *__pyx_t_1 = NULL;
21906 __Pyx_TraceDeclarations
21907 __Pyx_RefNannySetupContext("__get__");
21908 __Pyx_TraceCall("__get__", __pyx_f[0], 2506);
21909 __Pyx_XDECREF(__pyx_r);
21910 __pyx_t_1 = __Pyx_PyBool_FromLong(((((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & 1) != 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21911 __Pyx_GOTREF(__pyx_t_1);
21912 __pyx_r = __pyx_t_1;
21916 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21919 __Pyx_XDECREF(__pyx_t_1);
21920 __Pyx_AddTraceback("csamtools.AlignedRead.is_paired.__get__");
21923 __Pyx_XGIVEREF(__pyx_r);
21924 __Pyx_TraceReturn(__pyx_r);
21925 __Pyx_RefNannyFinishContext();
21929 /* "csamtools.pyx":2507
21930 * """true if read is paired in sequencing"""
21931 * def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0
21932 * def __set__(self,val): # <<<<<<<<<<<<<<
21933 * if val: self._delegate.core.flag |= BAM_FPAIRED
21934 * else: self._delegate.core.flag &= ~BAM_FPAIRED
21937 static int __pyx_pf_9csamtools_11AlignedRead_9is_paired_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
21938 static int __pyx_pf_9csamtools_11AlignedRead_9is_paired_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
21941 __Pyx_TraceDeclarations
21942 __Pyx_RefNannySetupContext("__set__");
21943 __Pyx_TraceCall("__set__", __pyx_f[0], 2507);
21945 /* "csamtools.pyx":2508
21946 * def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0
21947 * def __set__(self,val):
21948 * if val: self._delegate.core.flag |= BAM_FPAIRED # <<<<<<<<<<<<<<
21949 * else: self._delegate.core.flag &= ~BAM_FPAIRED
21950 * property is_proper_pair:
21952 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21954 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 1);
21959 /* "csamtools.pyx":2509
21960 * def __set__(self,val):
21961 * if val: self._delegate.core.flag |= BAM_FPAIRED
21962 * else: self._delegate.core.flag &= ~BAM_FPAIRED # <<<<<<<<<<<<<<
21963 * property is_proper_pair:
21964 * """true if read is mapped in a proper pair"""
21966 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~1));
21973 __Pyx_AddTraceback("csamtools.AlignedRead.is_paired.__set__");
21976 __Pyx_TraceReturn(Py_None);
21977 __Pyx_RefNannyFinishContext();
21981 /* "csamtools.pyx":2512
21982 * property is_proper_pair:
21983 * """true if read is mapped in a proper pair"""
21984 * def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0 # <<<<<<<<<<<<<<
21985 * def __set__(self,val):
21986 * if val: self._delegate.core.flag |= BAM_FPROPER_PAIR
21989 static PyObject *__pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(PyObject *__pyx_v_self); /*proto*/
21990 static PyObject *__pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(PyObject *__pyx_v_self) {
21991 PyObject *__pyx_r = NULL;
21992 PyObject *__pyx_t_1 = NULL;
21993 PyObject *__pyx_t_2 = NULL;
21994 __Pyx_TraceDeclarations
21995 __Pyx_RefNannySetupContext("__get__");
21996 __Pyx_TraceCall("__get__", __pyx_f[0], 2512);
21997 __Pyx_XDECREF(__pyx_r);
21998 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
21999 __Pyx_GOTREF(__pyx_t_1);
22000 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22001 __Pyx_GOTREF(__pyx_t_2);
22002 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22003 __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 = 2512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22004 __Pyx_GOTREF(__pyx_t_1);
22005 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22006 __pyx_r = __pyx_t_1;
22010 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
22013 __Pyx_XDECREF(__pyx_t_1);
22014 __Pyx_XDECREF(__pyx_t_2);
22015 __Pyx_AddTraceback("csamtools.AlignedRead.is_proper_pair.__get__");
22018 __Pyx_XGIVEREF(__pyx_r);
22019 __Pyx_TraceReturn(__pyx_r);
22020 __Pyx_RefNannyFinishContext();
22024 /* "csamtools.pyx":2513
22025 * """true if read is mapped in a proper pair"""
22026 * def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0
22027 * def __set__(self,val): # <<<<<<<<<<<<<<
22028 * if val: self._delegate.core.flag |= BAM_FPROPER_PAIR
22029 * else: self._delegate.core.flag &= ~BAM_FPROPER_PAIR
22032 static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
22033 static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
22036 __Pyx_TraceDeclarations
22037 __Pyx_RefNannySetupContext("__set__");
22038 __Pyx_TraceCall("__set__", __pyx_f[0], 2513);
22040 /* "csamtools.pyx":2514
22041 * def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0
22042 * def __set__(self,val):
22043 * if val: self._delegate.core.flag |= BAM_FPROPER_PAIR # <<<<<<<<<<<<<<
22044 * else: self._delegate.core.flag &= ~BAM_FPROPER_PAIR
22045 * property is_unmapped:
22047 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22049 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 2);
22054 /* "csamtools.pyx":2515
22055 * def __set__(self,val):
22056 * if val: self._delegate.core.flag |= BAM_FPROPER_PAIR
22057 * else: self._delegate.core.flag &= ~BAM_FPROPER_PAIR # <<<<<<<<<<<<<<
22058 * property is_unmapped:
22059 * """true if read itself is unmapped"""
22061 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~2));
22068 __Pyx_AddTraceback("csamtools.AlignedRead.is_proper_pair.__set__");
22071 __Pyx_TraceReturn(Py_None);
22072 __Pyx_RefNannyFinishContext();
22076 /* "csamtools.pyx":2518
22077 * property is_unmapped:
22078 * """true if read itself is unmapped"""
22079 * def __get__(self): return (self.flag & BAM_FUNMAP) != 0 # <<<<<<<<<<<<<<
22080 * def __set__(self,val):
22081 * if val: self._delegate.core.flag |= BAM_FUNMAP
22084 static PyObject *__pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(PyObject *__pyx_v_self); /*proto*/
22085 static PyObject *__pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(PyObject *__pyx_v_self) {
22086 PyObject *__pyx_r = NULL;
22087 PyObject *__pyx_t_1 = NULL;
22088 PyObject *__pyx_t_2 = NULL;
22089 __Pyx_TraceDeclarations
22090 __Pyx_RefNannySetupContext("__get__");
22091 __Pyx_TraceCall("__get__", __pyx_f[0], 2518);
22092 __Pyx_XDECREF(__pyx_r);
22093 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22094 __Pyx_GOTREF(__pyx_t_1);
22095 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22096 __Pyx_GOTREF(__pyx_t_2);
22097 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22098 __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 = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22099 __Pyx_GOTREF(__pyx_t_1);
22100 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22101 __pyx_r = __pyx_t_1;
22105 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
22108 __Pyx_XDECREF(__pyx_t_1);
22109 __Pyx_XDECREF(__pyx_t_2);
22110 __Pyx_AddTraceback("csamtools.AlignedRead.is_unmapped.__get__");
22113 __Pyx_XGIVEREF(__pyx_r);
22114 __Pyx_TraceReturn(__pyx_r);
22115 __Pyx_RefNannyFinishContext();
22119 /* "csamtools.pyx":2519
22120 * """true if read itself is unmapped"""
22121 * def __get__(self): return (self.flag & BAM_FUNMAP) != 0
22122 * def __set__(self,val): # <<<<<<<<<<<<<<
22123 * if val: self._delegate.core.flag |= BAM_FUNMAP
22124 * else: self._delegate.core.flag &= ~BAM_FUNMAP
22127 static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
22128 static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
22131 __Pyx_TraceDeclarations
22132 __Pyx_RefNannySetupContext("__set__");
22133 __Pyx_TraceCall("__set__", __pyx_f[0], 2519);
22135 /* "csamtools.pyx":2520
22136 * def __get__(self): return (self.flag & BAM_FUNMAP) != 0
22137 * def __set__(self,val):
22138 * if val: self._delegate.core.flag |= BAM_FUNMAP # <<<<<<<<<<<<<<
22139 * else: self._delegate.core.flag &= ~BAM_FUNMAP
22140 * property mate_is_unmapped:
22142 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22144 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 4);
22149 /* "csamtools.pyx":2521
22150 * def __set__(self,val):
22151 * if val: self._delegate.core.flag |= BAM_FUNMAP
22152 * else: self._delegate.core.flag &= ~BAM_FUNMAP # <<<<<<<<<<<<<<
22153 * property mate_is_unmapped:
22154 * """true if the mate is unmapped"""
22156 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~4));
22163 __Pyx_AddTraceback("csamtools.AlignedRead.is_unmapped.__set__");
22166 __Pyx_TraceReturn(Py_None);
22167 __Pyx_RefNannyFinishContext();
22171 /* "csamtools.pyx":2524
22172 * property mate_is_unmapped:
22173 * """true if the mate is unmapped"""
22174 * def __get__(self): return (self.flag & BAM_FMUNMAP) != 0 # <<<<<<<<<<<<<<
22175 * def __set__(self,val):
22176 * if val: self._delegate.core.flag |= BAM_FMUNMAP
22179 static PyObject *__pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(PyObject *__pyx_v_self); /*proto*/
22180 static PyObject *__pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(PyObject *__pyx_v_self) {
22181 PyObject *__pyx_r = NULL;
22182 PyObject *__pyx_t_1 = NULL;
22183 PyObject *__pyx_t_2 = NULL;
22184 __Pyx_TraceDeclarations
22185 __Pyx_RefNannySetupContext("__get__");
22186 __Pyx_TraceCall("__get__", __pyx_f[0], 2524);
22187 __Pyx_XDECREF(__pyx_r);
22188 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22189 __Pyx_GOTREF(__pyx_t_1);
22190 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22191 __Pyx_GOTREF(__pyx_t_2);
22192 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22193 __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 = 2524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22194 __Pyx_GOTREF(__pyx_t_1);
22195 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22196 __pyx_r = __pyx_t_1;
22200 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
22203 __Pyx_XDECREF(__pyx_t_1);
22204 __Pyx_XDECREF(__pyx_t_2);
22205 __Pyx_AddTraceback("csamtools.AlignedRead.mate_is_unmapped.__get__");
22208 __Pyx_XGIVEREF(__pyx_r);
22209 __Pyx_TraceReturn(__pyx_r);
22210 __Pyx_RefNannyFinishContext();
22214 /* "csamtools.pyx":2525
22215 * """true if the mate is unmapped"""
22216 * def __get__(self): return (self.flag & BAM_FMUNMAP) != 0
22217 * def __set__(self,val): # <<<<<<<<<<<<<<
22218 * if val: self._delegate.core.flag |= BAM_FMUNMAP
22219 * else: self._delegate.core.flag &= ~BAM_FMUNMAP
22222 static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
22223 static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
22226 __Pyx_TraceDeclarations
22227 __Pyx_RefNannySetupContext("__set__");
22228 __Pyx_TraceCall("__set__", __pyx_f[0], 2525);
22230 /* "csamtools.pyx":2526
22231 * def __get__(self): return (self.flag & BAM_FMUNMAP) != 0
22232 * def __set__(self,val):
22233 * if val: self._delegate.core.flag |= BAM_FMUNMAP # <<<<<<<<<<<<<<
22234 * else: self._delegate.core.flag &= ~BAM_FMUNMAP
22235 * property is_reverse:
22237 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22239 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 8);
22244 /* "csamtools.pyx":2527
22245 * def __set__(self,val):
22246 * if val: self._delegate.core.flag |= BAM_FMUNMAP
22247 * else: self._delegate.core.flag &= ~BAM_FMUNMAP # <<<<<<<<<<<<<<
22248 * property is_reverse:
22249 * """true if read is mapped to reverse strand"""
22251 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~8));
22258 __Pyx_AddTraceback("csamtools.AlignedRead.mate_is_unmapped.__set__");
22261 __Pyx_TraceReturn(Py_None);
22262 __Pyx_RefNannyFinishContext();
22266 /* "csamtools.pyx":2530
22267 * property is_reverse:
22268 * """true if read is mapped to reverse strand"""
22269 * def __get__(self): return (self.flag & BAM_FREVERSE) != 0 # <<<<<<<<<<<<<<
22270 * def __set__(self,val):
22271 * if val: self._delegate.core.flag |= BAM_FREVERSE
22274 static PyObject *__pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(PyObject *__pyx_v_self); /*proto*/
22275 static PyObject *__pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(PyObject *__pyx_v_self) {
22276 PyObject *__pyx_r = NULL;
22277 PyObject *__pyx_t_1 = NULL;
22278 PyObject *__pyx_t_2 = NULL;
22279 __Pyx_TraceDeclarations
22280 __Pyx_RefNannySetupContext("__get__");
22281 __Pyx_TraceCall("__get__", __pyx_f[0], 2530);
22282 __Pyx_XDECREF(__pyx_r);
22283 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22284 __Pyx_GOTREF(__pyx_t_1);
22285 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_16); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22286 __Pyx_GOTREF(__pyx_t_2);
22287 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22288 __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 = 2530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22289 __Pyx_GOTREF(__pyx_t_1);
22290 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22291 __pyx_r = __pyx_t_1;
22295 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
22298 __Pyx_XDECREF(__pyx_t_1);
22299 __Pyx_XDECREF(__pyx_t_2);
22300 __Pyx_AddTraceback("csamtools.AlignedRead.is_reverse.__get__");
22303 __Pyx_XGIVEREF(__pyx_r);
22304 __Pyx_TraceReturn(__pyx_r);
22305 __Pyx_RefNannyFinishContext();
22309 /* "csamtools.pyx":2531
22310 * """true if read is mapped to reverse strand"""
22311 * def __get__(self): return (self.flag & BAM_FREVERSE) != 0
22312 * def __set__(self,val): # <<<<<<<<<<<<<<
22313 * if val: self._delegate.core.flag |= BAM_FREVERSE
22314 * else: self._delegate.core.flag &= ~BAM_FREVERSE
22317 static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
22318 static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
22321 __Pyx_TraceDeclarations
22322 __Pyx_RefNannySetupContext("__set__");
22323 __Pyx_TraceCall("__set__", __pyx_f[0], 2531);
22325 /* "csamtools.pyx":2532
22326 * def __get__(self): return (self.flag & BAM_FREVERSE) != 0
22327 * def __set__(self,val):
22328 * if val: self._delegate.core.flag |= BAM_FREVERSE # <<<<<<<<<<<<<<
22329 * else: self._delegate.core.flag &= ~BAM_FREVERSE
22330 * property mate_is_reverse:
22332 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22334 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 16);
22339 /* "csamtools.pyx":2533
22340 * def __set__(self,val):
22341 * if val: self._delegate.core.flag |= BAM_FREVERSE
22342 * else: self._delegate.core.flag &= ~BAM_FREVERSE # <<<<<<<<<<<<<<
22343 * property mate_is_reverse:
22344 * """true is read is mapped to reverse strand"""
22346 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~16));
22353 __Pyx_AddTraceback("csamtools.AlignedRead.is_reverse.__set__");
22356 __Pyx_TraceReturn(Py_None);
22357 __Pyx_RefNannyFinishContext();
22361 /* "csamtools.pyx":2536
22362 * property mate_is_reverse:
22363 * """true is read is mapped to reverse strand"""
22364 * def __get__(self): return (self.flag & BAM_FMREVERSE) != 0 # <<<<<<<<<<<<<<
22365 * def __set__(self,val):
22366 * if val: self._delegate.core.flag |= BAM_FMREVERSE
22369 static PyObject *__pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(PyObject *__pyx_v_self); /*proto*/
22370 static PyObject *__pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(PyObject *__pyx_v_self) {
22371 PyObject *__pyx_r = NULL;
22372 PyObject *__pyx_t_1 = NULL;
22373 PyObject *__pyx_t_2 = NULL;
22374 __Pyx_TraceDeclarations
22375 __Pyx_RefNannySetupContext("__get__");
22376 __Pyx_TraceCall("__get__", __pyx_f[0], 2536);
22377 __Pyx_XDECREF(__pyx_r);
22378 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22379 __Pyx_GOTREF(__pyx_t_1);
22380 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22381 __Pyx_GOTREF(__pyx_t_2);
22382 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22383 __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 = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22384 __Pyx_GOTREF(__pyx_t_1);
22385 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22386 __pyx_r = __pyx_t_1;
22390 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
22393 __Pyx_XDECREF(__pyx_t_1);
22394 __Pyx_XDECREF(__pyx_t_2);
22395 __Pyx_AddTraceback("csamtools.AlignedRead.mate_is_reverse.__get__");
22398 __Pyx_XGIVEREF(__pyx_r);
22399 __Pyx_TraceReturn(__pyx_r);
22400 __Pyx_RefNannyFinishContext();
22404 /* "csamtools.pyx":2537
22405 * """true is read is mapped to reverse strand"""
22406 * def __get__(self): return (self.flag & BAM_FMREVERSE) != 0
22407 * def __set__(self,val): # <<<<<<<<<<<<<<
22408 * if val: self._delegate.core.flag |= BAM_FMREVERSE
22409 * else: self._delegate.core.flag &= ~BAM_FMREVERSE
22412 static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
22413 static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
22416 __Pyx_TraceDeclarations
22417 __Pyx_RefNannySetupContext("__set__");
22418 __Pyx_TraceCall("__set__", __pyx_f[0], 2537);
22420 /* "csamtools.pyx":2538
22421 * def __get__(self): return (self.flag & BAM_FMREVERSE) != 0
22422 * def __set__(self,val):
22423 * if val: self._delegate.core.flag |= BAM_FMREVERSE # <<<<<<<<<<<<<<
22424 * else: self._delegate.core.flag &= ~BAM_FMREVERSE
22425 * property is_read1:
22427 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22429 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 32);
22434 /* "csamtools.pyx":2539
22435 * def __set__(self,val):
22436 * if val: self._delegate.core.flag |= BAM_FMREVERSE
22437 * else: self._delegate.core.flag &= ~BAM_FMREVERSE # <<<<<<<<<<<<<<
22438 * property is_read1:
22439 * """true if this is read1"""
22441 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~32));
22448 __Pyx_AddTraceback("csamtools.AlignedRead.mate_is_reverse.__set__");
22451 __Pyx_TraceReturn(Py_None);
22452 __Pyx_RefNannyFinishContext();
22456 /* "csamtools.pyx":2542
22457 * property is_read1:
22458 * """true if this is read1"""
22459 * def __get__(self): return (self.flag & BAM_FREAD1) != 0 # <<<<<<<<<<<<<<
22460 * def __set__(self,val):
22461 * if val: self._delegate.core.flag |= BAM_FREAD1
22464 static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(PyObject *__pyx_v_self); /*proto*/
22465 static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(PyObject *__pyx_v_self) {
22466 PyObject *__pyx_r = NULL;
22467 PyObject *__pyx_t_1 = NULL;
22468 PyObject *__pyx_t_2 = NULL;
22469 __Pyx_TraceDeclarations
22470 __Pyx_RefNannySetupContext("__get__");
22471 __Pyx_TraceCall("__get__", __pyx_f[0], 2542);
22472 __Pyx_XDECREF(__pyx_r);
22473 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22474 __Pyx_GOTREF(__pyx_t_1);
22475 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22476 __Pyx_GOTREF(__pyx_t_2);
22477 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22478 __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 = 2542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22479 __Pyx_GOTREF(__pyx_t_1);
22480 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22481 __pyx_r = __pyx_t_1;
22485 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
22488 __Pyx_XDECREF(__pyx_t_1);
22489 __Pyx_XDECREF(__pyx_t_2);
22490 __Pyx_AddTraceback("csamtools.AlignedRead.is_read1.__get__");
22493 __Pyx_XGIVEREF(__pyx_r);
22494 __Pyx_TraceReturn(__pyx_r);
22495 __Pyx_RefNannyFinishContext();
22499 /* "csamtools.pyx":2543
22500 * """true if this is read1"""
22501 * def __get__(self): return (self.flag & BAM_FREAD1) != 0
22502 * def __set__(self,val): # <<<<<<<<<<<<<<
22503 * if val: self._delegate.core.flag |= BAM_FREAD1
22504 * else: self._delegate.core.flag &= ~BAM_FREAD1
22507 static int __pyx_pf_9csamtools_11AlignedRead_8is_read1_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
22508 static int __pyx_pf_9csamtools_11AlignedRead_8is_read1_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
22511 __Pyx_TraceDeclarations
22512 __Pyx_RefNannySetupContext("__set__");
22513 __Pyx_TraceCall("__set__", __pyx_f[0], 2543);
22515 /* "csamtools.pyx":2544
22516 * def __get__(self): return (self.flag & BAM_FREAD1) != 0
22517 * def __set__(self,val):
22518 * if val: self._delegate.core.flag |= BAM_FREAD1 # <<<<<<<<<<<<<<
22519 * else: self._delegate.core.flag &= ~BAM_FREAD1
22520 * property is_read2:
22522 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22524 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 64);
22529 /* "csamtools.pyx":2545
22530 * def __set__(self,val):
22531 * if val: self._delegate.core.flag |= BAM_FREAD1
22532 * else: self._delegate.core.flag &= ~BAM_FREAD1 # <<<<<<<<<<<<<<
22533 * property is_read2:
22534 * """true if this is read2"""
22536 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~64));
22543 __Pyx_AddTraceback("csamtools.AlignedRead.is_read1.__set__");
22546 __Pyx_TraceReturn(Py_None);
22547 __Pyx_RefNannyFinishContext();
22551 /* "csamtools.pyx":2548
22552 * property is_read2:
22553 * """true if this is read2"""
22554 * def __get__(self): return (self.flag & BAM_FREAD2) != 0 # <<<<<<<<<<<<<<
22555 * def __set__(self,val):
22556 * if val: self._delegate.core.flag |= BAM_FREAD2
22559 static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(PyObject *__pyx_v_self); /*proto*/
22560 static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(PyObject *__pyx_v_self) {
22561 PyObject *__pyx_r = NULL;
22562 PyObject *__pyx_t_1 = NULL;
22563 PyObject *__pyx_t_2 = NULL;
22564 __Pyx_TraceDeclarations
22565 __Pyx_RefNannySetupContext("__get__");
22566 __Pyx_TraceCall("__get__", __pyx_f[0], 2548);
22567 __Pyx_XDECREF(__pyx_r);
22568 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22569 __Pyx_GOTREF(__pyx_t_1);
22570 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_128); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22571 __Pyx_GOTREF(__pyx_t_2);
22572 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22573 __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 = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22574 __Pyx_GOTREF(__pyx_t_1);
22575 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22576 __pyx_r = __pyx_t_1;
22580 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
22583 __Pyx_XDECREF(__pyx_t_1);
22584 __Pyx_XDECREF(__pyx_t_2);
22585 __Pyx_AddTraceback("csamtools.AlignedRead.is_read2.__get__");
22588 __Pyx_XGIVEREF(__pyx_r);
22589 __Pyx_TraceReturn(__pyx_r);
22590 __Pyx_RefNannyFinishContext();
22594 /* "csamtools.pyx":2549
22595 * """true if this is read2"""
22596 * def __get__(self): return (self.flag & BAM_FREAD2) != 0
22597 * def __set__(self,val): # <<<<<<<<<<<<<<
22598 * if val: self._delegate.core.flag |= BAM_FREAD2
22599 * else: self._delegate.core.flag &= ~BAM_FREAD2
22602 static int __pyx_pf_9csamtools_11AlignedRead_8is_read2_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
22603 static int __pyx_pf_9csamtools_11AlignedRead_8is_read2_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
22606 __Pyx_TraceDeclarations
22607 __Pyx_RefNannySetupContext("__set__");
22608 __Pyx_TraceCall("__set__", __pyx_f[0], 2549);
22610 /* "csamtools.pyx":2550
22611 * def __get__(self): return (self.flag & BAM_FREAD2) != 0
22612 * def __set__(self,val):
22613 * if val: self._delegate.core.flag |= BAM_FREAD2 # <<<<<<<<<<<<<<
22614 * else: self._delegate.core.flag &= ~BAM_FREAD2
22615 * property is_secondary:
22617 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22619 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 128);
22624 /* "csamtools.pyx":2551
22625 * def __set__(self,val):
22626 * if val: self._delegate.core.flag |= BAM_FREAD2
22627 * else: self._delegate.core.flag &= ~BAM_FREAD2 # <<<<<<<<<<<<<<
22628 * property is_secondary:
22629 * """true if not primary alignment"""
22631 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~128));
22638 __Pyx_AddTraceback("csamtools.AlignedRead.is_read2.__set__");
22641 __Pyx_TraceReturn(Py_None);
22642 __Pyx_RefNannyFinishContext();
22646 /* "csamtools.pyx":2554
22647 * property is_secondary:
22648 * """true if not primary alignment"""
22649 * def __get__(self): return (self.flag & BAM_FSECONDARY) != 0 # <<<<<<<<<<<<<<
22650 * def __set__(self,val):
22651 * if val: self._delegate.core.flag |= BAM_FSECONDARY
22654 static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(PyObject *__pyx_v_self); /*proto*/
22655 static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(PyObject *__pyx_v_self) {
22656 PyObject *__pyx_r = NULL;
22657 PyObject *__pyx_t_1 = NULL;
22658 PyObject *__pyx_t_2 = NULL;
22659 __Pyx_TraceDeclarations
22660 __Pyx_RefNannySetupContext("__get__");
22661 __Pyx_TraceCall("__get__", __pyx_f[0], 2554);
22662 __Pyx_XDECREF(__pyx_r);
22663 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22664 __Pyx_GOTREF(__pyx_t_1);
22665 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_256); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22666 __Pyx_GOTREF(__pyx_t_2);
22667 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22668 __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 = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22669 __Pyx_GOTREF(__pyx_t_1);
22670 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22671 __pyx_r = __pyx_t_1;
22675 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
22678 __Pyx_XDECREF(__pyx_t_1);
22679 __Pyx_XDECREF(__pyx_t_2);
22680 __Pyx_AddTraceback("csamtools.AlignedRead.is_secondary.__get__");
22683 __Pyx_XGIVEREF(__pyx_r);
22684 __Pyx_TraceReturn(__pyx_r);
22685 __Pyx_RefNannyFinishContext();
22689 /* "csamtools.pyx":2555
22690 * """true if not primary alignment"""
22691 * def __get__(self): return (self.flag & BAM_FSECONDARY) != 0
22692 * def __set__(self,val): # <<<<<<<<<<<<<<
22693 * if val: self._delegate.core.flag |= BAM_FSECONDARY
22694 * else: self._delegate.core.flag &= ~BAM_FSECONDARY
22697 static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
22698 static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
22701 __Pyx_TraceDeclarations
22702 __Pyx_RefNannySetupContext("__set__");
22703 __Pyx_TraceCall("__set__", __pyx_f[0], 2555);
22705 /* "csamtools.pyx":2556
22706 * def __get__(self): return (self.flag & BAM_FSECONDARY) != 0
22707 * def __set__(self,val):
22708 * if val: self._delegate.core.flag |= BAM_FSECONDARY # <<<<<<<<<<<<<<
22709 * else: self._delegate.core.flag &= ~BAM_FSECONDARY
22710 * property is_qcfail:
22712 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22714 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 256);
22719 /* "csamtools.pyx":2557
22720 * def __set__(self,val):
22721 * if val: self._delegate.core.flag |= BAM_FSECONDARY
22722 * else: self._delegate.core.flag &= ~BAM_FSECONDARY # <<<<<<<<<<<<<<
22723 * property is_qcfail:
22724 * """true if QC failure"""
22726 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~256));
22733 __Pyx_AddTraceback("csamtools.AlignedRead.is_secondary.__set__");
22736 __Pyx_TraceReturn(Py_None);
22737 __Pyx_RefNannyFinishContext();
22741 /* "csamtools.pyx":2560
22742 * property is_qcfail:
22743 * """true if QC failure"""
22744 * def __get__(self): return (self.flag & BAM_FQCFAIL) != 0 # <<<<<<<<<<<<<<
22745 * def __set__(self,val):
22746 * if val: self._delegate.core.flag |= BAM_FQCFAIL
22749 static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(PyObject *__pyx_v_self); /*proto*/
22750 static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(PyObject *__pyx_v_self) {
22751 PyObject *__pyx_r = NULL;
22752 PyObject *__pyx_t_1 = NULL;
22753 PyObject *__pyx_t_2 = NULL;
22754 __Pyx_TraceDeclarations
22755 __Pyx_RefNannySetupContext("__get__");
22756 __Pyx_TraceCall("__get__", __pyx_f[0], 2560);
22757 __Pyx_XDECREF(__pyx_r);
22758 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22759 __Pyx_GOTREF(__pyx_t_1);
22760 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_512); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22761 __Pyx_GOTREF(__pyx_t_2);
22762 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22763 __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 = 2560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22764 __Pyx_GOTREF(__pyx_t_1);
22765 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22766 __pyx_r = __pyx_t_1;
22770 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
22773 __Pyx_XDECREF(__pyx_t_1);
22774 __Pyx_XDECREF(__pyx_t_2);
22775 __Pyx_AddTraceback("csamtools.AlignedRead.is_qcfail.__get__");
22778 __Pyx_XGIVEREF(__pyx_r);
22779 __Pyx_TraceReturn(__pyx_r);
22780 __Pyx_RefNannyFinishContext();
22784 /* "csamtools.pyx":2561
22785 * """true if QC failure"""
22786 * def __get__(self): return (self.flag & BAM_FQCFAIL) != 0
22787 * def __set__(self,val): # <<<<<<<<<<<<<<
22788 * if val: self._delegate.core.flag |= BAM_FQCFAIL
22789 * else: self._delegate.core.flag &= ~BAM_FQCFAIL
22792 static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
22793 static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
22796 __Pyx_TraceDeclarations
22797 __Pyx_RefNannySetupContext("__set__");
22798 __Pyx_TraceCall("__set__", __pyx_f[0], 2561);
22800 /* "csamtools.pyx":2562
22801 * def __get__(self): return (self.flag & BAM_FQCFAIL) != 0
22802 * def __set__(self,val):
22803 * if val: self._delegate.core.flag |= BAM_FQCFAIL # <<<<<<<<<<<<<<
22804 * else: self._delegate.core.flag &= ~BAM_FQCFAIL
22805 * property is_duplicate:
22807 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22809 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 512);
22814 /* "csamtools.pyx":2563
22815 * def __set__(self,val):
22816 * if val: self._delegate.core.flag |= BAM_FQCFAIL
22817 * else: self._delegate.core.flag &= ~BAM_FQCFAIL # <<<<<<<<<<<<<<
22818 * property is_duplicate:
22819 * """true if optical or PCR duplicate"""
22821 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~512));
22828 __Pyx_AddTraceback("csamtools.AlignedRead.is_qcfail.__set__");
22831 __Pyx_TraceReturn(Py_None);
22832 __Pyx_RefNannyFinishContext();
22836 /* "csamtools.pyx":2566
22837 * property is_duplicate:
22838 * """true if optical or PCR duplicate"""
22839 * def __get__(self): return (self.flag & BAM_FDUP) != 0 # <<<<<<<<<<<<<<
22840 * def __set__(self,val):
22841 * if val: self._delegate.core.flag |= BAM_FDUP
22844 static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(PyObject *__pyx_v_self); /*proto*/
22845 static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(PyObject *__pyx_v_self) {
22846 PyObject *__pyx_r = NULL;
22847 PyObject *__pyx_t_1 = NULL;
22848 PyObject *__pyx_t_2 = NULL;
22849 __Pyx_TraceDeclarations
22850 __Pyx_RefNannySetupContext("__get__");
22851 __Pyx_TraceCall("__get__", __pyx_f[0], 2566);
22852 __Pyx_XDECREF(__pyx_r);
22853 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22854 __Pyx_GOTREF(__pyx_t_1);
22855 __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_1024); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22856 __Pyx_GOTREF(__pyx_t_2);
22857 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22858 __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 = 2566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22859 __Pyx_GOTREF(__pyx_t_1);
22860 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22861 __pyx_r = __pyx_t_1;
22865 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
22868 __Pyx_XDECREF(__pyx_t_1);
22869 __Pyx_XDECREF(__pyx_t_2);
22870 __Pyx_AddTraceback("csamtools.AlignedRead.is_duplicate.__get__");
22873 __Pyx_XGIVEREF(__pyx_r);
22874 __Pyx_TraceReturn(__pyx_r);
22875 __Pyx_RefNannyFinishContext();
22879 /* "csamtools.pyx":2567
22880 * """true if optical or PCR duplicate"""
22881 * def __get__(self): return (self.flag & BAM_FDUP) != 0
22882 * def __set__(self,val): # <<<<<<<<<<<<<<
22883 * if val: self._delegate.core.flag |= BAM_FDUP
22884 * else: self._delegate.core.flag &= ~BAM_FDUP
22887 static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
22888 static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
22891 __Pyx_TraceDeclarations
22892 __Pyx_RefNannySetupContext("__set__");
22893 __Pyx_TraceCall("__set__", __pyx_f[0], 2567);
22895 /* "csamtools.pyx":2568
22896 * def __get__(self): return (self.flag & BAM_FDUP) != 0
22897 * def __set__(self,val):
22898 * if val: self._delegate.core.flag |= BAM_FDUP # <<<<<<<<<<<<<<
22899 * else: self._delegate.core.flag &= ~BAM_FDUP
22900 * property positions:
22902 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22904 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 1024);
22909 /* "csamtools.pyx":2569
22910 * def __set__(self,val):
22911 * if val: self._delegate.core.flag |= BAM_FDUP
22912 * else: self._delegate.core.flag &= ~BAM_FDUP # <<<<<<<<<<<<<<
22913 * property positions:
22914 * """a list of reference positions that this read aligns to."""
22916 ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~1024));
22923 __Pyx_AddTraceback("csamtools.AlignedRead.is_duplicate.__set__");
22926 __Pyx_TraceReturn(Py_None);
22927 __Pyx_RefNannyFinishContext();
22931 /* "csamtools.pyx":2572
22932 * property positions:
22933 * """a list of reference positions that this read aligns to."""
22934 * def __get__(self): # <<<<<<<<<<<<<<
22935 * cdef uint32_t k, i, pos
22939 static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(PyObject *__pyx_v_self); /*proto*/
22940 static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(PyObject *__pyx_v_self) {
22941 uint32_t __pyx_v_k;
22942 uint32_t __pyx_v_i;
22943 uint32_t __pyx_v_pos;
22945 uint32_t *__pyx_v_cigar_p;
22946 bam1_t *__pyx_v_src;
22947 PyObject *__pyx_v_result;
22948 PyObject *__pyx_v_l;
22949 PyObject *__pyx_r = NULL;
22950 PyObject *__pyx_t_1 = NULL;
22952 uint32_t __pyx_t_3;
22953 PyObject *__pyx_t_4 = NULL;
22954 uint32_t __pyx_t_5;
22956 __Pyx_TraceDeclarations
22957 __Pyx_RefNannySetupContext("__get__");
22958 __Pyx_TraceCall("__get__", __pyx_f[0], 2572);
22959 __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
22960 __pyx_v_l = Py_None; __Pyx_INCREF(Py_None);
22962 /* "csamtools.pyx":2578
22963 * cdef bam1_t * src
22965 * result = [] # <<<<<<<<<<<<<<
22966 * src = self._delegate
22967 * if src.core.n_cigar == 0: return []
22969 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22970 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
22971 __Pyx_DECREF(((PyObject *)__pyx_v_result));
22972 __pyx_v_result = __pyx_t_1;
22975 /* "csamtools.pyx":2579
22978 * src = self._delegate # <<<<<<<<<<<<<<
22979 * if src.core.n_cigar == 0: return []
22982 __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
22984 /* "csamtools.pyx":2580
22986 * src = self._delegate
22987 * if src.core.n_cigar == 0: return [] # <<<<<<<<<<<<<<
22989 * pos = src.core.pos
22991 __pyx_t_2 = (__pyx_v_src->core.n_cigar == 0);
22993 __Pyx_XDECREF(__pyx_r);
22994 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
22995 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
22996 __pyx_r = ((PyObject *)__pyx_t_1);
23003 /* "csamtools.pyx":2582
23004 * if src.core.n_cigar == 0: return []
23006 * pos = src.core.pos # <<<<<<<<<<<<<<
23008 * cigar_p = bam1_cigar(src)
23010 __pyx_v_pos = __pyx_v_src->core.pos;
23012 /* "csamtools.pyx":2584
23013 * pos = src.core.pos
23015 * cigar_p = bam1_cigar(src) # <<<<<<<<<<<<<<
23016 * for k from 0 <= k < src.core.n_cigar:
23017 * op = cigar_p[k] & BAM_CIGAR_MASK
23019 __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
23021 /* "csamtools.pyx":2585
23023 * cigar_p = bam1_cigar(src)
23024 * for k from 0 <= k < src.core.n_cigar: # <<<<<<<<<<<<<<
23025 * op = cigar_p[k] & BAM_CIGAR_MASK
23026 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
23028 __pyx_t_3 = __pyx_v_src->core.n_cigar;
23029 for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
23031 /* "csamtools.pyx":2586
23032 * cigar_p = bam1_cigar(src)
23033 * for k from 0 <= k < src.core.n_cigar:
23034 * op = cigar_p[k] & BAM_CIGAR_MASK # <<<<<<<<<<<<<<
23035 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
23036 * if op == BAM_CMATCH:
23038 __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);
23040 /* "csamtools.pyx":2587
23041 * for k from 0 <= k < src.core.n_cigar:
23042 * op = cigar_p[k] & BAM_CIGAR_MASK
23043 * l = cigar_p[k] >> BAM_CIGAR_SHIFT # <<<<<<<<<<<<<<
23044 * if op == BAM_CMATCH:
23045 * for i from pos <= i < pos + l:
23047 __pyx_t_1 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23048 __Pyx_GOTREF(__pyx_t_1);
23049 __Pyx_DECREF(__pyx_v_l);
23050 __pyx_v_l = __pyx_t_1;
23053 /* "csamtools.pyx":2588
23054 * op = cigar_p[k] & BAM_CIGAR_MASK
23055 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
23056 * if op == BAM_CMATCH: # <<<<<<<<<<<<<<
23057 * for i from pos <= i < pos + l:
23058 * result.append( i )
23060 __pyx_t_2 = (__pyx_v_op == 0);
23063 /* "csamtools.pyx":2589
23064 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
23065 * if op == BAM_CMATCH:
23066 * for i from pos <= i < pos + l: # <<<<<<<<<<<<<<
23067 * result.append( i )
23070 __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23071 __Pyx_GOTREF(__pyx_t_1);
23072 __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_v_l); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23073 __Pyx_GOTREF(__pyx_t_4);
23074 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23075 __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 = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23076 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23077 for (__pyx_v_i = __pyx_v_pos; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
23079 /* "csamtools.pyx":2590
23080 * if op == BAM_CMATCH:
23081 * for i from pos <= i < pos + l:
23082 * result.append( i ) # <<<<<<<<<<<<<<
23084 * if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:
23086 if (unlikely(__pyx_v_result == Py_None)) {
23087 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23089 __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23090 __Pyx_GOTREF(__pyx_t_4);
23091 __pyx_t_6 = PyList_Append(__pyx_v_result, __pyx_t_4); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23092 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23098 /* "csamtools.pyx":2592
23099 * result.append( i )
23101 * if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP: # <<<<<<<<<<<<<<
23105 switch (__pyx_v_op) {
23110 /* "csamtools.pyx":2593
23112 * if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:
23113 * pos += l # <<<<<<<<<<<<<<
23117 __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23118 __Pyx_GOTREF(__pyx_t_4);
23119 __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_v_l); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23120 __Pyx_GOTREF(__pyx_t_1);
23121 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23122 __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23123 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23124 __pyx_v_pos = __pyx_t_5;
23129 /* "csamtools.pyx":2595
23132 * return result # <<<<<<<<<<<<<<
23134 * def overlap( self, uint32_t start, uint32_t end ):
23136 __Pyx_XDECREF(__pyx_r);
23137 __Pyx_INCREF(((PyObject *)__pyx_v_result));
23138 __pyx_r = ((PyObject *)__pyx_v_result);
23141 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
23144 __Pyx_XDECREF(__pyx_t_1);
23145 __Pyx_XDECREF(__pyx_t_4);
23146 __Pyx_AddTraceback("csamtools.AlignedRead.positions.__get__");
23149 __Pyx_DECREF(__pyx_v_result);
23150 __Pyx_DECREF(__pyx_v_l);
23151 __Pyx_XGIVEREF(__pyx_r);
23152 __Pyx_TraceReturn(__pyx_r);
23153 __Pyx_RefNannyFinishContext();
23157 /* "csamtools.pyx":2597
23160 * def overlap( self, uint32_t start, uint32_t end ): # <<<<<<<<<<<<<<
23161 * """return number of aligned bases of read overlapping the interval *start* and *end*
23162 * on the reference sequence.
23165 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5overlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
23166 static char __pyx_doc_9csamtools_11AlignedRead_5overlap[] = "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 ";
23167 static PyObject *__pyx_pf_9csamtools_11AlignedRead_5overlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
23168 uint32_t __pyx_v_start;
23169 uint32_t __pyx_v_end;
23170 uint32_t __pyx_v_k;
23171 uint32_t __pyx_v_pos;
23172 uint32_t __pyx_v_overlap;
23175 uint32_t *__pyx_v_cigar_p;
23176 bam1_t *__pyx_v_src;
23177 PyObject *__pyx_v_l;
23178 PyObject *__pyx_r = NULL;
23180 uint32_t __pyx_t_2;
23181 PyObject *__pyx_t_3 = NULL;
23182 uint32_t __pyx_t_4;
23183 PyObject *__pyx_t_5 = NULL;
23184 PyObject *__pyx_t_6 = NULL;
23185 PyObject *__pyx_t_7 = NULL;
23186 uint32_t __pyx_t_8;
23187 uint32_t __pyx_t_9;
23189 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0};
23190 __Pyx_TraceDeclarations
23191 __Pyx_RefNannySetupContext("overlap");
23192 __Pyx_TraceCall("overlap", __pyx_f[0], 2597);
23193 if (unlikely(__pyx_kwds)) {
23194 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
23195 PyObject* values[2] = {0,0};
23196 switch (PyTuple_GET_SIZE(__pyx_args)) {
23197 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
23198 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
23200 default: goto __pyx_L5_argtuple_error;
23202 switch (PyTuple_GET_SIZE(__pyx_args)) {
23204 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
23205 if (likely(values[0])) kw_args--;
23206 else goto __pyx_L5_argtuple_error;
23208 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
23209 if (likely(values[1])) kw_args--;
23211 __Pyx_RaiseArgtupleInvalid("overlap", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
23214 if (unlikely(kw_args > 0)) {
23215 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "overlap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
23217 __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 = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
23218 __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 = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
23219 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
23220 goto __pyx_L5_argtuple_error;
23222 __pyx_v_start = __Pyx_PyInt_from_py_uint32_t(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_start == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
23223 __pyx_v_end = __Pyx_PyInt_from_py_uint32_t(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_end == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
23225 goto __pyx_L4_argument_unpacking_done;
23226 __pyx_L5_argtuple_error:;
23227 __Pyx_RaiseArgtupleInvalid("overlap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
23229 __Pyx_AddTraceback("csamtools.AlignedRead.overlap");
23230 __Pyx_RefNannyFinishContext();
23232 __pyx_L4_argument_unpacking_done:;
23233 __pyx_v_l = Py_None; __Pyx_INCREF(Py_None);
23235 /* "csamtools.pyx":2606
23236 * cdef bam1_t * src
23238 * overlap = 0 # <<<<<<<<<<<<<<
23240 * src = self._delegate
23242 __pyx_v_overlap = 0;
23244 /* "csamtools.pyx":2608
23247 * src = self._delegate # <<<<<<<<<<<<<<
23248 * if src.core.n_cigar == 0: return 0
23249 * pos = src.core.pos
23251 __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate;
23253 /* "csamtools.pyx":2609
23255 * src = self._delegate
23256 * if src.core.n_cigar == 0: return 0 # <<<<<<<<<<<<<<
23257 * pos = src.core.pos
23260 __pyx_t_1 = (__pyx_v_src->core.n_cigar == 0);
23262 __Pyx_XDECREF(__pyx_r);
23263 __Pyx_INCREF(__pyx_int_0);
23264 __pyx_r = __pyx_int_0;
23270 /* "csamtools.pyx":2610
23271 * src = self._delegate
23272 * if src.core.n_cigar == 0: return 0
23273 * pos = src.core.pos # <<<<<<<<<<<<<<
23277 __pyx_v_pos = __pyx_v_src->core.pos;
23279 /* "csamtools.pyx":2611
23280 * if src.core.n_cigar == 0: return 0
23281 * pos = src.core.pos
23282 * o = 0 # <<<<<<<<<<<<<<
23284 * cigar_p = bam1_cigar(src)
23288 /* "csamtools.pyx":2613
23291 * cigar_p = bam1_cigar(src) # <<<<<<<<<<<<<<
23292 * for k from 0 <= k < src.core.n_cigar:
23293 * op = cigar_p[k] & BAM_CIGAR_MASK
23295 __pyx_v_cigar_p = bam1_cigar(__pyx_v_src);
23297 /* "csamtools.pyx":2614
23299 * cigar_p = bam1_cigar(src)
23300 * for k from 0 <= k < src.core.n_cigar: # <<<<<<<<<<<<<<
23301 * op = cigar_p[k] & BAM_CIGAR_MASK
23302 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
23304 __pyx_t_2 = __pyx_v_src->core.n_cigar;
23305 for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_2; __pyx_v_k++) {
23307 /* "csamtools.pyx":2615
23308 * cigar_p = bam1_cigar(src)
23309 * for k from 0 <= k < src.core.n_cigar:
23310 * op = cigar_p[k] & BAM_CIGAR_MASK # <<<<<<<<<<<<<<
23311 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
23314 __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15);
23316 /* "csamtools.pyx":2616
23317 * for k from 0 <= k < src.core.n_cigar:
23318 * op = cigar_p[k] & BAM_CIGAR_MASK
23319 * l = cigar_p[k] >> BAM_CIGAR_SHIFT # <<<<<<<<<<<<<<
23321 * if op == BAM_CMATCH:
23323 __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 = 2616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23324 __Pyx_GOTREF(__pyx_t_3);
23325 __Pyx_DECREF(__pyx_v_l);
23326 __pyx_v_l = __pyx_t_3;
23329 /* "csamtools.pyx":2618
23330 * l = cigar_p[k] >> BAM_CIGAR_SHIFT
23332 * if op == BAM_CMATCH: # <<<<<<<<<<<<<<
23333 * o = min( pos + l, end) - max( pos, start )
23334 * if o > 0: overlap += o
23336 __pyx_t_1 = (__pyx_v_op == 0);
23339 /* "csamtools.pyx":2619
23341 * if op == BAM_CMATCH:
23342 * o = min( pos + l, end) - max( pos, start ) # <<<<<<<<<<<<<<
23343 * if o > 0: overlap += o
23346 __pyx_t_4 = __pyx_v_end;
23347 __pyx_t_3 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23348 __Pyx_GOTREF(__pyx_t_3);
23349 __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_v_l); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23350 __Pyx_GOTREF(__pyx_t_5);
23351 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23352 __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23353 __Pyx_GOTREF(__pyx_t_6);
23354 __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 = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23355 __Pyx_GOTREF(__pyx_t_7);
23356 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
23357 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23358 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
23360 __pyx_t_7 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23361 __Pyx_GOTREF(__pyx_t_7);
23362 __pyx_t_3 = __pyx_t_7;
23365 __Pyx_INCREF(__pyx_t_5);
23366 __pyx_t_3 = __pyx_t_5;
23368 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
23369 __pyx_t_4 = __pyx_v_start;
23370 __pyx_t_8 = __pyx_v_pos;
23371 if ((__pyx_t_4 > __pyx_t_8)) {
23372 __pyx_t_9 = __pyx_t_4;
23374 __pyx_t_9 = __pyx_t_8;
23376 __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23377 __Pyx_GOTREF(__pyx_t_5);
23378 __pyx_t_7 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23379 __Pyx_GOTREF(__pyx_t_7);
23380 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23381 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
23382 __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 = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23383 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
23384 __pyx_v_o = __pyx_t_10;
23386 /* "csamtools.pyx":2620
23387 * if op == BAM_CMATCH:
23388 * o = min( pos + l, end) - max( pos, start )
23389 * if o > 0: overlap += o # <<<<<<<<<<<<<<
23391 * if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:
23393 __pyx_t_1 = (__pyx_v_o > 0);
23395 __pyx_v_overlap = (__pyx_v_overlap + __pyx_v_o);
23403 /* "csamtools.pyx":2622
23404 * if o > 0: overlap += o
23406 * if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP: # <<<<<<<<<<<<<<
23410 switch (__pyx_v_op) {
23415 /* "csamtools.pyx":2623
23417 * if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP:
23418 * pos += l # <<<<<<<<<<<<<<
23422 __pyx_t_7 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23423 __Pyx_GOTREF(__pyx_t_7);
23424 __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_v_l); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23425 __Pyx_GOTREF(__pyx_t_5);
23426 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
23427 __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 = 2623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23428 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
23429 __pyx_v_pos = __pyx_t_9;
23434 /* "csamtools.pyx":2625
23437 * return overlap # <<<<<<<<<<<<<<
23439 * def opt(self, tag):
23441 __Pyx_XDECREF(__pyx_r);
23442 __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_overlap); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23443 __Pyx_GOTREF(__pyx_t_5);
23444 __pyx_r = __pyx_t_5;
23448 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
23451 __Pyx_XDECREF(__pyx_t_3);
23452 __Pyx_XDECREF(__pyx_t_5);
23453 __Pyx_XDECREF(__pyx_t_6);
23454 __Pyx_XDECREF(__pyx_t_7);
23455 __Pyx_AddTraceback("csamtools.AlignedRead.overlap");
23458 __Pyx_DECREF(__pyx_v_l);
23459 __Pyx_XGIVEREF(__pyx_r);
23460 __Pyx_TraceReturn(__pyx_r);
23461 __Pyx_RefNannyFinishContext();
23465 /* "csamtools.pyx":2627
23468 * def opt(self, tag): # <<<<<<<<<<<<<<
23469 * """retrieves optional data given a two-letter *tag*"""
23470 * #see bam_aux.c: bam_aux_get() and bam_aux2i() etc
23473 static PyObject *__pyx_pf_9csamtools_11AlignedRead_6opt(PyObject *__pyx_v_self, PyObject *__pyx_v_tag); /*proto*/
23474 static char __pyx_doc_9csamtools_11AlignedRead_6opt[] = "AlignedRead.opt(self, tag)\nretrieves optional data given a two-letter *tag*";
23475 static PyObject *__pyx_pf_9csamtools_11AlignedRead_6opt(PyObject *__pyx_v_self, PyObject *__pyx_v_tag) {
23476 uint8_t *__pyx_v_v;
23477 PyObject *__pyx_v_type;
23478 PyObject *__pyx_r = NULL;
23481 PyObject *__pyx_t_3 = NULL;
23482 PyObject *__pyx_t_4 = NULL;
23487 __Pyx_TraceDeclarations
23488 __Pyx_RefNannySetupContext("opt");
23489 __Pyx_TraceCall("opt", __pyx_f[0], 2627);
23490 __pyx_v_type = Py_None; __Pyx_INCREF(Py_None);
23492 /* "csamtools.pyx":2631
23493 * #see bam_aux.c: bam_aux_get() and bam_aux2i() etc
23495 * v = bam_aux_get(self._delegate, tag) # <<<<<<<<<<<<<<
23496 * if v == NULL: raise KeyError( "tag '%s' not present" % tag )
23499 __pyx_t_1 = PyBytes_AsString(__pyx_v_tag); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23500 __pyx_v_v = bam_aux_get(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate, __pyx_t_1);
23502 /* "csamtools.pyx":2632
23504 * v = bam_aux_get(self._delegate, tag)
23505 * if v == NULL: raise KeyError( "tag '%s' not present" % tag ) # <<<<<<<<<<<<<<
23507 * if type == 'c' or type == 'C' or type == 's' or type == 'S':
23509 __pyx_t_2 = (__pyx_v_v == NULL);
23511 __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_135), __pyx_v_tag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23512 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
23513 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23514 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
23515 PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
23516 __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
23518 __pyx_t_3 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23519 __Pyx_GOTREF(__pyx_t_3);
23520 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
23521 __Pyx_Raise(__pyx_t_3, 0, 0);
23522 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23523 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23528 /* "csamtools.pyx":2633
23529 * v = bam_aux_get(self._delegate, tag)
23530 * if v == NULL: raise KeyError( "tag '%s' not present" % tag )
23531 * type = chr(v[0]) # <<<<<<<<<<<<<<
23532 * if type == 'c' or type == 'C' or type == 's' or type == 'S':
23533 * return <int>bam_aux2i(v)
23535 __pyx_t_3 = __Pyx_PyInt_to_py_uint8_t((__pyx_v_v[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23536 __Pyx_GOTREF(__pyx_t_3);
23537 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23538 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
23539 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
23540 __Pyx_GIVEREF(__pyx_t_3);
23542 __pyx_t_3 = PyObject_Call(__pyx_builtin_chr, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23543 __Pyx_GOTREF(__pyx_t_3);
23544 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
23545 __Pyx_DECREF(__pyx_v_type);
23546 __pyx_v_type = __pyx_t_3;
23549 /* "csamtools.pyx":2634
23550 * if v == NULL: raise KeyError( "tag '%s' not present" % tag )
23552 * if type == 'c' or type == 'C' or type == 's' or type == 'S': # <<<<<<<<<<<<<<
23553 * return <int>bam_aux2i(v)
23554 * elif type == 'i' or type == 'I':
23556 __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__c), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23557 __Pyx_GOTREF(__pyx_t_3);
23558 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23559 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23561 __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__C), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23562 __Pyx_GOTREF(__pyx_t_3);
23563 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23564 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23566 __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__s), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23567 __Pyx_GOTREF(__pyx_t_3);
23568 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23569 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23571 __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__S), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23572 __Pyx_GOTREF(__pyx_t_3);
23573 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23574 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23575 __pyx_t_8 = __pyx_t_7;
23577 __pyx_t_8 = __pyx_t_6;
23579 __pyx_t_6 = __pyx_t_8;
23581 __pyx_t_6 = __pyx_t_5;
23583 __pyx_t_5 = __pyx_t_6;
23585 __pyx_t_5 = __pyx_t_2;
23589 /* "csamtools.pyx":2635
23591 * if type == 'c' or type == 'C' or type == 's' or type == 'S':
23592 * return <int>bam_aux2i(v) # <<<<<<<<<<<<<<
23593 * elif type == 'i' or type == 'I':
23594 * return <int32_t>bam_aux2i(v)
23596 __Pyx_XDECREF(__pyx_r);
23597 __pyx_t_3 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_v))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23598 __Pyx_GOTREF(__pyx_t_3);
23599 __pyx_r = __pyx_t_3;
23605 /* "csamtools.pyx":2636
23606 * if type == 'c' or type == 'C' or type == 's' or type == 'S':
23607 * return <int>bam_aux2i(v)
23608 * elif type == 'i' or type == 'I': # <<<<<<<<<<<<<<
23609 * return <int32_t>bam_aux2i(v)
23610 * elif type == 'f' or type == 'F':
23612 __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__i), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23613 __Pyx_GOTREF(__pyx_t_3);
23614 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23615 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23617 __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__I), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23618 __Pyx_GOTREF(__pyx_t_3);
23619 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23620 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23621 __pyx_t_6 = __pyx_t_2;
23623 __pyx_t_6 = __pyx_t_5;
23627 /* "csamtools.pyx":2637
23628 * return <int>bam_aux2i(v)
23629 * elif type == 'i' or type == 'I':
23630 * return <int32_t>bam_aux2i(v) # <<<<<<<<<<<<<<
23631 * elif type == 'f' or type == 'F':
23632 * return <float>bam_aux2f(v)
23634 __Pyx_XDECREF(__pyx_r);
23635 __pyx_t_3 = __Pyx_PyInt_to_py_int32_t(bam_aux2i(__pyx_v_v)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23636 __Pyx_GOTREF(__pyx_t_3);
23637 __pyx_r = __pyx_t_3;
23643 /* "csamtools.pyx":2638
23644 * elif type == 'i' or type == 'I':
23645 * return <int32_t>bam_aux2i(v)
23646 * elif type == 'f' or type == 'F': # <<<<<<<<<<<<<<
23647 * return <float>bam_aux2f(v)
23648 * elif type == 'd' or type == 'D':
23650 __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__f), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23651 __Pyx_GOTREF(__pyx_t_3);
23652 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23653 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23655 __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__F), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23656 __Pyx_GOTREF(__pyx_t_3);
23657 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23658 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23659 __pyx_t_2 = __pyx_t_5;
23661 __pyx_t_2 = __pyx_t_6;
23665 /* "csamtools.pyx":2639
23666 * return <int32_t>bam_aux2i(v)
23667 * elif type == 'f' or type == 'F':
23668 * return <float>bam_aux2f(v) # <<<<<<<<<<<<<<
23669 * elif type == 'd' or type == 'D':
23670 * return <double>bam_aux2d(v)
23672 __Pyx_XDECREF(__pyx_r);
23673 __pyx_t_3 = PyFloat_FromDouble(bam_aux2f(__pyx_v_v)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23674 __Pyx_GOTREF(__pyx_t_3);
23675 __pyx_r = __pyx_t_3;
23681 /* "csamtools.pyx":2640
23682 * elif type == 'f' or type == 'F':
23683 * return <float>bam_aux2f(v)
23684 * elif type == 'd' or type == 'D': # <<<<<<<<<<<<<<
23685 * return <double>bam_aux2d(v)
23686 * elif type == 'A':
23688 __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__d), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23689 __Pyx_GOTREF(__pyx_t_3);
23690 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23691 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23693 __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__D), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23694 __Pyx_GOTREF(__pyx_t_3);
23695 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23696 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23697 __pyx_t_5 = __pyx_t_6;
23699 __pyx_t_5 = __pyx_t_2;
23703 /* "csamtools.pyx":2641
23704 * return <float>bam_aux2f(v)
23705 * elif type == 'd' or type == 'D':
23706 * return <double>bam_aux2d(v) # <<<<<<<<<<<<<<
23707 * elif type == 'A':
23708 * # there might a more efficient way
23710 __Pyx_XDECREF(__pyx_r);
23711 __pyx_t_3 = PyFloat_FromDouble(bam_aux2d(__pyx_v_v)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23712 __Pyx_GOTREF(__pyx_t_3);
23713 __pyx_r = __pyx_t_3;
23719 /* "csamtools.pyx":2642
23720 * elif type == 'd' or type == 'D':
23721 * return <double>bam_aux2d(v)
23722 * elif type == 'A': # <<<<<<<<<<<<<<
23723 * # there might a more efficient way
23724 * # to convert a char into a string
23726 __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__A), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23727 __Pyx_GOTREF(__pyx_t_3);
23728 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23729 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23732 /* "csamtools.pyx":2645
23733 * # there might a more efficient way
23734 * # to convert a char into a string
23735 * return '%c' % <char>bam_aux2A(v) # <<<<<<<<<<<<<<
23736 * elif type == 'Z':
23737 * return <char*>bam_aux2Z(v)
23739 __Pyx_XDECREF(__pyx_r);
23740 __pyx_t_3 = PyInt_FromLong(bam_aux2A(__pyx_v_v)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23741 __Pyx_GOTREF(__pyx_t_3);
23742 __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_121), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23743 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
23744 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23745 __pyx_r = ((PyObject *)__pyx_t_4);
23751 /* "csamtools.pyx":2646
23752 * # to convert a char into a string
23753 * return '%c' % <char>bam_aux2A(v)
23754 * elif type == 'Z': # <<<<<<<<<<<<<<
23755 * return <char*>bam_aux2Z(v)
23758 __pyx_t_4 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__Z), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23759 __Pyx_GOTREF(__pyx_t_4);
23760 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23761 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23764 /* "csamtools.pyx":2647
23765 * return '%c' % <char>bam_aux2A(v)
23766 * elif type == 'Z':
23767 * return <char*>bam_aux2Z(v) # <<<<<<<<<<<<<<
23769 * def fancy_str (self):
23771 __Pyx_XDECREF(__pyx_r);
23772 __pyx_t_4 = PyBytes_FromString(bam_aux2Z(__pyx_v_v)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23773 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
23774 __pyx_r = ((PyObject *)__pyx_t_4);
23781 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
23784 __Pyx_XDECREF(__pyx_t_3);
23785 __Pyx_XDECREF(__pyx_t_4);
23786 __Pyx_AddTraceback("csamtools.AlignedRead.opt");
23789 __Pyx_DECREF(__pyx_v_type);
23790 __Pyx_XGIVEREF(__pyx_r);
23791 __Pyx_TraceReturn(__pyx_r);
23792 __Pyx_RefNannyFinishContext();
23796 /* "csamtools.pyx":2649
23797 * return <char*>bam_aux2Z(v)
23799 * def fancy_str (self): # <<<<<<<<<<<<<<
23800 * """returns list of fieldnames/values in pretty format for debugging
23804 static PyObject *__pyx_pf_9csamtools_11AlignedRead_7fancy_str(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
23805 static char __pyx_doc_9csamtools_11AlignedRead_7fancy_str[] = "AlignedRead.fancy_str(self)\nreturns list of fieldnames/values in pretty format for debugging\n ";
23806 static PyObject *__pyx_pf_9csamtools_11AlignedRead_7fancy_str(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
23807 PyObject *__pyx_v_ret_string;
23808 PyObject *__pyx_v_field_names;
23809 PyObject *__pyx_v_fields_names_in_order;
23810 PyObject *__pyx_v_f;
23811 PyObject *__pyx_r = NULL;
23812 PyObject *__pyx_t_1 = NULL;
23813 Py_ssize_t __pyx_t_2;
23814 PyObject *__pyx_t_3 = NULL;
23817 PyObject *__pyx_t_6 = NULL;
23818 PyObject *__pyx_t_7 = NULL;
23819 PyObject *__pyx_t_8 = NULL;
23820 PyObject *__pyx_t_9 = NULL;
23822 __Pyx_TraceDeclarations
23823 __Pyx_RefNannySetupContext("fancy_str");
23824 __Pyx_TraceCall("fancy_str", __pyx_f[0], 2649);
23825 __pyx_v_ret_string = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
23826 __pyx_v_field_names = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
23827 __pyx_v_fields_names_in_order = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
23828 __pyx_v_f = Py_None; __Pyx_INCREF(Py_None);
23830 /* "csamtools.pyx":2652
23831 * """returns list of fieldnames/values in pretty format for debugging
23833 * ret_string = [] # <<<<<<<<<<<<<<
23835 * "tid": "Contig index",
23837 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23838 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
23839 __Pyx_DECREF(((PyObject *)__pyx_v_ret_string));
23840 __pyx_v_ret_string = __pyx_t_1;
23843 /* "csamtools.pyx":2653
23846 * field_names = { # <<<<<<<<<<<<<<
23847 * "tid": "Contig index",
23848 * "pos": "Mapped position on contig",
23850 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23851 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
23852 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__tid), ((PyObject *)__pyx_kp_s_136)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23853 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__pos), ((PyObject *)__pyx_kp_s_137)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23854 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mtid), ((PyObject *)__pyx_kp_s_138)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23855 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mpos), ((PyObject *)__pyx_kp_s_139)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23856 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__isize), ((PyObject *)__pyx_kp_s_140)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23857 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__flag), ((PyObject *)__pyx_kp_s_141)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23858 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__n_cigar), ((PyObject *)__pyx_kp_s_142)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23859 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__cigar), ((PyObject *)__pyx_kp_s_143)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23860 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__qual), ((PyObject *)__pyx_kp_s_144)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23861 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__bin), ((PyObject *)__pyx_kp_s_145)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23862 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__l_qname), ((PyObject *)__pyx_kp_s_146)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23863 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__qname), ((PyObject *)__pyx_kp_s_147)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23864 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__l_qseq), ((PyObject *)__pyx_kp_s_148)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23865 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__qseq), ((PyObject *)__pyx_kp_s_149)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23866 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__bqual), ((PyObject *)__pyx_kp_s_150)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23867 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__l_aux), ((PyObject *)__pyx_kp_s_151)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23868 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__m_data), ((PyObject *)__pyx_kp_s_152)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23869 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__data_len), ((PyObject *)__pyx_kp_s_153)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23870 __Pyx_DECREF(((PyObject *)__pyx_v_field_names));
23871 __pyx_v_field_names = __pyx_t_1;
23874 /* "csamtools.pyx":2673
23875 * "data_len": "Current data length",
23877 * fields_names_in_order = ["tid", "pos", "mtid", "mpos", "isize", "flag", # <<<<<<<<<<<<<<
23878 * "n_cigar", "cigar", "qual", "bin", "l_qname", "qname",
23879 * "l_qseq", "qseq", "bqual", "l_aux", "m_data", "data_len"]
23881 __pyx_t_1 = PyList_New(18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23882 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
23883 __Pyx_INCREF(((PyObject *)__pyx_n_s__tid));
23884 PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__tid));
23885 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tid));
23886 __Pyx_INCREF(((PyObject *)__pyx_n_s__pos));
23887 PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__pos));
23888 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos));
23889 __Pyx_INCREF(((PyObject *)__pyx_n_s__mtid));
23890 PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__mtid));
23891 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mtid));
23892 __Pyx_INCREF(((PyObject *)__pyx_n_s__mpos));
23893 PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__mpos));
23894 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mpos));
23895 __Pyx_INCREF(((PyObject *)__pyx_n_s__isize));
23896 PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__isize));
23897 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__isize));
23898 __Pyx_INCREF(((PyObject *)__pyx_n_s__flag));
23899 PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s__flag));
23900 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__flag));
23901 __Pyx_INCREF(((PyObject *)__pyx_n_s__n_cigar));
23902 PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_n_s__n_cigar));
23903 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_cigar));
23904 __Pyx_INCREF(((PyObject *)__pyx_n_s__cigar));
23905 PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_n_s__cigar));
23906 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cigar));
23907 __Pyx_INCREF(((PyObject *)__pyx_n_s__qual));
23908 PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s__qual));
23909 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__qual));
23910 __Pyx_INCREF(((PyObject *)__pyx_n_s__bin));
23911 PyList_SET_ITEM(__pyx_t_1, 9, ((PyObject *)__pyx_n_s__bin));
23912 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin));
23913 __Pyx_INCREF(((PyObject *)__pyx_n_s__l_qname));
23914 PyList_SET_ITEM(__pyx_t_1, 10, ((PyObject *)__pyx_n_s__l_qname));
23915 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l_qname));
23916 __Pyx_INCREF(((PyObject *)__pyx_n_s__qname));
23917 PyList_SET_ITEM(__pyx_t_1, 11, ((PyObject *)__pyx_n_s__qname));
23918 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__qname));
23919 __Pyx_INCREF(((PyObject *)__pyx_n_s__l_qseq));
23920 PyList_SET_ITEM(__pyx_t_1, 12, ((PyObject *)__pyx_n_s__l_qseq));
23921 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l_qseq));
23922 __Pyx_INCREF(((PyObject *)__pyx_n_s__qseq));
23923 PyList_SET_ITEM(__pyx_t_1, 13, ((PyObject *)__pyx_n_s__qseq));
23924 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__qseq));
23925 __Pyx_INCREF(((PyObject *)__pyx_n_s__bqual));
23926 PyList_SET_ITEM(__pyx_t_1, 14, ((PyObject *)__pyx_n_s__bqual));
23927 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bqual));
23928 __Pyx_INCREF(((PyObject *)__pyx_n_s__l_aux));
23929 PyList_SET_ITEM(__pyx_t_1, 15, ((PyObject *)__pyx_n_s__l_aux));
23930 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l_aux));
23931 __Pyx_INCREF(((PyObject *)__pyx_n_s__m_data));
23932 PyList_SET_ITEM(__pyx_t_1, 16, ((PyObject *)__pyx_n_s__m_data));
23933 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m_data));
23934 __Pyx_INCREF(((PyObject *)__pyx_n_s__data_len));
23935 PyList_SET_ITEM(__pyx_t_1, 17, ((PyObject *)__pyx_n_s__data_len));
23936 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data_len));
23937 __Pyx_DECREF(((PyObject *)__pyx_v_fields_names_in_order));
23938 __pyx_v_fields_names_in_order = __pyx_t_1;
23941 /* "csamtools.pyx":2677
23942 * "l_qseq", "qseq", "bqual", "l_aux", "m_data", "data_len"]
23944 * for f in fields_names_in_order: # <<<<<<<<<<<<<<
23945 * if not f in self.__dict__:
23948 if (unlikely(__pyx_v_fields_names_in_order == Py_None)) {
23949 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23951 __pyx_t_2 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_fields_names_in_order); __Pyx_INCREF(__pyx_t_1);
23953 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
23954 __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
23955 __Pyx_DECREF(__pyx_v_f);
23956 __pyx_v_f = __pyx_t_3;
23959 /* "csamtools.pyx":2678
23961 * for f in fields_names_in_order:
23962 * if not f in self.__dict__: # <<<<<<<<<<<<<<
23964 * ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f)))
23966 __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____dict__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23967 __Pyx_GOTREF(__pyx_t_3);
23968 __pyx_t_4 = ((PySequence_Contains(__pyx_t_3, __pyx_v_f))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23969 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23970 __pyx_t_5 = (!__pyx_t_4);
23973 /* "csamtools.pyx":2679
23974 * for f in fields_names_in_order:
23975 * if not f in self.__dict__:
23976 * continue # <<<<<<<<<<<<<<
23977 * ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f)))
23980 goto __pyx_L5_continue;
23985 /* "csamtools.pyx":2680
23986 * if not f in self.__dict__:
23988 * ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f))) # <<<<<<<<<<<<<<
23990 * for f in self.__dict__:
23992 if (unlikely(__pyx_v_ret_string == Py_None)) {
23993 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23995 __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 = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23996 __Pyx_GOTREF(__pyx_t_3);
23997 __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_kp_s_155), __pyx_v_f); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
23998 __Pyx_GOTREF(__pyx_t_6);
23999 __pyx_t_7 = PyNumber_Add(__pyx_t_6, ((PyObject *)__pyx_kp_s_156)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24000 __Pyx_GOTREF(__pyx_t_7);
24001 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
24002 __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____getattribute__); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24003 __Pyx_GOTREF(__pyx_t_6);
24004 __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24005 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
24006 __Pyx_INCREF(__pyx_v_f);
24007 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f);
24008 __Pyx_GIVEREF(__pyx_v_f);
24009 __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 = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24010 __Pyx_GOTREF(__pyx_t_9);
24011 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
24012 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
24013 __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24014 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
24015 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3);
24016 __Pyx_GIVEREF(__pyx_t_3);
24017 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
24018 __Pyx_GIVEREF(__pyx_t_7);
24019 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_9);
24020 __Pyx_GIVEREF(__pyx_t_9);
24024 __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_154), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24025 __Pyx_GOTREF(((PyObject *)__pyx_t_9));
24026 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
24027 __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 = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24028 __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
24029 __pyx_L5_continue:;
24031 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24033 /* "csamtools.pyx":2682
24034 * ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f)))
24036 * for f in self.__dict__: # <<<<<<<<<<<<<<
24037 * if not f in field_names:
24038 * ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f)))
24040 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____dict__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24041 __Pyx_GOTREF(__pyx_t_1);
24042 if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
24043 __pyx_t_2 = 0; __pyx_t_9 = __pyx_t_1; __Pyx_INCREF(__pyx_t_9);
24045 __pyx_t_2 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24046 __Pyx_GOTREF(__pyx_t_9);
24048 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24050 if (likely(PyList_CheckExact(__pyx_t_9))) {
24051 if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_9)) break;
24052 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++;
24053 } else if (likely(PyTuple_CheckExact(__pyx_t_9))) {
24054 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
24055 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++;
24057 __pyx_t_1 = PyIter_Next(__pyx_t_9);
24059 if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24062 __Pyx_GOTREF(__pyx_t_1);
24064 __Pyx_DECREF(__pyx_v_f);
24065 __pyx_v_f = __pyx_t_1;
24068 /* "csamtools.pyx":2683
24070 * for f in self.__dict__:
24071 * if not f in field_names: # <<<<<<<<<<<<<<
24072 * ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f)))
24073 * return ret_string
24075 if (unlikely(__pyx_v_field_names == Py_None)) {
24076 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24078 __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 = 2683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24079 __pyx_t_4 = (!__pyx_t_5);
24082 /* "csamtools.pyx":2684
24083 * for f in self.__dict__:
24084 * if not f in field_names:
24085 * ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f))) # <<<<<<<<<<<<<<
24086 * return ret_string
24089 if (unlikely(__pyx_v_ret_string == Py_None)) {
24090 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24092 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____getattribute__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24093 __Pyx_GOTREF(__pyx_t_1);
24094 __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24095 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
24096 __Pyx_INCREF(__pyx_v_f);
24097 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f);
24098 __Pyx_GIVEREF(__pyx_v_f);
24099 __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 = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24100 __Pyx_GOTREF(__pyx_t_7);
24101 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24102 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
24103 __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24104 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
24105 __Pyx_INCREF(__pyx_v_f);
24106 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f);
24107 __Pyx_GIVEREF(__pyx_v_f);
24108 __Pyx_INCREF(((PyObject *)__pyx_kp_s_12));
24109 PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_kp_s_12));
24110 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_12));
24111 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
24112 __Pyx_GIVEREF(__pyx_t_7);
24114 __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_154), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24115 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
24116 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
24117 __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 = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24118 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
24123 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
24125 /* "csamtools.pyx":2685
24126 * if not f in field_names:
24127 * ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f)))
24128 * return ret_string # <<<<<<<<<<<<<<
24130 * cdef class PileupProxy:
24132 __Pyx_XDECREF(__pyx_r);
24133 __Pyx_INCREF(((PyObject *)__pyx_v_ret_string));
24134 __pyx_r = ((PyObject *)__pyx_v_ret_string);
24137 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
24140 __Pyx_XDECREF(__pyx_t_1);
24141 __Pyx_XDECREF(__pyx_t_3);
24142 __Pyx_XDECREF(__pyx_t_6);
24143 __Pyx_XDECREF(__pyx_t_7);
24144 __Pyx_XDECREF(__pyx_t_8);
24145 __Pyx_XDECREF(__pyx_t_9);
24146 __Pyx_AddTraceback("csamtools.AlignedRead.fancy_str");
24149 __Pyx_DECREF(__pyx_v_ret_string);
24150 __Pyx_DECREF(__pyx_v_field_names);
24151 __Pyx_DECREF(__pyx_v_fields_names_in_order);
24152 __Pyx_DECREF(__pyx_v_f);
24153 __Pyx_XGIVEREF(__pyx_r);
24154 __Pyx_TraceReturn(__pyx_r);
24155 __Pyx_RefNannyFinishContext();
24159 /* "csamtools.pyx":2709
24162 * def __init__(self): # <<<<<<<<<<<<<<
24163 * raise TypeError("This class cannot be instantiated from Python")
24167 static int __pyx_pf_9csamtools_11PileupProxy___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
24168 static int __pyx_pf_9csamtools_11PileupProxy___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
24170 PyObject *__pyx_t_1 = NULL;
24171 __Pyx_TraceDeclarations
24172 __Pyx_RefNannySetupContext("__init__");
24173 __Pyx_TraceCall("__init__", __pyx_f[0], 2709);
24174 if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
24175 __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
24176 if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
24178 /* "csamtools.pyx":2710
24180 * def __init__(self):
24181 * raise TypeError("This class cannot be instantiated from Python") # <<<<<<<<<<<<<<
24183 * def __str__(self):
24185 __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_158), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24186 __Pyx_GOTREF(__pyx_t_1);
24187 __Pyx_Raise(__pyx_t_1, 0, 0);
24188 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24189 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24194 __Pyx_XDECREF(__pyx_t_1);
24195 __Pyx_AddTraceback("csamtools.PileupProxy.__init__");
24198 __Pyx_TraceReturn(Py_None);
24199 __Pyx_RefNannyFinishContext();
24203 /* "csamtools.pyx":2712
24204 * raise TypeError("This class cannot be instantiated from Python")
24206 * def __str__(self): # <<<<<<<<<<<<<<
24207 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
24211 static PyObject *__pyx_pf_9csamtools_11PileupProxy_1__str__(PyObject *__pyx_v_self); /*proto*/
24212 static PyObject *__pyx_pf_9csamtools_11PileupProxy_1__str__(PyObject *__pyx_v_self) {
24213 PyObject *__pyx_r = NULL;
24214 PyObject *__pyx_t_1 = NULL;
24215 PyObject *__pyx_t_2 = NULL;
24216 PyObject *__pyx_t_3 = NULL;
24217 PyObject *__pyx_t_4 = NULL;
24218 PyObject *__pyx_t_5 = NULL;
24219 __Pyx_TraceDeclarations
24220 __Pyx_RefNannySetupContext("__str__");
24221 __Pyx_TraceCall("__str__", __pyx_f[0], 2712);
24223 /* "csamtools.pyx":2713
24225 * def __str__(self):
24226 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ # <<<<<<<<<<<<<<
24228 * "\n".join( map(str, self.pileups) )
24230 __Pyx_XDECREF(__pyx_r);
24232 /* "csamtools.pyx":2714
24233 * def __str__(self):
24234 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
24235 * "\n" +\ # <<<<<<<<<<<<<<
24236 * "\n".join( map(str, self.pileups) )
24239 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24240 __Pyx_GOTREF(__pyx_t_1);
24242 /* "csamtools.pyx":2713
24244 * def __str__(self):
24245 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ # <<<<<<<<<<<<<<
24247 * "\n".join( map(str, self.pileups) )
24249 __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24250 __Pyx_GOTREF(__pyx_t_2);
24251 __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24252 __Pyx_GOTREF(__pyx_t_3);
24253 __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24254 __Pyx_GOTREF(__pyx_t_4);
24255 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24256 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
24257 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
24258 __Pyx_GIVEREF(__pyx_t_2);
24259 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
24260 __Pyx_GIVEREF(__pyx_t_3);
24261 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
24262 __Pyx_GIVEREF(__pyx_t_4);
24266 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24267 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
24268 __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
24269 PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
24270 __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
24271 PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_5));
24272 __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
24274 __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 = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24275 __Pyx_GOTREF(__pyx_t_5);
24276 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
24277 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24278 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
24279 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
24280 __Pyx_GIVEREF(__pyx_t_5);
24282 __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 = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24283 __Pyx_GOTREF(__pyx_t_5);
24284 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24285 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
24286 __pyx_t_4 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24287 __Pyx_GOTREF(__pyx_t_4);
24288 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
24290 /* "csamtools.pyx":2715
24291 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
24293 * "\n".join( map(str, self.pileups) ) # <<<<<<<<<<<<<<
24297 __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24298 __Pyx_GOTREF(__pyx_t_5);
24299 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pileups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24300 __Pyx_GOTREF(__pyx_t_1);
24301 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24302 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
24303 __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
24304 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
24305 __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
24306 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
24307 __Pyx_GIVEREF(__pyx_t_1);
24309 __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 = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24310 __Pyx_GOTREF(__pyx_t_1);
24311 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
24312 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24313 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
24314 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
24315 __Pyx_GIVEREF(__pyx_t_1);
24317 __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 = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24318 __Pyx_GOTREF(__pyx_t_1);
24319 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
24320 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
24321 __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24322 __Pyx_GOTREF(__pyx_t_3);
24323 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
24324 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24325 __pyx_r = __pyx_t_3;
24329 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
24332 __Pyx_XDECREF(__pyx_t_1);
24333 __Pyx_XDECREF(__pyx_t_2);
24334 __Pyx_XDECREF(__pyx_t_3);
24335 __Pyx_XDECREF(__pyx_t_4);
24336 __Pyx_XDECREF(__pyx_t_5);
24337 __Pyx_AddTraceback("csamtools.PileupProxy.__str__");
24340 __Pyx_XGIVEREF(__pyx_r);
24341 __Pyx_TraceReturn(__pyx_r);
24342 __Pyx_RefNannyFinishContext();
24346 /* "csamtools.pyx":2719
24348 * '''the chromosome ID as is defined in the header'''
24349 * def __get__(self): return self.tid # <<<<<<<<<<<<<<
24354 static PyObject *__pyx_pf_9csamtools_11PileupProxy_3tid___get__(PyObject *__pyx_v_self); /*proto*/
24355 static PyObject *__pyx_pf_9csamtools_11PileupProxy_3tid___get__(PyObject *__pyx_v_self) {
24356 PyObject *__pyx_r = NULL;
24357 PyObject *__pyx_t_1 = NULL;
24358 __Pyx_TraceDeclarations
24359 __Pyx_RefNannySetupContext("__get__");
24360 __Pyx_TraceCall("__get__", __pyx_f[0], 2719);
24361 __Pyx_XDECREF(__pyx_r);
24362 __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24363 __Pyx_GOTREF(__pyx_t_1);
24364 __pyx_r = __pyx_t_1;
24368 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
24371 __Pyx_XDECREF(__pyx_t_1);
24372 __Pyx_AddTraceback("csamtools.PileupProxy.tid.__get__");
24375 __Pyx_XGIVEREF(__pyx_r);
24376 __Pyx_TraceReturn(__pyx_r);
24377 __Pyx_RefNannyFinishContext();
24381 /* "csamtools.pyx":2723
24383 * '''number of reads mapping to this column.'''
24384 * def __get__(self): return self.n_pu # <<<<<<<<<<<<<<
24385 * def __set__(self, n): self.n_pu = n
24389 static PyObject *__pyx_pf_9csamtools_11PileupProxy_1n___get__(PyObject *__pyx_v_self); /*proto*/
24390 static PyObject *__pyx_pf_9csamtools_11PileupProxy_1n___get__(PyObject *__pyx_v_self) {
24391 PyObject *__pyx_r = NULL;
24392 PyObject *__pyx_t_1 = NULL;
24393 __Pyx_TraceDeclarations
24394 __Pyx_RefNannySetupContext("__get__");
24395 __Pyx_TraceCall("__get__", __pyx_f[0], 2723);
24396 __Pyx_XDECREF(__pyx_r);
24397 __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->n_pu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24398 __Pyx_GOTREF(__pyx_t_1);
24399 __pyx_r = __pyx_t_1;
24403 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
24406 __Pyx_XDECREF(__pyx_t_1);
24407 __Pyx_AddTraceback("csamtools.PileupProxy.n.__get__");
24410 __Pyx_XGIVEREF(__pyx_r);
24411 __Pyx_TraceReturn(__pyx_r);
24412 __Pyx_RefNannyFinishContext();
24416 /* "csamtools.pyx":2724
24417 * '''number of reads mapping to this column.'''
24418 * def __get__(self): return self.n_pu
24419 * def __set__(self, n): self.n_pu = n # <<<<<<<<<<<<<<
24424 static int __pyx_pf_9csamtools_11PileupProxy_1n_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/
24425 static int __pyx_pf_9csamtools_11PileupProxy_1n_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_n) {
24428 __Pyx_TraceDeclarations
24429 __Pyx_RefNannySetupContext("__set__");
24430 __Pyx_TraceCall("__set__", __pyx_f[0], 2724);
24431 __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 = 2724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24432 ((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->n_pu = __pyx_t_1;
24437 __Pyx_AddTraceback("csamtools.PileupProxy.n.__set__");
24440 __Pyx_TraceReturn(Py_None);
24441 __Pyx_RefNannyFinishContext();
24445 /* "csamtools.pyx":2727
24448 * def __get__(self): return self.pos # <<<<<<<<<<<<<<
24450 * property pileups:
24453 static PyObject *__pyx_pf_9csamtools_11PileupProxy_3pos___get__(PyObject *__pyx_v_self); /*proto*/
24454 static PyObject *__pyx_pf_9csamtools_11PileupProxy_3pos___get__(PyObject *__pyx_v_self) {
24455 PyObject *__pyx_r = NULL;
24456 PyObject *__pyx_t_1 = NULL;
24457 __Pyx_TraceDeclarations
24458 __Pyx_RefNannySetupContext("__get__");
24459 __Pyx_TraceCall("__get__", __pyx_f[0], 2727);
24460 __Pyx_XDECREF(__pyx_r);
24461 __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24462 __Pyx_GOTREF(__pyx_t_1);
24463 __pyx_r = __pyx_t_1;
24467 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
24470 __Pyx_XDECREF(__pyx_t_1);
24471 __Pyx_AddTraceback("csamtools.PileupProxy.pos.__get__");
24474 __Pyx_XGIVEREF(__pyx_r);
24475 __Pyx_TraceReturn(__pyx_r);
24476 __Pyx_RefNannyFinishContext();
24480 /* "csamtools.pyx":2731
24481 * property pileups:
24482 * '''list of reads (:class:`pysam.PileupRead`) aligned to this column'''
24483 * def __get__(self): # <<<<<<<<<<<<<<
24488 static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(PyObject *__pyx_v_self); /*proto*/
24489 static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(PyObject *__pyx_v_self) {
24491 PyObject *__pyx_v_pileups;
24492 PyObject *__pyx_r = NULL;
24493 PyObject *__pyx_t_1 = NULL;
24496 __Pyx_TraceDeclarations
24497 __Pyx_RefNannySetupContext("__get__");
24498 __Pyx_TraceCall("__get__", __pyx_f[0], 2731);
24499 __pyx_v_pileups = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
24501 /* "csamtools.pyx":2733
24502 * def __get__(self):
24504 * pileups = [] # <<<<<<<<<<<<<<
24505 * # warning: there could be problems if self.n and self.buf are
24508 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24509 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
24510 __Pyx_DECREF(((PyObject *)__pyx_v_pileups));
24511 __pyx_v_pileups = __pyx_t_1;
24514 /* "csamtools.pyx":2736
24515 * # warning: there could be problems if self.n and self.buf are
24517 * for x from 0 <= x < self.n_pu: # <<<<<<<<<<<<<<
24518 * pileups.append( makePileupRead( &(self.plp[x])) )
24521 __pyx_t_2 = ((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->n_pu;
24522 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_2; __pyx_v_x++) {
24524 /* "csamtools.pyx":2737
24526 * for x from 0 <= x < self.n_pu:
24527 * pileups.append( makePileupRead( &(self.plp[x])) ) # <<<<<<<<<<<<<<
24531 if (unlikely(__pyx_v_pileups == Py_None)) {
24532 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24534 __pyx_t_1 = __pyx_f_9csamtools_makePileupRead((&(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->plp[__pyx_v_x]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24535 __Pyx_GOTREF(__pyx_t_1);
24536 __pyx_t_3 = PyList_Append(__pyx_v_pileups, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24537 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24540 /* "csamtools.pyx":2738
24541 * for x from 0 <= x < self.n_pu:
24542 * pileups.append( makePileupRead( &(self.plp[x])) )
24543 * return pileups # <<<<<<<<<<<<<<
24545 * cdef class PileupRead:
24547 __Pyx_XDECREF(__pyx_r);
24548 __Pyx_INCREF(((PyObject *)__pyx_v_pileups));
24549 __pyx_r = ((PyObject *)__pyx_v_pileups);
24552 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
24555 __Pyx_XDECREF(__pyx_t_1);
24556 __Pyx_AddTraceback("csamtools.PileupProxy.pileups.__get__");
24559 __Pyx_DECREF(__pyx_v_pileups);
24560 __Pyx_XGIVEREF(__pyx_r);
24561 __Pyx_TraceReturn(__pyx_r);
24562 __Pyx_RefNannyFinishContext();
24566 /* "csamtools.pyx":2753
24567 * uint32_t _is_tail
24569 * def __init__(self): # <<<<<<<<<<<<<<
24570 * raise TypeError("This class cannot be instantiated from Python")
24574 static int __pyx_pf_9csamtools_10PileupRead___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
24575 static int __pyx_pf_9csamtools_10PileupRead___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
24577 PyObject *__pyx_t_1 = NULL;
24578 __Pyx_TraceDeclarations
24579 __Pyx_RefNannySetupContext("__init__");
24580 __Pyx_TraceCall("__init__", __pyx_f[0], 2753);
24581 if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
24582 __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
24583 if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
24585 /* "csamtools.pyx":2754
24587 * def __init__(self):
24588 * raise TypeError("This class cannot be instantiated from Python") # <<<<<<<<<<<<<<
24590 * def __str__(self):
24592 __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_159), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24593 __Pyx_GOTREF(__pyx_t_1);
24594 __Pyx_Raise(__pyx_t_1, 0, 0);
24595 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24596 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24601 __Pyx_XDECREF(__pyx_t_1);
24602 __Pyx_AddTraceback("csamtools.PileupRead.__init__");
24605 __Pyx_TraceReturn(Py_None);
24606 __Pyx_RefNannyFinishContext();
24610 /* "csamtools.pyx":2756
24611 * raise TypeError("This class cannot be instantiated from Python")
24613 * def __str__(self): # <<<<<<<<<<<<<<
24614 * return "\t".join( map(str, (self.alignment, self.qpos, self.indel, self.level, self.is_del, self.is_head, self.is_tail ) ) )
24618 static PyObject *__pyx_pf_9csamtools_10PileupRead_1__str__(PyObject *__pyx_v_self); /*proto*/
24619 static PyObject *__pyx_pf_9csamtools_10PileupRead_1__str__(PyObject *__pyx_v_self) {
24620 PyObject *__pyx_r = NULL;
24621 PyObject *__pyx_t_1 = NULL;
24622 PyObject *__pyx_t_2 = NULL;
24623 PyObject *__pyx_t_3 = NULL;
24624 PyObject *__pyx_t_4 = NULL;
24625 PyObject *__pyx_t_5 = NULL;
24626 PyObject *__pyx_t_6 = NULL;
24627 PyObject *__pyx_t_7 = NULL;
24628 PyObject *__pyx_t_8 = NULL;
24629 PyObject *__pyx_t_9 = NULL;
24630 __Pyx_TraceDeclarations
24631 __Pyx_RefNannySetupContext("__str__");
24632 __Pyx_TraceCall("__str__", __pyx_f[0], 2756);
24634 /* "csamtools.pyx":2757
24636 * def __str__(self):
24637 * return "\t".join( map(str, (self.alignment, self.qpos, self.indel, self.level, self.is_del, self.is_head, self.is_tail ) ) ) # <<<<<<<<<<<<<<
24639 * property alignment:
24641 __Pyx_XDECREF(__pyx_r);
24642 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24643 __Pyx_GOTREF(__pyx_t_1);
24644 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__alignment); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24645 __Pyx_GOTREF(__pyx_t_2);
24646 __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__qpos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24647 __Pyx_GOTREF(__pyx_t_3);
24648 __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__indel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24649 __Pyx_GOTREF(__pyx_t_4);
24650 __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__level); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24651 __Pyx_GOTREF(__pyx_t_5);
24652 __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__is_del); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24653 __Pyx_GOTREF(__pyx_t_6);
24654 __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__is_head); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24655 __Pyx_GOTREF(__pyx_t_7);
24656 __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__is_tail); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24657 __Pyx_GOTREF(__pyx_t_8);
24658 __pyx_t_9 = PyTuple_New(7); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24659 __Pyx_GOTREF(((PyObject *)__pyx_t_9));
24660 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
24661 __Pyx_GIVEREF(__pyx_t_2);
24662 PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
24663 __Pyx_GIVEREF(__pyx_t_3);
24664 PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_4);
24665 __Pyx_GIVEREF(__pyx_t_4);
24666 PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_5);
24667 __Pyx_GIVEREF(__pyx_t_5);
24668 PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_t_6);
24669 __Pyx_GIVEREF(__pyx_t_6);
24670 PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_t_7);
24671 __Pyx_GIVEREF(__pyx_t_7);
24672 PyTuple_SET_ITEM(__pyx_t_9, 6, __pyx_t_8);
24673 __Pyx_GIVEREF(__pyx_t_8);
24681 __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24682 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
24683 __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
24684 PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
24685 __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
24686 PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_t_9));
24687 __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
24689 __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 = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24690 __Pyx_GOTREF(__pyx_t_9);
24691 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
24692 __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24693 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
24694 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
24695 __Pyx_GIVEREF(__pyx_t_9);
24697 __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 = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24698 __Pyx_GOTREF(__pyx_t_9);
24699 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24700 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
24701 __pyx_r = __pyx_t_9;
24705 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
24708 __Pyx_XDECREF(__pyx_t_1);
24709 __Pyx_XDECREF(__pyx_t_2);
24710 __Pyx_XDECREF(__pyx_t_3);
24711 __Pyx_XDECREF(__pyx_t_4);
24712 __Pyx_XDECREF(__pyx_t_5);
24713 __Pyx_XDECREF(__pyx_t_6);
24714 __Pyx_XDECREF(__pyx_t_7);
24715 __Pyx_XDECREF(__pyx_t_8);
24716 __Pyx_XDECREF(__pyx_t_9);
24717 __Pyx_AddTraceback("csamtools.PileupRead.__str__");
24720 __Pyx_XGIVEREF(__pyx_r);
24721 __Pyx_TraceReturn(__pyx_r);
24722 __Pyx_RefNannyFinishContext();
24726 /* "csamtools.pyx":2761
24727 * property alignment:
24728 * """a :class:`pysam.AlignedRead` object of the aligned read"""
24729 * def __get__(self): # <<<<<<<<<<<<<<
24730 * return self._alignment
24734 static PyObject *__pyx_pf_9csamtools_10PileupRead_9alignment___get__(PyObject *__pyx_v_self); /*proto*/
24735 static PyObject *__pyx_pf_9csamtools_10PileupRead_9alignment___get__(PyObject *__pyx_v_self) {
24736 PyObject *__pyx_r = NULL;
24737 __Pyx_TraceDeclarations
24738 __Pyx_RefNannySetupContext("__get__");
24739 __Pyx_TraceCall("__get__", __pyx_f[0], 2761);
24741 /* "csamtools.pyx":2762
24742 * """a :class:`pysam.AlignedRead` object of the aligned read"""
24743 * def __get__(self):
24744 * return self._alignment # <<<<<<<<<<<<<<
24746 * """position of the read base at the pileup site, 0-based"""
24748 __Pyx_XDECREF(__pyx_r);
24749 __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_alignment));
24750 __pyx_r = ((PyObject *)((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_alignment);
24753 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
24755 __Pyx_XGIVEREF(__pyx_r);
24756 __Pyx_TraceReturn(__pyx_r);
24757 __Pyx_RefNannyFinishContext();
24761 /* "csamtools.pyx":2765
24763 * """position of the read base at the pileup site, 0-based"""
24764 * def __get__(self): # <<<<<<<<<<<<<<
24765 * return self._qpos
24769 static PyObject *__pyx_pf_9csamtools_10PileupRead_4qpos___get__(PyObject *__pyx_v_self); /*proto*/
24770 static PyObject *__pyx_pf_9csamtools_10PileupRead_4qpos___get__(PyObject *__pyx_v_self) {
24771 PyObject *__pyx_r = NULL;
24772 PyObject *__pyx_t_1 = NULL;
24773 __Pyx_TraceDeclarations
24774 __Pyx_RefNannySetupContext("__get__");
24775 __Pyx_TraceCall("__get__", __pyx_f[0], 2765);
24777 /* "csamtools.pyx":2766
24778 * """position of the read base at the pileup site, 0-based"""
24779 * def __get__(self):
24780 * return self._qpos # <<<<<<<<<<<<<<
24782 * """indel length; 0 for no indel, positive for ins and negative for del"""
24784 __Pyx_XDECREF(__pyx_r);
24785 __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_qpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24786 __Pyx_GOTREF(__pyx_t_1);
24787 __pyx_r = __pyx_t_1;
24791 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
24794 __Pyx_XDECREF(__pyx_t_1);
24795 __Pyx_AddTraceback("csamtools.PileupRead.qpos.__get__");
24798 __Pyx_XGIVEREF(__pyx_r);
24799 __Pyx_TraceReturn(__pyx_r);
24800 __Pyx_RefNannyFinishContext();
24804 /* "csamtools.pyx":2769
24806 * """indel length; 0 for no indel, positive for ins and negative for del"""
24807 * def __get__(self): # <<<<<<<<<<<<<<
24808 * return self._indel
24812 static PyObject *__pyx_pf_9csamtools_10PileupRead_5indel___get__(PyObject *__pyx_v_self); /*proto*/
24813 static PyObject *__pyx_pf_9csamtools_10PileupRead_5indel___get__(PyObject *__pyx_v_self) {
24814 PyObject *__pyx_r = NULL;
24815 PyObject *__pyx_t_1 = NULL;
24816 __Pyx_TraceDeclarations
24817 __Pyx_RefNannySetupContext("__get__");
24818 __Pyx_TraceCall("__get__", __pyx_f[0], 2769);
24820 /* "csamtools.pyx":2770
24821 * """indel length; 0 for no indel, positive for ins and negative for del"""
24822 * def __get__(self):
24823 * return self._indel # <<<<<<<<<<<<<<
24825 * """1 iff the base on the padded read is a deletion"""
24827 __Pyx_XDECREF(__pyx_r);
24828 __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_indel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24829 __Pyx_GOTREF(__pyx_t_1);
24830 __pyx_r = __pyx_t_1;
24834 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
24837 __Pyx_XDECREF(__pyx_t_1);
24838 __Pyx_AddTraceback("csamtools.PileupRead.indel.__get__");
24841 __Pyx_XGIVEREF(__pyx_r);
24842 __Pyx_TraceReturn(__pyx_r);
24843 __Pyx_RefNannyFinishContext();
24847 /* "csamtools.pyx":2773
24849 * """1 iff the base on the padded read is a deletion"""
24850 * def __get__(self): # <<<<<<<<<<<<<<
24851 * return self._is_del
24852 * property is_head:
24855 static PyObject *__pyx_pf_9csamtools_10PileupRead_6is_del___get__(PyObject *__pyx_v_self); /*proto*/
24856 static PyObject *__pyx_pf_9csamtools_10PileupRead_6is_del___get__(PyObject *__pyx_v_self) {
24857 PyObject *__pyx_r = NULL;
24858 PyObject *__pyx_t_1 = NULL;
24859 __Pyx_TraceDeclarations
24860 __Pyx_RefNannySetupContext("__get__");
24861 __Pyx_TraceCall("__get__", __pyx_f[0], 2773);
24863 /* "csamtools.pyx":2774
24864 * """1 iff the base on the padded read is a deletion"""
24865 * def __get__(self):
24866 * return self._is_del # <<<<<<<<<<<<<<
24867 * property is_head:
24868 * def __get__(self):
24870 __Pyx_XDECREF(__pyx_r);
24871 __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_is_del); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24872 __Pyx_GOTREF(__pyx_t_1);
24873 __pyx_r = __pyx_t_1;
24877 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
24880 __Pyx_XDECREF(__pyx_t_1);
24881 __Pyx_AddTraceback("csamtools.PileupRead.is_del.__get__");
24884 __Pyx_XGIVEREF(__pyx_r);
24885 __Pyx_TraceReturn(__pyx_r);
24886 __Pyx_RefNannyFinishContext();
24890 /* "csamtools.pyx":2776
24891 * return self._is_del
24892 * property is_head:
24893 * def __get__(self): # <<<<<<<<<<<<<<
24894 * return self._is_head
24895 * property is_tail:
24898 static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_head___get__(PyObject *__pyx_v_self); /*proto*/
24899 static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_head___get__(PyObject *__pyx_v_self) {
24900 PyObject *__pyx_r = NULL;
24901 PyObject *__pyx_t_1 = NULL;
24902 __Pyx_TraceDeclarations
24903 __Pyx_RefNannySetupContext("__get__");
24904 __Pyx_TraceCall("__get__", __pyx_f[0], 2776);
24906 /* "csamtools.pyx":2777
24907 * property is_head:
24908 * def __get__(self):
24909 * return self._is_head # <<<<<<<<<<<<<<
24910 * property is_tail:
24911 * def __get__(self):
24913 __Pyx_XDECREF(__pyx_r);
24914 __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_is_head); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24915 __Pyx_GOTREF(__pyx_t_1);
24916 __pyx_r = __pyx_t_1;
24920 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
24923 __Pyx_XDECREF(__pyx_t_1);
24924 __Pyx_AddTraceback("csamtools.PileupRead.is_head.__get__");
24927 __Pyx_XGIVEREF(__pyx_r);
24928 __Pyx_TraceReturn(__pyx_r);
24929 __Pyx_RefNannyFinishContext();
24933 /* "csamtools.pyx":2779
24934 * return self._is_head
24935 * property is_tail:
24936 * def __get__(self): # <<<<<<<<<<<<<<
24937 * return self._is_tail
24941 static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_tail___get__(PyObject *__pyx_v_self); /*proto*/
24942 static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_tail___get__(PyObject *__pyx_v_self) {
24943 PyObject *__pyx_r = NULL;
24944 PyObject *__pyx_t_1 = NULL;
24945 __Pyx_TraceDeclarations
24946 __Pyx_RefNannySetupContext("__get__");
24947 __Pyx_TraceCall("__get__", __pyx_f[0], 2779);
24949 /* "csamtools.pyx":2780
24950 * property is_tail:
24951 * def __get__(self):
24952 * return self._is_tail # <<<<<<<<<<<<<<
24954 * def __get__(self):
24956 __Pyx_XDECREF(__pyx_r);
24957 __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_is_tail); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
24958 __Pyx_GOTREF(__pyx_t_1);
24959 __pyx_r = __pyx_t_1;
24963 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
24966 __Pyx_XDECREF(__pyx_t_1);
24967 __Pyx_AddTraceback("csamtools.PileupRead.is_tail.__get__");
24970 __Pyx_XGIVEREF(__pyx_r);
24971 __Pyx_TraceReturn(__pyx_r);
24972 __Pyx_RefNannyFinishContext();
24976 /* "csamtools.pyx":2782
24977 * return self._is_tail
24979 * def __get__(self): # <<<<<<<<<<<<<<
24980 * return self._level
24984 static PyObject *__pyx_pf_9csamtools_10PileupRead_5level___get__(PyObject *__pyx_v_self); /*proto*/
24985 static PyObject *__pyx_pf_9csamtools_10PileupRead_5level___get__(PyObject *__pyx_v_self) {
24986 PyObject *__pyx_r = NULL;
24987 PyObject *__pyx_t_1 = NULL;
24988 __Pyx_TraceDeclarations
24989 __Pyx_RefNannySetupContext("__get__");
24990 __Pyx_TraceCall("__get__", __pyx_f[0], 2782);
24992 /* "csamtools.pyx":2783
24994 * def __get__(self):
24995 * return self._level # <<<<<<<<<<<<<<
24999 __Pyx_XDECREF(__pyx_r);
25000 __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25001 __Pyx_GOTREF(__pyx_t_1);
25002 __pyx_r = __pyx_t_1;
25006 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
25009 __Pyx_XDECREF(__pyx_t_1);
25010 __Pyx_AddTraceback("csamtools.PileupRead.level.__get__");
25013 __Pyx_XGIVEREF(__pyx_r);
25014 __Pyx_TraceReturn(__pyx_r);
25015 __Pyx_RefNannyFinishContext();
25019 /* "csamtools.pyx":2787
25021 * '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
25022 * def __init__(self, id = 1): # <<<<<<<<<<<<<<
25023 * self.streams = []
25027 static PyObject *__pyx_pf_9csamtools_4Outs___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
25028 static char __pyx_doc_9csamtools_4Outs___init__[] = "Outs.__init__(self, id=1)";
25029 static PyMethodDef __pyx_mdef_9csamtools_4Outs___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_9csamtools_4Outs___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs___init__)};
25030 static PyObject *__pyx_pf_9csamtools_4Outs___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
25031 PyObject *__pyx_v_self = 0;
25032 PyObject *__pyx_v_id = 0;
25033 PyObject *__pyx_r = NULL;
25034 PyObject *__pyx_t_1 = NULL;
25035 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__id,0};
25036 __Pyx_TraceDeclarations
25037 __Pyx_RefNannySetupContext("__init__");
25038 __Pyx_TraceCall("__init__", __pyx_f[0], 2787);
25039 __pyx_self = __pyx_self;
25040 if (unlikely(__pyx_kwds)) {
25041 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
25042 PyObject* values[2] = {0,0};
25043 values[1] = ((PyObject *)__pyx_int_1);
25044 switch (PyTuple_GET_SIZE(__pyx_args)) {
25045 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
25046 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
25048 default: goto __pyx_L5_argtuple_error;
25050 switch (PyTuple_GET_SIZE(__pyx_args)) {
25052 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
25053 if (likely(values[0])) kw_args--;
25054 else goto __pyx_L5_argtuple_error;
25057 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__id);
25058 if (value) { values[1] = value; kw_args--; }
25061 if (unlikely(kw_args > 0)) {
25062 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2787; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
25064 __pyx_v_self = values[0];
25065 __pyx_v_id = values[1];
25067 __pyx_v_id = ((PyObject *)__pyx_int_1);
25068 switch (PyTuple_GET_SIZE(__pyx_args)) {
25069 case 2: __pyx_v_id = PyTuple_GET_ITEM(__pyx_args, 1);
25070 case 1: __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
25072 default: goto __pyx_L5_argtuple_error;
25075 goto __pyx_L4_argument_unpacking_done;
25076 __pyx_L5_argtuple_error:;
25077 __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2787; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
25079 __Pyx_AddTraceback("csamtools.Outs.__init__");
25080 __Pyx_RefNannyFinishContext();
25082 __pyx_L4_argument_unpacking_done:;
25084 /* "csamtools.pyx":2788
25085 * '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
25086 * def __init__(self, id = 1):
25087 * self.streams = [] # <<<<<<<<<<<<<<
25091 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25092 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
25093 if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__streams, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25094 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
25096 /* "csamtools.pyx":2789
25097 * def __init__(self, id = 1):
25098 * self.streams = []
25099 * self.id = id # <<<<<<<<<<<<<<
25101 * def setdevice(self, filename):
25103 if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__id, __pyx_v_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25105 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
25108 __Pyx_XDECREF(__pyx_t_1);
25109 __Pyx_AddTraceback("csamtools.Outs.__init__");
25112 __Pyx_XGIVEREF(__pyx_r);
25113 __Pyx_TraceReturn(__pyx_r);
25114 __Pyx_RefNannyFinishContext();
25118 /* "csamtools.pyx":2791
25121 * def setdevice(self, filename): # <<<<<<<<<<<<<<
25122 * '''open an existing file, like "/dev/null"'''
25123 * fd = os.open(filename, os.O_WRONLY)
25126 static PyObject *__pyx_pf_9csamtools_4Outs_1setdevice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
25127 static char __pyx_doc_9csamtools_4Outs_1setdevice[] = "Outs.setdevice(self, filename)\nopen an existing file, like \"/dev/null\"";
25128 static PyMethodDef __pyx_mdef_9csamtools_4Outs_1setdevice = {__Pyx_NAMESTR("setdevice"), (PyCFunction)__pyx_pf_9csamtools_4Outs_1setdevice, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_1setdevice)};
25129 static PyObject *__pyx_pf_9csamtools_4Outs_1setdevice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
25130 PyObject *__pyx_v_self = 0;
25131 PyObject *__pyx_v_filename = 0;
25132 PyObject *__pyx_v_fd;
25133 PyObject *__pyx_r = NULL;
25134 PyObject *__pyx_t_1 = NULL;
25135 PyObject *__pyx_t_2 = NULL;
25136 PyObject *__pyx_t_3 = NULL;
25137 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filename,0};
25138 __Pyx_TraceDeclarations
25139 __Pyx_RefNannySetupContext("setdevice");
25140 __Pyx_TraceCall("setdevice", __pyx_f[0], 2791);
25141 __pyx_self = __pyx_self;
25142 if (unlikely(__pyx_kwds)) {
25143 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
25144 PyObject* values[2] = {0,0};
25145 switch (PyTuple_GET_SIZE(__pyx_args)) {
25146 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
25147 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
25149 default: goto __pyx_L5_argtuple_error;
25151 switch (PyTuple_GET_SIZE(__pyx_args)) {
25153 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
25154 if (likely(values[0])) kw_args--;
25155 else goto __pyx_L5_argtuple_error;
25157 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
25158 if (likely(values[1])) kw_args--;
25160 __Pyx_RaiseArgtupleInvalid("setdevice", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
25163 if (unlikely(kw_args > 0)) {
25164 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setdevice") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
25166 __pyx_v_self = values[0];
25167 __pyx_v_filename = values[1];
25168 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
25169 goto __pyx_L5_argtuple_error;
25171 __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
25172 __pyx_v_filename = PyTuple_GET_ITEM(__pyx_args, 1);
25174 goto __pyx_L4_argument_unpacking_done;
25175 __pyx_L5_argtuple_error:;
25176 __Pyx_RaiseArgtupleInvalid("setdevice", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
25178 __Pyx_AddTraceback("csamtools.Outs.setdevice");
25179 __Pyx_RefNannyFinishContext();
25181 __pyx_L4_argument_unpacking_done:;
25182 __pyx_v_fd = Py_None; __Pyx_INCREF(Py_None);
25184 /* "csamtools.pyx":2793
25185 * def setdevice(self, filename):
25186 * '''open an existing file, like "/dev/null"'''
25187 * fd = os.open(filename, os.O_WRONLY) # <<<<<<<<<<<<<<
25191 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25192 __Pyx_GOTREF(__pyx_t_1);
25193 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__open); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25194 __Pyx_GOTREF(__pyx_t_2);
25195 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25196 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25197 __Pyx_GOTREF(__pyx_t_1);
25198 __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 = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25199 __Pyx_GOTREF(__pyx_t_3);
25200 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25201 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25202 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
25203 __Pyx_INCREF(__pyx_v_filename);
25204 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
25205 __Pyx_GIVEREF(__pyx_v_filename);
25206 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
25207 __Pyx_GIVEREF(__pyx_t_3);
25209 __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 = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25210 __Pyx_GOTREF(__pyx_t_3);
25211 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25212 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
25213 __Pyx_DECREF(__pyx_v_fd);
25214 __pyx_v_fd = __pyx_t_3;
25217 /* "csamtools.pyx":2794
25218 * '''open an existing file, like "/dev/null"'''
25219 * fd = os.open(filename, os.O_WRONLY)
25220 * self.setfd(fd) # <<<<<<<<<<<<<<
25222 * def setfile(self, filename):
25224 __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__setfd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25225 __Pyx_GOTREF(__pyx_t_3);
25226 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25227 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
25228 __Pyx_INCREF(__pyx_v_fd);
25229 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fd);
25230 __Pyx_GIVEREF(__pyx_v_fd);
25231 __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 = 2794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25232 __Pyx_GOTREF(__pyx_t_2);
25233 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25234 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
25235 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25237 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
25240 __Pyx_XDECREF(__pyx_t_1);
25241 __Pyx_XDECREF(__pyx_t_2);
25242 __Pyx_XDECREF(__pyx_t_3);
25243 __Pyx_AddTraceback("csamtools.Outs.setdevice");
25246 __Pyx_DECREF(__pyx_v_fd);
25247 __Pyx_XGIVEREF(__pyx_r);
25248 __Pyx_TraceReturn(__pyx_r);
25249 __Pyx_RefNannyFinishContext();
25253 /* "csamtools.pyx":2796
25256 * def setfile(self, filename): # <<<<<<<<<<<<<<
25257 * '''open a new file.'''
25258 * fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660);
25261 static PyObject *__pyx_pf_9csamtools_4Outs_2setfile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
25262 static char __pyx_doc_9csamtools_4Outs_2setfile[] = "Outs.setfile(self, filename)\nopen a new file.";
25263 static PyMethodDef __pyx_mdef_9csamtools_4Outs_2setfile = {__Pyx_NAMESTR("setfile"), (PyCFunction)__pyx_pf_9csamtools_4Outs_2setfile, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_2setfile)};
25264 static PyObject *__pyx_pf_9csamtools_4Outs_2setfile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
25265 PyObject *__pyx_v_self = 0;
25266 PyObject *__pyx_v_filename = 0;
25267 PyObject *__pyx_v_fd;
25268 PyObject *__pyx_r = NULL;
25269 PyObject *__pyx_t_1 = NULL;
25270 PyObject *__pyx_t_2 = NULL;
25271 PyObject *__pyx_t_3 = NULL;
25272 PyObject *__pyx_t_4 = NULL;
25273 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filename,0};
25274 __Pyx_TraceDeclarations
25275 __Pyx_RefNannySetupContext("setfile");
25276 __Pyx_TraceCall("setfile", __pyx_f[0], 2796);
25277 __pyx_self = __pyx_self;
25278 if (unlikely(__pyx_kwds)) {
25279 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
25280 PyObject* values[2] = {0,0};
25281 switch (PyTuple_GET_SIZE(__pyx_args)) {
25282 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
25283 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
25285 default: goto __pyx_L5_argtuple_error;
25287 switch (PyTuple_GET_SIZE(__pyx_args)) {
25289 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
25290 if (likely(values[0])) kw_args--;
25291 else goto __pyx_L5_argtuple_error;
25293 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
25294 if (likely(values[1])) kw_args--;
25296 __Pyx_RaiseArgtupleInvalid("setfile", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
25299 if (unlikely(kw_args > 0)) {
25300 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setfile") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
25302 __pyx_v_self = values[0];
25303 __pyx_v_filename = values[1];
25304 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
25305 goto __pyx_L5_argtuple_error;
25307 __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
25308 __pyx_v_filename = PyTuple_GET_ITEM(__pyx_args, 1);
25310 goto __pyx_L4_argument_unpacking_done;
25311 __pyx_L5_argtuple_error:;
25312 __Pyx_RaiseArgtupleInvalid("setfile", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
25314 __Pyx_AddTraceback("csamtools.Outs.setfile");
25315 __Pyx_RefNannyFinishContext();
25317 __pyx_L4_argument_unpacking_done:;
25318 __pyx_v_fd = Py_None; __Pyx_INCREF(Py_None);
25320 /* "csamtools.pyx":2798
25321 * def setfile(self, filename):
25322 * '''open a new file.'''
25323 * fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660); # <<<<<<<<<<<<<<
25327 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25328 __Pyx_GOTREF(__pyx_t_1);
25329 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__open); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25330 __Pyx_GOTREF(__pyx_t_2);
25331 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25332 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25333 __Pyx_GOTREF(__pyx_t_1);
25334 __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 = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25335 __Pyx_GOTREF(__pyx_t_3);
25336 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25337 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25338 __Pyx_GOTREF(__pyx_t_1);
25339 __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 = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25340 __Pyx_GOTREF(__pyx_t_4);
25341 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25342 __pyx_t_1 = PyNumber_Or(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25343 __Pyx_GOTREF(__pyx_t_1);
25344 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25345 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
25346 __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25347 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
25348 __Pyx_INCREF(__pyx_v_filename);
25349 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filename);
25350 __Pyx_GIVEREF(__pyx_v_filename);
25351 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
25352 __Pyx_GIVEREF(__pyx_t_1);
25353 __Pyx_INCREF(__pyx_int_0660);
25354 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_0660);
25355 __Pyx_GIVEREF(__pyx_int_0660);
25357 __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 = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25358 __Pyx_GOTREF(__pyx_t_1);
25359 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25360 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
25361 __Pyx_DECREF(__pyx_v_fd);
25362 __pyx_v_fd = __pyx_t_1;
25365 /* "csamtools.pyx":2799
25366 * '''open a new file.'''
25367 * fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660);
25368 * self.setfd(fd) # <<<<<<<<<<<<<<
25370 * def setfd(self, fd):
25372 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__setfd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25373 __Pyx_GOTREF(__pyx_t_1);
25374 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25375 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
25376 __Pyx_INCREF(__pyx_v_fd);
25377 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_fd);
25378 __Pyx_GIVEREF(__pyx_v_fd);
25379 __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 = 2799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25380 __Pyx_GOTREF(__pyx_t_2);
25381 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25382 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
25383 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25385 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
25388 __Pyx_XDECREF(__pyx_t_1);
25389 __Pyx_XDECREF(__pyx_t_2);
25390 __Pyx_XDECREF(__pyx_t_3);
25391 __Pyx_XDECREF(__pyx_t_4);
25392 __Pyx_AddTraceback("csamtools.Outs.setfile");
25395 __Pyx_DECREF(__pyx_v_fd);
25396 __Pyx_XGIVEREF(__pyx_r);
25397 __Pyx_TraceReturn(__pyx_r);
25398 __Pyx_RefNannyFinishContext();
25402 /* "csamtools.pyx":2801
25405 * def setfd(self, fd): # <<<<<<<<<<<<<<
25406 * ofd = os.dup(self.id) # Save old stream on new unit.
25407 * self.streams.append(ofd)
25410 static PyObject *__pyx_pf_9csamtools_4Outs_3setfd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
25411 static char __pyx_doc_9csamtools_4Outs_3setfd[] = "Outs.setfd(self, fd)";
25412 static PyMethodDef __pyx_mdef_9csamtools_4Outs_3setfd = {__Pyx_NAMESTR("setfd"), (PyCFunction)__pyx_pf_9csamtools_4Outs_3setfd, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_3setfd)};
25413 static PyObject *__pyx_pf_9csamtools_4Outs_3setfd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
25414 PyObject *__pyx_v_self = 0;
25415 PyObject *__pyx_v_fd = 0;
25416 PyObject *__pyx_v_ofd;
25417 PyObject *__pyx_r = NULL;
25418 PyObject *__pyx_t_1 = NULL;
25419 PyObject *__pyx_t_2 = NULL;
25420 PyObject *__pyx_t_3 = NULL;
25421 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__fd,0};
25422 __Pyx_TraceDeclarations
25423 __Pyx_RefNannySetupContext("setfd");
25424 __Pyx_TraceCall("setfd", __pyx_f[0], 2801);
25425 __pyx_self = __pyx_self;
25426 if (unlikely(__pyx_kwds)) {
25427 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
25428 PyObject* values[2] = {0,0};
25429 switch (PyTuple_GET_SIZE(__pyx_args)) {
25430 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
25431 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
25433 default: goto __pyx_L5_argtuple_error;
25435 switch (PyTuple_GET_SIZE(__pyx_args)) {
25437 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
25438 if (likely(values[0])) kw_args--;
25439 else goto __pyx_L5_argtuple_error;
25441 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fd);
25442 if (likely(values[1])) kw_args--;
25444 __Pyx_RaiseArgtupleInvalid("setfd", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
25447 if (unlikely(kw_args > 0)) {
25448 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setfd") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
25450 __pyx_v_self = values[0];
25451 __pyx_v_fd = values[1];
25452 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
25453 goto __pyx_L5_argtuple_error;
25455 __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
25456 __pyx_v_fd = PyTuple_GET_ITEM(__pyx_args, 1);
25458 goto __pyx_L4_argument_unpacking_done;
25459 __pyx_L5_argtuple_error:;
25460 __Pyx_RaiseArgtupleInvalid("setfd", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
25462 __Pyx_AddTraceback("csamtools.Outs.setfd");
25463 __Pyx_RefNannyFinishContext();
25465 __pyx_L4_argument_unpacking_done:;
25466 __pyx_v_ofd = Py_None; __Pyx_INCREF(Py_None);
25468 /* "csamtools.pyx":2802
25470 * def setfd(self, fd):
25471 * ofd = os.dup(self.id) # Save old stream on new unit. # <<<<<<<<<<<<<<
25472 * self.streams.append(ofd)
25473 * sys.stdout.flush() # Buffered data goes to old stream.
25475 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25476 __Pyx_GOTREF(__pyx_t_1);
25477 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dup); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25478 __Pyx_GOTREF(__pyx_t_2);
25479 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25480 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25481 __Pyx_GOTREF(__pyx_t_1);
25482 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25483 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
25484 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
25485 __Pyx_GIVEREF(__pyx_t_1);
25487 __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 = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25488 __Pyx_GOTREF(__pyx_t_1);
25489 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25490 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
25491 __Pyx_DECREF(__pyx_v_ofd);
25492 __pyx_v_ofd = __pyx_t_1;
25495 /* "csamtools.pyx":2803
25496 * def setfd(self, fd):
25497 * ofd = os.dup(self.id) # Save old stream on new unit.
25498 * self.streams.append(ofd) # <<<<<<<<<<<<<<
25499 * sys.stdout.flush() # Buffered data goes to old stream.
25500 * sys.stderr.flush() # Buffered data goes to old stream.
25502 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25503 __Pyx_GOTREF(__pyx_t_1);
25504 __pyx_t_3 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_v_ofd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25505 __Pyx_GOTREF(__pyx_t_3);
25506 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25507 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25509 /* "csamtools.pyx":2804
25510 * ofd = os.dup(self.id) # Save old stream on new unit.
25511 * self.streams.append(ofd)
25512 * sys.stdout.flush() # Buffered data goes to old stream. # <<<<<<<<<<<<<<
25513 * sys.stderr.flush() # Buffered data goes to old stream.
25514 * os.dup2(fd, self.id) # Open unit 1 on new stream.
25516 __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25517 __Pyx_GOTREF(__pyx_t_3);
25518 __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stdout); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25519 __Pyx_GOTREF(__pyx_t_1);
25520 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25521 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__flush); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25522 __Pyx_GOTREF(__pyx_t_3);
25523 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25524 __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 = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25525 __Pyx_GOTREF(__pyx_t_1);
25526 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25527 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25529 /* "csamtools.pyx":2805
25530 * self.streams.append(ofd)
25531 * sys.stdout.flush() # Buffered data goes to old stream.
25532 * sys.stderr.flush() # Buffered data goes to old stream. # <<<<<<<<<<<<<<
25533 * os.dup2(fd, self.id) # Open unit 1 on new stream.
25534 * os.close(fd) # Close other unit (look out, caller.)
25536 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25537 __Pyx_GOTREF(__pyx_t_1);
25538 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__stderr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25539 __Pyx_GOTREF(__pyx_t_3);
25540 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25541 __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__flush); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25542 __Pyx_GOTREF(__pyx_t_1);
25543 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25544 __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 = 2805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25545 __Pyx_GOTREF(__pyx_t_3);
25546 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25547 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25549 /* "csamtools.pyx":2806
25550 * sys.stdout.flush() # Buffered data goes to old stream.
25551 * sys.stderr.flush() # Buffered data goes to old stream.
25552 * os.dup2(fd, self.id) # Open unit 1 on new stream. # <<<<<<<<<<<<<<
25553 * os.close(fd) # Close other unit (look out, caller.)
25556 __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25557 __Pyx_GOTREF(__pyx_t_3);
25558 __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dup2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25559 __Pyx_GOTREF(__pyx_t_1);
25560 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25561 __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25562 __Pyx_GOTREF(__pyx_t_3);
25563 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25564 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
25565 __Pyx_INCREF(__pyx_v_fd);
25566 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fd);
25567 __Pyx_GIVEREF(__pyx_v_fd);
25568 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
25569 __Pyx_GIVEREF(__pyx_t_3);
25571 __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 = 2806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25572 __Pyx_GOTREF(__pyx_t_3);
25573 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25574 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
25575 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25577 /* "csamtools.pyx":2807
25578 * sys.stderr.flush() # Buffered data goes to old stream.
25579 * os.dup2(fd, self.id) # Open unit 1 on new stream.
25580 * os.close(fd) # Close other unit (look out, caller.) # <<<<<<<<<<<<<<
25582 * def restore(self):
25584 __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25585 __Pyx_GOTREF(__pyx_t_3);
25586 __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25587 __Pyx_GOTREF(__pyx_t_2);
25588 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25589 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25590 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
25591 __Pyx_INCREF(__pyx_v_fd);
25592 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fd);
25593 __Pyx_GIVEREF(__pyx_v_fd);
25594 __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 = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25595 __Pyx_GOTREF(__pyx_t_1);
25596 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25597 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
25598 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25600 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
25603 __Pyx_XDECREF(__pyx_t_1);
25604 __Pyx_XDECREF(__pyx_t_2);
25605 __Pyx_XDECREF(__pyx_t_3);
25606 __Pyx_AddTraceback("csamtools.Outs.setfd");
25609 __Pyx_DECREF(__pyx_v_ofd);
25610 __Pyx_XGIVEREF(__pyx_r);
25611 __Pyx_TraceReturn(__pyx_r);
25612 __Pyx_RefNannyFinishContext();
25616 /* "csamtools.pyx":2809
25617 * os.close(fd) # Close other unit (look out, caller.)
25619 * def restore(self): # <<<<<<<<<<<<<<
25620 * '''restore previous output stream'''
25624 static PyObject *__pyx_pf_9csamtools_4Outs_4restore(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
25625 static char __pyx_doc_9csamtools_4Outs_4restore[] = "Outs.restore(self)\nrestore previous output stream";
25626 static PyMethodDef __pyx_mdef_9csamtools_4Outs_4restore = {__Pyx_NAMESTR("restore"), (PyCFunction)__pyx_pf_9csamtools_4Outs_4restore, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_4restore)};
25627 static PyObject *__pyx_pf_9csamtools_4Outs_4restore(PyObject *__pyx_self, PyObject *__pyx_v_self) {
25628 PyObject *__pyx_r = NULL;
25629 PyObject *__pyx_t_1 = NULL;
25631 PyObject *__pyx_t_3 = NULL;
25632 PyObject *__pyx_t_4 = NULL;
25633 PyObject *__pyx_t_5 = NULL;
25634 __Pyx_TraceDeclarations
25635 __Pyx_RefNannySetupContext("restore");
25636 __Pyx_TraceCall("restore", __pyx_f[0], 2809);
25637 __pyx_self = __pyx_self;
25639 /* "csamtools.pyx":2811
25640 * def restore(self):
25641 * '''restore previous output stream'''
25642 * if self.streams: # <<<<<<<<<<<<<<
25643 * # the following was not sufficient, hence flush both stderr and stdout
25644 * # os.fsync( self.id )
25646 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25647 __Pyx_GOTREF(__pyx_t_1);
25648 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25649 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25652 /* "csamtools.pyx":2814
25653 * # the following was not sufficient, hence flush both stderr and stdout
25654 * # os.fsync( self.id )
25655 * sys.stdout.flush() # <<<<<<<<<<<<<<
25656 * sys.stderr.flush()
25657 * os.dup2(self.streams[-1], self.id)
25659 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25660 __Pyx_GOTREF(__pyx_t_1);
25661 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__stdout); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25662 __Pyx_GOTREF(__pyx_t_3);
25663 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25664 __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__flush); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25665 __Pyx_GOTREF(__pyx_t_1);
25666 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25667 __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 = 2814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25668 __Pyx_GOTREF(__pyx_t_3);
25669 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25670 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25672 /* "csamtools.pyx":2815
25673 * # os.fsync( self.id )
25674 * sys.stdout.flush()
25675 * sys.stderr.flush() # <<<<<<<<<<<<<<
25676 * os.dup2(self.streams[-1], self.id)
25677 * os.close(self.streams[-1])
25679 __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25680 __Pyx_GOTREF(__pyx_t_3);
25681 __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stderr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25682 __Pyx_GOTREF(__pyx_t_1);
25683 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25684 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__flush); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25685 __Pyx_GOTREF(__pyx_t_3);
25686 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25687 __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 = 2815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25688 __Pyx_GOTREF(__pyx_t_1);
25689 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25690 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25692 /* "csamtools.pyx":2816
25693 * sys.stdout.flush()
25694 * sys.stderr.flush()
25695 * os.dup2(self.streams[-1], self.id) # <<<<<<<<<<<<<<
25696 * os.close(self.streams[-1])
25697 * del self.streams[-1]
25699 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25700 __Pyx_GOTREF(__pyx_t_1);
25701 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dup2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25702 __Pyx_GOTREF(__pyx_t_3);
25703 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25704 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25705 __Pyx_GOTREF(__pyx_t_1);
25706 __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25707 __Pyx_GOTREF(__pyx_t_4);
25708 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25709 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25710 __Pyx_GOTREF(__pyx_t_1);
25711 __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25712 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
25713 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
25714 __Pyx_GIVEREF(__pyx_t_4);
25715 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
25716 __Pyx_GIVEREF(__pyx_t_1);
25719 __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 = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25720 __Pyx_GOTREF(__pyx_t_1);
25721 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25722 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
25723 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25725 /* "csamtools.pyx":2817
25726 * sys.stderr.flush()
25727 * os.dup2(self.streams[-1], self.id)
25728 * os.close(self.streams[-1]) # <<<<<<<<<<<<<<
25729 * del self.streams[-1]
25732 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25733 __Pyx_GOTREF(__pyx_t_1);
25734 __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25735 __Pyx_GOTREF(__pyx_t_5);
25736 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25737 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25738 __Pyx_GOTREF(__pyx_t_1);
25739 __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25740 __Pyx_GOTREF(__pyx_t_3);
25741 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25742 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25743 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
25744 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
25745 __Pyx_GIVEREF(__pyx_t_3);
25747 __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 = 2817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25748 __Pyx_GOTREF(__pyx_t_3);
25749 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
25750 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
25751 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25753 /* "csamtools.pyx":2818
25754 * os.dup2(self.streams[-1], self.id)
25755 * os.close(self.streams[-1])
25756 * del self.streams[-1] # <<<<<<<<<<<<<<
25758 * def _samtools_dispatch( method,
25760 __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25761 __Pyx_GOTREF(__pyx_t_3);
25762 if (__Pyx_DelItemInt(__pyx_t_3, -1, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25763 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25768 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
25771 __Pyx_XDECREF(__pyx_t_1);
25772 __Pyx_XDECREF(__pyx_t_3);
25773 __Pyx_XDECREF(__pyx_t_4);
25774 __Pyx_XDECREF(__pyx_t_5);
25775 __Pyx_AddTraceback("csamtools.Outs.restore");
25778 __Pyx_XGIVEREF(__pyx_r);
25779 __Pyx_TraceReturn(__pyx_r);
25780 __Pyx_RefNannyFinishContext();
25784 /* "csamtools.pyx":2820
25785 * del self.streams[-1]
25787 * def _samtools_dispatch( method, # <<<<<<<<<<<<<<
25789 * catch_stdout = True,
25792 static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
25793 static char __pyx_doc_9csamtools__samtools_dispatch[] = "_samtools_dispatch(method, args=(), catch_stdout=True, catch_stderr=False)\ncall ``method`` in samtools providing arguments in args.\n \n .. note:: \n This method redirects stdout and (optionally) stderr to capture it \n from samtools. If for some reason stdout/stderr 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 ";
25794 static PyMethodDef __pyx_mdef_9csamtools__samtools_dispatch = {__Pyx_NAMESTR("_samtools_dispatch"), (PyCFunction)__pyx_pf_9csamtools__samtools_dispatch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools__samtools_dispatch)};
25795 static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
25796 PyObject *__pyx_v_method = 0;
25797 PyObject *__pyx_v_args = 0;
25798 PyObject *__pyx_v_catch_stdout = 0;
25799 PyObject *__pyx_v_catch_stderr = 0;
25800 PyObject *__pyx_v_stderr_h;
25801 PyObject *__pyx_v_stderr_f;
25802 PyObject *__pyx_v_stderr_save;
25803 PyObject *__pyx_v_stdout_h;
25804 PyObject *__pyx_v_stdout_f;
25805 PyObject *__pyx_v_stdout_save;
25806 char **__pyx_v_cargs;
25809 int __pyx_v_retval;
25810 PyObject *__pyx_v_out_stdout;
25811 PyObject *__pyx_v_out_stderr;
25812 PyObject *__pyx_r = NULL;
25813 PyObject *__pyx_t_1 = NULL;
25815 PyObject *__pyx_t_3 = NULL;
25816 PyObject *__pyx_t_4 = NULL;
25818 PyObject *__pyx_t_6 = NULL;
25819 Py_ssize_t __pyx_t_7;
25822 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__method,&__pyx_n_s__args,&__pyx_n_s__catch_stdout,&__pyx_n_s__catch_stderr,0};
25823 __Pyx_TraceDeclarations
25824 __Pyx_RefNannySetupContext("_samtools_dispatch");
25825 __Pyx_TraceCall("_samtools_dispatch", __pyx_f[0], 2820);
25826 __pyx_self = __pyx_self;
25827 if (unlikely(__pyx_kwds)) {
25828 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
25829 PyObject* values[4] = {0,0,0,0};
25831 /* "csamtools.pyx":2821
25833 * def _samtools_dispatch( method,
25834 * args = (), # <<<<<<<<<<<<<<
25835 * catch_stdout = True,
25836 * catch_stderr = False,
25838 values[1] = ((PyObject *)__pyx_empty_tuple);
25839 values[2] = __pyx_k_160;
25840 values[3] = __pyx_k_161;
25841 switch (PyTuple_GET_SIZE(__pyx_args)) {
25842 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
25843 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
25844 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
25845 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
25847 default: goto __pyx_L5_argtuple_error;
25849 switch (PyTuple_GET_SIZE(__pyx_args)) {
25851 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__method);
25852 if (likely(values[0])) kw_args--;
25853 else goto __pyx_L5_argtuple_error;
25856 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__args);
25857 if (value) { values[1] = value; kw_args--; }
25861 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__catch_stdout);
25862 if (value) { values[2] = value; kw_args--; }
25866 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__catch_stderr);
25867 if (value) { values[3] = value; kw_args--; }
25870 if (unlikely(kw_args > 0)) {
25871 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_samtools_dispatch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2820; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
25873 __pyx_v_method = values[0];
25874 __pyx_v_args = values[1];
25875 __pyx_v_catch_stdout = values[2];
25876 __pyx_v_catch_stderr = values[3];
25878 __pyx_v_args = ((PyObject *)__pyx_empty_tuple);
25879 __pyx_v_catch_stdout = __pyx_k_160;
25880 __pyx_v_catch_stderr = __pyx_k_161;
25881 switch (PyTuple_GET_SIZE(__pyx_args)) {
25882 case 4: __pyx_v_catch_stderr = PyTuple_GET_ITEM(__pyx_args, 3);
25883 case 3: __pyx_v_catch_stdout = PyTuple_GET_ITEM(__pyx_args, 2);
25884 case 2: __pyx_v_args = PyTuple_GET_ITEM(__pyx_args, 1);
25885 case 1: __pyx_v_method = PyTuple_GET_ITEM(__pyx_args, 0);
25887 default: goto __pyx_L5_argtuple_error;
25890 goto __pyx_L4_argument_unpacking_done;
25891 __pyx_L5_argtuple_error:;
25892 __Pyx_RaiseArgtupleInvalid("_samtools_dispatch", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2820; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
25894 __Pyx_AddTraceback("csamtools._samtools_dispatch");
25895 __Pyx_RefNannyFinishContext();
25897 __pyx_L4_argument_unpacking_done:;
25898 __Pyx_INCREF(__pyx_v_args);
25899 __pyx_v_stderr_h = Py_None; __Pyx_INCREF(Py_None);
25900 __pyx_v_stderr_f = Py_None; __Pyx_INCREF(Py_None);
25901 __pyx_v_stderr_save = Py_None; __Pyx_INCREF(Py_None);
25902 __pyx_v_stdout_h = Py_None; __Pyx_INCREF(Py_None);
25903 __pyx_v_stdout_f = Py_None; __Pyx_INCREF(Py_None);
25904 __pyx_v_stdout_save = Py_None; __Pyx_INCREF(Py_None);
25905 __pyx_v_out_stdout = Py_None; __Pyx_INCREF(Py_None);
25906 __pyx_v_out_stderr = Py_None; __Pyx_INCREF(Py_None);
25908 /* "csamtools.pyx":2848
25910 * # some special cases
25911 * if method == "index": # <<<<<<<<<<<<<<
25912 * if not os.path.exists( args[0] ):
25913 * raise IOError( "No such file or directory: '%s'" % args[0] )
25915 __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__index), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25916 __Pyx_GOTREF(__pyx_t_1);
25917 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25918 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25921 /* "csamtools.pyx":2849
25922 * # some special cases
25923 * if method == "index":
25924 * if not os.path.exists( args[0] ): # <<<<<<<<<<<<<<
25925 * raise IOError( "No such file or directory: '%s'" % args[0] )
25928 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25929 __Pyx_GOTREF(__pyx_t_1);
25930 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25931 __Pyx_GOTREF(__pyx_t_3);
25932 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25933 __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25934 __Pyx_GOTREF(__pyx_t_1);
25935 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25936 __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25937 __Pyx_GOTREF(__pyx_t_3);
25938 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25939 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
25940 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
25941 __Pyx_GIVEREF(__pyx_t_3);
25943 __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 = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25944 __Pyx_GOTREF(__pyx_t_3);
25945 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25946 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
25947 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25948 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25949 __pyx_t_5 = (!__pyx_t_2);
25952 /* "csamtools.pyx":2850
25953 * if method == "index":
25954 * if not os.path.exists( args[0] ):
25955 * raise IOError( "No such file or directory: '%s'" % args[0] ) # <<<<<<<<<<<<<<
25957 * # redirect stderr and stdout to file
25959 __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25960 __Pyx_GOTREF(__pyx_t_3);
25961 __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_162), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25962 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
25963 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25964 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25965 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
25966 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
25967 __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
25969 __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 = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25970 __Pyx_GOTREF(__pyx_t_4);
25971 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
25972 __Pyx_Raise(__pyx_t_4, 0, 0);
25973 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
25974 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25982 /* "csamtools.pyx":2853
25984 * # redirect stderr and stdout to file
25985 * if catch_stderr: # <<<<<<<<<<<<<<
25986 * stderr_h, stderr_f = tempfile.mkstemp()
25987 * stderr_save = Outs( sys.stderr.fileno() )
25989 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stderr); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
25992 /* "csamtools.pyx":2854
25993 * # redirect stderr and stdout to file
25995 * stderr_h, stderr_f = tempfile.mkstemp() # <<<<<<<<<<<<<<
25996 * stderr_save = Outs( sys.stderr.fileno() )
25997 * stderr_save.setfd( stderr_h )
25999 __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__tempfile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26000 __Pyx_GOTREF(__pyx_t_4);
26001 __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__mkstemp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26002 __Pyx_GOTREF(__pyx_t_3);
26003 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26004 __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 = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26005 __Pyx_GOTREF(__pyx_t_4);
26006 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26007 if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
26008 PyObject* tuple = __pyx_t_4;
26009 __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3);
26010 __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1);
26011 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26012 __Pyx_DECREF(__pyx_v_stderr_h);
26013 __pyx_v_stderr_h = __pyx_t_3;
26015 __Pyx_DECREF(__pyx_v_stderr_f);
26016 __pyx_v_stderr_f = __pyx_t_1;
26019 __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26020 __Pyx_GOTREF(__pyx_t_6);
26021 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26022 __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26023 __Pyx_GOTREF(__pyx_t_3);
26024 __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26025 __Pyx_GOTREF(__pyx_t_1);
26026 if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26027 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
26028 __Pyx_DECREF(__pyx_v_stderr_h);
26029 __pyx_v_stderr_h = __pyx_t_3;
26031 __Pyx_DECREF(__pyx_v_stderr_f);
26032 __pyx_v_stderr_f = __pyx_t_1;
26036 /* "csamtools.pyx":2855
26038 * stderr_h, stderr_f = tempfile.mkstemp()
26039 * stderr_save = Outs( sys.stderr.fileno() ) # <<<<<<<<<<<<<<
26040 * stderr_save.setfd( stderr_h )
26043 __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__Outs); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26044 __Pyx_GOTREF(__pyx_t_4);
26045 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26046 __Pyx_GOTREF(__pyx_t_1);
26047 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__stderr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26048 __Pyx_GOTREF(__pyx_t_3);
26049 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26050 __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__fileno); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26051 __Pyx_GOTREF(__pyx_t_1);
26052 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26053 __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 = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26054 __Pyx_GOTREF(__pyx_t_3);
26055 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26056 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26057 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
26058 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
26059 __Pyx_GIVEREF(__pyx_t_3);
26061 __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26062 __Pyx_GOTREF(__pyx_t_3);
26063 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26064 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
26065 __Pyx_DECREF(__pyx_v_stderr_save);
26066 __pyx_v_stderr_save = __pyx_t_3;
26069 /* "csamtools.pyx":2856
26070 * stderr_h, stderr_f = tempfile.mkstemp()
26071 * stderr_save = Outs( sys.stderr.fileno() )
26072 * stderr_save.setfd( stderr_h ) # <<<<<<<<<<<<<<
26076 __pyx_t_3 = PyObject_GetAttr(__pyx_v_stderr_save, __pyx_n_s__setfd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26077 __Pyx_GOTREF(__pyx_t_3);
26078 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26079 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
26080 __Pyx_INCREF(__pyx_v_stderr_h);
26081 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_stderr_h);
26082 __Pyx_GIVEREF(__pyx_v_stderr_h);
26083 __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26084 __Pyx_GOTREF(__pyx_t_4);
26085 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26086 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
26087 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26092 /* "csamtools.pyx":2858
26093 * stderr_save.setfd( stderr_h )
26095 * if catch_stdout: # <<<<<<<<<<<<<<
26096 * stdout_h, stdout_f = tempfile.mkstemp()
26097 * stdout_save = Outs( sys.stdout.fileno() )
26099 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stdout); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26102 /* "csamtools.pyx":2859
26105 * stdout_h, stdout_f = tempfile.mkstemp() # <<<<<<<<<<<<<<
26106 * stdout_save = Outs( sys.stdout.fileno() )
26107 * stdout_save.setfd( stdout_h )
26109 __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__tempfile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26110 __Pyx_GOTREF(__pyx_t_4);
26111 __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__mkstemp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26112 __Pyx_GOTREF(__pyx_t_1);
26113 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26114 __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26115 __Pyx_GOTREF(__pyx_t_4);
26116 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26117 if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) {
26118 PyObject* tuple = __pyx_t_4;
26119 __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
26120 __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
26121 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26122 __Pyx_DECREF(__pyx_v_stdout_h);
26123 __pyx_v_stdout_h = __pyx_t_1;
26125 __Pyx_DECREF(__pyx_v_stdout_f);
26126 __pyx_v_stdout_f = __pyx_t_3;
26129 __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26130 __Pyx_GOTREF(__pyx_t_6);
26131 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26132 __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26133 __Pyx_GOTREF(__pyx_t_1);
26134 __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26135 __Pyx_GOTREF(__pyx_t_3);
26136 if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26137 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
26138 __Pyx_DECREF(__pyx_v_stdout_h);
26139 __pyx_v_stdout_h = __pyx_t_1;
26141 __Pyx_DECREF(__pyx_v_stdout_f);
26142 __pyx_v_stdout_f = __pyx_t_3;
26146 /* "csamtools.pyx":2860
26148 * stdout_h, stdout_f = tempfile.mkstemp()
26149 * stdout_save = Outs( sys.stdout.fileno() ) # <<<<<<<<<<<<<<
26150 * stdout_save.setfd( stdout_h )
26153 __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__Outs); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26154 __Pyx_GOTREF(__pyx_t_4);
26155 __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26156 __Pyx_GOTREF(__pyx_t_3);
26157 __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stdout); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26158 __Pyx_GOTREF(__pyx_t_1);
26159 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26160 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__fileno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26161 __Pyx_GOTREF(__pyx_t_3);
26162 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26163 __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 = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26164 __Pyx_GOTREF(__pyx_t_1);
26165 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26166 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26167 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
26168 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
26169 __Pyx_GIVEREF(__pyx_t_1);
26171 __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26172 __Pyx_GOTREF(__pyx_t_1);
26173 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26174 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
26175 __Pyx_DECREF(__pyx_v_stdout_save);
26176 __pyx_v_stdout_save = __pyx_t_1;
26179 /* "csamtools.pyx":2861
26180 * stdout_h, stdout_f = tempfile.mkstemp()
26181 * stdout_save = Outs( sys.stdout.fileno() )
26182 * stdout_save.setfd( stdout_h ) # <<<<<<<<<<<<<<
26184 * # patch for `samtools view`
26186 __pyx_t_1 = PyObject_GetAttr(__pyx_v_stdout_save, __pyx_n_s__setfd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26187 __Pyx_GOTREF(__pyx_t_1);
26188 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26189 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
26190 __Pyx_INCREF(__pyx_v_stdout_h);
26191 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_stdout_h);
26192 __Pyx_GIVEREF(__pyx_v_stdout_h);
26193 __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26194 __Pyx_GOTREF(__pyx_t_4);
26195 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26196 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
26197 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26199 /* "csamtools.pyx":2866
26200 * # samtools `view` closes stdout, from which I can not
26201 * # recover. Thus redirect output to file with -o option.
26202 * if method == "view": # <<<<<<<<<<<<<<
26203 * if "-o" in args: raise ValueError("option -o is forbidden in samtools view")
26204 * args = ( "-o", stdout_f ) + args
26206 __pyx_t_4 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__view), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26207 __Pyx_GOTREF(__pyx_t_4);
26208 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26209 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26212 /* "csamtools.pyx":2867
26213 * # recover. Thus redirect output to file with -o option.
26214 * if method == "view":
26215 * if "-o" in args: raise ValueError("option -o is forbidden in samtools view") # <<<<<<<<<<<<<<
26216 * args = ( "-o", stdout_f ) + args
26219 __pyx_t_5 = ((PySequence_Contains(__pyx_v_args, ((PyObject *)__pyx_kp_s_163)))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26221 __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_165), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26222 __Pyx_GOTREF(__pyx_t_4);
26223 __Pyx_Raise(__pyx_t_4, 0, 0);
26224 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26225 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26230 /* "csamtools.pyx":2868
26231 * if method == "view":
26232 * if "-o" in args: raise ValueError("option -o is forbidden in samtools view")
26233 * args = ( "-o", stdout_f ) + args # <<<<<<<<<<<<<<
26235 * # do the function call to samtools
26237 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26238 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
26239 __Pyx_INCREF(((PyObject *)__pyx_kp_s_163));
26240 PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_163));
26241 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_163));
26242 __Pyx_INCREF(__pyx_v_stdout_f);
26243 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_stdout_f);
26244 __Pyx_GIVEREF(__pyx_v_stdout_f);
26245 __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_t_4), __pyx_v_args); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26246 __Pyx_GOTREF(__pyx_t_3);
26247 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
26248 __Pyx_DECREF(__pyx_v_args);
26249 __pyx_v_args = __pyx_t_3;
26258 /* "csamtools.pyx":2874
26259 * cdef int i, n, retval
26261 * n = len(args) # <<<<<<<<<<<<<<
26262 * # allocate two more for first (dummy) argument (contains command)
26263 * cargs = <char**>calloc( n+2, sizeof( char *) )
26265 __pyx_t_7 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26266 __pyx_v_n = __pyx_t_7;
26268 /* "csamtools.pyx":2876
26270 * # allocate two more for first (dummy) argument (contains command)
26271 * cargs = <char**>calloc( n+2, sizeof( char *) ) # <<<<<<<<<<<<<<
26272 * cargs[0] = "samtools"
26273 * cargs[1] = method
26275 __pyx_v_cargs = ((char **)calloc((__pyx_v_n + 2), (sizeof(char *))));
26277 /* "csamtools.pyx":2877
26278 * # allocate two more for first (dummy) argument (contains command)
26279 * cargs = <char**>calloc( n+2, sizeof( char *) )
26280 * cargs[0] = "samtools" # <<<<<<<<<<<<<<
26281 * cargs[1] = method
26282 * for i from 0 <= i < n: cargs[i+2] = args[i]
26284 (__pyx_v_cargs[0]) = __pyx_k__samtools;
26286 /* "csamtools.pyx":2878
26287 * cargs = <char**>calloc( n+2, sizeof( char *) )
26288 * cargs[0] = "samtools"
26289 * cargs[1] = method # <<<<<<<<<<<<<<
26290 * for i from 0 <= i < n: cargs[i+2] = args[i]
26293 __pyx_t_8 = PyBytes_AsString(__pyx_v_method); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26294 (__pyx_v_cargs[1]) = __pyx_t_8;
26296 /* "csamtools.pyx":2879
26297 * cargs[0] = "samtools"
26298 * cargs[1] = method
26299 * for i from 0 <= i < n: cargs[i+2] = args[i] # <<<<<<<<<<<<<<
26301 * retval = pysam_dispatch(n+2, cargs)
26303 __pyx_t_9 = __pyx_v_n;
26304 for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) {
26305 __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 = 2879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26306 __Pyx_GOTREF(__pyx_t_3);
26307 __pyx_t_8 = PyBytes_AsString(__pyx_t_3); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26308 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26309 (__pyx_v_cargs[(__pyx_v_i + 2)]) = __pyx_t_8;
26312 /* "csamtools.pyx":2881
26313 * for i from 0 <= i < n: cargs[i+2] = args[i]
26315 * retval = pysam_dispatch(n+2, cargs) # <<<<<<<<<<<<<<
26319 __pyx_v_retval = pysam_dispatch((__pyx_v_n + 2), __pyx_v_cargs);
26321 /* "csamtools.pyx":2882
26323 * retval = pysam_dispatch(n+2, cargs)
26324 * free( cargs ) # <<<<<<<<<<<<<<
26326 * # restore stdout/stderr. This will also flush, so
26328 free(__pyx_v_cargs);
26330 /* "csamtools.pyx":2886
26331 * # restore stdout/stderr. This will also flush, so
26332 * # needs to be before reading back the file contents
26333 * if catch_stdout: # <<<<<<<<<<<<<<
26334 * stdout_save.restore()
26335 * out_stdout = open( stdout_f, "r").readlines()
26337 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stdout); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26340 /* "csamtools.pyx":2887
26341 * # needs to be before reading back the file contents
26343 * stdout_save.restore() # <<<<<<<<<<<<<<
26344 * out_stdout = open( stdout_f, "r").readlines()
26345 * os.remove( stdout_f )
26347 __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 = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26348 __Pyx_GOTREF(__pyx_t_3);
26349 __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 = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26350 __Pyx_GOTREF(__pyx_t_4);
26351 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26352 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26354 /* "csamtools.pyx":2888
26356 * stdout_save.restore()
26357 * out_stdout = open( stdout_f, "r").readlines() # <<<<<<<<<<<<<<
26358 * os.remove( stdout_f )
26361 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26362 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
26363 __Pyx_INCREF(__pyx_v_stdout_f);
26364 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_stdout_f);
26365 __Pyx_GIVEREF(__pyx_v_stdout_f);
26366 __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
26367 PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__r));
26368 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
26369 __pyx_t_3 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26370 __Pyx_GOTREF(__pyx_t_3);
26371 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
26372 __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__readlines); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26373 __Pyx_GOTREF(__pyx_t_4);
26374 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26375 __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 = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26376 __Pyx_GOTREF(__pyx_t_3);
26377 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26378 __Pyx_DECREF(__pyx_v_out_stdout);
26379 __pyx_v_out_stdout = __pyx_t_3;
26382 /* "csamtools.pyx":2889
26383 * stdout_save.restore()
26384 * out_stdout = open( stdout_f, "r").readlines()
26385 * os.remove( stdout_f ) # <<<<<<<<<<<<<<
26389 __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26390 __Pyx_GOTREF(__pyx_t_3);
26391 __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__remove); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26392 __Pyx_GOTREF(__pyx_t_4);
26393 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26394 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26395 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
26396 __Pyx_INCREF(__pyx_v_stdout_f);
26397 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_stdout_f);
26398 __Pyx_GIVEREF(__pyx_v_stdout_f);
26399 __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26400 __Pyx_GOTREF(__pyx_t_1);
26401 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26402 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
26403 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26408 /* "csamtools.pyx":2891
26409 * os.remove( stdout_f )
26411 * out_stdout = [] # <<<<<<<<<<<<<<
26415 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26416 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
26417 __Pyx_DECREF(__pyx_v_out_stdout);
26418 __pyx_v_out_stdout = ((PyObject *)__pyx_t_1);
26423 /* "csamtools.pyx":2893
26426 * if catch_stderr: # <<<<<<<<<<<<<<
26427 * stderr_save.restore()
26428 * out_stderr = open( stderr_f, "r").readlines()
26430 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stderr); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26433 /* "csamtools.pyx":2894
26436 * stderr_save.restore() # <<<<<<<<<<<<<<
26437 * out_stderr = open( stderr_f, "r").readlines()
26438 * os.remove( stderr_f )
26440 __pyx_t_1 = PyObject_GetAttr(__pyx_v_stderr_save, __pyx_n_s__restore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26441 __Pyx_GOTREF(__pyx_t_1);
26442 __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 = 2894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26443 __Pyx_GOTREF(__pyx_t_3);
26444 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26445 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26447 /* "csamtools.pyx":2895
26449 * stderr_save.restore()
26450 * out_stderr = open( stderr_f, "r").readlines() # <<<<<<<<<<<<<<
26451 * os.remove( stderr_f )
26454 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26455 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
26456 __Pyx_INCREF(__pyx_v_stderr_f);
26457 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_stderr_f);
26458 __Pyx_GIVEREF(__pyx_v_stderr_f);
26459 __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
26460 PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__r));
26461 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
26462 __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26463 __Pyx_GOTREF(__pyx_t_1);
26464 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
26465 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__readlines); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26466 __Pyx_GOTREF(__pyx_t_3);
26467 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26468 __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 = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26469 __Pyx_GOTREF(__pyx_t_1);
26470 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26471 __Pyx_DECREF(__pyx_v_out_stderr);
26472 __pyx_v_out_stderr = __pyx_t_1;
26475 /* "csamtools.pyx":2896
26476 * stderr_save.restore()
26477 * out_stderr = open( stderr_f, "r").readlines()
26478 * os.remove( stderr_f ) # <<<<<<<<<<<<<<
26482 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26483 __Pyx_GOTREF(__pyx_t_1);
26484 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__remove); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26485 __Pyx_GOTREF(__pyx_t_3);
26486 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26487 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26488 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
26489 __Pyx_INCREF(__pyx_v_stderr_f);
26490 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_stderr_f);
26491 __Pyx_GIVEREF(__pyx_v_stderr_f);
26492 __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26493 __Pyx_GOTREF(__pyx_t_4);
26494 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26495 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
26496 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26501 /* "csamtools.pyx":2898
26502 * os.remove( stderr_f )
26504 * out_stderr = [] # <<<<<<<<<<<<<<
26506 * return retval, out_stderr, out_stdout
26508 __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26509 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
26510 __Pyx_DECREF(__pyx_v_out_stderr);
26511 __pyx_v_out_stderr = ((PyObject *)__pyx_t_4);
26516 /* "csamtools.pyx":2900
26519 * return retval, out_stderr, out_stdout # <<<<<<<<<<<<<<
26521 * cdef class SNPCall:
26523 __Pyx_XDECREF(__pyx_r);
26524 __pyx_t_4 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26525 __Pyx_GOTREF(__pyx_t_4);
26526 __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26527 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
26528 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
26529 __Pyx_GIVEREF(__pyx_t_4);
26530 __Pyx_INCREF(__pyx_v_out_stderr);
26531 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_out_stderr);
26532 __Pyx_GIVEREF(__pyx_v_out_stderr);
26533 __Pyx_INCREF(__pyx_v_out_stdout);
26534 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_out_stdout);
26535 __Pyx_GIVEREF(__pyx_v_out_stdout);
26537 __pyx_r = ((PyObject *)__pyx_t_1);
26541 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26544 __Pyx_XDECREF(__pyx_t_1);
26545 __Pyx_XDECREF(__pyx_t_3);
26546 __Pyx_XDECREF(__pyx_t_4);
26547 __Pyx_XDECREF(__pyx_t_6);
26548 __Pyx_AddTraceback("csamtools._samtools_dispatch");
26551 __Pyx_DECREF(__pyx_v_stderr_h);
26552 __Pyx_DECREF(__pyx_v_stderr_f);
26553 __Pyx_DECREF(__pyx_v_stderr_save);
26554 __Pyx_DECREF(__pyx_v_stdout_h);
26555 __Pyx_DECREF(__pyx_v_stdout_f);
26556 __Pyx_DECREF(__pyx_v_stdout_save);
26557 __Pyx_DECREF(__pyx_v_out_stdout);
26558 __Pyx_DECREF(__pyx_v_out_stderr);
26559 __Pyx_DECREF(__pyx_v_args);
26560 __Pyx_XGIVEREF(__pyx_r);
26561 __Pyx_TraceReturn(__pyx_r);
26562 __Pyx_RefNannyFinishContext();
26566 /* "csamtools.pyx":2915
26568 * '''the chromosome ID as is defined in the header'''
26569 * def __get__(self): # <<<<<<<<<<<<<<
26574 static PyObject *__pyx_pf_9csamtools_7SNPCall_3tid___get__(PyObject *__pyx_v_self); /*proto*/
26575 static PyObject *__pyx_pf_9csamtools_7SNPCall_3tid___get__(PyObject *__pyx_v_self) {
26576 PyObject *__pyx_r = NULL;
26577 PyObject *__pyx_t_1 = NULL;
26578 __Pyx_TraceDeclarations
26579 __Pyx_RefNannySetupContext("__get__");
26580 __Pyx_TraceCall("__get__", __pyx_f[0], 2915);
26582 /* "csamtools.pyx":2916
26583 * '''the chromosome ID as is defined in the header'''
26584 * def __get__(self):
26585 * return self._tid # <<<<<<<<<<<<<<
26589 __Pyx_XDECREF(__pyx_r);
26590 __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26591 __Pyx_GOTREF(__pyx_t_1);
26592 __pyx_r = __pyx_t_1;
26596 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26599 __Pyx_XDECREF(__pyx_t_1);
26600 __Pyx_AddTraceback("csamtools.SNPCall.tid.__get__");
26603 __Pyx_XGIVEREF(__pyx_r);
26604 __Pyx_TraceReturn(__pyx_r);
26605 __Pyx_RefNannyFinishContext();
26609 /* "csamtools.pyx":2920
26611 * '''nucleotide position of SNP.'''
26612 * def __get__(self): return self._pos # <<<<<<<<<<<<<<
26614 * property reference_base:
26617 static PyObject *__pyx_pf_9csamtools_7SNPCall_3pos___get__(PyObject *__pyx_v_self); /*proto*/
26618 static PyObject *__pyx_pf_9csamtools_7SNPCall_3pos___get__(PyObject *__pyx_v_self) {
26619 PyObject *__pyx_r = NULL;
26620 PyObject *__pyx_t_1 = NULL;
26621 __Pyx_TraceDeclarations
26622 __Pyx_RefNannySetupContext("__get__");
26623 __Pyx_TraceCall("__get__", __pyx_f[0], 2920);
26624 __Pyx_XDECREF(__pyx_r);
26625 __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26626 __Pyx_GOTREF(__pyx_t_1);
26627 __pyx_r = __pyx_t_1;
26631 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26634 __Pyx_XDECREF(__pyx_t_1);
26635 __Pyx_AddTraceback("csamtools.SNPCall.pos.__get__");
26638 __Pyx_XGIVEREF(__pyx_r);
26639 __Pyx_TraceReturn(__pyx_r);
26640 __Pyx_RefNannyFinishContext();
26644 /* "csamtools.pyx":2924
26645 * property reference_base:
26646 * '''reference base at pos. ``N`` if no reference sequence supplied.'''
26647 * def __get__(self): return PyString_FromStringAndSize( &self._reference_base, 1 ) # <<<<<<<<<<<<<<
26649 * property genotype:
26652 static PyObject *__pyx_pf_9csamtools_7SNPCall_14reference_base___get__(PyObject *__pyx_v_self); /*proto*/
26653 static PyObject *__pyx_pf_9csamtools_7SNPCall_14reference_base___get__(PyObject *__pyx_v_self) {
26654 PyObject *__pyx_r = NULL;
26655 PyObject *__pyx_t_1 = NULL;
26656 __Pyx_TraceDeclarations
26657 __Pyx_RefNannySetupContext("__get__");
26658 __Pyx_TraceCall("__get__", __pyx_f[0], 2924);
26659 __Pyx_XDECREF(__pyx_r);
26660 __pyx_t_1 = PyString_FromStringAndSize((&((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_reference_base), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26661 __Pyx_GOTREF(__pyx_t_1);
26662 __pyx_r = __pyx_t_1;
26666 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26669 __Pyx_XDECREF(__pyx_t_1);
26670 __Pyx_AddTraceback("csamtools.SNPCall.reference_base.__get__");
26673 __Pyx_XGIVEREF(__pyx_r);
26674 __Pyx_TraceReturn(__pyx_r);
26675 __Pyx_RefNannyFinishContext();
26679 /* "csamtools.pyx":2928
26680 * property genotype:
26681 * '''the genotype called.'''
26682 * def __get__(self): return PyString_FromStringAndSize( &self._genotype, 1 ) # <<<<<<<<<<<<<<
26684 * property consensus_quality:
26687 static PyObject *__pyx_pf_9csamtools_7SNPCall_8genotype___get__(PyObject *__pyx_v_self); /*proto*/
26688 static PyObject *__pyx_pf_9csamtools_7SNPCall_8genotype___get__(PyObject *__pyx_v_self) {
26689 PyObject *__pyx_r = NULL;
26690 PyObject *__pyx_t_1 = NULL;
26691 __Pyx_TraceDeclarations
26692 __Pyx_RefNannySetupContext("__get__");
26693 __Pyx_TraceCall("__get__", __pyx_f[0], 2928);
26694 __Pyx_XDECREF(__pyx_r);
26695 __pyx_t_1 = PyString_FromStringAndSize((&((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_genotype), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26696 __Pyx_GOTREF(__pyx_t_1);
26697 __pyx_r = __pyx_t_1;
26701 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26704 __Pyx_XDECREF(__pyx_t_1);
26705 __Pyx_AddTraceback("csamtools.SNPCall.genotype.__get__");
26708 __Pyx_XGIVEREF(__pyx_r);
26709 __Pyx_TraceReturn(__pyx_r);
26710 __Pyx_RefNannyFinishContext();
26714 /* "csamtools.pyx":2932
26715 * property consensus_quality:
26716 * '''the genotype quality (Phred-scaled).'''
26717 * def __get__(self): return self._consensus_quality # <<<<<<<<<<<<<<
26719 * property snp_quality:
26722 static PyObject *__pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(PyObject *__pyx_v_self); /*proto*/
26723 static PyObject *__pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(PyObject *__pyx_v_self) {
26724 PyObject *__pyx_r = NULL;
26725 PyObject *__pyx_t_1 = NULL;
26726 __Pyx_TraceDeclarations
26727 __Pyx_RefNannySetupContext("__get__");
26728 __Pyx_TraceCall("__get__", __pyx_f[0], 2932);
26729 __Pyx_XDECREF(__pyx_r);
26730 __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_consensus_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26731 __Pyx_GOTREF(__pyx_t_1);
26732 __pyx_r = __pyx_t_1;
26736 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26739 __Pyx_XDECREF(__pyx_t_1);
26740 __Pyx_AddTraceback("csamtools.SNPCall.consensus_quality.__get__");
26743 __Pyx_XGIVEREF(__pyx_r);
26744 __Pyx_TraceReturn(__pyx_r);
26745 __Pyx_RefNannyFinishContext();
26749 /* "csamtools.pyx":2936
26750 * property snp_quality:
26751 * '''the snp quality (Phred scaled) - probability of consensus being identical to reference sequence.'''
26752 * def __get__(self): return self._snp_quality # <<<<<<<<<<<<<<
26754 * property mapping_quality:
26757 static PyObject *__pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(PyObject *__pyx_v_self); /*proto*/
26758 static PyObject *__pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(PyObject *__pyx_v_self) {
26759 PyObject *__pyx_r = NULL;
26760 PyObject *__pyx_t_1 = NULL;
26761 __Pyx_TraceDeclarations
26762 __Pyx_RefNannySetupContext("__get__");
26763 __Pyx_TraceCall("__get__", __pyx_f[0], 2936);
26764 __Pyx_XDECREF(__pyx_r);
26765 __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_snp_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26766 __Pyx_GOTREF(__pyx_t_1);
26767 __pyx_r = __pyx_t_1;
26771 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26774 __Pyx_XDECREF(__pyx_t_1);
26775 __Pyx_AddTraceback("csamtools.SNPCall.snp_quality.__get__");
26778 __Pyx_XGIVEREF(__pyx_r);
26779 __Pyx_TraceReturn(__pyx_r);
26780 __Pyx_RefNannyFinishContext();
26784 /* "csamtools.pyx":2940
26785 * property mapping_quality:
26786 * '''the root mean square (rms) of the mapping quality of all reads involved in the call.'''
26787 * def __get__(self): return self._rms_mapping_quality # <<<<<<<<<<<<<<
26789 * property coverage:
26792 static PyObject *__pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(PyObject *__pyx_v_self); /*proto*/
26793 static PyObject *__pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(PyObject *__pyx_v_self) {
26794 PyObject *__pyx_r = NULL;
26795 PyObject *__pyx_t_1 = NULL;
26796 __Pyx_TraceDeclarations
26797 __Pyx_RefNannySetupContext("__get__");
26798 __Pyx_TraceCall("__get__", __pyx_f[0], 2940);
26799 __Pyx_XDECREF(__pyx_r);
26800 __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_rms_mapping_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26801 __Pyx_GOTREF(__pyx_t_1);
26802 __pyx_r = __pyx_t_1;
26806 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26809 __Pyx_XDECREF(__pyx_t_1);
26810 __Pyx_AddTraceback("csamtools.SNPCall.mapping_quality.__get__");
26813 __Pyx_XGIVEREF(__pyx_r);
26814 __Pyx_TraceReturn(__pyx_r);
26815 __Pyx_RefNannyFinishContext();
26819 /* "csamtools.pyx":2944
26820 * property coverage:
26821 * '''coverage or read depth - the number of reads involved in the call.'''
26822 * def __get__(self): return self._coverage # <<<<<<<<<<<<<<
26824 * def __str__(self):
26827 static PyObject *__pyx_pf_9csamtools_7SNPCall_8coverage___get__(PyObject *__pyx_v_self); /*proto*/
26828 static PyObject *__pyx_pf_9csamtools_7SNPCall_8coverage___get__(PyObject *__pyx_v_self) {
26829 PyObject *__pyx_r = NULL;
26830 PyObject *__pyx_t_1 = NULL;
26831 __Pyx_TraceDeclarations
26832 __Pyx_RefNannySetupContext("__get__");
26833 __Pyx_TraceCall("__get__", __pyx_f[0], 2944);
26834 __Pyx_XDECREF(__pyx_r);
26835 __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_coverage); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26836 __Pyx_GOTREF(__pyx_t_1);
26837 __pyx_r = __pyx_t_1;
26841 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26844 __Pyx_XDECREF(__pyx_t_1);
26845 __Pyx_AddTraceback("csamtools.SNPCall.coverage.__get__");
26848 __Pyx_XGIVEREF(__pyx_r);
26849 __Pyx_TraceReturn(__pyx_r);
26850 __Pyx_RefNannyFinishContext();
26854 /* "csamtools.pyx":2946
26855 * def __get__(self): return self._coverage
26857 * def __str__(self): # <<<<<<<<<<<<<<
26859 * return "\t".join( map(str, (
26862 static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(PyObject *__pyx_v_self); /*proto*/
26863 static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(PyObject *__pyx_v_self) {
26864 PyObject *__pyx_r = NULL;
26865 PyObject *__pyx_t_1 = NULL;
26866 PyObject *__pyx_t_2 = NULL;
26867 PyObject *__pyx_t_3 = NULL;
26868 PyObject *__pyx_t_4 = NULL;
26869 PyObject *__pyx_t_5 = NULL;
26870 PyObject *__pyx_t_6 = NULL;
26871 PyObject *__pyx_t_7 = NULL;
26872 PyObject *__pyx_t_8 = NULL;
26873 PyObject *__pyx_t_9 = NULL;
26874 PyObject *__pyx_t_10 = NULL;
26875 __Pyx_TraceDeclarations
26876 __Pyx_RefNannySetupContext("__str__");
26877 __Pyx_TraceCall("__str__", __pyx_f[0], 2946);
26879 /* "csamtools.pyx":2948
26880 * def __str__(self):
26882 * return "\t".join( map(str, ( # <<<<<<<<<<<<<<
26886 __Pyx_XDECREF(__pyx_r);
26887 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26888 __Pyx_GOTREF(__pyx_t_1);
26890 /* "csamtools.pyx":2949
26892 * return "\t".join( map(str, (
26893 * self.tid, # <<<<<<<<<<<<<<
26895 * self.reference_base,
26897 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26898 __Pyx_GOTREF(__pyx_t_2);
26900 /* "csamtools.pyx":2950
26901 * return "\t".join( map(str, (
26903 * self.pos, # <<<<<<<<<<<<<<
26904 * self.reference_base,
26907 __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26908 __Pyx_GOTREF(__pyx_t_3);
26910 /* "csamtools.pyx":2951
26913 * self.reference_base, # <<<<<<<<<<<<<<
26915 * self.consensus_quality,
26917 __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__reference_base); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26918 __Pyx_GOTREF(__pyx_t_4);
26920 /* "csamtools.pyx":2952
26922 * self.reference_base,
26923 * self.genotype, # <<<<<<<<<<<<<<
26924 * self.consensus_quality,
26925 * self.snp_quality,
26927 __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__genotype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26928 __Pyx_GOTREF(__pyx_t_5);
26930 /* "csamtools.pyx":2953
26931 * self.reference_base,
26933 * self.consensus_quality, # <<<<<<<<<<<<<<
26934 * self.snp_quality,
26935 * self.mapping_quality,
26937 __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__consensus_quality); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26938 __Pyx_GOTREF(__pyx_t_6);
26940 /* "csamtools.pyx":2954
26942 * self.consensus_quality,
26943 * self.snp_quality, # <<<<<<<<<<<<<<
26944 * self.mapping_quality,
26945 * self.coverage ) ) )
26947 __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__snp_quality); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26948 __Pyx_GOTREF(__pyx_t_7);
26950 /* "csamtools.pyx":2955
26951 * self.consensus_quality,
26952 * self.snp_quality,
26953 * self.mapping_quality, # <<<<<<<<<<<<<<
26954 * self.coverage ) ) )
26957 __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mapping_quality); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26958 __Pyx_GOTREF(__pyx_t_8);
26960 /* "csamtools.pyx":2956
26961 * self.snp_quality,
26962 * self.mapping_quality,
26963 * self.coverage ) ) ) # <<<<<<<<<<<<<<
26967 __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__coverage); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26968 __Pyx_GOTREF(__pyx_t_9);
26969 __pyx_t_10 = PyTuple_New(8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26970 __Pyx_GOTREF(((PyObject *)__pyx_t_10));
26971 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2);
26972 __Pyx_GIVEREF(__pyx_t_2);
26973 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_3);
26974 __Pyx_GIVEREF(__pyx_t_3);
26975 PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_4);
26976 __Pyx_GIVEREF(__pyx_t_4);
26977 PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_5);
26978 __Pyx_GIVEREF(__pyx_t_5);
26979 PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_6);
26980 __Pyx_GIVEREF(__pyx_t_6);
26981 PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_7);
26982 __Pyx_GIVEREF(__pyx_t_7);
26983 PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_t_8);
26984 __Pyx_GIVEREF(__pyx_t_8);
26985 PyTuple_SET_ITEM(__pyx_t_10, 7, __pyx_t_9);
26986 __Pyx_GIVEREF(__pyx_t_9);
26995 __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
26996 __Pyx_GOTREF(((PyObject *)__pyx_t_9));
26997 __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
26998 PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
26999 __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
27000 PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_t_10));
27001 __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
27003 __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 = 2948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27004 __Pyx_GOTREF(__pyx_t_10);
27005 __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
27006 __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27007 __Pyx_GOTREF(((PyObject *)__pyx_t_9));
27008 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10);
27009 __Pyx_GIVEREF(__pyx_t_10);
27011 __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 = 2948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27012 __Pyx_GOTREF(__pyx_t_10);
27013 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27014 __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
27015 __pyx_r = __pyx_t_10;
27019 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
27022 __Pyx_XDECREF(__pyx_t_1);
27023 __Pyx_XDECREF(__pyx_t_2);
27024 __Pyx_XDECREF(__pyx_t_3);
27025 __Pyx_XDECREF(__pyx_t_4);
27026 __Pyx_XDECREF(__pyx_t_5);
27027 __Pyx_XDECREF(__pyx_t_6);
27028 __Pyx_XDECREF(__pyx_t_7);
27029 __Pyx_XDECREF(__pyx_t_8);
27030 __Pyx_XDECREF(__pyx_t_9);
27031 __Pyx_XDECREF(__pyx_t_10);
27032 __Pyx_AddTraceback("csamtools.SNPCall.__str__");
27035 __Pyx_XGIVEREF(__pyx_r);
27036 __Pyx_TraceReturn(__pyx_r);
27037 __Pyx_RefNannyFinishContext();
27041 /* "csamtools.pyx":3472
27042 * cdef int owns_samfile
27044 * def __init__(self, Samfile samfile, int reopen = True ): # <<<<<<<<<<<<<<
27045 * self.samfile = samfile
27049 static int __pyx_pf_9csamtools_12IndexedReads___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
27050 static int __pyx_pf_9csamtools_12IndexedReads___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
27051 struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0;
27052 int __pyx_v_reopen;
27053 PyObject *__pyx_v_mode;
27054 PyObject *__pyx_v_store;
27056 PyObject *__pyx_t_1 = NULL;
27057 PyObject *__pyx_t_2 = NULL;
27059 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__reopen,0};
27060 __Pyx_TraceDeclarations
27061 __Pyx_RefNannySetupContext("__init__");
27062 __Pyx_TraceCall("__init__", __pyx_f[0], 3472);
27063 if (unlikely(__pyx_kwds)) {
27064 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
27065 PyObject* values[2] = {0,0};
27066 switch (PyTuple_GET_SIZE(__pyx_args)) {
27067 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
27068 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
27070 default: goto __pyx_L5_argtuple_error;
27072 switch (PyTuple_GET_SIZE(__pyx_args)) {
27074 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
27075 if (likely(values[0])) kw_args--;
27076 else goto __pyx_L5_argtuple_error;
27079 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reopen);
27080 if (value) { values[1] = value; kw_args--; }
27083 if (unlikely(kw_args > 0)) {
27084 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3472; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
27086 __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]);
27088 __pyx_v_reopen = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3472; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
27090 __pyx_v_reopen = ((int)1);
27093 __pyx_v_reopen = ((int)1);
27094 switch (PyTuple_GET_SIZE(__pyx_args)) {
27095 case 2: __pyx_v_reopen = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3472; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
27096 case 1: __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0));
27098 default: goto __pyx_L5_argtuple_error;
27101 goto __pyx_L4_argument_unpacking_done;
27102 __pyx_L5_argtuple_error:;
27103 __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3472; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
27105 __Pyx_AddTraceback("csamtools.IndexedReads.__init__");
27106 __Pyx_RefNannyFinishContext();
27108 __pyx_L4_argument_unpacking_done:;
27109 __pyx_v_mode = Py_None; __Pyx_INCREF(Py_None);
27110 __pyx_v_store = Py_None; __Pyx_INCREF(Py_None);
27111 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27113 /* "csamtools.pyx":3473
27115 * def __init__(self, Samfile samfile, int reopen = True ):
27116 * self.samfile = samfile # <<<<<<<<<<<<<<
27118 * if samfile.isbam: mode = "rb"
27120 __Pyx_INCREF(((PyObject *)__pyx_v_samfile));
27121 __Pyx_GIVEREF(((PyObject *)__pyx_v_samfile));
27122 __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile);
27123 __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile));
27124 ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile = __pyx_v_samfile;
27126 /* "csamtools.pyx":3475
27127 * self.samfile = samfile
27129 * if samfile.isbam: mode = "rb" # <<<<<<<<<<<<<<
27133 if (__pyx_v_samfile->isbam) {
27134 __Pyx_INCREF(((PyObject *)__pyx_n_s__rb));
27135 __Pyx_DECREF(__pyx_v_mode);
27136 __pyx_v_mode = ((PyObject *)__pyx_n_s__rb);
27141 /* "csamtools.pyx":3476
27143 * if samfile.isbam: mode = "rb"
27144 * else: mode = "r" # <<<<<<<<<<<<<<
27146 * # reopen the file - note that this makes the iterator
27148 __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
27149 __Pyx_DECREF(__pyx_v_mode);
27150 __pyx_v_mode = ((PyObject *)__pyx_n_s__r);
27154 /* "csamtools.pyx":3480
27155 * # reopen the file - note that this makes the iterator
27156 * # slow and causes pileup to slow down significantly.
27157 * if reopen: # <<<<<<<<<<<<<<
27158 * store = StderrStore()
27159 * self.fp = samopen( samfile._filename, mode, NULL )
27161 if (__pyx_v_reopen) {
27163 /* "csamtools.pyx":3481
27164 * # slow and causes pileup to slow down significantly.
27166 * store = StderrStore() # <<<<<<<<<<<<<<
27167 * self.fp = samopen( samfile._filename, mode, NULL )
27170 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27171 __Pyx_GOTREF(__pyx_t_1);
27172 __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 = 3481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27173 __Pyx_GOTREF(__pyx_t_2);
27174 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27175 __Pyx_DECREF(__pyx_v_store);
27176 __pyx_v_store = __pyx_t_2;
27179 /* "csamtools.pyx":3482
27181 * store = StderrStore()
27182 * self.fp = samopen( samfile._filename, mode, NULL ) # <<<<<<<<<<<<<<
27184 * assert self.fp != NULL
27186 __pyx_t_3 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27187 ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_3, NULL);
27189 /* "csamtools.pyx":3483
27190 * store = StderrStore()
27191 * self.fp = samopen( samfile._filename, mode, NULL )
27192 * store.release() # <<<<<<<<<<<<<<
27193 * assert self.fp != NULL
27194 * self.owns_samfile = True
27196 __pyx_t_2 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27197 __Pyx_GOTREF(__pyx_t_2);
27198 __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 = 3483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27199 __Pyx_GOTREF(__pyx_t_1);
27200 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27201 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27203 /* "csamtools.pyx":3484
27204 * self.fp = samopen( samfile._filename, mode, NULL )
27206 * assert self.fp != NULL # <<<<<<<<<<<<<<
27207 * self.owns_samfile = True
27210 #ifndef CYTHON_WITHOUT_ASSERTIONS
27211 if (unlikely(!(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp != NULL))) {
27212 PyErr_SetNone(PyExc_AssertionError);
27213 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27217 /* "csamtools.pyx":3485
27219 * assert self.fp != NULL
27220 * self.owns_samfile = True # <<<<<<<<<<<<<<
27222 * self.fp = samfile.samfile
27224 ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->owns_samfile = 1;
27229 /* "csamtools.pyx":3487
27230 * self.owns_samfile = True
27232 * self.fp = samfile.samfile # <<<<<<<<<<<<<<
27233 * self.owns_samfile = False
27236 ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp = __pyx_v_samfile->samfile;
27238 /* "csamtools.pyx":3488
27240 * self.fp = samfile.samfile
27241 * self.owns_samfile = False # <<<<<<<<<<<<<<
27243 * assert samfile.isbam, "can only IndexReads on bam files"
27245 ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->owns_samfile = 0;
27249 /* "csamtools.pyx":3490
27250 * self.owns_samfile = False
27252 * assert samfile.isbam, "can only IndexReads on bam files" # <<<<<<<<<<<<<<
27254 * def build( self ):
27256 #ifndef CYTHON_WITHOUT_ASSERTIONS
27257 if (unlikely(!__pyx_v_samfile->isbam)) {
27258 PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_167));
27259 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27266 __Pyx_XDECREF(__pyx_t_1);
27267 __Pyx_XDECREF(__pyx_t_2);
27268 __Pyx_AddTraceback("csamtools.IndexedReads.__init__");
27271 __Pyx_DECREF(__pyx_v_mode);
27272 __Pyx_DECREF(__pyx_v_store);
27273 __Pyx_TraceReturn(Py_None);
27274 __Pyx_RefNannyFinishContext();
27278 /* "csamtools.pyx":3492
27279 * assert samfile.isbam, "can only IndexReads on bam files"
27281 * def build( self ): # <<<<<<<<<<<<<<
27282 * '''build index.'''
27286 static PyObject *__pyx_pf_9csamtools_12IndexedReads_1build(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
27287 static char __pyx_doc_9csamtools_12IndexedReads_1build[] = "IndexedReads.build(self)\nbuild index.";
27288 static PyObject *__pyx_pf_9csamtools_12IndexedReads_1build(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
27291 uint64_t __pyx_v_pos;
27292 char *__pyx_v_qname;
27293 PyObject *__pyx_r = NULL;
27294 PyObject *__pyx_t_1 = NULL;
27295 PyObject *__pyx_t_2 = NULL;
27296 PyObject *__pyx_t_3 = NULL;
27298 __Pyx_TraceDeclarations
27299 __Pyx_RefNannySetupContext("build");
27300 __Pyx_TraceCall("build", __pyx_f[0], 3492);
27302 /* "csamtools.pyx":3495
27303 * '''build index.'''
27305 * self.index = collections.defaultdict( list ) # <<<<<<<<<<<<<<
27307 * # this method will start indexing from the current file position
27309 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__collections); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27310 __Pyx_GOTREF(__pyx_t_1);
27311 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27312 __Pyx_GOTREF(__pyx_t_2);
27313 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27314 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27315 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
27316 __Pyx_INCREF(((PyObject *)((PyObject*)(&PyList_Type))));
27317 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)(&PyList_Type))));
27318 __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyList_Type))));
27319 __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 = 3495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27320 __Pyx_GOTREF(__pyx_t_3);
27321 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27322 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
27323 __Pyx_GIVEREF(__pyx_t_3);
27324 __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index);
27325 __Pyx_DECREF(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index);
27326 ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index = __pyx_t_3;
27329 /* "csamtools.pyx":3499
27330 * # this method will start indexing from the current file position
27332 * cdef int ret = 1 # <<<<<<<<<<<<<<
27333 * cdef bam1_t * b = <bam1_t*> calloc(1, sizeof( bam1_t) )
27338 /* "csamtools.pyx":3500
27341 * cdef bam1_t * b = <bam1_t*> calloc(1, sizeof( bam1_t) ) # <<<<<<<<<<<<<<
27343 * cdef uint64_t pos
27345 __pyx_v_b = ((bam1_t *)calloc(1, (sizeof(bam1_t))));
27347 /* "csamtools.pyx":3504
27348 * cdef uint64_t pos
27350 * while ret > 0: # <<<<<<<<<<<<<<
27351 * pos = bam_tell( self.fp.x.bam )
27352 * ret = samread( self.fp, b)
27355 __pyx_t_4 = (__pyx_v_ret > 0);
27356 if (!__pyx_t_4) break;
27358 /* "csamtools.pyx":3505
27361 * pos = bam_tell( self.fp.x.bam ) # <<<<<<<<<<<<<<
27362 * ret = samread( self.fp, b)
27365 __pyx_v_pos = bam_tell(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp->x.bam);
27367 /* "csamtools.pyx":3506
27369 * pos = bam_tell( self.fp.x.bam )
27370 * ret = samread( self.fp, b) # <<<<<<<<<<<<<<
27372 * qname = bam1_qname( b )
27374 __pyx_v_ret = samread(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp, __pyx_v_b);
27376 /* "csamtools.pyx":3507
27377 * pos = bam_tell( self.fp.x.bam )
27378 * ret = samread( self.fp, b)
27379 * if ret > 0: # <<<<<<<<<<<<<<
27380 * qname = bam1_qname( b )
27381 * self.index[qname].append( pos )
27383 __pyx_t_4 = (__pyx_v_ret > 0);
27386 /* "csamtools.pyx":3508
27387 * ret = samread( self.fp, b)
27389 * qname = bam1_qname( b ) # <<<<<<<<<<<<<<
27390 * self.index[qname].append( pos )
27393 __pyx_v_qname = bam1_qname(__pyx_v_b);
27395 /* "csamtools.pyx":3509
27397 * qname = bam1_qname( b )
27398 * self.index[qname].append( pos ) # <<<<<<<<<<<<<<
27400 * bam_destroy1( b )
27402 __pyx_t_3 = PyBytes_FromString(__pyx_v_qname); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27403 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
27404 __pyx_t_1 = PyObject_GetItem(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index, ((PyObject *)__pyx_t_3)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27405 __Pyx_GOTREF(__pyx_t_1);
27406 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
27407 __pyx_t_3 = __Pyx_PyInt_to_py_uint64_t(__pyx_v_pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27408 __Pyx_GOTREF(__pyx_t_3);
27409 __pyx_t_2 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27410 __Pyx_GOTREF(__pyx_t_2);
27411 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27412 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
27413 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27419 /* "csamtools.pyx":3511
27420 * self.index[qname].append( pos )
27422 * bam_destroy1( b ) # <<<<<<<<<<<<<<
27424 * def find( self, qname ):
27426 bam_destroy1(__pyx_v_b);
27428 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
27431 __Pyx_XDECREF(__pyx_t_1);
27432 __Pyx_XDECREF(__pyx_t_2);
27433 __Pyx_XDECREF(__pyx_t_3);
27434 __Pyx_AddTraceback("csamtools.IndexedReads.build");
27437 __Pyx_XGIVEREF(__pyx_r);
27438 __Pyx_TraceReturn(__pyx_r);
27439 __Pyx_RefNannyFinishContext();
27443 /* "csamtools.pyx":3513
27444 * bam_destroy1( b )
27446 * def find( self, qname ): # <<<<<<<<<<<<<<
27447 * if qname in self.index:
27448 * return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )
27451 static PyObject *__pyx_pf_9csamtools_12IndexedReads_2find(PyObject *__pyx_v_self, PyObject *__pyx_v_qname); /*proto*/
27452 static char __pyx_doc_9csamtools_12IndexedReads_2find[] = "IndexedReads.find(self, qname)";
27453 static PyObject *__pyx_pf_9csamtools_12IndexedReads_2find(PyObject *__pyx_v_self, PyObject *__pyx_v_qname) {
27454 PyObject *__pyx_r = NULL;
27456 PyObject *__pyx_t_2 = NULL;
27457 PyObject *__pyx_t_3 = NULL;
27458 PyObject *__pyx_t_4 = NULL;
27459 __Pyx_TraceDeclarations
27460 __Pyx_RefNannySetupContext("find");
27461 __Pyx_TraceCall("find", __pyx_f[0], 3513);
27463 /* "csamtools.pyx":3514
27465 * def find( self, qname ):
27466 * if qname in self.index: # <<<<<<<<<<<<<<
27467 * return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )
27470 __pyx_t_1 = ((PySequence_Contains(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index, __pyx_v_qname))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27473 /* "csamtools.pyx":3515
27474 * def find( self, qname ):
27475 * if qname in self.index:
27476 * return IteratorRowSelection( self.samfile, self.index[qname], reopen = False ) # <<<<<<<<<<<<<<
27478 * raise KeyError( "read %s not found" % qname )
27480 __Pyx_XDECREF(__pyx_r);
27481 __pyx_t_2 = PyObject_GetItem(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index, __pyx_v_qname); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27482 __Pyx_GOTREF(__pyx_t_2);
27483 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27484 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
27485 __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile));
27486 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile));
27487 __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile));
27488 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
27489 __Pyx_GIVEREF(__pyx_t_2);
27491 __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27492 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
27493 __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27494 __Pyx_GOTREF(__pyx_t_4);
27495 if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reopen), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27496 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
27497 __pyx_t_4 = PyEval_CallObjectWithKeywords(((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 = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27498 __Pyx_GOTREF(__pyx_t_4);
27499 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
27500 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
27501 __pyx_r = __pyx_t_4;
27508 /* "csamtools.pyx":3517
27509 * return IteratorRowSelection( self.samfile, self.index[qname], reopen = False )
27511 * raise KeyError( "read %s not found" % qname ) # <<<<<<<<<<<<<<
27513 * def __dealloc__(self):
27515 __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_168), __pyx_v_qname); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27516 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
27517 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27518 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
27519 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4));
27520 __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
27522 __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 = 3517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27523 __Pyx_GOTREF(__pyx_t_4);
27524 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
27525 __Pyx_Raise(__pyx_t_4, 0, 0);
27526 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
27527 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
27531 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
27534 __Pyx_XDECREF(__pyx_t_2);
27535 __Pyx_XDECREF(__pyx_t_3);
27536 __Pyx_XDECREF(__pyx_t_4);
27537 __Pyx_AddTraceback("csamtools.IndexedReads.find");
27540 __Pyx_XGIVEREF(__pyx_r);
27541 __Pyx_TraceReturn(__pyx_r);
27542 __Pyx_RefNannyFinishContext();
27546 /* "csamtools.pyx":3519
27547 * raise KeyError( "read %s not found" % qname )
27549 * def __dealloc__(self): # <<<<<<<<<<<<<<
27550 * if self.owns_samfile: samclose( self.fp )
27554 static void __pyx_pf_9csamtools_12IndexedReads_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
27555 static void __pyx_pf_9csamtools_12IndexedReads_3__dealloc__(PyObject *__pyx_v_self) {
27556 __Pyx_TraceDeclarations
27557 __Pyx_RefNannySetupContext("__dealloc__");
27558 __Pyx_TraceCall("__dealloc__", __pyx_f[0], 3519);
27560 /* "csamtools.pyx":3520
27562 * def __dealloc__(self):
27563 * if self.owns_samfile: samclose( self.fp ) # <<<<<<<<<<<<<<
27565 * __all__ = ["Samfile",
27567 if (((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->owns_samfile) {
27568 samclose(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp);
27573 __Pyx_TraceReturn(Py_None);
27574 __Pyx_RefNannyFinishContext();
27577 static PyObject *__pyx_tp_new_9csamtools_AlignedRead(PyTypeObject *t, PyObject *a, PyObject *k) {
27578 PyObject *o = (*t->tp_alloc)(t, 0);
27583 static void __pyx_tp_dealloc_9csamtools_AlignedRead(PyObject *o) {
27585 PyObject *etype, *eval, *etb;
27586 PyErr_Fetch(&etype, &eval, &etb);
27588 __pyx_pf_9csamtools_11AlignedRead_1__dealloc__(o);
27589 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
27591 PyErr_Restore(etype, eval, etb);
27593 (*Py_TYPE(o)->tp_free)(o);
27596 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qname(PyObject *o, void *x) {
27597 return __pyx_pf_9csamtools_11AlignedRead_5qname___get__(o);
27600 static int __pyx_setprop_9csamtools_11AlignedRead_qname(PyObject *o, PyObject *v, void *x) {
27602 return __pyx_pf_9csamtools_11AlignedRead_5qname_1__set__(o, v);
27605 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27610 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_cigar(PyObject *o, void *x) {
27611 return __pyx_pf_9csamtools_11AlignedRead_5cigar___get__(o);
27614 static int __pyx_setprop_9csamtools_11AlignedRead_cigar(PyObject *o, PyObject *v, void *x) {
27616 return __pyx_pf_9csamtools_11AlignedRead_5cigar_1__set__(o, v);
27619 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27624 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_seq(PyObject *o, void *x) {
27625 return __pyx_pf_9csamtools_11AlignedRead_3seq___get__(o);
27628 static int __pyx_setprop_9csamtools_11AlignedRead_seq(PyObject *o, PyObject *v, void *x) {
27630 return __pyx_pf_9csamtools_11AlignedRead_3seq_1__set__(o, v);
27633 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27638 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qual(PyObject *o, void *x) {
27639 return __pyx_pf_9csamtools_11AlignedRead_4qual___get__(o);
27642 static int __pyx_setprop_9csamtools_11AlignedRead_qual(PyObject *o, PyObject *v, void *x) {
27644 return __pyx_pf_9csamtools_11AlignedRead_4qual_1__set__(o, v);
27647 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27652 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_query(PyObject *o, void *x) {
27653 return __pyx_pf_9csamtools_11AlignedRead_5query___get__(o);
27656 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qqual(PyObject *o, void *x) {
27657 return __pyx_pf_9csamtools_11AlignedRead_5qqual___get__(o);
27660 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qstart(PyObject *o, void *x) {
27661 return __pyx_pf_9csamtools_11AlignedRead_6qstart___get__(o);
27664 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qend(PyObject *o, void *x) {
27665 return __pyx_pf_9csamtools_11AlignedRead_4qend___get__(o);
27668 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qlen(PyObject *o, void *x) {
27669 return __pyx_pf_9csamtools_11AlignedRead_4qlen___get__(o);
27672 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tags(PyObject *o, void *x) {
27673 return __pyx_pf_9csamtools_11AlignedRead_4tags___get__(o);
27676 static int __pyx_setprop_9csamtools_11AlignedRead_tags(PyObject *o, PyObject *v, void *x) {
27678 return __pyx_pf_9csamtools_11AlignedRead_4tags_1__set__(o, v);
27681 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27686 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_flag(PyObject *o, void *x) {
27687 return __pyx_pf_9csamtools_11AlignedRead_4flag___get__(o);
27690 static int __pyx_setprop_9csamtools_11AlignedRead_flag(PyObject *o, PyObject *v, void *x) {
27692 return __pyx_pf_9csamtools_11AlignedRead_4flag_1__set__(o, v);
27695 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27700 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rname(PyObject *o, void *x) {
27701 return __pyx_pf_9csamtools_11AlignedRead_5rname___get__(o);
27704 static int __pyx_setprop_9csamtools_11AlignedRead_rname(PyObject *o, PyObject *v, void *x) {
27706 return __pyx_pf_9csamtools_11AlignedRead_5rname_1__set__(o, v);
27709 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27714 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tid(PyObject *o, void *x) {
27715 return __pyx_pf_9csamtools_11AlignedRead_3tid___get__(o);
27718 static int __pyx_setprop_9csamtools_11AlignedRead_tid(PyObject *o, PyObject *v, void *x) {
27720 return __pyx_pf_9csamtools_11AlignedRead_3tid_1__set__(o, v);
27723 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27728 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_pos(PyObject *o, void *x) {
27729 return __pyx_pf_9csamtools_11AlignedRead_3pos___get__(o);
27732 static int __pyx_setprop_9csamtools_11AlignedRead_pos(PyObject *o, PyObject *v, void *x) {
27734 return __pyx_pf_9csamtools_11AlignedRead_3pos_1__set__(o, v);
27737 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27742 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_bin(PyObject *o, void *x) {
27743 return __pyx_pf_9csamtools_11AlignedRead_3bin___get__(o);
27746 static int __pyx_setprop_9csamtools_11AlignedRead_bin(PyObject *o, PyObject *v, void *x) {
27748 return __pyx_pf_9csamtools_11AlignedRead_3bin_1__set__(o, v);
27751 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27756 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rlen(PyObject *o, void *x) {
27757 return __pyx_pf_9csamtools_11AlignedRead_4rlen___get__(o);
27760 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_aend(PyObject *o, void *x) {
27761 return __pyx_pf_9csamtools_11AlignedRead_4aend___get__(o);
27764 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_alen(PyObject *o, void *x) {
27765 return __pyx_pf_9csamtools_11AlignedRead_4alen___get__(o);
27768 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mapq(PyObject *o, void *x) {
27769 return __pyx_pf_9csamtools_11AlignedRead_4mapq___get__(o);
27772 static int __pyx_setprop_9csamtools_11AlignedRead_mapq(PyObject *o, PyObject *v, void *x) {
27774 return __pyx_pf_9csamtools_11AlignedRead_4mapq_1__set__(o, v);
27777 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27782 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mrnm(PyObject *o, void *x) {
27783 return __pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(o);
27786 static int __pyx_setprop_9csamtools_11AlignedRead_mrnm(PyObject *o, PyObject *v, void *x) {
27788 return __pyx_pf_9csamtools_11AlignedRead_4mrnm_1__set__(o, v);
27791 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27796 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rnext(PyObject *o, void *x) {
27797 return __pyx_pf_9csamtools_11AlignedRead_5rnext___get__(o);
27800 static int __pyx_setprop_9csamtools_11AlignedRead_rnext(PyObject *o, PyObject *v, void *x) {
27802 return __pyx_pf_9csamtools_11AlignedRead_5rnext_1__set__(o, v);
27805 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27810 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mpos(PyObject *o, void *x) {
27811 return __pyx_pf_9csamtools_11AlignedRead_4mpos___get__(o);
27814 static int __pyx_setprop_9csamtools_11AlignedRead_mpos(PyObject *o, PyObject *v, void *x) {
27816 return __pyx_pf_9csamtools_11AlignedRead_4mpos_1__set__(o, v);
27819 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27824 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_pnext(PyObject *o, void *x) {
27825 return __pyx_pf_9csamtools_11AlignedRead_5pnext___get__(o);
27828 static int __pyx_setprop_9csamtools_11AlignedRead_pnext(PyObject *o, PyObject *v, void *x) {
27830 return __pyx_pf_9csamtools_11AlignedRead_5pnext_1__set__(o, v);
27833 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27838 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_isize(PyObject *o, void *x) {
27839 return __pyx_pf_9csamtools_11AlignedRead_5isize___get__(o);
27842 static int __pyx_setprop_9csamtools_11AlignedRead_isize(PyObject *o, PyObject *v, void *x) {
27844 return __pyx_pf_9csamtools_11AlignedRead_5isize_1__set__(o, v);
27847 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27852 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tlen(PyObject *o, void *x) {
27853 return __pyx_pf_9csamtools_11AlignedRead_4tlen___get__(o);
27856 static int __pyx_setprop_9csamtools_11AlignedRead_tlen(PyObject *o, PyObject *v, void *x) {
27858 return __pyx_pf_9csamtools_11AlignedRead_4tlen_1__set__(o, v);
27861 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27866 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_paired(PyObject *o, void *x) {
27867 return __pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(o);
27870 static int __pyx_setprop_9csamtools_11AlignedRead_is_paired(PyObject *o, PyObject *v, void *x) {
27872 return __pyx_pf_9csamtools_11AlignedRead_9is_paired_1__set__(o, v);
27875 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27880 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_proper_pair(PyObject *o, void *x) {
27881 return __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(o);
27884 static int __pyx_setprop_9csamtools_11AlignedRead_is_proper_pair(PyObject *o, PyObject *v, void *x) {
27886 return __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_1__set__(o, v);
27889 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27894 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_unmapped(PyObject *o, void *x) {
27895 return __pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(o);
27898 static int __pyx_setprop_9csamtools_11AlignedRead_is_unmapped(PyObject *o, PyObject *v, void *x) {
27900 return __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_1__set__(o, v);
27903 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27908 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mate_is_unmapped(PyObject *o, void *x) {
27909 return __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(o);
27912 static int __pyx_setprop_9csamtools_11AlignedRead_mate_is_unmapped(PyObject *o, PyObject *v, void *x) {
27914 return __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_1__set__(o, v);
27917 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27922 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_reverse(PyObject *o, void *x) {
27923 return __pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(o);
27926 static int __pyx_setprop_9csamtools_11AlignedRead_is_reverse(PyObject *o, PyObject *v, void *x) {
27928 return __pyx_pf_9csamtools_11AlignedRead_10is_reverse_1__set__(o, v);
27931 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27936 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mate_is_reverse(PyObject *o, void *x) {
27937 return __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(o);
27940 static int __pyx_setprop_9csamtools_11AlignedRead_mate_is_reverse(PyObject *o, PyObject *v, void *x) {
27942 return __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_1__set__(o, v);
27945 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27950 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_read1(PyObject *o, void *x) {
27951 return __pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(o);
27954 static int __pyx_setprop_9csamtools_11AlignedRead_is_read1(PyObject *o, PyObject *v, void *x) {
27956 return __pyx_pf_9csamtools_11AlignedRead_8is_read1_1__set__(o, v);
27959 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27964 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_read2(PyObject *o, void *x) {
27965 return __pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(o);
27968 static int __pyx_setprop_9csamtools_11AlignedRead_is_read2(PyObject *o, PyObject *v, void *x) {
27970 return __pyx_pf_9csamtools_11AlignedRead_8is_read2_1__set__(o, v);
27973 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27978 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_secondary(PyObject *o, void *x) {
27979 return __pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(o);
27982 static int __pyx_setprop_9csamtools_11AlignedRead_is_secondary(PyObject *o, PyObject *v, void *x) {
27984 return __pyx_pf_9csamtools_11AlignedRead_12is_secondary_1__set__(o, v);
27987 PyErr_SetString(PyExc_NotImplementedError, "__del__");
27992 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_qcfail(PyObject *o, void *x) {
27993 return __pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(o);
27996 static int __pyx_setprop_9csamtools_11AlignedRead_is_qcfail(PyObject *o, PyObject *v, void *x) {
27998 return __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_1__set__(o, v);
28001 PyErr_SetString(PyExc_NotImplementedError, "__del__");
28006 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_duplicate(PyObject *o, void *x) {
28007 return __pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(o);
28010 static int __pyx_setprop_9csamtools_11AlignedRead_is_duplicate(PyObject *o, PyObject *v, void *x) {
28012 return __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_1__set__(o, v);
28015 PyErr_SetString(PyExc_NotImplementedError, "__del__");
28020 static PyObject *__pyx_getprop_9csamtools_11AlignedRead_positions(PyObject *o, void *x) {
28021 return __pyx_pf_9csamtools_11AlignedRead_9positions___get__(o);
28024 static PyMethodDef __pyx_methods_9csamtools_AlignedRead[] = {
28025 {__Pyx_NAMESTR("compare"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_3compare, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_3compare)},
28026 {__Pyx_NAMESTR("overlap"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_5overlap, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_5overlap)},
28027 {__Pyx_NAMESTR("opt"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_6opt, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_6opt)},
28028 {__Pyx_NAMESTR("fancy_str"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_7fancy_str, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_7fancy_str)},
28032 static struct PyGetSetDef __pyx_getsets_9csamtools_AlignedRead[] = {
28033 {(char *)"qname", __pyx_getprop_9csamtools_11AlignedRead_qname, __pyx_setprop_9csamtools_11AlignedRead_qname, __Pyx_DOCSTR(__pyx_k_169), 0},
28034 {(char *)"cigar", __pyx_getprop_9csamtools_11AlignedRead_cigar, __pyx_setprop_9csamtools_11AlignedRead_cigar, __Pyx_DOCSTR(__pyx_k_170), 0},
28035 {(char *)"seq", __pyx_getprop_9csamtools_11AlignedRead_seq, __pyx_setprop_9csamtools_11AlignedRead_seq, __Pyx_DOCSTR(__pyx_k_171), 0},
28036 {(char *)"qual", __pyx_getprop_9csamtools_11AlignedRead_qual, __pyx_setprop_9csamtools_11AlignedRead_qual, __Pyx_DOCSTR(__pyx_k_172), 0},
28037 {(char *)"query", __pyx_getprop_9csamtools_11AlignedRead_query, 0, __Pyx_DOCSTR(__pyx_k_173), 0},
28038 {(char *)"qqual", __pyx_getprop_9csamtools_11AlignedRead_qqual, 0, __Pyx_DOCSTR(__pyx_k_174), 0},
28039 {(char *)"qstart", __pyx_getprop_9csamtools_11AlignedRead_qstart, 0, __Pyx_DOCSTR(__pyx_k_175), 0},
28040 {(char *)"qend", __pyx_getprop_9csamtools_11AlignedRead_qend, 0, __Pyx_DOCSTR(__pyx_k_176), 0},
28041 {(char *)"qlen", __pyx_getprop_9csamtools_11AlignedRead_qlen, 0, __Pyx_DOCSTR(__pyx_k_177), 0},
28042 {(char *)"tags", __pyx_getprop_9csamtools_11AlignedRead_tags, __pyx_setprop_9csamtools_11AlignedRead_tags, __Pyx_DOCSTR(__pyx_k_178), 0},
28043 {(char *)"flag", __pyx_getprop_9csamtools_11AlignedRead_flag, __pyx_setprop_9csamtools_11AlignedRead_flag, __Pyx_DOCSTR(__pyx_k_179), 0},
28044 {(char *)"rname", __pyx_getprop_9csamtools_11AlignedRead_rname, __pyx_setprop_9csamtools_11AlignedRead_rname, __Pyx_DOCSTR(__pyx_k_180), 0},
28045 {(char *)"tid", __pyx_getprop_9csamtools_11AlignedRead_tid, __pyx_setprop_9csamtools_11AlignedRead_tid, __Pyx_DOCSTR(__pyx_k_181), 0},
28046 {(char *)"pos", __pyx_getprop_9csamtools_11AlignedRead_pos, __pyx_setprop_9csamtools_11AlignedRead_pos, __Pyx_DOCSTR(__pyx_k_182), 0},
28047 {(char *)"bin", __pyx_getprop_9csamtools_11AlignedRead_bin, __pyx_setprop_9csamtools_11AlignedRead_bin, __Pyx_DOCSTR(__pyx_k_183), 0},
28048 {(char *)"rlen", __pyx_getprop_9csamtools_11AlignedRead_rlen, 0, __Pyx_DOCSTR(__pyx_k_184), 0},
28049 {(char *)"aend", __pyx_getprop_9csamtools_11AlignedRead_aend, 0, __Pyx_DOCSTR(__pyx_k_185), 0},
28050 {(char *)"alen", __pyx_getprop_9csamtools_11AlignedRead_alen, 0, __Pyx_DOCSTR(__pyx_k_186), 0},
28051 {(char *)"mapq", __pyx_getprop_9csamtools_11AlignedRead_mapq, __pyx_setprop_9csamtools_11AlignedRead_mapq, __Pyx_DOCSTR(__pyx_k_187), 0},
28052 {(char *)"mrnm", __pyx_getprop_9csamtools_11AlignedRead_mrnm, __pyx_setprop_9csamtools_11AlignedRead_mrnm, __Pyx_DOCSTR(__pyx_k_188), 0},
28053 {(char *)"rnext", __pyx_getprop_9csamtools_11AlignedRead_rnext, __pyx_setprop_9csamtools_11AlignedRead_rnext, __Pyx_DOCSTR(__pyx_k_189), 0},
28054 {(char *)"mpos", __pyx_getprop_9csamtools_11AlignedRead_mpos, __pyx_setprop_9csamtools_11AlignedRead_mpos, __Pyx_DOCSTR(__pyx_k_190), 0},
28055 {(char *)"pnext", __pyx_getprop_9csamtools_11AlignedRead_pnext, __pyx_setprop_9csamtools_11AlignedRead_pnext, __Pyx_DOCSTR(__pyx_k_191), 0},
28056 {(char *)"isize", __pyx_getprop_9csamtools_11AlignedRead_isize, __pyx_setprop_9csamtools_11AlignedRead_isize, __Pyx_DOCSTR(__pyx_k_192), 0},
28057 {(char *)"tlen", __pyx_getprop_9csamtools_11AlignedRead_tlen, __pyx_setprop_9csamtools_11AlignedRead_tlen, __Pyx_DOCSTR(__pyx_k_193), 0},
28058 {(char *)"is_paired", __pyx_getprop_9csamtools_11AlignedRead_is_paired, __pyx_setprop_9csamtools_11AlignedRead_is_paired, __Pyx_DOCSTR(__pyx_k_194), 0},
28059 {(char *)"is_proper_pair", __pyx_getprop_9csamtools_11AlignedRead_is_proper_pair, __pyx_setprop_9csamtools_11AlignedRead_is_proper_pair, __Pyx_DOCSTR(__pyx_k_195), 0},
28060 {(char *)"is_unmapped", __pyx_getprop_9csamtools_11AlignedRead_is_unmapped, __pyx_setprop_9csamtools_11AlignedRead_is_unmapped, __Pyx_DOCSTR(__pyx_k_196), 0},
28061 {(char *)"mate_is_unmapped", __pyx_getprop_9csamtools_11AlignedRead_mate_is_unmapped, __pyx_setprop_9csamtools_11AlignedRead_mate_is_unmapped, __Pyx_DOCSTR(__pyx_k_197), 0},
28062 {(char *)"is_reverse", __pyx_getprop_9csamtools_11AlignedRead_is_reverse, __pyx_setprop_9csamtools_11AlignedRead_is_reverse, __Pyx_DOCSTR(__pyx_k_198), 0},
28063 {(char *)"mate_is_reverse", __pyx_getprop_9csamtools_11AlignedRead_mate_is_reverse, __pyx_setprop_9csamtools_11AlignedRead_mate_is_reverse, __Pyx_DOCSTR(__pyx_k_199), 0},
28064 {(char *)"is_read1", __pyx_getprop_9csamtools_11AlignedRead_is_read1, __pyx_setprop_9csamtools_11AlignedRead_is_read1, __Pyx_DOCSTR(__pyx_k_200), 0},
28065 {(char *)"is_read2", __pyx_getprop_9csamtools_11AlignedRead_is_read2, __pyx_setprop_9csamtools_11AlignedRead_is_read2, __Pyx_DOCSTR(__pyx_k_201), 0},
28066 {(char *)"is_secondary", __pyx_getprop_9csamtools_11AlignedRead_is_secondary, __pyx_setprop_9csamtools_11AlignedRead_is_secondary, __Pyx_DOCSTR(__pyx_k_202), 0},
28067 {(char *)"is_qcfail", __pyx_getprop_9csamtools_11AlignedRead_is_qcfail, __pyx_setprop_9csamtools_11AlignedRead_is_qcfail, __Pyx_DOCSTR(__pyx_k_203), 0},
28068 {(char *)"is_duplicate", __pyx_getprop_9csamtools_11AlignedRead_is_duplicate, __pyx_setprop_9csamtools_11AlignedRead_is_duplicate, __Pyx_DOCSTR(__pyx_k_204), 0},
28069 {(char *)"positions", __pyx_getprop_9csamtools_11AlignedRead_positions, 0, __Pyx_DOCSTR(__pyx_k_205), 0},
28073 static PyNumberMethods __pyx_tp_as_number_AlignedRead = {
28077 #if PY_MAJOR_VERSION < 3
28080 0, /*nb_remainder*/
28093 #if PY_MAJOR_VERSION < 3
28097 #if PY_MAJOR_VERSION < 3
28103 #if PY_MAJOR_VERSION < 3
28106 #if PY_MAJOR_VERSION < 3
28109 0, /*nb_inplace_add*/
28110 0, /*nb_inplace_subtract*/
28111 0, /*nb_inplace_multiply*/
28112 #if PY_MAJOR_VERSION < 3
28113 0, /*nb_inplace_divide*/
28115 0, /*nb_inplace_remainder*/
28116 0, /*nb_inplace_power*/
28117 0, /*nb_inplace_lshift*/
28118 0, /*nb_inplace_rshift*/
28119 0, /*nb_inplace_and*/
28120 0, /*nb_inplace_xor*/
28121 0, /*nb_inplace_or*/
28122 0, /*nb_floor_divide*/
28123 0, /*nb_true_divide*/
28124 0, /*nb_inplace_floor_divide*/
28125 0, /*nb_inplace_true_divide*/
28126 #if PY_VERSION_HEX >= 0x02050000
28131 static PySequenceMethods __pyx_tp_as_sequence_AlignedRead = {
28138 0, /*sq_ass_slice*/
28140 0, /*sq_inplace_concat*/
28141 0, /*sq_inplace_repeat*/
28144 static PyMappingMethods __pyx_tp_as_mapping_AlignedRead = {
28146 0, /*mp_subscript*/
28147 0, /*mp_ass_subscript*/
28150 static PyBufferProcs __pyx_tp_as_buffer_AlignedRead = {
28151 #if PY_MAJOR_VERSION < 3
28152 0, /*bf_getreadbuffer*/
28154 #if PY_MAJOR_VERSION < 3
28155 0, /*bf_getwritebuffer*/
28157 #if PY_MAJOR_VERSION < 3
28158 0, /*bf_getsegcount*/
28160 #if PY_MAJOR_VERSION < 3
28161 0, /*bf_getcharbuffer*/
28163 #if PY_VERSION_HEX >= 0x02060000
28164 0, /*bf_getbuffer*/
28166 #if PY_VERSION_HEX >= 0x02060000
28167 0, /*bf_releasebuffer*/
28171 static PyTypeObject __pyx_type_9csamtools_AlignedRead = {
28172 PyVarObject_HEAD_INIT(0, 0)
28173 __Pyx_NAMESTR("csamtools.AlignedRead"), /*tp_name*/
28174 sizeof(struct __pyx_obj_9csamtools_AlignedRead), /*tp_basicsize*/
28176 __pyx_tp_dealloc_9csamtools_AlignedRead, /*tp_dealloc*/
28180 #if PY_MAJOR_VERSION < 3
28186 &__pyx_tp_as_number_AlignedRead, /*tp_as_number*/
28187 &__pyx_tp_as_sequence_AlignedRead, /*tp_as_sequence*/
28188 &__pyx_tp_as_mapping_AlignedRead, /*tp_as_mapping*/
28189 __pyx_pf_9csamtools_11AlignedRead_4__hash__, /*tp_hash*/
28191 __pyx_pf_9csamtools_11AlignedRead_2__str__, /*tp_str*/
28194 &__pyx_tp_as_buffer_AlignedRead, /*tp_as_buffer*/
28195 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
28196 __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 "), /*tp_doc*/
28199 0, /*tp_richcompare*/
28200 0, /*tp_weaklistoffset*/
28203 __pyx_methods_9csamtools_AlignedRead, /*tp_methods*/
28205 __pyx_getsets_9csamtools_AlignedRead, /*tp_getset*/
28208 0, /*tp_descr_get*/
28209 0, /*tp_descr_set*/
28210 0, /*tp_dictoffset*/
28211 __pyx_pf_9csamtools_11AlignedRead___init__, /*tp_init*/
28213 __pyx_tp_new_9csamtools_AlignedRead, /*tp_new*/
28219 0, /*tp_subclasses*/
28222 #if PY_VERSION_HEX >= 0x02060000
28223 0, /*tp_version_tag*/
28226 static struct __pyx_vtabstruct_9csamtools_Samfile __pyx_vtable_9csamtools_Samfile;
28228 static PyObject *__pyx_tp_new_9csamtools_Samfile(PyTypeObject *t, PyObject *a, PyObject *k) {
28229 struct __pyx_obj_9csamtools_Samfile *p;
28230 PyObject *o = (*t->tp_alloc)(t, 0);
28232 p = ((struct __pyx_obj_9csamtools_Samfile *)o);
28233 p->__pyx_vtab = __pyx_vtabptr_9csamtools_Samfile;
28234 if (__pyx_pf_9csamtools_7Samfile___cinit__(o, a, k) < 0) {
28235 Py_DECREF(o); o = 0;
28240 static void __pyx_tp_dealloc_9csamtools_Samfile(PyObject *o) {
28242 PyObject *etype, *eval, *etb;
28243 PyErr_Fetch(&etype, &eval, &etb);
28245 __pyx_pf_9csamtools_7Samfile_15__dealloc__(o);
28246 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
28248 PyErr_Restore(etype, eval, etb);
28250 (*Py_TYPE(o)->tp_free)(o);
28253 static PyObject *__pyx_getprop_9csamtools_7Samfile_filename(PyObject *o, void *x) {
28254 return __pyx_pf_9csamtools_7Samfile_8filename___get__(o);
28257 static PyObject *__pyx_getprop_9csamtools_7Samfile_nreferences(PyObject *o, void *x) {
28258 return __pyx_pf_9csamtools_7Samfile_11nreferences___get__(o);
28261 static PyObject *__pyx_getprop_9csamtools_7Samfile_references(PyObject *o, void *x) {
28262 return __pyx_pf_9csamtools_7Samfile_10references___get__(o);
28265 static PyObject *__pyx_getprop_9csamtools_7Samfile_lengths(PyObject *o, void *x) {
28266 return __pyx_pf_9csamtools_7Samfile_7lengths___get__(o);
28269 static PyObject *__pyx_getprop_9csamtools_7Samfile_mapped(PyObject *o, void *x) {
28270 return __pyx_pf_9csamtools_7Samfile_6mapped___get__(o);
28273 static PyObject *__pyx_getprop_9csamtools_7Samfile_unmapped(PyObject *o, void *x) {
28274 return __pyx_pf_9csamtools_7Samfile_8unmapped___get__(o);
28277 static PyObject *__pyx_getprop_9csamtools_7Samfile_text(PyObject *o, void *x) {
28278 return __pyx_pf_9csamtools_7Samfile_4text___get__(o);
28281 static PyObject *__pyx_getprop_9csamtools_7Samfile_header(PyObject *o, void *x) {
28282 return __pyx_pf_9csamtools_7Samfile_6header___get__(o);
28285 static PyMethodDef __pyx_methods_9csamtools_Samfile[] = {
28286 {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_1_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_1_isOpen)},
28287 {__Pyx_NAMESTR("_hasIndex"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_2_hasIndex, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_2_hasIndex)},
28288 {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_3_open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_3_open)},
28289 {__Pyx_NAMESTR("gettid"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_4gettid, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_4gettid)},
28290 {__Pyx_NAMESTR("getrname"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_5getrname, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_5getrname)},
28291 {__Pyx_NAMESTR("_parseRegion"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_6_parseRegion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_6_parseRegion)},
28292 {__Pyx_NAMESTR("reset"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_7reset, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_7reset)},
28293 {__Pyx_NAMESTR("seek"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_8seek, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_8seek)},
28294 {__Pyx_NAMESTR("tell"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_9tell, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_9tell)},
28295 {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_10fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_10fetch)},
28296 {__Pyx_NAMESTR("mate"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_11mate, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_11mate)},
28297 {__Pyx_NAMESTR("count"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_12count, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_12count)},
28298 {__Pyx_NAMESTR("pileup"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_13pileup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_13pileup)},
28299 {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_14close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_14close)},
28300 {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_16write, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_16write)},
28301 {__Pyx_NAMESTR("__enter__"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_17__enter__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_17__enter__)},
28302 {__Pyx_NAMESTR("__exit__"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_18__exit__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_18__exit__)},
28303 {__Pyx_NAMESTR("_buildLine"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_19_buildLine, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_19_buildLine)},
28304 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_21__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_21__next__)},
28308 static struct PyGetSetDef __pyx_getsets_9csamtools_Samfile[] = {
28309 {(char *)"filename", __pyx_getprop_9csamtools_7Samfile_filename, 0, __Pyx_DOCSTR(__pyx_k_206), 0},
28310 {(char *)"nreferences", __pyx_getprop_9csamtools_7Samfile_nreferences, 0, __Pyx_DOCSTR(__pyx_k_207), 0},
28311 {(char *)"references", __pyx_getprop_9csamtools_7Samfile_references, 0, __Pyx_DOCSTR(__pyx_k_208), 0},
28312 {(char *)"lengths", __pyx_getprop_9csamtools_7Samfile_lengths, 0, __Pyx_DOCSTR(__pyx_k_209), 0},
28313 {(char *)"mapped", __pyx_getprop_9csamtools_7Samfile_mapped, 0, __Pyx_DOCSTR(__pyx_k_210), 0},
28314 {(char *)"unmapped", __pyx_getprop_9csamtools_7Samfile_unmapped, 0, __Pyx_DOCSTR(__pyx_k_211), 0},
28315 {(char *)"text", __pyx_getprop_9csamtools_7Samfile_text, 0, __Pyx_DOCSTR(__pyx_k_212), 0},
28316 {(char *)"header", __pyx_getprop_9csamtools_7Samfile_header, 0, __Pyx_DOCSTR(__pyx_k_213), 0},
28320 static PyNumberMethods __pyx_tp_as_number_Samfile = {
28324 #if PY_MAJOR_VERSION < 3
28327 0, /*nb_remainder*/
28340 #if PY_MAJOR_VERSION < 3
28344 #if PY_MAJOR_VERSION < 3
28350 #if PY_MAJOR_VERSION < 3
28353 #if PY_MAJOR_VERSION < 3
28356 0, /*nb_inplace_add*/
28357 0, /*nb_inplace_subtract*/
28358 0, /*nb_inplace_multiply*/
28359 #if PY_MAJOR_VERSION < 3
28360 0, /*nb_inplace_divide*/
28362 0, /*nb_inplace_remainder*/
28363 0, /*nb_inplace_power*/
28364 0, /*nb_inplace_lshift*/
28365 0, /*nb_inplace_rshift*/
28366 0, /*nb_inplace_and*/
28367 0, /*nb_inplace_xor*/
28368 0, /*nb_inplace_or*/
28369 0, /*nb_floor_divide*/
28370 0, /*nb_true_divide*/
28371 0, /*nb_inplace_floor_divide*/
28372 0, /*nb_inplace_true_divide*/
28373 #if PY_VERSION_HEX >= 0x02050000
28378 static PySequenceMethods __pyx_tp_as_sequence_Samfile = {
28385 0, /*sq_ass_slice*/
28387 0, /*sq_inplace_concat*/
28388 0, /*sq_inplace_repeat*/
28391 static PyMappingMethods __pyx_tp_as_mapping_Samfile = {
28393 0, /*mp_subscript*/
28394 0, /*mp_ass_subscript*/
28397 static PyBufferProcs __pyx_tp_as_buffer_Samfile = {
28398 #if PY_MAJOR_VERSION < 3
28399 0, /*bf_getreadbuffer*/
28401 #if PY_MAJOR_VERSION < 3
28402 0, /*bf_getwritebuffer*/
28404 #if PY_MAJOR_VERSION < 3
28405 0, /*bf_getsegcount*/
28407 #if PY_MAJOR_VERSION < 3
28408 0, /*bf_getcharbuffer*/
28410 #if PY_VERSION_HEX >= 0x02060000
28411 0, /*bf_getbuffer*/
28413 #if PY_VERSION_HEX >= 0x02060000
28414 0, /*bf_releasebuffer*/
28418 static PyTypeObject __pyx_type_9csamtools_Samfile = {
28419 PyVarObject_HEAD_INIT(0, 0)
28420 __Pyx_NAMESTR("csamtools.Samfile"), /*tp_name*/
28421 sizeof(struct __pyx_obj_9csamtools_Samfile), /*tp_basicsize*/
28423 __pyx_tp_dealloc_9csamtools_Samfile, /*tp_dealloc*/
28427 #if PY_MAJOR_VERSION < 3
28433 &__pyx_tp_as_number_Samfile, /*tp_as_number*/
28434 &__pyx_tp_as_sequence_Samfile, /*tp_as_sequence*/
28435 &__pyx_tp_as_mapping_Samfile, /*tp_as_mapping*/
28441 &__pyx_tp_as_buffer_Samfile, /*tp_as_buffer*/
28442 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
28443 __Pyx_DOCSTR("*(filename, mode=None, template = None, referencenames = None, referencelengths = None, text = NULL, header = None,\n add_sq_text = False )*\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.\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 "), /*tp_doc*/
28446 0, /*tp_richcompare*/
28447 0, /*tp_weaklistoffset*/
28448 __pyx_pf_9csamtools_7Samfile_20__iter__, /*tp_iter*/
28449 __pyx_pf_9csamtools_7Samfile_21__next__, /*tp_iternext*/
28450 __pyx_methods_9csamtools_Samfile, /*tp_methods*/
28452 __pyx_getsets_9csamtools_Samfile, /*tp_getset*/
28455 0, /*tp_descr_get*/
28456 0, /*tp_descr_set*/
28457 0, /*tp_dictoffset*/
28460 __pyx_tp_new_9csamtools_Samfile, /*tp_new*/
28466 0, /*tp_subclasses*/
28469 #if PY_VERSION_HEX >= 0x02060000
28470 0, /*tp_version_tag*/
28474 static PyObject *__pyx_tp_new_9csamtools_IteratorRow(PyTypeObject *t, PyObject *a, PyObject *k) {
28475 PyObject *o = (*t->tp_alloc)(t, 0);
28480 static void __pyx_tp_dealloc_9csamtools_IteratorRow(PyObject *o) {
28481 (*Py_TYPE(o)->tp_free)(o);
28484 static PyMethodDef __pyx_methods_9csamtools_IteratorRow[] = {
28488 static PyNumberMethods __pyx_tp_as_number_IteratorRow = {
28492 #if PY_MAJOR_VERSION < 3
28495 0, /*nb_remainder*/
28508 #if PY_MAJOR_VERSION < 3
28512 #if PY_MAJOR_VERSION < 3
28518 #if PY_MAJOR_VERSION < 3
28521 #if PY_MAJOR_VERSION < 3
28524 0, /*nb_inplace_add*/
28525 0, /*nb_inplace_subtract*/
28526 0, /*nb_inplace_multiply*/
28527 #if PY_MAJOR_VERSION < 3
28528 0, /*nb_inplace_divide*/
28530 0, /*nb_inplace_remainder*/
28531 0, /*nb_inplace_power*/
28532 0, /*nb_inplace_lshift*/
28533 0, /*nb_inplace_rshift*/
28534 0, /*nb_inplace_and*/
28535 0, /*nb_inplace_xor*/
28536 0, /*nb_inplace_or*/
28537 0, /*nb_floor_divide*/
28538 0, /*nb_true_divide*/
28539 0, /*nb_inplace_floor_divide*/
28540 0, /*nb_inplace_true_divide*/
28541 #if PY_VERSION_HEX >= 0x02050000
28546 static PySequenceMethods __pyx_tp_as_sequence_IteratorRow = {
28553 0, /*sq_ass_slice*/
28555 0, /*sq_inplace_concat*/
28556 0, /*sq_inplace_repeat*/
28559 static PyMappingMethods __pyx_tp_as_mapping_IteratorRow = {
28561 0, /*mp_subscript*/
28562 0, /*mp_ass_subscript*/
28565 static PyBufferProcs __pyx_tp_as_buffer_IteratorRow = {
28566 #if PY_MAJOR_VERSION < 3
28567 0, /*bf_getreadbuffer*/
28569 #if PY_MAJOR_VERSION < 3
28570 0, /*bf_getwritebuffer*/
28572 #if PY_MAJOR_VERSION < 3
28573 0, /*bf_getsegcount*/
28575 #if PY_MAJOR_VERSION < 3
28576 0, /*bf_getcharbuffer*/
28578 #if PY_VERSION_HEX >= 0x02060000
28579 0, /*bf_getbuffer*/
28581 #if PY_VERSION_HEX >= 0x02060000
28582 0, /*bf_releasebuffer*/
28586 static PyTypeObject __pyx_type_9csamtools_IteratorRow = {
28587 PyVarObject_HEAD_INIT(0, 0)
28588 __Pyx_NAMESTR("csamtools.IteratorRow"), /*tp_name*/
28589 sizeof(struct __pyx_obj_9csamtools_IteratorRow), /*tp_basicsize*/
28591 __pyx_tp_dealloc_9csamtools_IteratorRow, /*tp_dealloc*/
28595 #if PY_MAJOR_VERSION < 3
28601 &__pyx_tp_as_number_IteratorRow, /*tp_as_number*/
28602 &__pyx_tp_as_sequence_IteratorRow, /*tp_as_sequence*/
28603 &__pyx_tp_as_mapping_IteratorRow, /*tp_as_mapping*/
28609 &__pyx_tp_as_buffer_IteratorRow, /*tp_as_buffer*/
28610 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
28611 __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*/
28614 0, /*tp_richcompare*/
28615 0, /*tp_weaklistoffset*/
28618 __pyx_methods_9csamtools_IteratorRow, /*tp_methods*/
28623 0, /*tp_descr_get*/
28624 0, /*tp_descr_set*/
28625 0, /*tp_dictoffset*/
28628 __pyx_tp_new_9csamtools_IteratorRow, /*tp_new*/
28634 0, /*tp_subclasses*/
28637 #if PY_VERSION_HEX >= 0x02060000
28638 0, /*tp_version_tag*/
28641 static struct __pyx_vtabstruct_9csamtools_IteratorRowAll __pyx_vtable_9csamtools_IteratorRowAll;
28643 static PyObject *__pyx_tp_new_9csamtools_IteratorRowAll(PyTypeObject *t, PyObject *a, PyObject *k) {
28644 struct __pyx_obj_9csamtools_IteratorRowAll *p;
28645 PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
28647 p = ((struct __pyx_obj_9csamtools_IteratorRowAll *)o);
28648 p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowAll;
28649 if (__pyx_pf_9csamtools_14IteratorRowAll___cinit__(o, a, k) < 0) {
28650 Py_DECREF(o); o = 0;
28655 static void __pyx_tp_dealloc_9csamtools_IteratorRowAll(PyObject *o) {
28657 PyObject *etype, *eval, *etb;
28658 PyErr_Fetch(&etype, &eval, &etb);
28660 __pyx_pf_9csamtools_14IteratorRowAll_3__dealloc__(o);
28661 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
28663 PyErr_Restore(etype, eval, etb);
28665 __pyx_tp_dealloc_9csamtools_IteratorRow(o);
28668 static PyMethodDef __pyx_methods_9csamtools_IteratorRowAll[] = {
28669 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_14IteratorRowAll_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorRowAll_2__next__)},
28673 static PyNumberMethods __pyx_tp_as_number_IteratorRowAll = {
28677 #if PY_MAJOR_VERSION < 3
28680 0, /*nb_remainder*/
28693 #if PY_MAJOR_VERSION < 3
28697 #if PY_MAJOR_VERSION < 3
28703 #if PY_MAJOR_VERSION < 3
28706 #if PY_MAJOR_VERSION < 3
28709 0, /*nb_inplace_add*/
28710 0, /*nb_inplace_subtract*/
28711 0, /*nb_inplace_multiply*/
28712 #if PY_MAJOR_VERSION < 3
28713 0, /*nb_inplace_divide*/
28715 0, /*nb_inplace_remainder*/
28716 0, /*nb_inplace_power*/
28717 0, /*nb_inplace_lshift*/
28718 0, /*nb_inplace_rshift*/
28719 0, /*nb_inplace_and*/
28720 0, /*nb_inplace_xor*/
28721 0, /*nb_inplace_or*/
28722 0, /*nb_floor_divide*/
28723 0, /*nb_true_divide*/
28724 0, /*nb_inplace_floor_divide*/
28725 0, /*nb_inplace_true_divide*/
28726 #if PY_VERSION_HEX >= 0x02050000
28731 static PySequenceMethods __pyx_tp_as_sequence_IteratorRowAll = {
28738 0, /*sq_ass_slice*/
28740 0, /*sq_inplace_concat*/
28741 0, /*sq_inplace_repeat*/
28744 static PyMappingMethods __pyx_tp_as_mapping_IteratorRowAll = {
28746 0, /*mp_subscript*/
28747 0, /*mp_ass_subscript*/
28750 static PyBufferProcs __pyx_tp_as_buffer_IteratorRowAll = {
28751 #if PY_MAJOR_VERSION < 3
28752 0, /*bf_getreadbuffer*/
28754 #if PY_MAJOR_VERSION < 3
28755 0, /*bf_getwritebuffer*/
28757 #if PY_MAJOR_VERSION < 3
28758 0, /*bf_getsegcount*/
28760 #if PY_MAJOR_VERSION < 3
28761 0, /*bf_getcharbuffer*/
28763 #if PY_VERSION_HEX >= 0x02060000
28764 0, /*bf_getbuffer*/
28766 #if PY_VERSION_HEX >= 0x02060000
28767 0, /*bf_releasebuffer*/
28771 static PyTypeObject __pyx_type_9csamtools_IteratorRowAll = {
28772 PyVarObject_HEAD_INIT(0, 0)
28773 __Pyx_NAMESTR("csamtools.IteratorRowAll"), /*tp_name*/
28774 sizeof(struct __pyx_obj_9csamtools_IteratorRowAll), /*tp_basicsize*/
28776 __pyx_tp_dealloc_9csamtools_IteratorRowAll, /*tp_dealloc*/
28780 #if PY_MAJOR_VERSION < 3
28786 &__pyx_tp_as_number_IteratorRowAll, /*tp_as_number*/
28787 &__pyx_tp_as_sequence_IteratorRowAll, /*tp_as_sequence*/
28788 &__pyx_tp_as_mapping_IteratorRowAll, /*tp_as_mapping*/
28794 &__pyx_tp_as_buffer_IteratorRowAll, /*tp_as_buffer*/
28795 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
28796 __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*/
28799 0, /*tp_richcompare*/
28800 0, /*tp_weaklistoffset*/
28801 __pyx_pf_9csamtools_14IteratorRowAll_1__iter__, /*tp_iter*/
28802 __pyx_pf_9csamtools_14IteratorRowAll_2__next__, /*tp_iternext*/
28803 __pyx_methods_9csamtools_IteratorRowAll, /*tp_methods*/
28808 0, /*tp_descr_get*/
28809 0, /*tp_descr_set*/
28810 0, /*tp_dictoffset*/
28813 __pyx_tp_new_9csamtools_IteratorRowAll, /*tp_new*/
28819 0, /*tp_subclasses*/
28822 #if PY_VERSION_HEX >= 0x02060000
28823 0, /*tp_version_tag*/
28827 static PyObject *__pyx_tp_new_9csamtools_PileupProxy(PyTypeObject *t, PyObject *a, PyObject *k) {
28828 PyObject *o = (*t->tp_alloc)(t, 0);
28833 static void __pyx_tp_dealloc_9csamtools_PileupProxy(PyObject *o) {
28834 (*Py_TYPE(o)->tp_free)(o);
28837 static PyObject *__pyx_getprop_9csamtools_11PileupProxy_tid(PyObject *o, void *x) {
28838 return __pyx_pf_9csamtools_11PileupProxy_3tid___get__(o);
28841 static PyObject *__pyx_getprop_9csamtools_11PileupProxy_n(PyObject *o, void *x) {
28842 return __pyx_pf_9csamtools_11PileupProxy_1n___get__(o);
28845 static int __pyx_setprop_9csamtools_11PileupProxy_n(PyObject *o, PyObject *v, void *x) {
28847 return __pyx_pf_9csamtools_11PileupProxy_1n_1__set__(o, v);
28850 PyErr_SetString(PyExc_NotImplementedError, "__del__");
28855 static PyObject *__pyx_getprop_9csamtools_11PileupProxy_pos(PyObject *o, void *x) {
28856 return __pyx_pf_9csamtools_11PileupProxy_3pos___get__(o);
28859 static PyObject *__pyx_getprop_9csamtools_11PileupProxy_pileups(PyObject *o, void *x) {
28860 return __pyx_pf_9csamtools_11PileupProxy_7pileups___get__(o);
28863 static PyMethodDef __pyx_methods_9csamtools_PileupProxy[] = {
28867 static struct PyGetSetDef __pyx_getsets_9csamtools_PileupProxy[] = {
28868 {(char *)"tid", __pyx_getprop_9csamtools_11PileupProxy_tid, 0, __Pyx_DOCSTR(__pyx_k_214), 0},
28869 {(char *)"n", __pyx_getprop_9csamtools_11PileupProxy_n, __pyx_setprop_9csamtools_11PileupProxy_n, __Pyx_DOCSTR(__pyx_k_215), 0},
28870 {(char *)"pos", __pyx_getprop_9csamtools_11PileupProxy_pos, 0, 0, 0},
28871 {(char *)"pileups", __pyx_getprop_9csamtools_11PileupProxy_pileups, 0, __Pyx_DOCSTR(__pyx_k_216), 0},
28875 static PyNumberMethods __pyx_tp_as_number_PileupProxy = {
28879 #if PY_MAJOR_VERSION < 3
28882 0, /*nb_remainder*/
28895 #if PY_MAJOR_VERSION < 3
28899 #if PY_MAJOR_VERSION < 3
28905 #if PY_MAJOR_VERSION < 3
28908 #if PY_MAJOR_VERSION < 3
28911 0, /*nb_inplace_add*/
28912 0, /*nb_inplace_subtract*/
28913 0, /*nb_inplace_multiply*/
28914 #if PY_MAJOR_VERSION < 3
28915 0, /*nb_inplace_divide*/
28917 0, /*nb_inplace_remainder*/
28918 0, /*nb_inplace_power*/
28919 0, /*nb_inplace_lshift*/
28920 0, /*nb_inplace_rshift*/
28921 0, /*nb_inplace_and*/
28922 0, /*nb_inplace_xor*/
28923 0, /*nb_inplace_or*/
28924 0, /*nb_floor_divide*/
28925 0, /*nb_true_divide*/
28926 0, /*nb_inplace_floor_divide*/
28927 0, /*nb_inplace_true_divide*/
28928 #if PY_VERSION_HEX >= 0x02050000
28933 static PySequenceMethods __pyx_tp_as_sequence_PileupProxy = {
28940 0, /*sq_ass_slice*/
28942 0, /*sq_inplace_concat*/
28943 0, /*sq_inplace_repeat*/
28946 static PyMappingMethods __pyx_tp_as_mapping_PileupProxy = {
28948 0, /*mp_subscript*/
28949 0, /*mp_ass_subscript*/
28952 static PyBufferProcs __pyx_tp_as_buffer_PileupProxy = {
28953 #if PY_MAJOR_VERSION < 3
28954 0, /*bf_getreadbuffer*/
28956 #if PY_MAJOR_VERSION < 3
28957 0, /*bf_getwritebuffer*/
28959 #if PY_MAJOR_VERSION < 3
28960 0, /*bf_getsegcount*/
28962 #if PY_MAJOR_VERSION < 3
28963 0, /*bf_getcharbuffer*/
28965 #if PY_VERSION_HEX >= 0x02060000
28966 0, /*bf_getbuffer*/
28968 #if PY_VERSION_HEX >= 0x02060000
28969 0, /*bf_releasebuffer*/
28973 static PyTypeObject __pyx_type_9csamtools_PileupProxy = {
28974 PyVarObject_HEAD_INIT(0, 0)
28975 __Pyx_NAMESTR("csamtools.PileupProxy"), /*tp_name*/
28976 sizeof(struct __pyx_obj_9csamtools_PileupProxy), /*tp_basicsize*/
28978 __pyx_tp_dealloc_9csamtools_PileupProxy, /*tp_dealloc*/
28982 #if PY_MAJOR_VERSION < 3
28988 &__pyx_tp_as_number_PileupProxy, /*tp_as_number*/
28989 &__pyx_tp_as_sequence_PileupProxy, /*tp_as_sequence*/
28990 &__pyx_tp_as_mapping_PileupProxy, /*tp_as_mapping*/
28993 __pyx_pf_9csamtools_11PileupProxy_1__str__, /*tp_str*/
28996 &__pyx_tp_as_buffer_PileupProxy, /*tp_as_buffer*/
28997 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
28998 __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*/
29001 0, /*tp_richcompare*/
29002 0, /*tp_weaklistoffset*/
29005 __pyx_methods_9csamtools_PileupProxy, /*tp_methods*/
29007 __pyx_getsets_9csamtools_PileupProxy, /*tp_getset*/
29010 0, /*tp_descr_get*/
29011 0, /*tp_descr_set*/
29012 0, /*tp_dictoffset*/
29013 __pyx_pf_9csamtools_11PileupProxy___init__, /*tp_init*/
29015 __pyx_tp_new_9csamtools_PileupProxy, /*tp_new*/
29021 0, /*tp_subclasses*/
29024 #if PY_VERSION_HEX >= 0x02060000
29025 0, /*tp_version_tag*/
29029 static PyObject *__pyx_tp_new_9csamtools_PileupRead(PyTypeObject *t, PyObject *a, PyObject *k) {
29030 struct __pyx_obj_9csamtools_PileupRead *p;
29031 PyObject *o = (*t->tp_alloc)(t, 0);
29033 p = ((struct __pyx_obj_9csamtools_PileupRead *)o);
29034 p->_alignment = ((struct __pyx_obj_9csamtools_AlignedRead *)Py_None); Py_INCREF(Py_None);
29038 static void __pyx_tp_dealloc_9csamtools_PileupRead(PyObject *o) {
29039 struct __pyx_obj_9csamtools_PileupRead *p = (struct __pyx_obj_9csamtools_PileupRead *)o;
29040 Py_XDECREF(((PyObject *)p->_alignment));
29041 (*Py_TYPE(o)->tp_free)(o);
29044 static int __pyx_tp_traverse_9csamtools_PileupRead(PyObject *o, visitproc v, void *a) {
29046 struct __pyx_obj_9csamtools_PileupRead *p = (struct __pyx_obj_9csamtools_PileupRead *)o;
29047 if (p->_alignment) {
29048 e = (*v)(((PyObject*)p->_alignment), a); if (e) return e;
29053 static int __pyx_tp_clear_9csamtools_PileupRead(PyObject *o) {
29054 struct __pyx_obj_9csamtools_PileupRead *p = (struct __pyx_obj_9csamtools_PileupRead *)o;
29056 tmp = ((PyObject*)p->_alignment);
29057 p->_alignment = ((struct __pyx_obj_9csamtools_AlignedRead *)Py_None); Py_INCREF(Py_None);
29062 static PyObject *__pyx_getprop_9csamtools_10PileupRead_alignment(PyObject *o, void *x) {
29063 return __pyx_pf_9csamtools_10PileupRead_9alignment___get__(o);
29066 static PyObject *__pyx_getprop_9csamtools_10PileupRead_qpos(PyObject *o, void *x) {
29067 return __pyx_pf_9csamtools_10PileupRead_4qpos___get__(o);
29070 static PyObject *__pyx_getprop_9csamtools_10PileupRead_indel(PyObject *o, void *x) {
29071 return __pyx_pf_9csamtools_10PileupRead_5indel___get__(o);
29074 static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_del(PyObject *o, void *x) {
29075 return __pyx_pf_9csamtools_10PileupRead_6is_del___get__(o);
29078 static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_head(PyObject *o, void *x) {
29079 return __pyx_pf_9csamtools_10PileupRead_7is_head___get__(o);
29082 static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_tail(PyObject *o, void *x) {
29083 return __pyx_pf_9csamtools_10PileupRead_7is_tail___get__(o);
29086 static PyObject *__pyx_getprop_9csamtools_10PileupRead_level(PyObject *o, void *x) {
29087 return __pyx_pf_9csamtools_10PileupRead_5level___get__(o);
29090 static PyMethodDef __pyx_methods_9csamtools_PileupRead[] = {
29094 static struct PyGetSetDef __pyx_getsets_9csamtools_PileupRead[] = {
29095 {(char *)"alignment", __pyx_getprop_9csamtools_10PileupRead_alignment, 0, __Pyx_DOCSTR(__pyx_k_217), 0},
29096 {(char *)"qpos", __pyx_getprop_9csamtools_10PileupRead_qpos, 0, __Pyx_DOCSTR(__pyx_k_218), 0},
29097 {(char *)"indel", __pyx_getprop_9csamtools_10PileupRead_indel, 0, __Pyx_DOCSTR(__pyx_k_219), 0},
29098 {(char *)"is_del", __pyx_getprop_9csamtools_10PileupRead_is_del, 0, __Pyx_DOCSTR(__pyx_k_220), 0},
29099 {(char *)"is_head", __pyx_getprop_9csamtools_10PileupRead_is_head, 0, 0, 0},
29100 {(char *)"is_tail", __pyx_getprop_9csamtools_10PileupRead_is_tail, 0, 0, 0},
29101 {(char *)"level", __pyx_getprop_9csamtools_10PileupRead_level, 0, 0, 0},
29105 static PyNumberMethods __pyx_tp_as_number_PileupRead = {
29109 #if PY_MAJOR_VERSION < 3
29112 0, /*nb_remainder*/
29125 #if PY_MAJOR_VERSION < 3
29129 #if PY_MAJOR_VERSION < 3
29135 #if PY_MAJOR_VERSION < 3
29138 #if PY_MAJOR_VERSION < 3
29141 0, /*nb_inplace_add*/
29142 0, /*nb_inplace_subtract*/
29143 0, /*nb_inplace_multiply*/
29144 #if PY_MAJOR_VERSION < 3
29145 0, /*nb_inplace_divide*/
29147 0, /*nb_inplace_remainder*/
29148 0, /*nb_inplace_power*/
29149 0, /*nb_inplace_lshift*/
29150 0, /*nb_inplace_rshift*/
29151 0, /*nb_inplace_and*/
29152 0, /*nb_inplace_xor*/
29153 0, /*nb_inplace_or*/
29154 0, /*nb_floor_divide*/
29155 0, /*nb_true_divide*/
29156 0, /*nb_inplace_floor_divide*/
29157 0, /*nb_inplace_true_divide*/
29158 #if PY_VERSION_HEX >= 0x02050000
29163 static PySequenceMethods __pyx_tp_as_sequence_PileupRead = {
29170 0, /*sq_ass_slice*/
29172 0, /*sq_inplace_concat*/
29173 0, /*sq_inplace_repeat*/
29176 static PyMappingMethods __pyx_tp_as_mapping_PileupRead = {
29178 0, /*mp_subscript*/
29179 0, /*mp_ass_subscript*/
29182 static PyBufferProcs __pyx_tp_as_buffer_PileupRead = {
29183 #if PY_MAJOR_VERSION < 3
29184 0, /*bf_getreadbuffer*/
29186 #if PY_MAJOR_VERSION < 3
29187 0, /*bf_getwritebuffer*/
29189 #if PY_MAJOR_VERSION < 3
29190 0, /*bf_getsegcount*/
29192 #if PY_MAJOR_VERSION < 3
29193 0, /*bf_getcharbuffer*/
29195 #if PY_VERSION_HEX >= 0x02060000
29196 0, /*bf_getbuffer*/
29198 #if PY_VERSION_HEX >= 0x02060000
29199 0, /*bf_releasebuffer*/
29203 static PyTypeObject __pyx_type_9csamtools_PileupRead = {
29204 PyVarObject_HEAD_INIT(0, 0)
29205 __Pyx_NAMESTR("csamtools.PileupRead"), /*tp_name*/
29206 sizeof(struct __pyx_obj_9csamtools_PileupRead), /*tp_basicsize*/
29208 __pyx_tp_dealloc_9csamtools_PileupRead, /*tp_dealloc*/
29212 #if PY_MAJOR_VERSION < 3
29218 &__pyx_tp_as_number_PileupRead, /*tp_as_number*/
29219 &__pyx_tp_as_sequence_PileupRead, /*tp_as_sequence*/
29220 &__pyx_tp_as_mapping_PileupRead, /*tp_as_mapping*/
29223 __pyx_pf_9csamtools_10PileupRead_1__str__, /*tp_str*/
29226 &__pyx_tp_as_buffer_PileupRead, /*tp_as_buffer*/
29227 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
29228 __Pyx_DOCSTR("PileupRead()\nA read aligned to a column.\n "), /*tp_doc*/
29229 __pyx_tp_traverse_9csamtools_PileupRead, /*tp_traverse*/
29230 __pyx_tp_clear_9csamtools_PileupRead, /*tp_clear*/
29231 0, /*tp_richcompare*/
29232 0, /*tp_weaklistoffset*/
29235 __pyx_methods_9csamtools_PileupRead, /*tp_methods*/
29237 __pyx_getsets_9csamtools_PileupRead, /*tp_getset*/
29240 0, /*tp_descr_get*/
29241 0, /*tp_descr_set*/
29242 0, /*tp_dictoffset*/
29243 __pyx_pf_9csamtools_10PileupRead___init__, /*tp_init*/
29245 __pyx_tp_new_9csamtools_PileupRead, /*tp_new*/
29251 0, /*tp_subclasses*/
29254 #if PY_VERSION_HEX >= 0x02060000
29255 0, /*tp_version_tag*/
29258 static struct __pyx_vtabstruct_9csamtools_Fastafile __pyx_vtable_9csamtools_Fastafile;
29260 static PyObject *__pyx_tp_new_9csamtools_Fastafile(PyTypeObject *t, PyObject *a, PyObject *k) {
29261 struct __pyx_obj_9csamtools_Fastafile *p;
29262 PyObject *o = (*t->tp_alloc)(t, 0);
29264 p = ((struct __pyx_obj_9csamtools_Fastafile *)o);
29265 p->__pyx_vtab = __pyx_vtabptr_9csamtools_Fastafile;
29266 if (__pyx_pf_9csamtools_9Fastafile___cinit__(o, a, k) < 0) {
29267 Py_DECREF(o); o = 0;
29272 static void __pyx_tp_dealloc_9csamtools_Fastafile(PyObject *o) {
29274 PyObject *etype, *eval, *etb;
29275 PyErr_Fetch(&etype, &eval, &etb);
29277 __pyx_pf_9csamtools_9Fastafile_5__dealloc__(o);
29278 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
29280 PyErr_Restore(etype, eval, etb);
29282 (*Py_TYPE(o)->tp_free)(o);
29285 static PyObject *__pyx_getprop_9csamtools_9Fastafile_filename(PyObject *o, void *x) {
29286 return __pyx_pf_9csamtools_9Fastafile_8filename___get__(o);
29289 static PyMethodDef __pyx_methods_9csamtools_Fastafile[] = {
29290 {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile_1_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_1_isOpen)},
29291 {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile_3_open, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_3_open)},
29292 {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile_4close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_4close)},
29293 {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile_6fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_6fetch)},
29297 static struct PyGetSetDef __pyx_getsets_9csamtools_Fastafile[] = {
29298 {(char *)"filename", __pyx_getprop_9csamtools_9Fastafile_filename, 0, __Pyx_DOCSTR(__pyx_k_206), 0},
29302 static PyNumberMethods __pyx_tp_as_number_Fastafile = {
29306 #if PY_MAJOR_VERSION < 3
29309 0, /*nb_remainder*/
29322 #if PY_MAJOR_VERSION < 3
29326 #if PY_MAJOR_VERSION < 3
29332 #if PY_MAJOR_VERSION < 3
29335 #if PY_MAJOR_VERSION < 3
29338 0, /*nb_inplace_add*/
29339 0, /*nb_inplace_subtract*/
29340 0, /*nb_inplace_multiply*/
29341 #if PY_MAJOR_VERSION < 3
29342 0, /*nb_inplace_divide*/
29344 0, /*nb_inplace_remainder*/
29345 0, /*nb_inplace_power*/
29346 0, /*nb_inplace_lshift*/
29347 0, /*nb_inplace_rshift*/
29348 0, /*nb_inplace_and*/
29349 0, /*nb_inplace_xor*/
29350 0, /*nb_inplace_or*/
29351 0, /*nb_floor_divide*/
29352 0, /*nb_true_divide*/
29353 0, /*nb_inplace_floor_divide*/
29354 0, /*nb_inplace_true_divide*/
29355 #if PY_VERSION_HEX >= 0x02050000
29360 static PySequenceMethods __pyx_tp_as_sequence_Fastafile = {
29361 __pyx_pf_9csamtools_9Fastafile_2__len__, /*sq_length*/
29367 0, /*sq_ass_slice*/
29369 0, /*sq_inplace_concat*/
29370 0, /*sq_inplace_repeat*/
29373 static PyMappingMethods __pyx_tp_as_mapping_Fastafile = {
29374 __pyx_pf_9csamtools_9Fastafile_2__len__, /*mp_length*/
29375 0, /*mp_subscript*/
29376 0, /*mp_ass_subscript*/
29379 static PyBufferProcs __pyx_tp_as_buffer_Fastafile = {
29380 #if PY_MAJOR_VERSION < 3
29381 0, /*bf_getreadbuffer*/
29383 #if PY_MAJOR_VERSION < 3
29384 0, /*bf_getwritebuffer*/
29386 #if PY_MAJOR_VERSION < 3
29387 0, /*bf_getsegcount*/
29389 #if PY_MAJOR_VERSION < 3
29390 0, /*bf_getcharbuffer*/
29392 #if PY_VERSION_HEX >= 0x02060000
29393 0, /*bf_getbuffer*/
29395 #if PY_VERSION_HEX >= 0x02060000
29396 0, /*bf_releasebuffer*/
29400 static PyTypeObject __pyx_type_9csamtools_Fastafile = {
29401 PyVarObject_HEAD_INIT(0, 0)
29402 __Pyx_NAMESTR("csamtools.Fastafile"), /*tp_name*/
29403 sizeof(struct __pyx_obj_9csamtools_Fastafile), /*tp_basicsize*/
29405 __pyx_tp_dealloc_9csamtools_Fastafile, /*tp_dealloc*/
29409 #if PY_MAJOR_VERSION < 3
29415 &__pyx_tp_as_number_Fastafile, /*tp_as_number*/
29416 &__pyx_tp_as_sequence_Fastafile, /*tp_as_sequence*/
29417 &__pyx_tp_as_mapping_Fastafile, /*tp_as_mapping*/
29423 &__pyx_tp_as_buffer_Fastafile, /*tp_as_buffer*/
29424 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
29425 __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*/
29428 0, /*tp_richcompare*/
29429 0, /*tp_weaklistoffset*/
29432 __pyx_methods_9csamtools_Fastafile, /*tp_methods*/
29434 __pyx_getsets_9csamtools_Fastafile, /*tp_getset*/
29437 0, /*tp_descr_get*/
29438 0, /*tp_descr_set*/
29439 0, /*tp_dictoffset*/
29442 __pyx_tp_new_9csamtools_Fastafile, /*tp_new*/
29448 0, /*tp_subclasses*/
29451 #if PY_VERSION_HEX >= 0x02060000
29452 0, /*tp_version_tag*/
29455 static struct __pyx_vtabstruct_9csamtools_IteratorRowRegion __pyx_vtable_9csamtools_IteratorRowRegion;
29457 static PyObject *__pyx_tp_new_9csamtools_IteratorRowRegion(PyTypeObject *t, PyObject *a, PyObject *k) {
29458 struct __pyx_obj_9csamtools_IteratorRowRegion *p;
29459 PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
29461 p = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)o);
29462 p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowRegion;
29463 p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
29464 if (__pyx_pf_9csamtools_17IteratorRowRegion___cinit__(o, a, k) < 0) {
29465 Py_DECREF(o); o = 0;
29470 static void __pyx_tp_dealloc_9csamtools_IteratorRowRegion(PyObject *o) {
29471 struct __pyx_obj_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_9csamtools_IteratorRowRegion *)o;
29473 PyObject *etype, *eval, *etb;
29474 PyErr_Fetch(&etype, &eval, &etb);
29476 __pyx_pf_9csamtools_17IteratorRowRegion_3__dealloc__(o);
29477 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
29479 PyErr_Restore(etype, eval, etb);
29481 Py_XDECREF(((PyObject *)p->samfile));
29482 __pyx_tp_dealloc_9csamtools_IteratorRow(o);
29485 static int __pyx_tp_traverse_9csamtools_IteratorRowRegion(PyObject *o, visitproc v, void *a) {
29487 struct __pyx_obj_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_9csamtools_IteratorRowRegion *)o;
29488 if (__pyx_ptype_9csamtools_IteratorRow->tp_traverse) {
29489 e = __pyx_ptype_9csamtools_IteratorRow->tp_traverse(o, v, a); if (e) return e;
29492 e = (*v)(((PyObject*)p->samfile), a); if (e) return e;
29497 static int __pyx_tp_clear_9csamtools_IteratorRowRegion(PyObject *o) {
29498 struct __pyx_obj_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_9csamtools_IteratorRowRegion *)o;
29500 if (__pyx_ptype_9csamtools_IteratorRow->tp_clear) {
29501 __pyx_ptype_9csamtools_IteratorRow->tp_clear(o);
29503 tmp = ((PyObject*)p->samfile);
29504 p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
29509 static PyMethodDef __pyx_methods_9csamtools_IteratorRowRegion[] = {
29510 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_17IteratorRowRegion_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_17IteratorRowRegion_2__next__)},
29514 static PyNumberMethods __pyx_tp_as_number_IteratorRowRegion = {
29518 #if PY_MAJOR_VERSION < 3
29521 0, /*nb_remainder*/
29534 #if PY_MAJOR_VERSION < 3
29538 #if PY_MAJOR_VERSION < 3
29544 #if PY_MAJOR_VERSION < 3
29547 #if PY_MAJOR_VERSION < 3
29550 0, /*nb_inplace_add*/
29551 0, /*nb_inplace_subtract*/
29552 0, /*nb_inplace_multiply*/
29553 #if PY_MAJOR_VERSION < 3
29554 0, /*nb_inplace_divide*/
29556 0, /*nb_inplace_remainder*/
29557 0, /*nb_inplace_power*/
29558 0, /*nb_inplace_lshift*/
29559 0, /*nb_inplace_rshift*/
29560 0, /*nb_inplace_and*/
29561 0, /*nb_inplace_xor*/
29562 0, /*nb_inplace_or*/
29563 0, /*nb_floor_divide*/
29564 0, /*nb_true_divide*/
29565 0, /*nb_inplace_floor_divide*/
29566 0, /*nb_inplace_true_divide*/
29567 #if PY_VERSION_HEX >= 0x02050000
29572 static PySequenceMethods __pyx_tp_as_sequence_IteratorRowRegion = {
29579 0, /*sq_ass_slice*/
29581 0, /*sq_inplace_concat*/
29582 0, /*sq_inplace_repeat*/
29585 static PyMappingMethods __pyx_tp_as_mapping_IteratorRowRegion = {
29587 0, /*mp_subscript*/
29588 0, /*mp_ass_subscript*/
29591 static PyBufferProcs __pyx_tp_as_buffer_IteratorRowRegion = {
29592 #if PY_MAJOR_VERSION < 3
29593 0, /*bf_getreadbuffer*/
29595 #if PY_MAJOR_VERSION < 3
29596 0, /*bf_getwritebuffer*/
29598 #if PY_MAJOR_VERSION < 3
29599 0, /*bf_getsegcount*/
29601 #if PY_MAJOR_VERSION < 3
29602 0, /*bf_getcharbuffer*/
29604 #if PY_VERSION_HEX >= 0x02060000
29605 0, /*bf_getbuffer*/
29607 #if PY_VERSION_HEX >= 0x02060000
29608 0, /*bf_releasebuffer*/
29612 static PyTypeObject __pyx_type_9csamtools_IteratorRowRegion = {
29613 PyVarObject_HEAD_INIT(0, 0)
29614 __Pyx_NAMESTR("csamtools.IteratorRowRegion"), /*tp_name*/
29615 sizeof(struct __pyx_obj_9csamtools_IteratorRowRegion), /*tp_basicsize*/
29617 __pyx_tp_dealloc_9csamtools_IteratorRowRegion, /*tp_dealloc*/
29621 #if PY_MAJOR_VERSION < 3
29627 &__pyx_tp_as_number_IteratorRowRegion, /*tp_as_number*/
29628 &__pyx_tp_as_sequence_IteratorRowRegion, /*tp_as_sequence*/
29629 &__pyx_tp_as_mapping_IteratorRowRegion, /*tp_as_mapping*/
29635 &__pyx_tp_as_buffer_IteratorRowRegion, /*tp_as_buffer*/
29636 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
29637 __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*/
29638 __pyx_tp_traverse_9csamtools_IteratorRowRegion, /*tp_traverse*/
29639 __pyx_tp_clear_9csamtools_IteratorRowRegion, /*tp_clear*/
29640 0, /*tp_richcompare*/
29641 0, /*tp_weaklistoffset*/
29642 __pyx_pf_9csamtools_17IteratorRowRegion_1__iter__, /*tp_iter*/
29643 __pyx_pf_9csamtools_17IteratorRowRegion_2__next__, /*tp_iternext*/
29644 __pyx_methods_9csamtools_IteratorRowRegion, /*tp_methods*/
29649 0, /*tp_descr_get*/
29650 0, /*tp_descr_set*/
29651 0, /*tp_dictoffset*/
29654 __pyx_tp_new_9csamtools_IteratorRowRegion, /*tp_new*/
29660 0, /*tp_subclasses*/
29663 #if PY_VERSION_HEX >= 0x02060000
29664 0, /*tp_version_tag*/
29668 static PyObject *__pyx_tp_new_9csamtools_IteratorRowAllRefs(PyTypeObject *t, PyObject *a, PyObject *k) {
29669 struct __pyx_obj_9csamtools_IteratorRowAllRefs *p;
29670 PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
29672 p = ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o);
29673 p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
29674 p->rowiter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
29675 if (__pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(o, a, k) < 0) {
29676 Py_DECREF(o); o = 0;
29681 static void __pyx_tp_dealloc_9csamtools_IteratorRowAllRefs(PyObject *o) {
29682 struct __pyx_obj_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o;
29683 Py_XDECREF(((PyObject *)p->samfile));
29684 Py_XDECREF(((PyObject *)p->rowiter));
29685 __pyx_tp_dealloc_9csamtools_IteratorRow(o);
29688 static int __pyx_tp_traverse_9csamtools_IteratorRowAllRefs(PyObject *o, visitproc v, void *a) {
29690 struct __pyx_obj_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o;
29691 if (__pyx_ptype_9csamtools_IteratorRow->tp_traverse) {
29692 e = __pyx_ptype_9csamtools_IteratorRow->tp_traverse(o, v, a); if (e) return e;
29695 e = (*v)(((PyObject*)p->samfile), a); if (e) return e;
29698 e = (*v)(((PyObject*)p->rowiter), a); if (e) return e;
29703 static int __pyx_tp_clear_9csamtools_IteratorRowAllRefs(PyObject *o) {
29704 struct __pyx_obj_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o;
29706 if (__pyx_ptype_9csamtools_IteratorRow->tp_clear) {
29707 __pyx_ptype_9csamtools_IteratorRow->tp_clear(o);
29709 tmp = ((PyObject*)p->samfile);
29710 p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
29712 tmp = ((PyObject*)p->rowiter);
29713 p->rowiter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
29718 static PyMethodDef __pyx_methods_9csamtools_IteratorRowAllRefs[] = {
29719 {__Pyx_NAMESTR("nextiter"), (PyCFunction)__pyx_pf_9csamtools_18IteratorRowAllRefs_1nextiter, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_18IteratorRowAllRefs_1nextiter)},
29720 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_18IteratorRowAllRefs_3__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_18IteratorRowAllRefs_3__next__)},
29724 static PyNumberMethods __pyx_tp_as_number_IteratorRowAllRefs = {
29728 #if PY_MAJOR_VERSION < 3
29731 0, /*nb_remainder*/
29744 #if PY_MAJOR_VERSION < 3
29748 #if PY_MAJOR_VERSION < 3
29754 #if PY_MAJOR_VERSION < 3
29757 #if PY_MAJOR_VERSION < 3
29760 0, /*nb_inplace_add*/
29761 0, /*nb_inplace_subtract*/
29762 0, /*nb_inplace_multiply*/
29763 #if PY_MAJOR_VERSION < 3
29764 0, /*nb_inplace_divide*/
29766 0, /*nb_inplace_remainder*/
29767 0, /*nb_inplace_power*/
29768 0, /*nb_inplace_lshift*/
29769 0, /*nb_inplace_rshift*/
29770 0, /*nb_inplace_and*/
29771 0, /*nb_inplace_xor*/
29772 0, /*nb_inplace_or*/
29773 0, /*nb_floor_divide*/
29774 0, /*nb_true_divide*/
29775 0, /*nb_inplace_floor_divide*/
29776 0, /*nb_inplace_true_divide*/
29777 #if PY_VERSION_HEX >= 0x02050000
29782 static PySequenceMethods __pyx_tp_as_sequence_IteratorRowAllRefs = {
29789 0, /*sq_ass_slice*/
29791 0, /*sq_inplace_concat*/
29792 0, /*sq_inplace_repeat*/
29795 static PyMappingMethods __pyx_tp_as_mapping_IteratorRowAllRefs = {
29797 0, /*mp_subscript*/
29798 0, /*mp_ass_subscript*/
29801 static PyBufferProcs __pyx_tp_as_buffer_IteratorRowAllRefs = {
29802 #if PY_MAJOR_VERSION < 3
29803 0, /*bf_getreadbuffer*/
29805 #if PY_MAJOR_VERSION < 3
29806 0, /*bf_getwritebuffer*/
29808 #if PY_MAJOR_VERSION < 3
29809 0, /*bf_getsegcount*/
29811 #if PY_MAJOR_VERSION < 3
29812 0, /*bf_getcharbuffer*/
29814 #if PY_VERSION_HEX >= 0x02060000
29815 0, /*bf_getbuffer*/
29817 #if PY_VERSION_HEX >= 0x02060000
29818 0, /*bf_releasebuffer*/
29822 static PyTypeObject __pyx_type_9csamtools_IteratorRowAllRefs = {
29823 PyVarObject_HEAD_INIT(0, 0)
29824 __Pyx_NAMESTR("csamtools.IteratorRowAllRefs"), /*tp_name*/
29825 sizeof(struct __pyx_obj_9csamtools_IteratorRowAllRefs), /*tp_basicsize*/
29827 __pyx_tp_dealloc_9csamtools_IteratorRowAllRefs, /*tp_dealloc*/
29831 #if PY_MAJOR_VERSION < 3
29837 &__pyx_tp_as_number_IteratorRowAllRefs, /*tp_as_number*/
29838 &__pyx_tp_as_sequence_IteratorRowAllRefs, /*tp_as_sequence*/
29839 &__pyx_tp_as_mapping_IteratorRowAllRefs, /*tp_as_mapping*/
29845 &__pyx_tp_as_buffer_IteratorRowAllRefs, /*tp_as_buffer*/
29846 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
29847 __Pyx_DOCSTR("iterates over all mapped reads by chaining iterators over each reference\n "), /*tp_doc*/
29848 __pyx_tp_traverse_9csamtools_IteratorRowAllRefs, /*tp_traverse*/
29849 __pyx_tp_clear_9csamtools_IteratorRowAllRefs, /*tp_clear*/
29850 0, /*tp_richcompare*/
29851 0, /*tp_weaklistoffset*/
29852 __pyx_pf_9csamtools_18IteratorRowAllRefs_2__iter__, /*tp_iter*/
29853 __pyx_pf_9csamtools_18IteratorRowAllRefs_3__next__, /*tp_iternext*/
29854 __pyx_methods_9csamtools_IteratorRowAllRefs, /*tp_methods*/
29859 0, /*tp_descr_get*/
29860 0, /*tp_descr_set*/
29861 0, /*tp_dictoffset*/
29864 __pyx_tp_new_9csamtools_IteratorRowAllRefs, /*tp_new*/
29870 0, /*tp_subclasses*/
29873 #if PY_VERSION_HEX >= 0x02060000
29874 0, /*tp_version_tag*/
29877 static struct __pyx_vtabstruct_9csamtools_IteratorRowSelection __pyx_vtable_9csamtools_IteratorRowSelection;
29879 static PyObject *__pyx_tp_new_9csamtools_IteratorRowSelection(PyTypeObject *t, PyObject *a, PyObject *k) {
29880 struct __pyx_obj_9csamtools_IteratorRowSelection *p;
29881 PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k);
29883 p = ((struct __pyx_obj_9csamtools_IteratorRowSelection *)o);
29884 p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowSelection;
29885 p->positions = Py_None; Py_INCREF(Py_None);
29886 if (__pyx_pf_9csamtools_20IteratorRowSelection___cinit__(o, a, k) < 0) {
29887 Py_DECREF(o); o = 0;
29892 static void __pyx_tp_dealloc_9csamtools_IteratorRowSelection(PyObject *o) {
29893 struct __pyx_obj_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_9csamtools_IteratorRowSelection *)o;
29895 PyObject *etype, *eval, *etb;
29896 PyErr_Fetch(&etype, &eval, &etb);
29898 __pyx_pf_9csamtools_20IteratorRowSelection_3__dealloc__(o);
29899 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
29901 PyErr_Restore(etype, eval, etb);
29903 Py_XDECREF(p->positions);
29904 __pyx_tp_dealloc_9csamtools_IteratorRow(o);
29907 static int __pyx_tp_traverse_9csamtools_IteratorRowSelection(PyObject *o, visitproc v, void *a) {
29909 struct __pyx_obj_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_9csamtools_IteratorRowSelection *)o;
29910 if (__pyx_ptype_9csamtools_IteratorRow->tp_traverse) {
29911 e = __pyx_ptype_9csamtools_IteratorRow->tp_traverse(o, v, a); if (e) return e;
29913 if (p->positions) {
29914 e = (*v)(p->positions, a); if (e) return e;
29919 static int __pyx_tp_clear_9csamtools_IteratorRowSelection(PyObject *o) {
29920 struct __pyx_obj_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_9csamtools_IteratorRowSelection *)o;
29922 if (__pyx_ptype_9csamtools_IteratorRow->tp_clear) {
29923 __pyx_ptype_9csamtools_IteratorRow->tp_clear(o);
29925 tmp = ((PyObject*)p->positions);
29926 p->positions = Py_None; Py_INCREF(Py_None);
29931 static PyMethodDef __pyx_methods_9csamtools_IteratorRowSelection[] = {
29932 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_20IteratorRowSelection_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_20IteratorRowSelection_2__next__)},
29936 static PyNumberMethods __pyx_tp_as_number_IteratorRowSelection = {
29940 #if PY_MAJOR_VERSION < 3
29943 0, /*nb_remainder*/
29956 #if PY_MAJOR_VERSION < 3
29960 #if PY_MAJOR_VERSION < 3
29966 #if PY_MAJOR_VERSION < 3
29969 #if PY_MAJOR_VERSION < 3
29972 0, /*nb_inplace_add*/
29973 0, /*nb_inplace_subtract*/
29974 0, /*nb_inplace_multiply*/
29975 #if PY_MAJOR_VERSION < 3
29976 0, /*nb_inplace_divide*/
29978 0, /*nb_inplace_remainder*/
29979 0, /*nb_inplace_power*/
29980 0, /*nb_inplace_lshift*/
29981 0, /*nb_inplace_rshift*/
29982 0, /*nb_inplace_and*/
29983 0, /*nb_inplace_xor*/
29984 0, /*nb_inplace_or*/
29985 0, /*nb_floor_divide*/
29986 0, /*nb_true_divide*/
29987 0, /*nb_inplace_floor_divide*/
29988 0, /*nb_inplace_true_divide*/
29989 #if PY_VERSION_HEX >= 0x02050000
29994 static PySequenceMethods __pyx_tp_as_sequence_IteratorRowSelection = {
30001 0, /*sq_ass_slice*/
30003 0, /*sq_inplace_concat*/
30004 0, /*sq_inplace_repeat*/
30007 static PyMappingMethods __pyx_tp_as_mapping_IteratorRowSelection = {
30009 0, /*mp_subscript*/
30010 0, /*mp_ass_subscript*/
30013 static PyBufferProcs __pyx_tp_as_buffer_IteratorRowSelection = {
30014 #if PY_MAJOR_VERSION < 3
30015 0, /*bf_getreadbuffer*/
30017 #if PY_MAJOR_VERSION < 3
30018 0, /*bf_getwritebuffer*/
30020 #if PY_MAJOR_VERSION < 3
30021 0, /*bf_getsegcount*/
30023 #if PY_MAJOR_VERSION < 3
30024 0, /*bf_getcharbuffer*/
30026 #if PY_VERSION_HEX >= 0x02060000
30027 0, /*bf_getbuffer*/
30029 #if PY_VERSION_HEX >= 0x02060000
30030 0, /*bf_releasebuffer*/
30034 static PyTypeObject __pyx_type_9csamtools_IteratorRowSelection = {
30035 PyVarObject_HEAD_INIT(0, 0)
30036 __Pyx_NAMESTR("csamtools.IteratorRowSelection"), /*tp_name*/
30037 sizeof(struct __pyx_obj_9csamtools_IteratorRowSelection), /*tp_basicsize*/
30039 __pyx_tp_dealloc_9csamtools_IteratorRowSelection, /*tp_dealloc*/
30043 #if PY_MAJOR_VERSION < 3
30049 &__pyx_tp_as_number_IteratorRowSelection, /*tp_as_number*/
30050 &__pyx_tp_as_sequence_IteratorRowSelection, /*tp_as_sequence*/
30051 &__pyx_tp_as_mapping_IteratorRowSelection, /*tp_as_mapping*/
30057 &__pyx_tp_as_buffer_IteratorRowSelection, /*tp_as_buffer*/
30058 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
30059 __Pyx_DOCSTR("*(Samfile samfile)*\n\n iterate over reads in *samfile* at a given list of file positions.\n "), /*tp_doc*/
30060 __pyx_tp_traverse_9csamtools_IteratorRowSelection, /*tp_traverse*/
30061 __pyx_tp_clear_9csamtools_IteratorRowSelection, /*tp_clear*/
30062 0, /*tp_richcompare*/
30063 0, /*tp_weaklistoffset*/
30064 __pyx_pf_9csamtools_20IteratorRowSelection_1__iter__, /*tp_iter*/
30065 __pyx_pf_9csamtools_20IteratorRowSelection_2__next__, /*tp_iternext*/
30066 __pyx_methods_9csamtools_IteratorRowSelection, /*tp_methods*/
30071 0, /*tp_descr_get*/
30072 0, /*tp_descr_set*/
30073 0, /*tp_dictoffset*/
30076 __pyx_tp_new_9csamtools_IteratorRowSelection, /*tp_new*/
30082 0, /*tp_subclasses*/
30085 #if PY_VERSION_HEX >= 0x02060000
30086 0, /*tp_version_tag*/
30089 static struct __pyx_vtabstruct_9csamtools_IteratorColumn __pyx_vtable_9csamtools_IteratorColumn;
30091 static PyObject *__pyx_tp_new_9csamtools_IteratorColumn(PyTypeObject *t, PyObject *a, PyObject *k) {
30092 struct __pyx_obj_9csamtools_IteratorColumn *p;
30093 PyObject *o = (*t->tp_alloc)(t, 0);
30095 p = ((struct __pyx_obj_9csamtools_IteratorColumn *)o);
30096 p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorColumn;
30097 p->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
30098 p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
30099 p->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)Py_None); Py_INCREF(Py_None);
30100 p->stepper = Py_None; Py_INCREF(Py_None);
30101 if (__pyx_pf_9csamtools_14IteratorColumn___cinit__(o, a, k) < 0) {
30102 Py_DECREF(o); o = 0;
30107 static void __pyx_tp_dealloc_9csamtools_IteratorColumn(PyObject *o) {
30108 struct __pyx_obj_9csamtools_IteratorColumn *p = (struct __pyx_obj_9csamtools_IteratorColumn *)o;
30110 PyObject *etype, *eval, *etb;
30111 PyErr_Fetch(&etype, &eval, &etb);
30113 __pyx_pf_9csamtools_14IteratorColumn_4__dealloc__(o);
30114 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
30116 PyErr_Restore(etype, eval, etb);
30118 Py_XDECREF(((PyObject *)p->iter));
30119 Py_XDECREF(((PyObject *)p->samfile));
30120 Py_XDECREF(((PyObject *)p->fastafile));
30121 Py_XDECREF(p->stepper);
30122 (*Py_TYPE(o)->tp_free)(o);
30125 static int __pyx_tp_traverse_9csamtools_IteratorColumn(PyObject *o, visitproc v, void *a) {
30127 struct __pyx_obj_9csamtools_IteratorColumn *p = (struct __pyx_obj_9csamtools_IteratorColumn *)o;
30129 e = (*v)(((PyObject*)p->iter), a); if (e) return e;
30132 e = (*v)(((PyObject*)p->samfile), a); if (e) return e;
30134 if (p->fastafile) {
30135 e = (*v)(((PyObject*)p->fastafile), a); if (e) return e;
30138 e = (*v)(p->stepper, a); if (e) return e;
30143 static int __pyx_tp_clear_9csamtools_IteratorColumn(PyObject *o) {
30144 struct __pyx_obj_9csamtools_IteratorColumn *p = (struct __pyx_obj_9csamtools_IteratorColumn *)o;
30146 tmp = ((PyObject*)p->iter);
30147 p->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None);
30149 tmp = ((PyObject*)p->samfile);
30150 p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
30152 tmp = ((PyObject*)p->fastafile);
30153 p->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)Py_None); Py_INCREF(Py_None);
30155 tmp = ((PyObject*)p->stepper);
30156 p->stepper = Py_None; Py_INCREF(Py_None);
30161 static PyObject *__pyx_getprop_9csamtools_14IteratorColumn_seq_len(PyObject *o, void *x) {
30162 return __pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(o);
30165 static PyMethodDef __pyx_methods_9csamtools_IteratorColumn[] = {
30166 {__Pyx_NAMESTR("addReference"), (PyCFunction)__pyx_pf_9csamtools_14IteratorColumn_2addReference, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorColumn_2addReference)},
30167 {__Pyx_NAMESTR("hasReference"), (PyCFunction)__pyx_pf_9csamtools_14IteratorColumn_3hasReference, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorColumn_3hasReference)},
30171 static struct PyGetSetDef __pyx_getsets_9csamtools_IteratorColumn[] = {
30172 {(char *)"seq_len", __pyx_getprop_9csamtools_14IteratorColumn_seq_len, 0, __Pyx_DOCSTR(__pyx_k_221), 0},
30176 static PyNumberMethods __pyx_tp_as_number_IteratorColumn = {
30180 #if PY_MAJOR_VERSION < 3
30183 0, /*nb_remainder*/
30196 #if PY_MAJOR_VERSION < 3
30200 #if PY_MAJOR_VERSION < 3
30206 #if PY_MAJOR_VERSION < 3
30209 #if PY_MAJOR_VERSION < 3
30212 0, /*nb_inplace_add*/
30213 0, /*nb_inplace_subtract*/
30214 0, /*nb_inplace_multiply*/
30215 #if PY_MAJOR_VERSION < 3
30216 0, /*nb_inplace_divide*/
30218 0, /*nb_inplace_remainder*/
30219 0, /*nb_inplace_power*/
30220 0, /*nb_inplace_lshift*/
30221 0, /*nb_inplace_rshift*/
30222 0, /*nb_inplace_and*/
30223 0, /*nb_inplace_xor*/
30224 0, /*nb_inplace_or*/
30225 0, /*nb_floor_divide*/
30226 0, /*nb_true_divide*/
30227 0, /*nb_inplace_floor_divide*/
30228 0, /*nb_inplace_true_divide*/
30229 #if PY_VERSION_HEX >= 0x02050000
30234 static PySequenceMethods __pyx_tp_as_sequence_IteratorColumn = {
30241 0, /*sq_ass_slice*/
30243 0, /*sq_inplace_concat*/
30244 0, /*sq_inplace_repeat*/
30247 static PyMappingMethods __pyx_tp_as_mapping_IteratorColumn = {
30249 0, /*mp_subscript*/
30250 0, /*mp_ass_subscript*/
30253 static PyBufferProcs __pyx_tp_as_buffer_IteratorColumn = {
30254 #if PY_MAJOR_VERSION < 3
30255 0, /*bf_getreadbuffer*/
30257 #if PY_MAJOR_VERSION < 3
30258 0, /*bf_getwritebuffer*/
30260 #if PY_MAJOR_VERSION < 3
30261 0, /*bf_getsegcount*/
30263 #if PY_MAJOR_VERSION < 3
30264 0, /*bf_getcharbuffer*/
30266 #if PY_VERSION_HEX >= 0x02060000
30267 0, /*bf_getbuffer*/
30269 #if PY_VERSION_HEX >= 0x02060000
30270 0, /*bf_releasebuffer*/
30274 static PyTypeObject __pyx_type_9csamtools_IteratorColumn = {
30275 PyVarObject_HEAD_INIT(0, 0)
30276 __Pyx_NAMESTR("csamtools.IteratorColumn"), /*tp_name*/
30277 sizeof(struct __pyx_obj_9csamtools_IteratorColumn), /*tp_basicsize*/
30279 __pyx_tp_dealloc_9csamtools_IteratorColumn, /*tp_dealloc*/
30283 #if PY_MAJOR_VERSION < 3
30289 &__pyx_tp_as_number_IteratorColumn, /*tp_as_number*/
30290 &__pyx_tp_as_sequence_IteratorColumn, /*tp_as_sequence*/
30291 &__pyx_tp_as_mapping_IteratorColumn, /*tp_as_mapping*/
30297 &__pyx_tp_as_buffer_IteratorColumn, /*tp_as_buffer*/
30298 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
30299 __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 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 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*/
30300 __pyx_tp_traverse_9csamtools_IteratorColumn, /*tp_traverse*/
30301 __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/
30302 0, /*tp_richcompare*/
30303 0, /*tp_weaklistoffset*/
30304 __pyx_pf_9csamtools_14IteratorColumn_1__iter__, /*tp_iter*/
30306 __pyx_methods_9csamtools_IteratorColumn, /*tp_methods*/
30308 __pyx_getsets_9csamtools_IteratorColumn, /*tp_getset*/
30311 0, /*tp_descr_get*/
30312 0, /*tp_descr_set*/
30313 0, /*tp_dictoffset*/
30316 __pyx_tp_new_9csamtools_IteratorColumn, /*tp_new*/
30322 0, /*tp_subclasses*/
30325 #if PY_VERSION_HEX >= 0x02060000
30326 0, /*tp_version_tag*/
30329 static struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion __pyx_vtable_9csamtools_IteratorColumnRegion;
30331 static PyObject *__pyx_tp_new_9csamtools_IteratorColumnRegion(PyTypeObject *t, PyObject *a, PyObject *k) {
30332 struct __pyx_obj_9csamtools_IteratorColumnRegion *p;
30333 PyObject *o = __pyx_tp_new_9csamtools_IteratorColumn(t, a, k);
30335 p = ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)o);
30336 p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9csamtools_IteratorColumn*)__pyx_vtabptr_9csamtools_IteratorColumnRegion;
30337 if (__pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(o, a, k) < 0) {
30338 Py_DECREF(o); o = 0;
30343 static PyMethodDef __pyx_methods_9csamtools_IteratorColumnRegion[] = {
30344 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_20IteratorColumnRegion_1__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_20IteratorColumnRegion_1__next__)},
30348 static PyNumberMethods __pyx_tp_as_number_IteratorColumnRegion = {
30352 #if PY_MAJOR_VERSION < 3
30355 0, /*nb_remainder*/
30368 #if PY_MAJOR_VERSION < 3
30372 #if PY_MAJOR_VERSION < 3
30378 #if PY_MAJOR_VERSION < 3
30381 #if PY_MAJOR_VERSION < 3
30384 0, /*nb_inplace_add*/
30385 0, /*nb_inplace_subtract*/
30386 0, /*nb_inplace_multiply*/
30387 #if PY_MAJOR_VERSION < 3
30388 0, /*nb_inplace_divide*/
30390 0, /*nb_inplace_remainder*/
30391 0, /*nb_inplace_power*/
30392 0, /*nb_inplace_lshift*/
30393 0, /*nb_inplace_rshift*/
30394 0, /*nb_inplace_and*/
30395 0, /*nb_inplace_xor*/
30396 0, /*nb_inplace_or*/
30397 0, /*nb_floor_divide*/
30398 0, /*nb_true_divide*/
30399 0, /*nb_inplace_floor_divide*/
30400 0, /*nb_inplace_true_divide*/
30401 #if PY_VERSION_HEX >= 0x02050000
30406 static PySequenceMethods __pyx_tp_as_sequence_IteratorColumnRegion = {
30413 0, /*sq_ass_slice*/
30415 0, /*sq_inplace_concat*/
30416 0, /*sq_inplace_repeat*/
30419 static PyMappingMethods __pyx_tp_as_mapping_IteratorColumnRegion = {
30421 0, /*mp_subscript*/
30422 0, /*mp_ass_subscript*/
30425 static PyBufferProcs __pyx_tp_as_buffer_IteratorColumnRegion = {
30426 #if PY_MAJOR_VERSION < 3
30427 0, /*bf_getreadbuffer*/
30429 #if PY_MAJOR_VERSION < 3
30430 0, /*bf_getwritebuffer*/
30432 #if PY_MAJOR_VERSION < 3
30433 0, /*bf_getsegcount*/
30435 #if PY_MAJOR_VERSION < 3
30436 0, /*bf_getcharbuffer*/
30438 #if PY_VERSION_HEX >= 0x02060000
30439 0, /*bf_getbuffer*/
30441 #if PY_VERSION_HEX >= 0x02060000
30442 0, /*bf_releasebuffer*/
30446 static PyTypeObject __pyx_type_9csamtools_IteratorColumnRegion = {
30447 PyVarObject_HEAD_INIT(0, 0)
30448 __Pyx_NAMESTR("csamtools.IteratorColumnRegion"), /*tp_name*/
30449 sizeof(struct __pyx_obj_9csamtools_IteratorColumnRegion), /*tp_basicsize*/
30451 __pyx_tp_dealloc_9csamtools_IteratorColumn, /*tp_dealloc*/
30455 #if PY_MAJOR_VERSION < 3
30461 &__pyx_tp_as_number_IteratorColumnRegion, /*tp_as_number*/
30462 &__pyx_tp_as_sequence_IteratorColumnRegion, /*tp_as_sequence*/
30463 &__pyx_tp_as_mapping_IteratorColumnRegion, /*tp_as_mapping*/
30469 &__pyx_tp_as_buffer_IteratorColumnRegion, /*tp_as_buffer*/
30470 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
30471 __Pyx_DOCSTR("iterates over a region only.\n "), /*tp_doc*/
30472 __pyx_tp_traverse_9csamtools_IteratorColumn, /*tp_traverse*/
30473 __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/
30474 0, /*tp_richcompare*/
30475 0, /*tp_weaklistoffset*/
30477 __pyx_pf_9csamtools_20IteratorColumnRegion_1__next__, /*tp_iternext*/
30478 __pyx_methods_9csamtools_IteratorColumnRegion, /*tp_methods*/
30483 0, /*tp_descr_get*/
30484 0, /*tp_descr_set*/
30485 0, /*tp_dictoffset*/
30488 __pyx_tp_new_9csamtools_IteratorColumnRegion, /*tp_new*/
30494 0, /*tp_subclasses*/
30497 #if PY_VERSION_HEX >= 0x02060000
30498 0, /*tp_version_tag*/
30501 static struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs __pyx_vtable_9csamtools_IteratorColumnAllRefs;
30503 static PyObject *__pyx_tp_new_9csamtools_IteratorColumnAllRefs(PyTypeObject *t, PyObject *a, PyObject *k) {
30504 struct __pyx_obj_9csamtools_IteratorColumnAllRefs *p;
30505 PyObject *o = __pyx_tp_new_9csamtools_IteratorColumn(t, a, k);
30507 p = ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)o);
30508 p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9csamtools_IteratorColumn*)__pyx_vtabptr_9csamtools_IteratorColumnAllRefs;
30509 if (__pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(o, a, k) < 0) {
30510 Py_DECREF(o); o = 0;
30515 static PyMethodDef __pyx_methods_9csamtools_IteratorColumnAllRefs[] = {
30516 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_21IteratorColumnAllRefs_1__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_21IteratorColumnAllRefs_1__next__)},
30520 static PyNumberMethods __pyx_tp_as_number_IteratorColumnAllRefs = {
30524 #if PY_MAJOR_VERSION < 3
30527 0, /*nb_remainder*/
30540 #if PY_MAJOR_VERSION < 3
30544 #if PY_MAJOR_VERSION < 3
30550 #if PY_MAJOR_VERSION < 3
30553 #if PY_MAJOR_VERSION < 3
30556 0, /*nb_inplace_add*/
30557 0, /*nb_inplace_subtract*/
30558 0, /*nb_inplace_multiply*/
30559 #if PY_MAJOR_VERSION < 3
30560 0, /*nb_inplace_divide*/
30562 0, /*nb_inplace_remainder*/
30563 0, /*nb_inplace_power*/
30564 0, /*nb_inplace_lshift*/
30565 0, /*nb_inplace_rshift*/
30566 0, /*nb_inplace_and*/
30567 0, /*nb_inplace_xor*/
30568 0, /*nb_inplace_or*/
30569 0, /*nb_floor_divide*/
30570 0, /*nb_true_divide*/
30571 0, /*nb_inplace_floor_divide*/
30572 0, /*nb_inplace_true_divide*/
30573 #if PY_VERSION_HEX >= 0x02050000
30578 static PySequenceMethods __pyx_tp_as_sequence_IteratorColumnAllRefs = {
30585 0, /*sq_ass_slice*/
30587 0, /*sq_inplace_concat*/
30588 0, /*sq_inplace_repeat*/
30591 static PyMappingMethods __pyx_tp_as_mapping_IteratorColumnAllRefs = {
30593 0, /*mp_subscript*/
30594 0, /*mp_ass_subscript*/
30597 static PyBufferProcs __pyx_tp_as_buffer_IteratorColumnAllRefs = {
30598 #if PY_MAJOR_VERSION < 3
30599 0, /*bf_getreadbuffer*/
30601 #if PY_MAJOR_VERSION < 3
30602 0, /*bf_getwritebuffer*/
30604 #if PY_MAJOR_VERSION < 3
30605 0, /*bf_getsegcount*/
30607 #if PY_MAJOR_VERSION < 3
30608 0, /*bf_getcharbuffer*/
30610 #if PY_VERSION_HEX >= 0x02060000
30611 0, /*bf_getbuffer*/
30613 #if PY_VERSION_HEX >= 0x02060000
30614 0, /*bf_releasebuffer*/
30618 static PyTypeObject __pyx_type_9csamtools_IteratorColumnAllRefs = {
30619 PyVarObject_HEAD_INIT(0, 0)
30620 __Pyx_NAMESTR("csamtools.IteratorColumnAllRefs"), /*tp_name*/
30621 sizeof(struct __pyx_obj_9csamtools_IteratorColumnAllRefs), /*tp_basicsize*/
30623 __pyx_tp_dealloc_9csamtools_IteratorColumn, /*tp_dealloc*/
30627 #if PY_MAJOR_VERSION < 3
30633 &__pyx_tp_as_number_IteratorColumnAllRefs, /*tp_as_number*/
30634 &__pyx_tp_as_sequence_IteratorColumnAllRefs, /*tp_as_sequence*/
30635 &__pyx_tp_as_mapping_IteratorColumnAllRefs, /*tp_as_mapping*/
30641 &__pyx_tp_as_buffer_IteratorColumnAllRefs, /*tp_as_buffer*/
30642 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
30643 __Pyx_DOCSTR("iterates over all columns by chaining iterators over each reference\n "), /*tp_doc*/
30644 __pyx_tp_traverse_9csamtools_IteratorColumn, /*tp_traverse*/
30645 __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/
30646 0, /*tp_richcompare*/
30647 0, /*tp_weaklistoffset*/
30649 __pyx_pf_9csamtools_21IteratorColumnAllRefs_1__next__, /*tp_iternext*/
30650 __pyx_methods_9csamtools_IteratorColumnAllRefs, /*tp_methods*/
30655 0, /*tp_descr_get*/
30656 0, /*tp_descr_set*/
30657 0, /*tp_dictoffset*/
30660 __pyx_tp_new_9csamtools_IteratorColumnAllRefs, /*tp_new*/
30666 0, /*tp_subclasses*/
30669 #if PY_VERSION_HEX >= 0x02060000
30670 0, /*tp_version_tag*/
30674 static PyObject *__pyx_tp_new_9csamtools_SNPCall(PyTypeObject *t, PyObject *a, PyObject *k) {
30675 PyObject *o = (*t->tp_alloc)(t, 0);
30680 static void __pyx_tp_dealloc_9csamtools_SNPCall(PyObject *o) {
30681 (*Py_TYPE(o)->tp_free)(o);
30684 static PyObject *__pyx_getprop_9csamtools_7SNPCall_tid(PyObject *o, void *x) {
30685 return __pyx_pf_9csamtools_7SNPCall_3tid___get__(o);
30688 static PyObject *__pyx_getprop_9csamtools_7SNPCall_pos(PyObject *o, void *x) {
30689 return __pyx_pf_9csamtools_7SNPCall_3pos___get__(o);
30692 static PyObject *__pyx_getprop_9csamtools_7SNPCall_reference_base(PyObject *o, void *x) {
30693 return __pyx_pf_9csamtools_7SNPCall_14reference_base___get__(o);
30696 static PyObject *__pyx_getprop_9csamtools_7SNPCall_genotype(PyObject *o, void *x) {
30697 return __pyx_pf_9csamtools_7SNPCall_8genotype___get__(o);
30700 static PyObject *__pyx_getprop_9csamtools_7SNPCall_consensus_quality(PyObject *o, void *x) {
30701 return __pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(o);
30704 static PyObject *__pyx_getprop_9csamtools_7SNPCall_snp_quality(PyObject *o, void *x) {
30705 return __pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(o);
30708 static PyObject *__pyx_getprop_9csamtools_7SNPCall_mapping_quality(PyObject *o, void *x) {
30709 return __pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(o);
30712 static PyObject *__pyx_getprop_9csamtools_7SNPCall_coverage(PyObject *o, void *x) {
30713 return __pyx_pf_9csamtools_7SNPCall_8coverage___get__(o);
30716 static PyMethodDef __pyx_methods_9csamtools_SNPCall[] = {
30720 static struct PyGetSetDef __pyx_getsets_9csamtools_SNPCall[] = {
30721 {(char *)"tid", __pyx_getprop_9csamtools_7SNPCall_tid, 0, __Pyx_DOCSTR(__pyx_k_214), 0},
30722 {(char *)"pos", __pyx_getprop_9csamtools_7SNPCall_pos, 0, __Pyx_DOCSTR(__pyx_k_222), 0},
30723 {(char *)"reference_base", __pyx_getprop_9csamtools_7SNPCall_reference_base, 0, __Pyx_DOCSTR(__pyx_k_223), 0},
30724 {(char *)"genotype", __pyx_getprop_9csamtools_7SNPCall_genotype, 0, __Pyx_DOCSTR(__pyx_k_224), 0},
30725 {(char *)"consensus_quality", __pyx_getprop_9csamtools_7SNPCall_consensus_quality, 0, __Pyx_DOCSTR(__pyx_k_225), 0},
30726 {(char *)"snp_quality", __pyx_getprop_9csamtools_7SNPCall_snp_quality, 0, __Pyx_DOCSTR(__pyx_k_226), 0},
30727 {(char *)"mapping_quality", __pyx_getprop_9csamtools_7SNPCall_mapping_quality, 0, __Pyx_DOCSTR(__pyx_k_227), 0},
30728 {(char *)"coverage", __pyx_getprop_9csamtools_7SNPCall_coverage, 0, __Pyx_DOCSTR(__pyx_k_228), 0},
30732 static PyNumberMethods __pyx_tp_as_number_SNPCall = {
30736 #if PY_MAJOR_VERSION < 3
30739 0, /*nb_remainder*/
30752 #if PY_MAJOR_VERSION < 3
30756 #if PY_MAJOR_VERSION < 3
30762 #if PY_MAJOR_VERSION < 3
30765 #if PY_MAJOR_VERSION < 3
30768 0, /*nb_inplace_add*/
30769 0, /*nb_inplace_subtract*/
30770 0, /*nb_inplace_multiply*/
30771 #if PY_MAJOR_VERSION < 3
30772 0, /*nb_inplace_divide*/
30774 0, /*nb_inplace_remainder*/
30775 0, /*nb_inplace_power*/
30776 0, /*nb_inplace_lshift*/
30777 0, /*nb_inplace_rshift*/
30778 0, /*nb_inplace_and*/
30779 0, /*nb_inplace_xor*/
30780 0, /*nb_inplace_or*/
30781 0, /*nb_floor_divide*/
30782 0, /*nb_true_divide*/
30783 0, /*nb_inplace_floor_divide*/
30784 0, /*nb_inplace_true_divide*/
30785 #if PY_VERSION_HEX >= 0x02050000
30790 static PySequenceMethods __pyx_tp_as_sequence_SNPCall = {
30797 0, /*sq_ass_slice*/
30799 0, /*sq_inplace_concat*/
30800 0, /*sq_inplace_repeat*/
30803 static PyMappingMethods __pyx_tp_as_mapping_SNPCall = {
30805 0, /*mp_subscript*/
30806 0, /*mp_ass_subscript*/
30809 static PyBufferProcs __pyx_tp_as_buffer_SNPCall = {
30810 #if PY_MAJOR_VERSION < 3
30811 0, /*bf_getreadbuffer*/
30813 #if PY_MAJOR_VERSION < 3
30814 0, /*bf_getwritebuffer*/
30816 #if PY_MAJOR_VERSION < 3
30817 0, /*bf_getsegcount*/
30819 #if PY_MAJOR_VERSION < 3
30820 0, /*bf_getcharbuffer*/
30822 #if PY_VERSION_HEX >= 0x02060000
30823 0, /*bf_getbuffer*/
30825 #if PY_VERSION_HEX >= 0x02060000
30826 0, /*bf_releasebuffer*/
30830 static PyTypeObject __pyx_type_9csamtools_SNPCall = {
30831 PyVarObject_HEAD_INIT(0, 0)
30832 __Pyx_NAMESTR("csamtools.SNPCall"), /*tp_name*/
30833 sizeof(struct __pyx_obj_9csamtools_SNPCall), /*tp_basicsize*/
30835 __pyx_tp_dealloc_9csamtools_SNPCall, /*tp_dealloc*/
30839 #if PY_MAJOR_VERSION < 3
30845 &__pyx_tp_as_number_SNPCall, /*tp_as_number*/
30846 &__pyx_tp_as_sequence_SNPCall, /*tp_as_sequence*/
30847 &__pyx_tp_as_mapping_SNPCall, /*tp_as_mapping*/
30850 __pyx_pf_9csamtools_7SNPCall___str__, /*tp_str*/
30853 &__pyx_tp_as_buffer_SNPCall, /*tp_as_buffer*/
30854 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
30855 __Pyx_DOCSTR("the results of a SNP call."), /*tp_doc*/
30858 0, /*tp_richcompare*/
30859 0, /*tp_weaklistoffset*/
30862 __pyx_methods_9csamtools_SNPCall, /*tp_methods*/
30864 __pyx_getsets_9csamtools_SNPCall, /*tp_getset*/
30867 0, /*tp_descr_get*/
30868 0, /*tp_descr_set*/
30869 0, /*tp_dictoffset*/
30872 __pyx_tp_new_9csamtools_SNPCall, /*tp_new*/
30878 0, /*tp_subclasses*/
30881 #if PY_VERSION_HEX >= 0x02060000
30882 0, /*tp_version_tag*/
30886 static PyObject *__pyx_tp_new_9csamtools_IndexedReads(PyTypeObject *t, PyObject *a, PyObject *k) {
30887 struct __pyx_obj_9csamtools_IndexedReads *p;
30888 PyObject *o = (*t->tp_alloc)(t, 0);
30890 p = ((struct __pyx_obj_9csamtools_IndexedReads *)o);
30891 p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
30892 p->index = Py_None; Py_INCREF(Py_None);
30896 static void __pyx_tp_dealloc_9csamtools_IndexedReads(PyObject *o) {
30897 struct __pyx_obj_9csamtools_IndexedReads *p = (struct __pyx_obj_9csamtools_IndexedReads *)o;
30899 PyObject *etype, *eval, *etb;
30900 PyErr_Fetch(&etype, &eval, &etb);
30902 __pyx_pf_9csamtools_12IndexedReads_3__dealloc__(o);
30903 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
30905 PyErr_Restore(etype, eval, etb);
30907 Py_XDECREF(((PyObject *)p->samfile));
30908 Py_XDECREF(p->index);
30909 (*Py_TYPE(o)->tp_free)(o);
30912 static int __pyx_tp_traverse_9csamtools_IndexedReads(PyObject *o, visitproc v, void *a) {
30914 struct __pyx_obj_9csamtools_IndexedReads *p = (struct __pyx_obj_9csamtools_IndexedReads *)o;
30916 e = (*v)(((PyObject*)p->samfile), a); if (e) return e;
30919 e = (*v)(p->index, a); if (e) return e;
30924 static int __pyx_tp_clear_9csamtools_IndexedReads(PyObject *o) {
30925 struct __pyx_obj_9csamtools_IndexedReads *p = (struct __pyx_obj_9csamtools_IndexedReads *)o;
30927 tmp = ((PyObject*)p->samfile);
30928 p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None);
30930 tmp = ((PyObject*)p->index);
30931 p->index = Py_None; Py_INCREF(Py_None);
30936 static PyMethodDef __pyx_methods_9csamtools_IndexedReads[] = {
30937 {__Pyx_NAMESTR("build"), (PyCFunction)__pyx_pf_9csamtools_12IndexedReads_1build, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_12IndexedReads_1build)},
30938 {__Pyx_NAMESTR("find"), (PyCFunction)__pyx_pf_9csamtools_12IndexedReads_2find, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_12IndexedReads_2find)},
30942 static PyNumberMethods __pyx_tp_as_number_IndexedReads = {
30946 #if PY_MAJOR_VERSION < 3
30949 0, /*nb_remainder*/
30962 #if PY_MAJOR_VERSION < 3
30966 #if PY_MAJOR_VERSION < 3
30972 #if PY_MAJOR_VERSION < 3
30975 #if PY_MAJOR_VERSION < 3
30978 0, /*nb_inplace_add*/
30979 0, /*nb_inplace_subtract*/
30980 0, /*nb_inplace_multiply*/
30981 #if PY_MAJOR_VERSION < 3
30982 0, /*nb_inplace_divide*/
30984 0, /*nb_inplace_remainder*/
30985 0, /*nb_inplace_power*/
30986 0, /*nb_inplace_lshift*/
30987 0, /*nb_inplace_rshift*/
30988 0, /*nb_inplace_and*/
30989 0, /*nb_inplace_xor*/
30990 0, /*nb_inplace_or*/
30991 0, /*nb_floor_divide*/
30992 0, /*nb_true_divide*/
30993 0, /*nb_inplace_floor_divide*/
30994 0, /*nb_inplace_true_divide*/
30995 #if PY_VERSION_HEX >= 0x02050000
31000 static PySequenceMethods __pyx_tp_as_sequence_IndexedReads = {
31007 0, /*sq_ass_slice*/
31009 0, /*sq_inplace_concat*/
31010 0, /*sq_inplace_repeat*/
31013 static PyMappingMethods __pyx_tp_as_mapping_IndexedReads = {
31015 0, /*mp_subscript*/
31016 0, /*mp_ass_subscript*/
31019 static PyBufferProcs __pyx_tp_as_buffer_IndexedReads = {
31020 #if PY_MAJOR_VERSION < 3
31021 0, /*bf_getreadbuffer*/
31023 #if PY_MAJOR_VERSION < 3
31024 0, /*bf_getwritebuffer*/
31026 #if PY_MAJOR_VERSION < 3
31027 0, /*bf_getsegcount*/
31029 #if PY_MAJOR_VERSION < 3
31030 0, /*bf_getcharbuffer*/
31032 #if PY_VERSION_HEX >= 0x02060000
31033 0, /*bf_getbuffer*/
31035 #if PY_VERSION_HEX >= 0x02060000
31036 0, /*bf_releasebuffer*/
31040 static PyTypeObject __pyx_type_9csamtools_IndexedReads = {
31041 PyVarObject_HEAD_INIT(0, 0)
31042 __Pyx_NAMESTR("csamtools.IndexedReads"), /*tp_name*/
31043 sizeof(struct __pyx_obj_9csamtools_IndexedReads), /*tp_basicsize*/
31045 __pyx_tp_dealloc_9csamtools_IndexedReads, /*tp_dealloc*/
31049 #if PY_MAJOR_VERSION < 3
31055 &__pyx_tp_as_number_IndexedReads, /*tp_as_number*/
31056 &__pyx_tp_as_sequence_IndexedReads, /*tp_as_sequence*/
31057 &__pyx_tp_as_mapping_IndexedReads, /*tp_as_mapping*/
31063 &__pyx_tp_as_buffer_IndexedReads, /*tp_as_buffer*/
31064 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
31065 __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*/
31066 __pyx_tp_traverse_9csamtools_IndexedReads, /*tp_traverse*/
31067 __pyx_tp_clear_9csamtools_IndexedReads, /*tp_clear*/
31068 0, /*tp_richcompare*/
31069 0, /*tp_weaklistoffset*/
31072 __pyx_methods_9csamtools_IndexedReads, /*tp_methods*/
31077 0, /*tp_descr_get*/
31078 0, /*tp_descr_set*/
31079 0, /*tp_dictoffset*/
31080 __pyx_pf_9csamtools_12IndexedReads___init__, /*tp_init*/
31082 __pyx_tp_new_9csamtools_IndexedReads, /*tp_new*/
31088 0, /*tp_subclasses*/
31091 #if PY_VERSION_HEX >= 0x02060000
31092 0, /*tp_version_tag*/
31096 static PyMethodDef __pyx_methods[] = {
31100 #if PY_MAJOR_VERSION >= 3
31101 static struct PyModuleDef __pyx_moduledef = {
31102 PyModuleDef_HEAD_INIT,
31103 __Pyx_NAMESTR("csamtools"),
31106 __pyx_methods /* m_methods */,
31107 NULL, /* m_reload */
31108 NULL, /* m_traverse */
31109 NULL, /* m_clear */
31114 static __Pyx_StringTabEntry __pyx_string_tab[] = {
31115 {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
31116 {&__pyx_kp_s_100, __pyx_k_100, sizeof(__pyx_k_100), 0, 0, 1, 0},
31117 {&__pyx_kp_s_101, __pyx_k_101, sizeof(__pyx_k_101), 0, 0, 1, 0},
31118 {&__pyx_kp_s_103, __pyx_k_103, sizeof(__pyx_k_103), 0, 0, 1, 0},
31119 {&__pyx_kp_s_106, __pyx_k_106, sizeof(__pyx_k_106), 0, 0, 1, 0},
31120 {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
31121 {&__pyx_kp_s_112, __pyx_k_112, sizeof(__pyx_k_112), 0, 0, 1, 0},
31122 {&__pyx_kp_s_113, __pyx_k_113, sizeof(__pyx_k_113), 0, 0, 1, 0},
31123 {&__pyx_kp_s_114, __pyx_k_114, sizeof(__pyx_k_114), 0, 0, 1, 0},
31124 {&__pyx_kp_s_116, __pyx_k_116, sizeof(__pyx_k_116), 0, 0, 1, 0},
31125 {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
31126 {&__pyx_kp_s_120, __pyx_k_120, sizeof(__pyx_k_120), 0, 0, 1, 0},
31127 {&__pyx_kp_s_121, __pyx_k_121, sizeof(__pyx_k_121), 0, 0, 1, 0},
31128 {&__pyx_n_s_122, __pyx_k_122, sizeof(__pyx_k_122), 0, 0, 1, 1},
31129 {&__pyx_kp_s_123, __pyx_k_123, sizeof(__pyx_k_123), 0, 0, 1, 0},
31130 {&__pyx_kp_s_124, __pyx_k_124, sizeof(__pyx_k_124), 0, 0, 1, 0},
31131 {&__pyx_kp_s_125, __pyx_k_125, sizeof(__pyx_k_125), 0, 0, 1, 0},
31132 {&__pyx_kp_s_126, __pyx_k_126, sizeof(__pyx_k_126), 0, 0, 1, 0},
31133 {&__pyx_kp_s_127, __pyx_k_127, sizeof(__pyx_k_127), 0, 0, 1, 0},
31134 {&__pyx_kp_s_128, __pyx_k_128, sizeof(__pyx_k_128), 0, 0, 1, 0},
31135 {&__pyx_kp_s_129, __pyx_k_129, sizeof(__pyx_k_129), 0, 0, 1, 0},
31136 {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
31137 {&__pyx_kp_s_130, __pyx_k_130, sizeof(__pyx_k_130), 0, 0, 1, 0},
31138 {&__pyx_kp_s_131, __pyx_k_131, sizeof(__pyx_k_131), 0, 0, 1, 0},
31139 {&__pyx_kp_s_132, __pyx_k_132, sizeof(__pyx_k_132), 0, 0, 1, 0},
31140 {&__pyx_kp_s_133, __pyx_k_133, sizeof(__pyx_k_133), 0, 0, 1, 0},
31141 {&__pyx_kp_s_135, __pyx_k_135, sizeof(__pyx_k_135), 0, 0, 1, 0},
31142 {&__pyx_kp_s_136, __pyx_k_136, sizeof(__pyx_k_136), 0, 0, 1, 0},
31143 {&__pyx_kp_s_137, __pyx_k_137, sizeof(__pyx_k_137), 0, 0, 1, 0},
31144 {&__pyx_kp_s_138, __pyx_k_138, sizeof(__pyx_k_138), 0, 0, 1, 0},
31145 {&__pyx_kp_s_139, __pyx_k_139, sizeof(__pyx_k_139), 0, 0, 1, 0},
31146 {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
31147 {&__pyx_kp_s_140, __pyx_k_140, sizeof(__pyx_k_140), 0, 0, 1, 0},
31148 {&__pyx_kp_s_141, __pyx_k_141, sizeof(__pyx_k_141), 0, 0, 1, 0},
31149 {&__pyx_kp_s_142, __pyx_k_142, sizeof(__pyx_k_142), 0, 0, 1, 0},
31150 {&__pyx_kp_s_143, __pyx_k_143, sizeof(__pyx_k_143), 0, 0, 1, 0},
31151 {&__pyx_kp_s_144, __pyx_k_144, sizeof(__pyx_k_144), 0, 0, 1, 0},
31152 {&__pyx_kp_s_145, __pyx_k_145, sizeof(__pyx_k_145), 0, 0, 1, 0},
31153 {&__pyx_kp_s_146, __pyx_k_146, sizeof(__pyx_k_146), 0, 0, 1, 0},
31154 {&__pyx_kp_s_147, __pyx_k_147, sizeof(__pyx_k_147), 0, 0, 1, 0},
31155 {&__pyx_kp_s_148, __pyx_k_148, sizeof(__pyx_k_148), 0, 0, 1, 0},
31156 {&__pyx_kp_s_149, __pyx_k_149, sizeof(__pyx_k_149), 0, 0, 1, 0},
31157 {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
31158 {&__pyx_kp_s_150, __pyx_k_150, sizeof(__pyx_k_150), 0, 0, 1, 0},
31159 {&__pyx_kp_s_151, __pyx_k_151, sizeof(__pyx_k_151), 0, 0, 1, 0},
31160 {&__pyx_kp_s_152, __pyx_k_152, sizeof(__pyx_k_152), 0, 0, 1, 0},
31161 {&__pyx_kp_s_153, __pyx_k_153, sizeof(__pyx_k_153), 0, 0, 1, 0},
31162 {&__pyx_kp_s_154, __pyx_k_154, sizeof(__pyx_k_154), 0, 0, 1, 0},
31163 {&__pyx_kp_s_155, __pyx_k_155, sizeof(__pyx_k_155), 0, 0, 1, 0},
31164 {&__pyx_kp_s_156, __pyx_k_156, sizeof(__pyx_k_156), 0, 0, 1, 0},
31165 {&__pyx_kp_s_157, __pyx_k_157, sizeof(__pyx_k_157), 0, 0, 1, 0},
31166 {&__pyx_kp_s_162, __pyx_k_162, sizeof(__pyx_k_162), 0, 0, 1, 0},
31167 {&__pyx_kp_s_163, __pyx_k_163, sizeof(__pyx_k_163), 0, 0, 1, 0},
31168 {&__pyx_kp_s_164, __pyx_k_164, sizeof(__pyx_k_164), 0, 0, 1, 0},
31169 {&__pyx_n_s_166, __pyx_k_166, sizeof(__pyx_k_166), 0, 0, 1, 1},
31170 {&__pyx_kp_s_167, __pyx_k_167, sizeof(__pyx_k_167), 0, 0, 1, 0},
31171 {&__pyx_kp_s_168, __pyx_k_168, sizeof(__pyx_k_168), 0, 0, 1, 0},
31172 {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
31173 {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
31174 {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
31175 {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
31176 {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
31177 {&__pyx_kp_s_230, __pyx_k_230, sizeof(__pyx_k_230), 0, 0, 1, 0},
31178 {&__pyx_kp_s_231, __pyx_k_231, sizeof(__pyx_k_231), 0, 0, 1, 0},
31179 {&__pyx_kp_s_232, __pyx_k_232, sizeof(__pyx_k_232), 0, 0, 1, 0},
31180 {&__pyx_kp_s_238, __pyx_k_238, sizeof(__pyx_k_238), 0, 0, 1, 0},
31181 {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
31182 {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
31183 {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
31184 {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0},
31185 {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
31186 {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
31187 {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
31188 {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
31189 {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
31190 {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0},
31191 {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
31192 {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
31193 {&__pyx_kp_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 0},
31194 {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0},
31195 {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
31196 {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0},
31197 {&__pyx_kp_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0},
31198 {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0},
31199 {&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0},
31200 {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0},
31201 {&__pyx_kp_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 0},
31202 {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
31203 {&__pyx_kp_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 0},
31204 {&__pyx_kp_s_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 0, 1, 0},
31205 {&__pyx_kp_s_68, __pyx_k_68, sizeof(__pyx_k_68), 0, 0, 1, 0},
31206 {&__pyx_kp_s_71, __pyx_k_71, sizeof(__pyx_k_71), 0, 0, 1, 0},
31207 {&__pyx_kp_s_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 0, 1, 0},
31208 {&__pyx_kp_s_81, __pyx_k_81, sizeof(__pyx_k_81), 0, 0, 1, 0},
31209 {&__pyx_kp_s_84, __pyx_k_84, sizeof(__pyx_k_84), 0, 0, 1, 0},
31210 {&__pyx_kp_s_89, __pyx_k_89, sizeof(__pyx_k_89), 0, 0, 1, 0},
31211 {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
31212 {&__pyx_kp_s_91, __pyx_k_91, sizeof(__pyx_k_91), 0, 0, 1, 0},
31213 {&__pyx_kp_s_93, __pyx_k_93, sizeof(__pyx_k_93), 0, 0, 1, 0},
31214 {&__pyx_kp_s_94, __pyx_k_94, sizeof(__pyx_k_94), 0, 0, 1, 0},
31215 {&__pyx_kp_s_96, __pyx_k_96, sizeof(__pyx_k_96), 0, 0, 1, 0},
31216 {&__pyx_kp_s_97, __pyx_k_97, sizeof(__pyx_k_97), 0, 0, 1, 0},
31217 {&__pyx_kp_s_98, __pyx_k_98, sizeof(__pyx_k_98), 0, 0, 1, 0},
31218 {&__pyx_kp_s_99, __pyx_k_99, sizeof(__pyx_k_99), 0, 0, 1, 0},
31219 {&__pyx_n_s__A, __pyx_k__A, sizeof(__pyx_k__A), 0, 0, 1, 1},
31220 {&__pyx_n_s__AS, __pyx_k__AS, sizeof(__pyx_k__AS), 0, 0, 1, 1},
31221 {&__pyx_n_s__AlignedRead, __pyx_k__AlignedRead, sizeof(__pyx_k__AlignedRead), 0, 0, 1, 1},
31222 {&__pyx_n_s__AttributeError, __pyx_k__AttributeError, sizeof(__pyx_k__AttributeError), 0, 0, 1, 1},
31223 {&__pyx_n_s__C, __pyx_k__C, sizeof(__pyx_k__C), 0, 0, 1, 1},
31224 {&__pyx_n_s__CL, __pyx_k__CL, sizeof(__pyx_k__CL), 0, 0, 1, 1},
31225 {&__pyx_n_s__CN, __pyx_k__CN, sizeof(__pyx_k__CN), 0, 0, 1, 1},
31226 {&__pyx_n_s__CO, __pyx_k__CO, sizeof(__pyx_k__CO), 0, 0, 1, 1},
31227 {&__pyx_n_s__D, __pyx_k__D, sizeof(__pyx_k__D), 0, 0, 1, 1},
31228 {&__pyx_n_s__DS, __pyx_k__DS, sizeof(__pyx_k__DS), 0, 0, 1, 1},
31229 {&__pyx_n_s__DT, __pyx_k__DT, sizeof(__pyx_k__DT), 0, 0, 1, 1},
31230 {&__pyx_n_s__DictType, __pyx_k__DictType, sizeof(__pyx_k__DictType), 0, 0, 1, 1},
31231 {&__pyx_n_s__F, __pyx_k__F, sizeof(__pyx_k__F), 0, 0, 1, 1},
31232 {&__pyx_n_s__Fastafile, __pyx_k__Fastafile, sizeof(__pyx_k__Fastafile), 0, 0, 1, 1},
31233 {&__pyx_n_s__FloatType, __pyx_k__FloatType, sizeof(__pyx_k__FloatType), 0, 0, 1, 1},
31234 {&__pyx_n_s__GO, __pyx_k__GO, sizeof(__pyx_k__GO), 0, 0, 1, 1},
31235 {&__pyx_n_s__HD, __pyx_k__HD, sizeof(__pyx_k__HD), 0, 0, 1, 1},
31236 {&__pyx_n_s__I, __pyx_k__I, sizeof(__pyx_k__I), 0, 0, 1, 1},
31237 {&__pyx_n_s__ID, __pyx_k__ID, sizeof(__pyx_k__ID), 0, 0, 1, 1},
31238 {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1},
31239 {&__pyx_n_s__IndexedReads, __pyx_k__IndexedReads, sizeof(__pyx_k__IndexedReads), 0, 0, 1, 1},
31240 {&__pyx_n_s__IntType, __pyx_k__IntType, sizeof(__pyx_k__IntType), 0, 0, 1, 1},
31241 {&__pyx_n_s__IteratorColumn, __pyx_k__IteratorColumn, sizeof(__pyx_k__IteratorColumn), 0, 0, 1, 1},
31242 {&__pyx_n_s__IteratorRow, __pyx_k__IteratorRow, sizeof(__pyx_k__IteratorRow), 0, 0, 1, 1},
31243 {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1},
31244 {&__pyx_n_s__LB, __pyx_k__LB, sizeof(__pyx_k__LB), 0, 0, 1, 1},
31245 {&__pyx_n_s__LN, __pyx_k__LN, sizeof(__pyx_k__LN), 0, 0, 1, 1},
31246 {&__pyx_n_s__M5, __pyx_k__M5, sizeof(__pyx_k__M5), 0, 0, 1, 1},
31247 {&__pyx_n_s__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1},
31248 {&__pyx_n_s__OSError, __pyx_k__OSError, sizeof(__pyx_k__OSError), 0, 0, 1, 1},
31249 {&__pyx_n_s__O_CREAT, __pyx_k__O_CREAT, sizeof(__pyx_k__O_CREAT), 0, 0, 1, 1},
31250 {&__pyx_n_s__O_WRONLY, __pyx_k__O_WRONLY, sizeof(__pyx_k__O_WRONLY), 0, 0, 1, 1},
31251 {&__pyx_n_s__Outs, __pyx_k__Outs, sizeof(__pyx_k__Outs), 0, 0, 1, 1},
31252 {&__pyx_n_s__OverflowError, __pyx_k__OverflowError, sizeof(__pyx_k__OverflowError), 0, 0, 1, 1},
31253 {&__pyx_n_s__PG, __pyx_k__PG, sizeof(__pyx_k__PG), 0, 0, 1, 1},
31254 {&__pyx_n_s__PI, __pyx_k__PI, sizeof(__pyx_k__PI), 0, 0, 1, 1},
31255 {&__pyx_n_s__PL, __pyx_k__PL, sizeof(__pyx_k__PL), 0, 0, 1, 1},
31256 {&__pyx_n_s__PN, __pyx_k__PN, sizeof(__pyx_k__PN), 0, 0, 1, 1},
31257 {&__pyx_n_s__PU, __pyx_k__PU, sizeof(__pyx_k__PU), 0, 0, 1, 1},
31258 {&__pyx_n_s__PileupColumn, __pyx_k__PileupColumn, sizeof(__pyx_k__PileupColumn), 0, 0, 1, 1},
31259 {&__pyx_n_s__PileupProxy, __pyx_k__PileupProxy, sizeof(__pyx_k__PileupProxy), 0, 0, 1, 1},
31260 {&__pyx_n_s__PileupRead, __pyx_k__PileupRead, sizeof(__pyx_k__PileupRead), 0, 0, 1, 1},
31261 {&__pyx_n_s__RG, __pyx_k__RG, sizeof(__pyx_k__RG), 0, 0, 1, 1},
31262 {&__pyx_n_s__S, __pyx_k__S, sizeof(__pyx_k__S), 0, 0, 1, 1},
31263 {&__pyx_n_s__SM, __pyx_k__SM, sizeof(__pyx_k__SM), 0, 0, 1, 1},
31264 {&__pyx_n_s__SN, __pyx_k__SN, sizeof(__pyx_k__SN), 0, 0, 1, 1},
31265 {&__pyx_n_s__SO, __pyx_k__SO, sizeof(__pyx_k__SO), 0, 0, 1, 1},
31266 {&__pyx_n_s__SP, __pyx_k__SP, sizeof(__pyx_k__SP), 0, 0, 1, 1},
31267 {&__pyx_n_s__SQ, __pyx_k__SQ, sizeof(__pyx_k__SQ), 0, 0, 1, 1},
31268 {&__pyx_n_s__Samfile, __pyx_k__Samfile, sizeof(__pyx_k__Samfile), 0, 0, 1, 1},
31269 {&__pyx_n_s__StderrStore, __pyx_k__StderrStore, sizeof(__pyx_k__StderrStore), 0, 0, 1, 1},
31270 {&__pyx_n_s__StderrStoreWindows, __pyx_k__StderrStoreWindows, sizeof(__pyx_k__StderrStoreWindows), 0, 0, 1, 1},
31271 {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1},
31272 {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
31273 {&__pyx_n_s__UR, __pyx_k__UR, sizeof(__pyx_k__UR), 0, 0, 1, 1},
31274 {&__pyx_n_s__VALID_HEADERS, __pyx_k__VALID_HEADERS, sizeof(__pyx_k__VALID_HEADERS), 0, 0, 1, 1},
31275 {&__pyx_n_s__VALID_HEADER_FIELDS, __pyx_k__VALID_HEADER_FIELDS, sizeof(__pyx_k__VALID_HEADER_FIELDS), 0, 0, 1, 1},
31276 {&__pyx_n_s__VALID_HEADER_ORDER, __pyx_k__VALID_HEADER_ORDER, sizeof(__pyx_k__VALID_HEADER_ORDER), 0, 0, 1, 1},
31277 {&__pyx_n_s__VALID_HEADER_TYPES, __pyx_k__VALID_HEADER_TYPES, sizeof(__pyx_k__VALID_HEADER_TYPES), 0, 0, 1, 1},
31278 {&__pyx_n_s__VN, __pyx_k__VN, sizeof(__pyx_k__VN), 0, 0, 1, 1},
31279 {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
31280 {&__pyx_n_s__Windows, __pyx_k__Windows, sizeof(__pyx_k__Windows), 0, 0, 1, 1},
31281 {&__pyx_n_s__Z, __pyx_k__Z, sizeof(__pyx_k__Z), 0, 0, 1, 1},
31282 {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1},
31283 {&__pyx_n_s____del__, __pyx_k____del__, sizeof(__pyx_k____del__), 0, 0, 1, 1},
31284 {&__pyx_n_s____dict__, __pyx_k____dict__, sizeof(__pyx_k____dict__), 0, 0, 1, 1},
31285 {&__pyx_n_s____getattribute__, __pyx_k____getattribute__, sizeof(__pyx_k____getattribute__), 0, 0, 1, 1},
31286 {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
31287 {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
31288 {&__pyx_n_s____str__, __pyx_k____str__, sizeof(__pyx_k____str__), 0, 0, 1, 1},
31289 {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
31290 {&__pyx_n_s___alignment, __pyx_k___alignment, sizeof(__pyx_k___alignment), 0, 0, 1, 1},
31291 {&__pyx_n_s___buildHeader, __pyx_k___buildHeader, sizeof(__pyx_k___buildHeader), 0, 0, 1, 1},
31292 {&__pyx_n_s___buildLine, __pyx_k___buildLine, sizeof(__pyx_k___buildLine), 0, 0, 1, 1},
31293 {&__pyx_n_s___consensus_quality, __pyx_k___consensus_quality, sizeof(__pyx_k___consensus_quality), 0, 0, 1, 1},
31294 {&__pyx_n_s___coverage, __pyx_k___coverage, sizeof(__pyx_k___coverage), 0, 0, 1, 1},
31295 {&__pyx_n_s___delegate, __pyx_k___delegate, sizeof(__pyx_k___delegate), 0, 0, 1, 1},
31296 {&__pyx_n_s___filename, __pyx_k___filename, sizeof(__pyx_k___filename), 0, 0, 1, 1},
31297 {&__pyx_n_s___genotype, __pyx_k___genotype, sizeof(__pyx_k___genotype), 0, 0, 1, 1},
31298 {&__pyx_n_s___hasIndex, __pyx_k___hasIndex, sizeof(__pyx_k___hasIndex), 0, 0, 1, 1},
31299 {&__pyx_n_s___indel, __pyx_k___indel, sizeof(__pyx_k___indel), 0, 0, 1, 1},
31300 {&__pyx_n_s___isOpen, __pyx_k___isOpen, sizeof(__pyx_k___isOpen), 0, 0, 1, 1},
31301 {&__pyx_n_s___is_del, __pyx_k___is_del, sizeof(__pyx_k___is_del), 0, 0, 1, 1},
31302 {&__pyx_n_s___is_head, __pyx_k___is_head, sizeof(__pyx_k___is_head), 0, 0, 1, 1},
31303 {&__pyx_n_s___is_tail, __pyx_k___is_tail, sizeof(__pyx_k___is_tail), 0, 0, 1, 1},
31304 {&__pyx_n_s___level, __pyx_k___level, sizeof(__pyx_k___level), 0, 0, 1, 1},
31305 {&__pyx_n_s___logfile, __pyx_k___logfile, sizeof(__pyx_k___logfile), 0, 0, 1, 1},
31306 {&__pyx_n_s___open, __pyx_k___open, sizeof(__pyx_k___open), 0, 0, 1, 1},
31307 {&__pyx_n_s___parseRegion, __pyx_k___parseRegion, sizeof(__pyx_k___parseRegion), 0, 0, 1, 1},
31308 {&__pyx_n_s___pos, __pyx_k___pos, sizeof(__pyx_k___pos), 0, 0, 1, 1},
31309 {&__pyx_n_s___qpos, __pyx_k___qpos, sizeof(__pyx_k___qpos), 0, 0, 1, 1},
31310 {&__pyx_n_s___reference_base, __pyx_k___reference_base, sizeof(__pyx_k___reference_base), 0, 0, 1, 1},
31311 {&__pyx_n_s___samtools_dispatch, __pyx_k___samtools_dispatch, sizeof(__pyx_k___samtools_dispatch), 0, 0, 1, 1},
31312 {&__pyx_n_s___snp_quality, __pyx_k___snp_quality, sizeof(__pyx_k___snp_quality), 0, 0, 1, 1},
31313 {&__pyx_n_s___tid, __pyx_k___tid, sizeof(__pyx_k___tid), 0, 0, 1, 1},
31314 {&__pyx_n_s__add_sq_text, __pyx_k__add_sq_text, sizeof(__pyx_k__add_sq_text), 0, 0, 1, 1},
31315 {&__pyx_n_s__alignment, __pyx_k__alignment, sizeof(__pyx_k__alignment), 0, 0, 1, 1},
31316 {&__pyx_n_s__all, __pyx_k__all, sizeof(__pyx_k__all), 0, 0, 1, 1},
31317 {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1},
31318 {&__pyx_n_s__args, __pyx_k__args, sizeof(__pyx_k__args), 0, 0, 1, 1},
31319 {&__pyx_n_s__b, __pyx_k__b, sizeof(__pyx_k__b), 0, 0, 1, 1},
31320 {&__pyx_n_s__bam, __pyx_k__bam, sizeof(__pyx_k__bam), 0, 0, 1, 1},
31321 {&__pyx_n_s__beg, __pyx_k__beg, sizeof(__pyx_k__beg), 0, 0, 1, 1},
31322 {&__pyx_n_s__bin, __pyx_k__bin, sizeof(__pyx_k__bin), 0, 0, 1, 1},
31323 {&__pyx_n_s__bqual, __pyx_k__bqual, sizeof(__pyx_k__bqual), 0, 0, 1, 1},
31324 {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1},
31325 {&__pyx_n_s__calcsize, __pyx_k__calcsize, sizeof(__pyx_k__calcsize), 0, 0, 1, 1},
31326 {&__pyx_n_s__callback, __pyx_k__callback, sizeof(__pyx_k__callback), 0, 0, 1, 1},
31327 {&__pyx_n_s__catch_stderr, __pyx_k__catch_stderr, sizeof(__pyx_k__catch_stderr), 0, 0, 1, 1},
31328 {&__pyx_n_s__catch_stdout, __pyx_k__catch_stdout, sizeof(__pyx_k__catch_stdout), 0, 0, 1, 1},
31329 {&__pyx_n_s__chr, __pyx_k__chr, sizeof(__pyx_k__chr), 0, 0, 1, 1},
31330 {&__pyx_n_s__cigar, __pyx_k__cigar, sizeof(__pyx_k__cigar), 0, 0, 1, 1},
31331 {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1},
31332 {&__pyx_n_s__cmp, __pyx_k__cmp, sizeof(__pyx_k__cmp), 0, 0, 1, 1},
31333 {&__pyx_n_s__cnext, __pyx_k__cnext, sizeof(__pyx_k__cnext), 0, 0, 1, 1},
31334 {&__pyx_n_s__collections, __pyx_k__collections, sizeof(__pyx_k__collections), 0, 0, 1, 1},
31335 {&__pyx_n_s__consensus_quality, __pyx_k__consensus_quality, sizeof(__pyx_k__consensus_quality), 0, 0, 1, 1},
31336 {&__pyx_n_s__core, __pyx_k__core, sizeof(__pyx_k__core), 0, 0, 1, 1},
31337 {&__pyx_n_s__coverage, __pyx_k__coverage, sizeof(__pyx_k__coverage), 0, 0, 1, 1},
31338 {&__pyx_n_s__csamtools, __pyx_k__csamtools, sizeof(__pyx_k__csamtools), 0, 0, 1, 1},
31339 {&__pyx_n_s__ctypes, __pyx_k__ctypes, sizeof(__pyx_k__ctypes), 0, 0, 1, 1},
31340 {&__pyx_n_s__current_pos, __pyx_k__current_pos, sizeof(__pyx_k__current_pos), 0, 0, 1, 1},
31341 {&__pyx_n_s__d, __pyx_k__d, sizeof(__pyx_k__d), 0, 0, 1, 1},
31342 {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
31343 {&__pyx_n_s__data_len, __pyx_k__data_len, sizeof(__pyx_k__data_len), 0, 0, 1, 1},
31344 {&__pyx_n_s__defaultdict, __pyx_k__defaultdict, sizeof(__pyx_k__defaultdict), 0, 0, 1, 1},
31345 {&__pyx_n_s__devnull, __pyx_k__devnull, sizeof(__pyx_k__devnull), 0, 0, 1, 1},
31346 {&__pyx_n_s__dup, __pyx_k__dup, sizeof(__pyx_k__dup), 0, 0, 1, 1},
31347 {&__pyx_n_s__dup2, __pyx_k__dup2, sizeof(__pyx_k__dup2), 0, 0, 1, 1},
31348 {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1},
31349 {&__pyx_n_s__exc_type, __pyx_k__exc_type, sizeof(__pyx_k__exc_type), 0, 0, 1, 1},
31350 {&__pyx_n_s__exc_value, __pyx_k__exc_value, sizeof(__pyx_k__exc_value), 0, 0, 1, 1},
31351 {&__pyx_n_s__exists, __pyx_k__exists, sizeof(__pyx_k__exists), 0, 0, 1, 1},
31352 {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1},
31353 {&__pyx_n_s__fastafile, __pyx_k__fastafile, sizeof(__pyx_k__fastafile), 0, 0, 1, 1},
31354 {&__pyx_n_s__fd, __pyx_k__fd, sizeof(__pyx_k__fd), 0, 0, 1, 1},
31355 {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1},
31356 {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1},
31357 {&__pyx_n_s__fileno, __pyx_k__fileno, sizeof(__pyx_k__fileno), 0, 0, 1, 1},
31358 {&__pyx_n_s__flag, __pyx_k__flag, sizeof(__pyx_k__flag), 0, 0, 1, 1},
31359 {&__pyx_n_s__flush, __pyx_k__flush, sizeof(__pyx_k__flush), 0, 0, 1, 1},
31360 {&__pyx_n_s__fp, __pyx_k__fp, sizeof(__pyx_k__fp), 0, 0, 1, 1},
31361 {&__pyx_n_s__genotype, __pyx_k__genotype, sizeof(__pyx_k__genotype), 0, 0, 1, 1},
31362 {&__pyx_n_s__gettid, __pyx_k__gettid, sizeof(__pyx_k__gettid), 0, 0, 1, 1},
31363 {&__pyx_n_s__hash, __pyx_k__hash, sizeof(__pyx_k__hash), 0, 0, 1, 1},
31364 {&__pyx_n_s__header, __pyx_k__header, sizeof(__pyx_k__header), 0, 0, 1, 1},
31365 {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
31366 {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1},
31367 {&__pyx_n_s__indel, __pyx_k__indel, sizeof(__pyx_k__indel), 0, 0, 1, 1},
31368 {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1},
31369 {&__pyx_n_s__is_del, __pyx_k__is_del, sizeof(__pyx_k__is_del), 0, 0, 1, 1},
31370 {&__pyx_n_s__is_head, __pyx_k__is_head, sizeof(__pyx_k__is_head), 0, 0, 1, 1},
31371 {&__pyx_n_s__is_tail, __pyx_k__is_tail, sizeof(__pyx_k__is_tail), 0, 0, 1, 1},
31372 {&__pyx_n_s__isbam, __pyx_k__isbam, sizeof(__pyx_k__isbam), 0, 0, 1, 1},
31373 {&__pyx_n_s__isize, __pyx_k__isize, sizeof(__pyx_k__isize), 0, 0, 1, 1},
31374 {&__pyx_n_s__isremote, __pyx_k__isremote, sizeof(__pyx_k__isremote), 0, 0, 1, 1},
31375 {&__pyx_n_s__isstream, __pyx_k__isstream, sizeof(__pyx_k__isstream), 0, 0, 1, 1},
31376 {&__pyx_n_s__isupper, __pyx_k__isupper, sizeof(__pyx_k__isupper), 0, 0, 1, 1},
31377 {&__pyx_n_s__iter, __pyx_k__iter, sizeof(__pyx_k__iter), 0, 0, 1, 1},
31378 {&__pyx_n_s__iterdata, __pyx_k__iterdata, sizeof(__pyx_k__iterdata), 0, 0, 1, 1},
31379 {&__pyx_n_s__itertools, __pyx_k__itertools, sizeof(__pyx_k__itertools), 0, 0, 1, 1},
31380 {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1},
31381 {&__pyx_n_s__l_aux, __pyx_k__l_aux, sizeof(__pyx_k__l_aux), 0, 0, 1, 1},
31382 {&__pyx_n_s__l_qname, __pyx_k__l_qname, sizeof(__pyx_k__l_qname), 0, 0, 1, 1},
31383 {&__pyx_n_s__l_qseq, __pyx_k__l_qseq, sizeof(__pyx_k__l_qseq), 0, 0, 1, 1},
31384 {&__pyx_n_s__l_text, __pyx_k__l_text, sizeof(__pyx_k__l_text), 0, 0, 1, 1},
31385 {&__pyx_n_s__level, __pyx_k__level, sizeof(__pyx_k__level), 0, 0, 1, 1},
31386 {&__pyx_n_s__m_data, __pyx_k__m_data, sizeof(__pyx_k__m_data), 0, 0, 1, 1},
31387 {&__pyx_n_s__map, __pyx_k__map, sizeof(__pyx_k__map), 0, 0, 1, 1},
31388 {&__pyx_n_s__mapping_quality, __pyx_k__mapping_quality, sizeof(__pyx_k__mapping_quality), 0, 0, 1, 1},
31389 {&__pyx_n_s__mapq, __pyx_k__mapq, sizeof(__pyx_k__mapq), 0, 0, 1, 1},
31390 {&__pyx_n_s__mask, __pyx_k__mask, sizeof(__pyx_k__mask), 0, 0, 1, 1},
31391 {&__pyx_n_s__mate, __pyx_k__mate, sizeof(__pyx_k__mate), 0, 0, 1, 1},
31392 {&__pyx_n_s__max_depth, __pyx_k__max_depth, sizeof(__pyx_k__max_depth), 0, 0, 1, 1},
31393 {&__pyx_n_s__method, __pyx_k__method, sizeof(__pyx_k__method), 0, 0, 1, 1},
31394 {&__pyx_n_s__mkstemp, __pyx_k__mkstemp, sizeof(__pyx_k__mkstemp), 0, 0, 1, 1},
31395 {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1},
31396 {&__pyx_n_s__mpos, __pyx_k__mpos, sizeof(__pyx_k__mpos), 0, 0, 1, 1},
31397 {&__pyx_n_s__mrnm, __pyx_k__mrnm, sizeof(__pyx_k__mrnm), 0, 0, 1, 1},
31398 {&__pyx_n_s__mtid, __pyx_k__mtid, sizeof(__pyx_k__mtid), 0, 0, 1, 1},
31399 {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1},
31400 {&__pyx_n_s__n_cigar, __pyx_k__n_cigar, sizeof(__pyx_k__n_cigar), 0, 0, 1, 1},
31401 {&__pyx_n_s__n_plp, __pyx_k__n_plp, sizeof(__pyx_k__n_plp), 0, 0, 1, 1},
31402 {&__pyx_n_s__n_pu, __pyx_k__n_pu, sizeof(__pyx_k__n_pu), 0, 0, 1, 1},
31403 {&__pyx_n_s__n_targets, __pyx_k__n_targets, sizeof(__pyx_k__n_targets), 0, 0, 1, 1},
31404 {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
31405 {&__pyx_n_s__nextiter, __pyx_k__nextiter, sizeof(__pyx_k__nextiter), 0, 0, 1, 1},
31406 {&__pyx_n_s__nreferences, __pyx_k__nreferences, sizeof(__pyx_k__nreferences), 0, 0, 1, 1},
31407 {&__pyx_n_s__object, __pyx_k__object, sizeof(__pyx_k__object), 0, 0, 1, 1},
31408 {&__pyx_n_s__offset, __pyx_k__offset, sizeof(__pyx_k__offset), 0, 0, 1, 1},
31409 {&__pyx_n_s__open, __pyx_k__open, sizeof(__pyx_k__open), 0, 0, 1, 1},
31410 {&__pyx_n_s__os, __pyx_k__os, sizeof(__pyx_k__os), 0, 0, 1, 1},
31411 {&__pyx_n_s__owns_samfile, __pyx_k__owns_samfile, sizeof(__pyx_k__owns_samfile), 0, 0, 1, 1},
31412 {&__pyx_n_s__pack_into, __pyx_k__pack_into, sizeof(__pyx_k__pack_into), 0, 0, 1, 1},
31413 {&__pyx_n_s__path, __pyx_k__path, sizeof(__pyx_k__path), 0, 0, 1, 1},
31414 {&__pyx_n_s__pileup_iter, __pyx_k__pileup_iter, sizeof(__pyx_k__pileup_iter), 0, 0, 1, 1},
31415 {&__pyx_n_s__pileups, __pyx_k__pileups, sizeof(__pyx_k__pileups), 0, 0, 1, 1},
31416 {&__pyx_n_s__platform, __pyx_k__platform, sizeof(__pyx_k__platform), 0, 0, 1, 1},
31417 {&__pyx_n_s__plp, __pyx_k__plp, sizeof(__pyx_k__plp), 0, 0, 1, 1},
31418 {&__pyx_n_s__port, __pyx_k__port, sizeof(__pyx_k__port), 0, 0, 1, 1},
31419 {&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1},
31420 {&__pyx_n_s__positions, __pyx_k__positions, sizeof(__pyx_k__positions), 0, 0, 1, 1},
31421 {&__pyx_n_s__qname, __pyx_k__qname, sizeof(__pyx_k__qname), 0, 0, 1, 1},
31422 {&__pyx_n_s__qpos, __pyx_k__qpos, sizeof(__pyx_k__qpos), 0, 0, 1, 1},
31423 {&__pyx_n_s__qseq, __pyx_k__qseq, sizeof(__pyx_k__qseq), 0, 0, 1, 1},
31424 {&__pyx_n_s__qual, __pyx_k__qual, sizeof(__pyx_k__qual), 0, 0, 1, 1},
31425 {&__pyx_n_s__r, __pyx_k__r, sizeof(__pyx_k__r), 0, 0, 1, 1},
31426 {&__pyx_n_s__rU, __pyx_k__rU, sizeof(__pyx_k__rU), 0, 0, 1, 1},
31427 {&__pyx_n_s__raw, __pyx_k__raw, sizeof(__pyx_k__raw), 0, 0, 1, 1},
31428 {&__pyx_n_s__rb, __pyx_k__rb, sizeof(__pyx_k__rb), 0, 0, 1, 1},
31429 {&__pyx_n_s__re, __pyx_k__re, sizeof(__pyx_k__re), 0, 0, 1, 1},
31430 {&__pyx_n_s__readAndRelease, __pyx_k__readAndRelease, sizeof(__pyx_k__readAndRelease), 0, 0, 1, 1},
31431 {&__pyx_n_s__readlines, __pyx_k__readlines, sizeof(__pyx_k__readlines), 0, 0, 1, 1},
31432 {&__pyx_n_s__record, __pyx_k__record, sizeof(__pyx_k__record), 0, 0, 1, 1},
31433 {&__pyx_n_s__reference, __pyx_k__reference, sizeof(__pyx_k__reference), 0, 0, 1, 1},
31434 {&__pyx_n_s__reference_base, __pyx_k__reference_base, sizeof(__pyx_k__reference_base), 0, 0, 1, 1},
31435 {&__pyx_n_s__referencelengths, __pyx_k__referencelengths, sizeof(__pyx_k__referencelengths), 0, 0, 1, 1},
31436 {&__pyx_n_s__referencenames, __pyx_k__referencenames, sizeof(__pyx_k__referencenames), 0, 0, 1, 1},
31437 {&__pyx_n_s__region, __pyx_k__region, sizeof(__pyx_k__region), 0, 0, 1, 1},
31438 {&__pyx_n_s__release, __pyx_k__release, sizeof(__pyx_k__release), 0, 0, 1, 1},
31439 {&__pyx_n_s__remove, __pyx_k__remove, sizeof(__pyx_k__remove), 0, 0, 1, 1},
31440 {&__pyx_n_s__reopen, __pyx_k__reopen, sizeof(__pyx_k__reopen), 0, 0, 1, 1},
31441 {&__pyx_n_s__restore, __pyx_k__restore, sizeof(__pyx_k__restore), 0, 0, 1, 1},
31442 {&__pyx_n_s__retval, __pyx_k__retval, sizeof(__pyx_k__retval), 0, 0, 1, 1},
31443 {&__pyx_n_s__rg2lib, __pyx_k__rg2lib, sizeof(__pyx_k__rg2lib), 0, 0, 1, 1},
31444 {&__pyx_n_s__rlen, __pyx_k__rlen, sizeof(__pyx_k__rlen), 0, 0, 1, 1},
31445 {&__pyx_n_s__rname, __pyx_k__rname, sizeof(__pyx_k__rname), 0, 0, 1, 1},
31446 {&__pyx_n_s__rowiter, __pyx_k__rowiter, sizeof(__pyx_k__rowiter), 0, 0, 1, 1},
31447 {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1},
31448 {&__pyx_n_s__samfile, __pyx_k__samfile, sizeof(__pyx_k__samfile), 0, 0, 1, 1},
31449 {&__pyx_n_s__samtools, __pyx_k__samtools, sizeof(__pyx_k__samtools), 0, 0, 1, 1},
31450 {&__pyx_n_s__seek, __pyx_k__seek, sizeof(__pyx_k__seek), 0, 0, 1, 1},
31451 {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
31452 {&__pyx_n_s__seq, __pyx_k__seq, sizeof(__pyx_k__seq), 0, 0, 1, 1},
31453 {&__pyx_n_s__seq_len, __pyx_k__seq_len, sizeof(__pyx_k__seq_len), 0, 0, 1, 1},
31454 {&__pyx_n_s__setdevice, __pyx_k__setdevice, sizeof(__pyx_k__setdevice), 0, 0, 1, 1},
31455 {&__pyx_n_s__setfd, __pyx_k__setfd, sizeof(__pyx_k__setfd), 0, 0, 1, 1},
31456 {&__pyx_n_s__setfile, __pyx_k__setfile, sizeof(__pyx_k__setfile), 0, 0, 1, 1},
31457 {&__pyx_n_s__setupIteratorData, __pyx_k__setupIteratorData, sizeof(__pyx_k__setupIteratorData), 0, 0, 1, 1},
31458 {&__pyx_n_s__snp_quality, __pyx_k__snp_quality, sizeof(__pyx_k__snp_quality), 0, 0, 1, 1},
31459 {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1},
31460 {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1},
31461 {&__pyx_n_s__start_offset, __pyx_k__start_offset, sizeof(__pyx_k__start_offset), 0, 0, 1, 1},
31462 {&__pyx_n_s__startswith, __pyx_k__startswith, sizeof(__pyx_k__startswith), 0, 0, 1, 1},
31463 {&__pyx_n_s__stderr, __pyx_k__stderr, sizeof(__pyx_k__stderr), 0, 0, 1, 1},
31464 {&__pyx_n_s__stderr_f, __pyx_k__stderr_f, sizeof(__pyx_k__stderr_f), 0, 0, 1, 1},
31465 {&__pyx_n_s__stderr_h, __pyx_k__stderr_h, sizeof(__pyx_k__stderr_h), 0, 0, 1, 1},
31466 {&__pyx_n_s__stderr_save, __pyx_k__stderr_save, sizeof(__pyx_k__stderr_save), 0, 0, 1, 1},
31467 {&__pyx_n_s__stdout, __pyx_k__stdout, sizeof(__pyx_k__stdout), 0, 0, 1, 1},
31468 {&__pyx_n_s__stepper, __pyx_k__stepper, sizeof(__pyx_k__stepper), 0, 0, 1, 1},
31469 {&__pyx_n_s__streams, __pyx_k__streams, sizeof(__pyx_k__streams), 0, 0, 1, 1},
31470 {&__pyx_n_s__strip, __pyx_k__strip, sizeof(__pyx_k__strip), 0, 0, 1, 1},
31471 {&__pyx_n_s__struct, __pyx_k__struct, sizeof(__pyx_k__struct), 0, 0, 1, 1},
31472 {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1},
31473 {&__pyx_n_s__system, __pyx_k__system, sizeof(__pyx_k__system), 0, 0, 1, 1},
31474 {&__pyx_n_s__tags, __pyx_k__tags, sizeof(__pyx_k__tags), 0, 0, 1, 1},
31475 {&__pyx_n_s__target_len, __pyx_k__target_len, sizeof(__pyx_k__target_len), 0, 0, 1, 1},
31476 {&__pyx_n_s__target_name, __pyx_k__target_name, sizeof(__pyx_k__target_name), 0, 0, 1, 1},
31477 {&__pyx_n_s__tempfile, __pyx_k__tempfile, sizeof(__pyx_k__tempfile), 0, 0, 1, 1},
31478 {&__pyx_n_s__template, __pyx_k__template, sizeof(__pyx_k__template), 0, 0, 1, 1},
31479 {&__pyx_n_s__text, __pyx_k__text, sizeof(__pyx_k__text), 0, 0, 1, 1},
31480 {&__pyx_n_s__tid, __pyx_k__tid, sizeof(__pyx_k__tid), 0, 0, 1, 1},
31481 {&__pyx_n_s__traceback, __pyx_k__traceback, sizeof(__pyx_k__traceback), 0, 0, 1, 1},
31482 {&__pyx_n_s__types, __pyx_k__types, sizeof(__pyx_k__types), 0, 0, 1, 1},
31483 {&__pyx_n_s__until_eof, __pyx_k__until_eof, sizeof(__pyx_k__until_eof), 0, 0, 1, 1},
31484 {&__pyx_n_s__view, __pyx_k__view, sizeof(__pyx_k__view), 0, 0, 1, 1},
31485 {&__pyx_n_s__w, __pyx_k__w, sizeof(__pyx_k__w), 0, 0, 1, 1},
31486 {&__pyx_n_s__wb, __pyx_k__wb, sizeof(__pyx_k__wb), 0, 0, 1, 1},
31487 {&__pyx_n_s__wbu, __pyx_k__wbu, sizeof(__pyx_k__wbu), 0, 0, 1, 1},
31488 {&__pyx_n_s__wh, __pyx_k__wh, sizeof(__pyx_k__wh), 0, 0, 1, 1},
31489 {&__pyx_n_s__where, __pyx_k__where, sizeof(__pyx_k__where), 0, 0, 1, 1},
31490 {&__pyx_n_s__write, __pyx_k__write, sizeof(__pyx_k__write), 0, 0, 1, 1},
31491 {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1},
31492 {0, 0, 0, 0, 0, 0, 0}
31494 static int __Pyx_InitCachedBuiltins(void) {
31495 __pyx_builtin_open = __Pyx_GetName(__pyx_b, __pyx_n_s__open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31496 __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31497 __pyx_builtin_map = __Pyx_GetName(__pyx_b, __pyx_n_s__map); if (!__pyx_builtin_map) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31498 __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31499 __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31500 __pyx_builtin_OverflowError = __Pyx_GetName(__pyx_b, __pyx_n_s__OverflowError); if (!__pyx_builtin_OverflowError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31501 __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31502 __pyx_builtin_OSError = __Pyx_GetName(__pyx_b, __pyx_n_s__OSError); if (!__pyx_builtin_OSError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31503 __pyx_builtin_AttributeError = __Pyx_GetName(__pyx_b, __pyx_n_s__AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31504 __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31505 __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31506 __pyx_builtin_cmp = __Pyx_GetName(__pyx_b, __pyx_n_s__cmp); if (!__pyx_builtin_cmp) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31507 __pyx_builtin_chr = __Pyx_GetName(__pyx_b, __pyx_n_s__chr); if (!__pyx_builtin_chr) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31508 __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31514 static int __Pyx_InitCachedConstants(void) {
31515 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
31517 /* "csamtools.pyx":271
31518 * def __len__(self):
31519 * if self.fastafile == NULL:
31520 * raise ValueError( "calling len() on closed file" ) # <<<<<<<<<<<<<<
31522 * return faidx_fetch_nseq(self.fastafile)
31524 __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31525 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4));
31526 __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
31527 PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3));
31528 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
31529 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
31531 /* "csamtools.pyx":303
31532 * '''number of :term:`filename` associated with this object.'''
31533 * def __get__(self):
31534 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
31535 * return self._filename
31538 __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31539 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7));
31540 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
31541 PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_s_6));
31542 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
31543 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));
31545 /* "csamtools.pyx":328
31547 * if not self._isOpen():
31548 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
31552 __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31553 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8));
31554 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
31555 PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_6));
31556 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
31557 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));
31559 /* "csamtools.pyx":334
31562 * if reference is None: raise ValueError( 'no sequence/region supplied.' ) # <<<<<<<<<<<<<<
31563 * if start is None: start = 0
31564 * if end is None: end = max_pos -1
31566 __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31567 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10));
31568 __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
31569 PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_s_9));
31570 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
31571 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
31573 /* "csamtools.pyx":636
31574 * returns -1 if reference is not known.
31576 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
31577 * return pysam_reference2tid( self.samfile.header, reference )
31580 __pyx_k_tuple_29 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31581 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_29));
31582 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
31583 PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_kp_s_6));
31584 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
31585 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));
31587 /* "csamtools.pyx":642
31589 * convert numerical :term:`tid` into :term:`reference` name.'''
31590 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
31591 * if not 0 <= tid < self.samfile.header.n_targets:
31592 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
31594 __pyx_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31595 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_30));
31596 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
31597 PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_kp_s_6));
31598 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
31599 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30));
31601 /* "csamtools.pyx":650
31603 * convert numerical :term:`tid` into :term:`reference` name.'''
31604 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
31605 * if not 0 <= tid < self.samfile.header.n_targets:
31606 * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) )
31608 __pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31609 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_32));
31610 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
31611 PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_s_6));
31612 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
31613 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
31615 /* "csamtools.pyx":699
31616 * if len(parts) >= 3: rend = int(parts[2])
31618 * if not reference: return 0, 0, 0, 0 # <<<<<<<<<<<<<<
31620 * rtid = self.gettid( reference )
31622 __pyx_k_tuple_34 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31623 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_34));
31624 __Pyx_INCREF(__pyx_int_0);
31625 PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, __pyx_int_0);
31626 __Pyx_GIVEREF(__pyx_int_0);
31627 __Pyx_INCREF(__pyx_int_0);
31628 PyTuple_SET_ITEM(__pyx_k_tuple_34, 1, __pyx_int_0);
31629 __Pyx_GIVEREF(__pyx_int_0);
31630 __Pyx_INCREF(__pyx_int_0);
31631 PyTuple_SET_ITEM(__pyx_k_tuple_34, 2, __pyx_int_0);
31632 __Pyx_GIVEREF(__pyx_int_0);
31633 __Pyx_INCREF(__pyx_int_0);
31634 PyTuple_SET_ITEM(__pyx_k_tuple_34, 3, __pyx_int_0);
31635 __Pyx_GIVEREF(__pyx_int_0);
31636 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
31638 /* "csamtools.pyx":719
31640 * if not self._isOpen():
31641 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
31642 * if not self.isbam:
31643 * raise NotImplementedError("seek only available in bam files")
31645 __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31646 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_37));
31647 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
31648 PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_kp_s_6));
31649 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
31650 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));
31652 /* "csamtools.pyx":721
31653 * raise ValueError( "I/O operation on closed file" )
31654 * if not self.isbam:
31655 * raise NotImplementedError("seek only available in bam files") # <<<<<<<<<<<<<<
31656 * if self.isstream:
31657 * raise OSError("seek no available in streams")
31659 __pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31660 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_39));
31661 __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
31662 PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_kp_s_38));
31663 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
31664 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39));
31666 /* "csamtools.pyx":723
31667 * raise NotImplementedError("seek only available in bam files")
31668 * if self.isstream:
31669 * raise OSError("seek no available in streams") # <<<<<<<<<<<<<<
31671 * return bam_seek( self.samfile.x.bam, offset, where )
31673 __pyx_k_tuple_41 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31674 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_41));
31675 __Pyx_INCREF(((PyObject *)__pyx_kp_s_40));
31676 PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_kp_s_40));
31677 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40));
31678 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41));
31680 /* "csamtools.pyx":732
31682 * if not self._isOpen():
31683 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
31684 * if not self.isbam:
31685 * raise NotImplementedError("seek only available in bam files")
31687 __pyx_k_tuple_42 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31688 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_42));
31689 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
31690 PyTuple_SET_ITEM(__pyx_k_tuple_42, 0, ((PyObject *)__pyx_kp_s_6));
31691 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
31692 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));
31694 /* "csamtools.pyx":734
31695 * raise ValueError( "I/O operation on closed file" )
31696 * if not self.isbam:
31697 * raise NotImplementedError("seek only available in bam files") # <<<<<<<<<<<<<<
31699 * return bam_tell( self.samfile.x.bam )
31701 __pyx_k_tuple_43 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31702 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_43));
31703 __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
31704 PyTuple_SET_ITEM(__pyx_k_tuple_43, 0, ((PyObject *)__pyx_kp_s_38));
31705 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
31706 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43));
31708 /* "csamtools.pyx":769
31710 * if not self._isOpen():
31711 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
31713 * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
31715 __pyx_k_tuple_45 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31716 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_45));
31717 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
31718 PyTuple_SET_ITEM(__pyx_k_tuple_45, 0, ((PyObject *)__pyx_kp_s_6));
31719 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
31720 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45));
31722 /* "csamtools.pyx":778
31724 * if not until_eof and not self._hasIndex() and not self.isremote:
31725 * raise ValueError( "fetch called on bamfile without index" ) # <<<<<<<<<<<<<<
31729 __pyx_k_tuple_47 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31730 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_47));
31731 __Pyx_INCREF(((PyObject *)__pyx_kp_s_46));
31732 PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_kp_s_46));
31733 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_46));
31734 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));
31736 /* "csamtools.pyx":781
31739 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) # <<<<<<<<<<<<<<
31740 * if not self._hasIndex(): raise ValueError( "no index available for fetch" )
31741 * return bam_fetch(self.samfile.x.bam,
31743 __pyx_k_tuple_49 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31744 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_49));
31745 __Pyx_INCREF(((PyObject *)__pyx_kp_s_48));
31746 PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, ((PyObject *)__pyx_kp_s_48));
31747 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48));
31748 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));
31750 /* "csamtools.pyx":782
31752 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" )
31753 * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) # <<<<<<<<<<<<<<
31754 * return bam_fetch(self.samfile.x.bam,
31757 __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31758 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_51));
31759 __Pyx_INCREF(((PyObject *)__pyx_kp_s_50));
31760 PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, ((PyObject *)__pyx_kp_s_50));
31761 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_50));
31762 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));
31764 /* "csamtools.pyx":803
31765 * # this happens if a bamfile is opened with mode 'r'
31767 * raise ValueError ("fetching by region is not available for sam files" ) # <<<<<<<<<<<<<<
31769 * if self.samfile.header.n_targets == 0:
31771 __pyx_k_tuple_53 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31772 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_53));
31773 __Pyx_INCREF(((PyObject *)__pyx_kp_s_52));
31774 PyTuple_SET_ITEM(__pyx_k_tuple_53, 0, ((PyObject *)__pyx_kp_s_52));
31775 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_52));
31776 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));
31778 /* "csamtools.pyx":806
31780 * if self.samfile.header.n_targets == 0:
31781 * raise ValueError( "fetch called for samfile without header") # <<<<<<<<<<<<<<
31785 __pyx_k_tuple_55 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31786 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_55));
31787 __Pyx_INCREF(((PyObject *)__pyx_kp_s_54));
31788 PyTuple_SET_ITEM(__pyx_k_tuple_55, 0, ((PyObject *)__pyx_kp_s_54));
31789 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_54));
31790 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
31792 /* "csamtools.pyx":809
31795 * raise NotImplementedError( "callback not implemented yet" ) # <<<<<<<<<<<<<<
31797 * return IteratorRowAll( self, reopen=reopen )
31799 __pyx_k_tuple_57 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31800 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_57));
31801 __Pyx_INCREF(((PyObject *)__pyx_kp_s_56));
31802 PyTuple_SET_ITEM(__pyx_k_tuple_57, 0, ((PyObject *)__pyx_kp_s_56));
31803 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_56));
31804 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));
31806 /* "csamtools.pyx":850
31808 * if mate_data.mate == NULL:
31809 * raise ValueError( "mate not found" ) # <<<<<<<<<<<<<<
31811 * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead)
31813 __pyx_k_tuple_61 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31814 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_61));
31815 __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
31816 PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, ((PyObject *)__pyx_kp_s_60));
31817 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
31818 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));
31820 /* "csamtools.pyx":875
31822 * if not self._isOpen():
31823 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
31825 * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
31827 __pyx_k_tuple_63 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31828 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_63));
31829 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
31830 PyTuple_SET_ITEM(__pyx_k_tuple_63, 0, ((PyObject *)__pyx_kp_s_6));
31831 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
31832 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));
31834 /* "csamtools.pyx":884
31836 * if not until_eof and not self._hasIndex() and not self.isremote:
31837 * raise ValueError( "fetch called on bamfile without index" ) # <<<<<<<<<<<<<<
31841 __pyx_k_tuple_64 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31842 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_64));
31843 __Pyx_INCREF(((PyObject *)__pyx_kp_s_46));
31844 PyTuple_SET_ITEM(__pyx_k_tuple_64, 0, ((PyObject *)__pyx_kp_s_46));
31845 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_46));
31846 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64));
31848 /* "csamtools.pyx":887
31851 * raise ValueError( "counting functionality requires a region/reference" ) # <<<<<<<<<<<<<<
31852 * if not self._hasIndex(): raise ValueError( "no index available for fetch" )
31853 * bam_fetch(self.samfile.x.bam,
31855 __pyx_k_tuple_66 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31856 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_66));
31857 __Pyx_INCREF(((PyObject *)__pyx_kp_s_65));
31858 PyTuple_SET_ITEM(__pyx_k_tuple_66, 0, ((PyObject *)__pyx_kp_s_65));
31859 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_65));
31860 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66));
31862 /* "csamtools.pyx":888
31864 * raise ValueError( "counting functionality requires a region/reference" )
31865 * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) # <<<<<<<<<<<<<<
31866 * bam_fetch(self.samfile.x.bam,
31869 __pyx_k_tuple_67 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31870 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_67));
31871 __Pyx_INCREF(((PyObject *)__pyx_kp_s_50));
31872 PyTuple_SET_ITEM(__pyx_k_tuple_67, 0, ((PyObject *)__pyx_kp_s_50));
31873 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_50));
31874 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67));
31876 /* "csamtools.pyx":898
31879 * raise ValueError ("count for a region is not available for sam files" ) # <<<<<<<<<<<<<<
31881 * def pileup( self,
31883 __pyx_k_tuple_69 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31884 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_69));
31885 __Pyx_INCREF(((PyObject *)__pyx_kp_s_68));
31886 PyTuple_SET_ITEM(__pyx_k_tuple_69, 0, ((PyObject *)__pyx_kp_s_68));
31887 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_68));
31888 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_69));
31890 /* "csamtools.pyx":952
31892 * if not self._isOpen():
31893 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
31895 * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
31897 __pyx_k_tuple_70 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31898 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_70));
31899 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
31900 PyTuple_SET_ITEM(__pyx_k_tuple_70, 0, ((PyObject *)__pyx_kp_s_6));
31901 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
31902 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70));
31904 /* "csamtools.pyx":957
31907 * if not self._hasIndex(): raise ValueError( "no index available for pileup" ) # <<<<<<<<<<<<<<
31911 __pyx_k_tuple_72 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31912 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_72));
31913 __Pyx_INCREF(((PyObject *)__pyx_kp_s_71));
31914 PyTuple_SET_ITEM(__pyx_k_tuple_72, 0, ((PyObject *)__pyx_kp_s_71));
31915 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_71));
31916 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_72));
31918 /* "csamtools.pyx":960
31921 * if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) # <<<<<<<<<<<<<<
31923 * buf = bam_plbuf_init( <bam_pileup_f>pileup_callback, <void*>callback )
31925 __pyx_k_tuple_73 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31926 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_73));
31927 __Pyx_INCREF(((PyObject *)__pyx_kp_s_48));
31928 PyTuple_SET_ITEM(__pyx_k_tuple_73, 0, ((PyObject *)__pyx_kp_s_48));
31929 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48));
31930 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_73));
31932 /* "csamtools.pyx":981
31935 * raise NotImplementedError( "pileup of samfiles not implemented yet" ) # <<<<<<<<<<<<<<
31937 * def close( self ):
31939 __pyx_k_tuple_75 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31940 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_75));
31941 __Pyx_INCREF(((PyObject *)__pyx_kp_s_74));
31942 PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, ((PyObject *)__pyx_kp_s_74));
31943 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_74));
31944 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75));
31946 /* "csamtools.pyx":1025
31947 * '''number of :term:`filename` associated with this object.'''
31948 * def __get__(self):
31949 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
31950 * return self._filename
31953 __pyx_k_tuple_76 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31954 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_76));
31955 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
31956 PyTuple_SET_ITEM(__pyx_k_tuple_76, 0, ((PyObject *)__pyx_kp_s_6));
31957 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
31958 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_76));
31960 /* "csamtools.pyx":1031
31961 * '''number of :term:`reference` sequences in the file.'''
31962 * def __get__(self):
31963 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
31964 * return self.samfile.header.n_targets
31967 __pyx_k_tuple_77 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31968 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_77));
31969 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
31970 PyTuple_SET_ITEM(__pyx_k_tuple_77, 0, ((PyObject *)__pyx_kp_s_6));
31971 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
31972 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77));
31974 /* "csamtools.pyx":1037
31975 * """tuple with the names of :term:`reference` sequences."""
31976 * def __get__(self):
31977 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
31979 * for x from 0 <= x < self.samfile.header.n_targets:
31981 __pyx_k_tuple_78 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31982 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_78));
31983 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
31984 PyTuple_SET_ITEM(__pyx_k_tuple_78, 0, ((PyObject *)__pyx_kp_s_6));
31985 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
31986 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_78));
31988 /* "csamtools.pyx":1048
31990 * def __get__(self):
31991 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
31993 * for x from 0 <= x < self.samfile.header.n_targets:
31995 __pyx_k_tuple_79 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
31996 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_79));
31997 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
31998 PyTuple_SET_ITEM(__pyx_k_tuple_79, 0, ((PyObject *)__pyx_kp_s_6));
31999 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
32000 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_79));
32002 /* "csamtools.pyx":1058
32004 * def __get__(self):
32005 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
32006 * if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" )
32009 __pyx_k_tuple_80 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32010 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_80));
32011 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
32012 PyTuple_SET_ITEM(__pyx_k_tuple_80, 0, ((PyObject *)__pyx_kp_s_6));
32013 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
32014 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_80));
32016 /* "csamtools.pyx":1059
32017 * def __get__(self):
32018 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
32019 * if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" ) # <<<<<<<<<<<<<<
32023 __pyx_k_tuple_82 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32024 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_82));
32025 __Pyx_INCREF(((PyObject *)__pyx_kp_s_81));
32026 PyTuple_SET_ITEM(__pyx_k_tuple_82, 0, ((PyObject *)__pyx_kp_s_81));
32027 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_81));
32028 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_82));
32030 /* "csamtools.pyx":1071
32032 * def __get__(self):
32033 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
32034 * if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" )
32037 __pyx_k_tuple_83 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32038 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_83));
32039 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
32040 PyTuple_SET_ITEM(__pyx_k_tuple_83, 0, ((PyObject *)__pyx_kp_s_6));
32041 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
32042 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_83));
32044 /* "csamtools.pyx":1072
32045 * def __get__(self):
32046 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
32047 * if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" ) # <<<<<<<<<<<<<<
32049 * cdef uint32_t total = 0
32051 __pyx_k_tuple_85 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_85)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32052 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_85));
32053 __Pyx_INCREF(((PyObject *)__pyx_kp_s_84));
32054 PyTuple_SET_ITEM(__pyx_k_tuple_85, 0, ((PyObject *)__pyx_kp_s_84));
32055 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_84));
32056 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_85));
32058 /* "csamtools.pyx":1084
32059 * '''full contents of the :term:`sam file` header as a string.'''
32060 * def __get__(self):
32061 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
32062 * return PyString_FromStringAndSize(self.samfile.header.text, self.samfile.header.l_text)
32065 __pyx_k_tuple_86 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_86)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32066 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_86));
32067 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
32068 PyTuple_SET_ITEM(__pyx_k_tuple_86, 0, ((PyObject *)__pyx_kp_s_6));
32069 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
32070 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_86));
32072 /* "csamtools.pyx":1092
32074 * def __get__(self):
32075 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
32079 __pyx_k_tuple_87 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_87)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32080 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_87));
32081 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
32082 PyTuple_SET_ITEM(__pyx_k_tuple_87, 0, ((PyObject *)__pyx_kp_s_6));
32083 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
32084 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_87));
32086 /* "csamtools.pyx":1099
32087 * # convert to python string (note: call self.text to create 0-terminated string)
32089 * for line in t.split("\n"): # <<<<<<<<<<<<<<
32090 * if not line.strip(): continue
32091 * assert line.startswith("@"), "header line without '@': '%s'" % line
32093 __pyx_k_tuple_88 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32094 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_88));
32095 __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
32096 PyTuple_SET_ITEM(__pyx_k_tuple_88, 0, ((PyObject *)__pyx_kp_s_2));
32097 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
32098 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_88));
32100 /* "csamtools.pyx":1101
32101 * for line in t.split("\n"):
32102 * if not line.strip(): continue
32103 * assert line.startswith("@"), "header line without '@': '%s'" % line # <<<<<<<<<<<<<<
32104 * fields = line[1:].split("\t")
32105 * record = fields[0]
32107 __pyx_k_tuple_90 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32108 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_90));
32109 __Pyx_INCREF(((PyObject *)__pyx_kp_s_89));
32110 PyTuple_SET_ITEM(__pyx_k_tuple_90, 0, ((PyObject *)__pyx_kp_s_89));
32111 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_89));
32112 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_90));
32114 /* "csamtools.pyx":1102
32115 * if not line.strip(): continue
32116 * assert line.startswith("@"), "header line without '@': '%s'" % line
32117 * fields = line[1:].split("\t") # <<<<<<<<<<<<<<
32118 * record = fields[0]
32119 * assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line)
32121 __pyx_k_tuple_92 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32122 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_92));
32123 __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
32124 PyTuple_SET_ITEM(__pyx_k_tuple_92, 0, ((PyObject *)__pyx_kp_s_1));
32125 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
32126 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_92));
32128 /* "csamtools.pyx":1115
32130 * for field in fields[1:]:
32131 * key, value = field.split(":",1) # <<<<<<<<<<<<<<
32132 * # uppercase keys must be valid
32133 * # lowercase are permitted for user fields
32135 __pyx_k_tuple_95 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32136 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_95));
32137 __Pyx_INCREF(((PyObject *)__pyx_kp_s_94));
32138 PyTuple_SET_ITEM(__pyx_k_tuple_95, 0, ((PyObject *)__pyx_kp_s_94));
32139 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_94));
32140 __Pyx_INCREF(__pyx_int_1);
32141 PyTuple_SET_ITEM(__pyx_k_tuple_95, 1, __pyx_int_1);
32142 __Pyx_GIVEREF(__pyx_int_1);
32143 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_95));
32145 /* "csamtools.pyx":1217
32146 * ###############################################################
32147 * def __iter__(self):
32148 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
32149 * if not self.isbam and self.samfile.header.n_targets == 0:
32150 * raise NotImplementedError( "can not iterate over samfile without header")
32152 __pyx_k_tuple_102 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_102)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32153 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_102));
32154 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
32155 PyTuple_SET_ITEM(__pyx_k_tuple_102, 0, ((PyObject *)__pyx_kp_s_6));
32156 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
32157 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_102));
32159 /* "csamtools.pyx":1219
32160 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
32161 * if not self.isbam and self.samfile.header.n_targets == 0:
32162 * raise NotImplementedError( "can not iterate over samfile without header") # <<<<<<<<<<<<<<
32166 __pyx_k_tuple_104 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_104)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32167 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_104));
32168 __Pyx_INCREF(((PyObject *)__pyx_kp_s_103));
32169 PyTuple_SET_ITEM(__pyx_k_tuple_104, 0, ((PyObject *)__pyx_kp_s_103));
32170 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_103));
32171 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_104));
32173 /* "csamtools.pyx":1296
32175 * if not samfile._isOpen():
32176 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
32178 * if not samfile._hasIndex():
32180 __pyx_k_tuple_105 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_105)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32181 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_105));
32182 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
32183 PyTuple_SET_ITEM(__pyx_k_tuple_105, 0, ((PyObject *)__pyx_kp_s_6));
32184 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
32185 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_105));
32187 /* "csamtools.pyx":1299
32189 * if not samfile._hasIndex():
32190 * raise ValueError( "no index available for iteration" ) # <<<<<<<<<<<<<<
32192 * # makes sure that samfile stays alive as long as the
32194 __pyx_k_tuple_107 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32195 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_107));
32196 __Pyx_INCREF(((PyObject *)__pyx_kp_s_106));
32197 PyTuple_SET_ITEM(__pyx_k_tuple_107, 0, ((PyObject *)__pyx_kp_s_106));
32198 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_106));
32199 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_107));
32201 /* "csamtools.pyx":1369
32203 * if not samfile._isOpen():
32204 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
32206 * if samfile.isbam: mode = "rb"
32208 __pyx_k_tuple_108 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_108)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32209 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_108));
32210 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
32211 PyTuple_SET_ITEM(__pyx_k_tuple_108, 0, ((PyObject *)__pyx_kp_s_6));
32212 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
32213 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_108));
32215 /* "csamtools.pyx":1424
32216 * def __cinit__(self, Samfile samfile):
32217 * assert samfile._isOpen()
32218 * if not samfile._hasIndex(): raise ValueError("no index available for fetch") # <<<<<<<<<<<<<<
32219 * self.samfile = samfile
32222 __pyx_k_tuple_109 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_109)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32223 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_109));
32224 __Pyx_INCREF(((PyObject *)__pyx_kp_s_50));
32225 PyTuple_SET_ITEM(__pyx_k_tuple_109, 0, ((PyObject *)__pyx_kp_s_50));
32226 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_50));
32227 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_109));
32229 /* "csamtools.pyx":1477
32231 * if not samfile._isOpen():
32232 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
32234 * if not samfile._isOpen():
32236 __pyx_k_tuple_110 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_110)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32237 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_110));
32238 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
32239 PyTuple_SET_ITEM(__pyx_k_tuple_110, 0, ((PyObject *)__pyx_kp_s_6));
32240 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
32241 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_110));
32243 /* "csamtools.pyx":1480
32245 * if not samfile._isOpen():
32246 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
32248 * assert samfile.isbam, "can only use this iterator on bam files"
32250 __pyx_k_tuple_111 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_111)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32251 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_111));
32252 __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
32253 PyTuple_SET_ITEM(__pyx_k_tuple_111, 0, ((PyObject *)__pyx_kp_s_6));
32254 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
32255 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_111));
32257 /* "csamtools.pyx":1796
32259 * if self.n_plp < 0:
32260 * raise ValueError("error during iteration" ) # <<<<<<<<<<<<<<
32262 * if self.plp == NULL:
32264 __pyx_k_tuple_117 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_117)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32265 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_117));
32266 __Pyx_INCREF(((PyObject *)__pyx_kp_s_116));
32267 PyTuple_SET_ITEM(__pyx_k_tuple_117, 0, ((PyObject *)__pyx_kp_s_116));
32268 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_116));
32269 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_117));
32271 /* "csamtools.pyx":1828
32273 * if self.n_plp < 0:
32274 * raise ValueError("error during iteration" ) # <<<<<<<<<<<<<<
32276 * # return result, if within same reference
32278 __pyx_k_tuple_118 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_118)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32279 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_118));
32280 __Pyx_INCREF(((PyObject *)__pyx_kp_s_116));
32281 PyTuple_SET_ITEM(__pyx_k_tuple_118, 0, ((PyObject *)__pyx_kp_s_116));
32282 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_116));
32283 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_118));
32285 /* "csamtools.pyx":2363
32286 * size = struct.calcsize(fmt)
32287 * if offset + size > max_size:
32288 * raise NotImplementedError("tags field too large") # <<<<<<<<<<<<<<
32290 * struct.pack_into( fmt,
32292 __pyx_k_tuple_134 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_134)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32293 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_134));
32294 __Pyx_INCREF(((PyObject *)__pyx_kp_s_133));
32295 PyTuple_SET_ITEM(__pyx_k_tuple_134, 0, ((PyObject *)__pyx_kp_s_133));
32296 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_133));
32297 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_134));
32299 /* "csamtools.pyx":2710
32301 * def __init__(self):
32302 * raise TypeError("This class cannot be instantiated from Python") # <<<<<<<<<<<<<<
32304 * def __str__(self):
32306 __pyx_k_tuple_158 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_158)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32307 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_158));
32308 __Pyx_INCREF(((PyObject *)__pyx_kp_s_157));
32309 PyTuple_SET_ITEM(__pyx_k_tuple_158, 0, ((PyObject *)__pyx_kp_s_157));
32310 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_157));
32311 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_158));
32313 /* "csamtools.pyx":2754
32315 * def __init__(self):
32316 * raise TypeError("This class cannot be instantiated from Python") # <<<<<<<<<<<<<<
32318 * def __str__(self):
32320 __pyx_k_tuple_159 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_159)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32321 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_159));
32322 __Pyx_INCREF(((PyObject *)__pyx_kp_s_157));
32323 PyTuple_SET_ITEM(__pyx_k_tuple_159, 0, ((PyObject *)__pyx_kp_s_157));
32324 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_157));
32325 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_159));
32327 /* "csamtools.pyx":2867
32328 * # recover. Thus redirect output to file with -o option.
32329 * if method == "view":
32330 * if "-o" in args: raise ValueError("option -o is forbidden in samtools view") # <<<<<<<<<<<<<<
32331 * args = ( "-o", stdout_f ) + args
32334 __pyx_k_tuple_165 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_165)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32335 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_165));
32336 __Pyx_INCREF(((PyObject *)__pyx_kp_s_164));
32337 PyTuple_SET_ITEM(__pyx_k_tuple_165, 0, ((PyObject *)__pyx_kp_s_164));
32338 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_164));
32339 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_165));
32341 /* "csamtools.pyx":224
32343 * # order of records within sam headers
32344 * VALID_HEADERS = ("HD", "SQ", "RG", "PG", "CO" ) # <<<<<<<<<<<<<<
32346 * # type conversions within sam header records
32348 __pyx_k_tuple_233 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_233)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32349 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_233));
32350 __Pyx_INCREF(((PyObject *)__pyx_n_s__HD));
32351 PyTuple_SET_ITEM(__pyx_k_tuple_233, 0, ((PyObject *)__pyx_n_s__HD));
32352 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__HD));
32353 __Pyx_INCREF(((PyObject *)__pyx_n_s__SQ));
32354 PyTuple_SET_ITEM(__pyx_k_tuple_233, 1, ((PyObject *)__pyx_n_s__SQ));
32355 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SQ));
32356 __Pyx_INCREF(((PyObject *)__pyx_n_s__RG));
32357 PyTuple_SET_ITEM(__pyx_k_tuple_233, 2, ((PyObject *)__pyx_n_s__RG));
32358 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RG));
32359 __Pyx_INCREF(((PyObject *)__pyx_n_s__PG));
32360 PyTuple_SET_ITEM(__pyx_k_tuple_233, 3, ((PyObject *)__pyx_n_s__PG));
32361 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PG));
32362 __Pyx_INCREF(((PyObject *)__pyx_n_s__CO));
32363 PyTuple_SET_ITEM(__pyx_k_tuple_233, 4, ((PyObject *)__pyx_n_s__CO));
32364 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CO));
32365 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_233));
32367 /* "csamtools.pyx":233
32369 * # output order of fields within records
32370 * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ), # <<<<<<<<<<<<<<
32371 * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
32372 * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),
32374 __pyx_k_tuple_234 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_234)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32375 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_234));
32376 __Pyx_INCREF(((PyObject *)__pyx_n_s__VN));
32377 PyTuple_SET_ITEM(__pyx_k_tuple_234, 0, ((PyObject *)__pyx_n_s__VN));
32378 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VN));
32379 __Pyx_INCREF(((PyObject *)__pyx_n_s__SO));
32380 PyTuple_SET_ITEM(__pyx_k_tuple_234, 1, ((PyObject *)__pyx_n_s__SO));
32381 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SO));
32382 __Pyx_INCREF(((PyObject *)__pyx_n_s__GO));
32383 PyTuple_SET_ITEM(__pyx_k_tuple_234, 2, ((PyObject *)__pyx_n_s__GO));
32384 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__GO));
32385 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_234));
32387 /* "csamtools.pyx":234
32388 * # output order of fields within records
32389 * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
32390 * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), # <<<<<<<<<<<<<<
32391 * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),
32392 * "PG" : ( "PN", "ID", "VN", "CL" ), }
32394 __pyx_k_tuple_235 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_235)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32395 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_235));
32396 __Pyx_INCREF(((PyObject *)__pyx_n_s__SN));
32397 PyTuple_SET_ITEM(__pyx_k_tuple_235, 0, ((PyObject *)__pyx_n_s__SN));
32398 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SN));
32399 __Pyx_INCREF(((PyObject *)__pyx_n_s__LN));
32400 PyTuple_SET_ITEM(__pyx_k_tuple_235, 1, ((PyObject *)__pyx_n_s__LN));
32401 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LN));
32402 __Pyx_INCREF(((PyObject *)__pyx_n_s__AS));
32403 PyTuple_SET_ITEM(__pyx_k_tuple_235, 2, ((PyObject *)__pyx_n_s__AS));
32404 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__AS));
32405 __Pyx_INCREF(((PyObject *)__pyx_n_s__M5));
32406 PyTuple_SET_ITEM(__pyx_k_tuple_235, 3, ((PyObject *)__pyx_n_s__M5));
32407 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__M5));
32408 __Pyx_INCREF(((PyObject *)__pyx_n_s__UR));
32409 PyTuple_SET_ITEM(__pyx_k_tuple_235, 4, ((PyObject *)__pyx_n_s__UR));
32410 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__UR));
32411 __Pyx_INCREF(((PyObject *)__pyx_n_s__SP));
32412 PyTuple_SET_ITEM(__pyx_k_tuple_235, 5, ((PyObject *)__pyx_n_s__SP));
32413 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SP));
32414 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_235));
32416 /* "csamtools.pyx":235
32417 * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
32418 * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
32419 * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), # <<<<<<<<<<<<<<
32420 * "PG" : ( "PN", "ID", "VN", "CL" ), }
32423 __pyx_k_tuple_236 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_236)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32424 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_236));
32425 __Pyx_INCREF(((PyObject *)__pyx_n_s__ID));
32426 PyTuple_SET_ITEM(__pyx_k_tuple_236, 0, ((PyObject *)__pyx_n_s__ID));
32427 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ID));
32428 __Pyx_INCREF(((PyObject *)__pyx_n_s__SM));
32429 PyTuple_SET_ITEM(__pyx_k_tuple_236, 1, ((PyObject *)__pyx_n_s__SM));
32430 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SM));
32431 __Pyx_INCREF(((PyObject *)__pyx_n_s__LB));
32432 PyTuple_SET_ITEM(__pyx_k_tuple_236, 2, ((PyObject *)__pyx_n_s__LB));
32433 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LB));
32434 __Pyx_INCREF(((PyObject *)__pyx_n_s__DS));
32435 PyTuple_SET_ITEM(__pyx_k_tuple_236, 3, ((PyObject *)__pyx_n_s__DS));
32436 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DS));
32437 __Pyx_INCREF(((PyObject *)__pyx_n_s__PU));
32438 PyTuple_SET_ITEM(__pyx_k_tuple_236, 4, ((PyObject *)__pyx_n_s__PU));
32439 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PU));
32440 __Pyx_INCREF(((PyObject *)__pyx_n_s__PI));
32441 PyTuple_SET_ITEM(__pyx_k_tuple_236, 5, ((PyObject *)__pyx_n_s__PI));
32442 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PI));
32443 __Pyx_INCREF(((PyObject *)__pyx_n_s__CN));
32444 PyTuple_SET_ITEM(__pyx_k_tuple_236, 6, ((PyObject *)__pyx_n_s__CN));
32445 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CN));
32446 __Pyx_INCREF(((PyObject *)__pyx_n_s__DT));
32447 PyTuple_SET_ITEM(__pyx_k_tuple_236, 7, ((PyObject *)__pyx_n_s__DT));
32448 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DT));
32449 __Pyx_INCREF(((PyObject *)__pyx_n_s__PL));
32450 PyTuple_SET_ITEM(__pyx_k_tuple_236, 8, ((PyObject *)__pyx_n_s__PL));
32451 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PL));
32452 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_236));
32454 /* "csamtools.pyx":236
32455 * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
32456 * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),
32457 * "PG" : ( "PN", "ID", "VN", "CL" ), } # <<<<<<<<<<<<<<
32461 __pyx_k_tuple_237 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_237)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32462 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_237));
32463 __Pyx_INCREF(((PyObject *)__pyx_n_s__PN));
32464 PyTuple_SET_ITEM(__pyx_k_tuple_237, 0, ((PyObject *)__pyx_n_s__PN));
32465 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PN));
32466 __Pyx_INCREF(((PyObject *)__pyx_n_s__ID));
32467 PyTuple_SET_ITEM(__pyx_k_tuple_237, 1, ((PyObject *)__pyx_n_s__ID));
32468 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ID));
32469 __Pyx_INCREF(((PyObject *)__pyx_n_s__VN));
32470 PyTuple_SET_ITEM(__pyx_k_tuple_237, 2, ((PyObject *)__pyx_n_s__VN));
32471 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VN));
32472 __Pyx_INCREF(((PyObject *)__pyx_n_s__CL));
32473 PyTuple_SET_ITEM(__pyx_k_tuple_237, 3, ((PyObject *)__pyx_n_s__CL));
32474 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CL));
32475 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_237));
32476 __Pyx_RefNannyFinishContext();
32479 __Pyx_RefNannyFinishContext();
32483 static int __Pyx_InitGlobals(void) {
32484 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
32485 __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;};
32486 __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;};
32487 __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;};
32488 __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;};
32489 __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;};
32490 __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;};
32491 __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;};
32492 __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;};
32493 __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;};
32494 __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;};
32495 __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;};
32496 __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;};
32497 __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;};
32498 __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;};
32499 __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;};
32500 __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;};
32501 __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;};
32502 __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;};
32503 __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;};
32504 __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;};
32505 __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;};
32511 #if PY_MAJOR_VERSION < 3
32512 PyMODINIT_FUNC initcsamtools(void); /*proto*/
32513 PyMODINIT_FUNC initcsamtools(void)
32515 PyMODINIT_FUNC PyInit_csamtools(void); /*proto*/
32516 PyMODINIT_FUNC PyInit_csamtools(void)
32519 PyObject *__pyx_t_1 = NULL;
32520 PyObject *__pyx_t_2 = NULL;
32521 PyObject *__pyx_t_3 = NULL;
32523 #if CYTHON_REFNANNY
32524 void* __pyx_refnanny = NULL;
32525 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
32526 if (!__Pyx_RefNanny) {
32528 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
32529 if (!__Pyx_RefNanny)
32530 Py_FatalError("failed to import 'refnanny' module");
32532 __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_csamtools(void)", __LINE__, __FILE__);
32534 __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;}
32535 __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;}
32536 #ifdef __pyx_binding_PyCFunctionType_USED
32537 if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32539 /*--- Library function declarations ---*/
32540 /*--- Threads initialization code ---*/
32541 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
32542 #ifdef WITH_THREAD /* Python build with threading support? */
32543 PyEval_InitThreads();
32546 /*--- Module creation code ---*/
32547 #if PY_MAJOR_VERSION < 3
32548 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("csamtools"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
32550 __pyx_m = PyModule_Create(&__pyx_moduledef);
32552 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
32553 #if PY_MAJOR_VERSION < 3
32554 Py_INCREF(__pyx_m);
32556 __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
32557 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
32558 if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
32559 /*--- Initialize various global constants etc. ---*/
32560 if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32561 if (__pyx_module_is_main_csamtools) {
32562 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;};
32564 /*--- Builtin init code ---*/
32565 if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32566 /*--- Constants init code ---*/
32567 if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32568 /*--- Global init code ---*/
32569 /*--- Function export code ---*/
32570 /*--- Type init code ---*/
32571 __pyx_ptype_9csamtools_file = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "file", sizeof(PyFileObject), 0); if (unlikely(!__pyx_ptype_9csamtools_file)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32572 if (PyType_Ready(&__pyx_type_9csamtools_AlignedRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32574 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_AlignedRead, "__str__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32575 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
32576 __pyx_wrapperbase_9csamtools_11AlignedRead_2__str__ = *((PyWrapperDescrObject *)wrapper)->d_base;
32577 __pyx_wrapperbase_9csamtools_11AlignedRead_2__str__.doc = __pyx_doc_9csamtools_11AlignedRead_2__str__;
32578 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_11AlignedRead_2__str__;
32581 if (__Pyx_SetAttrString(__pyx_m, "AlignedRead", (PyObject *)&__pyx_type_9csamtools_AlignedRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32582 __pyx_ptype_9csamtools_AlignedRead = &__pyx_type_9csamtools_AlignedRead;
32583 __pyx_vtabptr_9csamtools_Samfile = &__pyx_vtable_9csamtools_Samfile;
32584 __pyx_vtable_9csamtools_Samfile._buildHeader = (bam_header_t *(*)(struct __pyx_obj_9csamtools_Samfile *, PyObject *))__pyx_f_9csamtools_7Samfile__buildHeader;
32585 __pyx_vtable_9csamtools_Samfile.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_Samfile *))__pyx_f_9csamtools_7Samfile_getCurrent;
32586 __pyx_vtable_9csamtools_Samfile.cnext = (int (*)(struct __pyx_obj_9csamtools_Samfile *))__pyx_f_9csamtools_7Samfile_cnext;
32587 __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;
32588 __pyx_vtable_9csamtools_Samfile._getrname = (char *(*)(struct __pyx_obj_9csamtools_Samfile *, int))__pyx_f_9csamtools_7Samfile__getrname;
32589 if (PyType_Ready(&__pyx_type_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32591 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_Samfile, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32592 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
32593 __pyx_wrapperbase_9csamtools_7Samfile_21__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
32594 __pyx_wrapperbase_9csamtools_7Samfile_21__next__.doc = __pyx_doc_9csamtools_7Samfile_21__next__;
32595 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_7Samfile_21__next__;
32598 if (__Pyx_SetVtable(__pyx_type_9csamtools_Samfile.tp_dict, __pyx_vtabptr_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32599 if (__Pyx_SetAttrString(__pyx_m, "Samfile", (PyObject *)&__pyx_type_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32600 __pyx_ptype_9csamtools_Samfile = &__pyx_type_9csamtools_Samfile;
32601 if (PyType_Ready(&__pyx_type_9csamtools_IteratorRow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32602 if (__Pyx_SetAttrString(__pyx_m, "IteratorRow", (PyObject *)&__pyx_type_9csamtools_IteratorRow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32603 __pyx_ptype_9csamtools_IteratorRow = &__pyx_type_9csamtools_IteratorRow;
32604 __pyx_vtabptr_9csamtools_IteratorRowAll = &__pyx_vtable_9csamtools_IteratorRowAll;
32605 __pyx_vtable_9csamtools_IteratorRowAll.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_IteratorRowAll *))__pyx_f_9csamtools_14IteratorRowAll_getCurrent;
32606 __pyx_vtable_9csamtools_IteratorRowAll.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorRowAll *))__pyx_f_9csamtools_14IteratorRowAll_cnext;
32607 __pyx_type_9csamtools_IteratorRowAll.tp_base = __pyx_ptype_9csamtools_IteratorRow;
32608 if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32610 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowAll, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32611 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
32612 __pyx_wrapperbase_9csamtools_14IteratorRowAll_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
32613 __pyx_wrapperbase_9csamtools_14IteratorRowAll_2__next__.doc = __pyx_doc_9csamtools_14IteratorRowAll_2__next__;
32614 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_14IteratorRowAll_2__next__;
32617 if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorRowAll.tp_dict, __pyx_vtabptr_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32618 if (__Pyx_SetAttrString(__pyx_m, "IteratorRowAll", (PyObject *)&__pyx_type_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32619 __pyx_ptype_9csamtools_IteratorRowAll = &__pyx_type_9csamtools_IteratorRowAll;
32620 if (PyType_Ready(&__pyx_type_9csamtools_PileupProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32621 if (__Pyx_SetAttrString(__pyx_m, "PileupProxy", (PyObject *)&__pyx_type_9csamtools_PileupProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32622 __pyx_ptype_9csamtools_PileupProxy = &__pyx_type_9csamtools_PileupProxy;
32623 if (PyType_Ready(&__pyx_type_9csamtools_PileupRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32624 if (__Pyx_SetAttrString(__pyx_m, "PileupRead", (PyObject *)&__pyx_type_9csamtools_PileupRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32625 __pyx_ptype_9csamtools_PileupRead = &__pyx_type_9csamtools_PileupRead;
32626 __pyx_vtabptr_9csamtools_Fastafile = &__pyx_vtable_9csamtools_Fastafile;
32627 __pyx_vtable_9csamtools_Fastafile._fetch = (char *(*)(struct __pyx_obj_9csamtools_Fastafile *, char *, int, int, int *))__pyx_f_9csamtools_9Fastafile__fetch;
32628 if (PyType_Ready(&__pyx_type_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32629 if (__Pyx_SetVtable(__pyx_type_9csamtools_Fastafile.tp_dict, __pyx_vtabptr_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32630 if (__Pyx_SetAttrString(__pyx_m, "Fastafile", (PyObject *)&__pyx_type_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32631 __pyx_ptype_9csamtools_Fastafile = &__pyx_type_9csamtools_Fastafile;
32632 __pyx_vtabptr_9csamtools_IteratorRowRegion = &__pyx_vtable_9csamtools_IteratorRowRegion;
32633 __pyx_vtable_9csamtools_IteratorRowRegion.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_IteratorRowRegion *))__pyx_f_9csamtools_17IteratorRowRegion_getCurrent;
32634 __pyx_vtable_9csamtools_IteratorRowRegion.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorRowRegion *))__pyx_f_9csamtools_17IteratorRowRegion_cnext;
32635 __pyx_type_9csamtools_IteratorRowRegion.tp_base = __pyx_ptype_9csamtools_IteratorRow;
32636 if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32638 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowRegion, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32639 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
32640 __pyx_wrapperbase_9csamtools_17IteratorRowRegion_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
32641 __pyx_wrapperbase_9csamtools_17IteratorRowRegion_2__next__.doc = __pyx_doc_9csamtools_17IteratorRowRegion_2__next__;
32642 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_17IteratorRowRegion_2__next__;
32645 if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorRowRegion.tp_dict, __pyx_vtabptr_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32646 if (__Pyx_SetAttrString(__pyx_m, "IteratorRowRegion", (PyObject *)&__pyx_type_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32647 __pyx_ptype_9csamtools_IteratorRowRegion = &__pyx_type_9csamtools_IteratorRowRegion;
32648 __pyx_type_9csamtools_IteratorRowAllRefs.tp_base = __pyx_ptype_9csamtools_IteratorRow;
32649 if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32651 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowAllRefs, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32652 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
32653 __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_3__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
32654 __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_3__next__.doc = __pyx_doc_9csamtools_18IteratorRowAllRefs_3__next__;
32655 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_3__next__;
32658 if (__Pyx_SetAttrString(__pyx_m, "IteratorRowAllRefs", (PyObject *)&__pyx_type_9csamtools_IteratorRowAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32659 __pyx_ptype_9csamtools_IteratorRowAllRefs = &__pyx_type_9csamtools_IteratorRowAllRefs;
32660 __pyx_vtabptr_9csamtools_IteratorRowSelection = &__pyx_vtable_9csamtools_IteratorRowSelection;
32661 __pyx_vtable_9csamtools_IteratorRowSelection.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_IteratorRowSelection *))__pyx_f_9csamtools_20IteratorRowSelection_getCurrent;
32662 __pyx_vtable_9csamtools_IteratorRowSelection.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorRowSelection *))__pyx_f_9csamtools_20IteratorRowSelection_cnext;
32663 __pyx_type_9csamtools_IteratorRowSelection.tp_base = __pyx_ptype_9csamtools_IteratorRow;
32664 if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32666 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowSelection, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32667 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
32668 __pyx_wrapperbase_9csamtools_20IteratorRowSelection_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
32669 __pyx_wrapperbase_9csamtools_20IteratorRowSelection_2__next__.doc = __pyx_doc_9csamtools_20IteratorRowSelection_2__next__;
32670 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_20IteratorRowSelection_2__next__;
32673 if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorRowSelection.tp_dict, __pyx_vtabptr_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32674 if (__Pyx_SetAttrString(__pyx_m, "IteratorRowSelection", (PyObject *)&__pyx_type_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32675 __pyx_ptype_9csamtools_IteratorRowSelection = &__pyx_type_9csamtools_IteratorRowSelection;
32676 __pyx_vtabptr_9csamtools_IteratorColumn = &__pyx_vtable_9csamtools_IteratorColumn;
32677 __pyx_vtable_9csamtools_IteratorColumn.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorColumn *))__pyx_f_9csamtools_14IteratorColumn_cnext;
32678 __pyx_vtable_9csamtools_IteratorColumn.getSequence = (char *(*)(struct __pyx_obj_9csamtools_IteratorColumn *))__pyx_f_9csamtools_14IteratorColumn_getSequence;
32679 __pyx_vtable_9csamtools_IteratorColumn.setMask = (PyObject *(*)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *))__pyx_f_9csamtools_14IteratorColumn_setMask;
32680 __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;
32681 __pyx_vtable_9csamtools_IteratorColumn.reset = (PyObject *(*)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *, PyObject *, PyObject *))__pyx_f_9csamtools_14IteratorColumn_reset;
32682 if (PyType_Ready(&__pyx_type_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32683 if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorColumn.tp_dict, __pyx_vtabptr_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32684 if (__Pyx_SetAttrString(__pyx_m, "IteratorColumn", (PyObject *)&__pyx_type_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32685 __pyx_ptype_9csamtools_IteratorColumn = &__pyx_type_9csamtools_IteratorColumn;
32686 __pyx_vtabptr_9csamtools_IteratorColumnRegion = &__pyx_vtable_9csamtools_IteratorColumnRegion;
32687 __pyx_vtable_9csamtools_IteratorColumnRegion.__pyx_base = *__pyx_vtabptr_9csamtools_IteratorColumn;
32688 __pyx_type_9csamtools_IteratorColumnRegion.tp_base = __pyx_ptype_9csamtools_IteratorColumn;
32689 if (PyType_Ready(&__pyx_type_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32691 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorColumnRegion, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32692 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
32693 __pyx_wrapperbase_9csamtools_20IteratorColumnRegion_1__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
32694 __pyx_wrapperbase_9csamtools_20IteratorColumnRegion_1__next__.doc = __pyx_doc_9csamtools_20IteratorColumnRegion_1__next__;
32695 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_20IteratorColumnRegion_1__next__;
32698 if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorColumnRegion.tp_dict, __pyx_vtabptr_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32699 if (__Pyx_SetAttrString(__pyx_m, "IteratorColumnRegion", (PyObject *)&__pyx_type_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32700 __pyx_ptype_9csamtools_IteratorColumnRegion = &__pyx_type_9csamtools_IteratorColumnRegion;
32701 __pyx_vtabptr_9csamtools_IteratorColumnAllRefs = &__pyx_vtable_9csamtools_IteratorColumnAllRefs;
32702 __pyx_vtable_9csamtools_IteratorColumnAllRefs.__pyx_base = *__pyx_vtabptr_9csamtools_IteratorColumn;
32703 __pyx_type_9csamtools_IteratorColumnAllRefs.tp_base = __pyx_ptype_9csamtools_IteratorColumn;
32704 if (PyType_Ready(&__pyx_type_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32706 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorColumnAllRefs, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32707 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
32708 __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_1__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
32709 __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_1__next__.doc = __pyx_doc_9csamtools_21IteratorColumnAllRefs_1__next__;
32710 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_1__next__;
32713 if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorColumnAllRefs.tp_dict, __pyx_vtabptr_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32714 if (__Pyx_SetAttrString(__pyx_m, "IteratorColumnAllRefs", (PyObject *)&__pyx_type_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32715 __pyx_ptype_9csamtools_IteratorColumnAllRefs = &__pyx_type_9csamtools_IteratorColumnAllRefs;
32716 if (PyType_Ready(&__pyx_type_9csamtools_SNPCall) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32717 if (__Pyx_SetAttrString(__pyx_m, "SNPCall", (PyObject *)&__pyx_type_9csamtools_SNPCall) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32718 __pyx_ptype_9csamtools_SNPCall = &__pyx_type_9csamtools_SNPCall;
32719 if (PyType_Ready(&__pyx_type_9csamtools_IndexedReads) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32720 if (__Pyx_SetAttrString(__pyx_m, "IndexedReads", (PyObject *)&__pyx_type_9csamtools_IndexedReads) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32721 __pyx_ptype_9csamtools_IndexedReads = &__pyx_type_9csamtools_IndexedReads;
32722 /*--- Type import code ---*/
32723 __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[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32724 __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[3]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32725 /*--- Function import code ---*/
32726 /*--- Execution code ---*/
32728 /* "csamtools.pyx":4
32729 * # cython: profile=True
32730 * # adds doc-strings for sphinx
32731 * import tempfile # <<<<<<<<<<<<<<
32735 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__tempfile), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32736 __Pyx_GOTREF(__pyx_t_1);
32737 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;}
32738 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32740 /* "csamtools.pyx":5
32741 * # adds doc-strings for sphinx
32743 * import os # <<<<<<<<<<<<<<
32747 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32748 __Pyx_GOTREF(__pyx_t_1);
32749 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;}
32750 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32752 /* "csamtools.pyx":6
32755 * import sys # <<<<<<<<<<<<<<
32759 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32760 __Pyx_GOTREF(__pyx_t_1);
32761 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;}
32762 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32764 /* "csamtools.pyx":7
32767 * import types # <<<<<<<<<<<<<<
32771 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__types), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32772 __Pyx_GOTREF(__pyx_t_1);
32773 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;}
32774 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32776 /* "csamtools.pyx":8
32779 * import itertools # <<<<<<<<<<<<<<
32783 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__itertools), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32784 __Pyx_GOTREF(__pyx_t_1);
32785 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;}
32786 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32788 /* "csamtools.pyx":9
32791 * import struct # <<<<<<<<<<<<<<
32793 * import collections
32795 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32796 __Pyx_GOTREF(__pyx_t_1);
32797 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;}
32798 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32800 /* "csamtools.pyx":10
32803 * import ctypes # <<<<<<<<<<<<<<
32804 * import collections
32807 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__ctypes), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32808 __Pyx_GOTREF(__pyx_t_1);
32809 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;}
32810 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32812 /* "csamtools.pyx":11
32815 * import collections # <<<<<<<<<<<<<<
32819 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__collections), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32820 __Pyx_GOTREF(__pyx_t_1);
32821 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;}
32822 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32824 /* "csamtools.pyx":12
32826 * import collections
32827 * import re # <<<<<<<<<<<<<<
32829 * from cpython cimport PyString_FromStringAndSize, PyString_AS_STRING
32831 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__re), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32832 __Pyx_GOTREF(__pyx_t_1);
32833 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;}
32834 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32836 /* "csamtools.pyx":13
32837 * import collections
32839 * import platform # <<<<<<<<<<<<<<
32840 * from cpython cimport PyString_FromStringAndSize, PyString_AS_STRING
32841 * from cpython cimport PyErr_SetString
32843 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__platform), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32844 __Pyx_GOTREF(__pyx_t_1);
32845 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;}
32846 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32848 /* "csamtools.pyx":63
32849 * #####################################################################
32850 * # hard-coded constants
32851 * cdef char * bam_nt16_rev_table = "=ACMGRSVTWYHKDBN" # <<<<<<<<<<<<<<
32852 * cdef int max_pos = 2 << 29
32855 __pyx_v_9csamtools_bam_nt16_rev_table = __pyx_k_229;
32857 /* "csamtools.pyx":64
32858 * # hard-coded constants
32859 * cdef char * bam_nt16_rev_table = "=ACMGRSVTWYHKDBN"
32860 * cdef int max_pos = 2 << 29 # <<<<<<<<<<<<<<
32862 * # redirect stderr to 0
32864 __pyx_v_9csamtools_max_pos = 1073741824;
32866 /* "csamtools.pyx":67
32868 * # redirect stderr to 0
32869 * _logfile = open(os.path.devnull, "w") # <<<<<<<<<<<<<<
32870 * pysam_set_stderr( PyFile_AsFile( _logfile ) )
32873 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32874 __Pyx_GOTREF(__pyx_t_1);
32875 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32876 __Pyx_GOTREF(__pyx_t_2);
32877 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32878 __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__devnull); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32879 __Pyx_GOTREF(__pyx_t_1);
32880 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32881 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32882 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
32883 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
32884 __Pyx_GIVEREF(__pyx_t_1);
32885 __Pyx_INCREF(((PyObject *)__pyx_n_s__w));
32886 PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w));
32887 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w));
32889 __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32890 __Pyx_GOTREF(__pyx_t_1);
32891 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
32892 if (PyObject_SetAttr(__pyx_m, __pyx_n_s___logfile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32893 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32895 /* "csamtools.pyx":68
32896 * # redirect stderr to 0
32897 * _logfile = open(os.path.devnull, "w")
32898 * pysam_set_stderr( PyFile_AsFile( _logfile ) ) # <<<<<<<<<<<<<<
32900 * #####################################################################
32902 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___logfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32903 __Pyx_GOTREF(__pyx_t_1);
32904 pysam_set_stderr(PyFile_AsFile(__pyx_t_1));
32905 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32907 /* "csamtools.pyx":117
32910 * class PileupColumn(object): # <<<<<<<<<<<<<<
32911 * '''A pileup column. A pileup column contains
32912 * all the reads that map to a certain target base.
32914 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32915 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
32917 /* "csamtools.pyx":130
32918 * list of reads (:class:`pysam.PileupRead`) aligned to this column
32920 * def __str__(self): # <<<<<<<<<<<<<<
32921 * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\
32922 * "\n" + "\n".join( map(str, self.pileups) )
32924 __pyx_t_2 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_12PileupColumn___str__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32925 __Pyx_GOTREF(__pyx_t_2);
32926 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____str__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32927 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
32929 /* "csamtools.pyx":117
32932 * class PileupColumn(object): # <<<<<<<<<<<<<<
32933 * '''A pileup column. A pileup column contains
32934 * all the reads that map to a certain target base.
32936 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32937 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
32938 __Pyx_INCREF(__pyx_builtin_object);
32939 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_object);
32940 __Pyx_GIVEREF(__pyx_builtin_object);
32941 if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_230)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32942 __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1), __pyx_n_s__PileupColumn, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32943 __Pyx_GOTREF(__pyx_t_3);
32944 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
32945 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PileupColumn, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32946 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32947 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
32949 /* "csamtools.pyx":174
32952 * class StderrStore(): # <<<<<<<<<<<<<<
32954 * stderr is captured.
32956 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32957 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
32959 /* "csamtools.pyx":178
32960 * stderr is captured.
32962 * def __init__(self): # <<<<<<<<<<<<<<
32964 * self.stderr_h, self.stderr_f = tempfile.mkstemp()
32966 __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_11StderrStore___init__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32967 __Pyx_GOTREF(__pyx_t_3);
32968 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32969 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32971 /* "csamtools.pyx":184
32972 * self.stderr_save.setfd( self.stderr_h )
32974 * def readAndRelease( self ): # <<<<<<<<<<<<<<
32976 * self.stderr_save.restore()
32978 __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_11StderrStore_1readAndRelease, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32979 __Pyx_GOTREF(__pyx_t_3);
32980 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__readAndRelease, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32981 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32983 /* "csamtools.pyx":193
32986 * def release(self): # <<<<<<<<<<<<<<
32988 * self.stderr_save.restore()
32990 __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_11StderrStore_2release, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32991 __Pyx_GOTREF(__pyx_t_3);
32992 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__release, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
32993 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32995 /* "csamtools.pyx":199
32996 * os.remove( self.stderr_f )
32998 * def __del__(self): # <<<<<<<<<<<<<<
33002 __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_11StderrStore_3__del__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33003 __Pyx_GOTREF(__pyx_t_3);
33004 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____del__, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33005 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33007 /* "csamtools.pyx":174
33010 * class StderrStore(): # <<<<<<<<<<<<<<
33012 * stderr is captured.
33014 if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_231)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33015 __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s__StderrStore, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33016 __Pyx_GOTREF(__pyx_t_3);
33017 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StderrStore, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33018 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33019 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
33021 /* "csamtools.pyx":202
33024 * class StderrStoreWindows(): # <<<<<<<<<<<<<<
33025 * '''does nothing. stderr can't be redirected on windows'''
33026 * def __init__(self): pass
33028 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33029 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
33031 /* "csamtools.pyx":204
33032 * class StderrStoreWindows():
33033 * '''does nothing. stderr can't be redirected on windows'''
33034 * def __init__(self): pass # <<<<<<<<<<<<<<
33035 * def readAndRelease(self): return []
33036 * def release(self): pass
33038 __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_18StderrStoreWindows___init__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33039 __Pyx_GOTREF(__pyx_t_3);
33040 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33041 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33043 /* "csamtools.pyx":205
33044 * '''does nothing. stderr can't be redirected on windows'''
33045 * def __init__(self): pass
33046 * def readAndRelease(self): return [] # <<<<<<<<<<<<<<
33047 * def release(self): pass
33050 __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_18StderrStoreWindows_1readAndRelease, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33051 __Pyx_GOTREF(__pyx_t_3);
33052 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__readAndRelease, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33053 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33055 /* "csamtools.pyx":206
33056 * def __init__(self): pass
33057 * def readAndRelease(self): return []
33058 * def release(self): pass # <<<<<<<<<<<<<<
33060 * if platform.system()=='Windows':
33062 __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_18StderrStoreWindows_2release, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33063 __Pyx_GOTREF(__pyx_t_3);
33064 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__release, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33065 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33067 /* "csamtools.pyx":202
33070 * class StderrStoreWindows(): # <<<<<<<<<<<<<<
33071 * '''does nothing. stderr can't be redirected on windows'''
33072 * def __init__(self): pass
33074 if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_232)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33075 __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s__StderrStoreWindows, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33076 __Pyx_GOTREF(__pyx_t_3);
33077 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StderrStoreWindows, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33078 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33079 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
33081 /* "csamtools.pyx":208
33082 * def release(self): pass
33084 * if platform.system()=='Windows': # <<<<<<<<<<<<<<
33086 * StderrStore = StderrStoreWindows
33088 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__platform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33089 __Pyx_GOTREF(__pyx_t_1);
33090 __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__system); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33091 __Pyx_GOTREF(__pyx_t_3);
33092 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
33093 __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 = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33094 __Pyx_GOTREF(__pyx_t_1);
33095 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33096 __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Windows), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33097 __Pyx_GOTREF(__pyx_t_3);
33098 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
33099 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33100 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33103 /* "csamtools.pyx":209
33105 * if platform.system()=='Windows':
33106 * del StderrStore # <<<<<<<<<<<<<<
33107 * StderrStore = StderrStoreWindows
33110 if (__Pyx_DelAttrString(__pyx_m, "StderrStore") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33112 /* "csamtools.pyx":210
33113 * if platform.system()=='Windows':
33115 * StderrStore = StderrStoreWindows # <<<<<<<<<<<<<<
33119 __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStoreWindows); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33120 __Pyx_GOTREF(__pyx_t_3);
33121 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StderrStore, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33122 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33127 /* "csamtools.pyx":217
33128 * ######################################################################
33129 * # valid types for sam headers
33130 * VALID_HEADER_TYPES = { "HD" : dict, # <<<<<<<<<<<<<<
33134 __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33135 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
33136 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__HD), ((PyObject *)((PyObject*)(&PyDict_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33138 /* "csamtools.pyx":218
33139 * # valid types for sam headers
33140 * VALID_HEADER_TYPES = { "HD" : dict,
33141 * "SQ" : list, # <<<<<<<<<<<<<<
33145 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33147 /* "csamtools.pyx":219
33148 * VALID_HEADER_TYPES = { "HD" : dict,
33150 * "RG" : list, # <<<<<<<<<<<<<<
33154 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__RG), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33156 /* "csamtools.pyx":220
33159 * "PG" : list, # <<<<<<<<<<<<<<
33163 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__PG), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33165 /* "csamtools.pyx":221
33168 * "CO" : list } # <<<<<<<<<<<<<<
33170 * # order of records within sam headers
33172 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__CO), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33173 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33174 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
33176 /* "csamtools.pyx":224
33178 * # order of records within sam headers
33179 * VALID_HEADERS = ("HD", "SQ", "RG", "PG", "CO" ) # <<<<<<<<<<<<<<
33181 * # type conversions within sam header records
33183 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADERS, ((PyObject *)__pyx_k_tuple_233)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33185 /* "csamtools.pyx":227
33187 * # type conversions within sam header records
33188 * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str }, # <<<<<<<<<<<<<<
33189 * "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },
33190 * "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, },
33192 __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33193 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
33194 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33195 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
33196 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__VN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33197 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SO), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33198 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__GO), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33199 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__HD), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33200 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
33202 /* "csamtools.pyx":228
33203 * # type conversions within sam header records
33204 * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str },
33205 * "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str }, # <<<<<<<<<<<<<<
33206 * "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, },
33207 * "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, }
33209 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33210 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
33211 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33212 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__LN), ((PyObject *)((PyObject*)(&PyInt_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33213 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__AS), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33214 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__M5), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33215 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__UR), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33216 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SP), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33217 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33218 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
33220 /* "csamtools.pyx":229
33221 * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str },
33222 * "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },
33223 * "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, }, # <<<<<<<<<<<<<<
33224 * "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, }
33227 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33228 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
33229 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__ID), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33230 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SM), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33231 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__LB), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33232 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__DS), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33233 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PU), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33234 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PI), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33235 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__CN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33236 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__DT), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33237 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PL), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33238 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__RG), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33239 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
33241 /* "csamtools.pyx":230
33242 * "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str },
33243 * "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, },
33244 * "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, } # <<<<<<<<<<<<<<
33246 * # output order of fields within records
33248 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33249 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
33250 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33251 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__ID), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33252 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__VN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33253 if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__CL), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33254 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__PG), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33255 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
33256 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33257 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
33259 /* "csamtools.pyx":233
33261 * # output order of fields within records
33262 * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ), # <<<<<<<<<<<<<<
33263 * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
33264 * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),
33266 __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33267 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
33268 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__HD), ((PyObject *)__pyx_k_tuple_234)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33270 /* "csamtools.pyx":234
33271 * # output order of fields within records
33272 * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
33273 * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), # <<<<<<<<<<<<<<
33274 * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),
33275 * "PG" : ( "PN", "ID", "VN", "CL" ), }
33277 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)__pyx_k_tuple_235)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33279 /* "csamtools.pyx":235
33280 * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ),
33281 * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
33282 * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), # <<<<<<<<<<<<<<
33283 * "PG" : ( "PN", "ID", "VN", "CL" ), }
33286 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__RG), ((PyObject *)__pyx_k_tuple_236)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33288 /* "csamtools.pyx":236
33289 * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ),
33290 * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ),
33291 * "PG" : ( "PN", "ID", "VN", "CL" ), } # <<<<<<<<<<<<<<
33295 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__PG), ((PyObject *)__pyx_k_tuple_237)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33296 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_ORDER, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33297 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
33299 /* "csamtools.pyx":485
33302 * add_sq_text = True, # <<<<<<<<<<<<<<
33304 * '''open a sam/bam file.
33306 __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33307 __Pyx_GOTREF(__pyx_t_3);
33308 __pyx_k_16 = __pyx_t_3;
33309 __Pyx_GIVEREF(__pyx_t_3);
33312 /* "csamtools.pyx":744
33315 * until_eof = False ): # <<<<<<<<<<<<<<
33317 * fetch aligned reads in a :term:`region` using 0-based indexing. The region is specified by
33319 __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33320 __Pyx_GOTREF(__pyx_t_3);
33321 __pyx_k_44 = __pyx_t_3;
33322 __Pyx_GIVEREF(__pyx_t_3);
33325 /* "csamtools.pyx":861
33328 * until_eof = False ): # <<<<<<<<<<<<<<
33329 * '''*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)*
33332 __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33333 __Pyx_GOTREF(__pyx_t_3);
33334 __pyx_k_62 = __pyx_t_3;
33335 __Pyx_GIVEREF(__pyx_t_3);
33338 /* "csamtools.pyx":1783
33341 * int end = max_pos, # <<<<<<<<<<<<<<
33345 __pyx_k_115 = __pyx_v_9csamtools_max_pos;
33347 /* "csamtools.pyx":2785
33348 * return self._level
33350 * class Outs: # <<<<<<<<<<<<<<
33351 * '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
33352 * def __init__(self, id = 1):
33354 __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33355 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
33357 /* "csamtools.pyx":2787
33359 * '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
33360 * def __init__(self, id = 1): # <<<<<<<<<<<<<<
33361 * self.streams = []
33364 __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs___init__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33365 __Pyx_GOTREF(__pyx_t_1);
33366 if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____init__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33367 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
33369 /* "csamtools.pyx":2791
33372 * def setdevice(self, filename): # <<<<<<<<<<<<<<
33373 * '''open an existing file, like "/dev/null"'''
33374 * fd = os.open(filename, os.O_WRONLY)
33376 __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs_1setdevice, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33377 __Pyx_GOTREF(__pyx_t_1);
33378 if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__setdevice, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33379 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
33381 /* "csamtools.pyx":2796
33384 * def setfile(self, filename): # <<<<<<<<<<<<<<
33385 * '''open a new file.'''
33386 * fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660);
33388 __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs_2setfile, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33389 __Pyx_GOTREF(__pyx_t_1);
33390 if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__setfile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33391 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
33393 /* "csamtools.pyx":2801
33396 * def setfd(self, fd): # <<<<<<<<<<<<<<
33397 * ofd = os.dup(self.id) # Save old stream on new unit.
33398 * self.streams.append(ofd)
33400 __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs_3setfd, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33401 __Pyx_GOTREF(__pyx_t_1);
33402 if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__setfd, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33403 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
33405 /* "csamtools.pyx":2809
33406 * os.close(fd) # Close other unit (look out, caller.)
33408 * def restore(self): # <<<<<<<<<<<<<<
33409 * '''restore previous output stream'''
33412 __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs_4restore, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33413 __Pyx_GOTREF(__pyx_t_1);
33414 if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__restore, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33415 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
33417 /* "csamtools.pyx":2785
33418 * return self._level
33420 * class Outs: # <<<<<<<<<<<<<<
33421 * '''http://mail.python.org/pipermail/python-list/2000-June/038406.html'''
33422 * def __init__(self, id = 1):
33424 if (PyDict_SetItemString(((PyObject *)__pyx_t_3), "__doc__", ((PyObject *)__pyx_kp_s_238)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33425 __pyx_t_1 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3), __pyx_n_s__Outs, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33426 __Pyx_GOTREF(__pyx_t_1);
33427 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Outs, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33428 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
33429 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
33431 /* "csamtools.pyx":2822
33432 * def _samtools_dispatch( method,
33434 * catch_stdout = True, # <<<<<<<<<<<<<<
33435 * catch_stderr = False,
33438 __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33439 __Pyx_GOTREF(__pyx_t_3);
33440 __pyx_k_160 = __pyx_t_3;
33441 __Pyx_GIVEREF(__pyx_t_3);
33444 /* "csamtools.pyx":2823
33446 * catch_stdout = True,
33447 * catch_stderr = False, # <<<<<<<<<<<<<<
33449 * '''call ``method`` in samtools providing arguments in args.
33451 __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33452 __Pyx_GOTREF(__pyx_t_3);
33453 __pyx_k_161 = __pyx_t_3;
33454 __Pyx_GIVEREF(__pyx_t_3);
33457 /* "csamtools.pyx":2820
33458 * del self.streams[-1]
33460 * def _samtools_dispatch( method, # <<<<<<<<<<<<<<
33462 * catch_stdout = True,
33464 __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_9csamtools__samtools_dispatch, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33465 __Pyx_GOTREF(__pyx_t_3);
33466 if (PyObject_SetAttr(__pyx_m, __pyx_n_s___samtools_dispatch, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33467 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33469 /* "csamtools.pyx":3522
33470 * if self.owns_samfile: samclose( self.fp )
33472 * __all__ = ["Samfile", # <<<<<<<<<<<<<<
33476 __pyx_t_3 = PyList_New(9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33477 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
33478 __Pyx_INCREF(((PyObject *)__pyx_n_s__Samfile));
33479 PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__Samfile));
33480 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Samfile));
33481 __Pyx_INCREF(((PyObject *)__pyx_n_s__Fastafile));
33482 PyList_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__Fastafile));
33483 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Fastafile));
33484 __Pyx_INCREF(((PyObject *)__pyx_n_s__IteratorRow));
33485 PyList_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_n_s__IteratorRow));
33486 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IteratorRow));
33487 __Pyx_INCREF(((PyObject *)__pyx_n_s__IteratorColumn));
33488 PyList_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_n_s__IteratorColumn));
33489 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IteratorColumn));
33490 __Pyx_INCREF(((PyObject *)__pyx_n_s__AlignedRead));
33491 PyList_SET_ITEM(__pyx_t_3, 4, ((PyObject *)__pyx_n_s__AlignedRead));
33492 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__AlignedRead));
33493 __Pyx_INCREF(((PyObject *)__pyx_n_s__PileupColumn));
33494 PyList_SET_ITEM(__pyx_t_3, 5, ((PyObject *)__pyx_n_s__PileupColumn));
33495 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PileupColumn));
33496 __Pyx_INCREF(((PyObject *)__pyx_n_s__PileupProxy));
33497 PyList_SET_ITEM(__pyx_t_3, 6, ((PyObject *)__pyx_n_s__PileupProxy));
33498 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PileupProxy));
33499 __Pyx_INCREF(((PyObject *)__pyx_n_s__PileupRead));
33500 PyList_SET_ITEM(__pyx_t_3, 7, ((PyObject *)__pyx_n_s__PileupRead));
33501 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PileupRead));
33502 __Pyx_INCREF(((PyObject *)__pyx_n_s__IndexedReads));
33503 PyList_SET_ITEM(__pyx_t_3, 8, ((PyObject *)__pyx_n_s__IndexedReads));
33504 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IndexedReads));
33505 if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33506 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
33508 /* "csamtools.pyx":1
33509 * # cython: embedsignature=True # <<<<<<<<<<<<<<
33510 * # cython: profile=True
33511 * # adds doc-strings for sphinx
33513 __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33514 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
33515 if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
33516 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
33518 /* "cpython/type.pxd":2
33520 * cdef extern from "Python.h": # <<<<<<<<<<<<<<
33521 * # The C structure of the objects used to describe built-in types.
33526 __Pyx_XDECREF(__pyx_t_1);
33527 __Pyx_XDECREF(__pyx_t_2);
33528 __Pyx_XDECREF(__pyx_t_3);
33530 __Pyx_AddTraceback("init csamtools");
33531 Py_DECREF(__pyx_m); __pyx_m = 0;
33532 } else if (!PyErr_Occurred()) {
33533 PyErr_SetString(PyExc_ImportError, "init csamtools");
33536 __Pyx_RefNannyFinishContext();
33537 #if PY_MAJOR_VERSION < 3
33544 /* Runtime support code */
33546 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
33548 result = PyObject_GetAttr(dict, name);
33550 PyErr_SetObject(PyExc_NameError, name);
33557 static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
33558 PyFrameObject** frame,
33559 const char *funcname,
33560 const char *srcfile,
33562 if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) {
33563 if (*code == NULL) {
33564 *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
33565 if (*code == NULL) return 0;
33567 *frame = PyFrame_New(
33568 PyThreadState_GET(), /*PyThreadState *tstate*/
33569 *code, /*PyCodeObject *code*/
33570 PyModule_GetDict(__pyx_m), /*PyObject *globals*/
33571 0 /*PyObject *locals*/
33573 if (*frame == NULL) return 0;
33576 (*frame)->f_tstate = PyThreadState_GET();
33578 return PyThreadState_GET()->c_profilefunc(PyThreadState_GET()->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
33581 static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) {
33582 PyObject *py_srcfile = 0;
33583 PyObject *py_funcname = 0;
33584 PyCodeObject *py_code = 0;
33586 #if PY_MAJOR_VERSION < 3
33587 py_funcname = PyString_FromString(funcname);
33588 py_srcfile = PyString_FromString(srcfile);
33590 py_funcname = PyUnicode_FromString(funcname);
33591 py_srcfile = PyUnicode_FromString(srcfile);
33593 if (!py_funcname | !py_srcfile) goto bad;
33595 py_code = PyCode_New(
33596 0, /*int argcount,*/
33597 #if PY_MAJOR_VERSION >= 3
33598 0, /*int kwonlyargcount,*/
33600 0, /*int nlocals,*/
33601 0, /*int stacksize,*/
33603 __pyx_empty_bytes, /*PyObject *code,*/
33604 __pyx_empty_tuple, /*PyObject *consts,*/
33605 __pyx_empty_tuple, /*PyObject *names,*/
33606 __pyx_empty_tuple, /*PyObject *varnames,*/
33607 __pyx_empty_tuple, /*PyObject *freevars,*/
33608 __pyx_empty_tuple, /*PyObject *cellvars,*/
33609 py_srcfile, /*PyObject *filename,*/
33610 py_funcname, /*PyObject *name,*/
33611 firstlineno, /*int firstlineno,*/
33612 __pyx_empty_bytes /*PyObject *lnotab*/
33616 Py_XDECREF(py_srcfile);
33617 Py_XDECREF(py_funcname);
33622 #endif /* CYTHON_PROFILE */
33624 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
33625 if (unlikely(!type)) {
33626 PyErr_Format(PyExc_SystemError, "Missing type object");
33629 if (likely(PyObject_TypeCheck(obj, type)))
33631 PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
33632 Py_TYPE(obj)->tp_name, type->tp_name);
33636 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
33637 PyErr_Format(PyExc_ValueError,
33638 #if PY_VERSION_HEX < 0x02050000
33639 "need more than %d value%s to unpack", (int)index,
33641 "need more than %zd value%s to unpack", index,
33643 (index == 1) ? "" : "s");
33646 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
33647 PyErr_Format(PyExc_ValueError,
33648 #if PY_VERSION_HEX < 0x02050000
33649 "too many values to unpack (expected %d)", (int)expected);
33651 "too many values to unpack (expected %zd)", expected);
33655 static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
33657 if (!(item = PyIter_Next(iter))) {
33658 if (!PyErr_Occurred()) {
33659 __Pyx_RaiseNeedMoreValuesError(index);
33665 static int __Pyx_EndUnpack(PyObject *iter, Py_ssize_t expected) {
33667 if ((item = PyIter_Next(iter))) {
33669 __Pyx_RaiseTooManyValuesError(expected);
33672 else if (!PyErr_Occurred())
33678 static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
33680 const char* function_name,
33684 Py_ssize_t pos = 0;
33685 while (PyDict_Next(kwdict, &pos, &key, 0)) {
33686 #if PY_MAJOR_VERSION < 3
33687 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
33689 if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key)))
33691 goto invalid_keyword_type;
33693 if ((!kw_allowed) && unlikely(key))
33694 goto invalid_keyword;
33696 invalid_keyword_type:
33697 PyErr_Format(PyExc_TypeError,
33698 "%s() keywords must be strings", function_name);
33701 PyErr_Format(PyExc_TypeError,
33702 #if PY_MAJOR_VERSION < 3
33703 "%s() got an unexpected keyword argument '%s'",
33704 function_name, PyString_AsString(key));
33706 "%s() got an unexpected keyword argument '%U'",
33707 function_name, key);
33712 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
33713 PyObject *tmp_type, *tmp_value, *tmp_tb;
33714 PyThreadState *tstate = PyThreadState_GET();
33716 tmp_type = tstate->curexc_type;
33717 tmp_value = tstate->curexc_value;
33718 tmp_tb = tstate->curexc_traceback;
33719 tstate->curexc_type = type;
33720 tstate->curexc_value = value;
33721 tstate->curexc_traceback = tb;
33722 Py_XDECREF(tmp_type);
33723 Py_XDECREF(tmp_value);
33724 Py_XDECREF(tmp_tb);
33727 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
33728 PyThreadState *tstate = PyThreadState_GET();
33729 *type = tstate->curexc_type;
33730 *value = tstate->curexc_value;
33731 *tb = tstate->curexc_traceback;
33733 tstate->curexc_type = 0;
33734 tstate->curexc_value = 0;
33735 tstate->curexc_traceback = 0;
33739 #if PY_MAJOR_VERSION < 3
33740 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
33744 /* First, check the traceback argument, replacing None with NULL. */
33745 if (tb == Py_None) {
33749 else if (tb != NULL && !PyTraceBack_Check(tb)) {
33750 PyErr_SetString(PyExc_TypeError,
33751 "raise: arg 3 must be a traceback or None");
33754 /* Next, replace a missing value with None */
33755 if (value == NULL) {
33759 #if PY_VERSION_HEX < 0x02050000
33760 if (!PyClass_Check(type))
33762 if (!PyType_Check(type))
33765 /* Raising an instance. The value should be a dummy. */
33766 if (value != Py_None) {
33767 PyErr_SetString(PyExc_TypeError,
33768 "instance exception may not have a separate value");
33771 /* Normalize to raise <class>, <instance> */
33774 #if PY_VERSION_HEX < 0x02050000
33775 if (PyInstance_Check(type)) {
33776 type = (PyObject*) ((PyInstanceObject*)type)->in_class;
33781 PyErr_SetString(PyExc_TypeError,
33782 "raise: exception must be an old-style class or instance");
33786 type = (PyObject*) Py_TYPE(type);
33788 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
33789 PyErr_SetString(PyExc_TypeError,
33790 "raise: exception class must be a subclass of BaseException");
33796 __Pyx_ErrRestore(type, value, tb);
33805 #else /* Python 3+ */
33807 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
33808 if (tb == Py_None) {
33810 } else if (tb && !PyTraceBack_Check(tb)) {
33811 PyErr_SetString(PyExc_TypeError,
33812 "raise: arg 3 must be a traceback or None");
33815 if (value == Py_None)
33818 if (PyExceptionInstance_Check(type)) {
33820 PyErr_SetString(PyExc_TypeError,
33821 "instance exception may not have a separate value");
33825 type = (PyObject*) Py_TYPE(value);
33826 } else if (!PyExceptionClass_Check(type)) {
33827 PyErr_SetString(PyExc_TypeError,
33828 "raise: exception class must be a subclass of BaseException");
33832 PyErr_SetObject(type, value);
33835 PyThreadState *tstate = PyThreadState_GET();
33836 PyObject* tmp_tb = tstate->curexc_traceback;
33837 if (tb != tmp_tb) {
33839 tstate->curexc_traceback = tb;
33840 Py_XDECREF(tmp_tb);
33849 static void __Pyx_RaiseDoubleKeywordsError(
33850 const char* func_name,
33853 PyErr_Format(PyExc_TypeError,
33854 #if PY_MAJOR_VERSION >= 3
33855 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
33857 "%s() got multiple values for keyword argument '%s'", func_name,
33858 PyString_AS_STRING(kw_name));
33862 static int __Pyx_ParseOptionalKeywords(
33864 PyObject **argnames[],
33866 PyObject *values[],
33867 Py_ssize_t num_pos_args,
33868 const char* function_name)
33870 PyObject *key = 0, *value = 0;
33871 Py_ssize_t pos = 0;
33873 PyObject*** first_kw_arg = argnames + num_pos_args;
33875 while (PyDict_Next(kwds, &pos, &key, &value)) {
33876 name = first_kw_arg;
33877 while (*name && (**name != key)) name++;
33879 values[name-argnames] = value;
33881 #if PY_MAJOR_VERSION < 3
33882 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
33884 if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
33886 goto invalid_keyword_type;
33888 for (name = first_kw_arg; *name; name++) {
33889 #if PY_MAJOR_VERSION >= 3
33890 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
33891 PyUnicode_Compare(**name, key) == 0) break;
33893 if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
33894 _PyString_Eq(**name, key)) break;
33898 values[name-argnames] = value;
33900 /* unexpected keyword found */
33901 for (name=argnames; name != first_kw_arg; name++) {
33902 if (**name == key) goto arg_passed_twice;
33903 #if PY_MAJOR_VERSION >= 3
33904 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
33905 PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
33907 if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
33908 _PyString_Eq(**name, key)) goto arg_passed_twice;
33912 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
33914 goto invalid_keyword;
33922 __Pyx_RaiseDoubleKeywordsError(function_name, **name);
33924 invalid_keyword_type:
33925 PyErr_Format(PyExc_TypeError,
33926 "%s() keywords must be strings", function_name);
33929 PyErr_Format(PyExc_TypeError,
33930 #if PY_MAJOR_VERSION < 3
33931 "%s() got an unexpected keyword argument '%s'",
33932 function_name, PyString_AsString(key));
33934 "%s() got an unexpected keyword argument '%U'",
33935 function_name, key);
33941 static void __Pyx_RaiseArgtupleInvalid(
33942 const char* func_name,
33944 Py_ssize_t num_min,
33945 Py_ssize_t num_max,
33946 Py_ssize_t num_found)
33948 Py_ssize_t num_expected;
33949 const char *number, *more_or_less;
33951 if (num_found < num_min) {
33952 num_expected = num_min;
33953 more_or_less = "at least";
33955 num_expected = num_max;
33956 more_or_less = "at most";
33959 more_or_less = "exactly";
33961 number = (num_expected == 1) ? "" : "s";
33962 PyErr_Format(PyExc_TypeError,
33963 #if PY_VERSION_HEX < 0x02050000
33964 "%s() takes %s %d positional argument%s (%d given)",
33966 "%s() takes %s %zd positional argument%s (%zd given)",
33968 func_name, more_or_less, num_expected, number, num_found);
33971 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
33972 const char *name, int exact)
33975 PyErr_Format(PyExc_SystemError, "Missing type object");
33978 if (none_allowed && obj == Py_None) return 1;
33980 if (Py_TYPE(obj) == type) return 1;
33983 if (PyObject_TypeCheck(obj, type)) return 1;
33985 PyErr_Format(PyExc_TypeError,
33986 "Argument '%s' has incorrect type (expected %s, got %s)",
33987 name, type->tp_name, Py_TYPE(obj)->tp_name);
33991 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
33992 PyObject *local_type, *local_value, *local_tb;
33993 PyObject *tmp_type, *tmp_value, *tmp_tb;
33994 PyThreadState *tstate = PyThreadState_GET();
33995 local_type = tstate->curexc_type;
33996 local_value = tstate->curexc_value;
33997 local_tb = tstate->curexc_traceback;
33998 tstate->curexc_type = 0;
33999 tstate->curexc_value = 0;
34000 tstate->curexc_traceback = 0;
34001 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
34002 if (unlikely(tstate->curexc_type))
34004 #if PY_MAJOR_VERSION >= 3
34005 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
34008 *type = local_type;
34009 *value = local_value;
34011 Py_INCREF(local_type);
34012 Py_INCREF(local_value);
34013 Py_INCREF(local_tb);
34014 tmp_type = tstate->exc_type;
34015 tmp_value = tstate->exc_value;
34016 tmp_tb = tstate->exc_traceback;
34017 tstate->exc_type = local_type;
34018 tstate->exc_value = local_value;
34019 tstate->exc_traceback = local_tb;
34020 /* Make sure tstate is in a consistent state when we XDECREF
34021 these objects (XDECREF may run arbitrary code). */
34022 Py_XDECREF(tmp_type);
34023 Py_XDECREF(tmp_value);
34024 Py_XDECREF(tmp_tb);
34030 Py_XDECREF(local_type);
34031 Py_XDECREF(local_value);
34032 Py_XDECREF(local_tb);
34038 static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) {
34039 PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable");
34042 static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
34045 q -= ((r != 0) & ((r ^ b) < 0));
34049 static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
34051 r += ((r != 0) & ((r ^ b) < 0)) * b;
34056 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
34057 PyThreadState *tstate = PyThreadState_GET();
34058 *type = tstate->exc_type;
34059 *value = tstate->exc_value;
34060 *tb = tstate->exc_traceback;
34062 Py_XINCREF(*value);
34066 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
34067 PyObject *tmp_type, *tmp_value, *tmp_tb;
34068 PyThreadState *tstate = PyThreadState_GET();
34069 tmp_type = tstate->exc_type;
34070 tmp_value = tstate->exc_value;
34071 tmp_tb = tstate->exc_traceback;
34072 tstate->exc_type = type;
34073 tstate->exc_value = value;
34074 tstate->exc_traceback = tb;
34075 Py_XDECREF(tmp_type);
34076 Py_XDECREF(tmp_value);
34077 Py_XDECREF(tmp_tb);
34080 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
34081 PyObject *py_import = 0;
34082 PyObject *empty_list = 0;
34083 PyObject *module = 0;
34084 PyObject *global_dict = 0;
34085 PyObject *empty_dict = 0;
34087 py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
34093 empty_list = PyList_New(0);
34098 global_dict = PyModule_GetDict(__pyx_m);
34101 empty_dict = PyDict_New();
34104 module = PyObject_CallFunctionObjArgs(py_import,
34105 name, global_dict, empty_dict, list, NULL);
34107 Py_XDECREF(empty_list);
34108 Py_XDECREF(py_import);
34109 Py_XDECREF(empty_dict);
34113 static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
34114 PyObject *metaclass;
34115 /* Default metaclass */
34116 #if PY_MAJOR_VERSION < 3
34117 if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
34118 PyObject *base = PyTuple_GET_ITEM(bases, 0);
34119 metaclass = PyObject_GetAttrString(base, "__class__");
34122 metaclass = (PyObject*) Py_TYPE(base);
34125 metaclass = (PyObject *) &PyClass_Type;
34128 if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
34129 PyObject *base = PyTuple_GET_ITEM(bases, 0);
34130 metaclass = (PyObject*) Py_TYPE(base);
34132 metaclass = (PyObject *) &PyType_Type;
34135 Py_INCREF(metaclass);
34139 static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
34140 PyObject *modname) {
34142 PyObject *metaclass;
34144 if (PyDict_SetItemString(dict, "__module__", modname) < 0)
34147 /* Python2 __metaclass__ */
34148 metaclass = PyDict_GetItemString(dict, "__metaclass__");
34150 Py_INCREF(metaclass);
34152 metaclass = __Pyx_FindPy2Metaclass(bases);
34154 result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
34155 Py_DECREF(metaclass);
34160 static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) {
34161 __pyx_binding_PyCFunctionType_object *op = PyObject_GC_New(__pyx_binding_PyCFunctionType_object, __pyx_binding_PyCFunctionType);
34164 op->func.m_ml = ml;
34166 op->func.m_self = self;
34167 Py_XINCREF(module);
34168 op->func.m_module = module;
34169 PyObject_GC_Track(op);
34170 return (PyObject *)op;
34173 static void __pyx_binding_PyCFunctionType_dealloc(__pyx_binding_PyCFunctionType_object *m) {
34174 PyObject_GC_UnTrack(m);
34175 Py_XDECREF(m->func.m_self);
34176 Py_XDECREF(m->func.m_module);
34177 PyObject_GC_Del(m);
34180 static PyObject *__pyx_binding_PyCFunctionType_descr_get(PyObject *func, PyObject *obj, PyObject *type) {
34181 if (obj == Py_None)
34183 return PyMethod_New(func, obj, type);
34186 static int __pyx_binding_PyCFunctionType_init(void) {
34187 __pyx_binding_PyCFunctionType_type = PyCFunction_Type;
34188 __pyx_binding_PyCFunctionType_type.tp_name = __Pyx_NAMESTR("cython_binding_builtin_function_or_method");
34189 __pyx_binding_PyCFunctionType_type.tp_dealloc = (destructor)__pyx_binding_PyCFunctionType_dealloc;
34190 __pyx_binding_PyCFunctionType_type.tp_descr_get = __pyx_binding_PyCFunctionType_descr_get;
34191 if (PyType_Ready(&__pyx_binding_PyCFunctionType_type) < 0) {
34194 __pyx_binding_PyCFunctionType = &__pyx_binding_PyCFunctionType_type;
34199 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t val) {
34200 const uint32_t neg_one = (uint32_t)-1, const_zero = (uint32_t)0;
34201 const int is_unsigned = const_zero < neg_one;
34202 if ((sizeof(uint32_t) == sizeof(char)) ||
34203 (sizeof(uint32_t) == sizeof(short))) {
34204 return PyInt_FromLong((long)val);
34205 } else if ((sizeof(uint32_t) == sizeof(int)) ||
34206 (sizeof(uint32_t) == sizeof(long))) {
34208 return PyLong_FromUnsignedLong((unsigned long)val);
34210 return PyInt_FromLong((long)val);
34211 } else if (sizeof(uint32_t) == sizeof(PY_LONG_LONG)) {
34213 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
34215 return PyLong_FromLongLong((PY_LONG_LONG)val);
34217 int one = 1; int little = (int)*(unsigned char *)&one;
34218 unsigned char *bytes = (unsigned char *)&val;
34219 return _PyLong_FromByteArray(bytes, sizeof(uint32_t),
34220 little, !is_unsigned);
34224 static CYTHON_INLINE uint32_t __Pyx_PyInt_from_py_uint32_t(PyObject* x) {
34225 const uint32_t neg_one = (uint32_t)-1, const_zero = (uint32_t)0;
34226 const int is_unsigned = const_zero < neg_one;
34227 if (sizeof(uint32_t) == sizeof(char)) {
34229 return (uint32_t)__Pyx_PyInt_AsUnsignedChar(x);
34231 return (uint32_t)__Pyx_PyInt_AsSignedChar(x);
34232 } else if (sizeof(uint32_t) == sizeof(short)) {
34234 return (uint32_t)__Pyx_PyInt_AsUnsignedShort(x);
34236 return (uint32_t)__Pyx_PyInt_AsSignedShort(x);
34237 } else if (sizeof(uint32_t) == sizeof(int)) {
34239 return (uint32_t)__Pyx_PyInt_AsUnsignedInt(x);
34241 return (uint32_t)__Pyx_PyInt_AsSignedInt(x);
34242 } else if (sizeof(uint32_t) == sizeof(long)) {
34244 return (uint32_t)__Pyx_PyInt_AsUnsignedLong(x);
34246 return (uint32_t)__Pyx_PyInt_AsSignedLong(x);
34247 } else if (sizeof(uint32_t) == sizeof(PY_LONG_LONG)) {
34249 return (uint32_t)__Pyx_PyInt_AsUnsignedLongLong(x);
34251 return (uint32_t)__Pyx_PyInt_AsSignedLongLong(x);
34254 PyObject *v = __Pyx_PyNumber_Int(x);
34255 #if PY_VERSION_HEX < 0x03000000
34256 if (likely(v) && !PyLong_Check(v)) {
34258 v = PyNumber_Long(tmp);
34263 int one = 1; int is_little = (int)*(unsigned char *)&one;
34264 unsigned char *bytes = (unsigned char *)&val;
34265 int ret = _PyLong_AsByteArray((PyLongObject *)v,
34266 bytes, sizeof(val),
34267 is_little, !is_unsigned);
34272 return (uint32_t)-1;
34276 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int32_t(int32_t val) {
34277 const int32_t neg_one = (int32_t)-1, const_zero = (int32_t)0;
34278 const int is_unsigned = const_zero < neg_one;
34279 if ((sizeof(int32_t) == sizeof(char)) ||
34280 (sizeof(int32_t) == sizeof(short))) {
34281 return PyInt_FromLong((long)val);
34282 } else if ((sizeof(int32_t) == sizeof(int)) ||
34283 (sizeof(int32_t) == sizeof(long))) {
34285 return PyLong_FromUnsignedLong((unsigned long)val);
34287 return PyInt_FromLong((long)val);
34288 } else if (sizeof(int32_t) == sizeof(PY_LONG_LONG)) {
34290 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
34292 return PyLong_FromLongLong((PY_LONG_LONG)val);
34294 int one = 1; int little = (int)*(unsigned char *)&one;
34295 unsigned char *bytes = (unsigned char *)&val;
34296 return _PyLong_FromByteArray(bytes, sizeof(int32_t),
34297 little, !is_unsigned);
34301 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int64_t(int64_t val) {
34302 const int64_t neg_one = (int64_t)-1, const_zero = (int64_t)0;
34303 const int is_unsigned = const_zero < neg_one;
34304 if ((sizeof(int64_t) == sizeof(char)) ||
34305 (sizeof(int64_t) == sizeof(short))) {
34306 return PyInt_FromLong((long)val);
34307 } else if ((sizeof(int64_t) == sizeof(int)) ||
34308 (sizeof(int64_t) == sizeof(long))) {
34310 return PyLong_FromUnsignedLong((unsigned long)val);
34312 return PyInt_FromLong((long)val);
34313 } else if (sizeof(int64_t) == sizeof(PY_LONG_LONG)) {
34315 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
34317 return PyLong_FromLongLong((PY_LONG_LONG)val);
34319 int one = 1; int little = (int)*(unsigned char *)&one;
34320 unsigned char *bytes = (unsigned char *)&val;
34321 return _PyLong_FromByteArray(bytes, sizeof(int64_t),
34322 little, !is_unsigned);
34326 static CYTHON_INLINE uint64_t __Pyx_PyInt_from_py_uint64_t(PyObject* x) {
34327 const uint64_t neg_one = (uint64_t)-1, const_zero = (uint64_t)0;
34328 const int is_unsigned = const_zero < neg_one;
34329 if (sizeof(uint64_t) == sizeof(char)) {
34331 return (uint64_t)__Pyx_PyInt_AsUnsignedChar(x);
34333 return (uint64_t)__Pyx_PyInt_AsSignedChar(x);
34334 } else if (sizeof(uint64_t) == sizeof(short)) {
34336 return (uint64_t)__Pyx_PyInt_AsUnsignedShort(x);
34338 return (uint64_t)__Pyx_PyInt_AsSignedShort(x);
34339 } else if (sizeof(uint64_t) == sizeof(int)) {
34341 return (uint64_t)__Pyx_PyInt_AsUnsignedInt(x);
34343 return (uint64_t)__Pyx_PyInt_AsSignedInt(x);
34344 } else if (sizeof(uint64_t) == sizeof(long)) {
34346 return (uint64_t)__Pyx_PyInt_AsUnsignedLong(x);
34348 return (uint64_t)__Pyx_PyInt_AsSignedLong(x);
34349 } else if (sizeof(uint64_t) == sizeof(PY_LONG_LONG)) {
34351 return (uint64_t)__Pyx_PyInt_AsUnsignedLongLong(x);
34353 return (uint64_t)__Pyx_PyInt_AsSignedLongLong(x);
34356 PyObject *v = __Pyx_PyNumber_Int(x);
34357 #if PY_VERSION_HEX < 0x03000000
34358 if (likely(v) && !PyLong_Check(v)) {
34360 v = PyNumber_Long(tmp);
34365 int one = 1; int is_little = (int)*(unsigned char *)&one;
34366 unsigned char *bytes = (unsigned char *)&val;
34367 int ret = _PyLong_AsByteArray((PyLongObject *)v,
34368 bytes, sizeof(val),
34369 is_little, !is_unsigned);
34374 return (uint64_t)-1;
34378 static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject* x) {
34379 const int32_t neg_one = (int32_t)-1, const_zero = (int32_t)0;
34380 const int is_unsigned = const_zero < neg_one;
34381 if (sizeof(int32_t) == sizeof(char)) {
34383 return (int32_t)__Pyx_PyInt_AsUnsignedChar(x);
34385 return (int32_t)__Pyx_PyInt_AsSignedChar(x);
34386 } else if (sizeof(int32_t) == sizeof(short)) {
34388 return (int32_t)__Pyx_PyInt_AsUnsignedShort(x);
34390 return (int32_t)__Pyx_PyInt_AsSignedShort(x);
34391 } else if (sizeof(int32_t) == sizeof(int)) {
34393 return (int32_t)__Pyx_PyInt_AsUnsignedInt(x);
34395 return (int32_t)__Pyx_PyInt_AsSignedInt(x);
34396 } else if (sizeof(int32_t) == sizeof(long)) {
34398 return (int32_t)__Pyx_PyInt_AsUnsignedLong(x);
34400 return (int32_t)__Pyx_PyInt_AsSignedLong(x);
34401 } else if (sizeof(int32_t) == sizeof(PY_LONG_LONG)) {
34403 return (int32_t)__Pyx_PyInt_AsUnsignedLongLong(x);
34405 return (int32_t)__Pyx_PyInt_AsSignedLongLong(x);
34408 PyObject *v = __Pyx_PyNumber_Int(x);
34409 #if PY_VERSION_HEX < 0x03000000
34410 if (likely(v) && !PyLong_Check(v)) {
34412 v = PyNumber_Long(tmp);
34417 int one = 1; int is_little = (int)*(unsigned char *)&one;
34418 unsigned char *bytes = (unsigned char *)&val;
34419 int ret = _PyLong_AsByteArray((PyLongObject *)v,
34420 bytes, sizeof(val),
34421 is_little, !is_unsigned);
34426 return (int32_t)-1;
34430 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint8_t(uint8_t val) {
34431 const uint8_t neg_one = (uint8_t)-1, const_zero = (uint8_t)0;
34432 const int is_unsigned = const_zero < neg_one;
34433 if ((sizeof(uint8_t) == sizeof(char)) ||
34434 (sizeof(uint8_t) == sizeof(short))) {
34435 return PyInt_FromLong((long)val);
34436 } else if ((sizeof(uint8_t) == sizeof(int)) ||
34437 (sizeof(uint8_t) == sizeof(long))) {
34439 return PyLong_FromUnsignedLong((unsigned long)val);
34441 return PyInt_FromLong((long)val);
34442 } else if (sizeof(uint8_t) == sizeof(PY_LONG_LONG)) {
34444 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
34446 return PyLong_FromLongLong((PY_LONG_LONG)val);
34448 int one = 1; int little = (int)*(unsigned char *)&one;
34449 unsigned char *bytes = (unsigned char *)&val;
34450 return _PyLong_FromByteArray(bytes, sizeof(uint8_t),
34451 little, !is_unsigned);
34455 static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint64_t(uint64_t val) {
34456 const uint64_t neg_one = (uint64_t)-1, const_zero = (uint64_t)0;
34457 const int is_unsigned = const_zero < neg_one;
34458 if ((sizeof(uint64_t) == sizeof(char)) ||
34459 (sizeof(uint64_t) == sizeof(short))) {
34460 return PyInt_FromLong((long)val);
34461 } else if ((sizeof(uint64_t) == sizeof(int)) ||
34462 (sizeof(uint64_t) == sizeof(long))) {
34464 return PyLong_FromUnsignedLong((unsigned long)val);
34466 return PyInt_FromLong((long)val);
34467 } else if (sizeof(uint64_t) == sizeof(PY_LONG_LONG)) {
34469 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
34471 return PyLong_FromLongLong((PY_LONG_LONG)val);
34473 int one = 1; int little = (int)*(unsigned char *)&one;
34474 unsigned char *bytes = (unsigned char *)&val;
34475 return _PyLong_FromByteArray(bytes, sizeof(uint64_t),
34476 little, !is_unsigned);
34480 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
34481 const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
34482 const int is_unsigned = neg_one > const_zero;
34483 if (sizeof(unsigned char) < sizeof(long)) {
34484 long val = __Pyx_PyInt_AsLong(x);
34485 if (unlikely(val != (long)(unsigned char)val)) {
34486 if (!unlikely(val == -1 && PyErr_Occurred())) {
34487 PyErr_SetString(PyExc_OverflowError,
34488 (is_unsigned && unlikely(val < 0)) ?
34489 "can't convert negative value to unsigned char" :
34490 "value too large to convert to unsigned char");
34492 return (unsigned char)-1;
34494 return (unsigned char)val;
34496 return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
34499 static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
34500 const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
34501 const int is_unsigned = neg_one > const_zero;
34502 if (sizeof(unsigned short) < sizeof(long)) {
34503 long val = __Pyx_PyInt_AsLong(x);
34504 if (unlikely(val != (long)(unsigned short)val)) {
34505 if (!unlikely(val == -1 && PyErr_Occurred())) {
34506 PyErr_SetString(PyExc_OverflowError,
34507 (is_unsigned && unlikely(val < 0)) ?
34508 "can't convert negative value to unsigned short" :
34509 "value too large to convert to unsigned short");
34511 return (unsigned short)-1;
34513 return (unsigned short)val;
34515 return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
34518 static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
34519 const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
34520 const int is_unsigned = neg_one > const_zero;
34521 if (sizeof(unsigned int) < sizeof(long)) {
34522 long val = __Pyx_PyInt_AsLong(x);
34523 if (unlikely(val != (long)(unsigned int)val)) {
34524 if (!unlikely(val == -1 && PyErr_Occurred())) {
34525 PyErr_SetString(PyExc_OverflowError,
34526 (is_unsigned && unlikely(val < 0)) ?
34527 "can't convert negative value to unsigned int" :
34528 "value too large to convert to unsigned int");
34530 return (unsigned int)-1;
34532 return (unsigned int)val;
34534 return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
34537 static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
34538 const char neg_one = (char)-1, const_zero = 0;
34539 const int is_unsigned = neg_one > const_zero;
34540 if (sizeof(char) < sizeof(long)) {
34541 long val = __Pyx_PyInt_AsLong(x);
34542 if (unlikely(val != (long)(char)val)) {
34543 if (!unlikely(val == -1 && PyErr_Occurred())) {
34544 PyErr_SetString(PyExc_OverflowError,
34545 (is_unsigned && unlikely(val < 0)) ?
34546 "can't convert negative value to char" :
34547 "value too large to convert to char");
34553 return (char)__Pyx_PyInt_AsLong(x);
34556 static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
34557 const short neg_one = (short)-1, const_zero = 0;
34558 const int is_unsigned = neg_one > const_zero;
34559 if (sizeof(short) < sizeof(long)) {
34560 long val = __Pyx_PyInt_AsLong(x);
34561 if (unlikely(val != (long)(short)val)) {
34562 if (!unlikely(val == -1 && PyErr_Occurred())) {
34563 PyErr_SetString(PyExc_OverflowError,
34564 (is_unsigned && unlikely(val < 0)) ?
34565 "can't convert negative value to short" :
34566 "value too large to convert to short");
34572 return (short)__Pyx_PyInt_AsLong(x);
34575 static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
34576 const int neg_one = (int)-1, const_zero = 0;
34577 const int is_unsigned = neg_one > const_zero;
34578 if (sizeof(int) < sizeof(long)) {
34579 long val = __Pyx_PyInt_AsLong(x);
34580 if (unlikely(val != (long)(int)val)) {
34581 if (!unlikely(val == -1 && PyErr_Occurred())) {
34582 PyErr_SetString(PyExc_OverflowError,
34583 (is_unsigned && unlikely(val < 0)) ?
34584 "can't convert negative value to int" :
34585 "value too large to convert to int");
34591 return (int)__Pyx_PyInt_AsLong(x);
34594 static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
34595 const signed char neg_one = (signed char)-1, const_zero = 0;
34596 const int is_unsigned = neg_one > const_zero;
34597 if (sizeof(signed char) < sizeof(long)) {
34598 long val = __Pyx_PyInt_AsLong(x);
34599 if (unlikely(val != (long)(signed char)val)) {
34600 if (!unlikely(val == -1 && PyErr_Occurred())) {
34601 PyErr_SetString(PyExc_OverflowError,
34602 (is_unsigned && unlikely(val < 0)) ?
34603 "can't convert negative value to signed char" :
34604 "value too large to convert to signed char");
34606 return (signed char)-1;
34608 return (signed char)val;
34610 return (signed char)__Pyx_PyInt_AsSignedLong(x);
34613 static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
34614 const signed short neg_one = (signed short)-1, const_zero = 0;
34615 const int is_unsigned = neg_one > const_zero;
34616 if (sizeof(signed short) < sizeof(long)) {
34617 long val = __Pyx_PyInt_AsLong(x);
34618 if (unlikely(val != (long)(signed short)val)) {
34619 if (!unlikely(val == -1 && PyErr_Occurred())) {
34620 PyErr_SetString(PyExc_OverflowError,
34621 (is_unsigned && unlikely(val < 0)) ?
34622 "can't convert negative value to signed short" :
34623 "value too large to convert to signed short");
34625 return (signed short)-1;
34627 return (signed short)val;
34629 return (signed short)__Pyx_PyInt_AsSignedLong(x);
34632 static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
34633 const signed int neg_one = (signed int)-1, const_zero = 0;
34634 const int is_unsigned = neg_one > const_zero;
34635 if (sizeof(signed int) < sizeof(long)) {
34636 long val = __Pyx_PyInt_AsLong(x);
34637 if (unlikely(val != (long)(signed int)val)) {
34638 if (!unlikely(val == -1 && PyErr_Occurred())) {
34639 PyErr_SetString(PyExc_OverflowError,
34640 (is_unsigned && unlikely(val < 0)) ?
34641 "can't convert negative value to signed int" :
34642 "value too large to convert to signed int");
34644 return (signed int)-1;
34646 return (signed int)val;
34648 return (signed int)__Pyx_PyInt_AsSignedLong(x);
34651 static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
34652 const int neg_one = (int)-1, const_zero = 0;
34653 const int is_unsigned = neg_one > const_zero;
34654 if (sizeof(int) < sizeof(long)) {
34655 long val = __Pyx_PyInt_AsLong(x);
34656 if (unlikely(val != (long)(int)val)) {
34657 if (!unlikely(val == -1 && PyErr_Occurred())) {
34658 PyErr_SetString(PyExc_OverflowError,
34659 (is_unsigned && unlikely(val < 0)) ?
34660 "can't convert negative value to int" :
34661 "value too large to convert to int");
34667 return (int)__Pyx_PyInt_AsLong(x);
34670 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
34671 const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
34672 const int is_unsigned = neg_one > const_zero;
34673 #if PY_VERSION_HEX < 0x03000000
34674 if (likely(PyInt_Check(x))) {
34675 long val = PyInt_AS_LONG(x);
34676 if (is_unsigned && unlikely(val < 0)) {
34677 PyErr_SetString(PyExc_OverflowError,
34678 "can't convert negative value to unsigned long");
34679 return (unsigned long)-1;
34681 return (unsigned long)val;
34684 if (likely(PyLong_Check(x))) {
34686 if (unlikely(Py_SIZE(x) < 0)) {
34687 PyErr_SetString(PyExc_OverflowError,
34688 "can't convert negative value to unsigned long");
34689 return (unsigned long)-1;
34691 return PyLong_AsUnsignedLong(x);
34693 return PyLong_AsLong(x);
34697 PyObject *tmp = __Pyx_PyNumber_Int(x);
34698 if (!tmp) return (unsigned long)-1;
34699 val = __Pyx_PyInt_AsUnsignedLong(tmp);
34705 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
34706 const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
34707 const int is_unsigned = neg_one > const_zero;
34708 #if PY_VERSION_HEX < 0x03000000
34709 if (likely(PyInt_Check(x))) {
34710 long val = PyInt_AS_LONG(x);
34711 if (is_unsigned && unlikely(val < 0)) {
34712 PyErr_SetString(PyExc_OverflowError,
34713 "can't convert negative value to unsigned PY_LONG_LONG");
34714 return (unsigned PY_LONG_LONG)-1;
34716 return (unsigned PY_LONG_LONG)val;
34719 if (likely(PyLong_Check(x))) {
34721 if (unlikely(Py_SIZE(x) < 0)) {
34722 PyErr_SetString(PyExc_OverflowError,
34723 "can't convert negative value to unsigned PY_LONG_LONG");
34724 return (unsigned PY_LONG_LONG)-1;
34726 return PyLong_AsUnsignedLongLong(x);
34728 return PyLong_AsLongLong(x);
34731 unsigned PY_LONG_LONG val;
34732 PyObject *tmp = __Pyx_PyNumber_Int(x);
34733 if (!tmp) return (unsigned PY_LONG_LONG)-1;
34734 val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
34740 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
34741 const long neg_one = (long)-1, const_zero = 0;
34742 const int is_unsigned = neg_one > const_zero;
34743 #if PY_VERSION_HEX < 0x03000000
34744 if (likely(PyInt_Check(x))) {
34745 long val = PyInt_AS_LONG(x);
34746 if (is_unsigned && unlikely(val < 0)) {
34747 PyErr_SetString(PyExc_OverflowError,
34748 "can't convert negative value to long");
34754 if (likely(PyLong_Check(x))) {
34756 if (unlikely(Py_SIZE(x) < 0)) {
34757 PyErr_SetString(PyExc_OverflowError,
34758 "can't convert negative value to long");
34761 return PyLong_AsUnsignedLong(x);
34763 return PyLong_AsLong(x);
34767 PyObject *tmp = __Pyx_PyNumber_Int(x);
34768 if (!tmp) return (long)-1;
34769 val = __Pyx_PyInt_AsLong(tmp);
34775 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
34776 const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
34777 const int is_unsigned = neg_one > const_zero;
34778 #if PY_VERSION_HEX < 0x03000000
34779 if (likely(PyInt_Check(x))) {
34780 long val = PyInt_AS_LONG(x);
34781 if (is_unsigned && unlikely(val < 0)) {
34782 PyErr_SetString(PyExc_OverflowError,
34783 "can't convert negative value to PY_LONG_LONG");
34784 return (PY_LONG_LONG)-1;
34786 return (PY_LONG_LONG)val;
34789 if (likely(PyLong_Check(x))) {
34791 if (unlikely(Py_SIZE(x) < 0)) {
34792 PyErr_SetString(PyExc_OverflowError,
34793 "can't convert negative value to PY_LONG_LONG");
34794 return (PY_LONG_LONG)-1;
34796 return PyLong_AsUnsignedLongLong(x);
34798 return PyLong_AsLongLong(x);
34802 PyObject *tmp = __Pyx_PyNumber_Int(x);
34803 if (!tmp) return (PY_LONG_LONG)-1;
34804 val = __Pyx_PyInt_AsLongLong(tmp);
34810 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
34811 const signed long neg_one = (signed long)-1, const_zero = 0;
34812 const int is_unsigned = neg_one > const_zero;
34813 #if PY_VERSION_HEX < 0x03000000
34814 if (likely(PyInt_Check(x))) {
34815 long val = PyInt_AS_LONG(x);
34816 if (is_unsigned && unlikely(val < 0)) {
34817 PyErr_SetString(PyExc_OverflowError,
34818 "can't convert negative value to signed long");
34819 return (signed long)-1;
34821 return (signed long)val;
34824 if (likely(PyLong_Check(x))) {
34826 if (unlikely(Py_SIZE(x) < 0)) {
34827 PyErr_SetString(PyExc_OverflowError,
34828 "can't convert negative value to signed long");
34829 return (signed long)-1;
34831 return PyLong_AsUnsignedLong(x);
34833 return PyLong_AsLong(x);
34837 PyObject *tmp = __Pyx_PyNumber_Int(x);
34838 if (!tmp) return (signed long)-1;
34839 val = __Pyx_PyInt_AsSignedLong(tmp);
34845 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
34846 const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
34847 const int is_unsigned = neg_one > const_zero;
34848 #if PY_VERSION_HEX < 0x03000000
34849 if (likely(PyInt_Check(x))) {
34850 long val = PyInt_AS_LONG(x);
34851 if (is_unsigned && unlikely(val < 0)) {
34852 PyErr_SetString(PyExc_OverflowError,
34853 "can't convert negative value to signed PY_LONG_LONG");
34854 return (signed PY_LONG_LONG)-1;
34856 return (signed PY_LONG_LONG)val;
34859 if (likely(PyLong_Check(x))) {
34861 if (unlikely(Py_SIZE(x) < 0)) {
34862 PyErr_SetString(PyExc_OverflowError,
34863 "can't convert negative value to signed PY_LONG_LONG");
34864 return (signed PY_LONG_LONG)-1;
34866 return PyLong_AsUnsignedLongLong(x);
34868 return PyLong_AsLongLong(x);
34871 signed PY_LONG_LONG val;
34872 PyObject *tmp = __Pyx_PyNumber_Int(x);
34873 if (!tmp) return (signed PY_LONG_LONG)-1;
34874 val = __Pyx_PyInt_AsSignedLongLong(tmp);
34880 static void __Pyx_WriteUnraisable(const char *name) {
34881 PyObject *old_exc, *old_val, *old_tb;
34883 __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
34884 #if PY_MAJOR_VERSION < 3
34885 ctx = PyString_FromString(name);
34887 ctx = PyUnicode_FromString(name);
34889 __Pyx_ErrRestore(old_exc, old_val, old_tb);
34891 PyErr_WriteUnraisable(Py_None);
34893 PyErr_WriteUnraisable(ctx);
34898 #ifndef __PYX_HAVE_RT_ImportType
34899 #define __PYX_HAVE_RT_ImportType
34900 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
34901 long size, int strict)
34903 PyObject *py_module = 0;
34904 PyObject *result = 0;
34905 PyObject *py_name = 0;
34908 py_module = __Pyx_ImportModule(module_name);
34911 #if PY_MAJOR_VERSION < 3
34912 py_name = PyString_FromString(class_name);
34914 py_name = PyUnicode_FromString(class_name);
34918 result = PyObject_GetAttr(py_module, py_name);
34919 Py_DECREF(py_name);
34921 Py_DECREF(py_module);
34925 if (!PyType_Check(result)) {
34926 PyErr_Format(PyExc_TypeError,
34927 "%s.%s is not a type object",
34928 module_name, class_name);
34931 if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) {
34932 PyOS_snprintf(warning, sizeof(warning),
34933 "%s.%s size changed, may indicate binary incompatibility",
34934 module_name, class_name);
34935 #if PY_VERSION_HEX < 0x02050000
34936 PyErr_Warn(NULL, warning);
34938 PyErr_WarnEx(NULL, warning, 0);
34941 else if (((PyTypeObject *)result)->tp_basicsize != size) {
34942 PyErr_Format(PyExc_ValueError,
34943 "%s.%s has the wrong size, try recompiling",
34944 module_name, class_name);
34947 return (PyTypeObject *)result;
34949 Py_XDECREF(py_module);
34950 Py_XDECREF(result);
34955 #ifndef __PYX_HAVE_RT_ImportModule
34956 #define __PYX_HAVE_RT_ImportModule
34957 static PyObject *__Pyx_ImportModule(const char *name) {
34958 PyObject *py_name = 0;
34959 PyObject *py_module = 0;
34961 #if PY_MAJOR_VERSION < 3
34962 py_name = PyString_FromString(name);
34964 py_name = PyUnicode_FromString(name);
34968 py_module = PyImport_Import(py_name);
34969 Py_DECREF(py_name);
34972 Py_XDECREF(py_name);
34977 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
34978 #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
34979 PyObject *ob = PyCapsule_New(vtable, 0, 0);
34981 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
34985 if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
34994 #include "compile.h"
34995 #include "frameobject.h"
34996 #include "traceback.h"
34998 static void __Pyx_AddTraceback(const char *funcname) {
34999 PyObject *py_srcfile = 0;
35000 PyObject *py_funcname = 0;
35001 PyObject *py_globals = 0;
35002 PyCodeObject *py_code = 0;
35003 PyFrameObject *py_frame = 0;
35005 #if PY_MAJOR_VERSION < 3
35006 py_srcfile = PyString_FromString(__pyx_filename);
35008 py_srcfile = PyUnicode_FromString(__pyx_filename);
35010 if (!py_srcfile) goto bad;
35011 if (__pyx_clineno) {
35012 #if PY_MAJOR_VERSION < 3
35013 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
35015 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
35019 #if PY_MAJOR_VERSION < 3
35020 py_funcname = PyString_FromString(funcname);
35022 py_funcname = PyUnicode_FromString(funcname);
35025 if (!py_funcname) goto bad;
35026 py_globals = PyModule_GetDict(__pyx_m);
35027 if (!py_globals) goto bad;
35028 py_code = PyCode_New(
35029 0, /*int argcount,*/
35030 #if PY_MAJOR_VERSION >= 3
35031 0, /*int kwonlyargcount,*/
35033 0, /*int nlocals,*/
35034 0, /*int stacksize,*/
35036 __pyx_empty_bytes, /*PyObject *code,*/
35037 __pyx_empty_tuple, /*PyObject *consts,*/
35038 __pyx_empty_tuple, /*PyObject *names,*/
35039 __pyx_empty_tuple, /*PyObject *varnames,*/
35040 __pyx_empty_tuple, /*PyObject *freevars,*/
35041 __pyx_empty_tuple, /*PyObject *cellvars,*/
35042 py_srcfile, /*PyObject *filename,*/
35043 py_funcname, /*PyObject *name,*/
35044 __pyx_lineno, /*int firstlineno,*/
35045 __pyx_empty_bytes /*PyObject *lnotab*/
35047 if (!py_code) goto bad;
35048 py_frame = PyFrame_New(
35049 PyThreadState_GET(), /*PyThreadState *tstate,*/
35050 py_code, /*PyCodeObject *code,*/
35051 py_globals, /*PyObject *globals,*/
35052 0 /*PyObject *locals*/
35054 if (!py_frame) goto bad;
35055 py_frame->f_lineno = __pyx_lineno;
35056 PyTraceBack_Here(py_frame);
35058 Py_XDECREF(py_srcfile);
35059 Py_XDECREF(py_funcname);
35060 Py_XDECREF(py_code);
35061 Py_XDECREF(py_frame);
35064 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
35066 #if PY_MAJOR_VERSION < 3
35067 if (t->is_unicode) {
35068 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
35069 } else if (t->intern) {
35070 *t->p = PyString_InternFromString(t->s);
35072 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
35074 #else /* Python 3+ has unicode identifiers */
35075 if (t->is_unicode | t->is_str) {
35077 *t->p = PyUnicode_InternFromString(t->s);
35078 } else if (t->encoding) {
35079 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
35081 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
35084 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
35094 /* Type Conversion Functions */
35096 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
35097 int is_true = x == Py_True;
35098 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
35099 else return PyObject_IsTrue(x);
35102 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
35103 PyNumberMethods *m;
35104 const char *name = NULL;
35105 PyObject *res = NULL;
35106 #if PY_VERSION_HEX < 0x03000000
35107 if (PyInt_Check(x) || PyLong_Check(x))
35109 if (PyLong_Check(x))
35111 return Py_INCREF(x), x;
35112 m = Py_TYPE(x)->tp_as_number;
35113 #if PY_VERSION_HEX < 0x03000000
35114 if (m && m->nb_int) {
35116 res = PyNumber_Int(x);
35118 else if (m && m->nb_long) {
35120 res = PyNumber_Long(x);
35123 if (m && m->nb_int) {
35125 res = PyNumber_Long(x);
35129 #if PY_VERSION_HEX < 0x03000000
35130 if (!PyInt_Check(res) && !PyLong_Check(res)) {
35132 if (!PyLong_Check(res)) {
35134 PyErr_Format(PyExc_TypeError,
35135 "__%s__ returned non-%s (type %.200s)",
35136 name, name, Py_TYPE(res)->tp_name);
35141 else if (!PyErr_Occurred()) {
35142 PyErr_SetString(PyExc_TypeError,
35143 "an integer is required");
35148 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
35150 PyObject* x = PyNumber_Index(b);
35152 ival = PyInt_AsSsize_t(x);
35157 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
35158 #if PY_VERSION_HEX < 0x02050000
35159 if (ival <= LONG_MAX)
35160 return PyInt_FromLong((long)ival);
35162 unsigned char *bytes = (unsigned char *) &ival;
35163 int one = 1; int little = (int)*(unsigned char*)&one;
35164 return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
35167 return PyInt_FromSize_t(ival);
35171 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
35172 unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
35173 if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
35175 } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
35176 PyErr_SetString(PyExc_OverflowError,
35177 "value too large to convert to size_t");
35180 return (size_t)val;
35184 #endif /* Py_PYTHON_H */