1 /* Generated by Cython 0.14.1 on Fri Nov 25 20:32:50 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__ctabix
227 #include "sys/types.h"
228 #include "sys/stat.h"
234 #include "pythread.h"
236 #ifdef PYREX_WITHOUT_ASSERTIONS
237 #define CYTHON_WITHOUT_ASSERTIONS
241 /* inline attribute */
242 #ifndef CYTHON_INLINE
243 #if defined(__GNUC__)
244 #define CYTHON_INLINE __inline__
245 #elif defined(_MSC_VER)
246 #define CYTHON_INLINE __inline
247 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
248 #define CYTHON_INLINE inline
250 #define CYTHON_INLINE
254 /* unused attribute */
255 #ifndef CYTHON_UNUSED
256 # if defined(__GNUC__)
257 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
258 # define CYTHON_UNUSED __attribute__ ((__unused__))
260 # define CYTHON_UNUSED
262 # elif defined(__ICC) || defined(__INTEL_COMPILER)
263 # define CYTHON_UNUSED __attribute__ ((__unused__))
265 # define CYTHON_UNUSED
269 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*/
272 /* Type Conversion Predeclarations */
274 #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
275 #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
277 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
278 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
279 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
281 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
282 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
283 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
285 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
289 /* Test for GCC > 2.95 */
290 #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
291 #define likely(x) __builtin_expect(!!(x), 1)
292 #define unlikely(x) __builtin_expect(!!(x), 0)
293 #else /* __GNUC__ > 2 ... */
294 #define likely(x) (x)
295 #define unlikely(x) (x)
296 #endif /* __GNUC__ > 2 ... */
298 #define likely(x) (x)
299 #define unlikely(x) (x)
300 #endif /* __GNUC__ */
302 static PyObject *__pyx_m;
303 static PyObject *__pyx_b;
304 static PyObject *__pyx_empty_tuple;
305 static PyObject *__pyx_empty_bytes;
306 static int __pyx_lineno;
307 static int __pyx_clineno = 0;
308 static const char * __pyx_cfilenm= __FILE__;
309 static const char *__pyx_filename;
312 static const char *__pyx_f[] = {
319 /* Type declarations */
322 * cdef tabix_t * tabixfile
324 * cdef class Parser: # <<<<<<<<<<<<<<
328 struct __pyx_obj_6ctabix_Parser {
335 * cdef class asVCF( Parser ): # <<<<<<<<<<<<<<
336 * '''converts a :term:`tabix row` into a VCF record with
337 * the following fields:
340 struct __pyx_obj_6ctabix_asVCF {
341 struct __pyx_obj_6ctabix_Parser __pyx_base;
344 /* "TabProxies.pxd":42
345 * ctypedef int uint64_t
347 * cdef class TupleProxy: # <<<<<<<<<<<<<<
352 struct __pyx_obj_10TabProxies_TupleProxy {
354 struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtab;
364 /* "TabProxies.pxd":78
365 * cdef update( self, char * buffer, size_t nbytes )
367 * cdef class NamedTupleProxy( TupleProxy) : # <<<<<<<<<<<<<<
372 struct __pyx_obj_10TabProxies_NamedTupleProxy {
373 struct __pyx_obj_10TabProxies_TupleProxy __pyx_base;
376 /* "TabProxies.pxd":81
379 * cdef class BedProxy( NamedTupleProxy) : # <<<<<<<<<<<<<<
384 struct __pyx_obj_10TabProxies_BedProxy {
385 struct __pyx_obj_10TabProxies_NamedTupleProxy __pyx_base;
392 /* "TabProxies.pxd":92
393 * cdef update( self, char * buffer, size_t nbytes )
395 * cdef class VCFProxy( NamedTupleProxy) : # <<<<<<<<<<<<<<
400 struct __pyx_obj_10TabProxies_VCFProxy {
401 struct __pyx_obj_10TabProxies_NamedTupleProxy __pyx_base;
406 /* "TabProxies.pxd":61
407 * cdef update( self, char * buffer, size_t nbytes )
409 * cdef class GTFProxy( TupleProxy) : # <<<<<<<<<<<<<<
414 struct __pyx_obj_10TabProxies_GTFProxy {
415 struct __pyx_obj_10TabProxies_TupleProxy __pyx_base;
425 int hasOwnAttributes;
429 * if self._filename != NULL: free( self._filename )
431 * cdef class TabixIterator: # <<<<<<<<<<<<<<
432 * """iterates over rows in *tabixfile* in region
433 * given by *tid*, *start* and *end*.
436 struct __pyx_obj_6ctabix_TabixIterator {
443 * #########################################################
444 * #########################################################
445 * cdef class TabixIteratorParsed: # <<<<<<<<<<<<<<
446 * """iterates over mapped reads in a region.
450 struct __pyx_obj_6ctabix_TabixIteratorParsed {
454 struct __pyx_obj_6ctabix_Parser *parser;
458 * ti_iter_destroy(self.iterator)
460 * cdef class TabixHeaderIterator: # <<<<<<<<<<<<<<
461 * """return header lines.
465 struct __pyx_obj_6ctabix_TabixHeaderIterator {
472 * # char *ti_iter_read(BGZF *fp, ti_iter_t iter, int *len)
474 * cdef class Tabixfile: # <<<<<<<<<<<<<<
475 * cdef char * _filename
479 struct __pyx_obj_6ctabix_Tabixfile {
488 * cdef class asGTF(Parser): # <<<<<<<<<<<<<<
489 * '''converts a :term:`tabix row` into a GTF record with the following
493 struct __pyx_obj_6ctabix_asGTF {
494 struct __pyx_obj_6ctabix_Parser __pyx_base;
500 * cdef class asBed( Parser ): # <<<<<<<<<<<<<<
501 * '''converts a :term:`tabix row` into a bed record
502 * with the following fields:
505 struct __pyx_obj_6ctabix_asBed {
506 struct __pyx_obj_6ctabix_Parser __pyx_base;
512 * cdef class asTuple(Parser): # <<<<<<<<<<<<<<
513 * '''converts a :term:`tabix row` into a python tuple.
517 struct __pyx_obj_6ctabix_asTuple {
518 struct __pyx_obj_6ctabix_Parser __pyx_base;
522 /* "TabProxies.pxd":42
523 * ctypedef int uint64_t
525 * cdef class TupleProxy: # <<<<<<<<<<<<<<
530 struct __pyx_vtabstruct_10TabProxies_TupleProxy {
531 int (*getMaxFields)(struct __pyx_obj_10TabProxies_TupleProxy *, size_t);
532 PyObject *(*take)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t);
533 PyObject *(*present)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t);
534 PyObject *(*copy)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t);
535 PyObject *(*update)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t);
537 static struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtabptr_10TabProxies_TupleProxy;
540 /* "TabProxies.pxd":78
541 * cdef update( self, char * buffer, size_t nbytes )
543 * cdef class NamedTupleProxy( TupleProxy) : # <<<<<<<<<<<<<<
548 struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy {
549 struct __pyx_vtabstruct_10TabProxies_TupleProxy __pyx_base;
551 static struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy *__pyx_vtabptr_10TabProxies_NamedTupleProxy;
554 /* "TabProxies.pxd":92
555 * cdef update( self, char * buffer, size_t nbytes )
557 * cdef class VCFProxy( NamedTupleProxy) : # <<<<<<<<<<<<<<
562 struct __pyx_vtabstruct_10TabProxies_VCFProxy {
563 struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy __pyx_base;
565 static struct __pyx_vtabstruct_10TabProxies_VCFProxy *__pyx_vtabptr_10TabProxies_VCFProxy;
568 /* "TabProxies.pxd":81
571 * cdef class BedProxy( NamedTupleProxy) : # <<<<<<<<<<<<<<
576 struct __pyx_vtabstruct_10TabProxies_BedProxy {
577 struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy __pyx_base;
579 static struct __pyx_vtabstruct_10TabProxies_BedProxy *__pyx_vtabptr_10TabProxies_BedProxy;
582 /* "TabProxies.pxd":61
583 * cdef update( self, char * buffer, size_t nbytes )
585 * cdef class GTFProxy( TupleProxy) : # <<<<<<<<<<<<<<
590 struct __pyx_vtabstruct_10TabProxies_GTFProxy {
591 struct __pyx_vtabstruct_10TabProxies_TupleProxy __pyx_base;
593 static struct __pyx_vtabstruct_10TabProxies_GTFProxy *__pyx_vtabptr_10TabProxies_GTFProxy;
595 #ifndef CYTHON_REFNANNY
596 #define CYTHON_REFNANNY 0
601 void (*INCREF)(void*, PyObject*, int);
602 void (*DECREF)(void*, PyObject*, int);
603 void (*GOTREF)(void*, PyObject*, int);
604 void (*GIVEREF)(void*, PyObject*, int);
605 void* (*SetupContext)(const char*, int, const char*);
606 void (*FinishContext)(void**);
607 } __Pyx_RefNannyAPIStruct;
608 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
609 static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
610 PyObject *m = NULL, *p = NULL;
612 m = PyImport_ImportModule((char *)modname);
614 p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
616 r = PyLong_AsVoidPtr(p);
620 return (__Pyx_RefNannyAPIStruct *)r;
622 #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
623 #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
624 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
625 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
626 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
627 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
628 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
630 #define __Pyx_RefNannySetupContext(name)
631 #define __Pyx_RefNannyFinishContext()
632 #define __Pyx_INCREF(r) Py_INCREF(r)
633 #define __Pyx_DECREF(r) Py_DECREF(r)
634 #define __Pyx_GOTREF(r)
635 #define __Pyx_GIVEREF(r)
636 #define __Pyx_XDECREF(r) Py_XDECREF(r)
637 #endif /* CYTHON_REFNANNY */
638 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
639 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)
641 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
643 static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict,
644 const char* function_name, int kw_allowed); /*proto*/
646 static void __Pyx_RaiseDoubleKeywordsError(
647 const char* func_name, PyObject* kw_name); /*proto*/
649 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/
651 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
652 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
655 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
658 r = PyObject_GetItem(o, j);
664 #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
665 __Pyx_GetItemInt_List_Fast(o, i) : \
666 __Pyx_GetItemInt_Generic(o, to_py_func(i)))
668 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
669 if (likely(o != Py_None)) {
670 if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
671 PyObject *r = PyList_GET_ITEM(o, i);
675 else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
676 PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
681 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
684 #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
685 __Pyx_GetItemInt_Tuple_Fast(o, i) : \
686 __Pyx_GetItemInt_Generic(o, to_py_func(i)))
688 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
689 if (likely(o != Py_None)) {
690 if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
691 PyObject *r = PyTuple_GET_ITEM(o, i);
695 else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
696 PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
701 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
705 #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
706 __Pyx_GetItemInt_Fast(o, i) : \
707 __Pyx_GetItemInt_Generic(o, to_py_func(i)))
709 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
711 if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
712 r = PyList_GET_ITEM(o, i);
715 else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
716 r = PyTuple_GET_ITEM(o, i);
719 else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
720 r = PySequence_GetItem(o, i);
723 r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
728 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
729 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
731 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
733 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
735 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
737 static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
738 static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/
740 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
741 const char *name, int exact); /*proto*/
743 static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);
745 #if PY_MAJOR_VERSION >= 3
746 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
748 if (unlikely(d == Py_None)) {
749 __Pyx_RaiseNoneIndexingError();
752 value = PyDict_GetItemWithError(d, key);
753 if (unlikely(!value)) {
754 if (!PyErr_Occurred())
755 PyErr_SetObject(PyExc_KeyError, key);
762 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
765 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
767 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
768 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
770 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
772 static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject *);
774 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
776 static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
778 static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
780 static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
782 static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
784 static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
786 static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
788 static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
790 static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
792 static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
794 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
796 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
798 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
800 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
802 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
804 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
806 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/
808 static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
810 static void* __Pyx_GetVtable(PyObject *dict); /*proto*/
812 static void __Pyx_AddTraceback(const char *funcname); /*proto*/
814 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
815 /* Module declarations from cpython.version */
817 /* Module declarations from cpython.ref */
819 /* Module declarations from cpython.exc */
821 /* Module declarations from cpython.module */
823 /* Module declarations from cpython.mem */
825 /* Module declarations from cpython.tuple */
827 /* Module declarations from cpython.list */
829 /* Module declarations from libc.stdio */
831 /* Module declarations from cpython.object */
833 /* Module declarations from cpython.sequence */
835 /* Module declarations from cpython.mapping */
837 /* Module declarations from cpython.iterator */
839 /* Module declarations from cpython.type */
841 /* Module declarations from cpython.number */
843 /* Module declarations from cpython.int */
845 /* Module declarations from __builtin__ */
847 /* Module declarations from cpython.bool */
849 static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
850 /* Module declarations from cpython.long */
852 /* Module declarations from cpython.float */
854 /* Module declarations from __builtin__ */
856 /* Module declarations from cpython.complex */
858 static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
859 /* Module declarations from cpython.string */
861 /* Module declarations from cpython.unicode */
863 /* Module declarations from cpython.dict */
865 /* Module declarations from cpython.instance */
867 /* Module declarations from cpython.function */
869 /* Module declarations from cpython.method */
871 /* Module declarations from cpython.weakref */
873 /* Module declarations from cpython.getargs */
875 /* Module declarations from cpython.pythread */
877 /* Module declarations from cpython.cobject */
879 /* Module declarations from cpython.oldbuffer */
881 /* Module declarations from cpython.set */
883 /* Module declarations from cpython.buffer */
885 /* Module declarations from cpython.bytes */
887 /* Module declarations from cpython.pycapsule */
889 /* Module declarations from cpython */
891 /* Module declarations from TabProxies */
893 static PyTypeObject *__pyx_ptype_10TabProxies_TupleProxy = 0;
894 static PyTypeObject *__pyx_ptype_10TabProxies_GTFProxy = 0;
895 static PyTypeObject *__pyx_ptype_10TabProxies_NamedTupleProxy = 0;
896 static PyTypeObject *__pyx_ptype_10TabProxies_BedProxy = 0;
897 static PyTypeObject *__pyx_ptype_10TabProxies_VCFProxy = 0;
898 /* Module declarations from ctabix */
900 static PyTypeObject *__pyx_ptype_6ctabix_Tabixfile = 0;
901 static PyTypeObject *__pyx_ptype_6ctabix_Parser = 0;
902 static PyTypeObject *__pyx_ptype_6ctabix_TabixIterator = 0;
903 static PyTypeObject *__pyx_ptype_6ctabix_TabixHeaderIterator = 0;
904 static PyTypeObject *__pyx_ptype_6ctabix_asTuple = 0;
905 static PyTypeObject *__pyx_ptype_6ctabix_asGTF = 0;
906 static PyTypeObject *__pyx_ptype_6ctabix_asBed = 0;
907 static PyTypeObject *__pyx_ptype_6ctabix_asVCF = 0;
908 static PyTypeObject *__pyx_ptype_6ctabix_TabixIteratorParsed = 0;
909 #define __Pyx_MODULE_NAME "ctabix"
910 static int __pyx_module_is_main_ctabix = 0;
912 /* Implementation of ctabix */
913 static PyObject *__pyx_builtin_IOError;
914 static PyObject *__pyx_builtin_ValueError;
915 static PyObject *__pyx_builtin_StopIteration;
916 static PyObject *__pyx_builtin_OSError;
917 static PyObject *__pyx_builtin_ord;
918 static PyObject *__pyx_builtin_KeyError;
919 static char __pyx_k_1[] = "invalid file opening mode `%s`";
920 static char __pyx_k_2[] = ".tbi";
921 static char __pyx_k_3[] = "file `%s` not found";
922 static char __pyx_k_4[] = "index `%s` not found";
923 static char __pyx_k_5[] = "could not open file `%s`";
924 static char __pyx_k_6[] = "%s:%i-%i";
925 static char __pyx_k_7[] = "invalid region `%s`";
926 static char __pyx_k_8[] = "invalid region: start (%i) > end (%i)";
927 static char __pyx_k_9[] = "start out of range (%i)";
928 static char __pyx_k_10[] = "end out of range (%i)";
929 static char __pyx_k_11[] = "I/O operation on closed file";
930 static char __pyx_k_14[] = "malformatted query or wrong sequence name.\n";
931 static char __pyx_k_16[] = "can't open header.\n";
932 static char __pyx_k_20[] = "Filename '%s' already exists, use *force* to overwrite";
933 static char __pyx_k_21[] = "could not open '%s' for writing";
934 static char __pyx_k_23[] = "could not open '%s' for reading";
935 static char __pyx_k_25[] = "writing failed";
936 static char __pyx_k_29[] = "#";
937 static char __pyx_k_31[] = "No such file '%s'";
938 static char __pyx_k_32[] = ".gz";
939 static char __pyx_k_34[] = "Filename '%s.tbi' already exists, use *force* to overwrite";
940 static char __pyx_k_42[] = "unknown preset '%s', valid presets are '%s'";
941 static char __pyx_k_43[] = ",";
942 static char __pyx_k_44[] = "filename associated with this object.";
943 static char __pyx_k_45[] = "the file header.\n \n .. note::\n The header is returned as an iterator over lines without the\n newline character.\n ";
944 static char __pyx_k_46[] = "chromosome names";
945 static char __pyx_k__r[] = "r";
946 static char __pyx_k__w[] = "w";
947 static char __pyx_k__bc[] = "bc";
948 static char __pyx_k__ec[] = "ec";
949 static char __pyx_k__fp[] = "fp";
950 static char __pyx_k__os[] = "os";
951 static char __pyx_k__sc[] = "sc";
952 static char __pyx_k__bed[] = "bed";
953 static char __pyx_k__end[] = "end";
954 static char __pyx_k__gff[] = "gff";
955 static char __pyx_k__idx[] = "idx";
956 static char __pyx_k__len[] = "len";
957 static char __pyx_k__ord[] = "ord";
958 static char __pyx_k__sam[] = "sam";
959 static char __pyx_k__sys[] = "sys";
960 static char __pyx_k__tid[] = "tid";
961 static char __pyx_k__vcf[] = "vcf";
962 static char __pyx_k__copy[] = "copy";
963 static char __pyx_k__gzip[] = "gzip";
964 static char __pyx_k__join[] = "join";
965 static char __pyx_k__keys[] = "keys";
966 static char __pyx_k__mode[] = "mode";
967 static char __pyx_k__path[] = "path";
968 static char __pyx_k___open[] = "_open";
969 static char __pyx_k__asBed[] = "asBed";
970 static char __pyx_k__asGTF[] = "asGTF";
971 static char __pyx_k__asVCF[] = "asVCF";
972 static char __pyx_k__close[] = "close";
973 static char __pyx_k__force[] = "force";
974 static char __pyx_k__start[] = "start";
975 static char __pyx_k__types[] = "types";
976 static char __pyx_k__append[] = "append";
977 static char __pyx_k__buffer[] = "buffer";
978 static char __pyx_k__ctabix[] = "ctabix";
979 static char __pyx_k__ctypes[] = "ctypes";
980 static char __pyx_k__exists[] = "exists";
981 static char __pyx_k__parser[] = "parser";
982 static char __pyx_k__pileup[] = "pileup";
983 static char __pyx_k__preset[] = "preset";
984 static char __pyx_k__psltbl[] = "psltbl";
985 static char __pyx_k__region[] = "region";
986 static char __pyx_k__struct[] = "struct";
987 static char __pyx_k__unlink[] = "unlink";
988 static char __pyx_k__IOError[] = "IOError";
989 static char __pyx_k__OSError[] = "OSError";
990 static char __pyx_k____all__[] = "__all__";
991 static char __pyx_k___isOpen[] = "_isOpen";
992 static char __pyx_k__asTuple[] = "asTuple";
993 static char __pyx_k__end_col[] = "end_col";
994 static char __pyx_k__seq_col[] = "seq_col";
995 static char __pyx_k__KeyError[] = "KeyError";
996 static char __pyx_k__O_RDONLY[] = "O_RDONLY";
997 static char __pyx_k____main__[] = "__main__";
998 static char __pyx_k____test__[] = "__test__";
999 static char __pyx_k__endswith[] = "endswith";
1000 static char __pyx_k__filename[] = "filename";
1001 static char __pyx_k__iterator[] = "iterator";
1002 static char __pyx_k__tempfile[] = "tempfile";
1003 static char __pyx_k__Tabixfile[] = "Tabixfile";
1004 static char __pyx_k___filename[] = "_filename";
1005 static char __pyx_k__itertools[] = "itertools";
1006 static char __pyx_k__line_skip[] = "line_skip";
1007 static char __pyx_k__meta_char[] = "meta_char";
1008 static char __pyx_k__reference[] = "reference";
1009 static char __pyx_k__start_col[] = "start_col";
1010 static char __pyx_k__tabixfile[] = "tabixfile";
1011 static char __pyx_k__zerobased[] = "zerobased";
1012 static char __pyx_k__ValueError[] = "ValueError";
1013 static char __pyx_k__filename_in[] = "filename_in";
1014 static char __pyx_k__tabix_index[] = "tabix_index";
1015 static char __pyx_k___parseRegion[] = "_parseRegion";
1016 static char __pyx_k__filename_out[] = "filename_out";
1017 static char __pyx_k__StopIteration[] = "StopIteration";
1018 static char __pyx_k__tabix_compress[] = "tabix_compress";
1019 static PyObject *__pyx_kp_s_1;
1020 static PyObject *__pyx_kp_s_10;
1021 static PyObject *__pyx_kp_s_11;
1022 static PyObject *__pyx_kp_s_14;
1023 static PyObject *__pyx_kp_s_16;
1024 static PyObject *__pyx_kp_s_2;
1025 static PyObject *__pyx_kp_s_20;
1026 static PyObject *__pyx_kp_s_21;
1027 static PyObject *__pyx_kp_s_23;
1028 static PyObject *__pyx_kp_s_25;
1029 static PyObject *__pyx_kp_s_29;
1030 static PyObject *__pyx_kp_s_3;
1031 static PyObject *__pyx_kp_s_31;
1032 static PyObject *__pyx_kp_s_32;
1033 static PyObject *__pyx_kp_s_34;
1034 static PyObject *__pyx_kp_s_4;
1035 static PyObject *__pyx_kp_s_42;
1036 static PyObject *__pyx_kp_s_43;
1037 static PyObject *__pyx_kp_s_5;
1038 static PyObject *__pyx_kp_s_6;
1039 static PyObject *__pyx_kp_s_7;
1040 static PyObject *__pyx_kp_s_8;
1041 static PyObject *__pyx_kp_s_9;
1042 static PyObject *__pyx_n_s__IOError;
1043 static PyObject *__pyx_n_s__KeyError;
1044 static PyObject *__pyx_n_s__OSError;
1045 static PyObject *__pyx_n_s__O_RDONLY;
1046 static PyObject *__pyx_n_s__StopIteration;
1047 static PyObject *__pyx_n_s__Tabixfile;
1048 static PyObject *__pyx_n_s__ValueError;
1049 static PyObject *__pyx_n_s____all__;
1050 static PyObject *__pyx_n_s____main__;
1051 static PyObject *__pyx_n_s____test__;
1052 static PyObject *__pyx_n_s___filename;
1053 static PyObject *__pyx_n_s___isOpen;
1054 static PyObject *__pyx_n_s___open;
1055 static PyObject *__pyx_n_s___parseRegion;
1056 static PyObject *__pyx_n_s__append;
1057 static PyObject *__pyx_n_s__asBed;
1058 static PyObject *__pyx_n_s__asGTF;
1059 static PyObject *__pyx_n_s__asTuple;
1060 static PyObject *__pyx_n_s__asVCF;
1061 static PyObject *__pyx_n_s__bc;
1062 static PyObject *__pyx_n_s__bed;
1063 static PyObject *__pyx_n_s__buffer;
1064 static PyObject *__pyx_n_s__close;
1065 static PyObject *__pyx_n_s__copy;
1066 static PyObject *__pyx_n_s__ctabix;
1067 static PyObject *__pyx_n_s__ctypes;
1068 static PyObject *__pyx_n_s__ec;
1069 static PyObject *__pyx_n_s__end;
1070 static PyObject *__pyx_n_s__end_col;
1071 static PyObject *__pyx_n_s__endswith;
1072 static PyObject *__pyx_n_s__exists;
1073 static PyObject *__pyx_n_s__filename;
1074 static PyObject *__pyx_n_s__filename_in;
1075 static PyObject *__pyx_n_s__filename_out;
1076 static PyObject *__pyx_n_s__force;
1077 static PyObject *__pyx_n_s__fp;
1078 static PyObject *__pyx_n_s__gff;
1079 static PyObject *__pyx_n_s__gzip;
1080 static PyObject *__pyx_n_s__idx;
1081 static PyObject *__pyx_n_s__iterator;
1082 static PyObject *__pyx_n_s__itertools;
1083 static PyObject *__pyx_n_s__join;
1084 static PyObject *__pyx_n_s__keys;
1085 static PyObject *__pyx_n_s__len;
1086 static PyObject *__pyx_n_s__line_skip;
1087 static PyObject *__pyx_n_s__meta_char;
1088 static PyObject *__pyx_n_s__mode;
1089 static PyObject *__pyx_n_s__ord;
1090 static PyObject *__pyx_n_s__os;
1091 static PyObject *__pyx_n_s__parser;
1092 static PyObject *__pyx_n_s__path;
1093 static PyObject *__pyx_n_s__pileup;
1094 static PyObject *__pyx_n_s__preset;
1095 static PyObject *__pyx_n_s__psltbl;
1096 static PyObject *__pyx_n_s__r;
1097 static PyObject *__pyx_n_s__reference;
1098 static PyObject *__pyx_n_s__region;
1099 static PyObject *__pyx_n_s__sam;
1100 static PyObject *__pyx_n_s__sc;
1101 static PyObject *__pyx_n_s__seq_col;
1102 static PyObject *__pyx_n_s__start;
1103 static PyObject *__pyx_n_s__start_col;
1104 static PyObject *__pyx_n_s__struct;
1105 static PyObject *__pyx_n_s__sys;
1106 static PyObject *__pyx_n_s__tabix_compress;
1107 static PyObject *__pyx_n_s__tabix_index;
1108 static PyObject *__pyx_n_s__tabixfile;
1109 static PyObject *__pyx_n_s__tempfile;
1110 static PyObject *__pyx_n_s__tid;
1111 static PyObject *__pyx_n_s__types;
1112 static PyObject *__pyx_n_s__unlink;
1113 static PyObject *__pyx_n_s__vcf;
1114 static PyObject *__pyx_n_s__w;
1115 static PyObject *__pyx_n_s__zerobased;
1116 static PyObject *__pyx_int_0;
1117 static PyObject *__pyx_int_1;
1118 static PyObject *__pyx_int_2;
1119 static PyObject *__pyx_int_3;
1120 static PyObject *__pyx_int_4;
1121 static PyObject *__pyx_int_5;
1122 static PyObject *__pyx_int_neg_1;
1123 static PyObject *__pyx_int_15;
1124 static PyObject *__pyx_int_17;
1125 static PyObject *__pyx_int_18;
1126 static PyObject *__pyx_int_65536;
1127 static PyObject *__pyx_k_19;
1128 static PyObject *__pyx_k_28;
1129 static PyObject *__pyx_k_30;
1130 static PyObject *__pyx_k_tuple_12;
1131 static PyObject *__pyx_k_tuple_13;
1132 static PyObject *__pyx_k_tuple_15;
1133 static PyObject *__pyx_k_tuple_17;
1134 static PyObject *__pyx_k_tuple_18;
1135 static PyObject *__pyx_k_tuple_22;
1136 static PyObject *__pyx_k_tuple_24;
1137 static PyObject *__pyx_k_tuple_26;
1138 static PyObject *__pyx_k_tuple_27;
1139 static PyObject *__pyx_k_tuple_33;
1140 static PyObject *__pyx_k_tuple_35;
1141 static PyObject *__pyx_k_tuple_36;
1142 static PyObject *__pyx_k_tuple_37;
1143 static PyObject *__pyx_k_tuple_38;
1144 static PyObject *__pyx_k_tuple_39;
1145 static PyObject *__pyx_k_tuple_40;
1146 static PyObject *__pyx_k_tuple_41;
1151 * def __cinit__(self, *args, **kwargs ): # <<<<<<<<<<<<<<
1152 * self.tabixfile = NULL
1153 * self._open( *args, **kwargs )
1156 static int __pyx_pf_6ctabix_9Tabixfile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1157 static int __pyx_pf_6ctabix_9Tabixfile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1158 PyObject *__pyx_v_args = 0;
1159 PyObject *__pyx_v_kwargs = 0;
1161 PyObject *__pyx_t_1 = NULL;
1162 PyObject *__pyx_t_2 = NULL;
1163 PyObject *__pyx_t_3 = NULL;
1164 __Pyx_RefNannySetupContext("__cinit__");
1165 if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
1166 __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
1167 if (unlikely(!__pyx_v_kwargs)) return -1;
1168 __Pyx_GOTREF(__pyx_v_kwargs);
1169 __Pyx_INCREF(__pyx_args);
1170 __pyx_v_args = __pyx_args;
1174 * def __cinit__(self, *args, **kwargs ):
1175 * self.tabixfile = NULL # <<<<<<<<<<<<<<
1176 * self._open( *args, **kwargs )
1179 ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile = NULL;
1182 * def __cinit__(self, *args, **kwargs ):
1183 * self.tabixfile = NULL
1184 * self._open( *args, **kwargs ) # <<<<<<<<<<<<<<
1186 * def _isOpen( self ):
1188 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1189 __Pyx_GOTREF(__pyx_t_1);
1190 __pyx_t_2 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1191 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
1192 __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 = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1193 __Pyx_GOTREF(__pyx_t_3);
1194 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1195 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
1196 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1201 __Pyx_XDECREF(__pyx_t_1);
1202 __Pyx_XDECREF(__pyx_t_2);
1203 __Pyx_XDECREF(__pyx_t_3);
1204 __Pyx_AddTraceback("ctabix.Tabixfile.__cinit__");
1207 __Pyx_DECREF(__pyx_v_args);
1208 __Pyx_DECREF(__pyx_v_kwargs);
1209 __Pyx_RefNannyFinishContext();
1214 * self._open( *args, **kwargs )
1216 * def _isOpen( self ): # <<<<<<<<<<<<<<
1217 * '''return true if samfile has been opened.'''
1218 * return self.tabixfile != NULL
1221 static PyObject *__pyx_pf_6ctabix_9Tabixfile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
1222 static char __pyx_doc_6ctabix_9Tabixfile_1_isOpen[] = "Tabixfile._isOpen(self)\nreturn true if samfile has been opened.";
1223 static PyObject *__pyx_pf_6ctabix_9Tabixfile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
1224 PyObject *__pyx_r = NULL;
1225 PyObject *__pyx_t_1 = NULL;
1226 __Pyx_RefNannySetupContext("_isOpen");
1229 * def _isOpen( self ):
1230 * '''return true if samfile has been opened.'''
1231 * return self.tabixfile != NULL # <<<<<<<<<<<<<<
1235 __Pyx_XDECREF(__pyx_r);
1236 __pyx_t_1 = __Pyx_PyBool_FromLong((((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1237 __Pyx_GOTREF(__pyx_t_1);
1238 __pyx_r = __pyx_t_1;
1242 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1245 __Pyx_XDECREF(__pyx_t_1);
1246 __Pyx_AddTraceback("ctabix.Tabixfile._isOpen");
1249 __Pyx_XGIVEREF(__pyx_r);
1250 __Pyx_RefNannyFinishContext();
1255 * return self.tabixfile != NULL
1257 * def _open( self, # <<<<<<<<<<<<<<
1262 static PyObject *__pyx_pf_6ctabix_9Tabixfile_2_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1263 static char __pyx_doc_6ctabix_9Tabixfile_2_open[] = "Tabixfile._open(self, char *filename, mode='r')\nopen a :term:`tabix file` for reading.\n ";
1264 static PyObject *__pyx_pf_6ctabix_9Tabixfile_2_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1265 char *__pyx_v_filename;
1266 PyObject *__pyx_v_mode = 0;
1267 PyObject *__pyx_v_filename_index;
1268 PyObject *__pyx_r = NULL;
1269 PyObject *__pyx_t_1 = NULL;
1270 PyObject *__pyx_t_2 = NULL;
1272 PyObject *__pyx_t_4 = NULL;
1275 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,0};
1276 __Pyx_RefNannySetupContext("_open");
1277 if (unlikely(__pyx_kwds)) {
1278 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
1279 PyObject* values[2] = {0,0};
1280 values[1] = ((PyObject *)__pyx_n_s__r);
1281 switch (PyTuple_GET_SIZE(__pyx_args)) {
1282 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1283 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1285 default: goto __pyx_L5_argtuple_error;
1287 switch (PyTuple_GET_SIZE(__pyx_args)) {
1289 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
1290 if (likely(values[0])) kw_args--;
1291 else goto __pyx_L5_argtuple_error;
1294 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode);
1295 if (value) { values[1] = value; kw_args--; }
1298 if (unlikely(kw_args > 0)) {
1299 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_open") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1301 __pyx_v_filename = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1302 __pyx_v_mode = values[1];
1304 __pyx_v_mode = ((PyObject *)__pyx_n_s__r);
1305 switch (PyTuple_GET_SIZE(__pyx_args)) {
1306 case 2: __pyx_v_mode = PyTuple_GET_ITEM(__pyx_args, 1);
1307 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 = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1309 default: goto __pyx_L5_argtuple_error;
1312 goto __pyx_L4_argument_unpacking_done;
1313 __pyx_L5_argtuple_error:;
1314 __Pyx_RaiseArgtupleInvalid("_open", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1316 __Pyx_AddTraceback("ctabix.Tabixfile._open");
1317 __Pyx_RefNannyFinishContext();
1319 __pyx_L4_argument_unpacking_done:;
1320 __pyx_v_filename_index = Py_None; __Pyx_INCREF(Py_None);
1325 * assert mode in ( "r",), "invalid file opening mode `%s`" % mode # <<<<<<<<<<<<<<
1327 * # close a previously opened file
1329 #ifndef CYTHON_WITHOUT_ASSERTIONS
1330 __Pyx_INCREF(__pyx_v_mode);
1331 __pyx_t_1 = __pyx_v_mode;
1332 __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1333 __Pyx_GOTREF(__pyx_t_2);
1334 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1335 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1336 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1337 if (unlikely(!__pyx_t_3)) {
1338 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_v_mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1339 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
1340 PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_1));
1341 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
1342 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1348 * # close a previously opened file
1349 * if self.tabixfile != NULL: self.close() # <<<<<<<<<<<<<<
1350 * self.tabixfile = NULL
1353 __pyx_t_3 = (((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile != NULL);
1355 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1356 __Pyx_GOTREF(__pyx_t_1);
1357 __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 = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1358 __Pyx_GOTREF(__pyx_t_2);
1359 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1360 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1366 * # close a previously opened file
1367 * if self.tabixfile != NULL: self.close()
1368 * self.tabixfile = NULL # <<<<<<<<<<<<<<
1370 * if self._filename != NULL: free(self._filename )
1372 ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile = NULL;
1375 * self.tabixfile = NULL
1377 * if self._filename != NULL: free(self._filename ) # <<<<<<<<<<<<<<
1378 * self._filename = strdup( filename )
1381 __pyx_t_3 = (((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename != NULL);
1383 free(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename);
1390 * if self._filename != NULL: free(self._filename )
1391 * self._filename = strdup( filename ) # <<<<<<<<<<<<<<
1393 * filename_index = filename + ".tbi"
1395 ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename = strdup(__pyx_v_filename);
1398 * self._filename = strdup( filename )
1400 * filename_index = filename + ".tbi" # <<<<<<<<<<<<<<
1402 * if mode[0] == 'w':
1404 __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1405 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
1406 __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1407 __Pyx_GOTREF(__pyx_t_1);
1408 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
1409 __Pyx_DECREF(__pyx_v_filename_index);
1410 __pyx_v_filename_index = __pyx_t_1;
1414 * filename_index = filename + ".tbi"
1416 * if mode[0] == 'w': # <<<<<<<<<<<<<<
1417 * # open file for writing
1420 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1421 __Pyx_GOTREF(__pyx_t_1);
1422 __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__w), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1423 __Pyx_GOTREF(__pyx_t_2);
1424 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1425 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1426 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1434 * elif mode[0] == "r": # <<<<<<<<<<<<<<
1435 * # open file for reading
1436 * if not os.path.exists( self._filename ):
1438 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1439 __Pyx_GOTREF(__pyx_t_2);
1440 __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1441 __Pyx_GOTREF(__pyx_t_1);
1442 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1443 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1444 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1448 * elif mode[0] == "r":
1449 * # open file for reading
1450 * if not os.path.exists( self._filename ): # <<<<<<<<<<<<<<
1451 * raise IOError( "file `%s` not found" % self._filename)
1454 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1455 __Pyx_GOTREF(__pyx_t_1);
1456 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1457 __Pyx_GOTREF(__pyx_t_2);
1458 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1459 __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1460 __Pyx_GOTREF(__pyx_t_1);
1461 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1462 __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1463 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
1464 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1465 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
1466 PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_2));
1467 __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
1469 __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 = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1470 __Pyx_GOTREF(__pyx_t_2);
1471 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1472 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
1473 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1474 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1475 __pyx_t_5 = (!__pyx_t_3);
1479 * # open file for reading
1480 * if not os.path.exists( self._filename ):
1481 * raise IOError( "file `%s` not found" % self._filename) # <<<<<<<<<<<<<<
1483 * if not os.path.exists( filename_index ):
1485 __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1486 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
1487 __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1488 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
1489 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
1490 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1491 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
1492 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4));
1493 __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
1495 __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1496 __Pyx_GOTREF(__pyx_t_4);
1497 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
1498 __Pyx_Raise(__pyx_t_4, 0, 0);
1499 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1500 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1506 * raise IOError( "file `%s` not found" % self._filename)
1508 * if not os.path.exists( filename_index ): # <<<<<<<<<<<<<<
1509 * raise IOError( "index `%s` not found" % filename_index)
1512 __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1513 __Pyx_GOTREF(__pyx_t_4);
1514 __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1515 __Pyx_GOTREF(__pyx_t_2);
1516 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1517 __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1518 __Pyx_GOTREF(__pyx_t_4);
1519 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1520 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1521 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
1522 __Pyx_INCREF(__pyx_v_filename_index);
1523 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_filename_index);
1524 __Pyx_GIVEREF(__pyx_v_filename_index);
1525 __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1526 __Pyx_GOTREF(__pyx_t_1);
1527 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1528 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
1529 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1530 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1531 __pyx_t_3 = (!__pyx_t_5);
1536 * if not os.path.exists( filename_index ):
1537 * raise IOError( "index `%s` not found" % filename_index) # <<<<<<<<<<<<<<
1539 * # open file and load index
1541 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_v_filename_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1542 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
1543 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1544 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
1545 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
1546 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
1548 __pyx_t_1 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1549 __Pyx_GOTREF(__pyx_t_1);
1550 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
1551 __Pyx_Raise(__pyx_t_1, 0, 0);
1552 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1553 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1560 * # open file and load index
1561 * self.tabixfile = ti_open( self._filename, filename_index ) # <<<<<<<<<<<<<<
1563 * if self.tabixfile == NULL:
1565 __pyx_t_6 = PyBytes_AsString(__pyx_v_filename_index); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1566 ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile = ti_open(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename, __pyx_t_6);
1572 * self.tabixfile = ti_open( self._filename, filename_index )
1574 * if self.tabixfile == NULL: # <<<<<<<<<<<<<<
1575 * raise IOError("could not open file `%s`" % filename )
1578 __pyx_t_3 = (((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile == NULL);
1583 * if self.tabixfile == NULL:
1584 * raise IOError("could not open file `%s`" % filename ) # <<<<<<<<<<<<<<
1586 * def _parseRegion( self,
1588 __pyx_t_1 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1589 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
1590 __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1591 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
1592 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
1593 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1594 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
1595 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
1596 __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
1598 __pyx_t_2 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1599 __Pyx_GOTREF(__pyx_t_2);
1600 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
1601 __Pyx_Raise(__pyx_t_2, 0, 0);
1602 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1603 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1608 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1611 __Pyx_XDECREF(__pyx_t_1);
1612 __Pyx_XDECREF(__pyx_t_2);
1613 __Pyx_XDECREF(__pyx_t_4);
1614 __Pyx_AddTraceback("ctabix.Tabixfile._open");
1617 __Pyx_DECREF(__pyx_v_filename_index);
1618 __Pyx_XGIVEREF(__pyx_r);
1619 __Pyx_RefNannyFinishContext();
1624 * raise IOError("could not open file `%s`" % filename )
1626 * def _parseRegion( self, # <<<<<<<<<<<<<<
1631 static PyObject *__pyx_pf_6ctabix_9Tabixfile_3_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1632 static char __pyx_doc_6ctabix_9Tabixfile_3_parseRegion[] = "Tabixfile._parseRegion(self, reference=None, start=None, end=None, region=None)\nparse region information.\n\n raise ValueError for for invalid regions.\n\n returns a tuple of region, tid, start and end. Region\n is a valid samtools :term:`region` or None if the region\n extends over the whole file.\n\n Note that regions are 1-based, while start,end are python coordinates.\n ";
1633 static PyObject *__pyx_pf_6ctabix_9Tabixfile_3_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1634 PyObject *__pyx_v_reference = 0;
1635 PyObject *__pyx_v_start = 0;
1636 PyObject *__pyx_v_end = 0;
1637 PyObject *__pyx_v_region = 0;
1641 int __pyx_v_max_pos;
1642 PyObject *__pyx_r = NULL;
1644 PyObject *__pyx_t_2 = NULL;
1647 PyObject *__pyx_t_5 = NULL;
1648 PyObject *__pyx_t_6 = NULL;
1650 PyObject *__pyx_t_8 = NULL;
1651 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
1652 __Pyx_RefNannySetupContext("_parseRegion");
1653 if (unlikely(__pyx_kwds)) {
1654 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
1655 PyObject* values[4] = {0,0,0,0};
1659 * def _parseRegion( self,
1660 * reference = None, # <<<<<<<<<<<<<<
1664 values[0] = ((PyObject *)Py_None);
1667 * def _parseRegion( self,
1669 * start = None, # <<<<<<<<<<<<<<
1673 values[1] = ((PyObject *)Py_None);
1678 * end = None, # <<<<<<<<<<<<<<
1680 * '''parse region information.
1682 values[2] = ((PyObject *)Py_None);
1687 * region = None ): # <<<<<<<<<<<<<<
1688 * '''parse region information.
1691 values[3] = ((PyObject *)Py_None);
1692 switch (PyTuple_GET_SIZE(__pyx_args)) {
1693 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1694 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1695 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1696 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1698 default: goto __pyx_L5_argtuple_error;
1700 switch (PyTuple_GET_SIZE(__pyx_args)) {
1703 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
1704 if (value) { values[0] = value; kw_args--; }
1708 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
1709 if (value) { values[1] = value; kw_args--; }
1713 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
1714 if (value) { values[2] = value; kw_args--; }
1718 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region);
1719 if (value) { values[3] = value; kw_args--; }
1722 if (unlikely(kw_args > 0)) {
1723 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_parseRegion") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1725 __pyx_v_reference = values[0];
1726 __pyx_v_start = values[1];
1727 __pyx_v_end = values[2];
1728 __pyx_v_region = values[3];
1733 * def _parseRegion( self,
1734 * reference = None, # <<<<<<<<<<<<<<
1738 __pyx_v_reference = ((PyObject *)Py_None);
1741 * def _parseRegion( self,
1743 * start = None, # <<<<<<<<<<<<<<
1747 __pyx_v_start = ((PyObject *)Py_None);
1752 * end = None, # <<<<<<<<<<<<<<
1754 * '''parse region information.
1756 __pyx_v_end = ((PyObject *)Py_None);
1761 * region = None ): # <<<<<<<<<<<<<<
1762 * '''parse region information.
1765 __pyx_v_region = ((PyObject *)Py_None);
1766 switch (PyTuple_GET_SIZE(__pyx_args)) {
1767 case 4: __pyx_v_region = PyTuple_GET_ITEM(__pyx_args, 3);
1768 case 3: __pyx_v_end = PyTuple_GET_ITEM(__pyx_args, 2);
1769 case 2: __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 1);
1770 case 1: __pyx_v_reference = PyTuple_GET_ITEM(__pyx_args, 0);
1772 default: goto __pyx_L5_argtuple_error;
1775 goto __pyx_L4_argument_unpacking_done;
1776 __pyx_L5_argtuple_error:;
1777 __Pyx_RaiseArgtupleInvalid("_parseRegion", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1779 __Pyx_AddTraceback("ctabix.Tabixfile._parseRegion");
1780 __Pyx_RefNannyFinishContext();
1782 __pyx_L4_argument_unpacking_done:;
1783 __Pyx_INCREF(__pyx_v_region);
1786 * Note that regions are 1-based, while start,end are python coordinates.
1788 * ti_lazy_index_load( self.tabixfile ) # <<<<<<<<<<<<<<
1792 ti_lazy_index_load(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile);
1797 * max_pos = 2 << 29 # <<<<<<<<<<<<<<
1799 * rtid = rstart = rend = 0
1801 __pyx_v_max_pos = 1073741824;
1806 * rtid = rstart = rend = 0 # <<<<<<<<<<<<<<
1808 * # translate to a region
1816 * # translate to a region
1817 * if reference: # <<<<<<<<<<<<<<
1818 * if start != None and end != None:
1819 * region = "%s:%i-%i" % (reference, start+1, end)
1821 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_reference); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1825 * # translate to a region
1827 * if start != None and end != None: # <<<<<<<<<<<<<<
1828 * region = "%s:%i-%i" % (reference, start+1, end)
1829 * elif start == None and end != None:
1831 __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1832 __Pyx_GOTREF(__pyx_t_2);
1833 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1834 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1836 __pyx_t_2 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1837 __Pyx_GOTREF(__pyx_t_2);
1838 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1839 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1840 __pyx_t_4 = __pyx_t_3;
1842 __pyx_t_4 = __pyx_t_1;
1848 * if start != None and end != None:
1849 * region = "%s:%i-%i" % (reference, start+1, end) # <<<<<<<<<<<<<<
1850 * elif start == None and end != None:
1851 * region = "%s:%i-%i" % (reference, 1, end)
1853 __pyx_t_2 = PyNumber_Add(__pyx_v_start, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1854 __Pyx_GOTREF(__pyx_t_2);
1855 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1856 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
1857 __Pyx_INCREF(__pyx_v_reference);
1858 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_reference);
1859 __Pyx_GIVEREF(__pyx_v_reference);
1860 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
1861 __Pyx_GIVEREF(__pyx_t_2);
1862 __Pyx_INCREF(__pyx_v_end);
1863 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_end);
1864 __Pyx_GIVEREF(__pyx_v_end);
1866 __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1867 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
1868 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
1869 __Pyx_DECREF(__pyx_v_region);
1870 __pyx_v_region = ((PyObject *)__pyx_t_2);
1876 * if start != None and end != None:
1877 * region = "%s:%i-%i" % (reference, start+1, end)
1878 * elif start == None and end != None: # <<<<<<<<<<<<<<
1879 * region = "%s:%i-%i" % (reference, 1, end)
1880 * elif end == None and start != None:
1882 __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1883 __Pyx_GOTREF(__pyx_t_2);
1884 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1885 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1887 __pyx_t_2 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1888 __Pyx_GOTREF(__pyx_t_2);
1889 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1890 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1891 __pyx_t_3 = __pyx_t_1;
1893 __pyx_t_3 = __pyx_t_4;
1898 * region = "%s:%i-%i" % (reference, start+1, end)
1899 * elif start == None and end != None:
1900 * region = "%s:%i-%i" % (reference, 1, end) # <<<<<<<<<<<<<<
1901 * elif end == None and start != None:
1902 * region = "%s:%i-%i" % (reference, start+1, max_pos-1)
1904 __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1905 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
1906 __Pyx_INCREF(__pyx_v_reference);
1907 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_reference);
1908 __Pyx_GIVEREF(__pyx_v_reference);
1909 __Pyx_INCREF(__pyx_int_1);
1910 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_1);
1911 __Pyx_GIVEREF(__pyx_int_1);
1912 __Pyx_INCREF(__pyx_v_end);
1913 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_end);
1914 __Pyx_GIVEREF(__pyx_v_end);
1915 __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1916 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
1917 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
1918 __Pyx_DECREF(__pyx_v_region);
1919 __pyx_v_region = ((PyObject *)__pyx_t_5);
1925 * elif start == None and end != None:
1926 * region = "%s:%i-%i" % (reference, 1, end)
1927 * elif end == None and start != None: # <<<<<<<<<<<<<<
1928 * region = "%s:%i-%i" % (reference, start+1, max_pos-1)
1931 __pyx_t_5 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1932 __Pyx_GOTREF(__pyx_t_5);
1933 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1934 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1936 __pyx_t_5 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1937 __Pyx_GOTREF(__pyx_t_5);
1938 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1939 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1940 __pyx_t_1 = __pyx_t_4;
1942 __pyx_t_1 = __pyx_t_3;
1947 * region = "%s:%i-%i" % (reference, 1, end)
1948 * elif end == None and start != None:
1949 * region = "%s:%i-%i" % (reference, start+1, max_pos-1) # <<<<<<<<<<<<<<
1951 * region = reference
1953 __pyx_t_5 = PyNumber_Add(__pyx_v_start, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1954 __Pyx_GOTREF(__pyx_t_5);
1955 __pyx_t_2 = PyInt_FromLong((__pyx_v_max_pos - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1956 __Pyx_GOTREF(__pyx_t_2);
1957 __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1958 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
1959 __Pyx_INCREF(__pyx_v_reference);
1960 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_reference);
1961 __Pyx_GIVEREF(__pyx_v_reference);
1962 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
1963 __Pyx_GIVEREF(__pyx_t_5);
1964 PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2);
1965 __Pyx_GIVEREF(__pyx_t_2);
1968 __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1969 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
1970 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
1971 __Pyx_DECREF(__pyx_v_region);
1972 __pyx_v_region = ((PyObject *)__pyx_t_2);
1979 * region = "%s:%i-%i" % (reference, start+1, max_pos-1)
1981 * region = reference # <<<<<<<<<<<<<<
1985 __Pyx_INCREF(__pyx_v_reference);
1986 __Pyx_DECREF(__pyx_v_region);
1987 __pyx_v_region = __pyx_v_reference;
1995 * region = reference
1997 * if region: # <<<<<<<<<<<<<<
1998 * ti_parse_region( self.tabixfile.idx, region, &rtid, &rstart, &rend)
1999 * if rtid < 0: raise ValueError( "invalid region `%s`" % region )
2001 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2007 * ti_parse_region( self.tabixfile.idx, region, &rtid, &rstart, &rend) # <<<<<<<<<<<<<<
2008 * if rtid < 0: raise ValueError( "invalid region `%s`" % region )
2009 * if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) )
2011 __pyx_t_7 = PyBytes_AsString(__pyx_v_region); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2012 ti_parse_region(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile->idx, __pyx_t_7, (&__pyx_v_rtid), (&__pyx_v_rstart), (&__pyx_v_rend));
2016 * ti_parse_region( self.tabixfile.idx, region, &rtid, &rstart, &rend)
2017 * if rtid < 0: raise ValueError( "invalid region `%s`" % region ) # <<<<<<<<<<<<<<
2018 * if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) )
2019 * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart )
2021 __pyx_t_1 = (__pyx_v_rtid < 0);
2023 __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), __pyx_v_region); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2024 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
2025 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2026 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
2027 PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_2));
2028 __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
2030 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2031 __Pyx_GOTREF(__pyx_t_2);
2032 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
2033 __Pyx_Raise(__pyx_t_2, 0, 0);
2034 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2035 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2041 * ti_parse_region( self.tabixfile.idx, region, &rtid, &rstart, &rend)
2042 * if rtid < 0: raise ValueError( "invalid region `%s`" % region )
2043 * if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) ) # <<<<<<<<<<<<<<
2044 * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart )
2045 * if not 0 <= rend < max_pos: raise ValueError( 'end out of range (%i)' % rend )
2047 __pyx_t_1 = (__pyx_v_rstart > __pyx_v_rend);
2049 __pyx_t_2 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2050 __Pyx_GOTREF(__pyx_t_2);
2051 __pyx_t_6 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2052 __Pyx_GOTREF(__pyx_t_6);
2053 __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2054 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
2055 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
2056 __Pyx_GIVEREF(__pyx_t_2);
2057 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
2058 __Pyx_GIVEREF(__pyx_t_6);
2061 __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2062 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
2063 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
2064 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2065 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
2066 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
2067 __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
2069 __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2070 __Pyx_GOTREF(__pyx_t_6);
2071 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
2072 __Pyx_Raise(__pyx_t_6, 0, 0);
2073 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2074 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2080 * if rtid < 0: raise ValueError( "invalid region `%s`" % region )
2081 * if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) )
2082 * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart ) # <<<<<<<<<<<<<<
2083 * if not 0 <= rend < max_pos: raise ValueError( 'end out of range (%i)' % rend )
2086 __pyx_t_1 = (0 <= __pyx_v_rstart);
2088 __pyx_t_1 = (__pyx_v_rstart < __pyx_v_max_pos);
2090 __pyx_t_3 = (!__pyx_t_1);
2092 __pyx_t_6 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2093 __Pyx_GOTREF(__pyx_t_6);
2094 __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2095 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
2096 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2097 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2098 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
2099 PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
2100 __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
2102 __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 = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2103 __Pyx_GOTREF(__pyx_t_5);
2104 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
2105 __Pyx_Raise(__pyx_t_5, 0, 0);
2106 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2107 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2113 * if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) )
2114 * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart )
2115 * if not 0 <= rend < max_pos: raise ValueError( 'end out of range (%i)' % rend ) # <<<<<<<<<<<<<<
2117 * return region, rtid, rstart, rend
2119 __pyx_t_3 = (0 <= __pyx_v_rend);
2121 __pyx_t_3 = (__pyx_v_rend < __pyx_v_max_pos);
2123 __pyx_t_1 = (!__pyx_t_3);
2125 __pyx_t_5 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2126 __Pyx_GOTREF(__pyx_t_5);
2127 __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2128 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
2129 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2130 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2131 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
2132 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
2133 __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
2135 __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2136 __Pyx_GOTREF(__pyx_t_6);
2137 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
2138 __Pyx_Raise(__pyx_t_6, 0, 0);
2139 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2140 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2149 * if not 0 <= rend < max_pos: raise ValueError( 'end out of range (%i)' % rend )
2151 * return region, rtid, rstart, rend # <<<<<<<<<<<<<<
2155 __Pyx_XDECREF(__pyx_r);
2156 __pyx_t_6 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2157 __Pyx_GOTREF(__pyx_t_6);
2158 __pyx_t_5 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2159 __Pyx_GOTREF(__pyx_t_5);
2160 __pyx_t_2 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2161 __Pyx_GOTREF(__pyx_t_2);
2162 __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2163 __Pyx_GOTREF(((PyObject *)__pyx_t_8));
2164 __Pyx_INCREF(__pyx_v_region);
2165 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_region);
2166 __Pyx_GIVEREF(__pyx_v_region);
2167 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
2168 __Pyx_GIVEREF(__pyx_t_6);
2169 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_5);
2170 __Pyx_GIVEREF(__pyx_t_5);
2171 PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_2);
2172 __Pyx_GIVEREF(__pyx_t_2);
2176 __pyx_r = ((PyObject *)__pyx_t_8);
2180 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2183 __Pyx_XDECREF(__pyx_t_2);
2184 __Pyx_XDECREF(__pyx_t_5);
2185 __Pyx_XDECREF(__pyx_t_6);
2186 __Pyx_XDECREF(__pyx_t_8);
2187 __Pyx_AddTraceback("ctabix.Tabixfile._parseRegion");
2190 __Pyx_DECREF(__pyx_v_region);
2191 __Pyx_XGIVEREF(__pyx_r);
2192 __Pyx_RefNannyFinishContext();
2197 * return region, rtid, rstart, rend
2199 * def fetch( self, # <<<<<<<<<<<<<<
2204 static PyObject *__pyx_pf_6ctabix_9Tabixfile_4fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2205 static char __pyx_doc_6ctabix_9Tabixfile_4fetch[] = "Tabixfile.fetch(self, reference=None, start=None, end=None, region=None, parser=None)\n\n \n fetch one or more rows 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 be supplied.\n\n Without *reference* or *region* all entries will be fetched. \n \n If only *reference* is set, all reads matching on *reference* will be fetched.\n\n If *parser* is None, the results are returned as an unparsed string.\n Otherwise, *parser* is assumed to be a functor that will return parsed \n data (see for example :meth:`asTuple` and :meth:`asGTF`).\n ";
2206 static PyObject *__pyx_pf_6ctabix_9Tabixfile_4fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2207 PyObject *__pyx_v_reference = 0;
2208 PyObject *__pyx_v_start = 0;
2209 PyObject *__pyx_v_end = 0;
2210 PyObject *__pyx_v_region = 0;
2211 PyObject *__pyx_v_parser = 0;
2212 PyObject *__pyx_v_rtid;
2213 PyObject *__pyx_v_rstart;
2214 PyObject *__pyx_v_rend;
2215 PyObject *__pyx_r = NULL;
2216 PyObject *__pyx_t_1 = NULL;
2217 PyObject *__pyx_t_2 = NULL;
2220 PyObject *__pyx_t_5 = NULL;
2221 PyObject *__pyx_t_6 = NULL;
2222 PyObject *__pyx_t_7 = NULL;
2223 PyObject *__pyx_t_8 = NULL;
2224 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__parser,0};
2225 __Pyx_RefNannySetupContext("fetch");
2226 if (unlikely(__pyx_kwds)) {
2227 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
2228 PyObject* values[5] = {0,0,0,0,0};
2233 * reference = None, # <<<<<<<<<<<<<<
2237 values[0] = ((PyObject *)Py_None);
2242 * start = None, # <<<<<<<<<<<<<<
2246 values[1] = ((PyObject *)Py_None);
2251 * end = None, # <<<<<<<<<<<<<<
2255 values[2] = ((PyObject *)Py_None);
2260 * region = None, # <<<<<<<<<<<<<<
2264 values[3] = ((PyObject *)Py_None);
2269 * parser = None ): # <<<<<<<<<<<<<<
2273 values[4] = ((PyObject *)Py_None);
2274 switch (PyTuple_GET_SIZE(__pyx_args)) {
2275 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2276 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2277 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2278 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2279 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2281 default: goto __pyx_L5_argtuple_error;
2283 switch (PyTuple_GET_SIZE(__pyx_args)) {
2286 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
2287 if (value) { values[0] = value; kw_args--; }
2291 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
2292 if (value) { values[1] = value; kw_args--; }
2296 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
2297 if (value) { values[2] = value; kw_args--; }
2301 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region);
2302 if (value) { values[3] = value; kw_args--; }
2306 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
2307 if (value) { values[4] = value; kw_args--; }
2310 if (unlikely(kw_args > 0)) {
2311 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2313 __pyx_v_reference = values[0];
2314 __pyx_v_start = values[1];
2315 __pyx_v_end = values[2];
2316 __pyx_v_region = values[3];
2317 __pyx_v_parser = values[4];
2323 * reference = None, # <<<<<<<<<<<<<<
2327 __pyx_v_reference = ((PyObject *)Py_None);
2332 * start = None, # <<<<<<<<<<<<<<
2336 __pyx_v_start = ((PyObject *)Py_None);
2341 * end = None, # <<<<<<<<<<<<<<
2345 __pyx_v_end = ((PyObject *)Py_None);
2350 * region = None, # <<<<<<<<<<<<<<
2354 __pyx_v_region = ((PyObject *)Py_None);
2359 * parser = None ): # <<<<<<<<<<<<<<
2363 __pyx_v_parser = ((PyObject *)Py_None);
2364 switch (PyTuple_GET_SIZE(__pyx_args)) {
2365 case 5: __pyx_v_parser = PyTuple_GET_ITEM(__pyx_args, 4);
2366 case 4: __pyx_v_region = PyTuple_GET_ITEM(__pyx_args, 3);
2367 case 3: __pyx_v_end = PyTuple_GET_ITEM(__pyx_args, 2);
2368 case 2: __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 1);
2369 case 1: __pyx_v_reference = PyTuple_GET_ITEM(__pyx_args, 0);
2371 default: goto __pyx_L5_argtuple_error;
2374 goto __pyx_L4_argument_unpacking_done;
2375 __pyx_L5_argtuple_error:;
2376 __Pyx_RaiseArgtupleInvalid("fetch", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2378 __Pyx_AddTraceback("ctabix.Tabixfile.fetch");
2379 __Pyx_RefNannyFinishContext();
2381 __pyx_L4_argument_unpacking_done:;
2382 __Pyx_INCREF(__pyx_v_region);
2383 __pyx_v_rtid = Py_None; __Pyx_INCREF(Py_None);
2384 __pyx_v_rstart = Py_None; __Pyx_INCREF(Py_None);
2385 __pyx_v_rend = Py_None; __Pyx_INCREF(Py_None);
2388 * data (see for example :meth:`asTuple` and :meth:`asGTF`).
2390 * ti_lazy_index_load( self.tabixfile ) # <<<<<<<<<<<<<<
2392 * if not self._isOpen():
2394 ti_lazy_index_load(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile);
2397 * ti_lazy_index_load( self.tabixfile )
2399 * if not self._isOpen(): # <<<<<<<<<<<<<<
2400 * raise ValueError( "I/O operation on closed file" )
2403 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2404 __Pyx_GOTREF(__pyx_t_1);
2405 __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 = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2406 __Pyx_GOTREF(__pyx_t_2);
2407 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2408 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2409 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2410 __pyx_t_4 = (!__pyx_t_3);
2415 * if not self._isOpen():
2416 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
2418 * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
2420 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2421 __Pyx_GOTREF(__pyx_t_2);
2422 __Pyx_Raise(__pyx_t_2, 0, 0);
2423 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2424 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2430 * raise ValueError( "I/O operation on closed file" )
2432 * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) # <<<<<<<<<<<<<<
2434 * if parser == None:
2436 __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2437 __Pyx_GOTREF(__pyx_t_2);
2438 __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2439 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
2440 __Pyx_INCREF(__pyx_v_reference);
2441 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference);
2442 __Pyx_GIVEREF(__pyx_v_reference);
2443 __Pyx_INCREF(__pyx_v_start);
2444 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start);
2445 __Pyx_GIVEREF(__pyx_v_start);
2446 __Pyx_INCREF(__pyx_v_end);
2447 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end);
2448 __Pyx_GIVEREF(__pyx_v_end);
2449 __Pyx_INCREF(__pyx_v_region);
2450 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_region);
2451 __Pyx_GIVEREF(__pyx_v_region);
2452 __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 = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2453 __Pyx_GOTREF(__pyx_t_5);
2454 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2455 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
2456 if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 4)) {
2457 PyObject* tuple = __pyx_t_5;
2458 __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
2459 __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
2460 __pyx_t_6 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_6);
2461 __pyx_t_7 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_7);
2462 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2463 __Pyx_DECREF(__pyx_v_region);
2464 __pyx_v_region = __pyx_t_1;
2466 __Pyx_DECREF(__pyx_v_rtid);
2467 __pyx_v_rtid = __pyx_t_2;
2469 __Pyx_DECREF(__pyx_v_rstart);
2470 __pyx_v_rstart = __pyx_t_6;
2472 __Pyx_DECREF(__pyx_v_rend);
2473 __pyx_v_rend = __pyx_t_7;
2476 __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2477 __Pyx_GOTREF(__pyx_t_8);
2478 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2479 __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2480 __Pyx_GOTREF(__pyx_t_1);
2481 __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2482 __Pyx_GOTREF(__pyx_t_2);
2483 __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_8, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2484 __Pyx_GOTREF(__pyx_t_6);
2485 __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_8, 3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2486 __Pyx_GOTREF(__pyx_t_7);
2487 if (__Pyx_EndUnpack(__pyx_t_8, 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2488 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2489 __Pyx_DECREF(__pyx_v_region);
2490 __pyx_v_region = __pyx_t_1;
2492 __Pyx_DECREF(__pyx_v_rtid);
2493 __pyx_v_rtid = __pyx_t_2;
2495 __Pyx_DECREF(__pyx_v_rstart);
2496 __pyx_v_rstart = __pyx_t_6;
2498 __Pyx_DECREF(__pyx_v_rend);
2499 __pyx_v_rend = __pyx_t_7;
2504 * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
2506 * if parser == None: # <<<<<<<<<<<<<<
2508 * return TabixIterator( self, rtid, rstart, rend )
2510 __pyx_t_5 = PyObject_RichCompare(__pyx_v_parser, Py_None, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2511 __Pyx_GOTREF(__pyx_t_5);
2512 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2513 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2518 * if parser == None:
2519 * if region: # <<<<<<<<<<<<<<
2520 * return TabixIterator( self, rtid, rstart, rend )
2523 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2527 * if parser == None:
2529 * return TabixIterator( self, rtid, rstart, rend ) # <<<<<<<<<<<<<<
2531 * return TabixIterator( self, -1, 0, 0 )
2533 __Pyx_XDECREF(__pyx_r);
2534 __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2535 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
2536 __Pyx_INCREF(__pyx_v_self);
2537 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self);
2538 __Pyx_GIVEREF(__pyx_v_self);
2539 __Pyx_INCREF(__pyx_v_rtid);
2540 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_rtid);
2541 __Pyx_GIVEREF(__pyx_v_rtid);
2542 __Pyx_INCREF(__pyx_v_rstart);
2543 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_rstart);
2544 __Pyx_GIVEREF(__pyx_v_rstart);
2545 __Pyx_INCREF(__pyx_v_rend);
2546 PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_rend);
2547 __Pyx_GIVEREF(__pyx_v_rend);
2548 __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixIterator)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2549 __Pyx_GOTREF(__pyx_t_7);
2550 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
2551 __pyx_r = __pyx_t_7;
2559 * return TabixIterator( self, rtid, rstart, rend )
2561 * return TabixIterator( self, -1, 0, 0 ) # <<<<<<<<<<<<<<
2565 __Pyx_XDECREF(__pyx_r);
2566 __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2567 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
2568 __Pyx_INCREF(__pyx_v_self);
2569 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self);
2570 __Pyx_GIVEREF(__pyx_v_self);
2571 __Pyx_INCREF(__pyx_int_neg_1);
2572 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_neg_1);
2573 __Pyx_GIVEREF(__pyx_int_neg_1);
2574 __Pyx_INCREF(__pyx_int_0);
2575 PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_int_0);
2576 __Pyx_GIVEREF(__pyx_int_0);
2577 __Pyx_INCREF(__pyx_int_0);
2578 PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_int_0);
2579 __Pyx_GIVEREF(__pyx_int_0);
2580 __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixIterator)), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2581 __Pyx_GOTREF(__pyx_t_5);
2582 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
2583 __pyx_r = __pyx_t_5;
2593 * return TabixIterator( self, -1, 0, 0 )
2595 * if region: # <<<<<<<<<<<<<<
2596 * return TabixIteratorParsed( self, rtid, rstart, rend, parser )
2599 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2605 * return TabixIteratorParsed( self, rtid, rstart, rend, parser ) # <<<<<<<<<<<<<<
2607 * return TabixIteratorParsed( self, -1, 0, 0, parser )
2609 __Pyx_XDECREF(__pyx_r);
2610 __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2611 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
2612 __Pyx_INCREF(__pyx_v_self);
2613 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self);
2614 __Pyx_GIVEREF(__pyx_v_self);
2615 __Pyx_INCREF(__pyx_v_rtid);
2616 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_rtid);
2617 __Pyx_GIVEREF(__pyx_v_rtid);
2618 __Pyx_INCREF(__pyx_v_rstart);
2619 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_rstart);
2620 __Pyx_GIVEREF(__pyx_v_rstart);
2621 __Pyx_INCREF(__pyx_v_rend);
2622 PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_rend);
2623 __Pyx_GIVEREF(__pyx_v_rend);
2624 __Pyx_INCREF(__pyx_v_parser);
2625 PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_v_parser);
2626 __Pyx_GIVEREF(__pyx_v_parser);
2627 __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixIteratorParsed)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2628 __Pyx_GOTREF(__pyx_t_7);
2629 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
2630 __pyx_r = __pyx_t_7;
2638 * return TabixIteratorParsed( self, rtid, rstart, rend, parser )
2640 * return TabixIteratorParsed( self, -1, 0, 0, parser ) # <<<<<<<<<<<<<<
2642 * ###############################################################
2644 __Pyx_XDECREF(__pyx_r);
2645 __pyx_t_7 = PyTuple_New(5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2646 __Pyx_GOTREF(((PyObject *)__pyx_t_7));
2647 __Pyx_INCREF(__pyx_v_self);
2648 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self);
2649 __Pyx_GIVEREF(__pyx_v_self);
2650 __Pyx_INCREF(__pyx_int_neg_1);
2651 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_neg_1);
2652 __Pyx_GIVEREF(__pyx_int_neg_1);
2653 __Pyx_INCREF(__pyx_int_0);
2654 PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_int_0);
2655 __Pyx_GIVEREF(__pyx_int_0);
2656 __Pyx_INCREF(__pyx_int_0);
2657 PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_int_0);
2658 __Pyx_GIVEREF(__pyx_int_0);
2659 __Pyx_INCREF(__pyx_v_parser);
2660 PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_v_parser);
2661 __Pyx_GIVEREF(__pyx_v_parser);
2662 __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixIteratorParsed)), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2663 __Pyx_GOTREF(__pyx_t_5);
2664 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
2665 __pyx_r = __pyx_t_5;
2673 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2676 __Pyx_XDECREF(__pyx_t_1);
2677 __Pyx_XDECREF(__pyx_t_2);
2678 __Pyx_XDECREF(__pyx_t_5);
2679 __Pyx_XDECREF(__pyx_t_6);
2680 __Pyx_XDECREF(__pyx_t_7);
2681 __Pyx_XDECREF(__pyx_t_8);
2682 __Pyx_AddTraceback("ctabix.Tabixfile.fetch");
2685 __Pyx_DECREF(__pyx_v_rtid);
2686 __Pyx_DECREF(__pyx_v_rstart);
2687 __Pyx_DECREF(__pyx_v_rend);
2688 __Pyx_DECREF(__pyx_v_region);
2689 __Pyx_XGIVEREF(__pyx_r);
2690 __Pyx_RefNannyFinishContext();
2695 * property filename:
2696 * '''filename associated with this object.'''
2697 * def __get__(self): # <<<<<<<<<<<<<<
2698 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
2699 * return self._filename
2702 static PyObject *__pyx_pf_6ctabix_9Tabixfile_8filename___get__(PyObject *__pyx_v_self); /*proto*/
2703 static PyObject *__pyx_pf_6ctabix_9Tabixfile_8filename___get__(PyObject *__pyx_v_self) {
2704 PyObject *__pyx_r = NULL;
2705 PyObject *__pyx_t_1 = NULL;
2706 PyObject *__pyx_t_2 = NULL;
2709 __Pyx_RefNannySetupContext("__get__");
2712 * '''filename associated with this object.'''
2713 * def __get__(self):
2714 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
2715 * return self._filename
2718 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2719 __Pyx_GOTREF(__pyx_t_1);
2720 __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 = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2721 __Pyx_GOTREF(__pyx_t_2);
2722 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2723 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2724 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2725 __pyx_t_4 = (!__pyx_t_3);
2727 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2728 __Pyx_GOTREF(__pyx_t_2);
2729 __Pyx_Raise(__pyx_t_2, 0, 0);
2730 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2731 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2737 * def __get__(self):
2738 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
2739 * return self._filename # <<<<<<<<<<<<<<
2743 __Pyx_XDECREF(__pyx_r);
2744 __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2745 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
2746 __pyx_r = ((PyObject *)__pyx_t_2);
2750 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2753 __Pyx_XDECREF(__pyx_t_1);
2754 __Pyx_XDECREF(__pyx_t_2);
2755 __Pyx_AddTraceback("ctabix.Tabixfile.filename.__get__");
2758 __Pyx_XGIVEREF(__pyx_r);
2759 __Pyx_RefNannyFinishContext();
2766 * def __get__( self ): # <<<<<<<<<<<<<<
2767 * return TabixHeaderIterator( self )
2771 static PyObject *__pyx_pf_6ctabix_9Tabixfile_6header___get__(PyObject *__pyx_v_self); /*proto*/
2772 static PyObject *__pyx_pf_6ctabix_9Tabixfile_6header___get__(PyObject *__pyx_v_self) {
2773 PyObject *__pyx_r = NULL;
2774 PyObject *__pyx_t_1 = NULL;
2775 PyObject *__pyx_t_2 = NULL;
2776 __Pyx_RefNannySetupContext("__get__");
2780 * def __get__( self ):
2781 * return TabixHeaderIterator( self ) # <<<<<<<<<<<<<<
2785 __Pyx_XDECREF(__pyx_r);
2786 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2787 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
2788 __Pyx_INCREF(__pyx_v_self);
2789 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
2790 __Pyx_GIVEREF(__pyx_v_self);
2791 __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixHeaderIterator)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2792 __Pyx_GOTREF(__pyx_t_2);
2793 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
2794 __pyx_r = __pyx_t_2;
2798 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2801 __Pyx_XDECREF(__pyx_t_1);
2802 __Pyx_XDECREF(__pyx_t_2);
2803 __Pyx_AddTraceback("ctabix.Tabixfile.header.__get__");
2806 __Pyx_XGIVEREF(__pyx_r);
2807 __Pyx_RefNannyFinishContext();
2813 * '''chromosome names'''
2814 * def __get__(self): # <<<<<<<<<<<<<<
2815 * cdef char ** sequences
2816 * cdef int nsequences
2819 static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(PyObject *__pyx_v_self); /*proto*/
2820 static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(PyObject *__pyx_v_self) {
2821 char **__pyx_v_sequences;
2822 int __pyx_v_nsequences;
2824 PyObject *__pyx_v_result;
2825 PyObject *__pyx_r = NULL;
2826 PyObject *__pyx_t_1 = NULL;
2829 __Pyx_RefNannySetupContext("__get__");
2830 __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
2833 * cdef int nsequences
2835 * ti_lazy_index_load( self.tabixfile ) # <<<<<<<<<<<<<<
2836 * sequences = ti_seqname( self.tabixfile.idx, &nsequences )
2839 ti_lazy_index_load(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile);
2843 * ti_lazy_index_load( self.tabixfile )
2844 * sequences = ti_seqname( self.tabixfile.idx, &nsequences ) # <<<<<<<<<<<<<<
2848 __pyx_v_sequences = ti_seqname(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile->idx, (&__pyx_v_nsequences));
2851 * sequences = ti_seqname( self.tabixfile.idx, &nsequences )
2853 * result = [] # <<<<<<<<<<<<<<
2854 * for x from 0 <= x < nsequences:
2855 * result.append( sequences[x] )
2857 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2858 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
2859 __Pyx_DECREF(((PyObject *)__pyx_v_result));
2860 __pyx_v_result = __pyx_t_1;
2866 * for x from 0 <= x < nsequences: # <<<<<<<<<<<<<<
2867 * result.append( sequences[x] )
2870 __pyx_t_2 = __pyx_v_nsequences;
2871 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_2; __pyx_v_x++) {
2875 * for x from 0 <= x < nsequences:
2876 * result.append( sequences[x] ) # <<<<<<<<<<<<<<
2880 if (unlikely(__pyx_v_result == Py_None)) {
2881 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2883 __pyx_t_1 = PyBytes_FromString((__pyx_v_sequences[__pyx_v_x])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2884 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
2885 __pyx_t_3 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2886 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
2890 * for x from 0 <= x < nsequences:
2891 * result.append( sequences[x] )
2892 * return result # <<<<<<<<<<<<<<
2894 * def close( self ):
2896 __Pyx_XDECREF(__pyx_r);
2897 __Pyx_INCREF(((PyObject *)__pyx_v_result));
2898 __pyx_r = ((PyObject *)__pyx_v_result);
2901 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2904 __Pyx_XDECREF(__pyx_t_1);
2905 __Pyx_AddTraceback("ctabix.Tabixfile.contigs.__get__");
2908 __Pyx_DECREF(__pyx_v_result);
2909 __Pyx_XGIVEREF(__pyx_r);
2910 __Pyx_RefNannyFinishContext();
2917 * def close( self ): # <<<<<<<<<<<<<<
2919 * closes the :class:`pysam.Tabixfile`.'''
2922 static PyObject *__pyx_pf_6ctabix_9Tabixfile_5close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2923 static char __pyx_doc_6ctabix_9Tabixfile_5close[] = "Tabixfile.close(self)\n\n closes the :class:`pysam.Tabixfile`.";
2924 static PyObject *__pyx_pf_6ctabix_9Tabixfile_5close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
2925 PyObject *__pyx_r = NULL;
2927 __Pyx_RefNannySetupContext("close");
2931 * closes the :class:`pysam.Tabixfile`.'''
2932 * if self.tabixfile != NULL: # <<<<<<<<<<<<<<
2933 * ti_close( self.tabixfile )
2934 * self.tabixfile = NULL
2936 __pyx_t_1 = (((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile != NULL);
2940 * closes the :class:`pysam.Tabixfile`.'''
2941 * if self.tabixfile != NULL:
2942 * ti_close( self.tabixfile ) # <<<<<<<<<<<<<<
2943 * self.tabixfile = NULL
2946 ti_close(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile);
2949 * if self.tabixfile != NULL:
2950 * ti_close( self.tabixfile )
2951 * self.tabixfile = NULL # <<<<<<<<<<<<<<
2953 * def __dealloc__( self ):
2955 ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile = NULL;
2960 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2961 __Pyx_XGIVEREF(__pyx_r);
2962 __Pyx_RefNannyFinishContext();
2967 * self.tabixfile = NULL
2969 * def __dealloc__( self ): # <<<<<<<<<<<<<<
2970 * # remember: dealloc cannot call other python methods
2971 * # note: no doc string
2974 static void __pyx_pf_6ctabix_9Tabixfile_6__dealloc__(PyObject *__pyx_v_self); /*proto*/
2975 static void __pyx_pf_6ctabix_9Tabixfile_6__dealloc__(PyObject *__pyx_v_self) {
2977 __Pyx_RefNannySetupContext("__dealloc__");
2980 * # note: no doc string
2981 * # note: __del__ is not called.
2982 * if self.tabixfile != NULL: # <<<<<<<<<<<<<<
2983 * ti_close( self.tabixfile )
2984 * self.tabixfile = NULL
2986 __pyx_t_1 = (((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile != NULL);
2990 * # note: __del__ is not called.
2991 * if self.tabixfile != NULL:
2992 * ti_close( self.tabixfile ) # <<<<<<<<<<<<<<
2993 * self.tabixfile = NULL
2994 * if self._filename != NULL: free( self._filename )
2996 ti_close(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile);
2999 * if self.tabixfile != NULL:
3000 * ti_close( self.tabixfile )
3001 * self.tabixfile = NULL # <<<<<<<<<<<<<<
3002 * if self._filename != NULL: free( self._filename )
3005 ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile = NULL;
3011 * ti_close( self.tabixfile )
3012 * self.tabixfile = NULL
3013 * if self._filename != NULL: free( self._filename ) # <<<<<<<<<<<<<<
3015 * cdef class TabixIterator:
3017 __pyx_t_1 = (((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename != NULL);
3019 free(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename);
3024 __Pyx_RefNannyFinishContext();
3028 * cdef tabix_t * tabixfile
3030 * def __cinit__(self, Tabixfile tabixfile, # <<<<<<<<<<<<<<
3031 * int tid, int start, int end ):
3035 static int __pyx_pf_6ctabix_13TabixIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3036 static int __pyx_pf_6ctabix_13TabixIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3037 struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile = 0;
3042 PyObject *__pyx_t_1 = NULL;
3043 PyObject *__pyx_t_2 = NULL;
3045 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,0};
3046 __Pyx_RefNannySetupContext("__cinit__");
3047 if (unlikely(__pyx_kwds)) {
3048 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
3049 PyObject* values[4] = {0,0,0,0};
3050 switch (PyTuple_GET_SIZE(__pyx_args)) {
3051 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3052 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3053 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3054 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3056 default: goto __pyx_L5_argtuple_error;
3058 switch (PyTuple_GET_SIZE(__pyx_args)) {
3060 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile);
3061 if (likely(values[0])) kw_args--;
3062 else goto __pyx_L5_argtuple_error;
3064 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid);
3065 if (likely(values[1])) kw_args--;
3067 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3070 values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
3071 if (likely(values[2])) kw_args--;
3073 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3076 values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
3077 if (likely(values[3])) kw_args--;
3079 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3082 if (unlikely(kw_args > 0)) {
3083 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3085 __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)values[0]);
3086 __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3087 __pyx_v_start = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3088 __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3089 } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
3090 goto __pyx_L5_argtuple_error;
3092 __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)PyTuple_GET_ITEM(__pyx_args, 0));
3093 __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 = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3094 __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 = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3095 __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 = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3097 goto __pyx_L4_argument_unpacking_done;
3098 __pyx_L5_argtuple_error:;
3099 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3101 __Pyx_AddTraceback("ctabix.TabixIterator.__cinit__");
3102 __Pyx_RefNannyFinishContext();
3104 __pyx_L4_argument_unpacking_done:;
3105 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tabixfile), __pyx_ptype_6ctabix_Tabixfile, 1, "tabixfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3108 * int tid, int start, int end ):
3110 * assert tabixfile._isOpen() # <<<<<<<<<<<<<<
3112 * # makes sure that samfile stays alive as long as the
3114 #ifndef CYTHON_WITHOUT_ASSERTIONS
3115 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_tabixfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3116 __Pyx_GOTREF(__pyx_t_1);
3117 __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 = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3118 __Pyx_GOTREF(__pyx_t_2);
3119 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3120 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3121 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3122 if (unlikely(!__pyx_t_3)) {
3123 PyErr_SetNone(PyExc_AssertionError);
3124 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3129 * # makes sure that samfile stays alive as long as the
3130 * # iterator is alive.
3131 * self.tabixfile = tabixfile.tabixfile # <<<<<<<<<<<<<<
3135 ((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->tabixfile = __pyx_v_tabixfile->tabixfile;
3138 * self.tabixfile = tabixfile.tabixfile
3140 * if tid < 0: # <<<<<<<<<<<<<<
3141 * # seek to start of file to ensure iteration is over
3144 __pyx_t_3 = (__pyx_v_tid < 0);
3148 * # seek to start of file to ensure iteration is over
3150 * bgzf_seek( self.tabixfile.fp, 0, 0) # <<<<<<<<<<<<<<
3151 * self.iterator = ti_iter_first()
3154 bgzf_seek(((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->tabixfile->fp, 0, 0);
3158 * bgzf_seek( self.tabixfile.fp, 0, 0)
3159 * self.iterator = ti_iter_first() # <<<<<<<<<<<<<<
3161 * self.iterator = ti_queryi(self.tabixfile, tid, start, end)
3163 ((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->iterator = ti_iter_first();
3169 * self.iterator = ti_iter_first()
3171 * self.iterator = ti_queryi(self.tabixfile, tid, start, end) # <<<<<<<<<<<<<<
3173 * if <void*>self.iterator == NULL:
3175 ((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->iterator = ti_queryi(((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->tabixfile, __pyx_v_tid, __pyx_v_start, __pyx_v_end);
3180 * self.iterator = ti_queryi(self.tabixfile, tid, start, end)
3182 * if <void*>self.iterator == NULL: # <<<<<<<<<<<<<<
3183 * raise ValueError("malformatted query or wrong sequence name.\n")
3186 __pyx_t_3 = (((void *)((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->iterator) == NULL);
3191 * if <void*>self.iterator == NULL:
3192 * raise ValueError("malformatted query or wrong sequence name.\n") # <<<<<<<<<<<<<<
3194 * def __iter__(self):
3196 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3197 __Pyx_GOTREF(__pyx_t_2);
3198 __Pyx_Raise(__pyx_t_2, 0, 0);
3199 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3200 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3208 __Pyx_XDECREF(__pyx_t_1);
3209 __Pyx_XDECREF(__pyx_t_2);
3210 __Pyx_AddTraceback("ctabix.TabixIterator.__cinit__");
3213 __Pyx_RefNannyFinishContext();
3218 * raise ValueError("malformatted query or wrong sequence name.\n")
3220 * def __iter__(self): # <<<<<<<<<<<<<<
3225 static PyObject *__pyx_pf_6ctabix_13TabixIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/
3226 static PyObject *__pyx_pf_6ctabix_13TabixIterator_1__iter__(PyObject *__pyx_v_self) {
3227 PyObject *__pyx_r = NULL;
3228 __Pyx_RefNannySetupContext("__iter__");
3232 * def __iter__(self):
3233 * return self # <<<<<<<<<<<<<<
3235 * def __next__(self):
3237 __Pyx_XDECREF(__pyx_r);
3238 __Pyx_INCREF(__pyx_v_self);
3239 __pyx_r = __pyx_v_self;
3242 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3244 __Pyx_XGIVEREF(__pyx_r);
3245 __Pyx_RefNannyFinishContext();
3252 * def __next__(self): # <<<<<<<<<<<<<<
3253 * """python version of next().
3257 static PyObject *__pyx_pf_6ctabix_13TabixIterator_2__next__(PyObject *__pyx_v_self); /*proto*/
3258 static char __pyx_doc_6ctabix_13TabixIterator_2__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n ";
3259 struct wrapperbase __pyx_wrapperbase_6ctabix_13TabixIterator_2__next__;
3260 static PyObject *__pyx_pf_6ctabix_13TabixIterator_2__next__(PyObject *__pyx_v_self) {
3263 PyObject *__pyx_r = NULL;
3265 PyObject *__pyx_t_2 = NULL;
3266 __Pyx_RefNannySetupContext("__next__");
3270 * # simply use '#' for now.
3271 * while 1: # <<<<<<<<<<<<<<
3272 * s = ti_read(self.tabixfile, self.iterator, &len)
3273 * if s == NULL: raise StopIteration
3279 * # simply use '#' for now.
3281 * s = ti_read(self.tabixfile, self.iterator, &len) # <<<<<<<<<<<<<<
3282 * if s == NULL: raise StopIteration
3283 * if s[0] != '#': break
3285 __pyx_v_s = ti_read(((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->tabixfile, ((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->iterator, (&__pyx_v_len));
3289 * s = ti_read(self.tabixfile, self.iterator, &len)
3290 * if s == NULL: raise StopIteration # <<<<<<<<<<<<<<
3291 * if s[0] != '#': break
3294 __pyx_t_1 = (__pyx_v_s == NULL);
3296 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
3297 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3303 * s = ti_read(self.tabixfile, self.iterator, &len)
3304 * if s == NULL: raise StopIteration
3305 * if s[0] != '#': break # <<<<<<<<<<<<<<
3309 __pyx_t_1 = ((__pyx_v_s[0]) != '#');
3311 goto __pyx_L6_break;
3319 * if s[0] != '#': break
3321 * return s # <<<<<<<<<<<<<<
3323 * def __dealloc__(self):
3325 __Pyx_XDECREF(__pyx_r);
3326 __pyx_t_2 = PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3327 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
3328 __pyx_r = ((PyObject *)__pyx_t_2);
3332 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3335 __Pyx_XDECREF(__pyx_t_2);
3336 __Pyx_AddTraceback("ctabix.TabixIterator.__next__");
3339 __Pyx_XGIVEREF(__pyx_r);
3340 __Pyx_RefNannyFinishContext();
3347 * def __dealloc__(self): # <<<<<<<<<<<<<<
3348 * if <void*>self.iterator != NULL:
3349 * ti_iter_destroy(self.iterator)
3352 static void __pyx_pf_6ctabix_13TabixIterator_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
3353 static void __pyx_pf_6ctabix_13TabixIterator_3__dealloc__(PyObject *__pyx_v_self) {
3355 __Pyx_RefNannySetupContext("__dealloc__");
3359 * def __dealloc__(self):
3360 * if <void*>self.iterator != NULL: # <<<<<<<<<<<<<<
3361 * ti_iter_destroy(self.iterator)
3364 __pyx_t_1 = (((void *)((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->iterator) != NULL);
3368 * def __dealloc__(self):
3369 * if <void*>self.iterator != NULL:
3370 * ti_iter_destroy(self.iterator) # <<<<<<<<<<<<<<
3372 * cdef class TabixHeaderIterator:
3374 ti_iter_destroy(((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->iterator);
3379 __Pyx_RefNannyFinishContext();
3383 * cdef tabix_t * tabixfile
3385 * def __cinit__(self, Tabixfile tabixfile ): # <<<<<<<<<<<<<<
3387 * assert tabixfile._isOpen()
3390 static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3391 static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3392 struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile = 0;
3394 PyObject *__pyx_t_1 = NULL;
3395 PyObject *__pyx_t_2 = NULL;
3397 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,0};
3398 __Pyx_RefNannySetupContext("__cinit__");
3399 if (unlikely(__pyx_kwds)) {
3400 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
3401 PyObject* values[1] = {0};
3402 switch (PyTuple_GET_SIZE(__pyx_args)) {
3403 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3405 default: goto __pyx_L5_argtuple_error;
3407 switch (PyTuple_GET_SIZE(__pyx_args)) {
3409 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile);
3410 if (likely(values[0])) kw_args--;
3411 else goto __pyx_L5_argtuple_error;
3413 if (unlikely(kw_args > 0)) {
3414 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3416 __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)values[0]);
3417 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
3418 goto __pyx_L5_argtuple_error;
3420 __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)PyTuple_GET_ITEM(__pyx_args, 0));
3422 goto __pyx_L4_argument_unpacking_done;
3423 __pyx_L5_argtuple_error:;
3424 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3426 __Pyx_AddTraceback("ctabix.TabixHeaderIterator.__cinit__");
3427 __Pyx_RefNannyFinishContext();
3429 __pyx_L4_argument_unpacking_done:;
3430 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tabixfile), __pyx_ptype_6ctabix_Tabixfile, 1, "tabixfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3433 * def __cinit__(self, Tabixfile tabixfile ):
3435 * assert tabixfile._isOpen() # <<<<<<<<<<<<<<
3437 * # makes sure that samfile stays alive as long as the
3439 #ifndef CYTHON_WITHOUT_ASSERTIONS
3440 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_tabixfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3441 __Pyx_GOTREF(__pyx_t_1);
3442 __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 = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3443 __Pyx_GOTREF(__pyx_t_2);
3444 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3445 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3446 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3447 if (unlikely(!__pyx_t_3)) {
3448 PyErr_SetNone(PyExc_AssertionError);
3449 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3454 * # makes sure that samfile stays alive as long as the
3455 * # iterator is alive.
3456 * self.tabixfile = tabixfile.tabixfile # <<<<<<<<<<<<<<
3458 * self.iterator = ti_query(self.tabixfile, NULL, 0, 0)
3460 ((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->tabixfile = __pyx_v_tabixfile->tabixfile;
3463 * self.tabixfile = tabixfile.tabixfile
3465 * self.iterator = ti_query(self.tabixfile, NULL, 0, 0) # <<<<<<<<<<<<<<
3467 * if <void*>self.iterator == NULL:
3469 ((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->iterator = ti_query(((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->tabixfile, NULL, 0, 0);
3472 * self.iterator = ti_query(self.tabixfile, NULL, 0, 0)
3474 * if <void*>self.iterator == NULL: # <<<<<<<<<<<<<<
3475 * raise ValueError("can't open header.\n")
3478 __pyx_t_3 = (((void *)((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->iterator) == NULL);
3483 * if <void*>self.iterator == NULL:
3484 * raise ValueError("can't open header.\n") # <<<<<<<<<<<<<<
3486 * def __iter__(self):
3488 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3489 __Pyx_GOTREF(__pyx_t_2);
3490 __Pyx_Raise(__pyx_t_2, 0, 0);
3491 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3492 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3500 __Pyx_XDECREF(__pyx_t_1);
3501 __Pyx_XDECREF(__pyx_t_2);
3502 __Pyx_AddTraceback("ctabix.TabixHeaderIterator.__cinit__");
3505 __Pyx_RefNannyFinishContext();
3510 * raise ValueError("can't open header.\n")
3512 * def __iter__(self): # <<<<<<<<<<<<<<
3517 static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/
3518 static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_1__iter__(PyObject *__pyx_v_self) {
3519 PyObject *__pyx_r = NULL;
3520 __Pyx_RefNannySetupContext("__iter__");
3524 * def __iter__(self):
3525 * return self # <<<<<<<<<<<<<<
3527 * def __next__(self):
3529 __Pyx_XDECREF(__pyx_r);
3530 __Pyx_INCREF(__pyx_v_self);
3531 __pyx_r = __pyx_v_self;
3534 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3536 __Pyx_XGIVEREF(__pyx_r);
3537 __Pyx_RefNannyFinishContext();
3544 * def __next__(self): # <<<<<<<<<<<<<<
3545 * """python version of next().
3549 static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_2__next__(PyObject *__pyx_v_self); /*proto*/
3550 static char __pyx_doc_6ctabix_19TabixHeaderIterator_2__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n ";
3551 struct wrapperbase __pyx_wrapperbase_6ctabix_19TabixHeaderIterator_2__next__;
3552 static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_2__next__(PyObject *__pyx_v_self) {
3555 PyObject *__pyx_r = NULL;
3557 PyObject *__pyx_t_2 = NULL;
3558 __Pyx_RefNannySetupContext("__next__");
3561 * # Getting the metachar is a pain as ti_index_t is incomplete type.
3562 * # simply use '#' for now.
3563 * s = ti_read(self.tabixfile, self.iterator, &len) # <<<<<<<<<<<<<<
3564 * if s == NULL: raise StopIteration
3565 * # stop at first non-header line
3567 __pyx_v_s = ti_read(((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->tabixfile, ((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->iterator, (&__pyx_v_len));
3570 * # simply use '#' for now.
3571 * s = ti_read(self.tabixfile, self.iterator, &len)
3572 * if s == NULL: raise StopIteration # <<<<<<<<<<<<<<
3573 * # stop at first non-header line
3574 * if s[0] != '#': raise StopIteration
3576 __pyx_t_1 = (__pyx_v_s == NULL);
3578 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
3579 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3585 * if s == NULL: raise StopIteration
3586 * # stop at first non-header line
3587 * if s[0] != '#': raise StopIteration # <<<<<<<<<<<<<<
3591 __pyx_t_1 = ((__pyx_v_s[0]) != '#');
3593 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
3594 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3600 * if s[0] != '#': raise StopIteration
3602 * return s # <<<<<<<<<<<<<<
3604 * def __dealloc__(self):
3606 __Pyx_XDECREF(__pyx_r);
3607 __pyx_t_2 = PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3608 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
3609 __pyx_r = ((PyObject *)__pyx_t_2);
3613 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3616 __Pyx_XDECREF(__pyx_t_2);
3617 __Pyx_AddTraceback("ctabix.TabixHeaderIterator.__next__");
3620 __Pyx_XGIVEREF(__pyx_r);
3621 __Pyx_RefNannyFinishContext();
3628 * def __dealloc__(self): # <<<<<<<<<<<<<<
3629 * if <void*>self.iterator != NULL:
3630 * ti_iter_destroy(self.iterator)
3633 static void __pyx_pf_6ctabix_19TabixHeaderIterator_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
3634 static void __pyx_pf_6ctabix_19TabixHeaderIterator_3__dealloc__(PyObject *__pyx_v_self) {
3636 __Pyx_RefNannySetupContext("__dealloc__");
3640 * def __dealloc__(self):
3641 * if <void*>self.iterator != NULL: # <<<<<<<<<<<<<<
3642 * ti_iter_destroy(self.iterator)
3645 __pyx_t_1 = (((void *)((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->iterator) != NULL);
3649 * def __dealloc__(self):
3650 * if <void*>self.iterator != NULL:
3651 * ti_iter_destroy(self.iterator) # <<<<<<<<<<<<<<
3653 * #########################################################
3655 ti_iter_destroy(((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->iterator);
3660 __Pyx_RefNannyFinishContext();
3664 * Access is by numeric index.
3666 * def __call__(self, char * buffer, int len): # <<<<<<<<<<<<<<
3667 * cdef TabProxies.TupleProxy r
3668 * r = TabProxies.TupleProxy()
3671 static PyObject *__pyx_pf_6ctabix_7asTuple___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3672 static PyObject *__pyx_pf_6ctabix_7asTuple___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3673 char *__pyx_v_buffer;
3675 struct __pyx_obj_10TabProxies_TupleProxy *__pyx_v_r;
3676 PyObject *__pyx_r = NULL;
3677 PyObject *__pyx_t_1 = NULL;
3678 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
3679 __Pyx_RefNannySetupContext("__call__");
3680 if (unlikely(__pyx_kwds)) {
3681 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
3682 PyObject* values[2] = {0,0};
3683 switch (PyTuple_GET_SIZE(__pyx_args)) {
3684 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3685 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3687 default: goto __pyx_L5_argtuple_error;
3689 switch (PyTuple_GET_SIZE(__pyx_args)) {
3691 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer);
3692 if (likely(values[0])) kw_args--;
3693 else goto __pyx_L5_argtuple_error;
3695 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len);
3696 if (likely(values[1])) kw_args--;
3698 __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3701 if (unlikely(kw_args > 0)) {
3702 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3704 __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3705 __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3706 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3707 goto __pyx_L5_argtuple_error;
3709 __pyx_v_buffer = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3710 __pyx_v_len = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3712 goto __pyx_L4_argument_unpacking_done;
3713 __pyx_L5_argtuple_error:;
3714 __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3716 __Pyx_AddTraceback("ctabix.asTuple.__call__");
3717 __Pyx_RefNannyFinishContext();
3719 __pyx_L4_argument_unpacking_done:;
3720 __pyx_v_r = ((struct __pyx_obj_10TabProxies_TupleProxy *)Py_None); __Pyx_INCREF(Py_None);
3723 * def __call__(self, char * buffer, int len):
3724 * cdef TabProxies.TupleProxy r
3725 * r = TabProxies.TupleProxy() # <<<<<<<<<<<<<<
3726 * # need to copy - there were some
3727 * # persistence issues with "present"
3729 __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3730 __Pyx_GOTREF(__pyx_t_1);
3731 __Pyx_DECREF(((PyObject *)__pyx_v_r));
3732 __pyx_v_r = ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_t_1);
3736 * # need to copy - there were some
3737 * # persistence issues with "present"
3738 * r.copy( buffer, len ) # <<<<<<<<<<<<<<
3742 __pyx_t_1 = ((struct __pyx_vtabstruct_10TabProxies_TupleProxy *)__pyx_v_r->__pyx_vtab)->copy(__pyx_v_r, __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3743 __Pyx_GOTREF(__pyx_t_1);
3744 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3747 * # persistence issues with "present"
3748 * r.copy( buffer, len )
3749 * return r # <<<<<<<<<<<<<<
3751 * cdef class asGTF(Parser):
3753 __Pyx_XDECREF(__pyx_r);
3754 __Pyx_INCREF(((PyObject *)__pyx_v_r));
3755 __pyx_r = ((PyObject *)__pyx_v_r);
3758 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3761 __Pyx_XDECREF(__pyx_t_1);
3762 __Pyx_AddTraceback("ctabix.asTuple.__call__");
3765 __Pyx_DECREF((PyObject *)__pyx_v_r);
3766 __Pyx_XGIVEREF(__pyx_r);
3767 __Pyx_RefNannyFinishContext();
3774 * def __call__(self, char * buffer, int len): # <<<<<<<<<<<<<<
3775 * cdef TabProxies.GTFProxy r
3776 * r = TabProxies.GTFProxy()
3779 static PyObject *__pyx_pf_6ctabix_5asGTF___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3780 static PyObject *__pyx_pf_6ctabix_5asGTF___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3781 char *__pyx_v_buffer;
3783 struct __pyx_obj_10TabProxies_GTFProxy *__pyx_v_r;
3784 PyObject *__pyx_r = NULL;
3785 PyObject *__pyx_t_1 = NULL;
3786 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
3787 __Pyx_RefNannySetupContext("__call__");
3788 if (unlikely(__pyx_kwds)) {
3789 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
3790 PyObject* values[2] = {0,0};
3791 switch (PyTuple_GET_SIZE(__pyx_args)) {
3792 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3793 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3795 default: goto __pyx_L5_argtuple_error;
3797 switch (PyTuple_GET_SIZE(__pyx_args)) {
3799 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer);
3800 if (likely(values[0])) kw_args--;
3801 else goto __pyx_L5_argtuple_error;
3803 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len);
3804 if (likely(values[1])) kw_args--;
3806 __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3809 if (unlikely(kw_args > 0)) {
3810 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3812 __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3813 __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3814 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3815 goto __pyx_L5_argtuple_error;
3817 __pyx_v_buffer = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3818 __pyx_v_len = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3820 goto __pyx_L4_argument_unpacking_done;
3821 __pyx_L5_argtuple_error:;
3822 __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3824 __Pyx_AddTraceback("ctabix.asGTF.__call__");
3825 __Pyx_RefNannyFinishContext();
3827 __pyx_L4_argument_unpacking_done:;
3828 __pyx_v_r = ((struct __pyx_obj_10TabProxies_GTFProxy *)Py_None); __Pyx_INCREF(Py_None);
3831 * def __call__(self, char * buffer, int len):
3832 * cdef TabProxies.GTFProxy r
3833 * r = TabProxies.GTFProxy() # <<<<<<<<<<<<<<
3834 * r.copy( buffer, len )
3837 __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_GTFProxy)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3838 __Pyx_GOTREF(__pyx_t_1);
3839 __Pyx_DECREF(((PyObject *)__pyx_v_r));
3840 __pyx_v_r = ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_t_1);
3844 * cdef TabProxies.GTFProxy r
3845 * r = TabProxies.GTFProxy()
3846 * r.copy( buffer, len ) # <<<<<<<<<<<<<<
3850 __pyx_t_1 = ((struct __pyx_vtabstruct_10TabProxies_GTFProxy *)__pyx_v_r->__pyx_base.__pyx_vtab)->__pyx_base.copy(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_r), __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3851 __Pyx_GOTREF(__pyx_t_1);
3852 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3855 * r = TabProxies.GTFProxy()
3856 * r.copy( buffer, len )
3857 * return r # <<<<<<<<<<<<<<
3859 * cdef class asBed( Parser ):
3861 __Pyx_XDECREF(__pyx_r);
3862 __Pyx_INCREF(((PyObject *)__pyx_v_r));
3863 __pyx_r = ((PyObject *)__pyx_v_r);
3866 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3869 __Pyx_XDECREF(__pyx_t_1);
3870 __Pyx_AddTraceback("ctabix.asGTF.__call__");
3873 __Pyx_DECREF((PyObject *)__pyx_v_r);
3874 __Pyx_XGIVEREF(__pyx_r);
3875 __Pyx_RefNannyFinishContext();
3882 * def __call__(self, char * buffer, int len): # <<<<<<<<<<<<<<
3883 * cdef TabProxies.BedProxy r
3884 * r = TabProxies.BedProxy()
3887 static PyObject *__pyx_pf_6ctabix_5asBed___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3888 static PyObject *__pyx_pf_6ctabix_5asBed___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3889 char *__pyx_v_buffer;
3891 struct __pyx_obj_10TabProxies_BedProxy *__pyx_v_r;
3892 PyObject *__pyx_r = NULL;
3893 PyObject *__pyx_t_1 = NULL;
3894 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
3895 __Pyx_RefNannySetupContext("__call__");
3896 if (unlikely(__pyx_kwds)) {
3897 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
3898 PyObject* values[2] = {0,0};
3899 switch (PyTuple_GET_SIZE(__pyx_args)) {
3900 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3901 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3903 default: goto __pyx_L5_argtuple_error;
3905 switch (PyTuple_GET_SIZE(__pyx_args)) {
3907 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer);
3908 if (likely(values[0])) kw_args--;
3909 else goto __pyx_L5_argtuple_error;
3911 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len);
3912 if (likely(values[1])) kw_args--;
3914 __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3917 if (unlikely(kw_args > 0)) {
3918 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3920 __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3921 __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3922 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3923 goto __pyx_L5_argtuple_error;
3925 __pyx_v_buffer = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3926 __pyx_v_len = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3928 goto __pyx_L4_argument_unpacking_done;
3929 __pyx_L5_argtuple_error:;
3930 __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3932 __Pyx_AddTraceback("ctabix.asBed.__call__");
3933 __Pyx_RefNannyFinishContext();
3935 __pyx_L4_argument_unpacking_done:;
3936 __pyx_v_r = ((struct __pyx_obj_10TabProxies_BedProxy *)Py_None); __Pyx_INCREF(Py_None);
3939 * def __call__(self, char * buffer, int len):
3940 * cdef TabProxies.BedProxy r
3941 * r = TabProxies.BedProxy() # <<<<<<<<<<<<<<
3942 * r.copy( buffer, len )
3945 __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_BedProxy)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3946 __Pyx_GOTREF(__pyx_t_1);
3947 __Pyx_DECREF(((PyObject *)__pyx_v_r));
3948 __pyx_v_r = ((struct __pyx_obj_10TabProxies_BedProxy *)__pyx_t_1);
3952 * cdef TabProxies.BedProxy r
3953 * r = TabProxies.BedProxy()
3954 * r.copy( buffer, len ) # <<<<<<<<<<<<<<
3958 __pyx_t_1 = ((struct __pyx_vtabstruct_10TabProxies_BedProxy *)__pyx_v_r->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_r), __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3959 __Pyx_GOTREF(__pyx_t_1);
3960 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3963 * r = TabProxies.BedProxy()
3964 * r.copy( buffer, len )
3965 * return r # <<<<<<<<<<<<<<
3967 * cdef class asVCF( Parser ):
3969 __Pyx_XDECREF(__pyx_r);
3970 __Pyx_INCREF(((PyObject *)__pyx_v_r));
3971 __pyx_r = ((PyObject *)__pyx_v_r);
3974 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3977 __Pyx_XDECREF(__pyx_t_1);
3978 __Pyx_AddTraceback("ctabix.asBed.__call__");
3981 __Pyx_DECREF((PyObject *)__pyx_v_r);
3982 __Pyx_XGIVEREF(__pyx_r);
3983 __Pyx_RefNannyFinishContext();
3990 * def __call__(self, char * buffer, int len ): # <<<<<<<<<<<<<<
3991 * cdef TabProxies.VCFProxy r
3992 * r = TabProxies.VCFProxy()
3995 static PyObject *__pyx_pf_6ctabix_5asVCF___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3996 static PyObject *__pyx_pf_6ctabix_5asVCF___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3997 char *__pyx_v_buffer;
3999 struct __pyx_obj_10TabProxies_VCFProxy *__pyx_v_r;
4000 PyObject *__pyx_r = NULL;
4001 PyObject *__pyx_t_1 = NULL;
4002 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
4003 __Pyx_RefNannySetupContext("__call__");
4004 if (unlikely(__pyx_kwds)) {
4005 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
4006 PyObject* values[2] = {0,0};
4007 switch (PyTuple_GET_SIZE(__pyx_args)) {
4008 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4009 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4011 default: goto __pyx_L5_argtuple_error;
4013 switch (PyTuple_GET_SIZE(__pyx_args)) {
4015 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer);
4016 if (likely(values[0])) kw_args--;
4017 else goto __pyx_L5_argtuple_error;
4019 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len);
4020 if (likely(values[1])) kw_args--;
4022 __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4025 if (unlikely(kw_args > 0)) {
4026 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4028 __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4029 __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4030 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4031 goto __pyx_L5_argtuple_error;
4033 __pyx_v_buffer = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4034 __pyx_v_len = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4036 goto __pyx_L4_argument_unpacking_done;
4037 __pyx_L5_argtuple_error:;
4038 __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4040 __Pyx_AddTraceback("ctabix.asVCF.__call__");
4041 __Pyx_RefNannyFinishContext();
4043 __pyx_L4_argument_unpacking_done:;
4044 __pyx_v_r = ((struct __pyx_obj_10TabProxies_VCFProxy *)Py_None); __Pyx_INCREF(Py_None);
4047 * def __call__(self, char * buffer, int len ):
4048 * cdef TabProxies.VCFProxy r
4049 * r = TabProxies.VCFProxy() # <<<<<<<<<<<<<<
4050 * r.copy( buffer, len )
4053 __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_VCFProxy)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4054 __Pyx_GOTREF(__pyx_t_1);
4055 __Pyx_DECREF(((PyObject *)__pyx_v_r));
4056 __pyx_v_r = ((struct __pyx_obj_10TabProxies_VCFProxy *)__pyx_t_1);
4060 * cdef TabProxies.VCFProxy r
4061 * r = TabProxies.VCFProxy()
4062 * r.copy( buffer, len ) # <<<<<<<<<<<<<<
4066 __pyx_t_1 = ((struct __pyx_vtabstruct_10TabProxies_VCFProxy *)__pyx_v_r->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_r), __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4067 __Pyx_GOTREF(__pyx_t_1);
4068 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4071 * r = TabProxies.VCFProxy()
4072 * r.copy( buffer, len )
4073 * return r # <<<<<<<<<<<<<<
4075 * #########################################################
4077 __Pyx_XDECREF(__pyx_r);
4078 __Pyx_INCREF(((PyObject *)__pyx_v_r));
4079 __pyx_r = ((PyObject *)__pyx_v_r);
4082 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4085 __Pyx_XDECREF(__pyx_t_1);
4086 __Pyx_AddTraceback("ctabix.asVCF.__call__");
4089 __Pyx_DECREF((PyObject *)__pyx_v_r);
4090 __Pyx_XGIVEREF(__pyx_r);
4091 __Pyx_RefNannyFinishContext();
4096 * cdef Parser parser
4098 * def __cinit__(self, # <<<<<<<<<<<<<<
4099 * Tabixfile tabixfile,
4103 static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4104 static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4105 struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile = 0;
4109 struct __pyx_obj_6ctabix_Parser *__pyx_v_parser = 0;
4111 PyObject *__pyx_t_1 = NULL;
4112 PyObject *__pyx_t_2 = NULL;
4114 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__parser,0};
4115 __Pyx_RefNannySetupContext("__cinit__");
4116 if (unlikely(__pyx_kwds)) {
4117 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
4118 PyObject* values[5] = {0,0,0,0,0};
4119 switch (PyTuple_GET_SIZE(__pyx_args)) {
4120 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4121 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4122 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4123 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4124 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4126 default: goto __pyx_L5_argtuple_error;
4128 switch (PyTuple_GET_SIZE(__pyx_args)) {
4130 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile);
4131 if (likely(values[0])) kw_args--;
4132 else goto __pyx_L5_argtuple_error;
4134 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid);
4135 if (likely(values[1])) kw_args--;
4137 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4140 values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
4141 if (likely(values[2])) kw_args--;
4143 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4146 values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
4147 if (likely(values[3])) kw_args--;
4149 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4152 values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
4153 if (likely(values[4])) kw_args--;
4155 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4158 if (unlikely(kw_args > 0)) {
4159 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4161 __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)values[0]);
4162 __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4163 __pyx_v_start = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4164 __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4165 __pyx_v_parser = ((struct __pyx_obj_6ctabix_Parser *)values[4]);
4166 } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
4167 goto __pyx_L5_argtuple_error;
4169 __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)PyTuple_GET_ITEM(__pyx_args, 0));
4170 __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 = 440; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4171 __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 = 441; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4172 __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 = 442; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4173 __pyx_v_parser = ((struct __pyx_obj_6ctabix_Parser *)PyTuple_GET_ITEM(__pyx_args, 4));
4175 goto __pyx_L4_argument_unpacking_done;
4176 __pyx_L5_argtuple_error:;
4177 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4179 __Pyx_AddTraceback("ctabix.TabixIteratorParsed.__cinit__");
4180 __Pyx_RefNannyFinishContext();
4182 __pyx_L4_argument_unpacking_done:;
4183 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tabixfile), __pyx_ptype_6ctabix_Tabixfile, 1, "tabixfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4184 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_6ctabix_Parser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4189 * assert tabixfile._isOpen() # <<<<<<<<<<<<<<
4190 * self.parser = parser
4193 #ifndef CYTHON_WITHOUT_ASSERTIONS
4194 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_tabixfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4195 __Pyx_GOTREF(__pyx_t_1);
4196 __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 = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4197 __Pyx_GOTREF(__pyx_t_2);
4198 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4199 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4200 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4201 if (unlikely(!__pyx_t_3)) {
4202 PyErr_SetNone(PyExc_AssertionError);
4203 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4209 * assert tabixfile._isOpen()
4210 * self.parser = parser # <<<<<<<<<<<<<<
4212 * # makes sure that samfile stays alive as long as the
4214 __Pyx_INCREF(((PyObject *)__pyx_v_parser));
4215 __Pyx_GIVEREF(((PyObject *)__pyx_v_parser));
4216 __Pyx_GOTREF(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->parser);
4217 __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->parser));
4218 ((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->parser = __pyx_v_parser;
4221 * # makes sure that samfile stays alive as long as the
4222 * # iterator is alive.
4223 * self.tabixfile = tabixfile.tabixfile # <<<<<<<<<<<<<<
4227 ((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->tabixfile = __pyx_v_tabixfile->tabixfile;
4230 * self.tabixfile = tabixfile.tabixfile
4232 * if tid < 0: # <<<<<<<<<<<<<<
4233 * # seek to start of file to ensure iteration is over
4236 __pyx_t_3 = (__pyx_v_tid < 0);
4240 * # seek to start of file to ensure iteration is over
4242 * bgzf_seek( self.tabixfile.fp, 0, 0) # <<<<<<<<<<<<<<
4243 * self.iterator = ti_iter_first()
4246 bgzf_seek(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->tabixfile->fp, 0, 0);
4250 * bgzf_seek( self.tabixfile.fp, 0, 0)
4251 * self.iterator = ti_iter_first() # <<<<<<<<<<<<<<
4253 * self.iterator = ti_queryi(self.tabixfile, tid, start, end)
4255 ((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->iterator = ti_iter_first();
4261 * self.iterator = ti_iter_first()
4263 * self.iterator = ti_queryi(self.tabixfile, tid, start, end) # <<<<<<<<<<<<<<
4265 * if <void*>self.iterator == NULL:
4267 ((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->iterator = ti_queryi(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->tabixfile, __pyx_v_tid, __pyx_v_start, __pyx_v_end);
4272 * self.iterator = ti_queryi(self.tabixfile, tid, start, end)
4274 * if <void*>self.iterator == NULL: # <<<<<<<<<<<<<<
4275 * raise ValueError("malformatted query or wrong sequence name.\n")
4278 __pyx_t_3 = (((void *)((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->iterator) == NULL);
4283 * if <void*>self.iterator == NULL:
4284 * raise ValueError("malformatted query or wrong sequence name.\n") # <<<<<<<<<<<<<<
4286 * def __iter__(self):
4288 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4289 __Pyx_GOTREF(__pyx_t_2);
4290 __Pyx_Raise(__pyx_t_2, 0, 0);
4291 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4292 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4300 __Pyx_XDECREF(__pyx_t_1);
4301 __Pyx_XDECREF(__pyx_t_2);
4302 __Pyx_AddTraceback("ctabix.TabixIteratorParsed.__cinit__");
4305 __Pyx_RefNannyFinishContext();
4310 * raise ValueError("malformatted query or wrong sequence name.\n")
4312 * def __iter__(self): # <<<<<<<<<<<<<<
4317 static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_1__iter__(PyObject *__pyx_v_self); /*proto*/
4318 static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_1__iter__(PyObject *__pyx_v_self) {
4319 PyObject *__pyx_r = NULL;
4320 __Pyx_RefNannySetupContext("__iter__");
4324 * def __iter__(self):
4325 * return self # <<<<<<<<<<<<<<
4327 * def __next__(self):
4329 __Pyx_XDECREF(__pyx_r);
4330 __Pyx_INCREF(__pyx_v_self);
4331 __pyx_r = __pyx_v_self;
4334 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4336 __Pyx_XGIVEREF(__pyx_r);
4337 __Pyx_RefNannyFinishContext();
4344 * def __next__(self): # <<<<<<<<<<<<<<
4345 * """python version of next().
4349 static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_2__next__(PyObject *__pyx_v_self); /*proto*/
4350 static char __pyx_doc_6ctabix_19TabixIteratorParsed_2__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n ";
4351 struct wrapperbase __pyx_wrapperbase_6ctabix_19TabixIteratorParsed_2__next__;
4352 static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_2__next__(PyObject *__pyx_v_self) {
4355 PyObject *__pyx_r = NULL;
4357 PyObject *__pyx_t_2 = NULL;
4358 PyObject *__pyx_t_3 = NULL;
4359 PyObject *__pyx_t_4 = NULL;
4360 __Pyx_RefNannySetupContext("__next__");
4365 * while 1: # <<<<<<<<<<<<<<
4366 * s = ti_read(self.tabixfile, self.iterator, &len)
4367 * if s == NULL: raise StopIteration
4375 * s = ti_read(self.tabixfile, self.iterator, &len) # <<<<<<<<<<<<<<
4376 * if s == NULL: raise StopIteration
4377 * # todo: read metachar from configuration
4379 __pyx_v_s = ti_read(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->tabixfile, ((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->iterator, (&__pyx_v_len));
4383 * s = ti_read(self.tabixfile, self.iterator, &len)
4384 * if s == NULL: raise StopIteration # <<<<<<<<<<<<<<
4385 * # todo: read metachar from configuration
4386 * if s[0] != '#': break
4388 __pyx_t_1 = (__pyx_v_s == NULL);
4390 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0);
4391 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4397 * if s == NULL: raise StopIteration
4398 * # todo: read metachar from configuration
4399 * if s[0] != '#': break # <<<<<<<<<<<<<<
4401 * return self.parser(s, len)
4403 __pyx_t_1 = ((__pyx_v_s[0]) != '#');
4405 goto __pyx_L6_break;
4413 * if s[0] != '#': break
4415 * return self.parser(s, len) # <<<<<<<<<<<<<<
4417 * def __dealloc__(self):
4419 __Pyx_XDECREF(__pyx_r);
4420 __pyx_t_2 = PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4421 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
4422 __pyx_t_3 = PyInt_FromLong(__pyx_v_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4423 __Pyx_GOTREF(__pyx_t_3);
4424 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4425 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
4426 PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_2));
4427 __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
4428 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
4429 __Pyx_GIVEREF(__pyx_t_3);
4432 __pyx_t_3 = PyObject_Call(((PyObject *)((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->parser), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4433 __Pyx_GOTREF(__pyx_t_3);
4434 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
4435 __pyx_r = __pyx_t_3;
4439 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4442 __Pyx_XDECREF(__pyx_t_2);
4443 __Pyx_XDECREF(__pyx_t_3);
4444 __Pyx_XDECREF(__pyx_t_4);
4445 __Pyx_AddTraceback("ctabix.TabixIteratorParsed.__next__");
4448 __Pyx_XGIVEREF(__pyx_r);
4449 __Pyx_RefNannyFinishContext();
4454 * return self.parser(s, len)
4456 * def __dealloc__(self): # <<<<<<<<<<<<<<
4457 * if <void*>self.iterator != NULL:
4458 * ti_iter_destroy(self.iterator)
4461 static void __pyx_pf_6ctabix_19TabixIteratorParsed_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
4462 static void __pyx_pf_6ctabix_19TabixIteratorParsed_3__dealloc__(PyObject *__pyx_v_self) {
4464 __Pyx_RefNannySetupContext("__dealloc__");
4468 * def __dealloc__(self):
4469 * if <void*>self.iterator != NULL: # <<<<<<<<<<<<<<
4470 * ti_iter_destroy(self.iterator)
4473 __pyx_t_1 = (((void *)((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->iterator) != NULL);
4477 * def __dealloc__(self):
4478 * if <void*>self.iterator != NULL:
4479 * ti_iter_destroy(self.iterator) # <<<<<<<<<<<<<<
4481 * def tabix_compress( filename_in,
4483 ti_iter_destroy(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->iterator);
4488 __Pyx_RefNannyFinishContext();
4492 * ti_iter_destroy(self.iterator)
4494 * def tabix_compress( filename_in, # <<<<<<<<<<<<<<
4499 static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4500 static char __pyx_doc_6ctabix_tabix_compress[] = "tabix_compress(filename_in, filename_out, force=False)\n\n compress *filename_in* writing the output to *filename_out*.\n \n Raise an IOError if *filename_out* already exists, unless *force* is set.\n ";
4501 static PyMethodDef __pyx_mdef_6ctabix_tabix_compress = {__Pyx_NAMESTR("tabix_compress"), (PyCFunction)__pyx_pf_6ctabix_tabix_compress, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_tabix_compress)};
4502 static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4503 PyObject *__pyx_v_filename_in = 0;
4504 PyObject *__pyx_v_filename_out = 0;
4505 PyObject *__pyx_v_force = 0;
4506 int __pyx_v_WINDOW_SIZE;
4509 void *__pyx_v_buffer;
4512 int __pyx_v_O_RDONLY;
4513 PyObject *__pyx_r = NULL;
4516 PyObject *__pyx_t_3 = NULL;
4517 PyObject *__pyx_t_4 = NULL;
4518 PyObject *__pyx_t_5 = NULL;
4522 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename_in,&__pyx_n_s__filename_out,&__pyx_n_s__force,0};
4523 __Pyx_RefNannySetupContext("tabix_compress");
4524 __pyx_self = __pyx_self;
4525 if (unlikely(__pyx_kwds)) {
4526 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
4527 PyObject* values[3] = {0,0,0};
4528 values[2] = __pyx_k_19;
4529 switch (PyTuple_GET_SIZE(__pyx_args)) {
4530 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4531 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4532 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4534 default: goto __pyx_L5_argtuple_error;
4536 switch (PyTuple_GET_SIZE(__pyx_args)) {
4538 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename_in);
4539 if (likely(values[0])) kw_args--;
4540 else goto __pyx_L5_argtuple_error;
4542 values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename_out);
4543 if (likely(values[1])) kw_args--;
4545 __Pyx_RaiseArgtupleInvalid("tabix_compress", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4549 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__force);
4550 if (value) { values[2] = value; kw_args--; }
4553 if (unlikely(kw_args > 0)) {
4554 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "tabix_compress") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4556 __pyx_v_filename_in = values[0];
4557 __pyx_v_filename_out = values[1];
4558 __pyx_v_force = values[2];
4560 __pyx_v_force = __pyx_k_19;
4561 switch (PyTuple_GET_SIZE(__pyx_args)) {
4563 __pyx_v_force = PyTuple_GET_ITEM(__pyx_args, 2);
4565 __pyx_v_filename_out = PyTuple_GET_ITEM(__pyx_args, 1);
4566 __pyx_v_filename_in = PyTuple_GET_ITEM(__pyx_args, 0);
4568 default: goto __pyx_L5_argtuple_error;
4571 goto __pyx_L4_argument_unpacking_done;
4572 __pyx_L5_argtuple_error:;
4573 __Pyx_RaiseArgtupleInvalid("tabix_compress", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4575 __Pyx_AddTraceback("ctabix.tabix_compress");
4576 __Pyx_RefNannyFinishContext();
4578 __pyx_L4_argument_unpacking_done:;
4583 * if not force and os.path.exists(filename_out ): # <<<<<<<<<<<<<<
4584 * raise IOError( "Filename '%s' already exists, use *force* to overwrite" % filename_out)
4587 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_force); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4588 __pyx_t_2 = (!__pyx_t_1);
4590 __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4591 __Pyx_GOTREF(__pyx_t_3);
4592 __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__path); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4593 __Pyx_GOTREF(__pyx_t_4);
4594 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4595 __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__exists); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4596 __Pyx_GOTREF(__pyx_t_3);
4597 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4598 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4599 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
4600 __Pyx_INCREF(__pyx_v_filename_out);
4601 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filename_out);
4602 __Pyx_GIVEREF(__pyx_v_filename_out);
4603 __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4604 __Pyx_GOTREF(__pyx_t_5);
4605 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4606 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
4607 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4608 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4609 __pyx_t_6 = __pyx_t_1;
4611 __pyx_t_6 = __pyx_t_2;
4617 * if not force and os.path.exists(filename_out ):
4618 * raise IOError( "Filename '%s' already exists, use *force* to overwrite" % filename_out) # <<<<<<<<<<<<<<
4620 * cdef int WINDOW_SIZE
4622 __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), __pyx_v_filename_out); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4623 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
4624 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4625 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
4626 PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
4627 __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
4629 __pyx_t_5 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4630 __Pyx_GOTREF(__pyx_t_5);
4631 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
4632 __Pyx_Raise(__pyx_t_5, 0, 0);
4633 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4634 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4642 * O_RDONLY = os.O_RDONLY # <<<<<<<<<<<<<<
4644 * WINDOW_SIZE = 64 * 1024
4646 __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4647 __Pyx_GOTREF(__pyx_t_5);
4648 __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__O_RDONLY); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4649 __Pyx_GOTREF(__pyx_t_4);
4650 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4651 __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4652 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4653 __pyx_v_O_RDONLY = __pyx_t_7;
4656 * O_RDONLY = os.O_RDONLY
4658 * WINDOW_SIZE = 64 * 1024 # <<<<<<<<<<<<<<
4660 * fp = bgzf_open( filename_out, "w")
4662 __pyx_v_WINDOW_SIZE = 65536;
4665 * WINDOW_SIZE = 64 * 1024
4667 * fp = bgzf_open( filename_out, "w") # <<<<<<<<<<<<<<
4669 * raise IOError( "could not open '%s' for writing" )
4671 __pyx_t_8 = PyBytes_AsString(__pyx_v_filename_out); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4672 __pyx_v_fp = bgzf_open(__pyx_t_8, __pyx_k__w);
4676 * fp = bgzf_open( filename_out, "w")
4677 * if fp == NULL: # <<<<<<<<<<<<<<
4678 * raise IOError( "could not open '%s' for writing" )
4681 __pyx_t_6 = (__pyx_v_fp == NULL);
4685 * fp = bgzf_open( filename_out, "w")
4687 * raise IOError( "could not open '%s' for writing" ) # <<<<<<<<<<<<<<
4689 * fd_src = open(filename_in, O_RDONLY)
4691 __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4692 __Pyx_GOTREF(__pyx_t_4);
4693 __Pyx_Raise(__pyx_t_4, 0, 0);
4694 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4695 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4701 * raise IOError( "could not open '%s' for writing" )
4703 * fd_src = open(filename_in, O_RDONLY) # <<<<<<<<<<<<<<
4705 * raise IOError( "could not open '%s' for reading" )
4707 __pyx_t_8 = PyBytes_AsString(__pyx_v_filename_in); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4708 __pyx_v_fd_src = open(__pyx_t_8, __pyx_v_O_RDONLY);
4712 * fd_src = open(filename_in, O_RDONLY)
4713 * if fd_src == 0: # <<<<<<<<<<<<<<
4714 * raise IOError( "could not open '%s' for reading" )
4717 __pyx_t_6 = (__pyx_v_fd_src == 0);
4721 * fd_src = open(filename_in, O_RDONLY)
4723 * raise IOError( "could not open '%s' for reading" ) # <<<<<<<<<<<<<<
4725 * buffer = malloc(WINDOW_SIZE)
4727 __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4728 __Pyx_GOTREF(__pyx_t_4);
4729 __Pyx_Raise(__pyx_t_4, 0, 0);
4730 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4731 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4737 * raise IOError( "could not open '%s' for reading" )
4739 * buffer = malloc(WINDOW_SIZE) # <<<<<<<<<<<<<<
4743 __pyx_v_buffer = malloc(__pyx_v_WINDOW_SIZE);
4746 * buffer = malloc(WINDOW_SIZE)
4748 * while c > 0: # <<<<<<<<<<<<<<
4749 * c = read(fd_src, buffer, WINDOW_SIZE)
4750 * r = bgzf_write(fp, buffer, c)
4753 __pyx_t_6 = (__pyx_v_c > 0);
4754 if (!__pyx_t_6) break;
4759 * c = read(fd_src, buffer, WINDOW_SIZE) # <<<<<<<<<<<<<<
4760 * r = bgzf_write(fp, buffer, c)
4763 __pyx_v_c = read(__pyx_v_fd_src, __pyx_v_buffer, __pyx_v_WINDOW_SIZE);
4767 * c = read(fd_src, buffer, WINDOW_SIZE)
4768 * r = bgzf_write(fp, buffer, c) # <<<<<<<<<<<<<<
4772 __pyx_v_r = bgzf_write(__pyx_v_fp, __pyx_v_buffer, __pyx_v_c);
4775 * c = read(fd_src, buffer, WINDOW_SIZE)
4776 * r = bgzf_write(fp, buffer, c)
4777 * if r < 0: # <<<<<<<<<<<<<<
4779 * raise OSError("writing failed")
4781 __pyx_t_6 = (__pyx_v_r < 0);
4785 * r = bgzf_write(fp, buffer, c)
4787 * free( buffer ) # <<<<<<<<<<<<<<
4788 * raise OSError("writing failed")
4791 free(__pyx_v_buffer);
4796 * raise OSError("writing failed") # <<<<<<<<<<<<<<
4800 __pyx_t_4 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4801 __Pyx_GOTREF(__pyx_t_4);
4802 __Pyx_Raise(__pyx_t_4, 0, 0);
4803 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4804 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4811 * raise OSError("writing failed")
4813 * free( buffer ) # <<<<<<<<<<<<<<
4814 * r = bgzf_close(fp)
4815 * if r < 0: raise OSError("writing failed")
4817 free(__pyx_v_buffer);
4822 * r = bgzf_close(fp) # <<<<<<<<<<<<<<
4823 * if r < 0: raise OSError("writing failed")
4826 __pyx_v_r = bgzf_close(__pyx_v_fp);
4830 * r = bgzf_close(fp)
4831 * if r < 0: raise OSError("writing failed") # <<<<<<<<<<<<<<
4833 * def tabix_index( filename,
4835 __pyx_t_6 = (__pyx_v_r < 0);
4837 __pyx_t_4 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4838 __Pyx_GOTREF(__pyx_t_4);
4839 __Pyx_Raise(__pyx_t_4, 0, 0);
4840 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4841 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4846 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4849 __Pyx_XDECREF(__pyx_t_3);
4850 __Pyx_XDECREF(__pyx_t_4);
4851 __Pyx_XDECREF(__pyx_t_5);
4852 __Pyx_AddTraceback("ctabix.tabix_compress");
4855 __Pyx_XGIVEREF(__pyx_r);
4856 __Pyx_RefNannyFinishContext();
4861 * if r < 0: raise OSError("writing failed")
4863 * def tabix_index( filename, # <<<<<<<<<<<<<<
4868 static PyObject *__pyx_pf_6ctabix_1tabix_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4869 static char __pyx_doc_6ctabix_1tabix_index[] = "tabix_index(filename, force=False, seq_col=None, start_col=None, end_col=None, preset=None, meta_char='#', zerobased=False)\n\n index tab-separated *filename* using tabix.\n\n An existing index will not be overwritten unless\n *force* is set.\n\n The index will be built from coordinates\n in columns *seq_col*, *start_col* and *end_col*.\n\n The contents of *filename* have to be sorted by \n contig and position - the method does not check\n if the file is sorted.\n\n Column indices are 0-based. Coordinates in the file\n are assumed to be 1-based.\n\n If *preset* is provided, the column coordinates\n are taken from a preset. Valid values for preset\n are \"gff\", \"bed\", \"sam\", \"vcf\", psltbl\", \"pileup\".\n \n Lines beginning with *meta_char* and the first\n *line_skip* lines will be skipped.\n \n If *filename* does not end in \".gz\", it will be automatically\n compressed. The original file will be removed and only the \n compressed file will be retained. \n\n If *filename* ends in *gz*, the file is assumed to be already\n compressed with bgzf.\n\n returns the filename of the compressed data\n ";
4870 static PyMethodDef __pyx_mdef_6ctabix_1tabix_index = {__Pyx_NAMESTR("tabix_index"), (PyCFunction)__pyx_pf_6ctabix_1tabix_index, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_1tabix_index)};
4871 static PyObject *__pyx_pf_6ctabix_1tabix_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4872 PyObject *__pyx_v_filename = 0;
4873 PyObject *__pyx_v_force = 0;
4874 PyObject *__pyx_v_seq_col = 0;
4875 PyObject *__pyx_v_start_col = 0;
4876 PyObject *__pyx_v_end_col = 0;
4877 PyObject *__pyx_v_preset = 0;
4878 PyObject *__pyx_v_meta_char = 0;
4879 PyObject *__pyx_v_zerobased = 0;
4880 PyObject *__pyx_v_preset2conf;
4881 PyObject *__pyx_v_conf_data;
4882 ti_conf_t __pyx_v_conf;
4883 PyObject *__pyx_r = NULL;
4884 PyObject *__pyx_t_1 = NULL;
4885 PyObject *__pyx_t_2 = NULL;
4886 PyObject *__pyx_t_3 = NULL;
4889 PyObject *__pyx_t_6 = NULL;
4892 PyObject *__pyx_t_9 = NULL;
4893 PyObject *__pyx_t_10 = NULL;
4900 PyObject *__pyx_t_17 = NULL;
4902 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__force,&__pyx_n_s__seq_col,&__pyx_n_s__start_col,&__pyx_n_s__end_col,&__pyx_n_s__preset,&__pyx_n_s__meta_char,&__pyx_n_s__zerobased,0};
4903 __Pyx_RefNannySetupContext("tabix_index");
4904 __pyx_self = __pyx_self;
4905 if (unlikely(__pyx_kwds)) {
4906 Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
4907 PyObject* values[8] = {0,0,0,0,0,0,0,0};
4908 values[1] = __pyx_k_28;
4911 * def tabix_index( filename,
4913 * seq_col = None, # <<<<<<<<<<<<<<
4917 values[2] = ((PyObject *)Py_None);
4922 * start_col = None, # <<<<<<<<<<<<<<
4926 values[3] = ((PyObject *)Py_None);
4931 * end_col = None, # <<<<<<<<<<<<<<
4935 values[4] = ((PyObject *)Py_None);
4940 * preset = None, # <<<<<<<<<<<<<<
4942 * zerobased = False,
4944 values[5] = ((PyObject *)Py_None);
4945 values[6] = ((PyObject *)__pyx_kp_s_29);
4946 values[7] = __pyx_k_30;
4947 switch (PyTuple_GET_SIZE(__pyx_args)) {
4948 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
4949 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
4950 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4951 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4952 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4953 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4954 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4955 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4957 default: goto __pyx_L5_argtuple_error;
4959 switch (PyTuple_GET_SIZE(__pyx_args)) {
4961 values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
4962 if (likely(values[0])) kw_args--;
4963 else goto __pyx_L5_argtuple_error;
4966 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__force);
4967 if (value) { values[1] = value; kw_args--; }
4971 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seq_col);
4972 if (value) { values[2] = value; kw_args--; }
4976 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start_col);
4977 if (value) { values[3] = value; kw_args--; }
4981 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end_col);
4982 if (value) { values[4] = value; kw_args--; }
4986 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__preset);
4987 if (value) { values[5] = value; kw_args--; }
4991 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__meta_char);
4992 if (value) { values[6] = value; kw_args--; }
4996 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__zerobased);
4997 if (value) { values[7] = value; kw_args--; }
5000 if (unlikely(kw_args > 0)) {
5001 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "tabix_index") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5003 __pyx_v_filename = values[0];
5004 __pyx_v_force = values[1];
5005 __pyx_v_seq_col = values[2];
5006 __pyx_v_start_col = values[3];
5007 __pyx_v_end_col = values[4];
5008 __pyx_v_preset = values[5];
5009 __pyx_v_meta_char = values[6];
5010 __pyx_v_zerobased = values[7];
5012 __pyx_v_force = __pyx_k_28;
5015 * def tabix_index( filename,
5017 * seq_col = None, # <<<<<<<<<<<<<<
5021 __pyx_v_seq_col = ((PyObject *)Py_None);
5026 * start_col = None, # <<<<<<<<<<<<<<
5030 __pyx_v_start_col = ((PyObject *)Py_None);
5035 * end_col = None, # <<<<<<<<<<<<<<
5039 __pyx_v_end_col = ((PyObject *)Py_None);
5044 * preset = None, # <<<<<<<<<<<<<<
5046 * zerobased = False,
5048 __pyx_v_preset = ((PyObject *)Py_None);
5049 __pyx_v_meta_char = ((PyObject *)__pyx_kp_s_29);
5050 __pyx_v_zerobased = __pyx_k_30;
5051 switch (PyTuple_GET_SIZE(__pyx_args)) {
5052 case 8: __pyx_v_zerobased = PyTuple_GET_ITEM(__pyx_args, 7);
5053 case 7: __pyx_v_meta_char = PyTuple_GET_ITEM(__pyx_args, 6);
5054 case 6: __pyx_v_preset = PyTuple_GET_ITEM(__pyx_args, 5);
5055 case 5: __pyx_v_end_col = PyTuple_GET_ITEM(__pyx_args, 4);
5056 case 4: __pyx_v_start_col = PyTuple_GET_ITEM(__pyx_args, 3);
5057 case 3: __pyx_v_seq_col = PyTuple_GET_ITEM(__pyx_args, 2);
5058 case 2: __pyx_v_force = PyTuple_GET_ITEM(__pyx_args, 1);
5059 case 1: __pyx_v_filename = PyTuple_GET_ITEM(__pyx_args, 0);
5061 default: goto __pyx_L5_argtuple_error;
5064 goto __pyx_L4_argument_unpacking_done;
5065 __pyx_L5_argtuple_error:;
5066 __Pyx_RaiseArgtupleInvalid("tabix_index", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5068 __Pyx_AddTraceback("ctabix.tabix_index");
5069 __Pyx_RefNannyFinishContext();
5071 __pyx_L4_argument_unpacking_done:;
5072 __Pyx_INCREF(__pyx_v_filename);
5073 __Pyx_INCREF(__pyx_v_end_col);
5074 __Pyx_INCREF(__pyx_v_preset);
5075 __pyx_v_preset2conf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
5076 __pyx_v_conf_data = Py_None; __Pyx_INCREF(Py_None);
5081 * if not os.path.exists(filename): raise IOError("No such file '%s'" % filename) # <<<<<<<<<<<<<<
5083 * if not filename.endswith(".gz"):
5085 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5086 __Pyx_GOTREF(__pyx_t_1);
5087 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5088 __Pyx_GOTREF(__pyx_t_2);
5089 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5090 __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5091 __Pyx_GOTREF(__pyx_t_1);
5092 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5093 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5094 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
5095 __Pyx_INCREF(__pyx_v_filename);
5096 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_filename);
5097 __Pyx_GIVEREF(__pyx_v_filename);
5098 __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 = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5099 __Pyx_GOTREF(__pyx_t_3);
5100 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5101 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
5102 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5103 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5104 __pyx_t_5 = (!__pyx_t_4);
5106 __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), __pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5107 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
5108 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5109 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
5110 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
5111 __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
5113 __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 = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5114 __Pyx_GOTREF(__pyx_t_3);
5115 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
5116 __Pyx_Raise(__pyx_t_3, 0, 0);
5117 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5118 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5124 * if not os.path.exists(filename): raise IOError("No such file '%s'" % filename)
5126 * if not filename.endswith(".gz"): # <<<<<<<<<<<<<<
5128 * tabix_compress( filename, filename + ".gz", force = force )
5130 __pyx_t_3 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__endswith); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5131 __Pyx_GOTREF(__pyx_t_3);
5132 __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5133 __Pyx_GOTREF(__pyx_t_2);
5134 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5135 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5136 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5137 __pyx_t_4 = (!__pyx_t_5);
5141 * if not filename.endswith(".gz"):
5143 * tabix_compress( filename, filename + ".gz", force = force ) # <<<<<<<<<<<<<<
5144 * os.unlink( filename )
5147 __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__tabix_compress); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5148 __Pyx_GOTREF(__pyx_t_2);
5149 __pyx_t_3 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_32)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5150 __Pyx_GOTREF(__pyx_t_3);
5151 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5152 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
5153 __Pyx_INCREF(__pyx_v_filename);
5154 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
5155 __Pyx_GIVEREF(__pyx_v_filename);
5156 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
5157 __Pyx_GIVEREF(__pyx_t_3);
5159 __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5160 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
5161 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__force), __pyx_v_force) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5162 __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5163 __Pyx_GOTREF(__pyx_t_6);
5164 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5165 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
5166 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
5167 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5171 * tabix_compress( filename, filename + ".gz", force = force )
5172 * os.unlink( filename ) # <<<<<<<<<<<<<<
5176 __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5177 __Pyx_GOTREF(__pyx_t_6);
5178 __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__unlink); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5179 __Pyx_GOTREF(__pyx_t_3);
5180 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5181 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5182 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
5183 __Pyx_INCREF(__pyx_v_filename);
5184 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_filename);
5185 __Pyx_GIVEREF(__pyx_v_filename);
5186 __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5187 __Pyx_GOTREF(__pyx_t_1);
5188 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5189 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
5190 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5193 * tabix_compress( filename, filename + ".gz", force = force )
5194 * os.unlink( filename )
5195 * filename += ".gz" # <<<<<<<<<<<<<<
5197 * if not force and os.path.exists(filename + ".tbi" ):
5199 __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_filename, ((PyObject *)__pyx_kp_s_32)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5200 __Pyx_GOTREF(__pyx_t_1);
5201 __Pyx_DECREF(__pyx_v_filename);
5202 __pyx_v_filename = __pyx_t_1;
5211 * if not force and os.path.exists(filename + ".tbi" ): # <<<<<<<<<<<<<<
5212 * raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" )
5215 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_force); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5216 __pyx_t_5 = (!__pyx_t_4);
5218 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5219 __Pyx_GOTREF(__pyx_t_1);
5220 __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5221 __Pyx_GOTREF(__pyx_t_6);
5222 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5223 __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5224 __Pyx_GOTREF(__pyx_t_1);
5225 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5226 __pyx_t_6 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5227 __Pyx_GOTREF(__pyx_t_6);
5228 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5229 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
5230 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
5231 __Pyx_GIVEREF(__pyx_t_6);
5233 __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5234 __Pyx_GOTREF(__pyx_t_6);
5235 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5236 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
5237 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5238 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5239 __pyx_t_7 = __pyx_t_4;
5241 __pyx_t_7 = __pyx_t_5;
5247 * if not force and os.path.exists(filename + ".tbi" ):
5248 * raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" ) # <<<<<<<<<<<<<<
5250 * # columns (1-based)
5252 __pyx_t_6 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5253 __Pyx_GOTREF(__pyx_t_6);
5254 __Pyx_Raise(__pyx_t_6, 0, 0);
5255 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5256 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5262 * # preset-code, contig, start, end, metachar for commends, lines to ignore at beginning
5263 * # 0 is a missing column
5264 * preset2conf = { # <<<<<<<<<<<<<<
5265 * 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),
5266 * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
5268 __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5269 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
5272 * # 0 is a missing column
5274 * 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ), # <<<<<<<<<<<<<<
5275 * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
5276 * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
5278 __pyx_t_3 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5279 __Pyx_GOTREF(__pyx_t_3);
5280 __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5281 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
5282 __Pyx_INCREF(__pyx_int_0);
5283 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
5284 __Pyx_GIVEREF(__pyx_int_0);
5285 __Pyx_INCREF(__pyx_int_1);
5286 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_1);
5287 __Pyx_GIVEREF(__pyx_int_1);
5288 __Pyx_INCREF(__pyx_int_4);
5289 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_4);
5290 __Pyx_GIVEREF(__pyx_int_4);
5291 __Pyx_INCREF(__pyx_int_5);
5292 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_int_5);
5293 __Pyx_GIVEREF(__pyx_int_5);
5294 PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_3);
5295 __Pyx_GIVEREF(__pyx_t_3);
5296 __Pyx_INCREF(__pyx_int_0);
5297 PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_int_0);
5298 __Pyx_GIVEREF(__pyx_int_0);
5300 if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__gff), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5301 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
5305 * 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),
5306 * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ), # <<<<<<<<<<<<<<
5307 * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
5308 * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
5310 __pyx_t_1 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5311 __Pyx_GOTREF(__pyx_t_1);
5312 __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5313 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
5314 __Pyx_INCREF(__pyx_int_65536);
5315 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_65536);
5316 __Pyx_GIVEREF(__pyx_int_65536);
5317 __Pyx_INCREF(__pyx_int_1);
5318 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1);
5319 __Pyx_GIVEREF(__pyx_int_1);
5320 __Pyx_INCREF(__pyx_int_2);
5321 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_2);
5322 __Pyx_GIVEREF(__pyx_int_2);
5323 __Pyx_INCREF(__pyx_int_3);
5324 PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_int_3);
5325 __Pyx_GIVEREF(__pyx_int_3);
5326 PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_1);
5327 __Pyx_GIVEREF(__pyx_t_1);
5328 __Pyx_INCREF(__pyx_int_0);
5329 PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0);
5330 __Pyx_GIVEREF(__pyx_int_0);
5332 if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__bed), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5333 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
5336 * 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),
5337 * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
5338 * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ), # <<<<<<<<<<<<<<
5339 * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
5340 * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
5342 __pyx_t_3 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5343 __Pyx_GOTREF(__pyx_t_3);
5344 __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5345 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
5346 __Pyx_INCREF(__pyx_int_65536);
5347 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_65536);
5348 __Pyx_GIVEREF(__pyx_int_65536);
5349 __Pyx_INCREF(__pyx_int_15);
5350 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_15);
5351 __Pyx_GIVEREF(__pyx_int_15);
5352 __Pyx_INCREF(__pyx_int_17);
5353 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_17);
5354 __Pyx_GIVEREF(__pyx_int_17);
5355 __Pyx_INCREF(__pyx_int_18);
5356 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_int_18);
5357 __Pyx_GIVEREF(__pyx_int_18);
5358 PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_3);
5359 __Pyx_GIVEREF(__pyx_t_3);
5360 __Pyx_INCREF(__pyx_int_0);
5361 PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_int_0);
5362 __Pyx_GIVEREF(__pyx_int_0);
5364 if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__psltbl), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5365 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
5368 * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
5369 * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
5370 * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ), # <<<<<<<<<<<<<<
5371 * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
5372 * 'pileup': (3, 1, 2, 0, ord('#'), 0 ),
5374 __pyx_t_1 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_k_tuple_39), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5375 __Pyx_GOTREF(__pyx_t_1);
5376 __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5377 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
5378 __Pyx_INCREF(__pyx_int_1);
5379 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_1);
5380 __Pyx_GIVEREF(__pyx_int_1);
5381 __Pyx_INCREF(__pyx_int_3);
5382 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_3);
5383 __Pyx_GIVEREF(__pyx_int_3);
5384 __Pyx_INCREF(__pyx_int_4);
5385 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_4);
5386 __Pyx_GIVEREF(__pyx_int_4);
5387 __Pyx_INCREF(__pyx_int_0);
5388 PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_int_0);
5389 __Pyx_GIVEREF(__pyx_int_0);
5390 PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_1);
5391 __Pyx_GIVEREF(__pyx_t_1);
5392 __Pyx_INCREF(__pyx_int_0);
5393 PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0);
5394 __Pyx_GIVEREF(__pyx_int_0);
5396 if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__sam), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5397 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
5400 * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
5401 * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
5402 * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ), # <<<<<<<<<<<<<<
5403 * 'pileup': (3, 1, 2, 0, ord('#'), 0 ),
5406 __pyx_t_3 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5407 __Pyx_GOTREF(__pyx_t_3);
5408 __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5409 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
5410 __Pyx_INCREF(__pyx_int_2);
5411 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_2);
5412 __Pyx_GIVEREF(__pyx_int_2);
5413 __Pyx_INCREF(__pyx_int_1);
5414 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_1);
5415 __Pyx_GIVEREF(__pyx_int_1);
5416 __Pyx_INCREF(__pyx_int_2);
5417 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_2);
5418 __Pyx_GIVEREF(__pyx_int_2);
5419 __Pyx_INCREF(__pyx_int_0);
5420 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_int_0);
5421 __Pyx_GIVEREF(__pyx_int_0);
5422 PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_3);
5423 __Pyx_GIVEREF(__pyx_t_3);
5424 __Pyx_INCREF(__pyx_int_0);
5425 PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_int_0);
5426 __Pyx_GIVEREF(__pyx_int_0);
5428 if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__vcf), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5429 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
5432 * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
5433 * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
5434 * 'pileup': (3, 1, 2, 0, ord('#'), 0 ), # <<<<<<<<<<<<<<
5438 __pyx_t_1 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5439 __Pyx_GOTREF(__pyx_t_1);
5440 __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5441 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
5442 __Pyx_INCREF(__pyx_int_3);
5443 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_3);
5444 __Pyx_GIVEREF(__pyx_int_3);
5445 __Pyx_INCREF(__pyx_int_1);
5446 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1);
5447 __Pyx_GIVEREF(__pyx_int_1);
5448 __Pyx_INCREF(__pyx_int_2);
5449 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_2);
5450 __Pyx_GIVEREF(__pyx_int_2);
5451 __Pyx_INCREF(__pyx_int_0);
5452 PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_int_0);
5453 __Pyx_GIVEREF(__pyx_int_0);
5454 PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_1);
5455 __Pyx_GIVEREF(__pyx_t_1);
5456 __Pyx_INCREF(__pyx_int_0);
5457 PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0);
5458 __Pyx_GIVEREF(__pyx_int_0);
5460 if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__pileup), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5461 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
5462 __Pyx_DECREF(((PyObject *)__pyx_v_preset2conf));
5463 __pyx_v_preset2conf = __pyx_t_6;
5469 * if preset: # <<<<<<<<<<<<<<
5471 * conf_data = preset2conf[preset]
5473 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_preset); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5479 * try: # <<<<<<<<<<<<<<
5480 * conf_data = preset2conf[preset]
5484 PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
5485 __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
5486 __Pyx_XGOTREF(__pyx_save_exc_type);
5487 __Pyx_XGOTREF(__pyx_save_exc_value);
5488 __Pyx_XGOTREF(__pyx_save_exc_tb);
5494 * conf_data = preset2conf[preset] # <<<<<<<<<<<<<<
5496 * raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() )))
5498 __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_preset2conf), __pyx_v_preset); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L10_error;}
5499 __Pyx_GOTREF(__pyx_t_6);
5500 __Pyx_DECREF(__pyx_v_conf_data);
5501 __pyx_v_conf_data = __pyx_t_6;
5504 __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
5505 __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
5506 __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
5507 goto __pyx_L17_try_end;
5509 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5510 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5511 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5512 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5516 * conf_data = preset2conf[preset]
5517 * except KeyError: # <<<<<<<<<<<<<<
5518 * raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() )))
5521 __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
5523 __Pyx_AddTraceback("ctabix.tabix_index");
5524 if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
5525 __Pyx_GOTREF(__pyx_t_6);
5526 __Pyx_GOTREF(__pyx_t_3);
5527 __Pyx_GOTREF(__pyx_t_1);
5530 * conf_data = preset2conf[preset]
5532 * raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() ))) # <<<<<<<<<<<<<<
5534 * if end_col == None: end_col = -1
5536 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_43), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
5537 __Pyx_GOTREF(__pyx_t_2);
5538 if (unlikely(__pyx_v_preset2conf == Py_None)) {
5539 PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'keys'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
5541 __pyx_t_9 = PyDict_Keys(__pyx_v_preset2conf); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
5542 __Pyx_GOTREF(__pyx_t_9);
5543 __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
5544 __Pyx_GOTREF(((PyObject *)__pyx_t_10));
5545 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
5546 __Pyx_GIVEREF(__pyx_t_9);
5548 __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
5549 __Pyx_GOTREF(__pyx_t_9);
5550 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5551 __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
5552 __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
5553 __Pyx_GOTREF(((PyObject *)__pyx_t_10));
5554 __Pyx_INCREF(__pyx_v_preset);
5555 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_preset);
5556 __Pyx_GIVEREF(__pyx_v_preset);
5557 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
5558 __Pyx_GIVEREF(__pyx_t_9);
5560 __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
5561 __Pyx_GOTREF(((PyObject *)__pyx_t_9));
5562 __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
5563 __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
5564 __Pyx_GOTREF(((PyObject *)__pyx_t_10));
5565 PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_9));
5566 __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
5568 __pyx_t_9 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
5569 __Pyx_GOTREF(__pyx_t_9);
5570 __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
5571 __Pyx_Raise(__pyx_t_9, 0, 0);
5572 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5573 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;}
5574 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5575 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5576 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5577 goto __pyx_L11_exception_handled;
5579 __pyx_L12_except_error:;
5580 __Pyx_XGIVEREF(__pyx_save_exc_type);
5581 __Pyx_XGIVEREF(__pyx_save_exc_value);
5582 __Pyx_XGIVEREF(__pyx_save_exc_tb);
5583 __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
5584 goto __pyx_L1_error;
5585 __pyx_L11_exception_handled:;
5586 __Pyx_XGIVEREF(__pyx_save_exc_type);
5587 __Pyx_XGIVEREF(__pyx_save_exc_value);
5588 __Pyx_XGIVEREF(__pyx_save_exc_tb);
5589 __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
5597 * raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() )))
5599 * if end_col == None: end_col = -1 # <<<<<<<<<<<<<<
5603 __pyx_t_1 = PyObject_RichCompare(__pyx_v_end_col, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5604 __Pyx_GOTREF(__pyx_t_1);
5605 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5606 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5608 __Pyx_INCREF(__pyx_int_neg_1);
5609 __Pyx_DECREF(__pyx_v_end_col);
5610 __pyx_v_end_col = __pyx_int_neg_1;
5617 * if end_col == None: end_col = -1
5618 * preset = 0 # <<<<<<<<<<<<<<
5620 * # note that tabix internally works with 0-based coordinates and open/closed intervals.
5622 __Pyx_INCREF(__pyx_int_0);
5623 __Pyx_DECREF(__pyx_v_preset);
5624 __pyx_v_preset = __pyx_int_0;
5627 * # -1 is subtracted from the start coordinate. To avoid doing this, set
5628 * # the TI_FLAG_UCSC=0x10000 flag:
5629 * if zerobased: preset = preset | 0x10000 # <<<<<<<<<<<<<<
5631 * conf_data = (preset, seq_col+1, start_col+1, end_col+1, ord(meta_char), 0)
5633 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_zerobased); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5635 __pyx_t_1 = PyNumber_Or(__pyx_v_preset, __pyx_int_65536); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5636 __Pyx_GOTREF(__pyx_t_1);
5637 __Pyx_DECREF(__pyx_v_preset);
5638 __pyx_v_preset = __pyx_t_1;
5645 * if zerobased: preset = preset | 0x10000
5647 * conf_data = (preset, seq_col+1, start_col+1, end_col+1, ord(meta_char), 0) # <<<<<<<<<<<<<<
5649 * cdef ti_conf_t conf
5651 __pyx_t_1 = PyNumber_Add(__pyx_v_seq_col, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5652 __Pyx_GOTREF(__pyx_t_1);
5653 __pyx_t_3 = PyNumber_Add(__pyx_v_start_col, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5654 __Pyx_GOTREF(__pyx_t_3);
5655 __pyx_t_6 = PyNumber_Add(__pyx_v_end_col, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5656 __Pyx_GOTREF(__pyx_t_6);
5657 __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5658 __Pyx_GOTREF(((PyObject *)__pyx_t_9));
5659 __Pyx_INCREF(__pyx_v_meta_char);
5660 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_meta_char);
5661 __Pyx_GIVEREF(__pyx_v_meta_char);
5662 __pyx_t_10 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5663 __Pyx_GOTREF(__pyx_t_10);
5664 __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
5665 __pyx_t_9 = PyTuple_New(6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5666 __Pyx_GOTREF(((PyObject *)__pyx_t_9));
5667 __Pyx_INCREF(__pyx_v_preset);
5668 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_preset);
5669 __Pyx_GIVEREF(__pyx_v_preset);
5670 PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
5671 __Pyx_GIVEREF(__pyx_t_1);
5672 PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_3);
5673 __Pyx_GIVEREF(__pyx_t_3);
5674 PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_6);
5675 __Pyx_GIVEREF(__pyx_t_6);
5676 PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_t_10);
5677 __Pyx_GIVEREF(__pyx_t_10);
5678 __Pyx_INCREF(__pyx_int_0);
5679 PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_int_0);
5680 __Pyx_GIVEREF(__pyx_int_0);
5685 __Pyx_DECREF(__pyx_v_conf_data);
5686 __pyx_v_conf_data = ((PyObject *)__pyx_t_9);
5693 * cdef ti_conf_t conf
5694 * conf.preset, conf.sc, conf.bc, conf.ec, conf.meta_char, conf.line_skip = conf_data # <<<<<<<<<<<<<<
5696 * ti_index_build( filename, &conf)
5698 if (PyTuple_CheckExact(__pyx_v_conf_data) && likely(PyTuple_GET_SIZE(__pyx_v_conf_data) == 6)) {
5699 PyObject* tuple = __pyx_v_conf_data;
5700 __pyx_t_9 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_9);
5701 __pyx_t_11 = __Pyx_PyInt_from_py_int32_t(__pyx_t_9); if (unlikely((__pyx_t_11 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5702 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5703 __pyx_t_10 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_10);
5704 __pyx_t_12 = __Pyx_PyInt_from_py_int32_t(__pyx_t_10); if (unlikely((__pyx_t_12 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5705 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5706 __pyx_t_6 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_6);
5707 __pyx_t_13 = __Pyx_PyInt_from_py_int32_t(__pyx_t_6); if (unlikely((__pyx_t_13 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5708 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5709 __pyx_t_3 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_3);
5710 __pyx_t_14 = __Pyx_PyInt_from_py_int32_t(__pyx_t_3); if (unlikely((__pyx_t_14 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5711 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5712 __pyx_t_1 = PyTuple_GET_ITEM(tuple, 4); __Pyx_INCREF(__pyx_t_1);
5713 __pyx_t_15 = __Pyx_PyInt_from_py_int32_t(__pyx_t_1); if (unlikely((__pyx_t_15 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5714 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5715 __pyx_t_2 = PyTuple_GET_ITEM(tuple, 5); __Pyx_INCREF(__pyx_t_2);
5716 __pyx_t_16 = __Pyx_PyInt_from_py_int32_t(__pyx_t_2); if (unlikely((__pyx_t_16 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5717 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5718 __pyx_v_conf.preset = __pyx_t_11;
5719 __pyx_v_conf.sc = __pyx_t_12;
5720 __pyx_v_conf.bc = __pyx_t_13;
5721 __pyx_v_conf.ec = __pyx_t_14;
5722 __pyx_v_conf.meta_char = __pyx_t_15;
5723 __pyx_v_conf.line_skip = __pyx_t_16;
5725 __pyx_t_17 = PyObject_GetIter(__pyx_v_conf_data); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5726 __Pyx_GOTREF(__pyx_t_17);
5727 __pyx_t_9 = __Pyx_UnpackItem(__pyx_t_17, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5728 __Pyx_GOTREF(__pyx_t_9);
5729 __pyx_t_16 = __Pyx_PyInt_from_py_int32_t(__pyx_t_9); if (unlikely((__pyx_t_16 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5730 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5731 __pyx_t_10 = __Pyx_UnpackItem(__pyx_t_17, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5732 __Pyx_GOTREF(__pyx_t_10);
5733 __pyx_t_15 = __Pyx_PyInt_from_py_int32_t(__pyx_t_10); if (unlikely((__pyx_t_15 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5734 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5735 __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_17, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5736 __Pyx_GOTREF(__pyx_t_6);
5737 __pyx_t_14 = __Pyx_PyInt_from_py_int32_t(__pyx_t_6); if (unlikely((__pyx_t_14 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5738 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5739 __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_17, 3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5740 __Pyx_GOTREF(__pyx_t_3);
5741 __pyx_t_13 = __Pyx_PyInt_from_py_int32_t(__pyx_t_3); if (unlikely((__pyx_t_13 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5742 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5743 __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_17, 4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5744 __Pyx_GOTREF(__pyx_t_1);
5745 __pyx_t_12 = __Pyx_PyInt_from_py_int32_t(__pyx_t_1); if (unlikely((__pyx_t_12 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5746 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5747 __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_17, 5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5748 __Pyx_GOTREF(__pyx_t_2);
5749 __pyx_t_11 = __Pyx_PyInt_from_py_int32_t(__pyx_t_2); if (unlikely((__pyx_t_11 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5750 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5751 if (__Pyx_EndUnpack(__pyx_t_17, 6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5752 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5753 __pyx_v_conf.preset = __pyx_t_16;
5754 __pyx_v_conf.sc = __pyx_t_15;
5755 __pyx_v_conf.bc = __pyx_t_14;
5756 __pyx_v_conf.ec = __pyx_t_13;
5757 __pyx_v_conf.meta_char = __pyx_t_12;
5758 __pyx_v_conf.line_skip = __pyx_t_11;
5762 * conf.preset, conf.sc, conf.bc, conf.ec, conf.meta_char, conf.line_skip = conf_data
5764 * ti_index_build( filename, &conf) # <<<<<<<<<<<<<<
5768 __pyx_t_18 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_18) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5769 ti_index_build(__pyx_t_18, (&__pyx_v_conf));
5772 * ti_index_build( filename, &conf)
5774 * return filename # <<<<<<<<<<<<<<
5776 * __all__ = ["tabix_index",
5778 __Pyx_XDECREF(__pyx_r);
5779 __Pyx_INCREF(__pyx_v_filename);
5780 __pyx_r = __pyx_v_filename;
5783 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5786 __Pyx_XDECREF(__pyx_t_1);
5787 __Pyx_XDECREF(__pyx_t_2);
5788 __Pyx_XDECREF(__pyx_t_3);
5789 __Pyx_XDECREF(__pyx_t_6);
5790 __Pyx_XDECREF(__pyx_t_9);
5791 __Pyx_XDECREF(__pyx_t_10);
5792 __Pyx_XDECREF(__pyx_t_17);
5793 __Pyx_AddTraceback("ctabix.tabix_index");
5796 __Pyx_DECREF(__pyx_v_preset2conf);
5797 __Pyx_DECREF(__pyx_v_conf_data);
5798 __Pyx_DECREF(__pyx_v_filename);
5799 __Pyx_DECREF(__pyx_v_end_col);
5800 __Pyx_DECREF(__pyx_v_preset);
5801 __Pyx_XGIVEREF(__pyx_r);
5802 __Pyx_RefNannyFinishContext();
5806 static PyObject *__pyx_tp_new_6ctabix_Tabixfile(PyTypeObject *t, PyObject *a, PyObject *k) {
5807 PyObject *o = (*t->tp_alloc)(t, 0);
5809 if (__pyx_pf_6ctabix_9Tabixfile___cinit__(o, a, k) < 0) {
5810 Py_DECREF(o); o = 0;
5815 static void __pyx_tp_dealloc_6ctabix_Tabixfile(PyObject *o) {
5817 PyObject *etype, *eval, *etb;
5818 PyErr_Fetch(&etype, &eval, &etb);
5820 __pyx_pf_6ctabix_9Tabixfile_6__dealloc__(o);
5821 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
5823 PyErr_Restore(etype, eval, etb);
5825 (*Py_TYPE(o)->tp_free)(o);
5828 static PyObject *__pyx_getprop_6ctabix_9Tabixfile_filename(PyObject *o, void *x) {
5829 return __pyx_pf_6ctabix_9Tabixfile_8filename___get__(o);
5832 static PyObject *__pyx_getprop_6ctabix_9Tabixfile_header(PyObject *o, void *x) {
5833 return __pyx_pf_6ctabix_9Tabixfile_6header___get__(o);
5836 static PyObject *__pyx_getprop_6ctabix_9Tabixfile_contigs(PyObject *o, void *x) {
5837 return __pyx_pf_6ctabix_9Tabixfile_7contigs___get__(o);
5840 static PyMethodDef __pyx_methods_6ctabix_Tabixfile[] = {
5841 {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile_1_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_1_isOpen)},
5842 {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile_2_open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_2_open)},
5843 {__Pyx_NAMESTR("_parseRegion"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile_3_parseRegion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_3_parseRegion)},
5844 {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile_4fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_4fetch)},
5845 {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile_5close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_5close)},
5849 static struct PyGetSetDef __pyx_getsets_6ctabix_Tabixfile[] = {
5850 {(char *)"filename", __pyx_getprop_6ctabix_9Tabixfile_filename, 0, __Pyx_DOCSTR(__pyx_k_44), 0},
5851 {(char *)"header", __pyx_getprop_6ctabix_9Tabixfile_header, 0, __Pyx_DOCSTR(__pyx_k_45), 0},
5852 {(char *)"contigs", __pyx_getprop_6ctabix_9Tabixfile_contigs, 0, __Pyx_DOCSTR(__pyx_k_46), 0},
5856 static PyNumberMethods __pyx_tp_as_number_Tabixfile = {
5860 #if PY_MAJOR_VERSION < 3
5876 #if PY_MAJOR_VERSION < 3
5880 #if PY_MAJOR_VERSION < 3
5886 #if PY_MAJOR_VERSION < 3
5889 #if PY_MAJOR_VERSION < 3
5892 0, /*nb_inplace_add*/
5893 0, /*nb_inplace_subtract*/
5894 0, /*nb_inplace_multiply*/
5895 #if PY_MAJOR_VERSION < 3
5896 0, /*nb_inplace_divide*/
5898 0, /*nb_inplace_remainder*/
5899 0, /*nb_inplace_power*/
5900 0, /*nb_inplace_lshift*/
5901 0, /*nb_inplace_rshift*/
5902 0, /*nb_inplace_and*/
5903 0, /*nb_inplace_xor*/
5904 0, /*nb_inplace_or*/
5905 0, /*nb_floor_divide*/
5906 0, /*nb_true_divide*/
5907 0, /*nb_inplace_floor_divide*/
5908 0, /*nb_inplace_true_divide*/
5909 #if PY_VERSION_HEX >= 0x02050000
5914 static PySequenceMethods __pyx_tp_as_sequence_Tabixfile = {
5923 0, /*sq_inplace_concat*/
5924 0, /*sq_inplace_repeat*/
5927 static PyMappingMethods __pyx_tp_as_mapping_Tabixfile = {
5930 0, /*mp_ass_subscript*/
5933 static PyBufferProcs __pyx_tp_as_buffer_Tabixfile = {
5934 #if PY_MAJOR_VERSION < 3
5935 0, /*bf_getreadbuffer*/
5937 #if PY_MAJOR_VERSION < 3
5938 0, /*bf_getwritebuffer*/
5940 #if PY_MAJOR_VERSION < 3
5941 0, /*bf_getsegcount*/
5943 #if PY_MAJOR_VERSION < 3
5944 0, /*bf_getcharbuffer*/
5946 #if PY_VERSION_HEX >= 0x02060000
5949 #if PY_VERSION_HEX >= 0x02060000
5950 0, /*bf_releasebuffer*/
5954 static PyTypeObject __pyx_type_6ctabix_Tabixfile = {
5955 PyVarObject_HEAD_INIT(0, 0)
5956 __Pyx_NAMESTR("ctabix.Tabixfile"), /*tp_name*/
5957 sizeof(struct __pyx_obj_6ctabix_Tabixfile), /*tp_basicsize*/
5959 __pyx_tp_dealloc_6ctabix_Tabixfile, /*tp_dealloc*/
5963 #if PY_MAJOR_VERSION < 3
5969 &__pyx_tp_as_number_Tabixfile, /*tp_as_number*/
5970 &__pyx_tp_as_sequence_Tabixfile, /*tp_as_sequence*/
5971 &__pyx_tp_as_mapping_Tabixfile, /*tp_as_mapping*/
5977 &__pyx_tp_as_buffer_Tabixfile, /*tp_as_buffer*/
5978 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
5979 __Pyx_DOCSTR("*(filename, mode='r')*\n\n opens a :term:`tabix file` for reading. A missing\n index (*filename* + \".tbi\") will raise an exception.\n "), /*tp_doc*/
5982 0, /*tp_richcompare*/
5983 0, /*tp_weaklistoffset*/
5986 __pyx_methods_6ctabix_Tabixfile, /*tp_methods*/
5988 __pyx_getsets_6ctabix_Tabixfile, /*tp_getset*/
5993 0, /*tp_dictoffset*/
5996 __pyx_tp_new_6ctabix_Tabixfile, /*tp_new*/
6002 0, /*tp_subclasses*/
6005 #if PY_VERSION_HEX >= 0x02060000
6006 0, /*tp_version_tag*/
6010 static PyObject *__pyx_tp_new_6ctabix_Parser(PyTypeObject *t, PyObject *a, PyObject *k) {
6011 PyObject *o = (*t->tp_alloc)(t, 0);
6016 static void __pyx_tp_dealloc_6ctabix_Parser(PyObject *o) {
6017 (*Py_TYPE(o)->tp_free)(o);
6020 static PyMethodDef __pyx_methods_6ctabix_Parser[] = {
6024 static PyNumberMethods __pyx_tp_as_number_Parser = {
6028 #if PY_MAJOR_VERSION < 3
6044 #if PY_MAJOR_VERSION < 3
6048 #if PY_MAJOR_VERSION < 3
6054 #if PY_MAJOR_VERSION < 3
6057 #if PY_MAJOR_VERSION < 3
6060 0, /*nb_inplace_add*/
6061 0, /*nb_inplace_subtract*/
6062 0, /*nb_inplace_multiply*/
6063 #if PY_MAJOR_VERSION < 3
6064 0, /*nb_inplace_divide*/
6066 0, /*nb_inplace_remainder*/
6067 0, /*nb_inplace_power*/
6068 0, /*nb_inplace_lshift*/
6069 0, /*nb_inplace_rshift*/
6070 0, /*nb_inplace_and*/
6071 0, /*nb_inplace_xor*/
6072 0, /*nb_inplace_or*/
6073 0, /*nb_floor_divide*/
6074 0, /*nb_true_divide*/
6075 0, /*nb_inplace_floor_divide*/
6076 0, /*nb_inplace_true_divide*/
6077 #if PY_VERSION_HEX >= 0x02050000
6082 static PySequenceMethods __pyx_tp_as_sequence_Parser = {
6091 0, /*sq_inplace_concat*/
6092 0, /*sq_inplace_repeat*/
6095 static PyMappingMethods __pyx_tp_as_mapping_Parser = {
6098 0, /*mp_ass_subscript*/
6101 static PyBufferProcs __pyx_tp_as_buffer_Parser = {
6102 #if PY_MAJOR_VERSION < 3
6103 0, /*bf_getreadbuffer*/
6105 #if PY_MAJOR_VERSION < 3
6106 0, /*bf_getwritebuffer*/
6108 #if PY_MAJOR_VERSION < 3
6109 0, /*bf_getsegcount*/
6111 #if PY_MAJOR_VERSION < 3
6112 0, /*bf_getcharbuffer*/
6114 #if PY_VERSION_HEX >= 0x02060000
6117 #if PY_VERSION_HEX >= 0x02060000
6118 0, /*bf_releasebuffer*/
6122 static PyTypeObject __pyx_type_6ctabix_Parser = {
6123 PyVarObject_HEAD_INIT(0, 0)
6124 __Pyx_NAMESTR("ctabix.Parser"), /*tp_name*/
6125 sizeof(struct __pyx_obj_6ctabix_Parser), /*tp_basicsize*/
6127 __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/
6131 #if PY_MAJOR_VERSION < 3
6137 &__pyx_tp_as_number_Parser, /*tp_as_number*/
6138 &__pyx_tp_as_sequence_Parser, /*tp_as_sequence*/
6139 &__pyx_tp_as_mapping_Parser, /*tp_as_mapping*/
6145 &__pyx_tp_as_buffer_Parser, /*tp_as_buffer*/
6146 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
6150 0, /*tp_richcompare*/
6151 0, /*tp_weaklistoffset*/
6154 __pyx_methods_6ctabix_Parser, /*tp_methods*/
6161 0, /*tp_dictoffset*/
6164 __pyx_tp_new_6ctabix_Parser, /*tp_new*/
6170 0, /*tp_subclasses*/
6173 #if PY_VERSION_HEX >= 0x02060000
6174 0, /*tp_version_tag*/
6178 static PyObject *__pyx_tp_new_6ctabix_TabixIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
6179 PyObject *o = (*t->tp_alloc)(t, 0);
6181 if (__pyx_pf_6ctabix_13TabixIterator___cinit__(o, a, k) < 0) {
6182 Py_DECREF(o); o = 0;
6187 static void __pyx_tp_dealloc_6ctabix_TabixIterator(PyObject *o) {
6189 PyObject *etype, *eval, *etb;
6190 PyErr_Fetch(&etype, &eval, &etb);
6192 __pyx_pf_6ctabix_13TabixIterator_3__dealloc__(o);
6193 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
6195 PyErr_Restore(etype, eval, etb);
6197 (*Py_TYPE(o)->tp_free)(o);
6200 static PyMethodDef __pyx_methods_6ctabix_TabixIterator[] = {
6201 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_6ctabix_13TabixIterator_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_13TabixIterator_2__next__)},
6205 static PyNumberMethods __pyx_tp_as_number_TabixIterator = {
6209 #if PY_MAJOR_VERSION < 3
6225 #if PY_MAJOR_VERSION < 3
6229 #if PY_MAJOR_VERSION < 3
6235 #if PY_MAJOR_VERSION < 3
6238 #if PY_MAJOR_VERSION < 3
6241 0, /*nb_inplace_add*/
6242 0, /*nb_inplace_subtract*/
6243 0, /*nb_inplace_multiply*/
6244 #if PY_MAJOR_VERSION < 3
6245 0, /*nb_inplace_divide*/
6247 0, /*nb_inplace_remainder*/
6248 0, /*nb_inplace_power*/
6249 0, /*nb_inplace_lshift*/
6250 0, /*nb_inplace_rshift*/
6251 0, /*nb_inplace_and*/
6252 0, /*nb_inplace_xor*/
6253 0, /*nb_inplace_or*/
6254 0, /*nb_floor_divide*/
6255 0, /*nb_true_divide*/
6256 0, /*nb_inplace_floor_divide*/
6257 0, /*nb_inplace_true_divide*/
6258 #if PY_VERSION_HEX >= 0x02050000
6263 static PySequenceMethods __pyx_tp_as_sequence_TabixIterator = {
6272 0, /*sq_inplace_concat*/
6273 0, /*sq_inplace_repeat*/
6276 static PyMappingMethods __pyx_tp_as_mapping_TabixIterator = {
6279 0, /*mp_ass_subscript*/
6282 static PyBufferProcs __pyx_tp_as_buffer_TabixIterator = {
6283 #if PY_MAJOR_VERSION < 3
6284 0, /*bf_getreadbuffer*/
6286 #if PY_MAJOR_VERSION < 3
6287 0, /*bf_getwritebuffer*/
6289 #if PY_MAJOR_VERSION < 3
6290 0, /*bf_getsegcount*/
6292 #if PY_MAJOR_VERSION < 3
6293 0, /*bf_getcharbuffer*/
6295 #if PY_VERSION_HEX >= 0x02060000
6298 #if PY_VERSION_HEX >= 0x02060000
6299 0, /*bf_releasebuffer*/
6303 static PyTypeObject __pyx_type_6ctabix_TabixIterator = {
6304 PyVarObject_HEAD_INIT(0, 0)
6305 __Pyx_NAMESTR("ctabix.TabixIterator"), /*tp_name*/
6306 sizeof(struct __pyx_obj_6ctabix_TabixIterator), /*tp_basicsize*/
6308 __pyx_tp_dealloc_6ctabix_TabixIterator, /*tp_dealloc*/
6312 #if PY_MAJOR_VERSION < 3
6318 &__pyx_tp_as_number_TabixIterator, /*tp_as_number*/
6319 &__pyx_tp_as_sequence_TabixIterator, /*tp_as_sequence*/
6320 &__pyx_tp_as_mapping_TabixIterator, /*tp_as_mapping*/
6326 &__pyx_tp_as_buffer_TabixIterator, /*tp_as_buffer*/
6327 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
6328 __Pyx_DOCSTR("iterates over rows in *tabixfile* in region\n given by *tid*, *start* and *end*.\n "), /*tp_doc*/
6331 0, /*tp_richcompare*/
6332 0, /*tp_weaklistoffset*/
6333 __pyx_pf_6ctabix_13TabixIterator_1__iter__, /*tp_iter*/
6334 __pyx_pf_6ctabix_13TabixIterator_2__next__, /*tp_iternext*/
6335 __pyx_methods_6ctabix_TabixIterator, /*tp_methods*/
6342 0, /*tp_dictoffset*/
6345 __pyx_tp_new_6ctabix_TabixIterator, /*tp_new*/
6351 0, /*tp_subclasses*/
6354 #if PY_VERSION_HEX >= 0x02060000
6355 0, /*tp_version_tag*/
6359 static PyObject *__pyx_tp_new_6ctabix_TabixHeaderIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
6360 PyObject *o = (*t->tp_alloc)(t, 0);
6362 if (__pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(o, a, k) < 0) {
6363 Py_DECREF(o); o = 0;
6368 static void __pyx_tp_dealloc_6ctabix_TabixHeaderIterator(PyObject *o) {
6370 PyObject *etype, *eval, *etb;
6371 PyErr_Fetch(&etype, &eval, &etb);
6373 __pyx_pf_6ctabix_19TabixHeaderIterator_3__dealloc__(o);
6374 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
6376 PyErr_Restore(etype, eval, etb);
6378 (*Py_TYPE(o)->tp_free)(o);
6381 static PyMethodDef __pyx_methods_6ctabix_TabixHeaderIterator[] = {
6382 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_6ctabix_19TabixHeaderIterator_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_19TabixHeaderIterator_2__next__)},
6386 static PyNumberMethods __pyx_tp_as_number_TabixHeaderIterator = {
6390 #if PY_MAJOR_VERSION < 3
6406 #if PY_MAJOR_VERSION < 3
6410 #if PY_MAJOR_VERSION < 3
6416 #if PY_MAJOR_VERSION < 3
6419 #if PY_MAJOR_VERSION < 3
6422 0, /*nb_inplace_add*/
6423 0, /*nb_inplace_subtract*/
6424 0, /*nb_inplace_multiply*/
6425 #if PY_MAJOR_VERSION < 3
6426 0, /*nb_inplace_divide*/
6428 0, /*nb_inplace_remainder*/
6429 0, /*nb_inplace_power*/
6430 0, /*nb_inplace_lshift*/
6431 0, /*nb_inplace_rshift*/
6432 0, /*nb_inplace_and*/
6433 0, /*nb_inplace_xor*/
6434 0, /*nb_inplace_or*/
6435 0, /*nb_floor_divide*/
6436 0, /*nb_true_divide*/
6437 0, /*nb_inplace_floor_divide*/
6438 0, /*nb_inplace_true_divide*/
6439 #if PY_VERSION_HEX >= 0x02050000
6444 static PySequenceMethods __pyx_tp_as_sequence_TabixHeaderIterator = {
6453 0, /*sq_inplace_concat*/
6454 0, /*sq_inplace_repeat*/
6457 static PyMappingMethods __pyx_tp_as_mapping_TabixHeaderIterator = {
6460 0, /*mp_ass_subscript*/
6463 static PyBufferProcs __pyx_tp_as_buffer_TabixHeaderIterator = {
6464 #if PY_MAJOR_VERSION < 3
6465 0, /*bf_getreadbuffer*/
6467 #if PY_MAJOR_VERSION < 3
6468 0, /*bf_getwritebuffer*/
6470 #if PY_MAJOR_VERSION < 3
6471 0, /*bf_getsegcount*/
6473 #if PY_MAJOR_VERSION < 3
6474 0, /*bf_getcharbuffer*/
6476 #if PY_VERSION_HEX >= 0x02060000
6479 #if PY_VERSION_HEX >= 0x02060000
6480 0, /*bf_releasebuffer*/
6484 static PyTypeObject __pyx_type_6ctabix_TabixHeaderIterator = {
6485 PyVarObject_HEAD_INIT(0, 0)
6486 __Pyx_NAMESTR("ctabix.TabixHeaderIterator"), /*tp_name*/
6487 sizeof(struct __pyx_obj_6ctabix_TabixHeaderIterator), /*tp_basicsize*/
6489 __pyx_tp_dealloc_6ctabix_TabixHeaderIterator, /*tp_dealloc*/
6493 #if PY_MAJOR_VERSION < 3
6499 &__pyx_tp_as_number_TabixHeaderIterator, /*tp_as_number*/
6500 &__pyx_tp_as_sequence_TabixHeaderIterator, /*tp_as_sequence*/
6501 &__pyx_tp_as_mapping_TabixHeaderIterator, /*tp_as_mapping*/
6507 &__pyx_tp_as_buffer_TabixHeaderIterator, /*tp_as_buffer*/
6508 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
6509 __Pyx_DOCSTR("return header lines.\n "), /*tp_doc*/
6512 0, /*tp_richcompare*/
6513 0, /*tp_weaklistoffset*/
6514 __pyx_pf_6ctabix_19TabixHeaderIterator_1__iter__, /*tp_iter*/
6515 __pyx_pf_6ctabix_19TabixHeaderIterator_2__next__, /*tp_iternext*/
6516 __pyx_methods_6ctabix_TabixHeaderIterator, /*tp_methods*/
6523 0, /*tp_dictoffset*/
6526 __pyx_tp_new_6ctabix_TabixHeaderIterator, /*tp_new*/
6532 0, /*tp_subclasses*/
6535 #if PY_VERSION_HEX >= 0x02060000
6536 0, /*tp_version_tag*/
6540 static PyObject *__pyx_tp_new_6ctabix_asTuple(PyTypeObject *t, PyObject *a, PyObject *k) {
6541 PyObject *o = __pyx_tp_new_6ctabix_Parser(t, a, k);
6546 static PyMethodDef __pyx_methods_6ctabix_asTuple[] = {
6550 static PyNumberMethods __pyx_tp_as_number_asTuple = {
6554 #if PY_MAJOR_VERSION < 3
6570 #if PY_MAJOR_VERSION < 3
6574 #if PY_MAJOR_VERSION < 3
6580 #if PY_MAJOR_VERSION < 3
6583 #if PY_MAJOR_VERSION < 3
6586 0, /*nb_inplace_add*/
6587 0, /*nb_inplace_subtract*/
6588 0, /*nb_inplace_multiply*/
6589 #if PY_MAJOR_VERSION < 3
6590 0, /*nb_inplace_divide*/
6592 0, /*nb_inplace_remainder*/
6593 0, /*nb_inplace_power*/
6594 0, /*nb_inplace_lshift*/
6595 0, /*nb_inplace_rshift*/
6596 0, /*nb_inplace_and*/
6597 0, /*nb_inplace_xor*/
6598 0, /*nb_inplace_or*/
6599 0, /*nb_floor_divide*/
6600 0, /*nb_true_divide*/
6601 0, /*nb_inplace_floor_divide*/
6602 0, /*nb_inplace_true_divide*/
6603 #if PY_VERSION_HEX >= 0x02050000
6608 static PySequenceMethods __pyx_tp_as_sequence_asTuple = {
6617 0, /*sq_inplace_concat*/
6618 0, /*sq_inplace_repeat*/
6621 static PyMappingMethods __pyx_tp_as_mapping_asTuple = {
6624 0, /*mp_ass_subscript*/
6627 static PyBufferProcs __pyx_tp_as_buffer_asTuple = {
6628 #if PY_MAJOR_VERSION < 3
6629 0, /*bf_getreadbuffer*/
6631 #if PY_MAJOR_VERSION < 3
6632 0, /*bf_getwritebuffer*/
6634 #if PY_MAJOR_VERSION < 3
6635 0, /*bf_getsegcount*/
6637 #if PY_MAJOR_VERSION < 3
6638 0, /*bf_getcharbuffer*/
6640 #if PY_VERSION_HEX >= 0x02060000
6643 #if PY_VERSION_HEX >= 0x02060000
6644 0, /*bf_releasebuffer*/
6648 static PyTypeObject __pyx_type_6ctabix_asTuple = {
6649 PyVarObject_HEAD_INIT(0, 0)
6650 __Pyx_NAMESTR("ctabix.asTuple"), /*tp_name*/
6651 sizeof(struct __pyx_obj_6ctabix_asTuple), /*tp_basicsize*/
6653 __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/
6657 #if PY_MAJOR_VERSION < 3
6663 &__pyx_tp_as_number_asTuple, /*tp_as_number*/
6664 &__pyx_tp_as_sequence_asTuple, /*tp_as_sequence*/
6665 &__pyx_tp_as_mapping_asTuple, /*tp_as_mapping*/
6667 __pyx_pf_6ctabix_7asTuple___call__, /*tp_call*/
6671 &__pyx_tp_as_buffer_asTuple, /*tp_as_buffer*/
6672 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
6673 __Pyx_DOCSTR("converts a :term:`tabix row` into a python tuple.\n\n Access is by numeric index.\n "), /*tp_doc*/
6676 0, /*tp_richcompare*/
6677 0, /*tp_weaklistoffset*/
6680 __pyx_methods_6ctabix_asTuple, /*tp_methods*/
6687 0, /*tp_dictoffset*/
6690 __pyx_tp_new_6ctabix_asTuple, /*tp_new*/
6696 0, /*tp_subclasses*/
6699 #if PY_VERSION_HEX >= 0x02060000
6700 0, /*tp_version_tag*/
6704 static PyObject *__pyx_tp_new_6ctabix_asGTF(PyTypeObject *t, PyObject *a, PyObject *k) {
6705 PyObject *o = __pyx_tp_new_6ctabix_Parser(t, a, k);
6710 static PyMethodDef __pyx_methods_6ctabix_asGTF[] = {
6714 static PyNumberMethods __pyx_tp_as_number_asGTF = {
6718 #if PY_MAJOR_VERSION < 3
6734 #if PY_MAJOR_VERSION < 3
6738 #if PY_MAJOR_VERSION < 3
6744 #if PY_MAJOR_VERSION < 3
6747 #if PY_MAJOR_VERSION < 3
6750 0, /*nb_inplace_add*/
6751 0, /*nb_inplace_subtract*/
6752 0, /*nb_inplace_multiply*/
6753 #if PY_MAJOR_VERSION < 3
6754 0, /*nb_inplace_divide*/
6756 0, /*nb_inplace_remainder*/
6757 0, /*nb_inplace_power*/
6758 0, /*nb_inplace_lshift*/
6759 0, /*nb_inplace_rshift*/
6760 0, /*nb_inplace_and*/
6761 0, /*nb_inplace_xor*/
6762 0, /*nb_inplace_or*/
6763 0, /*nb_floor_divide*/
6764 0, /*nb_true_divide*/
6765 0, /*nb_inplace_floor_divide*/
6766 0, /*nb_inplace_true_divide*/
6767 #if PY_VERSION_HEX >= 0x02050000
6772 static PySequenceMethods __pyx_tp_as_sequence_asGTF = {
6781 0, /*sq_inplace_concat*/
6782 0, /*sq_inplace_repeat*/
6785 static PyMappingMethods __pyx_tp_as_mapping_asGTF = {
6788 0, /*mp_ass_subscript*/
6791 static PyBufferProcs __pyx_tp_as_buffer_asGTF = {
6792 #if PY_MAJOR_VERSION < 3
6793 0, /*bf_getreadbuffer*/
6795 #if PY_MAJOR_VERSION < 3
6796 0, /*bf_getwritebuffer*/
6798 #if PY_MAJOR_VERSION < 3
6799 0, /*bf_getsegcount*/
6801 #if PY_MAJOR_VERSION < 3
6802 0, /*bf_getcharbuffer*/
6804 #if PY_VERSION_HEX >= 0x02060000
6807 #if PY_VERSION_HEX >= 0x02060000
6808 0, /*bf_releasebuffer*/
6812 static PyTypeObject __pyx_type_6ctabix_asGTF = {
6813 PyVarObject_HEAD_INIT(0, 0)
6814 __Pyx_NAMESTR("ctabix.asGTF"), /*tp_name*/
6815 sizeof(struct __pyx_obj_6ctabix_asGTF), /*tp_basicsize*/
6817 __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/
6821 #if PY_MAJOR_VERSION < 3
6827 &__pyx_tp_as_number_asGTF, /*tp_as_number*/
6828 &__pyx_tp_as_sequence_asGTF, /*tp_as_sequence*/
6829 &__pyx_tp_as_mapping_asGTF, /*tp_as_mapping*/
6831 __pyx_pf_6ctabix_5asGTF___call__, /*tp_call*/
6835 &__pyx_tp_as_buffer_asGTF, /*tp_as_buffer*/
6836 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
6837 __Pyx_DOCSTR("converts a :term:`tabix row` into a GTF record with the following \n fields:\n\n contig\n contig\n feature\n feature\n source\n source\n start\n genomic start coordinate (0-based)\n end\n genomic end coordinate plus one (0-based)\n score\n feature score\n strand\n strand\n frame\n frame\n attributes\n attribute string.\n\n GTF formatted entries also defined the attributes:\n\n gene_id\n the gene identifier\n transcript_ind\n the transcript identifier\n \n "), /*tp_doc*/
6840 0, /*tp_richcompare*/
6841 0, /*tp_weaklistoffset*/
6844 __pyx_methods_6ctabix_asGTF, /*tp_methods*/
6851 0, /*tp_dictoffset*/
6854 __pyx_tp_new_6ctabix_asGTF, /*tp_new*/
6860 0, /*tp_subclasses*/
6863 #if PY_VERSION_HEX >= 0x02060000
6864 0, /*tp_version_tag*/
6868 static PyObject *__pyx_tp_new_6ctabix_asBed(PyTypeObject *t, PyObject *a, PyObject *k) {
6869 PyObject *o = __pyx_tp_new_6ctabix_Parser(t, a, k);
6874 static PyMethodDef __pyx_methods_6ctabix_asBed[] = {
6878 static PyNumberMethods __pyx_tp_as_number_asBed = {
6882 #if PY_MAJOR_VERSION < 3
6898 #if PY_MAJOR_VERSION < 3
6902 #if PY_MAJOR_VERSION < 3
6908 #if PY_MAJOR_VERSION < 3
6911 #if PY_MAJOR_VERSION < 3
6914 0, /*nb_inplace_add*/
6915 0, /*nb_inplace_subtract*/
6916 0, /*nb_inplace_multiply*/
6917 #if PY_MAJOR_VERSION < 3
6918 0, /*nb_inplace_divide*/
6920 0, /*nb_inplace_remainder*/
6921 0, /*nb_inplace_power*/
6922 0, /*nb_inplace_lshift*/
6923 0, /*nb_inplace_rshift*/
6924 0, /*nb_inplace_and*/
6925 0, /*nb_inplace_xor*/
6926 0, /*nb_inplace_or*/
6927 0, /*nb_floor_divide*/
6928 0, /*nb_true_divide*/
6929 0, /*nb_inplace_floor_divide*/
6930 0, /*nb_inplace_true_divide*/
6931 #if PY_VERSION_HEX >= 0x02050000
6936 static PySequenceMethods __pyx_tp_as_sequence_asBed = {
6945 0, /*sq_inplace_concat*/
6946 0, /*sq_inplace_repeat*/
6949 static PyMappingMethods __pyx_tp_as_mapping_asBed = {
6952 0, /*mp_ass_subscript*/
6955 static PyBufferProcs __pyx_tp_as_buffer_asBed = {
6956 #if PY_MAJOR_VERSION < 3
6957 0, /*bf_getreadbuffer*/
6959 #if PY_MAJOR_VERSION < 3
6960 0, /*bf_getwritebuffer*/
6962 #if PY_MAJOR_VERSION < 3
6963 0, /*bf_getsegcount*/
6965 #if PY_MAJOR_VERSION < 3
6966 0, /*bf_getcharbuffer*/
6968 #if PY_VERSION_HEX >= 0x02060000
6971 #if PY_VERSION_HEX >= 0x02060000
6972 0, /*bf_releasebuffer*/
6976 static PyTypeObject __pyx_type_6ctabix_asBed = {
6977 PyVarObject_HEAD_INIT(0, 0)
6978 __Pyx_NAMESTR("ctabix.asBed"), /*tp_name*/
6979 sizeof(struct __pyx_obj_6ctabix_asBed), /*tp_basicsize*/
6981 __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/
6985 #if PY_MAJOR_VERSION < 3
6991 &__pyx_tp_as_number_asBed, /*tp_as_number*/
6992 &__pyx_tp_as_sequence_asBed, /*tp_as_sequence*/
6993 &__pyx_tp_as_mapping_asBed, /*tp_as_mapping*/
6995 __pyx_pf_6ctabix_5asBed___call__, /*tp_call*/
6999 &__pyx_tp_as_buffer_asBed, /*tp_as_buffer*/
7000 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
7001 __Pyx_DOCSTR("converts a :term:`tabix row` into a bed record\n with the following fields:\n\n contig\n contig\n start\n genomic start coordinate (zero-based)\n end\n genomic end coordinate plus one (zero-based)\n name\n name of feature.\n score\n score of feature\n strand\n strand of feature\n thickStart\n thickStart\n thickEnd\n thickEnd\n itemRGB\n itemRGB\n blockCount\n number of bocks\n blockSizes\n ',' separated string of block sizes\n blockStarts\n ',' separated string of block genomic start positions\n\n Only the first three fields are required. Additional\n fields are optional, but if one is defined, all the preceeding\n need to be defined as well.\n\n "), /*tp_doc*/
7004 0, /*tp_richcompare*/
7005 0, /*tp_weaklistoffset*/
7008 __pyx_methods_6ctabix_asBed, /*tp_methods*/
7015 0, /*tp_dictoffset*/
7018 __pyx_tp_new_6ctabix_asBed, /*tp_new*/
7024 0, /*tp_subclasses*/
7027 #if PY_VERSION_HEX >= 0x02060000
7028 0, /*tp_version_tag*/
7032 static PyObject *__pyx_tp_new_6ctabix_asVCF(PyTypeObject *t, PyObject *a, PyObject *k) {
7033 PyObject *o = __pyx_tp_new_6ctabix_Parser(t, a, k);
7038 static PyMethodDef __pyx_methods_6ctabix_asVCF[] = {
7042 static PyNumberMethods __pyx_tp_as_number_asVCF = {
7046 #if PY_MAJOR_VERSION < 3
7062 #if PY_MAJOR_VERSION < 3
7066 #if PY_MAJOR_VERSION < 3
7072 #if PY_MAJOR_VERSION < 3
7075 #if PY_MAJOR_VERSION < 3
7078 0, /*nb_inplace_add*/
7079 0, /*nb_inplace_subtract*/
7080 0, /*nb_inplace_multiply*/
7081 #if PY_MAJOR_VERSION < 3
7082 0, /*nb_inplace_divide*/
7084 0, /*nb_inplace_remainder*/
7085 0, /*nb_inplace_power*/
7086 0, /*nb_inplace_lshift*/
7087 0, /*nb_inplace_rshift*/
7088 0, /*nb_inplace_and*/
7089 0, /*nb_inplace_xor*/
7090 0, /*nb_inplace_or*/
7091 0, /*nb_floor_divide*/
7092 0, /*nb_true_divide*/
7093 0, /*nb_inplace_floor_divide*/
7094 0, /*nb_inplace_true_divide*/
7095 #if PY_VERSION_HEX >= 0x02050000
7100 static PySequenceMethods __pyx_tp_as_sequence_asVCF = {
7109 0, /*sq_inplace_concat*/
7110 0, /*sq_inplace_repeat*/
7113 static PyMappingMethods __pyx_tp_as_mapping_asVCF = {
7116 0, /*mp_ass_subscript*/
7119 static PyBufferProcs __pyx_tp_as_buffer_asVCF = {
7120 #if PY_MAJOR_VERSION < 3
7121 0, /*bf_getreadbuffer*/
7123 #if PY_MAJOR_VERSION < 3
7124 0, /*bf_getwritebuffer*/
7126 #if PY_MAJOR_VERSION < 3
7127 0, /*bf_getsegcount*/
7129 #if PY_MAJOR_VERSION < 3
7130 0, /*bf_getcharbuffer*/
7132 #if PY_VERSION_HEX >= 0x02060000
7135 #if PY_VERSION_HEX >= 0x02060000
7136 0, /*bf_releasebuffer*/
7140 static PyTypeObject __pyx_type_6ctabix_asVCF = {
7141 PyVarObject_HEAD_INIT(0, 0)
7142 __Pyx_NAMESTR("ctabix.asVCF"), /*tp_name*/
7143 sizeof(struct __pyx_obj_6ctabix_asVCF), /*tp_basicsize*/
7145 __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/
7149 #if PY_MAJOR_VERSION < 3
7155 &__pyx_tp_as_number_asVCF, /*tp_as_number*/
7156 &__pyx_tp_as_sequence_asVCF, /*tp_as_sequence*/
7157 &__pyx_tp_as_mapping_asVCF, /*tp_as_mapping*/
7159 __pyx_pf_6ctabix_5asVCF___call__, /*tp_call*/
7163 &__pyx_tp_as_buffer_asVCF, /*tp_as_buffer*/
7164 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
7165 __Pyx_DOCSTR("converts a :term:`tabix row` into a VCF record with\n the following fields:\n \n contig\n contig\n pos\n chromosomal position, zero-based\n id \n id\n ref\n reference\n alt\n alt\n qual\n qual\n filter\n filter\n info\n info\n format\n format specifier.\n\n Access to genotypes is via index::\n\n contig = vcf.contig\n first_sample_genotype = vcf[0]\n second_sample_genotype = vcf[1]\n\n "), /*tp_doc*/
7168 0, /*tp_richcompare*/
7169 0, /*tp_weaklistoffset*/
7172 __pyx_methods_6ctabix_asVCF, /*tp_methods*/
7179 0, /*tp_dictoffset*/
7182 __pyx_tp_new_6ctabix_asVCF, /*tp_new*/
7188 0, /*tp_subclasses*/
7191 #if PY_VERSION_HEX >= 0x02060000
7192 0, /*tp_version_tag*/
7196 static PyObject *__pyx_tp_new_6ctabix_TabixIteratorParsed(PyTypeObject *t, PyObject *a, PyObject *k) {
7197 struct __pyx_obj_6ctabix_TabixIteratorParsed *p;
7198 PyObject *o = (*t->tp_alloc)(t, 0);
7200 p = ((struct __pyx_obj_6ctabix_TabixIteratorParsed *)o);
7201 p->parser = ((struct __pyx_obj_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
7202 if (__pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(o, a, k) < 0) {
7203 Py_DECREF(o); o = 0;
7208 static void __pyx_tp_dealloc_6ctabix_TabixIteratorParsed(PyObject *o) {
7209 struct __pyx_obj_6ctabix_TabixIteratorParsed *p = (struct __pyx_obj_6ctabix_TabixIteratorParsed *)o;
7211 PyObject *etype, *eval, *etb;
7212 PyErr_Fetch(&etype, &eval, &etb);
7214 __pyx_pf_6ctabix_19TabixIteratorParsed_3__dealloc__(o);
7215 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
7217 PyErr_Restore(etype, eval, etb);
7219 Py_XDECREF(((PyObject *)p->parser));
7220 (*Py_TYPE(o)->tp_free)(o);
7223 static int __pyx_tp_traverse_6ctabix_TabixIteratorParsed(PyObject *o, visitproc v, void *a) {
7225 struct __pyx_obj_6ctabix_TabixIteratorParsed *p = (struct __pyx_obj_6ctabix_TabixIteratorParsed *)o;
7227 e = (*v)(((PyObject*)p->parser), a); if (e) return e;
7232 static int __pyx_tp_clear_6ctabix_TabixIteratorParsed(PyObject *o) {
7233 struct __pyx_obj_6ctabix_TabixIteratorParsed *p = (struct __pyx_obj_6ctabix_TabixIteratorParsed *)o;
7235 tmp = ((PyObject*)p->parser);
7236 p->parser = ((struct __pyx_obj_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
7241 static PyMethodDef __pyx_methods_6ctabix_TabixIteratorParsed[] = {
7242 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_6ctabix_19TabixIteratorParsed_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_19TabixIteratorParsed_2__next__)},
7246 static PyNumberMethods __pyx_tp_as_number_TabixIteratorParsed = {
7250 #if PY_MAJOR_VERSION < 3
7266 #if PY_MAJOR_VERSION < 3
7270 #if PY_MAJOR_VERSION < 3
7276 #if PY_MAJOR_VERSION < 3
7279 #if PY_MAJOR_VERSION < 3
7282 0, /*nb_inplace_add*/
7283 0, /*nb_inplace_subtract*/
7284 0, /*nb_inplace_multiply*/
7285 #if PY_MAJOR_VERSION < 3
7286 0, /*nb_inplace_divide*/
7288 0, /*nb_inplace_remainder*/
7289 0, /*nb_inplace_power*/
7290 0, /*nb_inplace_lshift*/
7291 0, /*nb_inplace_rshift*/
7292 0, /*nb_inplace_and*/
7293 0, /*nb_inplace_xor*/
7294 0, /*nb_inplace_or*/
7295 0, /*nb_floor_divide*/
7296 0, /*nb_true_divide*/
7297 0, /*nb_inplace_floor_divide*/
7298 0, /*nb_inplace_true_divide*/
7299 #if PY_VERSION_HEX >= 0x02050000
7304 static PySequenceMethods __pyx_tp_as_sequence_TabixIteratorParsed = {
7313 0, /*sq_inplace_concat*/
7314 0, /*sq_inplace_repeat*/
7317 static PyMappingMethods __pyx_tp_as_mapping_TabixIteratorParsed = {
7320 0, /*mp_ass_subscript*/
7323 static PyBufferProcs __pyx_tp_as_buffer_TabixIteratorParsed = {
7324 #if PY_MAJOR_VERSION < 3
7325 0, /*bf_getreadbuffer*/
7327 #if PY_MAJOR_VERSION < 3
7328 0, /*bf_getwritebuffer*/
7330 #if PY_MAJOR_VERSION < 3
7331 0, /*bf_getsegcount*/
7333 #if PY_MAJOR_VERSION < 3
7334 0, /*bf_getcharbuffer*/
7336 #if PY_VERSION_HEX >= 0x02060000
7339 #if PY_VERSION_HEX >= 0x02060000
7340 0, /*bf_releasebuffer*/
7344 static PyTypeObject __pyx_type_6ctabix_TabixIteratorParsed = {
7345 PyVarObject_HEAD_INIT(0, 0)
7346 __Pyx_NAMESTR("ctabix.TabixIteratorParsed"), /*tp_name*/
7347 sizeof(struct __pyx_obj_6ctabix_TabixIteratorParsed), /*tp_basicsize*/
7349 __pyx_tp_dealloc_6ctabix_TabixIteratorParsed, /*tp_dealloc*/
7353 #if PY_MAJOR_VERSION < 3
7359 &__pyx_tp_as_number_TabixIteratorParsed, /*tp_as_number*/
7360 &__pyx_tp_as_sequence_TabixIteratorParsed, /*tp_as_sequence*/
7361 &__pyx_tp_as_mapping_TabixIteratorParsed, /*tp_as_mapping*/
7367 &__pyx_tp_as_buffer_TabixIteratorParsed, /*tp_as_buffer*/
7368 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
7369 __Pyx_DOCSTR("iterates over mapped reads in a region.\n\n Returns parsed data.\n "), /*tp_doc*/
7370 __pyx_tp_traverse_6ctabix_TabixIteratorParsed, /*tp_traverse*/
7371 __pyx_tp_clear_6ctabix_TabixIteratorParsed, /*tp_clear*/
7372 0, /*tp_richcompare*/
7373 0, /*tp_weaklistoffset*/
7374 __pyx_pf_6ctabix_19TabixIteratorParsed_1__iter__, /*tp_iter*/
7375 __pyx_pf_6ctabix_19TabixIteratorParsed_2__next__, /*tp_iternext*/
7376 __pyx_methods_6ctabix_TabixIteratorParsed, /*tp_methods*/
7383 0, /*tp_dictoffset*/
7386 __pyx_tp_new_6ctabix_TabixIteratorParsed, /*tp_new*/
7392 0, /*tp_subclasses*/
7395 #if PY_VERSION_HEX >= 0x02060000
7396 0, /*tp_version_tag*/
7400 static PyMethodDef __pyx_methods[] = {
7404 #if PY_MAJOR_VERSION >= 3
7405 static struct PyModuleDef __pyx_moduledef = {
7406 PyModuleDef_HEAD_INIT,
7407 __Pyx_NAMESTR("ctabix"),
7410 __pyx_methods /* m_methods */,
7411 NULL, /* m_reload */
7412 NULL, /* m_traverse */
7418 static __Pyx_StringTabEntry __pyx_string_tab[] = {
7419 {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
7420 {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
7421 {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
7422 {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
7423 {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
7424 {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
7425 {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
7426 {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
7427 {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
7428 {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
7429 {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
7430 {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
7431 {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
7432 {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
7433 {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
7434 {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
7435 {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
7436 {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0},
7437 {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
7438 {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
7439 {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
7440 {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
7441 {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
7442 {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1},
7443 {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1},
7444 {&__pyx_n_s__OSError, __pyx_k__OSError, sizeof(__pyx_k__OSError), 0, 0, 1, 1},
7445 {&__pyx_n_s__O_RDONLY, __pyx_k__O_RDONLY, sizeof(__pyx_k__O_RDONLY), 0, 0, 1, 1},
7446 {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1},
7447 {&__pyx_n_s__Tabixfile, __pyx_k__Tabixfile, sizeof(__pyx_k__Tabixfile), 0, 0, 1, 1},
7448 {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
7449 {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1},
7450 {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
7451 {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
7452 {&__pyx_n_s___filename, __pyx_k___filename, sizeof(__pyx_k___filename), 0, 0, 1, 1},
7453 {&__pyx_n_s___isOpen, __pyx_k___isOpen, sizeof(__pyx_k___isOpen), 0, 0, 1, 1},
7454 {&__pyx_n_s___open, __pyx_k___open, sizeof(__pyx_k___open), 0, 0, 1, 1},
7455 {&__pyx_n_s___parseRegion, __pyx_k___parseRegion, sizeof(__pyx_k___parseRegion), 0, 0, 1, 1},
7456 {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1},
7457 {&__pyx_n_s__asBed, __pyx_k__asBed, sizeof(__pyx_k__asBed), 0, 0, 1, 1},
7458 {&__pyx_n_s__asGTF, __pyx_k__asGTF, sizeof(__pyx_k__asGTF), 0, 0, 1, 1},
7459 {&__pyx_n_s__asTuple, __pyx_k__asTuple, sizeof(__pyx_k__asTuple), 0, 0, 1, 1},
7460 {&__pyx_n_s__asVCF, __pyx_k__asVCF, sizeof(__pyx_k__asVCF), 0, 0, 1, 1},
7461 {&__pyx_n_s__bc, __pyx_k__bc, sizeof(__pyx_k__bc), 0, 0, 1, 1},
7462 {&__pyx_n_s__bed, __pyx_k__bed, sizeof(__pyx_k__bed), 0, 0, 1, 1},
7463 {&__pyx_n_s__buffer, __pyx_k__buffer, sizeof(__pyx_k__buffer), 0, 0, 1, 1},
7464 {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1},
7465 {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1},
7466 {&__pyx_n_s__ctabix, __pyx_k__ctabix, sizeof(__pyx_k__ctabix), 0, 0, 1, 1},
7467 {&__pyx_n_s__ctypes, __pyx_k__ctypes, sizeof(__pyx_k__ctypes), 0, 0, 1, 1},
7468 {&__pyx_n_s__ec, __pyx_k__ec, sizeof(__pyx_k__ec), 0, 0, 1, 1},
7469 {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1},
7470 {&__pyx_n_s__end_col, __pyx_k__end_col, sizeof(__pyx_k__end_col), 0, 0, 1, 1},
7471 {&__pyx_n_s__endswith, __pyx_k__endswith, sizeof(__pyx_k__endswith), 0, 0, 1, 1},
7472 {&__pyx_n_s__exists, __pyx_k__exists, sizeof(__pyx_k__exists), 0, 0, 1, 1},
7473 {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1},
7474 {&__pyx_n_s__filename_in, __pyx_k__filename_in, sizeof(__pyx_k__filename_in), 0, 0, 1, 1},
7475 {&__pyx_n_s__filename_out, __pyx_k__filename_out, sizeof(__pyx_k__filename_out), 0, 0, 1, 1},
7476 {&__pyx_n_s__force, __pyx_k__force, sizeof(__pyx_k__force), 0, 0, 1, 1},
7477 {&__pyx_n_s__fp, __pyx_k__fp, sizeof(__pyx_k__fp), 0, 0, 1, 1},
7478 {&__pyx_n_s__gff, __pyx_k__gff, sizeof(__pyx_k__gff), 0, 0, 1, 1},
7479 {&__pyx_n_s__gzip, __pyx_k__gzip, sizeof(__pyx_k__gzip), 0, 0, 1, 1},
7480 {&__pyx_n_s__idx, __pyx_k__idx, sizeof(__pyx_k__idx), 0, 0, 1, 1},
7481 {&__pyx_n_s__iterator, __pyx_k__iterator, sizeof(__pyx_k__iterator), 0, 0, 1, 1},
7482 {&__pyx_n_s__itertools, __pyx_k__itertools, sizeof(__pyx_k__itertools), 0, 0, 1, 1},
7483 {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1},
7484 {&__pyx_n_s__keys, __pyx_k__keys, sizeof(__pyx_k__keys), 0, 0, 1, 1},
7485 {&__pyx_n_s__len, __pyx_k__len, sizeof(__pyx_k__len), 0, 0, 1, 1},
7486 {&__pyx_n_s__line_skip, __pyx_k__line_skip, sizeof(__pyx_k__line_skip), 0, 0, 1, 1},
7487 {&__pyx_n_s__meta_char, __pyx_k__meta_char, sizeof(__pyx_k__meta_char), 0, 0, 1, 1},
7488 {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1},
7489 {&__pyx_n_s__ord, __pyx_k__ord, sizeof(__pyx_k__ord), 0, 0, 1, 1},
7490 {&__pyx_n_s__os, __pyx_k__os, sizeof(__pyx_k__os), 0, 0, 1, 1},
7491 {&__pyx_n_s__parser, __pyx_k__parser, sizeof(__pyx_k__parser), 0, 0, 1, 1},
7492 {&__pyx_n_s__path, __pyx_k__path, sizeof(__pyx_k__path), 0, 0, 1, 1},
7493 {&__pyx_n_s__pileup, __pyx_k__pileup, sizeof(__pyx_k__pileup), 0, 0, 1, 1},
7494 {&__pyx_n_s__preset, __pyx_k__preset, sizeof(__pyx_k__preset), 0, 0, 1, 1},
7495 {&__pyx_n_s__psltbl, __pyx_k__psltbl, sizeof(__pyx_k__psltbl), 0, 0, 1, 1},
7496 {&__pyx_n_s__r, __pyx_k__r, sizeof(__pyx_k__r), 0, 0, 1, 1},
7497 {&__pyx_n_s__reference, __pyx_k__reference, sizeof(__pyx_k__reference), 0, 0, 1, 1},
7498 {&__pyx_n_s__region, __pyx_k__region, sizeof(__pyx_k__region), 0, 0, 1, 1},
7499 {&__pyx_n_s__sam, __pyx_k__sam, sizeof(__pyx_k__sam), 0, 0, 1, 1},
7500 {&__pyx_n_s__sc, __pyx_k__sc, sizeof(__pyx_k__sc), 0, 0, 1, 1},
7501 {&__pyx_n_s__seq_col, __pyx_k__seq_col, sizeof(__pyx_k__seq_col), 0, 0, 1, 1},
7502 {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1},
7503 {&__pyx_n_s__start_col, __pyx_k__start_col, sizeof(__pyx_k__start_col), 0, 0, 1, 1},
7504 {&__pyx_n_s__struct, __pyx_k__struct, sizeof(__pyx_k__struct), 0, 0, 1, 1},
7505 {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1},
7506 {&__pyx_n_s__tabix_compress, __pyx_k__tabix_compress, sizeof(__pyx_k__tabix_compress), 0, 0, 1, 1},
7507 {&__pyx_n_s__tabix_index, __pyx_k__tabix_index, sizeof(__pyx_k__tabix_index), 0, 0, 1, 1},
7508 {&__pyx_n_s__tabixfile, __pyx_k__tabixfile, sizeof(__pyx_k__tabixfile), 0, 0, 1, 1},
7509 {&__pyx_n_s__tempfile, __pyx_k__tempfile, sizeof(__pyx_k__tempfile), 0, 0, 1, 1},
7510 {&__pyx_n_s__tid, __pyx_k__tid, sizeof(__pyx_k__tid), 0, 0, 1, 1},
7511 {&__pyx_n_s__types, __pyx_k__types, sizeof(__pyx_k__types), 0, 0, 1, 1},
7512 {&__pyx_n_s__unlink, __pyx_k__unlink, sizeof(__pyx_k__unlink), 0, 0, 1, 1},
7513 {&__pyx_n_s__vcf, __pyx_k__vcf, sizeof(__pyx_k__vcf), 0, 0, 1, 1},
7514 {&__pyx_n_s__w, __pyx_k__w, sizeof(__pyx_k__w), 0, 0, 1, 1},
7515 {&__pyx_n_s__zerobased, __pyx_k__zerobased, sizeof(__pyx_k__zerobased), 0, 0, 1, 1},
7516 {0, 0, 0, 0, 0, 0, 0}
7518 static int __Pyx_InitCachedBuiltins(void) {
7519 __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7520 __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7521 __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7522 __pyx_builtin_OSError = __Pyx_GetName(__pyx_b, __pyx_n_s__OSError); if (!__pyx_builtin_OSError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7523 __pyx_builtin_ord = __Pyx_GetName(__pyx_b, __pyx_n_s__ord); if (!__pyx_builtin_ord) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7524 __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7530 static int __Pyx_InitCachedConstants(void) {
7531 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
7535 * if not self._isOpen():
7536 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
7538 * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
7540 __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7541 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12));
7542 __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
7543 PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_11));
7544 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
7545 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
7548 * '''filename associated with this object.'''
7549 * def __get__(self):
7550 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
7551 * return self._filename
7554 __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7555 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_13));
7556 __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
7557 PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_s_11));
7558 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
7559 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));
7563 * if <void*>self.iterator == NULL:
7564 * raise ValueError("malformatted query or wrong sequence name.\n") # <<<<<<<<<<<<<<
7566 * def __iter__(self):
7568 __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7569 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15));
7570 __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
7571 PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_s_14));
7572 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
7573 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15));
7577 * if <void*>self.iterator == NULL:
7578 * raise ValueError("can't open header.\n") # <<<<<<<<<<<<<<
7580 * def __iter__(self):
7582 __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7583 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17));
7584 __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
7585 PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_s_16));
7586 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16));
7587 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
7591 * if <void*>self.iterator == NULL:
7592 * raise ValueError("malformatted query or wrong sequence name.\n") # <<<<<<<<<<<<<<
7594 * def __iter__(self):
7596 __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7597 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_18));
7598 __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
7599 PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_kp_s_14));
7600 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
7601 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
7604 * fp = bgzf_open( filename_out, "w")
7606 * raise IOError( "could not open '%s' for writing" ) # <<<<<<<<<<<<<<
7608 * fd_src = open(filename_in, O_RDONLY)
7610 __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7611 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_22));
7612 __Pyx_INCREF(((PyObject *)__pyx_kp_s_21));
7613 PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_kp_s_21));
7614 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_21));
7615 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));
7618 * fd_src = open(filename_in, O_RDONLY)
7620 * raise IOError( "could not open '%s' for reading" ) # <<<<<<<<<<<<<<
7622 * buffer = malloc(WINDOW_SIZE)
7624 __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7625 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_24));
7626 __Pyx_INCREF(((PyObject *)__pyx_kp_s_23));
7627 PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_s_23));
7628 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23));
7629 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
7634 * raise OSError("writing failed") # <<<<<<<<<<<<<<
7638 __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7639 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_26));
7640 __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
7641 PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_25));
7642 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
7643 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
7647 * r = bgzf_close(fp)
7648 * if r < 0: raise OSError("writing failed") # <<<<<<<<<<<<<<
7650 * def tabix_index( filename,
7652 __pyx_k_tuple_27 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7653 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_27));
7654 __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
7655 PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_kp_s_25));
7656 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
7657 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27));
7660 * if not os.path.exists(filename): raise IOError("No such file '%s'" % filename)
7662 * if not filename.endswith(".gz"): # <<<<<<<<<<<<<<
7664 * tabix_compress( filename, filename + ".gz", force = force )
7666 __pyx_k_tuple_33 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7667 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_33));
7668 __Pyx_INCREF(((PyObject *)__pyx_kp_s_32));
7669 PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_kp_s_32));
7670 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_32));
7671 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));
7675 * if not force and os.path.exists(filename + ".tbi" ):
7676 * raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" ) # <<<<<<<<<<<<<<
7678 * # columns (1-based)
7680 __pyx_k_tuple_35 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7681 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_35));
7682 __Pyx_INCREF(((PyObject *)__pyx_kp_s_34));
7683 PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, ((PyObject *)__pyx_kp_s_34));
7684 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_34));
7685 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
7688 * # 0 is a missing column
7690 * 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ), # <<<<<<<<<<<<<<
7691 * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
7692 * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
7694 __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7695 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_36));
7696 __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
7697 PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_kp_s_29));
7698 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29));
7699 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
7703 * 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),
7704 * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ), # <<<<<<<<<<<<<<
7705 * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
7706 * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
7708 __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7709 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_37));
7710 __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
7711 PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_kp_s_29));
7712 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29));
7713 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));
7716 * 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),
7717 * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
7718 * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ), # <<<<<<<<<<<<<<
7719 * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
7720 * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
7722 __pyx_k_tuple_38 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7723 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_38));
7724 __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
7725 PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, ((PyObject *)__pyx_kp_s_29));
7726 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29));
7727 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
7730 * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
7731 * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
7732 * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ), # <<<<<<<<<<<<<<
7733 * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
7734 * 'pileup': (3, 1, 2, 0, ord('#'), 0 ),
7736 __pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7737 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_39));
7738 __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
7739 PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_kp_s_29));
7740 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29));
7741 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39));
7744 * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
7745 * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
7746 * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ), # <<<<<<<<<<<<<<
7747 * 'pileup': (3, 1, 2, 0, ord('#'), 0 ),
7750 __pyx_k_tuple_40 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7751 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_40));
7752 __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
7753 PyTuple_SET_ITEM(__pyx_k_tuple_40, 0, ((PyObject *)__pyx_kp_s_29));
7754 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29));
7755 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));
7758 * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
7759 * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
7760 * 'pileup': (3, 1, 2, 0, ord('#'), 0 ), # <<<<<<<<<<<<<<
7764 __pyx_k_tuple_41 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7765 __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_41));
7766 __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
7767 PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_kp_s_29));
7768 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29));
7769 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41));
7770 __Pyx_RefNannyFinishContext();
7773 __Pyx_RefNannyFinishContext();
7777 static int __Pyx_InitGlobals(void) {
7778 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7779 __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;};
7780 __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;};
7781 __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;};
7782 __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7783 __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;};
7784 __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7785 __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7786 __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7787 __pyx_int_17 = PyInt_FromLong(17); if (unlikely(!__pyx_int_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7788 __pyx_int_18 = PyInt_FromLong(18); if (unlikely(!__pyx_int_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7789 __pyx_int_65536 = PyInt_FromLong(65536); if (unlikely(!__pyx_int_65536)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7795 #if PY_MAJOR_VERSION < 3
7796 PyMODINIT_FUNC initctabix(void); /*proto*/
7797 PyMODINIT_FUNC initctabix(void)
7799 PyMODINIT_FUNC PyInit_ctabix(void); /*proto*/
7800 PyMODINIT_FUNC PyInit_ctabix(void)
7803 PyObject *__pyx_t_1 = NULL;
7805 void* __pyx_refnanny = NULL;
7806 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
7807 if (!__Pyx_RefNanny) {
7809 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
7810 if (!__Pyx_RefNanny)
7811 Py_FatalError("failed to import 'refnanny' module");
7813 __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_ctabix(void)", __LINE__, __FILE__);
7815 __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;}
7816 __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;}
7817 #ifdef __pyx_binding_PyCFunctionType_USED
7818 if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7820 /*--- Library function declarations ---*/
7821 /*--- Threads initialization code ---*/
7822 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
7823 #ifdef WITH_THREAD /* Python build with threading support? */
7824 PyEval_InitThreads();
7827 /*--- Module creation code ---*/
7828 #if PY_MAJOR_VERSION < 3
7829 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("ctabix"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
7831 __pyx_m = PyModule_Create(&__pyx_moduledef);
7833 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7834 #if PY_MAJOR_VERSION < 3
7837 __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
7838 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7839 if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
7840 /*--- Initialize various global constants etc. ---*/
7841 if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7842 if (__pyx_module_is_main_ctabix) {
7843 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;};
7845 /*--- Builtin init code ---*/
7846 if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7847 /*--- Constants init code ---*/
7848 if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7849 /*--- Global init code ---*/
7850 /*--- Function export code ---*/
7851 /*--- Type init code ---*/
7852 if (PyType_Ready(&__pyx_type_6ctabix_Tabixfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7853 if (__Pyx_SetAttrString(__pyx_m, "Tabixfile", (PyObject *)&__pyx_type_6ctabix_Tabixfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7854 __pyx_ptype_6ctabix_Tabixfile = &__pyx_type_6ctabix_Tabixfile;
7855 if (PyType_Ready(&__pyx_type_6ctabix_Parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7856 if (__Pyx_SetAttrString(__pyx_m, "Parser", (PyObject *)&__pyx_type_6ctabix_Parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7857 __pyx_ptype_6ctabix_Parser = &__pyx_type_6ctabix_Parser;
7858 if (PyType_Ready(&__pyx_type_6ctabix_TabixIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7860 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6ctabix_TabixIterator, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7861 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
7862 __pyx_wrapperbase_6ctabix_13TabixIterator_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
7863 __pyx_wrapperbase_6ctabix_13TabixIterator_2__next__.doc = __pyx_doc_6ctabix_13TabixIterator_2__next__;
7864 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6ctabix_13TabixIterator_2__next__;
7867 if (__Pyx_SetAttrString(__pyx_m, "TabixIterator", (PyObject *)&__pyx_type_6ctabix_TabixIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7868 __pyx_ptype_6ctabix_TabixIterator = &__pyx_type_6ctabix_TabixIterator;
7869 if (PyType_Ready(&__pyx_type_6ctabix_TabixHeaderIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7871 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6ctabix_TabixHeaderIterator, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7872 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
7873 __pyx_wrapperbase_6ctabix_19TabixHeaderIterator_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
7874 __pyx_wrapperbase_6ctabix_19TabixHeaderIterator_2__next__.doc = __pyx_doc_6ctabix_19TabixHeaderIterator_2__next__;
7875 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6ctabix_19TabixHeaderIterator_2__next__;
7878 if (__Pyx_SetAttrString(__pyx_m, "TabixHeaderIterator", (PyObject *)&__pyx_type_6ctabix_TabixHeaderIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7879 __pyx_ptype_6ctabix_TabixHeaderIterator = &__pyx_type_6ctabix_TabixHeaderIterator;
7880 __pyx_type_6ctabix_asTuple.tp_base = __pyx_ptype_6ctabix_Parser;
7881 if (PyType_Ready(&__pyx_type_6ctabix_asTuple) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7882 if (__Pyx_SetAttrString(__pyx_m, "asTuple", (PyObject *)&__pyx_type_6ctabix_asTuple) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7883 __pyx_ptype_6ctabix_asTuple = &__pyx_type_6ctabix_asTuple;
7884 __pyx_type_6ctabix_asGTF.tp_base = __pyx_ptype_6ctabix_Parser;
7885 if (PyType_Ready(&__pyx_type_6ctabix_asGTF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7886 if (__Pyx_SetAttrString(__pyx_m, "asGTF", (PyObject *)&__pyx_type_6ctabix_asGTF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7887 __pyx_ptype_6ctabix_asGTF = &__pyx_type_6ctabix_asGTF;
7888 __pyx_type_6ctabix_asBed.tp_base = __pyx_ptype_6ctabix_Parser;
7889 if (PyType_Ready(&__pyx_type_6ctabix_asBed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7890 if (__Pyx_SetAttrString(__pyx_m, "asBed", (PyObject *)&__pyx_type_6ctabix_asBed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7891 __pyx_ptype_6ctabix_asBed = &__pyx_type_6ctabix_asBed;
7892 __pyx_type_6ctabix_asVCF.tp_base = __pyx_ptype_6ctabix_Parser;
7893 if (PyType_Ready(&__pyx_type_6ctabix_asVCF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7894 if (__Pyx_SetAttrString(__pyx_m, "asVCF", (PyObject *)&__pyx_type_6ctabix_asVCF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7895 __pyx_ptype_6ctabix_asVCF = &__pyx_type_6ctabix_asVCF;
7896 if (PyType_Ready(&__pyx_type_6ctabix_TabixIteratorParsed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7898 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6ctabix_TabixIteratorParsed, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7899 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
7900 __pyx_wrapperbase_6ctabix_19TabixIteratorParsed_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
7901 __pyx_wrapperbase_6ctabix_19TabixIteratorParsed_2__next__.doc = __pyx_doc_6ctabix_19TabixIteratorParsed_2__next__;
7902 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6ctabix_19TabixIteratorParsed_2__next__;
7905 if (__Pyx_SetAttrString(__pyx_m, "TabixIteratorParsed", (PyObject *)&__pyx_type_6ctabix_TabixIteratorParsed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7906 __pyx_ptype_6ctabix_TabixIteratorParsed = &__pyx_type_6ctabix_TabixIteratorParsed;
7907 /*--- Type import code ---*/
7908 __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7909 __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7910 __pyx_ptype_10TabProxies_TupleProxy = __Pyx_ImportType("TabProxies", "TupleProxy", sizeof(struct __pyx_obj_10TabProxies_TupleProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_TupleProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7911 __pyx_vtabptr_10TabProxies_TupleProxy = (struct __pyx_vtabstruct_10TabProxies_TupleProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_TupleProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_TupleProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7912 __pyx_ptype_10TabProxies_GTFProxy = __Pyx_ImportType("TabProxies", "GTFProxy", sizeof(struct __pyx_obj_10TabProxies_GTFProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_GTFProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7913 __pyx_vtabptr_10TabProxies_GTFProxy = (struct __pyx_vtabstruct_10TabProxies_GTFProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_GTFProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_GTFProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7914 __pyx_ptype_10TabProxies_NamedTupleProxy = __Pyx_ImportType("TabProxies", "NamedTupleProxy", sizeof(struct __pyx_obj_10TabProxies_NamedTupleProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7915 __pyx_vtabptr_10TabProxies_NamedTupleProxy = (struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_NamedTupleProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7916 __pyx_ptype_10TabProxies_BedProxy = __Pyx_ImportType("TabProxies", "BedProxy", sizeof(struct __pyx_obj_10TabProxies_BedProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7917 __pyx_vtabptr_10TabProxies_BedProxy = (struct __pyx_vtabstruct_10TabProxies_BedProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_BedProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7918 __pyx_ptype_10TabProxies_VCFProxy = __Pyx_ImportType("TabProxies", "VCFProxy", sizeof(struct __pyx_obj_10TabProxies_VCFProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7919 __pyx_vtabptr_10TabProxies_VCFProxy = (struct __pyx_vtabstruct_10TabProxies_VCFProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_VCFProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7920 /*--- Function import code ---*/
7921 /*--- Execution code ---*/
7924 * # adds doc-strings for sphinx
7926 * import tempfile, os, sys, types, itertools, struct, ctypes, gzip # <<<<<<<<<<<<<<
7927 * from cpython cimport PyString_FromStringAndSize, PyString_AS_STRING
7928 * cimport TabProxies
7930 __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;}
7931 __Pyx_GOTREF(__pyx_t_1);
7932 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;}
7933 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7934 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7935 __Pyx_GOTREF(__pyx_t_1);
7936 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7937 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7938 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7939 __Pyx_GOTREF(__pyx_t_1);
7940 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7941 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7942 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__types), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7943 __Pyx_GOTREF(__pyx_t_1);
7944 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__types, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7945 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7946 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__itertools), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7947 __Pyx_GOTREF(__pyx_t_1);
7948 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__itertools, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7949 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7950 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7951 __Pyx_GOTREF(__pyx_t_1);
7952 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__struct, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7953 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7954 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__ctypes), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7955 __Pyx_GOTREF(__pyx_t_1);
7956 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ctypes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7957 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7958 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__gzip), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7959 __Pyx_GOTREF(__pyx_t_1);
7960 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gzip, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7961 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7964 * def tabix_compress( filename_in,
7966 * force = False ): # <<<<<<<<<<<<<<
7970 __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7971 __Pyx_GOTREF(__pyx_t_1);
7972 __pyx_k_19 = __pyx_t_1;
7973 __Pyx_GIVEREF(__pyx_t_1);
7977 * ti_iter_destroy(self.iterator)
7979 * def tabix_compress( filename_in, # <<<<<<<<<<<<<<
7983 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6ctabix_tabix_compress, NULL, __pyx_n_s__ctabix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7984 __Pyx_GOTREF(__pyx_t_1);
7985 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tabix_compress, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7986 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7990 * def tabix_index( filename,
7991 * force = False, # <<<<<<<<<<<<<<
7995 __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7996 __Pyx_GOTREF(__pyx_t_1);
7997 __pyx_k_28 = __pyx_t_1;
7998 __Pyx_GIVEREF(__pyx_t_1);
8004 * zerobased = False, # <<<<<<<<<<<<<<
8008 __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8009 __Pyx_GOTREF(__pyx_t_1);
8010 __pyx_k_30 = __pyx_t_1;
8011 __Pyx_GIVEREF(__pyx_t_1);
8015 * if r < 0: raise OSError("writing failed")
8017 * def tabix_index( filename, # <<<<<<<<<<<<<<
8021 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6ctabix_1tabix_index, NULL, __pyx_n_s__ctabix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8022 __Pyx_GOTREF(__pyx_t_1);
8023 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tabix_index, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8024 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8029 * __all__ = ["tabix_index", # <<<<<<<<<<<<<<
8033 __pyx_t_1 = PyList_New(7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8034 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
8035 __Pyx_INCREF(((PyObject *)__pyx_n_s__tabix_index));
8036 PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__tabix_index));
8037 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tabix_index));
8038 __Pyx_INCREF(((PyObject *)__pyx_n_s__tabix_compress));
8039 PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__tabix_compress));
8040 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tabix_compress));
8041 __Pyx_INCREF(((PyObject *)__pyx_n_s__Tabixfile));
8042 PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__Tabixfile));
8043 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Tabixfile));
8044 __Pyx_INCREF(((PyObject *)__pyx_n_s__asTuple));
8045 PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__asTuple));
8046 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__asTuple));
8047 __Pyx_INCREF(((PyObject *)__pyx_n_s__asGTF));
8048 PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__asGTF));
8049 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__asGTF));
8050 __Pyx_INCREF(((PyObject *)__pyx_n_s__asVCF));
8051 PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s__asVCF));
8052 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__asVCF));
8053 __Pyx_INCREF(((PyObject *)__pyx_n_s__asBed));
8054 PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_n_s__asBed));
8055 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__asBed));
8056 if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8057 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
8060 * # cython: embedsignature=True # <<<<<<<<<<<<<<
8061 * # adds doc-strings for sphinx
8064 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8065 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
8066 if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8067 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
8069 /* "cpython/type.pxd":2
8071 * cdef extern from "Python.h": # <<<<<<<<<<<<<<
8072 * # The C structure of the objects used to describe built-in types.
8077 __Pyx_XDECREF(__pyx_t_1);
8079 __Pyx_AddTraceback("init ctabix");
8080 Py_DECREF(__pyx_m); __pyx_m = 0;
8081 } else if (!PyErr_Occurred()) {
8082 PyErr_SetString(PyExc_ImportError, "init ctabix");
8085 __Pyx_RefNannyFinishContext();
8086 #if PY_MAJOR_VERSION < 3
8093 /* Runtime support code */
8095 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
8097 result = PyObject_GetAttr(dict, name);
8099 PyErr_SetObject(PyExc_NameError, name);
8103 static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
8105 const char* function_name,
8110 while (PyDict_Next(kwdict, &pos, &key, 0)) {
8111 #if PY_MAJOR_VERSION < 3
8112 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
8114 if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key)))
8116 goto invalid_keyword_type;
8118 if ((!kw_allowed) && unlikely(key))
8119 goto invalid_keyword;
8121 invalid_keyword_type:
8122 PyErr_Format(PyExc_TypeError,
8123 "%s() keywords must be strings", function_name);
8126 PyErr_Format(PyExc_TypeError,
8127 #if PY_MAJOR_VERSION < 3
8128 "%s() got an unexpected keyword argument '%s'",
8129 function_name, PyString_AsString(key));
8131 "%s() got an unexpected keyword argument '%U'",
8132 function_name, key);
8137 static void __Pyx_RaiseDoubleKeywordsError(
8138 const char* func_name,
8141 PyErr_Format(PyExc_TypeError,
8142 #if PY_MAJOR_VERSION >= 3
8143 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
8145 "%s() got multiple values for keyword argument '%s'", func_name,
8146 PyString_AS_STRING(kw_name));
8150 static int __Pyx_ParseOptionalKeywords(
8152 PyObject **argnames[],
8155 Py_ssize_t num_pos_args,
8156 const char* function_name)
8158 PyObject *key = 0, *value = 0;
8161 PyObject*** first_kw_arg = argnames + num_pos_args;
8163 while (PyDict_Next(kwds, &pos, &key, &value)) {
8164 name = first_kw_arg;
8165 while (*name && (**name != key)) name++;
8167 values[name-argnames] = value;
8169 #if PY_MAJOR_VERSION < 3
8170 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
8172 if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
8174 goto invalid_keyword_type;
8176 for (name = first_kw_arg; *name; name++) {
8177 #if PY_MAJOR_VERSION >= 3
8178 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
8179 PyUnicode_Compare(**name, key) == 0) break;
8181 if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
8182 _PyString_Eq(**name, key)) break;
8186 values[name-argnames] = value;
8188 /* unexpected keyword found */
8189 for (name=argnames; name != first_kw_arg; name++) {
8190 if (**name == key) goto arg_passed_twice;
8191 #if PY_MAJOR_VERSION >= 3
8192 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
8193 PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
8195 if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
8196 _PyString_Eq(**name, key)) goto arg_passed_twice;
8200 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
8202 goto invalid_keyword;
8210 __Pyx_RaiseDoubleKeywordsError(function_name, **name);
8212 invalid_keyword_type:
8213 PyErr_Format(PyExc_TypeError,
8214 "%s() keywords must be strings", function_name);
8217 PyErr_Format(PyExc_TypeError,
8218 #if PY_MAJOR_VERSION < 3
8219 "%s() got an unexpected keyword argument '%s'",
8220 function_name, PyString_AsString(key));
8222 "%s() got an unexpected keyword argument '%U'",
8223 function_name, key);
8229 static void __Pyx_RaiseArgtupleInvalid(
8230 const char* func_name,
8234 Py_ssize_t num_found)
8236 Py_ssize_t num_expected;
8237 const char *number, *more_or_less;
8239 if (num_found < num_min) {
8240 num_expected = num_min;
8241 more_or_less = "at least";
8243 num_expected = num_max;
8244 more_or_less = "at most";
8247 more_or_less = "exactly";
8249 number = (num_expected == 1) ? "" : "s";
8250 PyErr_Format(PyExc_TypeError,
8251 #if PY_VERSION_HEX < 0x02050000
8252 "%s() takes %s %d positional argument%s (%d given)",
8254 "%s() takes %s %zd positional argument%s (%zd given)",
8256 func_name, more_or_less, num_expected, number, num_found);
8260 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
8261 PyObject *tmp_type, *tmp_value, *tmp_tb;
8262 PyThreadState *tstate = PyThreadState_GET();
8264 tmp_type = tstate->curexc_type;
8265 tmp_value = tstate->curexc_value;
8266 tmp_tb = tstate->curexc_traceback;
8267 tstate->curexc_type = type;
8268 tstate->curexc_value = value;
8269 tstate->curexc_traceback = tb;
8270 Py_XDECREF(tmp_type);
8271 Py_XDECREF(tmp_value);
8275 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
8276 PyThreadState *tstate = PyThreadState_GET();
8277 *type = tstate->curexc_type;
8278 *value = tstate->curexc_value;
8279 *tb = tstate->curexc_traceback;
8281 tstate->curexc_type = 0;
8282 tstate->curexc_value = 0;
8283 tstate->curexc_traceback = 0;
8287 #if PY_MAJOR_VERSION < 3
8288 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
8292 /* First, check the traceback argument, replacing None with NULL. */
8293 if (tb == Py_None) {
8297 else if (tb != NULL && !PyTraceBack_Check(tb)) {
8298 PyErr_SetString(PyExc_TypeError,
8299 "raise: arg 3 must be a traceback or None");
8302 /* Next, replace a missing value with None */
8303 if (value == NULL) {
8307 #if PY_VERSION_HEX < 0x02050000
8308 if (!PyClass_Check(type))
8310 if (!PyType_Check(type))
8313 /* Raising an instance. The value should be a dummy. */
8314 if (value != Py_None) {
8315 PyErr_SetString(PyExc_TypeError,
8316 "instance exception may not have a separate value");
8319 /* Normalize to raise <class>, <instance> */
8322 #if PY_VERSION_HEX < 0x02050000
8323 if (PyInstance_Check(type)) {
8324 type = (PyObject*) ((PyInstanceObject*)type)->in_class;
8329 PyErr_SetString(PyExc_TypeError,
8330 "raise: exception must be an old-style class or instance");
8334 type = (PyObject*) Py_TYPE(type);
8336 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
8337 PyErr_SetString(PyExc_TypeError,
8338 "raise: exception class must be a subclass of BaseException");
8344 __Pyx_ErrRestore(type, value, tb);
8353 #else /* Python 3+ */
8355 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
8356 if (tb == Py_None) {
8358 } else if (tb && !PyTraceBack_Check(tb)) {
8359 PyErr_SetString(PyExc_TypeError,
8360 "raise: arg 3 must be a traceback or None");
8363 if (value == Py_None)
8366 if (PyExceptionInstance_Check(type)) {
8368 PyErr_SetString(PyExc_TypeError,
8369 "instance exception may not have a separate value");
8373 type = (PyObject*) Py_TYPE(value);
8374 } else if (!PyExceptionClass_Check(type)) {
8375 PyErr_SetString(PyExc_TypeError,
8376 "raise: exception class must be a subclass of BaseException");
8380 PyErr_SetObject(type, value);
8383 PyThreadState *tstate = PyThreadState_GET();
8384 PyObject* tmp_tb = tstate->curexc_traceback;
8387 tstate->curexc_traceback = tb;
8397 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
8398 PyErr_Format(PyExc_ValueError,
8399 #if PY_VERSION_HEX < 0x02050000
8400 "need more than %d value%s to unpack", (int)index,
8402 "need more than %zd value%s to unpack", index,
8404 (index == 1) ? "" : "s");
8407 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
8408 PyErr_Format(PyExc_ValueError,
8409 #if PY_VERSION_HEX < 0x02050000
8410 "too many values to unpack (expected %d)", (int)expected);
8412 "too many values to unpack (expected %zd)", expected);
8416 static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
8418 if (!(item = PyIter_Next(iter))) {
8419 if (!PyErr_Occurred()) {
8420 __Pyx_RaiseNeedMoreValuesError(index);
8426 static int __Pyx_EndUnpack(PyObject *iter, Py_ssize_t expected) {
8428 if ((item = PyIter_Next(iter))) {
8430 __Pyx_RaiseTooManyValuesError(expected);
8433 else if (!PyErr_Occurred())
8439 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
8440 const char *name, int exact)
8443 PyErr_Format(PyExc_SystemError, "Missing type object");
8446 if (none_allowed && obj == Py_None) return 1;
8448 if (Py_TYPE(obj) == type) return 1;
8451 if (PyObject_TypeCheck(obj, type)) return 1;
8453 PyErr_Format(PyExc_TypeError,
8454 "Argument '%s' has incorrect type (expected %s, got %s)",
8455 name, type->tp_name, Py_TYPE(obj)->tp_name);
8459 static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) {
8460 PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable");
8463 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
8464 PyObject *local_type, *local_value, *local_tb;
8465 PyObject *tmp_type, *tmp_value, *tmp_tb;
8466 PyThreadState *tstate = PyThreadState_GET();
8467 local_type = tstate->curexc_type;
8468 local_value = tstate->curexc_value;
8469 local_tb = tstate->curexc_traceback;
8470 tstate->curexc_type = 0;
8471 tstate->curexc_value = 0;
8472 tstate->curexc_traceback = 0;
8473 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
8474 if (unlikely(tstate->curexc_type))
8476 #if PY_MAJOR_VERSION >= 3
8477 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
8481 *value = local_value;
8483 Py_INCREF(local_type);
8484 Py_INCREF(local_value);
8485 Py_INCREF(local_tb);
8486 tmp_type = tstate->exc_type;
8487 tmp_value = tstate->exc_value;
8488 tmp_tb = tstate->exc_traceback;
8489 tstate->exc_type = local_type;
8490 tstate->exc_value = local_value;
8491 tstate->exc_traceback = local_tb;
8492 /* Make sure tstate is in a consistent state when we XDECREF
8493 these objects (XDECREF may run arbitrary code). */
8494 Py_XDECREF(tmp_type);
8495 Py_XDECREF(tmp_value);
8502 Py_XDECREF(local_type);
8503 Py_XDECREF(local_value);
8504 Py_XDECREF(local_tb);
8509 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
8510 PyThreadState *tstate = PyThreadState_GET();
8511 *type = tstate->exc_type;
8512 *value = tstate->exc_value;
8513 *tb = tstate->exc_traceback;
8519 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
8520 PyObject *tmp_type, *tmp_value, *tmp_tb;
8521 PyThreadState *tstate = PyThreadState_GET();
8522 tmp_type = tstate->exc_type;
8523 tmp_value = tstate->exc_value;
8524 tmp_tb = tstate->exc_traceback;
8525 tstate->exc_type = type;
8526 tstate->exc_value = value;
8527 tstate->exc_traceback = tb;
8528 Py_XDECREF(tmp_type);
8529 Py_XDECREF(tmp_value);
8533 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
8534 PyObject *py_import = 0;
8535 PyObject *empty_list = 0;
8536 PyObject *module = 0;
8537 PyObject *global_dict = 0;
8538 PyObject *empty_dict = 0;
8540 py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
8546 empty_list = PyList_New(0);
8551 global_dict = PyModule_GetDict(__pyx_m);
8554 empty_dict = PyDict_New();
8557 module = PyObject_CallFunctionObjArgs(py_import,
8558 name, global_dict, empty_dict, list, NULL);
8560 Py_XDECREF(empty_list);
8561 Py_XDECREF(py_import);
8562 Py_XDECREF(empty_dict);
8566 static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject* x) {
8567 const int32_t neg_one = (int32_t)-1, const_zero = (int32_t)0;
8568 const int is_unsigned = const_zero < neg_one;
8569 if (sizeof(int32_t) == sizeof(char)) {
8571 return (int32_t)__Pyx_PyInt_AsUnsignedChar(x);
8573 return (int32_t)__Pyx_PyInt_AsSignedChar(x);
8574 } else if (sizeof(int32_t) == sizeof(short)) {
8576 return (int32_t)__Pyx_PyInt_AsUnsignedShort(x);
8578 return (int32_t)__Pyx_PyInt_AsSignedShort(x);
8579 } else if (sizeof(int32_t) == sizeof(int)) {
8581 return (int32_t)__Pyx_PyInt_AsUnsignedInt(x);
8583 return (int32_t)__Pyx_PyInt_AsSignedInt(x);
8584 } else if (sizeof(int32_t) == sizeof(long)) {
8586 return (int32_t)__Pyx_PyInt_AsUnsignedLong(x);
8588 return (int32_t)__Pyx_PyInt_AsSignedLong(x);
8589 } else if (sizeof(int32_t) == sizeof(PY_LONG_LONG)) {
8591 return (int32_t)__Pyx_PyInt_AsUnsignedLongLong(x);
8593 return (int32_t)__Pyx_PyInt_AsSignedLongLong(x);
8596 PyObject *v = __Pyx_PyNumber_Int(x);
8597 #if PY_VERSION_HEX < 0x03000000
8598 if (likely(v) && !PyLong_Check(v)) {
8600 v = PyNumber_Long(tmp);
8605 int one = 1; int is_little = (int)*(unsigned char *)&one;
8606 unsigned char *bytes = (unsigned char *)&val;
8607 int ret = _PyLong_AsByteArray((PyLongObject *)v,
8609 is_little, !is_unsigned);
8618 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
8619 const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
8620 const int is_unsigned = neg_one > const_zero;
8621 if (sizeof(unsigned char) < sizeof(long)) {
8622 long val = __Pyx_PyInt_AsLong(x);
8623 if (unlikely(val != (long)(unsigned char)val)) {
8624 if (!unlikely(val == -1 && PyErr_Occurred())) {
8625 PyErr_SetString(PyExc_OverflowError,
8626 (is_unsigned && unlikely(val < 0)) ?
8627 "can't convert negative value to unsigned char" :
8628 "value too large to convert to unsigned char");
8630 return (unsigned char)-1;
8632 return (unsigned char)val;
8634 return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
8637 static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
8638 const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
8639 const int is_unsigned = neg_one > const_zero;
8640 if (sizeof(unsigned short) < sizeof(long)) {
8641 long val = __Pyx_PyInt_AsLong(x);
8642 if (unlikely(val != (long)(unsigned short)val)) {
8643 if (!unlikely(val == -1 && PyErr_Occurred())) {
8644 PyErr_SetString(PyExc_OverflowError,
8645 (is_unsigned && unlikely(val < 0)) ?
8646 "can't convert negative value to unsigned short" :
8647 "value too large to convert to unsigned short");
8649 return (unsigned short)-1;
8651 return (unsigned short)val;
8653 return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
8656 static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
8657 const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
8658 const int is_unsigned = neg_one > const_zero;
8659 if (sizeof(unsigned int) < sizeof(long)) {
8660 long val = __Pyx_PyInt_AsLong(x);
8661 if (unlikely(val != (long)(unsigned int)val)) {
8662 if (!unlikely(val == -1 && PyErr_Occurred())) {
8663 PyErr_SetString(PyExc_OverflowError,
8664 (is_unsigned && unlikely(val < 0)) ?
8665 "can't convert negative value to unsigned int" :
8666 "value too large to convert to unsigned int");
8668 return (unsigned int)-1;
8670 return (unsigned int)val;
8672 return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
8675 static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
8676 const char neg_one = (char)-1, const_zero = 0;
8677 const int is_unsigned = neg_one > const_zero;
8678 if (sizeof(char) < sizeof(long)) {
8679 long val = __Pyx_PyInt_AsLong(x);
8680 if (unlikely(val != (long)(char)val)) {
8681 if (!unlikely(val == -1 && PyErr_Occurred())) {
8682 PyErr_SetString(PyExc_OverflowError,
8683 (is_unsigned && unlikely(val < 0)) ?
8684 "can't convert negative value to char" :
8685 "value too large to convert to char");
8691 return (char)__Pyx_PyInt_AsLong(x);
8694 static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
8695 const short neg_one = (short)-1, const_zero = 0;
8696 const int is_unsigned = neg_one > const_zero;
8697 if (sizeof(short) < sizeof(long)) {
8698 long val = __Pyx_PyInt_AsLong(x);
8699 if (unlikely(val != (long)(short)val)) {
8700 if (!unlikely(val == -1 && PyErr_Occurred())) {
8701 PyErr_SetString(PyExc_OverflowError,
8702 (is_unsigned && unlikely(val < 0)) ?
8703 "can't convert negative value to short" :
8704 "value too large to convert to short");
8710 return (short)__Pyx_PyInt_AsLong(x);
8713 static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
8714 const int neg_one = (int)-1, const_zero = 0;
8715 const int is_unsigned = neg_one > const_zero;
8716 if (sizeof(int) < sizeof(long)) {
8717 long val = __Pyx_PyInt_AsLong(x);
8718 if (unlikely(val != (long)(int)val)) {
8719 if (!unlikely(val == -1 && PyErr_Occurred())) {
8720 PyErr_SetString(PyExc_OverflowError,
8721 (is_unsigned && unlikely(val < 0)) ?
8722 "can't convert negative value to int" :
8723 "value too large to convert to int");
8729 return (int)__Pyx_PyInt_AsLong(x);
8732 static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
8733 const signed char neg_one = (signed char)-1, const_zero = 0;
8734 const int is_unsigned = neg_one > const_zero;
8735 if (sizeof(signed char) < sizeof(long)) {
8736 long val = __Pyx_PyInt_AsLong(x);
8737 if (unlikely(val != (long)(signed char)val)) {
8738 if (!unlikely(val == -1 && PyErr_Occurred())) {
8739 PyErr_SetString(PyExc_OverflowError,
8740 (is_unsigned && unlikely(val < 0)) ?
8741 "can't convert negative value to signed char" :
8742 "value too large to convert to signed char");
8744 return (signed char)-1;
8746 return (signed char)val;
8748 return (signed char)__Pyx_PyInt_AsSignedLong(x);
8751 static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
8752 const signed short neg_one = (signed short)-1, const_zero = 0;
8753 const int is_unsigned = neg_one > const_zero;
8754 if (sizeof(signed short) < sizeof(long)) {
8755 long val = __Pyx_PyInt_AsLong(x);
8756 if (unlikely(val != (long)(signed short)val)) {
8757 if (!unlikely(val == -1 && PyErr_Occurred())) {
8758 PyErr_SetString(PyExc_OverflowError,
8759 (is_unsigned && unlikely(val < 0)) ?
8760 "can't convert negative value to signed short" :
8761 "value too large to convert to signed short");
8763 return (signed short)-1;
8765 return (signed short)val;
8767 return (signed short)__Pyx_PyInt_AsSignedLong(x);
8770 static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
8771 const signed int neg_one = (signed int)-1, const_zero = 0;
8772 const int is_unsigned = neg_one > const_zero;
8773 if (sizeof(signed int) < sizeof(long)) {
8774 long val = __Pyx_PyInt_AsLong(x);
8775 if (unlikely(val != (long)(signed int)val)) {
8776 if (!unlikely(val == -1 && PyErr_Occurred())) {
8777 PyErr_SetString(PyExc_OverflowError,
8778 (is_unsigned && unlikely(val < 0)) ?
8779 "can't convert negative value to signed int" :
8780 "value too large to convert to signed int");
8782 return (signed int)-1;
8784 return (signed int)val;
8786 return (signed int)__Pyx_PyInt_AsSignedLong(x);
8789 static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
8790 const int neg_one = (int)-1, const_zero = 0;
8791 const int is_unsigned = neg_one > const_zero;
8792 if (sizeof(int) < sizeof(long)) {
8793 long val = __Pyx_PyInt_AsLong(x);
8794 if (unlikely(val != (long)(int)val)) {
8795 if (!unlikely(val == -1 && PyErr_Occurred())) {
8796 PyErr_SetString(PyExc_OverflowError,
8797 (is_unsigned && unlikely(val < 0)) ?
8798 "can't convert negative value to int" :
8799 "value too large to convert to int");
8805 return (int)__Pyx_PyInt_AsLong(x);
8808 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
8809 const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
8810 const int is_unsigned = neg_one > const_zero;
8811 #if PY_VERSION_HEX < 0x03000000
8812 if (likely(PyInt_Check(x))) {
8813 long val = PyInt_AS_LONG(x);
8814 if (is_unsigned && unlikely(val < 0)) {
8815 PyErr_SetString(PyExc_OverflowError,
8816 "can't convert negative value to unsigned long");
8817 return (unsigned long)-1;
8819 return (unsigned long)val;
8822 if (likely(PyLong_Check(x))) {
8824 if (unlikely(Py_SIZE(x) < 0)) {
8825 PyErr_SetString(PyExc_OverflowError,
8826 "can't convert negative value to unsigned long");
8827 return (unsigned long)-1;
8829 return PyLong_AsUnsignedLong(x);
8831 return PyLong_AsLong(x);
8835 PyObject *tmp = __Pyx_PyNumber_Int(x);
8836 if (!tmp) return (unsigned long)-1;
8837 val = __Pyx_PyInt_AsUnsignedLong(tmp);
8843 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
8844 const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
8845 const int is_unsigned = neg_one > const_zero;
8846 #if PY_VERSION_HEX < 0x03000000
8847 if (likely(PyInt_Check(x))) {
8848 long val = PyInt_AS_LONG(x);
8849 if (is_unsigned && unlikely(val < 0)) {
8850 PyErr_SetString(PyExc_OverflowError,
8851 "can't convert negative value to unsigned PY_LONG_LONG");
8852 return (unsigned PY_LONG_LONG)-1;
8854 return (unsigned PY_LONG_LONG)val;
8857 if (likely(PyLong_Check(x))) {
8859 if (unlikely(Py_SIZE(x) < 0)) {
8860 PyErr_SetString(PyExc_OverflowError,
8861 "can't convert negative value to unsigned PY_LONG_LONG");
8862 return (unsigned PY_LONG_LONG)-1;
8864 return PyLong_AsUnsignedLongLong(x);
8866 return PyLong_AsLongLong(x);
8869 unsigned PY_LONG_LONG val;
8870 PyObject *tmp = __Pyx_PyNumber_Int(x);
8871 if (!tmp) return (unsigned PY_LONG_LONG)-1;
8872 val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
8878 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
8879 const long neg_one = (long)-1, const_zero = 0;
8880 const int is_unsigned = neg_one > const_zero;
8881 #if PY_VERSION_HEX < 0x03000000
8882 if (likely(PyInt_Check(x))) {
8883 long val = PyInt_AS_LONG(x);
8884 if (is_unsigned && unlikely(val < 0)) {
8885 PyErr_SetString(PyExc_OverflowError,
8886 "can't convert negative value to long");
8892 if (likely(PyLong_Check(x))) {
8894 if (unlikely(Py_SIZE(x) < 0)) {
8895 PyErr_SetString(PyExc_OverflowError,
8896 "can't convert negative value to long");
8899 return PyLong_AsUnsignedLong(x);
8901 return PyLong_AsLong(x);
8905 PyObject *tmp = __Pyx_PyNumber_Int(x);
8906 if (!tmp) return (long)-1;
8907 val = __Pyx_PyInt_AsLong(tmp);
8913 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
8914 const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
8915 const int is_unsigned = neg_one > const_zero;
8916 #if PY_VERSION_HEX < 0x03000000
8917 if (likely(PyInt_Check(x))) {
8918 long val = PyInt_AS_LONG(x);
8919 if (is_unsigned && unlikely(val < 0)) {
8920 PyErr_SetString(PyExc_OverflowError,
8921 "can't convert negative value to PY_LONG_LONG");
8922 return (PY_LONG_LONG)-1;
8924 return (PY_LONG_LONG)val;
8927 if (likely(PyLong_Check(x))) {
8929 if (unlikely(Py_SIZE(x) < 0)) {
8930 PyErr_SetString(PyExc_OverflowError,
8931 "can't convert negative value to PY_LONG_LONG");
8932 return (PY_LONG_LONG)-1;
8934 return PyLong_AsUnsignedLongLong(x);
8936 return PyLong_AsLongLong(x);
8940 PyObject *tmp = __Pyx_PyNumber_Int(x);
8941 if (!tmp) return (PY_LONG_LONG)-1;
8942 val = __Pyx_PyInt_AsLongLong(tmp);
8948 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
8949 const signed long neg_one = (signed long)-1, const_zero = 0;
8950 const int is_unsigned = neg_one > const_zero;
8951 #if PY_VERSION_HEX < 0x03000000
8952 if (likely(PyInt_Check(x))) {
8953 long val = PyInt_AS_LONG(x);
8954 if (is_unsigned && unlikely(val < 0)) {
8955 PyErr_SetString(PyExc_OverflowError,
8956 "can't convert negative value to signed long");
8957 return (signed long)-1;
8959 return (signed long)val;
8962 if (likely(PyLong_Check(x))) {
8964 if (unlikely(Py_SIZE(x) < 0)) {
8965 PyErr_SetString(PyExc_OverflowError,
8966 "can't convert negative value to signed long");
8967 return (signed long)-1;
8969 return PyLong_AsUnsignedLong(x);
8971 return PyLong_AsLong(x);
8975 PyObject *tmp = __Pyx_PyNumber_Int(x);
8976 if (!tmp) return (signed long)-1;
8977 val = __Pyx_PyInt_AsSignedLong(tmp);
8983 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
8984 const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
8985 const int is_unsigned = neg_one > const_zero;
8986 #if PY_VERSION_HEX < 0x03000000
8987 if (likely(PyInt_Check(x))) {
8988 long val = PyInt_AS_LONG(x);
8989 if (is_unsigned && unlikely(val < 0)) {
8990 PyErr_SetString(PyExc_OverflowError,
8991 "can't convert negative value to signed PY_LONG_LONG");
8992 return (signed PY_LONG_LONG)-1;
8994 return (signed PY_LONG_LONG)val;
8997 if (likely(PyLong_Check(x))) {
8999 if (unlikely(Py_SIZE(x) < 0)) {
9000 PyErr_SetString(PyExc_OverflowError,
9001 "can't convert negative value to signed PY_LONG_LONG");
9002 return (signed PY_LONG_LONG)-1;
9004 return PyLong_AsUnsignedLongLong(x);
9006 return PyLong_AsLongLong(x);
9009 signed PY_LONG_LONG val;
9010 PyObject *tmp = __Pyx_PyNumber_Int(x);
9011 if (!tmp) return (signed PY_LONG_LONG)-1;
9012 val = __Pyx_PyInt_AsSignedLongLong(tmp);
9018 #ifndef __PYX_HAVE_RT_ImportType
9019 #define __PYX_HAVE_RT_ImportType
9020 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
9021 long size, int strict)
9023 PyObject *py_module = 0;
9024 PyObject *result = 0;
9025 PyObject *py_name = 0;
9028 py_module = __Pyx_ImportModule(module_name);
9031 #if PY_MAJOR_VERSION < 3
9032 py_name = PyString_FromString(class_name);
9034 py_name = PyUnicode_FromString(class_name);
9038 result = PyObject_GetAttr(py_module, py_name);
9041 Py_DECREF(py_module);
9045 if (!PyType_Check(result)) {
9046 PyErr_Format(PyExc_TypeError,
9047 "%s.%s is not a type object",
9048 module_name, class_name);
9051 if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) {
9052 PyOS_snprintf(warning, sizeof(warning),
9053 "%s.%s size changed, may indicate binary incompatibility",
9054 module_name, class_name);
9055 #if PY_VERSION_HEX < 0x02050000
9056 PyErr_Warn(NULL, warning);
9058 PyErr_WarnEx(NULL, warning, 0);
9061 else if (((PyTypeObject *)result)->tp_basicsize != size) {
9062 PyErr_Format(PyExc_ValueError,
9063 "%s.%s has the wrong size, try recompiling",
9064 module_name, class_name);
9067 return (PyTypeObject *)result;
9069 Py_XDECREF(py_module);
9075 #ifndef __PYX_HAVE_RT_ImportModule
9076 #define __PYX_HAVE_RT_ImportModule
9077 static PyObject *__Pyx_ImportModule(const char *name) {
9078 PyObject *py_name = 0;
9079 PyObject *py_module = 0;
9081 #if PY_MAJOR_VERSION < 3
9082 py_name = PyString_FromString(name);
9084 py_name = PyUnicode_FromString(name);
9088 py_module = PyImport_Import(py_name);
9092 Py_XDECREF(py_name);
9097 static void* __Pyx_GetVtable(PyObject *dict) {
9099 PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__");
9102 #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
9103 ptr = PyCapsule_GetPointer(ob, 0);
9105 ptr = PyCObject_AsVoidPtr(ob);
9107 if (!ptr && !PyErr_Occurred())
9108 PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
9116 #include "compile.h"
9117 #include "frameobject.h"
9118 #include "traceback.h"
9120 static void __Pyx_AddTraceback(const char *funcname) {
9121 PyObject *py_srcfile = 0;
9122 PyObject *py_funcname = 0;
9123 PyObject *py_globals = 0;
9124 PyCodeObject *py_code = 0;
9125 PyFrameObject *py_frame = 0;
9127 #if PY_MAJOR_VERSION < 3
9128 py_srcfile = PyString_FromString(__pyx_filename);
9130 py_srcfile = PyUnicode_FromString(__pyx_filename);
9132 if (!py_srcfile) goto bad;
9133 if (__pyx_clineno) {
9134 #if PY_MAJOR_VERSION < 3
9135 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
9137 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
9141 #if PY_MAJOR_VERSION < 3
9142 py_funcname = PyString_FromString(funcname);
9144 py_funcname = PyUnicode_FromString(funcname);
9147 if (!py_funcname) goto bad;
9148 py_globals = PyModule_GetDict(__pyx_m);
9149 if (!py_globals) goto bad;
9150 py_code = PyCode_New(
9151 0, /*int argcount,*/
9152 #if PY_MAJOR_VERSION >= 3
9153 0, /*int kwonlyargcount,*/
9156 0, /*int stacksize,*/
9158 __pyx_empty_bytes, /*PyObject *code,*/
9159 __pyx_empty_tuple, /*PyObject *consts,*/
9160 __pyx_empty_tuple, /*PyObject *names,*/
9161 __pyx_empty_tuple, /*PyObject *varnames,*/
9162 __pyx_empty_tuple, /*PyObject *freevars,*/
9163 __pyx_empty_tuple, /*PyObject *cellvars,*/
9164 py_srcfile, /*PyObject *filename,*/
9165 py_funcname, /*PyObject *name,*/
9166 __pyx_lineno, /*int firstlineno,*/
9167 __pyx_empty_bytes /*PyObject *lnotab*/
9169 if (!py_code) goto bad;
9170 py_frame = PyFrame_New(
9171 PyThreadState_GET(), /*PyThreadState *tstate,*/
9172 py_code, /*PyCodeObject *code,*/
9173 py_globals, /*PyObject *globals,*/
9174 0 /*PyObject *locals*/
9176 if (!py_frame) goto bad;
9177 py_frame->f_lineno = __pyx_lineno;
9178 PyTraceBack_Here(py_frame);
9180 Py_XDECREF(py_srcfile);
9181 Py_XDECREF(py_funcname);
9182 Py_XDECREF(py_code);
9183 Py_XDECREF(py_frame);
9186 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
9188 #if PY_MAJOR_VERSION < 3
9189 if (t->is_unicode) {
9190 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
9191 } else if (t->intern) {
9192 *t->p = PyString_InternFromString(t->s);
9194 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
9196 #else /* Python 3+ has unicode identifiers */
9197 if (t->is_unicode | t->is_str) {
9199 *t->p = PyUnicode_InternFromString(t->s);
9200 } else if (t->encoding) {
9201 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
9203 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
9206 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
9216 /* Type Conversion Functions */
9218 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
9219 int is_true = x == Py_True;
9220 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
9221 else return PyObject_IsTrue(x);
9224 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
9226 const char *name = NULL;
9227 PyObject *res = NULL;
9228 #if PY_VERSION_HEX < 0x03000000
9229 if (PyInt_Check(x) || PyLong_Check(x))
9231 if (PyLong_Check(x))
9233 return Py_INCREF(x), x;
9234 m = Py_TYPE(x)->tp_as_number;
9235 #if PY_VERSION_HEX < 0x03000000
9236 if (m && m->nb_int) {
9238 res = PyNumber_Int(x);
9240 else if (m && m->nb_long) {
9242 res = PyNumber_Long(x);
9245 if (m && m->nb_int) {
9247 res = PyNumber_Long(x);
9251 #if PY_VERSION_HEX < 0x03000000
9252 if (!PyInt_Check(res) && !PyLong_Check(res)) {
9254 if (!PyLong_Check(res)) {
9256 PyErr_Format(PyExc_TypeError,
9257 "__%s__ returned non-%s (type %.200s)",
9258 name, name, Py_TYPE(res)->tp_name);
9263 else if (!PyErr_Occurred()) {
9264 PyErr_SetString(PyExc_TypeError,
9265 "an integer is required");
9270 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
9272 PyObject* x = PyNumber_Index(b);
9274 ival = PyInt_AsSsize_t(x);
9279 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
9280 #if PY_VERSION_HEX < 0x02050000
9281 if (ival <= LONG_MAX)
9282 return PyInt_FromLong((long)ival);
9284 unsigned char *bytes = (unsigned char *) &ival;
9285 int one = 1; int little = (int)*(unsigned char*)&one;
9286 return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
9289 return PyInt_FromSize_t(ival);
9293 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
9294 unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
9295 if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
9297 } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
9298 PyErr_SetString(PyExc_OverflowError,
9299 "value too large to convert to size_t");
9306 #endif /* Py_PYTHON_H */