1 /* Generated by Cython 0.17.1 on Tue Nov 20 16:47:00 2012 */
3 #define PY_SSIZE_T_CLEAN
6 #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02040000
8 #error Cython requires Python 2.4+.
10 #include <stddef.h> /* For offsetof */
12 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
14 #if !defined(WIN32) && !defined(MS_WINDOWS)
26 #define DL_IMPORT(t) t
29 #define DL_EXPORT(t) t
32 #define PY_LONG_LONG LONG_LONG
35 #define Py_HUGE_VAL HUGE_VAL
38 #define CYTHON_COMPILING_IN_PYPY 1
39 #define CYTHON_COMPILING_IN_CPYTHON 0
41 #define CYTHON_COMPILING_IN_PYPY 0
42 #define CYTHON_COMPILING_IN_CPYTHON 1
44 #if PY_VERSION_HEX < 0x02050000
45 typedef int Py_ssize_t;
46 #define PY_SSIZE_T_MAX INT_MAX
47 #define PY_SSIZE_T_MIN INT_MIN
48 #define PY_FORMAT_SIZE_T ""
49 #define CYTHON_FORMAT_SSIZE_T ""
50 #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
51 #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o)
52 #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
53 (PyErr_Format(PyExc_TypeError, \
54 "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
56 #define PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o))
57 #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
58 #define __PYX_BUILD_PY_SSIZE_T "i"
60 #define __PYX_BUILD_PY_SSIZE_T "n"
61 #define CYTHON_FORMAT_SSIZE_T "z"
63 #if PY_VERSION_HEX < 0x02060000
64 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
65 #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
66 #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
67 #define PyVarObject_HEAD_INIT(type, size) \
68 PyObject_HEAD_INIT(type) size,
69 #define PyType_Modified(t)
80 Py_ssize_t *suboffsets;
83 #define PyBUF_SIMPLE 0
84 #define PyBUF_WRITABLE 0x0001
85 #define PyBUF_FORMAT 0x0004
86 #define PyBUF_ND 0x0008
87 #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
88 #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
89 #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
90 #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
91 #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
92 #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
93 #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
94 typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
95 typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
97 #if PY_MAJOR_VERSION < 3
98 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
99 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
100 PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
102 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
103 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
104 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
106 #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
107 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
109 #if PY_MAJOR_VERSION >= 3
110 #define Py_TPFLAGS_CHECKTYPES 0
111 #define Py_TPFLAGS_HAVE_INDEX 0
113 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
114 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
116 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
117 #define CYTHON_PEP393_ENABLED 1
118 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
119 0 : _PyUnicode_Ready((PyObject *)(op)))
120 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
121 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
122 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
124 #define CYTHON_PEP393_ENABLED 0
125 #define __Pyx_PyUnicode_READY(op) (0)
126 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
127 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
128 #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
130 #if PY_MAJOR_VERSION >= 3
131 #define PyBaseString_Type PyUnicode_Type
132 #define PyStringObject PyUnicodeObject
133 #define PyString_Type PyUnicode_Type
134 #define PyString_Check PyUnicode_Check
135 #define PyString_CheckExact PyUnicode_CheckExact
137 #if PY_VERSION_HEX < 0x02060000
138 #define PyBytesObject PyStringObject
139 #define PyBytes_Type PyString_Type
140 #define PyBytes_Check PyString_Check
141 #define PyBytes_CheckExact PyString_CheckExact
142 #define PyBytes_FromString PyString_FromString
143 #define PyBytes_FromStringAndSize PyString_FromStringAndSize
144 #define PyBytes_FromFormat PyString_FromFormat
145 #define PyBytes_DecodeEscape PyString_DecodeEscape
146 #define PyBytes_AsString PyString_AsString
147 #define PyBytes_AsStringAndSize PyString_AsStringAndSize
148 #define PyBytes_Size PyString_Size
149 #define PyBytes_AS_STRING PyString_AS_STRING
150 #define PyBytes_GET_SIZE PyString_GET_SIZE
151 #define PyBytes_Repr PyString_Repr
152 #define PyBytes_Concat PyString_Concat
153 #define PyBytes_ConcatAndDel PyString_ConcatAndDel
155 #if PY_VERSION_HEX < 0x02060000
156 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
157 #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
159 #ifndef PySet_CheckExact
160 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
162 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
163 #if PY_MAJOR_VERSION >= 3
164 #define PyIntObject PyLongObject
165 #define PyInt_Type PyLong_Type
166 #define PyInt_Check(op) PyLong_Check(op)
167 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
168 #define PyInt_FromString PyLong_FromString
169 #define PyInt_FromUnicode PyLong_FromUnicode
170 #define PyInt_FromLong PyLong_FromLong
171 #define PyInt_FromSize_t PyLong_FromSize_t
172 #define PyInt_FromSsize_t PyLong_FromSsize_t
173 #define PyInt_AsLong PyLong_AsLong
174 #define PyInt_AS_LONG PyLong_AS_LONG
175 #define PyInt_AsSsize_t PyLong_AsSsize_t
176 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
177 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
179 #if PY_MAJOR_VERSION >= 3
180 #define PyBoolObject PyLongObject
182 #if PY_VERSION_HEX < 0x03020000
183 typedef long Py_hash_t;
184 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
185 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
187 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
188 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
190 #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
191 #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
192 #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
193 #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
195 #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
196 (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
197 (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
198 (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
199 #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
200 (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
201 (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
202 (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
203 #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
204 (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
205 (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
206 (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
208 #if PY_MAJOR_VERSION >= 3
209 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
211 #if PY_VERSION_HEX < 0x02050000
212 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
213 #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
214 #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
216 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
217 #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
218 #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
220 #if PY_VERSION_HEX < 0x02050000
221 #define __Pyx_NAMESTR(n) ((char *)(n))
222 #define __Pyx_DOCSTR(n) ((char *)(n))
224 #define __Pyx_NAMESTR(n) (n)
225 #define __Pyx_DOCSTR(n) (n)
229 #if PY_MAJOR_VERSION >= 3
230 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
231 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
233 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
234 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
237 #ifndef __PYX_EXTERN_C
239 #define __PYX_EXTERN_C extern "C"
241 #define __PYX_EXTERN_C extern
245 #if defined(WIN32) || defined(MS_WINDOWS)
246 #define _USE_MATH_DEFINES
249 #define __PYX_HAVE__ctabix
250 #define __PYX_HAVE_API__ctabix
255 #include "sys/types.h"
256 #include "sys/stat.h"
262 #include "pythread.h"
267 #ifdef PYREX_WITHOUT_ASSERTIONS
268 #define CYTHON_WITHOUT_ASSERTIONS
272 /* inline attribute */
273 #ifndef CYTHON_INLINE
274 #if defined(__GNUC__)
275 #define CYTHON_INLINE __inline__
276 #elif defined(_MSC_VER)
277 #define CYTHON_INLINE __inline
278 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
279 #define CYTHON_INLINE inline
281 #define CYTHON_INLINE
285 /* unused attribute */
286 #ifndef CYTHON_UNUSED
287 # if defined(__GNUC__)
288 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
289 # define CYTHON_UNUSED __attribute__ ((__unused__))
291 # define CYTHON_UNUSED
293 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
294 # define CYTHON_UNUSED __attribute__ ((__unused__))
296 # define CYTHON_UNUSED
300 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*/
303 /* Type Conversion Predeclarations */
305 #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
306 #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
308 #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
309 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
310 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
311 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
313 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
314 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
315 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
317 #if CYTHON_COMPILING_IN_CPYTHON
318 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
320 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
322 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
325 /* Test for GCC > 2.95 */
326 #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
327 #define likely(x) __builtin_expect(!!(x), 1)
328 #define unlikely(x) __builtin_expect(!!(x), 0)
329 #else /* __GNUC__ > 2 ... */
330 #define likely(x) (x)
331 #define unlikely(x) (x)
332 #endif /* __GNUC__ > 2 ... */
334 #define likely(x) (x)
335 #define unlikely(x) (x)
336 #endif /* __GNUC__ */
338 static PyObject *__pyx_m;
339 static PyObject *__pyx_b;
340 static PyObject *__pyx_empty_tuple;
341 static PyObject *__pyx_empty_bytes;
342 static int __pyx_lineno;
343 static int __pyx_clineno = 0;
344 static const char * __pyx_cfilenm= __FILE__;
345 static const char *__pyx_filename;
348 static const char *__pyx_f[] = {
356 /*--- Type declarations ---*/
357 struct __pyx_obj_6ctabix_Parser;
358 struct __pyx_obj_6ctabix_asVCF;
359 struct __pyx_obj_10TabProxies_TupleProxy;
360 struct __pyx_obj_10TabProxies_NamedTupleProxy;
361 struct __pyx_obj_10TabProxies_BedProxy;
362 struct __pyx_obj_6ctabix_tabix_copy_iterator;
363 struct __pyx_obj_10TabProxies_VCFProxy;
364 struct __pyx_obj_10TabProxies_GTFProxy;
365 struct __pyx_obj_6ctabix_TabixIterator;
366 struct __pyx_obj_6ctabix_TabixIteratorParsed;
367 struct __pyx_obj_6ctabix_TabixHeaderIterator;
368 struct __pyx_obj_6ctabix_Tabixfile;
369 struct __pyx_obj_6ctabix_asGTF;
370 struct __pyx_obj_6ctabix_asBed;
371 struct __pyx_obj_6ctabix_tabix_inplace_iterator;
372 struct __pyx_obj_6ctabix_asTuple;
375 * cdef tabix_t * tabixfile
377 * cdef class Parser: # <<<<<<<<<<<<<<
381 struct __pyx_obj_6ctabix_Parser {
389 * cdef class asVCF(Parser): # <<<<<<<<<<<<<<
393 struct __pyx_obj_6ctabix_asVCF {
394 struct __pyx_obj_6ctabix_Parser __pyx_base;
398 /* "TabProxies.pxd":41
399 * ctypedef int uint64_t
401 * cdef class TupleProxy: # <<<<<<<<<<<<<<
405 struct __pyx_obj_10TabProxies_TupleProxy {
407 struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtab;
418 /* "TabProxies.pxd":69
419 * cdef char * getAttributes( self )
421 * cdef class NamedTupleProxy( TupleProxy) : # <<<<<<<<<<<<<<
425 struct __pyx_obj_10TabProxies_NamedTupleProxy {
426 struct __pyx_obj_10TabProxies_TupleProxy __pyx_base;
430 /* "TabProxies.pxd":72
433 * cdef class BedProxy( NamedTupleProxy) : # <<<<<<<<<<<<<<
437 struct __pyx_obj_10TabProxies_BedProxy {
438 struct __pyx_obj_10TabProxies_NamedTupleProxy __pyx_base;
447 * cdef __cnext__(self)
449 * ctypedef class tabix_copy_iterator: # <<<<<<<<<<<<<<
453 struct __pyx_obj_6ctabix_tabix_copy_iterator {
455 struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator *__pyx_vtab;
457 struct __pyx_obj_6ctabix_Parser *parser;
461 /* "TabProxies.pxd":83
462 * cdef update( self, char * buffer, size_t nbytes )
464 * cdef class VCFProxy( NamedTupleProxy) : # <<<<<<<<<<<<<<
468 struct __pyx_obj_10TabProxies_VCFProxy {
469 struct __pyx_obj_10TabProxies_NamedTupleProxy __pyx_base;
475 /* "TabProxies.pxd":60
476 * cdef update( self, char * buffer, size_t nbytes )
478 * cdef class GTFProxy( TupleProxy) : # <<<<<<<<<<<<<<
482 struct __pyx_obj_10TabProxies_GTFProxy {
483 struct __pyx_obj_10TabProxies_TupleProxy __pyx_base;
485 int hasOwnAttributes;
490 * cdef char * _filename
492 * cdef class TabixIterator: # <<<<<<<<<<<<<<
493 * cdef ti_iter_t iterator
494 * cdef tabix_t * tabixfile
496 struct __pyx_obj_6ctabix_TabixIterator {
506 * cdef class TabixIteratorParsed: # <<<<<<<<<<<<<<
507 * cdef ti_iter_t iterator
508 * cdef tabix_t * tabixfile
510 struct __pyx_obj_6ctabix_TabixIteratorParsed {
514 struct __pyx_obj_6ctabix_Parser *parser;
519 * cdef tabix_t * tabixfile
521 * cdef class TabixHeaderIterator: # <<<<<<<<<<<<<<
522 * cdef ti_iter_t iterator
523 * cdef tabix_t * tabixfile
525 struct __pyx_obj_6ctabix_TabixHeaderIterator {
533 * # char *ti_iter_read(BGZF *fp, ti_iter_t iter, int *len)
535 * cdef class Tabixfile: # <<<<<<<<<<<<<<
537 * # pointer to tabixfile
539 struct __pyx_obj_6ctabix_Tabixfile {
550 * cdef class asGTF(Parser): # <<<<<<<<<<<<<<
554 struct __pyx_obj_6ctabix_asGTF {
555 struct __pyx_obj_6ctabix_Parser __pyx_base;
562 * cdef class asBed(Parser): # <<<<<<<<<<<<<<
566 struct __pyx_obj_6ctabix_asBed {
567 struct __pyx_obj_6ctabix_Parser __pyx_base;
574 * ctypedef class tabix_inplace_iterator: # <<<<<<<<<<<<<<
578 struct __pyx_obj_6ctabix_tabix_inplace_iterator {
580 struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator *__pyx_vtab;
584 struct __pyx_obj_6ctabix_Parser *parser;
591 * cdef class asTuple(Parser): # <<<<<<<<<<<<<<
595 struct __pyx_obj_6ctabix_asTuple {
596 struct __pyx_obj_6ctabix_Parser __pyx_base;
602 * return self.__cnext__()
604 * ctypedef class tabix_copy_iterator: # <<<<<<<<<<<<<<
605 * '''iterate over ``infile``.
609 struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator {
610 PyObject *(*__pyx___cnext__)(struct __pyx_obj_6ctabix_tabix_copy_iterator *);
612 static struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator *__pyx_vtabptr_6ctabix_tabix_copy_iterator;
615 /* "TabProxies.pxd":41
616 * ctypedef int uint64_t
618 * cdef class TupleProxy: # <<<<<<<<<<<<<<
623 struct __pyx_vtabstruct_10TabProxies_TupleProxy {
624 int (*getMaxFields)(struct __pyx_obj_10TabProxies_TupleProxy *, size_t);
625 PyObject *(*take)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t);
626 PyObject *(*present)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t);
627 PyObject *(*copy)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t);
628 PyObject *(*update)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t);
630 static struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtabptr_10TabProxies_TupleProxy;
633 /* "TabProxies.pxd":69
634 * cdef char * getAttributes( self )
636 * cdef class NamedTupleProxy( TupleProxy) : # <<<<<<<<<<<<<<
641 struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy {
642 struct __pyx_vtabstruct_10TabProxies_TupleProxy __pyx_base;
644 static struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy *__pyx_vtabptr_10TabProxies_NamedTupleProxy;
647 /* "TabProxies.pxd":83
648 * cdef update( self, char * buffer, size_t nbytes )
650 * cdef class VCFProxy( NamedTupleProxy) : # <<<<<<<<<<<<<<
655 struct __pyx_vtabstruct_10TabProxies_VCFProxy {
656 struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy __pyx_base;
658 static struct __pyx_vtabstruct_10TabProxies_VCFProxy *__pyx_vtabptr_10TabProxies_VCFProxy;
661 /* "TabProxies.pxd":60
662 * cdef update( self, char * buffer, size_t nbytes )
664 * cdef class GTFProxy( TupleProxy) : # <<<<<<<<<<<<<<
669 struct __pyx_vtabstruct_10TabProxies_GTFProxy {
670 struct __pyx_vtabstruct_10TabProxies_TupleProxy __pyx_base;
671 char *(*getAttributes)(struct __pyx_obj_10TabProxies_GTFProxy *);
673 static struct __pyx_vtabstruct_10TabProxies_GTFProxy *__pyx_vtabptr_10TabProxies_GTFProxy;
676 /* "TabProxies.pxd":72
679 * cdef class BedProxy( NamedTupleProxy) : # <<<<<<<<<<<<<<
684 struct __pyx_vtabstruct_10TabProxies_BedProxy {
685 struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy __pyx_base;
687 static struct __pyx_vtabstruct_10TabProxies_BedProxy *__pyx_vtabptr_10TabProxies_BedProxy;
691 * ## Iterators for parsing through unindexed files.
692 * #########################################################
693 * ctypedef class tabix_inplace_iterator: # <<<<<<<<<<<<<<
694 * '''iterate over ``infile``.
698 struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator {
699 PyObject *(*__pyx___cnext__)(struct __pyx_obj_6ctabix_tabix_inplace_iterator *);
701 static struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator *__pyx_vtabptr_6ctabix_tabix_inplace_iterator;
702 #ifndef CYTHON_REFNANNY
703 #define CYTHON_REFNANNY 0
707 void (*INCREF)(void*, PyObject*, int);
708 void (*DECREF)(void*, PyObject*, int);
709 void (*GOTREF)(void*, PyObject*, int);
710 void (*GIVEREF)(void*, PyObject*, int);
711 void* (*SetupContext)(const char*, int, const char*);
712 void (*FinishContext)(void**);
713 } __Pyx_RefNannyAPIStruct;
714 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
715 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
716 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
718 #define __Pyx_RefNannySetupContext(name, acquire_gil) \
720 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
721 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
722 PyGILState_Release(__pyx_gilstate_save); \
724 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
727 #define __Pyx_RefNannySetupContext(name, acquire_gil) \
728 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
730 #define __Pyx_RefNannyFinishContext() \
731 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
732 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
733 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
734 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
735 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
736 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
737 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
738 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
739 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
741 #define __Pyx_RefNannyDeclarations
742 #define __Pyx_RefNannySetupContext(name, acquire_gil)
743 #define __Pyx_RefNannyFinishContext()
744 #define __Pyx_INCREF(r) Py_INCREF(r)
745 #define __Pyx_DECREF(r) Py_DECREF(r)
746 #define __Pyx_GOTREF(r)
747 #define __Pyx_GIVEREF(r)
748 #define __Pyx_XINCREF(r) Py_XINCREF(r)
749 #define __Pyx_XDECREF(r) Py_XDECREF(r)
750 #define __Pyx_XGOTREF(r)
751 #define __Pyx_XGIVEREF(r)
752 #endif /* CYTHON_REFNANNY */
753 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
754 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
756 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
758 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
759 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
760 const char* encoding, const char* errors,
761 PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
763 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
764 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
766 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
770 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
772 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
773 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
774 const char* function_name); /*proto*/
776 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
777 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
779 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
782 r = PyObject_GetItem(o, j);
786 #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
787 __Pyx_GetItemInt_List_Fast(o, i) : \
788 __Pyx_GetItemInt_Generic(o, to_py_func(i)))
789 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
790 #if CYTHON_COMPILING_IN_CPYTHON
791 if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
792 PyObject *r = PyList_GET_ITEM(o, i);
796 else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
797 PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
801 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
803 return PySequence_GetItem(o, i);
806 #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
807 __Pyx_GetItemInt_Tuple_Fast(o, i) : \
808 __Pyx_GetItemInt_Generic(o, to_py_func(i)))
809 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
810 #if CYTHON_COMPILING_IN_CPYTHON
811 if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
812 PyObject *r = PyTuple_GET_ITEM(o, i);
816 else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
817 PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
821 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
823 return PySequence_GetItem(o, i);
826 #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
827 __Pyx_GetItemInt_Fast(o, i) : \
828 __Pyx_GetItemInt_Generic(o, to_py_func(i)))
829 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
830 #if CYTHON_COMPILING_IN_CPYTHON
831 if (PyList_CheckExact(o)) {
832 Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
833 if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
834 PyObject *r = PyList_GET_ITEM(o, n);
839 else if (PyTuple_CheckExact(o)) {
840 Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
841 if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
842 PyObject *r = PyTuple_GET_ITEM(o, n);
846 } else { /* inlined PySequence_GetItem() */
847 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
848 if (likely(m && m->sq_item)) {
849 if (unlikely(i < 0) && likely(m->sq_length)) {
850 Py_ssize_t l = m->sq_length(o);
851 if (unlikely(l < 0)) return NULL;
854 return m->sq_item(o, i);
858 if (PySequence_Check(o)) {
859 return PySequence_GetItem(o, i);
862 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
865 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
867 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
869 static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
871 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
873 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
874 const char *name, int exact); /*proto*/
876 #if PY_MAJOR_VERSION >= 3
877 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
879 value = PyDict_GetItemWithError(d, key);
880 if (unlikely(!value)) {
881 if (!PyErr_Occurred())
882 PyErr_SetObject(PyExc_KeyError, key);
889 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
892 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
894 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
895 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
897 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
899 static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
901 static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
902 PyObject *modname); /*proto*/
904 #define __Pyx_CyFunction_USED 1
905 #include <structmember.h>
906 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
907 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
908 #define __Pyx_CYFUNCTION_CCLASS 0x04
909 #define __Pyx_CyFunction_GetClosure(f) \
910 (((__pyx_CyFunctionObject *) (f))->func_closure)
911 #define __Pyx_CyFunction_GetClassObj(f) \
912 (((__pyx_CyFunctionObject *) (f))->func_classobj)
913 #define __Pyx_CyFunction_Defaults(type, f) \
914 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
915 #define __Pyx_CyFunction_SetDefaultsGetter(f, g) \
916 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
918 PyCFunctionObject func;
921 PyObject *func_weakreflist;
925 PyObject *func_closure;
926 PyObject *func_classobj; /* No-args super() class cell */
928 int defaults_pyobjects;
929 PyObject *defaults_tuple; /* Const defaults tuple */
930 PyObject *(*defaults_getter)(PyObject *);
931 } __pyx_CyFunctionObject;
932 static PyTypeObject *__pyx_CyFunctionType = 0;
933 #define __Pyx_CyFunction_NewEx(ml, flags, self, module, code) \
934 __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, self, module, code)
935 static PyObject *__Pyx_CyFunction_New(PyTypeObject *,
936 PyMethodDef *ml, int flags,
937 PyObject *self, PyObject *module,
939 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
942 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
944 static int __Pyx_CyFunction_init(void);
946 static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject *);
948 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
950 static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
952 static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
954 static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
956 static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
958 static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
960 static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
962 static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
964 static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
966 static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
968 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
970 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
972 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
974 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
976 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
978 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
980 static int __Pyx_check_binary_version(void);
982 static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
984 #if !defined(__Pyx_PyIdentifier_FromString)
985 #if PY_MAJOR_VERSION < 3
986 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
988 #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
992 static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
994 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/
996 static void* __Pyx_GetVtable(PyObject *dict); /*proto*/
1000 PyCodeObject* code_object;
1001 } __Pyx_CodeObjectCacheEntry;
1002 struct __Pyx_CodeObjectCache {
1005 __Pyx_CodeObjectCacheEntry* entries;
1007 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1008 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1009 static PyCodeObject *__pyx_find_code_object(int code_line);
1010 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1012 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1013 int py_line, const char *filename); /*proto*/
1015 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
1018 /* Module declarations from 'TabProxies' */
1019 static PyTypeObject *__pyx_ptype_10TabProxies_TupleProxy = 0;
1020 static PyTypeObject *__pyx_ptype_10TabProxies_GTFProxy = 0;
1021 static PyTypeObject *__pyx_ptype_10TabProxies_NamedTupleProxy = 0;
1022 static PyTypeObject *__pyx_ptype_10TabProxies_BedProxy = 0;
1023 static PyTypeObject *__pyx_ptype_10TabProxies_VCFProxy = 0;
1025 /* Module declarations from 'cpython.version' */
1027 /* Module declarations from 'cpython.ref' */
1029 /* Module declarations from 'cpython.exc' */
1031 /* Module declarations from 'cpython.module' */
1033 /* Module declarations from 'cpython.mem' */
1035 /* Module declarations from 'cpython.tuple' */
1037 /* Module declarations from 'cpython.list' */
1039 /* Module declarations from 'libc.stdio' */
1041 /* Module declarations from 'cpython.object' */
1043 /* Module declarations from 'cpython.sequence' */
1045 /* Module declarations from 'cpython.mapping' */
1047 /* Module declarations from 'cpython.iterator' */
1049 /* Module declarations from '__builtin__' */
1051 /* Module declarations from 'cpython.type' */
1052 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1054 /* Module declarations from 'cpython.number' */
1056 /* Module declarations from 'cpython.int' */
1058 /* Module declarations from '__builtin__' */
1060 /* Module declarations from 'cpython.bool' */
1061 static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
1063 /* Module declarations from 'cpython.long' */
1065 /* Module declarations from 'cpython.float' */
1067 /* Module declarations from '__builtin__' */
1069 /* Module declarations from 'cpython.complex' */
1070 static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
1072 /* Module declarations from 'cpython.string' */
1074 /* Module declarations from 'cpython.unicode' */
1076 /* Module declarations from 'cpython.dict' */
1078 /* Module declarations from 'cpython.instance' */
1080 /* Module declarations from 'cpython.function' */
1082 /* Module declarations from 'cpython.method' */
1084 /* Module declarations from 'cpython.weakref' */
1086 /* Module declarations from 'cpython.getargs' */
1088 /* Module declarations from 'cpython.pythread' */
1090 /* Module declarations from 'cpython.pystate' */
1092 /* Module declarations from 'cpython.cobject' */
1094 /* Module declarations from 'cpython.oldbuffer' */
1096 /* Module declarations from 'cpython.set' */
1098 /* Module declarations from 'cpython.buffer' */
1100 /* Module declarations from 'cpython.bytes' */
1102 /* Module declarations from 'cpython.pycapsule' */
1104 /* Module declarations from 'cpython' */
1106 /* Module declarations from 'ctabix' */
1107 static PyTypeObject *__pyx_ptype_6ctabix_Tabixfile = 0;
1108 static PyTypeObject *__pyx_ptype_6ctabix_TabixIterator = 0;
1109 static PyTypeObject *__pyx_ptype_6ctabix_TabixHeaderIterator = 0;
1110 static PyTypeObject *__pyx_ptype_6ctabix_Parser = 0;
1111 static PyTypeObject *__pyx_ptype_6ctabix_asTuple = 0;
1112 static PyTypeObject *__pyx_ptype_6ctabix_asGTF = 0;
1113 static PyTypeObject *__pyx_ptype_6ctabix_asBed = 0;
1114 static PyTypeObject *__pyx_ptype_6ctabix_asVCF = 0;
1115 static PyTypeObject *__pyx_ptype_6ctabix_TabixIteratorParsed = 0;
1116 static PyTypeObject *__pyx_ptype_6ctabix_tabix_inplace_iterator = 0;
1117 static PyTypeObject *__pyx_ptype_6ctabix_tabix_copy_iterator = 0;
1118 static PyObject *__pyx_v_6ctabix__FILENAME_ENCODING = 0;
1119 static PyObject *__pyx_f_6ctabix__my_encodeFilename(PyObject *); /*proto*/
1120 static PyObject *__pyx_f_6ctabix__force_bytes(PyObject *); /*proto*/
1121 static PyObject *__pyx_f_6ctabix__charptr_to_str(char *); /*proto*/
1122 #define __Pyx_MODULE_NAME "ctabix"
1123 int __pyx_module_is_main_ctabix = 0;
1125 /* Implementation of 'ctabix' */
1126 static PyObject *__pyx_builtin_TypeError;
1127 static PyObject *__pyx_builtin_NotImplementedError;
1128 static PyObject *__pyx_builtin_IOError;
1129 static PyObject *__pyx_builtin_ValueError;
1130 static PyObject *__pyx_builtin_StopIteration;
1131 static PyObject *__pyx_builtin_OSError;
1132 static PyObject *__pyx_builtin_ord;
1133 static PyObject *__pyx_builtin_KeyError;
1134 static PyObject *__pyx_builtin_MemoryError;
1135 static int __pyx_pf_6ctabix_9Tabixfile___cinit__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
1136 static PyObject *__pyx_pf_6ctabix_9Tabixfile_2_isOpen(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self); /* proto */
1137 static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode); /* proto */
1138 static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region); /* proto */
1139 static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region, PyObject *__pyx_v_parser); /* proto */
1140 static PyObject *__pyx_pf_6ctabix_9Tabixfile_8filename___get__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self); /* proto */
1141 static PyObject *__pyx_pf_6ctabix_9Tabixfile_6header___get__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self); /* proto */
1142 static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self); /* proto */
1143 static PyObject *__pyx_pf_6ctabix_9Tabixfile_10close(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self); /* proto */
1144 static void __pyx_pf_6ctabix_9Tabixfile_12__dealloc__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self); /* proto */
1145 static int __pyx_pf_6ctabix_13TabixIterator___cinit__(struct __pyx_obj_6ctabix_TabixIterator *__pyx_v_self, struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end); /* proto */
1146 static PyObject *__pyx_pf_6ctabix_13TabixIterator_2__iter__(struct __pyx_obj_6ctabix_TabixIterator *__pyx_v_self); /* proto */
1147 static PyObject *__pyx_pf_6ctabix_13TabixIterator_4__next__(struct __pyx_obj_6ctabix_TabixIterator *__pyx_v_self); /* proto */
1148 static void __pyx_pf_6ctabix_13TabixIterator_6__dealloc__(struct __pyx_obj_6ctabix_TabixIterator *__pyx_v_self); /* proto */
1149 static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(struct __pyx_obj_6ctabix_TabixHeaderIterator *__pyx_v_self, struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile); /* proto */
1150 static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_2__iter__(struct __pyx_obj_6ctabix_TabixHeaderIterator *__pyx_v_self); /* proto */
1151 static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_4__next__(struct __pyx_obj_6ctabix_TabixHeaderIterator *__pyx_v_self); /* proto */
1152 static void __pyx_pf_6ctabix_19TabixHeaderIterator_6__dealloc__(struct __pyx_obj_6ctabix_TabixHeaderIterator *__pyx_v_self); /* proto */
1153 static PyObject *__pyx_pf_6ctabix_7asTuple___call__(CYTHON_UNUSED struct __pyx_obj_6ctabix_asTuple *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len); /* proto */
1154 static PyObject *__pyx_pf_6ctabix_5asGTF___call__(CYTHON_UNUSED struct __pyx_obj_6ctabix_asGTF *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len); /* proto */
1155 static PyObject *__pyx_pf_6ctabix_5asBed___call__(CYTHON_UNUSED struct __pyx_obj_6ctabix_asBed *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len); /* proto */
1156 static PyObject *__pyx_pf_6ctabix_5asVCF___call__(CYTHON_UNUSED struct __pyx_obj_6ctabix_asVCF *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len); /* proto */
1157 static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_obj_6ctabix_TabixIteratorParsed *__pyx_v_self, struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end, struct __pyx_obj_6ctabix_Parser *__pyx_v_parser); /* proto */
1158 static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_2__iter__(struct __pyx_obj_6ctabix_TabixIteratorParsed *__pyx_v_self); /* proto */
1159 static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_4__next__(struct __pyx_obj_6ctabix_TabixIteratorParsed *__pyx_v_self); /* proto */
1160 static void __pyx_pf_6ctabix_19TabixIteratorParsed_6__dealloc__(struct __pyx_obj_6ctabix_TabixIteratorParsed *__pyx_v_self); /* proto */
1161 static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename_in, PyObject *__pyx_v_filename_out, PyObject *__pyx_v_force); /* proto */
1162 static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_force, PyObject *__pyx_v_seq_col, PyObject *__pyx_v_start_col, PyObject *__pyx_v_end_col, PyObject *__pyx_v_preset, PyObject *__pyx_v_meta_char, PyObject *__pyx_v_zerobased); /* proto */
1163 static int __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self, PyObject *__pyx_v_infile, int __pyx_v_buffer_size); /* proto */
1164 static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_2__iter__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self); /* proto */
1165 static void __pyx_pf_6ctabix_22tabix_inplace_iterator_4__dealloc__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self); /* proto */
1166 static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_6__next__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self); /* proto */
1167 static int __pyx_pf_6ctabix_19tabix_copy_iterator___cinit__(struct __pyx_obj_6ctabix_tabix_copy_iterator *__pyx_v_self, PyObject *__pyx_v_infile, struct __pyx_obj_6ctabix_Parser *__pyx_v_parser); /* proto */
1168 static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_2__iter__(struct __pyx_obj_6ctabix_tabix_copy_iterator *__pyx_v_self); /* proto */
1169 static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_4__next__(struct __pyx_obj_6ctabix_tabix_copy_iterator *__pyx_v_self); /* proto */
1170 static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_infile, PyObject *__pyx_v_parser); /* proto */
1171 static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_2__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
1172 static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
1173 static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_6next(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
1174 static PyObject *__pyx_pf_6ctabix_4tabix_iterator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_infile, PyObject *__pyx_v_parser); /* proto */
1175 static char __pyx_k_1[] = "Argument must be string or unicode.";
1176 static char __pyx_k_3[] = "Argument must be string, bytes or unicode.";
1177 static char __pyx_k_5[] = "invalid file opening mode `%s`";
1178 static char __pyx_k_6[] = ".tbi";
1179 static char __pyx_k_7[] = "http:";
1180 static char __pyx_k_9[] = "ftp:";
1181 static char __pyx_k_12[] = "writing to tabix files not implemented";
1182 static char __pyx_k_14[] = "file `%s` not found";
1183 static char __pyx_k_15[] = "index `%s` not found";
1184 static char __pyx_k_16[] = "could not open file `%s`";
1185 static char __pyx_k_17[] = "%s:%i-%i";
1186 static char __pyx_k_18[] = "invalid region `%s`";
1187 static char __pyx_k_19[] = "invalid region: start (%i) > end (%i)";
1188 static char __pyx_k_20[] = "start out of range (%i)";
1189 static char __pyx_k_21[] = "end out of range (%i)";
1190 static char __pyx_k_22[] = "I/O operation on closed file";
1191 static char __pyx_k_25[] = "malformatted query or wrong sequence name.\n";
1192 static char __pyx_k_27[] = "can't open header.\n";
1193 static char __pyx_k_31[] = "Filename '%s' already exists, use *force* to overwrite";
1194 static char __pyx_k_32[] = "could not open '%s' for writing";
1195 static char __pyx_k_34[] = "could not open '%s' for reading";
1196 static char __pyx_k_36[] = "writing failed";
1197 static char __pyx_k_40[] = "#";
1198 static char __pyx_k_42[] = "No such file '%s'";
1199 static char __pyx_k_43[] = ".gz";
1200 static char __pyx_k_45[] = "Filename '%s.tbi' already exists, use *force* to overwrite";
1201 static char __pyx_k_47[] = "unknown preset '%s', valid presets are '%s'";
1202 static char __pyx_k_48[] = ",";
1203 static char __pyx_k_49[] = "I/O operation on closed file.";
1204 static char __pyx_k_52[] = "incomplete line at %s";
1205 static char __pyx_k_56[] = "tabix_generic_iterator";
1206 static char __pyx_k_57[] = "filename associated with this object.";
1207 static char __pyx_k_58[] = "the file header.\n \n .. note::\n The header is returned as an iterator over lines without the\n newline character.\n ";
1208 static char __pyx_k_59[] = "chromosome names";
1209 static char __pyx_k_60[] = "getfilesystemencoding";
1210 static char __pyx_k_63[] = "/ifs/devel/pysam/pysam/ctabix.pyx";
1211 static char __pyx_k_74[] = "iterate over ``infile``.\n \n Permits the use of file-like objects for example from the gzip module.\n ";
1212 static char __pyx_k_77[] = "tabix_inplace_iterator";
1213 static char __pyx_k__b[] = "b";
1214 static char __pyx_k__c[] = "c";
1215 static char __pyx_k__r[] = "r";
1216 static char __pyx_k__s[] = "s";
1217 static char __pyx_k__w[] = "w";
1218 static char __pyx_k__fn[] = "fn";
1219 static char __pyx_k__fp[] = "fp";
1220 static char __pyx_k__io[] = "io";
1221 static char __pyx_k__os[] = "os";
1222 static char __pyx_k__bed[] = "bed";
1223 static char __pyx_k__cpy[] = "cpy";
1224 static char __pyx_k__end[] = "end";
1225 static char __pyx_k__gff[] = "gff";
1226 static char __pyx_k__len[] = "len";
1227 static char __pyx_k__ord[] = "ord";
1228 static char __pyx_k__sam[] = "sam";
1229 static char __pyx_k__sys[] = "sys";
1230 static char __pyx_k__tid[] = "tid";
1231 static char __pyx_k__vcf[] = "vcf";
1232 static char __pyx_k__conf[] = "conf";
1233 static char __pyx_k__gzip[] = "gzip";
1234 static char __pyx_k__join[] = "join";
1235 static char __pyx_k__line[] = "line";
1236 static char __pyx_k__mode[] = "mode";
1237 static char __pyx_k__next[] = "next";
1238 static char __pyx_k__path[] = "path";
1239 static char __pyx_k__self[] = "self";
1240 static char __pyx_k___open[] = "_open";
1241 static char __pyx_k__asBed[] = "asBed";
1242 static char __pyx_k__asGTF[] = "asGTF";
1243 static char __pyx_k__asVCF[] = "asVCF";
1244 static char __pyx_k__ascii[] = "ascii";
1245 static char __pyx_k__close[] = "close";
1246 static char __pyx_k__force[] = "force";
1247 static char __pyx_k__start[] = "start";
1248 static char __pyx_k__types[] = "types";
1249 static char __pyx_k__Parser[] = "Parser";
1250 static char __pyx_k__buffer[] = "buffer";
1251 static char __pyx_k__closed[] = "closed";
1252 static char __pyx_k__ctabix[] = "ctabix";
1253 static char __pyx_k__ctypes[] = "ctypes";
1254 static char __pyx_k__decode[] = "decode";
1255 static char __pyx_k__encode[] = "encode";
1256 static char __pyx_k__exists[] = "exists";
1257 static char __pyx_k__fd_src[] = "fd_src";
1258 static char __pyx_k__infile[] = "infile";
1259 static char __pyx_k__nbytes[] = "nbytes";
1260 static char __pyx_k__parser[] = "parser";
1261 static char __pyx_k__pileup[] = "pileup";
1262 static char __pyx_k__preset[] = "preset";
1263 static char __pyx_k__psltbl[] = "psltbl";
1264 static char __pyx_k__region[] = "region";
1265 static char __pyx_k__struct[] = "struct";
1266 static char __pyx_k__unlink[] = "unlink";
1267 static char __pyx_k__IOError[] = "IOError";
1268 static char __pyx_k__OSError[] = "OSError";
1269 static char __pyx_k__PYTHON3[] = "PYTHON3";
1270 static char __pyx_k____all__[] = "__all__";
1271 static char __pyx_k___isOpen[] = "_isOpen";
1272 static char __pyx_k__asTuple[] = "asTuple";
1273 static char __pyx_k__end_col[] = "end_col";
1274 static char __pyx_k__present[] = "present";
1275 static char __pyx_k__seq_col[] = "seq_col";
1276 static char __pyx_k__KeyError[] = "KeyError";
1277 static char __pyx_k__O_RDONLY[] = "O_RDONLY";
1278 static char __pyx_k____init__[] = "__init__";
1279 static char __pyx_k____iter__[] = "__iter__";
1280 static char __pyx_k____main__[] = "__main__";
1281 static char __pyx_k____next__[] = "__next__";
1282 static char __pyx_k____test__[] = "__test__";
1283 static char __pyx_k__endswith[] = "endswith";
1284 static char __pyx_k__filename[] = "filename";
1285 static char __pyx_k__readline[] = "readline";
1286 static char __pyx_k__tempfile[] = "tempfile";
1287 static char __pyx_k__Tabixfile[] = "Tabixfile";
1288 static char __pyx_k__TypeError[] = "TypeError";
1289 static char __pyx_k__conf_data[] = "conf_data";
1290 static char __pyx_k__itertools[] = "itertools";
1291 static char __pyx_k__meta_char[] = "meta_char";
1292 static char __pyx_k__reference[] = "reference";
1293 static char __pyx_k__start_col[] = "start_col";
1294 static char __pyx_k__tabixfile[] = "tabixfile";
1295 static char __pyx_k__zerobased[] = "zerobased";
1296 static char __pyx_k__ValueError[] = "ValueError";
1297 static char __pyx_k__startswith[] = "startswith";
1298 static char __pyx_k__MemoryError[] = "MemoryError";
1299 static char __pyx_k__WINDOW_SIZE[] = "WINDOW_SIZE";
1300 static char __pyx_k__buffer_size[] = "buffer_size";
1301 static char __pyx_k__filename_in[] = "filename_in";
1302 static char __pyx_k__preset2conf[] = "preset2conf";
1303 static char __pyx_k__tabix_index[] = "tabix_index";
1304 static char __pyx_k___parseRegion[] = "_parseRegion";
1305 static char __pyx_k__filename_out[] = "filename_out";
1306 static char __pyx_k__StopIteration[] = "StopIteration";
1307 static char __pyx_k__tabix_compress[] = "tabix_compress";
1308 static char __pyx_k__tabix_iterator[] = "tabix_iterator";
1309 static char __pyx_k__getdefaultencoding[] = "getdefaultencoding";
1310 static char __pyx_k__NotImplementedError[] = "NotImplementedError";
1311 static PyObject *__pyx_kp_u_1;
1312 static PyObject *__pyx_kp_s_12;
1313 static PyObject *__pyx_kp_s_14;
1314 static PyObject *__pyx_kp_s_15;
1315 static PyObject *__pyx_kp_s_16;
1316 static PyObject *__pyx_kp_s_17;
1317 static PyObject *__pyx_kp_s_18;
1318 static PyObject *__pyx_kp_s_19;
1319 static PyObject *__pyx_kp_s_20;
1320 static PyObject *__pyx_kp_s_21;
1321 static PyObject *__pyx_kp_s_22;
1322 static PyObject *__pyx_kp_s_25;
1323 static PyObject *__pyx_kp_s_27;
1324 static PyObject *__pyx_kp_u_3;
1325 static PyObject *__pyx_kp_s_31;
1326 static PyObject *__pyx_kp_s_32;
1327 static PyObject *__pyx_kp_s_34;
1328 static PyObject *__pyx_kp_s_36;
1329 static PyObject *__pyx_kp_s_40;
1330 static PyObject *__pyx_kp_s_42;
1331 static PyObject *__pyx_kp_s_43;
1332 static PyObject *__pyx_kp_s_45;
1333 static PyObject *__pyx_kp_s_47;
1334 static PyObject *__pyx_kp_s_48;
1335 static PyObject *__pyx_kp_s_49;
1336 static PyObject *__pyx_kp_s_5;
1337 static PyObject *__pyx_kp_s_52;
1338 static PyObject *__pyx_n_s_56;
1339 static PyObject *__pyx_kp_s_6;
1340 static PyObject *__pyx_n_s_60;
1341 static PyObject *__pyx_kp_s_63;
1342 static PyObject *__pyx_kp_s_7;
1343 static PyObject *__pyx_kp_s_74;
1344 static PyObject *__pyx_n_s_77;
1345 static PyObject *__pyx_kp_s_9;
1346 static PyObject *__pyx_n_s__IOError;
1347 static PyObject *__pyx_n_s__KeyError;
1348 static PyObject *__pyx_n_s__MemoryError;
1349 static PyObject *__pyx_n_s__NotImplementedError;
1350 static PyObject *__pyx_n_s__OSError;
1351 static PyObject *__pyx_n_s__O_RDONLY;
1352 static PyObject *__pyx_n_s__PYTHON3;
1353 static PyObject *__pyx_n_s__Parser;
1354 static PyObject *__pyx_n_s__StopIteration;
1355 static PyObject *__pyx_n_s__Tabixfile;
1356 static PyObject *__pyx_n_s__TypeError;
1357 static PyObject *__pyx_n_s__ValueError;
1358 static PyObject *__pyx_n_s__WINDOW_SIZE;
1359 static PyObject *__pyx_n_s____all__;
1360 static PyObject *__pyx_n_s____init__;
1361 static PyObject *__pyx_n_s____iter__;
1362 static PyObject *__pyx_n_s____main__;
1363 static PyObject *__pyx_n_s____next__;
1364 static PyObject *__pyx_n_s____test__;
1365 static PyObject *__pyx_n_s___isOpen;
1366 static PyObject *__pyx_n_s___open;
1367 static PyObject *__pyx_n_s___parseRegion;
1368 static PyObject *__pyx_n_s__asBed;
1369 static PyObject *__pyx_n_s__asGTF;
1370 static PyObject *__pyx_n_s__asTuple;
1371 static PyObject *__pyx_n_s__asVCF;
1372 static PyObject *__pyx_n_s__ascii;
1373 static PyObject *__pyx_n_s__b;
1374 static PyObject *__pyx_n_s__bed;
1375 static PyObject *__pyx_n_s__buffer;
1376 static PyObject *__pyx_n_s__buffer_size;
1377 static PyObject *__pyx_n_s__c;
1378 static PyObject *__pyx_n_s__close;
1379 static PyObject *__pyx_n_s__closed;
1380 static PyObject *__pyx_n_s__conf;
1381 static PyObject *__pyx_n_s__conf_data;
1382 static PyObject *__pyx_n_s__cpy;
1383 static PyObject *__pyx_n_s__ctabix;
1384 static PyObject *__pyx_n_s__ctypes;
1385 static PyObject *__pyx_n_s__decode;
1386 static PyObject *__pyx_n_s__encode;
1387 static PyObject *__pyx_n_s__end;
1388 static PyObject *__pyx_n_s__end_col;
1389 static PyObject *__pyx_n_s__endswith;
1390 static PyObject *__pyx_n_s__exists;
1391 static PyObject *__pyx_n_s__fd_src;
1392 static PyObject *__pyx_n_s__filename;
1393 static PyObject *__pyx_n_s__filename_in;
1394 static PyObject *__pyx_n_s__filename_out;
1395 static PyObject *__pyx_n_s__fn;
1396 static PyObject *__pyx_n_s__force;
1397 static PyObject *__pyx_n_s__fp;
1398 static PyObject *__pyx_n_s__getdefaultencoding;
1399 static PyObject *__pyx_n_s__gff;
1400 static PyObject *__pyx_n_s__gzip;
1401 static PyObject *__pyx_n_s__infile;
1402 static PyObject *__pyx_n_s__io;
1403 static PyObject *__pyx_n_s__itertools;
1404 static PyObject *__pyx_n_s__join;
1405 static PyObject *__pyx_n_s__len;
1406 static PyObject *__pyx_n_s__line;
1407 static PyObject *__pyx_n_s__meta_char;
1408 static PyObject *__pyx_n_s__mode;
1409 static PyObject *__pyx_n_s__nbytes;
1410 static PyObject *__pyx_n_s__next;
1411 static PyObject *__pyx_n_s__ord;
1412 static PyObject *__pyx_n_s__os;
1413 static PyObject *__pyx_n_s__parser;
1414 static PyObject *__pyx_n_s__path;
1415 static PyObject *__pyx_n_s__pileup;
1416 static PyObject *__pyx_n_s__present;
1417 static PyObject *__pyx_n_s__preset;
1418 static PyObject *__pyx_n_s__preset2conf;
1419 static PyObject *__pyx_n_s__psltbl;
1420 static PyObject *__pyx_n_s__r;
1421 static PyObject *__pyx_n_s__readline;
1422 static PyObject *__pyx_n_s__reference;
1423 static PyObject *__pyx_n_s__region;
1424 static PyObject *__pyx_n_s__s;
1425 static PyObject *__pyx_n_s__sam;
1426 static PyObject *__pyx_n_s__self;
1427 static PyObject *__pyx_n_s__seq_col;
1428 static PyObject *__pyx_n_s__start;
1429 static PyObject *__pyx_n_s__start_col;
1430 static PyObject *__pyx_n_s__startswith;
1431 static PyObject *__pyx_n_s__struct;
1432 static PyObject *__pyx_n_s__sys;
1433 static PyObject *__pyx_n_s__tabix_compress;
1434 static PyObject *__pyx_n_s__tabix_index;
1435 static PyObject *__pyx_n_s__tabix_iterator;
1436 static PyObject *__pyx_n_s__tabixfile;
1437 static PyObject *__pyx_n_s__tempfile;
1438 static PyObject *__pyx_n_s__tid;
1439 static PyObject *__pyx_n_s__types;
1440 static PyObject *__pyx_n_s__unlink;
1441 static PyObject *__pyx_n_s__vcf;
1442 static PyObject *__pyx_n_s__w;
1443 static PyObject *__pyx_n_s__zerobased;
1444 static PyObject *__pyx_int_0;
1445 static PyObject *__pyx_int_1;
1446 static PyObject *__pyx_int_2;
1447 static PyObject *__pyx_int_3;
1448 static PyObject *__pyx_int_4;
1449 static PyObject *__pyx_int_5;
1450 static PyObject *__pyx_int_neg_1;
1451 static PyObject *__pyx_int_15;
1452 static PyObject *__pyx_int_17;
1453 static PyObject *__pyx_int_18;
1454 static PyObject *__pyx_int_35;
1455 static PyObject *__pyx_int_65536;
1456 static PyObject *__pyx_k_30;
1457 static PyObject *__pyx_k_39;
1458 static PyObject *__pyx_k_41;
1459 static PyObject *__pyx_k_tuple_2;
1460 static PyObject *__pyx_k_tuple_4;
1461 static PyObject *__pyx_k_tuple_8;
1462 static PyObject *__pyx_k_tuple_10;
1463 static PyObject *__pyx_k_tuple_11;
1464 static PyObject *__pyx_k_tuple_13;
1465 static PyObject *__pyx_k_tuple_23;
1466 static PyObject *__pyx_k_tuple_24;
1467 static PyObject *__pyx_k_tuple_26;
1468 static PyObject *__pyx_k_tuple_28;
1469 static PyObject *__pyx_k_tuple_29;
1470 static PyObject *__pyx_k_tuple_33;
1471 static PyObject *__pyx_k_tuple_35;
1472 static PyObject *__pyx_k_tuple_37;
1473 static PyObject *__pyx_k_tuple_38;
1474 static PyObject *__pyx_k_tuple_44;
1475 static PyObject *__pyx_k_tuple_46;
1476 static PyObject *__pyx_k_tuple_50;
1477 static PyObject *__pyx_k_tuple_51;
1478 static PyObject *__pyx_k_tuple_53;
1479 static PyObject *__pyx_k_tuple_54;
1480 static PyObject *__pyx_k_tuple_55;
1481 static PyObject *__pyx_k_tuple_61;
1482 static PyObject *__pyx_k_tuple_64;
1483 static PyObject *__pyx_k_tuple_66;
1484 static PyObject *__pyx_k_tuple_68;
1485 static PyObject *__pyx_k_tuple_70;
1486 static PyObject *__pyx_k_tuple_72;
1487 static PyObject *__pyx_k_tuple_75;
1488 static PyObject *__pyx_k_codeobj_62;
1489 static PyObject *__pyx_k_codeobj_65;
1490 static PyObject *__pyx_k_codeobj_67;
1491 static PyObject *__pyx_k_codeobj_69;
1492 static PyObject *__pyx_k_codeobj_71;
1493 static PyObject *__pyx_k_codeobj_73;
1494 static PyObject *__pyx_k_codeobj_76;
1497 * from cpython.version cimport PY_MAJOR_VERSION
1499 * cdef from_string_and_size(char* s, size_t length): # <<<<<<<<<<<<<<
1500 * if PY_MAJOR_VERSION < 3:
1504 static PyObject *__pyx_f_6ctabix_from_string_and_size(char *__pyx_v_s, size_t __pyx_v_length) {
1505 PyObject *__pyx_r = NULL;
1506 __Pyx_RefNannyDeclarations
1508 PyObject *__pyx_t_2 = NULL;
1509 int __pyx_lineno = 0;
1510 const char *__pyx_filename = NULL;
1511 int __pyx_clineno = 0;
1512 __Pyx_RefNannySetupContext("from_string_and_size", 0);
1516 * cdef from_string_and_size(char* s, size_t length):
1517 * if PY_MAJOR_VERSION < 3: # <<<<<<<<<<<<<<
1521 __pyx_t_1 = (PY_MAJOR_VERSION < 3);
1525 * cdef from_string_and_size(char* s, size_t length):
1526 * if PY_MAJOR_VERSION < 3:
1527 * return s[:length] # <<<<<<<<<<<<<<
1529 * return s[:length].decode("ascii")
1531 __Pyx_XDECREF(__pyx_r);
1532 __pyx_t_2 = PyBytes_FromStringAndSize(__pyx_v_s + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1533 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
1534 __pyx_r = ((PyObject *)__pyx_t_2);
1544 * return s[:length].decode("ascii") # <<<<<<<<<<<<<<
1546 * # filename encoding (copied from lxml.etree.pyx)
1548 __Pyx_XDECREF(__pyx_r);
1549 __pyx_t_2 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_s, 0, __pyx_v_length, NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1550 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
1551 __pyx_r = ((PyObject *)__pyx_t_2);
1557 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1560 __Pyx_XDECREF(__pyx_t_2);
1561 __Pyx_AddTraceback("ctabix.from_string_and_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
1564 __Pyx_XGIVEREF(__pyx_r);
1565 __Pyx_RefNannyFinishContext();
1570 * #_C_FILENAME_ENCODING = <char*>_FILENAME_ENCODING
1572 * cdef bytes _my_encodeFilename(object filename): # <<<<<<<<<<<<<<
1573 * u"""Make sure a filename is 8-bit encoded (or None).
1577 static PyObject *__pyx_f_6ctabix__my_encodeFilename(PyObject *__pyx_v_filename) {
1578 PyObject *__pyx_r = NULL;
1579 __Pyx_RefNannyDeclarations
1581 PyObject *__pyx_t_2 = NULL;
1582 PyObject *__pyx_t_3 = NULL;
1583 PyObject *__pyx_t_4 = NULL;
1584 int __pyx_lineno = 0;
1585 const char *__pyx_filename = NULL;
1586 int __pyx_clineno = 0;
1587 __Pyx_RefNannySetupContext("_my_encodeFilename", 0);
1590 * u"""Make sure a filename is 8-bit encoded (or None).
1592 * if filename is None: # <<<<<<<<<<<<<<
1594 * elif PyBytes_Check(filename):
1596 __pyx_t_1 = (__pyx_v_filename == Py_None);
1601 * if filename is None:
1602 * return None # <<<<<<<<<<<<<<
1603 * elif PyBytes_Check(filename):
1606 __Pyx_XDECREF(((PyObject *)__pyx_r));
1607 __Pyx_INCREF(Py_None);
1608 __pyx_r = ((PyObject*)Py_None);
1614 * if filename is None:
1616 * elif PyBytes_Check(filename): # <<<<<<<<<<<<<<
1618 * elif PyUnicode_Check(filename):
1620 __pyx_t_1 = PyBytes_Check(__pyx_v_filename);
1625 * elif PyBytes_Check(filename):
1626 * return filename # <<<<<<<<<<<<<<
1627 * elif PyUnicode_Check(filename):
1628 * return filename.encode(_FILENAME_ENCODING)
1630 __Pyx_XDECREF(((PyObject *)__pyx_r));
1631 if (!(likely(PyBytes_CheckExact(__pyx_v_filename))||((__pyx_v_filename) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_filename)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1632 __Pyx_INCREF(__pyx_v_filename);
1633 __pyx_r = ((PyObject*)__pyx_v_filename);
1639 * elif PyBytes_Check(filename):
1641 * elif PyUnicode_Check(filename): # <<<<<<<<<<<<<<
1642 * return filename.encode(_FILENAME_ENCODING)
1645 __pyx_t_1 = PyUnicode_Check(__pyx_v_filename);
1650 * elif PyUnicode_Check(filename):
1651 * return filename.encode(_FILENAME_ENCODING) # <<<<<<<<<<<<<<
1653 * raise TypeError, u"Argument must be string or unicode."
1655 __Pyx_XDECREF(((PyObject *)__pyx_r));
1656 __pyx_t_2 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1657 __Pyx_GOTREF(__pyx_t_2);
1658 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1659 __Pyx_GOTREF(__pyx_t_3);
1660 __Pyx_INCREF(((PyObject *)__pyx_v_6ctabix__FILENAME_ENCODING));
1661 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_6ctabix__FILENAME_ENCODING));
1662 __Pyx_GIVEREF(((PyObject *)__pyx_v_6ctabix__FILENAME_ENCODING));
1663 __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1664 __Pyx_GOTREF(__pyx_t_4);
1665 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1666 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
1667 if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1668 __pyx_r = ((PyObject*)__pyx_t_4);
1676 * return filename.encode(_FILENAME_ENCODING)
1678 * raise TypeError, u"Argument must be string or unicode." # <<<<<<<<<<<<<<
1680 * cdef bytes _force_bytes(object s):
1682 __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_1), 0, 0);
1683 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1687 __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
1690 __Pyx_XDECREF(__pyx_t_2);
1691 __Pyx_XDECREF(__pyx_t_3);
1692 __Pyx_XDECREF(__pyx_t_4);
1693 __Pyx_AddTraceback("ctabix._my_encodeFilename", __pyx_clineno, __pyx_lineno, __pyx_filename);
1696 __Pyx_XGIVEREF(__pyx_r);
1697 __Pyx_RefNannyFinishContext();
1702 * raise TypeError, u"Argument must be string or unicode."
1704 * cdef bytes _force_bytes(object s): # <<<<<<<<<<<<<<
1705 * u"""convert string or unicode object to bytes, assuming ascii encoding.
1709 static PyObject *__pyx_f_6ctabix__force_bytes(PyObject *__pyx_v_s) {
1710 PyObject *__pyx_r = NULL;
1711 __Pyx_RefNannyDeclarations
1713 PyObject *__pyx_t_2 = NULL;
1714 PyObject *__pyx_t_3 = NULL;
1715 int __pyx_lineno = 0;
1716 const char *__pyx_filename = NULL;
1717 int __pyx_clineno = 0;
1718 __Pyx_RefNannySetupContext("_force_bytes", 0);
1721 * u"""convert string or unicode object to bytes, assuming ascii encoding.
1723 * if PY_MAJOR_VERSION < 3: # <<<<<<<<<<<<<<
1727 __pyx_t_1 = (PY_MAJOR_VERSION < 3);
1732 * if PY_MAJOR_VERSION < 3:
1733 * return s # <<<<<<<<<<<<<<
1737 __Pyx_XDECREF(((PyObject *)__pyx_r));
1738 if (!(likely(PyBytes_CheckExact(__pyx_v_s))||((__pyx_v_s) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_s)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1739 __Pyx_INCREF(__pyx_v_s);
1740 __pyx_r = ((PyObject*)__pyx_v_s);
1746 * if PY_MAJOR_VERSION < 3:
1748 * elif s is None: # <<<<<<<<<<<<<<
1750 * elif PyBytes_Check(s):
1752 __pyx_t_1 = (__pyx_v_s == Py_None);
1758 * return None # <<<<<<<<<<<<<<
1759 * elif PyBytes_Check(s):
1762 __Pyx_XDECREF(((PyObject *)__pyx_r));
1763 __Pyx_INCREF(Py_None);
1764 __pyx_r = ((PyObject*)Py_None);
1772 * elif PyBytes_Check(s): # <<<<<<<<<<<<<<
1774 * elif PyUnicode_Check(s):
1776 __pyx_t_1 = PyBytes_Check(__pyx_v_s);
1781 * elif PyBytes_Check(s):
1782 * return s # <<<<<<<<<<<<<<
1783 * elif PyUnicode_Check(s):
1784 * return s.encode('ascii')
1786 __Pyx_XDECREF(((PyObject *)__pyx_r));
1787 if (!(likely(PyBytes_CheckExact(__pyx_v_s))||((__pyx_v_s) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_s)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1788 __Pyx_INCREF(__pyx_v_s);
1789 __pyx_r = ((PyObject*)__pyx_v_s);
1795 * elif PyBytes_Check(s):
1797 * elif PyUnicode_Check(s): # <<<<<<<<<<<<<<
1798 * return s.encode('ascii')
1801 __pyx_t_1 = PyUnicode_Check(__pyx_v_s);
1806 * elif PyUnicode_Check(s):
1807 * return s.encode('ascii') # <<<<<<<<<<<<<<
1809 * raise TypeError, u"Argument must be string, bytes or unicode."
1811 __Pyx_XDECREF(((PyObject *)__pyx_r));
1812 __pyx_t_2 = PyObject_GetAttr(__pyx_v_s, __pyx_n_s__encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1813 __Pyx_GOTREF(__pyx_t_2);
1814 __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1815 __Pyx_GOTREF(__pyx_t_3);
1816 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1817 if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1818 __pyx_r = ((PyObject*)__pyx_t_3);
1826 * return s.encode('ascii')
1828 * raise TypeError, u"Argument must be string, bytes or unicode." # <<<<<<<<<<<<<<
1830 * cdef inline bytes _force_cmdline_bytes(object s):
1832 __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_u_3), 0, 0);
1833 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1837 __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
1840 __Pyx_XDECREF(__pyx_t_2);
1841 __Pyx_XDECREF(__pyx_t_3);
1842 __Pyx_AddTraceback("ctabix._force_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
1845 __Pyx_XGIVEREF(__pyx_r);
1846 __Pyx_RefNannyFinishContext();
1851 * raise TypeError, u"Argument must be string, bytes or unicode."
1853 * cdef inline bytes _force_cmdline_bytes(object s): # <<<<<<<<<<<<<<
1854 * return _force_bytes(s)
1858 static CYTHON_INLINE PyObject *__pyx_f_6ctabix__force_cmdline_bytes(PyObject *__pyx_v_s) {
1859 PyObject *__pyx_r = NULL;
1860 __Pyx_RefNannyDeclarations
1861 PyObject *__pyx_t_1 = NULL;
1862 int __pyx_lineno = 0;
1863 const char *__pyx_filename = NULL;
1864 int __pyx_clineno = 0;
1865 __Pyx_RefNannySetupContext("_force_cmdline_bytes", 0);
1869 * cdef inline bytes _force_cmdline_bytes(object s):
1870 * return _force_bytes(s) # <<<<<<<<<<<<<<
1872 * cdef _charptr_to_str(char* s):
1874 __Pyx_XDECREF(((PyObject *)__pyx_r));
1875 __pyx_t_1 = ((PyObject *)__pyx_f_6ctabix__force_bytes(__pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1876 __Pyx_GOTREF(__pyx_t_1);
1877 __pyx_r = ((PyObject*)__pyx_t_1);
1881 __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
1884 __Pyx_XDECREF(__pyx_t_1);
1885 __Pyx_AddTraceback("ctabix._force_cmdline_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
1888 __Pyx_XGIVEREF(__pyx_r);
1889 __Pyx_RefNannyFinishContext();
1894 * return _force_bytes(s)
1896 * cdef _charptr_to_str(char* s): # <<<<<<<<<<<<<<
1897 * if PY_MAJOR_VERSION < 3:
1901 static PyObject *__pyx_f_6ctabix__charptr_to_str(char *__pyx_v_s) {
1902 PyObject *__pyx_r = NULL;
1903 __Pyx_RefNannyDeclarations
1905 PyObject *__pyx_t_2 = NULL;
1906 int __pyx_lineno = 0;
1907 const char *__pyx_filename = NULL;
1908 int __pyx_clineno = 0;
1909 __Pyx_RefNannySetupContext("_charptr_to_str", 0);
1913 * cdef _charptr_to_str(char* s):
1914 * if PY_MAJOR_VERSION < 3: # <<<<<<<<<<<<<<
1918 __pyx_t_1 = (PY_MAJOR_VERSION < 3);
1922 * cdef _charptr_to_str(char* s):
1923 * if PY_MAJOR_VERSION < 3:
1924 * return s # <<<<<<<<<<<<<<
1926 * return s.decode("ascii")
1928 __Pyx_XDECREF(__pyx_r);
1929 __pyx_t_2 = PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1930 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
1931 __pyx_r = ((PyObject *)__pyx_t_2);
1941 * return s.decode("ascii") # <<<<<<<<<<<<<<
1943 * cdef _force_str(object s):
1945 __Pyx_XDECREF(__pyx_r);
1946 __pyx_t_2 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_s, 0, strlen(__pyx_v_s), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1947 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
1948 __pyx_r = ((PyObject *)__pyx_t_2);
1954 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1957 __Pyx_XDECREF(__pyx_t_2);
1958 __Pyx_AddTraceback("ctabix._charptr_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
1961 __Pyx_XGIVEREF(__pyx_r);
1962 __Pyx_RefNannyFinishContext();
1967 * return s.decode("ascii")
1969 * cdef _force_str(object s): # <<<<<<<<<<<<<<
1970 * """Return s converted to str type of current Python (bytes in Py2, unicode in Py3)"""
1974 static PyObject *__pyx_f_6ctabix__force_str(PyObject *__pyx_v_s) {
1975 PyObject *__pyx_r = NULL;
1976 __Pyx_RefNannyDeclarations
1978 PyObject *__pyx_t_2 = NULL;
1979 PyObject *__pyx_t_3 = NULL;
1980 int __pyx_lineno = 0;
1981 const char *__pyx_filename = NULL;
1982 int __pyx_clineno = 0;
1983 __Pyx_RefNannySetupContext("_force_str", 0);
1986 * cdef _force_str(object s):
1987 * """Return s converted to str type of current Python (bytes in Py2, unicode in Py3)"""
1988 * if s is None: # <<<<<<<<<<<<<<
1990 * if PY_MAJOR_VERSION < 3:
1992 __pyx_t_1 = (__pyx_v_s == Py_None);
1996 * """Return s converted to str type of current Python (bytes in Py2, unicode in Py3)"""
1998 * return None # <<<<<<<<<<<<<<
1999 * if PY_MAJOR_VERSION < 3:
2002 __Pyx_XDECREF(__pyx_r);
2003 __Pyx_INCREF(Py_None);
2013 * if PY_MAJOR_VERSION < 3: # <<<<<<<<<<<<<<
2015 * elif PyBytes_Check(s):
2017 __pyx_t_1 = (PY_MAJOR_VERSION < 3);
2022 * if PY_MAJOR_VERSION < 3:
2023 * return s # <<<<<<<<<<<<<<
2024 * elif PyBytes_Check(s):
2025 * return s.decode('ascii')
2027 __Pyx_XDECREF(__pyx_r);
2028 __Pyx_INCREF(__pyx_v_s);
2029 __pyx_r = __pyx_v_s;
2035 * if PY_MAJOR_VERSION < 3:
2037 * elif PyBytes_Check(s): # <<<<<<<<<<<<<<
2038 * return s.decode('ascii')
2041 __pyx_t_1 = PyBytes_Check(__pyx_v_s);
2046 * elif PyBytes_Check(s):
2047 * return s.decode('ascii') # <<<<<<<<<<<<<<
2051 __Pyx_XDECREF(__pyx_r);
2052 __pyx_t_2 = PyObject_GetAttr(__pyx_v_s, __pyx_n_s__decode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2053 __Pyx_GOTREF(__pyx_t_2);
2054 __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2055 __Pyx_GOTREF(__pyx_t_3);
2056 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2057 __pyx_r = __pyx_t_3;
2067 * return s # <<<<<<<<<<<<<<
2071 __Pyx_XDECREF(__pyx_r);
2072 __Pyx_INCREF(__pyx_v_s);
2073 __pyx_r = __pyx_v_s;
2078 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2081 __Pyx_XDECREF(__pyx_t_2);
2082 __Pyx_XDECREF(__pyx_t_3);
2083 __Pyx_AddTraceback("ctabix._force_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
2086 __Pyx_XGIVEREF(__pyx_r);
2087 __Pyx_RefNannyFinishContext();
2091 /* Python wrapper */
2092 static int __pyx_pw_6ctabix_9Tabixfile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2093 static int __pyx_pw_6ctabix_9Tabixfile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2094 PyObject *__pyx_v_filename = 0;
2095 PyObject *__pyx_v_mode = 0;
2096 PyObject *__pyx_v_args = 0;
2097 PyObject *__pyx_v_kwargs = 0;
2099 __Pyx_RefNannyDeclarations
2100 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
2101 __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
2102 __Pyx_GOTREF(__pyx_v_kwargs);
2103 if (PyTuple_GET_SIZE(__pyx_args) > 2) {
2104 __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
2105 if (unlikely(!__pyx_v_args)) {
2106 __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
2107 __Pyx_RefNannyFinishContext();
2110 __Pyx_GOTREF(__pyx_v_args);
2112 __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
2115 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,0};
2116 PyObject* values[2] = {0,0};
2117 values[1] = ((PyObject *)__pyx_n_s__r);
2118 if (unlikely(__pyx_kwds)) {
2120 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2123 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2124 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2127 kw_args = PyDict_Size(__pyx_kwds);
2130 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--;
2131 else goto __pyx_L5_argtuple_error;
2134 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode);
2135 if (value) { values[1] = value; kw_args--; }
2138 if (unlikely(kw_args > 0)) {
2139 const Py_ssize_t used_pos_args = (pos_args < 2) ? pos_args : 2;
2140 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2143 switch (PyTuple_GET_SIZE(__pyx_args)) {
2145 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2146 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2149 goto __pyx_L5_argtuple_error;
2152 __pyx_v_filename = values[0];
2153 __pyx_v_mode = values[1];
2155 goto __pyx_L4_argument_unpacking_done;
2156 __pyx_L5_argtuple_error:;
2157 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2159 __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
2160 __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
2161 __Pyx_AddTraceback("ctabix.Tabixfile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2162 __Pyx_RefNannyFinishContext();
2164 __pyx_L4_argument_unpacking_done:;
2165 __pyx_r = __pyx_pf_6ctabix_9Tabixfile___cinit__(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self), __pyx_v_filename, __pyx_v_mode, __pyx_v_args, __pyx_v_kwargs);
2166 __Pyx_XDECREF(__pyx_v_args);
2167 __Pyx_XDECREF(__pyx_v_kwargs);
2168 __Pyx_RefNannyFinishContext();
2173 * index (*filename* + ".tbi") will raise an exception.
2175 * def __cinit__(self, filename, mode = 'r', *args, **kwargs ): # <<<<<<<<<<<<<<
2176 * self.tabixfile = NULL
2177 * self._open( filename, mode, *args, **kwargs )
2180 static int __pyx_pf_6ctabix_9Tabixfile___cinit__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
2182 __Pyx_RefNannyDeclarations
2183 PyObject *__pyx_t_1 = NULL;
2184 PyObject *__pyx_t_2 = NULL;
2185 PyObject *__pyx_t_3 = NULL;
2186 PyObject *__pyx_t_4 = NULL;
2187 int __pyx_lineno = 0;
2188 const char *__pyx_filename = NULL;
2189 int __pyx_clineno = 0;
2190 __Pyx_RefNannySetupContext("__cinit__", 0);
2194 * def __cinit__(self, filename, mode = 'r', *args, **kwargs ):
2195 * self.tabixfile = NULL # <<<<<<<<<<<<<<
2196 * self._open( filename, mode, *args, **kwargs )
2199 __pyx_v_self->tabixfile = NULL;
2202 * def __cinit__(self, filename, mode = 'r', *args, **kwargs ):
2203 * self.tabixfile = NULL
2204 * self._open( filename, mode, *args, **kwargs ) # <<<<<<<<<<<<<<
2206 * def _isOpen( self ):
2208 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2209 __Pyx_GOTREF(__pyx_t_1);
2210 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2211 __Pyx_GOTREF(__pyx_t_2);
2212 __Pyx_INCREF(__pyx_v_filename);
2213 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_filename);
2214 __Pyx_GIVEREF(__pyx_v_filename);
2215 __Pyx_INCREF(__pyx_v_mode);
2216 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_mode);
2217 __Pyx_GIVEREF(__pyx_v_mode);
2218 __pyx_t_3 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2219 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
2220 __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2221 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
2222 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
2223 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
2224 __pyx_t_3 = ((PyObject *)__pyx_v_kwargs);
2225 __Pyx_INCREF(__pyx_t_3);
2226 __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2227 __Pyx_GOTREF(__pyx_t_2);
2228 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2229 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
2230 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
2231 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2236 __Pyx_XDECREF(__pyx_t_1);
2237 __Pyx_XDECREF(__pyx_t_2);
2238 __Pyx_XDECREF(__pyx_t_3);
2239 __Pyx_XDECREF(__pyx_t_4);
2240 __Pyx_AddTraceback("ctabix.Tabixfile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2243 __Pyx_RefNannyFinishContext();
2247 /* Python wrapper */
2248 static PyObject *__pyx_pw_6ctabix_9Tabixfile_3_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2249 static char __pyx_doc_6ctabix_9Tabixfile_2_isOpen[] = "Tabixfile._isOpen(self)\nreturn true if samfile has been opened.";
2250 static PyObject *__pyx_pw_6ctabix_9Tabixfile_3_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
2251 PyObject *__pyx_r = 0;
2252 __Pyx_RefNannyDeclarations
2253 __Pyx_RefNannySetupContext("_isOpen (wrapper)", 0);
2254 __pyx_r = __pyx_pf_6ctabix_9Tabixfile_2_isOpen(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self));
2255 __Pyx_RefNannyFinishContext();
2260 * self._open( filename, mode, *args, **kwargs )
2262 * def _isOpen( self ): # <<<<<<<<<<<<<<
2263 * '''return true if samfile has been opened.'''
2264 * return self.tabixfile != NULL
2267 static PyObject *__pyx_pf_6ctabix_9Tabixfile_2_isOpen(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self) {
2268 PyObject *__pyx_r = NULL;
2269 __Pyx_RefNannyDeclarations
2270 PyObject *__pyx_t_1 = NULL;
2271 int __pyx_lineno = 0;
2272 const char *__pyx_filename = NULL;
2273 int __pyx_clineno = 0;
2274 __Pyx_RefNannySetupContext("_isOpen", 0);
2277 * def _isOpen( self ):
2278 * '''return true if samfile has been opened.'''
2279 * return self.tabixfile != NULL # <<<<<<<<<<<<<<
2283 __Pyx_XDECREF(__pyx_r);
2284 __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->tabixfile != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2285 __Pyx_GOTREF(__pyx_t_1);
2286 __pyx_r = __pyx_t_1;
2290 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2293 __Pyx_XDECREF(__pyx_t_1);
2294 __Pyx_AddTraceback("ctabix.Tabixfile._isOpen", __pyx_clineno, __pyx_lineno, __pyx_filename);
2297 __Pyx_XGIVEREF(__pyx_r);
2298 __Pyx_RefNannyFinishContext();
2302 /* Python wrapper */
2303 static PyObject *__pyx_pw_6ctabix_9Tabixfile_5_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2304 static char __pyx_doc_6ctabix_9Tabixfile_4_open[] = "Tabixfile._open(self, filename, mode='r')\nopen a :term:`tabix file` for reading.\n ";
2305 static PyObject *__pyx_pw_6ctabix_9Tabixfile_5_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2306 PyObject *__pyx_v_filename = 0;
2307 PyObject *__pyx_v_mode = 0;
2308 PyObject *__pyx_r = 0;
2309 __Pyx_RefNannyDeclarations
2310 __Pyx_RefNannySetupContext("_open (wrapper)", 0);
2312 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,0};
2313 PyObject* values[2] = {0,0};
2314 values[1] = ((PyObject *)__pyx_n_s__r);
2315 if (unlikely(__pyx_kwds)) {
2317 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2319 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2320 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2322 default: goto __pyx_L5_argtuple_error;
2324 kw_args = PyDict_Size(__pyx_kwds);
2327 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--;
2328 else goto __pyx_L5_argtuple_error;
2331 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode);
2332 if (value) { values[1] = value; kw_args--; }
2335 if (unlikely(kw_args > 0)) {
2336 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_open") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2339 switch (PyTuple_GET_SIZE(__pyx_args)) {
2340 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2341 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2343 default: goto __pyx_L5_argtuple_error;
2346 __pyx_v_filename = values[0];
2347 __pyx_v_mode = values[1];
2349 goto __pyx_L4_argument_unpacking_done;
2350 __pyx_L5_argtuple_error:;
2351 __Pyx_RaiseArgtupleInvalid("_open", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2353 __Pyx_AddTraceback("ctabix.Tabixfile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
2354 __Pyx_RefNannyFinishContext();
2356 __pyx_L4_argument_unpacking_done:;
2357 __pyx_r = __pyx_pf_6ctabix_9Tabixfile_4_open(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self), __pyx_v_filename, __pyx_v_mode);
2358 __Pyx_RefNannyFinishContext();
2363 * return self.tabixfile != NULL
2365 * def _open( self, # <<<<<<<<<<<<<<
2370 static PyObject *__pyx_pf_6ctabix_9Tabixfile_4_open(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode) {
2371 PyObject *__pyx_v_filename_index = NULL;
2372 CYTHON_UNUSED PyObject *__pyx_v_bmode = 0;
2373 PyObject *__pyx_r = NULL;
2374 __Pyx_RefNannyDeclarations
2375 PyObject *__pyx_t_1 = NULL;
2376 PyObject *__pyx_t_2 = NULL;
2378 PyObject *__pyx_t_4 = NULL;
2383 int __pyx_lineno = 0;
2384 const char *__pyx_filename = NULL;
2385 int __pyx_clineno = 0;
2386 __Pyx_RefNannySetupContext("_open", 0);
2387 __Pyx_INCREF(__pyx_v_filename);
2392 * assert mode in ( "r",), "invalid file opening mode `%s`" % mode # <<<<<<<<<<<<<<
2394 * # close a previously opened file
2396 #ifndef CYTHON_WITHOUT_ASSERTIONS
2397 __Pyx_INCREF(__pyx_v_mode);
2398 __pyx_t_1 = __pyx_v_mode;
2399 __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__r), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2400 __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 = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2401 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2402 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2403 if (unlikely(!((int)__pyx_t_3))) {
2404 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_v_mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2405 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
2406 PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_1));
2407 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
2408 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2414 * # close a previously opened file
2415 * if self.tabixfile != NULL: self.close() # <<<<<<<<<<<<<<
2416 * self.tabixfile = NULL
2419 __pyx_t_3 = (__pyx_v_self->tabixfile != NULL);
2421 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2422 __Pyx_GOTREF(__pyx_t_1);
2423 __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 = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2424 __Pyx_GOTREF(__pyx_t_2);
2425 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2426 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2432 * # close a previously opened file
2433 * if self.tabixfile != NULL: self.close()
2434 * self.tabixfile = NULL # <<<<<<<<<<<<<<
2436 * filename_index = filename + ".tbi"
2438 __pyx_v_self->tabixfile = NULL;
2441 * self.tabixfile = NULL
2443 * filename_index = filename + ".tbi" # <<<<<<<<<<<<<<
2444 * self.isremote = filename.startswith( "http:") or filename.startswith( "ftp:" )
2447 __pyx_t_2 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2448 __Pyx_GOTREF(__pyx_t_2);
2449 __pyx_v_filename_index = __pyx_t_2;
2454 * filename_index = filename + ".tbi"
2455 * self.isremote = filename.startswith( "http:") or filename.startswith( "ftp:" ) # <<<<<<<<<<<<<<
2457 * # encode all the strings
2459 __pyx_t_2 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2460 __Pyx_GOTREF(__pyx_t_2);
2461 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2462 __Pyx_GOTREF(__pyx_t_1);
2463 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2464 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2466 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2467 __pyx_t_2 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2468 __Pyx_GOTREF(__pyx_t_2);
2469 __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2470 __Pyx_GOTREF(__pyx_t_4);
2471 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2472 __pyx_t_2 = __pyx_t_4;
2475 __pyx_t_2 = __pyx_t_1;
2478 __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2479 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2480 __pyx_v_self->isremote = __pyx_t_5;
2484 * # encode all the strings
2485 * filename = _my_encodeFilename(filename) # <<<<<<<<<<<<<<
2486 * filename_index = _my_encodeFilename(filename_index)
2487 * cdef bytes bmode = mode.encode('ascii')
2489 __pyx_t_2 = ((PyObject *)__pyx_f_6ctabix__my_encodeFilename(__pyx_v_filename)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2490 __Pyx_GOTREF(__pyx_t_2);
2491 __Pyx_DECREF(__pyx_v_filename);
2492 __pyx_v_filename = __pyx_t_2;
2496 * # encode all the strings
2497 * filename = _my_encodeFilename(filename)
2498 * filename_index = _my_encodeFilename(filename_index) # <<<<<<<<<<<<<<
2499 * cdef bytes bmode = mode.encode('ascii')
2502 __pyx_t_2 = ((PyObject *)__pyx_f_6ctabix__my_encodeFilename(__pyx_v_filename_index)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2503 __Pyx_GOTREF(__pyx_t_2);
2504 __Pyx_DECREF(__pyx_v_filename_index);
2505 __pyx_v_filename_index = __pyx_t_2;
2509 * filename = _my_encodeFilename(filename)
2510 * filename_index = _my_encodeFilename(filename_index)
2511 * cdef bytes bmode = mode.encode('ascii') # <<<<<<<<<<<<<<
2513 * if self._filename != NULL: free(self._filename )
2515 __pyx_t_2 = PyObject_GetAttr(__pyx_v_mode, __pyx_n_s__encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2516 __Pyx_GOTREF(__pyx_t_2);
2517 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2518 __Pyx_GOTREF(__pyx_t_1);
2519 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2520 if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2521 __pyx_v_bmode = ((PyObject*)__pyx_t_1);
2525 * cdef bytes bmode = mode.encode('ascii')
2527 * if self._filename != NULL: free(self._filename ) # <<<<<<<<<<<<<<
2529 * self._filename = strdup(filename)
2531 __pyx_t_3 = (__pyx_v_self->_filename != NULL);
2533 free(__pyx_v_self->_filename);
2539 * if self._filename != NULL: free(self._filename )
2541 * self._filename = strdup(filename) # <<<<<<<<<<<<<<
2543 * if mode[0] == 'w':
2545 __pyx_t_6 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2546 __pyx_v_self->_filename = strdup(__pyx_t_6);
2549 * self._filename = strdup(filename)
2551 * if mode[0] == 'w': # <<<<<<<<<<<<<<
2552 * # open file for writing
2553 * raise NotImplementedError("writing to tabix files not implemented" )
2555 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2556 __Pyx_GOTREF(__pyx_t_1);
2557 __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__w), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2558 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2559 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2560 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2564 * if mode[0] == 'w':
2565 * # open file for writing
2566 * raise NotImplementedError("writing to tabix files not implemented" ) # <<<<<<<<<<<<<<
2568 * elif mode[0] == "r":
2570 __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2571 __Pyx_GOTREF(__pyx_t_2);
2572 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
2573 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2574 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2579 * raise NotImplementedError("writing to tabix files not implemented" )
2581 * elif mode[0] == "r": # <<<<<<<<<<<<<<
2582 * # open file for reading
2585 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2586 __Pyx_GOTREF(__pyx_t_2);
2587 __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__r), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2588 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2589 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2590 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2594 * # open file for reading
2596 * if not self.isremote: # <<<<<<<<<<<<<<
2597 * if not os.path.exists( filename ):
2598 * raise IOError( "file `%s` not found" % filename)
2600 __pyx_t_3 = (!__pyx_v_self->isremote);
2605 * if not self.isremote:
2606 * if not os.path.exists( filename ): # <<<<<<<<<<<<<<
2607 * raise IOError( "file `%s` not found" % filename)
2610 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2611 __Pyx_GOTREF(__pyx_t_1);
2612 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2613 __Pyx_GOTREF(__pyx_t_2);
2614 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2615 __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2616 __Pyx_GOTREF(__pyx_t_1);
2617 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2618 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2619 __Pyx_GOTREF(__pyx_t_2);
2620 __Pyx_INCREF(__pyx_v_filename);
2621 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_filename);
2622 __Pyx_GIVEREF(__pyx_v_filename);
2623 __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2624 __Pyx_GOTREF(__pyx_t_4);
2625 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2626 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
2627 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2628 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2629 __pyx_t_7 = (!__pyx_t_3);
2633 * if not self.isremote:
2634 * if not os.path.exists( filename ):
2635 * raise IOError( "file `%s` not found" % filename) # <<<<<<<<<<<<<<
2637 * if not os.path.exists( filename_index ):
2639 __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __pyx_v_filename); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2640 __Pyx_GOTREF(((PyObject *)__pyx_t_4));
2641 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2642 __Pyx_GOTREF(__pyx_t_2);
2643 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4));
2644 __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
2646 __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 = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2647 __Pyx_GOTREF(__pyx_t_4);
2648 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
2649 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
2650 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2651 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2657 * raise IOError( "file `%s` not found" % filename)
2659 * if not os.path.exists( filename_index ): # <<<<<<<<<<<<<<
2660 * raise IOError( "index `%s` not found" % filename_index)
2663 __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2664 __Pyx_GOTREF(__pyx_t_4);
2665 __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2666 __Pyx_GOTREF(__pyx_t_2);
2667 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2668 __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2669 __Pyx_GOTREF(__pyx_t_4);
2670 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2671 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2672 __Pyx_GOTREF(__pyx_t_2);
2673 __Pyx_INCREF(__pyx_v_filename_index);
2674 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_filename_index);
2675 __Pyx_GIVEREF(__pyx_v_filename_index);
2676 __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 = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2677 __Pyx_GOTREF(__pyx_t_1);
2678 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2679 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
2680 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2681 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2682 __pyx_t_3 = (!__pyx_t_7);
2687 * if not os.path.exists( filename_index ):
2688 * raise IOError( "index `%s` not found" % filename_index) # <<<<<<<<<<<<<<
2690 * # open file and load index
2692 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), __pyx_v_filename_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2693 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
2694 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2695 __Pyx_GOTREF(__pyx_t_2);
2696 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
2697 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
2699 __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 = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2700 __Pyx_GOTREF(__pyx_t_1);
2701 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
2702 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
2703 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2704 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2714 * # open file and load index
2715 * self.tabixfile = ti_open( filename, filename_index ) # <<<<<<<<<<<<<<
2717 * if self.tabixfile == NULL:
2719 __pyx_t_6 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2720 __pyx_t_8 = PyBytes_AsString(__pyx_v_filename_index); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2721 __pyx_v_self->tabixfile = ti_open(__pyx_t_6, __pyx_t_8);
2727 * self.tabixfile = ti_open( filename, filename_index )
2729 * if self.tabixfile == NULL: # <<<<<<<<<<<<<<
2730 * raise IOError("could not open file `%s`" % filename )
2733 __pyx_t_3 = (__pyx_v_self->tabixfile == NULL);
2738 * if self.tabixfile == NULL:
2739 * raise IOError("could not open file `%s`" % filename ) # <<<<<<<<<<<<<<
2741 * def _parseRegion( self,
2743 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), __pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2744 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
2745 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2746 __Pyx_GOTREF(__pyx_t_2);
2747 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
2748 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
2750 __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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2751 __Pyx_GOTREF(__pyx_t_1);
2752 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
2753 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
2754 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2755 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2760 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2763 __Pyx_XDECREF(__pyx_t_1);
2764 __Pyx_XDECREF(__pyx_t_2);
2765 __Pyx_XDECREF(__pyx_t_4);
2766 __Pyx_AddTraceback("ctabix.Tabixfile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
2769 __Pyx_XDECREF(__pyx_v_filename_index);
2770 __Pyx_XDECREF(__pyx_v_bmode);
2771 __Pyx_XDECREF(__pyx_v_filename);
2772 __Pyx_XGIVEREF(__pyx_r);
2773 __Pyx_RefNannyFinishContext();
2777 /* Python wrapper */
2778 static PyObject *__pyx_pw_6ctabix_9Tabixfile_7_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2779 static char __pyx_doc_6ctabix_9Tabixfile_6_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 ";
2780 static PyObject *__pyx_pw_6ctabix_9Tabixfile_7_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2781 PyObject *__pyx_v_reference = 0;
2782 PyObject *__pyx_v_start = 0;
2783 PyObject *__pyx_v_end = 0;
2784 PyObject *__pyx_v_region = 0;
2785 PyObject *__pyx_r = 0;
2786 __Pyx_RefNannyDeclarations
2787 __Pyx_RefNannySetupContext("_parseRegion (wrapper)", 0);
2789 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0};
2790 PyObject* values[4] = {0,0,0,0};
2794 * def _parseRegion( self,
2795 * reference = None, # <<<<<<<<<<<<<<
2799 values[0] = ((PyObject *)Py_None);
2802 * def _parseRegion( self,
2804 * start = None, # <<<<<<<<<<<<<<
2808 values[1] = ((PyObject *)Py_None);
2813 * end = None, # <<<<<<<<<<<<<<
2815 * '''parse region information.
2817 values[2] = ((PyObject *)Py_None);
2822 * region = None ): # <<<<<<<<<<<<<<
2823 * '''parse region information.
2826 values[3] = ((PyObject *)Py_None);
2827 if (unlikely(__pyx_kwds)) {
2829 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2831 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2832 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2833 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2834 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2836 default: goto __pyx_L5_argtuple_error;
2838 kw_args = PyDict_Size(__pyx_kwds);
2842 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
2843 if (value) { values[0] = value; kw_args--; }
2847 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
2848 if (value) { values[1] = value; kw_args--; }
2852 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
2853 if (value) { values[2] = value; kw_args--; }
2857 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region);
2858 if (value) { values[3] = value; kw_args--; }
2861 if (unlikely(kw_args > 0)) {
2862 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_parseRegion") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2865 switch (PyTuple_GET_SIZE(__pyx_args)) {
2866 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2867 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2868 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2869 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2871 default: goto __pyx_L5_argtuple_error;
2874 __pyx_v_reference = values[0];
2875 __pyx_v_start = values[1];
2876 __pyx_v_end = values[2];
2877 __pyx_v_region = values[3];
2879 goto __pyx_L4_argument_unpacking_done;
2880 __pyx_L5_argtuple_error:;
2881 __Pyx_RaiseArgtupleInvalid("_parseRegion", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2883 __Pyx_AddTraceback("ctabix.Tabixfile._parseRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
2884 __Pyx_RefNannyFinishContext();
2886 __pyx_L4_argument_unpacking_done:;
2887 __pyx_r = __pyx_pf_6ctabix_9Tabixfile_6_parseRegion(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region);
2888 __Pyx_RefNannyFinishContext();
2893 * raise IOError("could not open file `%s`" % filename )
2895 * def _parseRegion( self, # <<<<<<<<<<<<<<
2900 static PyObject *__pyx_pf_6ctabix_9Tabixfile_6_parseRegion(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region) {
2904 int __pyx_v_max_pos;
2905 PyObject *__pyx_r = NULL;
2906 __Pyx_RefNannyDeclarations
2908 PyObject *__pyx_t_2 = NULL;
2911 PyObject *__pyx_t_5 = NULL;
2912 PyObject *__pyx_t_6 = NULL;
2914 PyObject *__pyx_t_8 = NULL;
2915 int __pyx_lineno = 0;
2916 const char *__pyx_filename = NULL;
2917 int __pyx_clineno = 0;
2918 __Pyx_RefNannySetupContext("_parseRegion", 0);
2919 __Pyx_INCREF(__pyx_v_region);
2922 * Note that regions are 1-based, while start,end are python coordinates.
2924 * ti_lazy_index_load( self.tabixfile ) # <<<<<<<<<<<<<<
2928 ti_lazy_index_load(__pyx_v_self->tabixfile);
2933 * max_pos = 2 << 29 # <<<<<<<<<<<<<<
2935 * rtid = rstart = rend = 0
2937 __pyx_v_max_pos = 1073741824;
2942 * rtid = rstart = rend = 0 # <<<<<<<<<<<<<<
2944 * # translate to a region
2952 * # translate to a region
2953 * if reference: # <<<<<<<<<<<<<<
2954 * if start != None and end != None:
2955 * region = "%s:%i-%i" % (reference, start+1, end)
2957 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_reference); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2961 * # translate to a region
2963 * if start != None and end != None: # <<<<<<<<<<<<<<
2964 * region = "%s:%i-%i" % (reference, start+1, end)
2965 * elif start == None and end != None:
2967 __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2968 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2969 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2971 __pyx_t_2 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2972 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2973 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2974 __pyx_t_4 = __pyx_t_3;
2976 __pyx_t_4 = __pyx_t_1;
2982 * if start != None and end != None:
2983 * region = "%s:%i-%i" % (reference, start+1, end) # <<<<<<<<<<<<<<
2984 * elif start == None and end != None:
2985 * region = "%s:%i-%i" % (reference, 1, end)
2987 __pyx_t_2 = PyNumber_Add(__pyx_v_start, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2988 __Pyx_GOTREF(__pyx_t_2);
2989 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2990 __Pyx_GOTREF(__pyx_t_5);
2991 __Pyx_INCREF(__pyx_v_reference);
2992 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_reference);
2993 __Pyx_GIVEREF(__pyx_v_reference);
2994 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
2995 __Pyx_GIVEREF(__pyx_t_2);
2996 __Pyx_INCREF(__pyx_v_end);
2997 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_end);
2998 __Pyx_GIVEREF(__pyx_v_end);
3000 __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3001 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
3002 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
3003 __Pyx_DECREF(__pyx_v_region);
3004 __pyx_v_region = ((PyObject *)__pyx_t_2);
3010 * if start != None and end != None:
3011 * region = "%s:%i-%i" % (reference, start+1, end)
3012 * elif start == None and end != None: # <<<<<<<<<<<<<<
3013 * region = "%s:%i-%i" % (reference, 1, end)
3014 * elif end == None and start != None:
3016 __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3017 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3018 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3020 __pyx_t_2 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3021 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3022 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3023 __pyx_t_3 = __pyx_t_1;
3025 __pyx_t_3 = __pyx_t_4;
3030 * region = "%s:%i-%i" % (reference, start+1, end)
3031 * elif start == None and end != None:
3032 * region = "%s:%i-%i" % (reference, 1, end) # <<<<<<<<<<<<<<
3033 * elif end == None and start != None:
3034 * region = "%s:%i-%i" % (reference, start+1, max_pos-1)
3036 __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3037 __Pyx_GOTREF(__pyx_t_2);
3038 __Pyx_INCREF(__pyx_v_reference);
3039 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_reference);
3040 __Pyx_GIVEREF(__pyx_v_reference);
3041 __Pyx_INCREF(__pyx_int_1);
3042 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_1);
3043 __Pyx_GIVEREF(__pyx_int_1);
3044 __Pyx_INCREF(__pyx_v_end);
3045 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_end);
3046 __Pyx_GIVEREF(__pyx_v_end);
3047 __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3048 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
3049 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
3050 __Pyx_DECREF(__pyx_v_region);
3051 __pyx_v_region = ((PyObject *)__pyx_t_5);
3057 * elif start == None and end != None:
3058 * region = "%s:%i-%i" % (reference, 1, end)
3059 * elif end == None and start != None: # <<<<<<<<<<<<<<
3060 * region = "%s:%i-%i" % (reference, start+1, max_pos-1)
3063 __pyx_t_5 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3064 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3065 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3067 __pyx_t_5 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3068 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3069 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3070 __pyx_t_1 = __pyx_t_4;
3072 __pyx_t_1 = __pyx_t_3;
3077 * region = "%s:%i-%i" % (reference, 1, end)
3078 * elif end == None and start != None:
3079 * region = "%s:%i-%i" % (reference, start+1, max_pos-1) # <<<<<<<<<<<<<<
3081 * region = reference
3083 __pyx_t_5 = PyNumber_Add(__pyx_v_start, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3084 __Pyx_GOTREF(__pyx_t_5);
3085 __pyx_t_2 = PyInt_FromLong((__pyx_v_max_pos - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3086 __Pyx_GOTREF(__pyx_t_2);
3087 __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3088 __Pyx_GOTREF(__pyx_t_6);
3089 __Pyx_INCREF(__pyx_v_reference);
3090 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_reference);
3091 __Pyx_GIVEREF(__pyx_v_reference);
3092 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
3093 __Pyx_GIVEREF(__pyx_t_5);
3094 PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2);
3095 __Pyx_GIVEREF(__pyx_t_2);
3098 __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3099 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
3100 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
3101 __Pyx_DECREF(__pyx_v_region);
3102 __pyx_v_region = ((PyObject *)__pyx_t_2);
3109 * region = "%s:%i-%i" % (reference, start+1, max_pos-1)
3111 * region = reference # <<<<<<<<<<<<<<
3115 __Pyx_INCREF(__pyx_v_reference);
3116 __Pyx_DECREF(__pyx_v_region);
3117 __pyx_v_region = __pyx_v_reference;
3125 * region = reference
3127 * if region: # <<<<<<<<<<<<<<
3128 * region = _force_bytes(region)
3129 * ti_parse_region( self.tabixfile.idx, region,
3131 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3137 * region = _force_bytes(region) # <<<<<<<<<<<<<<
3138 * ti_parse_region( self.tabixfile.idx, region,
3139 * &rtid, &rstart, &rend)
3141 __pyx_t_2 = ((PyObject *)__pyx_f_6ctabix__force_bytes(__pyx_v_region)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3142 __Pyx_GOTREF(__pyx_t_2);
3143 __Pyx_DECREF(__pyx_v_region);
3144 __pyx_v_region = __pyx_t_2;
3149 * region = _force_bytes(region)
3150 * ti_parse_region( self.tabixfile.idx, region, # <<<<<<<<<<<<<<
3151 * &rtid, &rstart, &rend)
3152 * if rtid < 0: raise ValueError( "invalid region `%s`" % region )
3154 __pyx_t_7 = PyBytes_AsString(__pyx_v_region); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3157 * region = _force_bytes(region)
3158 * ti_parse_region( self.tabixfile.idx, region,
3159 * &rtid, &rstart, &rend) # <<<<<<<<<<<<<<
3160 * if rtid < 0: raise ValueError( "invalid region `%s`" % region )
3161 * if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) )
3163 ti_parse_region(__pyx_v_self->tabixfile->idx, __pyx_t_7, (&__pyx_v_rtid), (&__pyx_v_rstart), (&__pyx_v_rend));
3166 * ti_parse_region( self.tabixfile.idx, region,
3167 * &rtid, &rstart, &rend)
3168 * if rtid < 0: raise ValueError( "invalid region `%s`" % region ) # <<<<<<<<<<<<<<
3169 * if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) )
3170 * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart )
3172 __pyx_t_1 = (__pyx_v_rtid < 0);
3174 __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_18), __pyx_v_region); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3175 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
3176 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3177 __Pyx_GOTREF(__pyx_t_6);
3178 PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_2));
3179 __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
3181 __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 = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3182 __Pyx_GOTREF(__pyx_t_2);
3183 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
3184 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
3185 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3186 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3192 * &rtid, &rstart, &rend)
3193 * if rtid < 0: raise ValueError( "invalid region `%s`" % region )
3194 * if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) ) # <<<<<<<<<<<<<<
3195 * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart )
3196 * if not 0 <= rend < max_pos: raise ValueError( 'end out of range (%i)' % rend )
3198 __pyx_t_1 = (__pyx_v_rstart > __pyx_v_rend);
3200 __pyx_t_2 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3201 __Pyx_GOTREF(__pyx_t_2);
3202 __pyx_t_6 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3203 __Pyx_GOTREF(__pyx_t_6);
3204 __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3205 __Pyx_GOTREF(__pyx_t_5);
3206 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
3207 __Pyx_GIVEREF(__pyx_t_2);
3208 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
3209 __Pyx_GIVEREF(__pyx_t_6);
3212 __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3213 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
3214 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
3215 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3216 __Pyx_GOTREF(__pyx_t_5);
3217 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
3218 __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
3220 __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 = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3221 __Pyx_GOTREF(__pyx_t_6);
3222 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
3223 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
3224 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3225 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3231 * if rtid < 0: raise ValueError( "invalid region `%s`" % region )
3232 * if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) )
3233 * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart ) # <<<<<<<<<<<<<<
3234 * if not 0 <= rend < max_pos: raise ValueError( 'end out of range (%i)' % rend )
3237 __pyx_t_1 = (0 <= __pyx_v_rstart);
3239 __pyx_t_1 = (__pyx_v_rstart < __pyx_v_max_pos);
3241 __pyx_t_3 = (!__pyx_t_1);
3243 __pyx_t_6 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3244 __Pyx_GOTREF(__pyx_t_6);
3245 __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3246 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
3247 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3248 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3249 __Pyx_GOTREF(__pyx_t_6);
3250 PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
3251 __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
3253 __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 = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3254 __Pyx_GOTREF(__pyx_t_5);
3255 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
3256 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
3257 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3258 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3264 * if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) )
3265 * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart )
3266 * if not 0 <= rend < max_pos: raise ValueError( 'end out of range (%i)' % rend ) # <<<<<<<<<<<<<<
3268 * return region, rtid, rstart, rend
3270 __pyx_t_3 = (0 <= __pyx_v_rend);
3272 __pyx_t_3 = (__pyx_v_rend < __pyx_v_max_pos);
3274 __pyx_t_1 = (!__pyx_t_3);
3276 __pyx_t_5 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3277 __Pyx_GOTREF(__pyx_t_5);
3278 __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3279 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
3280 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3281 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3282 __Pyx_GOTREF(__pyx_t_5);
3283 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
3284 __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
3286 __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 = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3287 __Pyx_GOTREF(__pyx_t_6);
3288 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
3289 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
3290 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3291 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3300 * if not 0 <= rend < max_pos: raise ValueError( 'end out of range (%i)' % rend )
3302 * return region, rtid, rstart, rend # <<<<<<<<<<<<<<
3306 __Pyx_XDECREF(__pyx_r);
3307 __pyx_t_6 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3308 __Pyx_GOTREF(__pyx_t_6);
3309 __pyx_t_5 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3310 __Pyx_GOTREF(__pyx_t_5);
3311 __pyx_t_2 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3312 __Pyx_GOTREF(__pyx_t_2);
3313 __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3314 __Pyx_GOTREF(__pyx_t_8);
3315 __Pyx_INCREF(__pyx_v_region);
3316 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_region);
3317 __Pyx_GIVEREF(__pyx_v_region);
3318 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
3319 __Pyx_GIVEREF(__pyx_t_6);
3320 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_5);
3321 __Pyx_GIVEREF(__pyx_t_5);
3322 PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_2);
3323 __Pyx_GIVEREF(__pyx_t_2);
3327 __pyx_r = ((PyObject *)__pyx_t_8);
3331 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3334 __Pyx_XDECREF(__pyx_t_2);
3335 __Pyx_XDECREF(__pyx_t_5);
3336 __Pyx_XDECREF(__pyx_t_6);
3337 __Pyx_XDECREF(__pyx_t_8);
3338 __Pyx_AddTraceback("ctabix.Tabixfile._parseRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
3341 __Pyx_XDECREF(__pyx_v_region);
3342 __Pyx_XGIVEREF(__pyx_r);
3343 __Pyx_RefNannyFinishContext();
3347 /* Python wrapper */
3348 static PyObject *__pyx_pw_6ctabix_9Tabixfile_9fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3349 static char __pyx_doc_6ctabix_9Tabixfile_8fetch[] = "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 ";
3350 static PyObject *__pyx_pw_6ctabix_9Tabixfile_9fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3351 PyObject *__pyx_v_reference = 0;
3352 PyObject *__pyx_v_start = 0;
3353 PyObject *__pyx_v_end = 0;
3354 PyObject *__pyx_v_region = 0;
3355 PyObject *__pyx_v_parser = 0;
3356 PyObject *__pyx_r = 0;
3357 __Pyx_RefNannyDeclarations
3358 __Pyx_RefNannySetupContext("fetch (wrapper)", 0);
3360 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};
3361 PyObject* values[5] = {0,0,0,0,0};
3366 * reference = None, # <<<<<<<<<<<<<<
3370 values[0] = ((PyObject *)Py_None);
3375 * start = None, # <<<<<<<<<<<<<<
3379 values[1] = ((PyObject *)Py_None);
3384 * end = None, # <<<<<<<<<<<<<<
3388 values[2] = ((PyObject *)Py_None);
3393 * region = None, # <<<<<<<<<<<<<<
3397 values[3] = ((PyObject *)Py_None);
3402 * parser = None ): # <<<<<<<<<<<<<<
3406 values[4] = ((PyObject *)Py_None);
3407 if (unlikely(__pyx_kwds)) {
3409 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3411 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3412 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3413 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3414 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3415 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3417 default: goto __pyx_L5_argtuple_error;
3419 kw_args = PyDict_Size(__pyx_kwds);
3423 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference);
3424 if (value) { values[0] = value; kw_args--; }
3428 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
3429 if (value) { values[1] = value; kw_args--; }
3433 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
3434 if (value) { values[2] = value; kw_args--; }
3438 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region);
3439 if (value) { values[3] = value; kw_args--; }
3443 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser);
3444 if (value) { values[4] = value; kw_args--; }
3447 if (unlikely(kw_args > 0)) {
3448 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3451 switch (PyTuple_GET_SIZE(__pyx_args)) {
3452 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3453 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3454 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3455 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3456 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3458 default: goto __pyx_L5_argtuple_error;
3461 __pyx_v_reference = values[0];
3462 __pyx_v_start = values[1];
3463 __pyx_v_end = values[2];
3464 __pyx_v_region = values[3];
3465 __pyx_v_parser = values[4];
3467 goto __pyx_L4_argument_unpacking_done;
3468 __pyx_L5_argtuple_error:;
3469 __Pyx_RaiseArgtupleInvalid("fetch", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3471 __Pyx_AddTraceback("ctabix.Tabixfile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
3472 __Pyx_RefNannyFinishContext();
3474 __pyx_L4_argument_unpacking_done:;
3475 __pyx_r = __pyx_pf_6ctabix_9Tabixfile_8fetch(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self), __pyx_v_reference, __pyx_v_start, __pyx_v_end, __pyx_v_region, __pyx_v_parser);
3476 __Pyx_RefNannyFinishContext();
3481 * return region, rtid, rstart, rend
3483 * def fetch( self, # <<<<<<<<<<<<<<
3488 static PyObject *__pyx_pf_6ctabix_9Tabixfile_8fetch(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_start, PyObject *__pyx_v_end, PyObject *__pyx_v_region, PyObject *__pyx_v_parser) {
3489 PyObject *__pyx_v_rtid = NULL;
3490 PyObject *__pyx_v_rstart = NULL;
3491 PyObject *__pyx_v_rend = NULL;
3492 PyObject *__pyx_r = NULL;
3493 __Pyx_RefNannyDeclarations
3494 PyObject *__pyx_t_1 = NULL;
3495 PyObject *__pyx_t_2 = NULL;
3498 PyObject *__pyx_t_5 = NULL;
3499 PyObject *__pyx_t_6 = NULL;
3500 PyObject *__pyx_t_7 = NULL;
3501 PyObject *__pyx_t_8 = NULL;
3502 PyObject *(*__pyx_t_9)(PyObject *);
3503 int __pyx_lineno = 0;
3504 const char *__pyx_filename = NULL;
3505 int __pyx_clineno = 0;
3506 __Pyx_RefNannySetupContext("fetch", 0);
3507 __Pyx_INCREF(__pyx_v_region);
3510 * data (see for example :meth:`asTuple` and :meth:`asGTF`).
3512 * ti_lazy_index_load( self.tabixfile ) # <<<<<<<<<<<<<<
3514 * if not self._isOpen():
3516 ti_lazy_index_load(__pyx_v_self->tabixfile);
3519 * ti_lazy_index_load( self.tabixfile )
3521 * if not self._isOpen(): # <<<<<<<<<<<<<<
3522 * raise ValueError( "I/O operation on closed file" )
3525 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3526 __Pyx_GOTREF(__pyx_t_1);
3527 __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 = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3528 __Pyx_GOTREF(__pyx_t_2);
3529 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3530 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3531 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3532 __pyx_t_4 = (!__pyx_t_3);
3537 * if not self._isOpen():
3538 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
3540 * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
3542 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3543 __Pyx_GOTREF(__pyx_t_2);
3544 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
3545 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3546 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3552 * raise ValueError( "I/O operation on closed file" )
3554 * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) # <<<<<<<<<<<<<<
3556 * if parser == None:
3558 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3559 __Pyx_GOTREF(__pyx_t_2);
3560 __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3561 __Pyx_GOTREF(__pyx_t_1);
3562 __Pyx_INCREF(__pyx_v_reference);
3563 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference);
3564 __Pyx_GIVEREF(__pyx_v_reference);
3565 __Pyx_INCREF(__pyx_v_start);
3566 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start);
3567 __Pyx_GIVEREF(__pyx_v_start);
3568 __Pyx_INCREF(__pyx_v_end);
3569 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end);
3570 __Pyx_GIVEREF(__pyx_v_end);
3571 __Pyx_INCREF(__pyx_v_region);
3572 PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_region);
3573 __Pyx_GIVEREF(__pyx_v_region);
3574 __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 = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3575 __Pyx_GOTREF(__pyx_t_5);
3576 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3577 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
3578 if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
3579 PyObject* sequence = __pyx_t_5;
3580 #if CYTHON_COMPILING_IN_CPYTHON
3581 Py_ssize_t size = Py_SIZE(sequence);
3583 Py_ssize_t size = PySequence_Size(sequence);
3585 if (unlikely(size != 4)) {
3586 if (size > 4) __Pyx_RaiseTooManyValuesError(4);
3587 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3588 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3590 #if CYTHON_COMPILING_IN_CPYTHON
3591 if (likely(PyTuple_CheckExact(sequence))) {
3592 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
3593 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
3594 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2);
3595 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 3);
3597 __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
3598 __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
3599 __pyx_t_6 = PyList_GET_ITEM(sequence, 2);
3600 __pyx_t_7 = PyList_GET_ITEM(sequence, 3);
3602 __Pyx_INCREF(__pyx_t_1);
3603 __Pyx_INCREF(__pyx_t_2);
3604 __Pyx_INCREF(__pyx_t_6);
3605 __Pyx_INCREF(__pyx_t_7);
3608 PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_6,&__pyx_t_7};
3609 for (i=0; i < 4; i++) {
3610 PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3614 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3617 Py_ssize_t index = -1;
3618 PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_6,&__pyx_t_7};
3619 __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3620 __Pyx_GOTREF(__pyx_t_8);
3621 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3622 __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
3623 for (index=0; index < 4; index++) {
3624 PyObject* item = __pyx_t_9(__pyx_t_8); if (unlikely(!item)) goto __pyx_L4_unpacking_failed;
3626 *(temps[index]) = item;
3628 if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3630 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3631 goto __pyx_L5_unpacking_done;
3632 __pyx_L4_unpacking_failed:;
3633 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3635 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3636 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3637 __pyx_L5_unpacking_done:;
3639 __Pyx_DECREF(__pyx_v_region);
3640 __pyx_v_region = __pyx_t_1;
3642 __pyx_v_rtid = __pyx_t_2;
3644 __pyx_v_rstart = __pyx_t_6;
3646 __pyx_v_rend = __pyx_t_7;
3650 * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
3652 * if parser == None: # <<<<<<<<<<<<<<
3654 * return TabixIterator( self, rtid, rstart, rend )
3656 __pyx_t_5 = PyObject_RichCompare(__pyx_v_parser, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3657 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3658 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3663 * if parser == None:
3664 * if region: # <<<<<<<<<<<<<<
3665 * return TabixIterator( self, rtid, rstart, rend )
3668 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3672 * if parser == None:
3674 * return TabixIterator( self, rtid, rstart, rend ) # <<<<<<<<<<<<<<
3676 * return TabixIterator( self, -1, 0, 0 )
3678 __Pyx_XDECREF(__pyx_r);
3679 __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3680 __Pyx_GOTREF(__pyx_t_5);
3681 __Pyx_INCREF(((PyObject *)__pyx_v_self));
3682 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self));
3683 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
3684 __Pyx_INCREF(__pyx_v_rtid);
3685 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_rtid);
3686 __Pyx_GIVEREF(__pyx_v_rtid);
3687 __Pyx_INCREF(__pyx_v_rstart);
3688 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_rstart);
3689 __Pyx_GIVEREF(__pyx_v_rstart);
3690 __Pyx_INCREF(__pyx_v_rend);
3691 PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_rend);
3692 __Pyx_GIVEREF(__pyx_v_rend);
3693 __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 = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3694 __Pyx_GOTREF(__pyx_t_7);
3695 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
3696 __pyx_r = __pyx_t_7;
3704 * return TabixIterator( self, rtid, rstart, rend )
3706 * return TabixIterator( self, -1, 0, 0 ) # <<<<<<<<<<<<<<
3710 __Pyx_XDECREF(__pyx_r);
3711 __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3712 __Pyx_GOTREF(__pyx_t_7);
3713 __Pyx_INCREF(((PyObject *)__pyx_v_self));
3714 PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_self));
3715 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
3716 __Pyx_INCREF(__pyx_int_neg_1);
3717 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_neg_1);
3718 __Pyx_GIVEREF(__pyx_int_neg_1);
3719 __Pyx_INCREF(__pyx_int_0);
3720 PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_int_0);
3721 __Pyx_GIVEREF(__pyx_int_0);
3722 __Pyx_INCREF(__pyx_int_0);
3723 PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_int_0);
3724 __Pyx_GIVEREF(__pyx_int_0);
3725 __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 = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3726 __Pyx_GOTREF(__pyx_t_5);
3727 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
3728 __pyx_r = __pyx_t_5;
3738 * return TabixIterator( self, -1, 0, 0 )
3740 * if region: # <<<<<<<<<<<<<<
3741 * return TabixIteratorParsed( self, rtid, rstart, rend, parser )
3744 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3750 * return TabixIteratorParsed( self, rtid, rstart, rend, parser ) # <<<<<<<<<<<<<<
3752 * return TabixIteratorParsed( self, -1, 0, 0, parser )
3754 __Pyx_XDECREF(__pyx_r);
3755 __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3756 __Pyx_GOTREF(__pyx_t_5);
3757 __Pyx_INCREF(((PyObject *)__pyx_v_self));
3758 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self));
3759 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
3760 __Pyx_INCREF(__pyx_v_rtid);
3761 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_rtid);
3762 __Pyx_GIVEREF(__pyx_v_rtid);
3763 __Pyx_INCREF(__pyx_v_rstart);
3764 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_rstart);
3765 __Pyx_GIVEREF(__pyx_v_rstart);
3766 __Pyx_INCREF(__pyx_v_rend);
3767 PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_rend);
3768 __Pyx_GIVEREF(__pyx_v_rend);
3769 __Pyx_INCREF(__pyx_v_parser);
3770 PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_v_parser);
3771 __Pyx_GIVEREF(__pyx_v_parser);
3772 __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 = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3773 __Pyx_GOTREF(__pyx_t_7);
3774 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
3775 __pyx_r = __pyx_t_7;
3783 * return TabixIteratorParsed( self, rtid, rstart, rend, parser )
3785 * return TabixIteratorParsed( self, -1, 0, 0, parser ) # <<<<<<<<<<<<<<
3787 * ###############################################################
3789 __Pyx_XDECREF(__pyx_r);
3790 __pyx_t_7 = PyTuple_New(5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3791 __Pyx_GOTREF(__pyx_t_7);
3792 __Pyx_INCREF(((PyObject *)__pyx_v_self));
3793 PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_self));
3794 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
3795 __Pyx_INCREF(__pyx_int_neg_1);
3796 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_neg_1);
3797 __Pyx_GIVEREF(__pyx_int_neg_1);
3798 __Pyx_INCREF(__pyx_int_0);
3799 PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_int_0);
3800 __Pyx_GIVEREF(__pyx_int_0);
3801 __Pyx_INCREF(__pyx_int_0);
3802 PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_int_0);
3803 __Pyx_GIVEREF(__pyx_int_0);
3804 __Pyx_INCREF(__pyx_v_parser);
3805 PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_v_parser);
3806 __Pyx_GIVEREF(__pyx_v_parser);
3807 __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 = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3808 __Pyx_GOTREF(__pyx_t_5);
3809 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
3810 __pyx_r = __pyx_t_5;
3818 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3821 __Pyx_XDECREF(__pyx_t_1);
3822 __Pyx_XDECREF(__pyx_t_2);
3823 __Pyx_XDECREF(__pyx_t_5);
3824 __Pyx_XDECREF(__pyx_t_6);
3825 __Pyx_XDECREF(__pyx_t_7);
3826 __Pyx_XDECREF(__pyx_t_8);
3827 __Pyx_AddTraceback("ctabix.Tabixfile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
3830 __Pyx_XDECREF(__pyx_v_rtid);
3831 __Pyx_XDECREF(__pyx_v_rstart);
3832 __Pyx_XDECREF(__pyx_v_rend);
3833 __Pyx_XDECREF(__pyx_v_region);
3834 __Pyx_XGIVEREF(__pyx_r);
3835 __Pyx_RefNannyFinishContext();
3839 /* Python wrapper */
3840 static PyObject *__pyx_pw_6ctabix_9Tabixfile_8filename_1__get__(PyObject *__pyx_v_self); /*proto*/
3841 static PyObject *__pyx_pw_6ctabix_9Tabixfile_8filename_1__get__(PyObject *__pyx_v_self) {
3842 PyObject *__pyx_r = 0;
3843 __Pyx_RefNannyDeclarations
3844 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
3845 __pyx_r = __pyx_pf_6ctabix_9Tabixfile_8filename___get__(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self));
3846 __Pyx_RefNannyFinishContext();
3851 * property filename:
3852 * '''filename associated with this object.'''
3853 * def __get__(self): # <<<<<<<<<<<<<<
3854 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
3855 * return self._filename
3858 static PyObject *__pyx_pf_6ctabix_9Tabixfile_8filename___get__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self) {
3859 PyObject *__pyx_r = NULL;
3860 __Pyx_RefNannyDeclarations
3861 PyObject *__pyx_t_1 = NULL;
3862 PyObject *__pyx_t_2 = NULL;
3865 int __pyx_lineno = 0;
3866 const char *__pyx_filename = NULL;
3867 int __pyx_clineno = 0;
3868 __Pyx_RefNannySetupContext("__get__", 0);
3871 * '''filename associated with this object.'''
3872 * def __get__(self):
3873 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
3874 * return self._filename
3877 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3878 __Pyx_GOTREF(__pyx_t_1);
3879 __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 = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3880 __Pyx_GOTREF(__pyx_t_2);
3881 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3882 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3883 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3884 __pyx_t_4 = (!__pyx_t_3);
3886 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3887 __Pyx_GOTREF(__pyx_t_2);
3888 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
3889 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3890 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3896 * def __get__(self):
3897 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" )
3898 * return self._filename # <<<<<<<<<<<<<<
3902 __Pyx_XDECREF(__pyx_r);
3903 __pyx_t_2 = PyBytes_FromString(__pyx_v_self->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3904 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
3905 __pyx_r = ((PyObject *)__pyx_t_2);
3909 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3912 __Pyx_XDECREF(__pyx_t_1);
3913 __Pyx_XDECREF(__pyx_t_2);
3914 __Pyx_AddTraceback("ctabix.Tabixfile.filename.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3917 __Pyx_XGIVEREF(__pyx_r);
3918 __Pyx_RefNannyFinishContext();
3922 /* Python wrapper */
3923 static PyObject *__pyx_pw_6ctabix_9Tabixfile_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
3924 static PyObject *__pyx_pw_6ctabix_9Tabixfile_6header_1__get__(PyObject *__pyx_v_self) {
3925 PyObject *__pyx_r = 0;
3926 __Pyx_RefNannyDeclarations
3927 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
3928 __pyx_r = __pyx_pf_6ctabix_9Tabixfile_6header___get__(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self));
3929 __Pyx_RefNannyFinishContext();
3936 * def __get__( self ): # <<<<<<<<<<<<<<
3937 * return TabixHeaderIterator( self )
3941 static PyObject *__pyx_pf_6ctabix_9Tabixfile_6header___get__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self) {
3942 PyObject *__pyx_r = NULL;
3943 __Pyx_RefNannyDeclarations
3944 PyObject *__pyx_t_1 = NULL;
3945 PyObject *__pyx_t_2 = NULL;
3946 int __pyx_lineno = 0;
3947 const char *__pyx_filename = NULL;
3948 int __pyx_clineno = 0;
3949 __Pyx_RefNannySetupContext("__get__", 0);
3953 * def __get__( self ):
3954 * return TabixHeaderIterator( self ) # <<<<<<<<<<<<<<
3958 __Pyx_XDECREF(__pyx_r);
3959 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3960 __Pyx_GOTREF(__pyx_t_1);
3961 __Pyx_INCREF(((PyObject *)__pyx_v_self));
3962 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
3963 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
3964 __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 = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3965 __Pyx_GOTREF(__pyx_t_2);
3966 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
3967 __pyx_r = __pyx_t_2;
3971 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3974 __Pyx_XDECREF(__pyx_t_1);
3975 __Pyx_XDECREF(__pyx_t_2);
3976 __Pyx_AddTraceback("ctabix.Tabixfile.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3979 __Pyx_XGIVEREF(__pyx_r);
3980 __Pyx_RefNannyFinishContext();
3984 /* Python wrapper */
3985 static PyObject *__pyx_pw_6ctabix_9Tabixfile_7contigs_1__get__(PyObject *__pyx_v_self); /*proto*/
3986 static PyObject *__pyx_pw_6ctabix_9Tabixfile_7contigs_1__get__(PyObject *__pyx_v_self) {
3987 PyObject *__pyx_r = 0;
3988 __Pyx_RefNannyDeclarations
3989 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
3990 __pyx_r = __pyx_pf_6ctabix_9Tabixfile_7contigs___get__(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self));
3991 __Pyx_RefNannyFinishContext();
3997 * '''chromosome names'''
3998 * def __get__(self): # <<<<<<<<<<<<<<
3999 * cdef char ** sequences
4000 * cdef int nsequences
4003 static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self) {
4004 char **__pyx_v_sequences;
4005 int __pyx_v_nsequences;
4007 PyObject *__pyx_v_result = NULL;
4008 PyObject *__pyx_r = NULL;
4009 __Pyx_RefNannyDeclarations
4010 PyObject *__pyx_t_1 = NULL;
4013 int __pyx_lineno = 0;
4014 const char *__pyx_filename = NULL;
4015 int __pyx_clineno = 0;
4016 __Pyx_RefNannySetupContext("__get__", 0);
4019 * cdef int nsequences
4021 * ti_lazy_index_load( self.tabixfile ) # <<<<<<<<<<<<<<
4022 * sequences = ti_seqname( self.tabixfile.idx, &nsequences )
4025 ti_lazy_index_load(__pyx_v_self->tabixfile);
4029 * ti_lazy_index_load( self.tabixfile )
4030 * sequences = ti_seqname( self.tabixfile.idx, &nsequences ) # <<<<<<<<<<<<<<
4034 __pyx_v_sequences = ti_seqname(__pyx_v_self->tabixfile->idx, (&__pyx_v_nsequences));
4037 * sequences = ti_seqname( self.tabixfile.idx, &nsequences )
4039 * result = [] # <<<<<<<<<<<<<<
4040 * for x from 0 <= x < nsequences:
4041 * result.append( sequences[x] )
4043 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4044 __Pyx_GOTREF(__pyx_t_1);
4045 __pyx_v_result = __pyx_t_1;
4051 * for x from 0 <= x < nsequences: # <<<<<<<<<<<<<<
4052 * result.append( sequences[x] )
4055 __pyx_t_2 = __pyx_v_nsequences;
4056 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_2; __pyx_v_x++) {
4060 * for x from 0 <= x < nsequences:
4061 * result.append( sequences[x] ) # <<<<<<<<<<<<<<
4065 __pyx_t_1 = PyBytes_FromString((__pyx_v_sequences[__pyx_v_x])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4066 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
4067 __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 = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4068 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
4072 * for x from 0 <= x < nsequences:
4073 * result.append( sequences[x] )
4074 * return result # <<<<<<<<<<<<<<
4076 * def close( self ):
4078 __Pyx_XDECREF(__pyx_r);
4079 __Pyx_INCREF(((PyObject *)__pyx_v_result));
4080 __pyx_r = ((PyObject *)__pyx_v_result);
4083 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4086 __Pyx_XDECREF(__pyx_t_1);
4087 __Pyx_AddTraceback("ctabix.Tabixfile.contigs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4090 __Pyx_XDECREF(__pyx_v_result);
4091 __Pyx_XGIVEREF(__pyx_r);
4092 __Pyx_RefNannyFinishContext();
4096 /* Python wrapper */
4097 static PyObject *__pyx_pw_6ctabix_9Tabixfile_11close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
4098 static char __pyx_doc_6ctabix_9Tabixfile_10close[] = "Tabixfile.close(self)\n\n closes the :class:`pysam.Tabixfile`.";
4099 static PyObject *__pyx_pw_6ctabix_9Tabixfile_11close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4100 PyObject *__pyx_r = 0;
4101 __Pyx_RefNannyDeclarations
4102 __Pyx_RefNannySetupContext("close (wrapper)", 0);
4103 __pyx_r = __pyx_pf_6ctabix_9Tabixfile_10close(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self));
4104 __Pyx_RefNannyFinishContext();
4111 * def close( self ): # <<<<<<<<<<<<<<
4113 * closes the :class:`pysam.Tabixfile`.'''
4116 static PyObject *__pyx_pf_6ctabix_9Tabixfile_10close(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self) {
4117 PyObject *__pyx_r = NULL;
4118 __Pyx_RefNannyDeclarations
4120 __Pyx_RefNannySetupContext("close", 0);
4124 * closes the :class:`pysam.Tabixfile`.'''
4125 * if self.tabixfile != NULL: # <<<<<<<<<<<<<<
4126 * ti_close( self.tabixfile )
4127 * self.tabixfile = NULL
4129 __pyx_t_1 = (__pyx_v_self->tabixfile != NULL);
4133 * closes the :class:`pysam.Tabixfile`.'''
4134 * if self.tabixfile != NULL:
4135 * ti_close( self.tabixfile ) # <<<<<<<<<<<<<<
4136 * self.tabixfile = NULL
4139 ti_close(__pyx_v_self->tabixfile);
4142 * if self.tabixfile != NULL:
4143 * ti_close( self.tabixfile )
4144 * self.tabixfile = NULL # <<<<<<<<<<<<<<
4146 * def __dealloc__( self ):
4148 __pyx_v_self->tabixfile = NULL;
4153 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4154 __Pyx_XGIVEREF(__pyx_r);
4155 __Pyx_RefNannyFinishContext();
4159 /* Python wrapper */
4160 static void __pyx_pw_6ctabix_9Tabixfile_13__dealloc__(PyObject *__pyx_v_self); /*proto*/
4161 static void __pyx_pw_6ctabix_9Tabixfile_13__dealloc__(PyObject *__pyx_v_self) {
4162 __Pyx_RefNannyDeclarations
4163 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
4164 __pyx_pf_6ctabix_9Tabixfile_12__dealloc__(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self));
4165 __Pyx_RefNannyFinishContext();
4169 * self.tabixfile = NULL
4171 * def __dealloc__( self ): # <<<<<<<<<<<<<<
4172 * # remember: dealloc cannot call other python methods
4173 * # note: no doc string
4176 static void __pyx_pf_6ctabix_9Tabixfile_12__dealloc__(struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_self) {
4177 __Pyx_RefNannyDeclarations
4179 __Pyx_RefNannySetupContext("__dealloc__", 0);
4182 * # note: no doc string
4183 * # note: __del__ is not called.
4184 * if self.tabixfile != NULL: # <<<<<<<<<<<<<<
4185 * ti_close( self.tabixfile )
4186 * self.tabixfile = NULL
4188 __pyx_t_1 = (__pyx_v_self->tabixfile != NULL);
4192 * # note: __del__ is not called.
4193 * if self.tabixfile != NULL:
4194 * ti_close( self.tabixfile ) # <<<<<<<<<<<<<<
4195 * self.tabixfile = NULL
4196 * if self._filename != NULL: free( self._filename )
4198 ti_close(__pyx_v_self->tabixfile);
4201 * if self.tabixfile != NULL:
4202 * ti_close( self.tabixfile )
4203 * self.tabixfile = NULL # <<<<<<<<<<<<<<
4204 * if self._filename != NULL: free( self._filename )
4207 __pyx_v_self->tabixfile = NULL;
4213 * ti_close( self.tabixfile )
4214 * self.tabixfile = NULL
4215 * if self._filename != NULL: free( self._filename ) # <<<<<<<<<<<<<<
4217 * cdef class TabixIterator:
4219 __pyx_t_1 = (__pyx_v_self->_filename != NULL);
4221 free(__pyx_v_self->_filename);
4226 __Pyx_RefNannyFinishContext();
4229 /* Python wrapper */
4230 static int __pyx_pw_6ctabix_13TabixIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4231 static int __pyx_pw_6ctabix_13TabixIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4232 struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile = 0;
4237 __Pyx_RefNannyDeclarations
4238 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
4240 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,0};
4241 PyObject* values[4] = {0,0,0,0};
4242 if (unlikely(__pyx_kwds)) {
4244 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4246 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4247 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4248 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4249 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4251 default: goto __pyx_L5_argtuple_error;
4253 kw_args = PyDict_Size(__pyx_kwds);
4256 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile)) != 0)) kw_args--;
4257 else goto __pyx_L5_argtuple_error;
4259 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid)) != 0)) kw_args--;
4261 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4264 if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start)) != 0)) kw_args--;
4266 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4269 if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end)) != 0)) kw_args--;
4271 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4274 if (unlikely(kw_args > 0)) {
4275 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4277 } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
4278 goto __pyx_L5_argtuple_error;
4280 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4281 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4282 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4283 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4285 __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)values[0]);
4286 __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4287 __pyx_v_start = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4288 __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4290 goto __pyx_L4_argument_unpacking_done;
4291 __pyx_L5_argtuple_error:;
4292 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4294 __Pyx_AddTraceback("ctabix.TabixIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4295 __Pyx_RefNannyFinishContext();
4297 __pyx_L4_argument_unpacking_done:;
4298 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tabixfile), __pyx_ptype_6ctabix_Tabixfile, 1, "tabixfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4299 __pyx_r = __pyx_pf_6ctabix_13TabixIterator___cinit__(((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self), __pyx_v_tabixfile, __pyx_v_tid, __pyx_v_start, __pyx_v_end);
4304 __Pyx_RefNannyFinishContext();
4311 * def __cinit__(self, Tabixfile tabixfile, # <<<<<<<<<<<<<<
4312 * int tid, int start, int end ):
4316 static int __pyx_pf_6ctabix_13TabixIterator___cinit__(struct __pyx_obj_6ctabix_TabixIterator *__pyx_v_self, struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end) {
4318 __Pyx_RefNannyDeclarations
4319 PyObject *__pyx_t_1 = NULL;
4320 PyObject *__pyx_t_2 = NULL;
4322 int __pyx_lineno = 0;
4323 const char *__pyx_filename = NULL;
4324 int __pyx_clineno = 0;
4325 __Pyx_RefNannySetupContext("__cinit__", 0);
4328 * int tid, int start, int end ):
4330 * assert tabixfile._isOpen() # <<<<<<<<<<<<<<
4332 * # makes sure that samfile stays alive as long as the
4334 #ifndef CYTHON_WITHOUT_ASSERTIONS
4335 __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 = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4336 __Pyx_GOTREF(__pyx_t_1);
4337 __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 = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4338 __Pyx_GOTREF(__pyx_t_2);
4339 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4340 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4341 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4342 if (unlikely(!__pyx_t_3)) {
4343 PyErr_SetNone(PyExc_AssertionError);
4344 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4349 * # makes sure that samfile stays alive as long as the
4350 * # iterator is alive.
4351 * self.tabixfile = tabixfile.tabixfile # <<<<<<<<<<<<<<
4355 __pyx_v_self->tabixfile = __pyx_v_tabixfile->tabixfile;
4358 * self.tabixfile = tabixfile.tabixfile
4360 * if tid < 0: # <<<<<<<<<<<<<<
4361 * # seek to start of file to ensure iteration is over
4364 __pyx_t_3 = (__pyx_v_tid < 0);
4368 * # seek to start of file to ensure iteration is over
4370 * bgzf_seek( self.tabixfile.fp, 0, 0) # <<<<<<<<<<<<<<
4371 * self.iterator = ti_iter_first()
4374 bgzf_seek(__pyx_v_self->tabixfile->fp, 0, 0);
4378 * bgzf_seek( self.tabixfile.fp, 0, 0)
4379 * self.iterator = ti_iter_first() # <<<<<<<<<<<<<<
4381 * self.iterator = ti_queryi(self.tabixfile, tid, start, end)
4383 __pyx_v_self->iterator = ti_iter_first();
4389 * self.iterator = ti_iter_first()
4391 * self.iterator = ti_queryi(self.tabixfile, tid, start, end) # <<<<<<<<<<<<<<
4393 * if <void*>self.iterator == NULL:
4395 __pyx_v_self->iterator = ti_queryi(__pyx_v_self->tabixfile, __pyx_v_tid, __pyx_v_start, __pyx_v_end);
4400 * self.iterator = ti_queryi(self.tabixfile, tid, start, end)
4402 * if <void*>self.iterator == NULL: # <<<<<<<<<<<<<<
4403 * raise ValueError("malformatted query or wrong sequence name.\n")
4406 __pyx_t_3 = (((void *)__pyx_v_self->iterator) == NULL);
4411 * if <void*>self.iterator == NULL:
4412 * raise ValueError("malformatted query or wrong sequence name.\n") # <<<<<<<<<<<<<<
4414 * def __iter__(self):
4416 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4417 __Pyx_GOTREF(__pyx_t_2);
4418 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
4419 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4420 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4428 __Pyx_XDECREF(__pyx_t_1);
4429 __Pyx_XDECREF(__pyx_t_2);
4430 __Pyx_AddTraceback("ctabix.TabixIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4433 __Pyx_RefNannyFinishContext();
4437 /* Python wrapper */
4438 static PyObject *__pyx_pw_6ctabix_13TabixIterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
4439 static PyObject *__pyx_pw_6ctabix_13TabixIterator_3__iter__(PyObject *__pyx_v_self) {
4440 PyObject *__pyx_r = 0;
4441 __Pyx_RefNannyDeclarations
4442 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
4443 __pyx_r = __pyx_pf_6ctabix_13TabixIterator_2__iter__(((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self));
4444 __Pyx_RefNannyFinishContext();
4449 * raise ValueError("malformatted query or wrong sequence name.\n")
4451 * def __iter__(self): # <<<<<<<<<<<<<<
4456 static PyObject *__pyx_pf_6ctabix_13TabixIterator_2__iter__(struct __pyx_obj_6ctabix_TabixIterator *__pyx_v_self) {
4457 PyObject *__pyx_r = NULL;
4458 __Pyx_RefNannyDeclarations
4459 __Pyx_RefNannySetupContext("__iter__", 0);
4463 * def __iter__(self):
4464 * return self # <<<<<<<<<<<<<<
4466 * def __next__(self):
4468 __Pyx_XDECREF(__pyx_r);
4469 __Pyx_INCREF(((PyObject *)__pyx_v_self));
4470 __pyx_r = ((PyObject *)__pyx_v_self);
4473 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4475 __Pyx_XGIVEREF(__pyx_r);
4476 __Pyx_RefNannyFinishContext();
4480 /* Python wrapper */
4481 static PyObject *__pyx_pw_6ctabix_13TabixIterator_5__next__(PyObject *__pyx_v_self); /*proto*/
4482 static char __pyx_doc_6ctabix_13TabixIterator_4__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n ";
4483 #if CYTHON_COMPILING_IN_CPYTHON
4484 struct wrapperbase __pyx_wrapperbase_6ctabix_13TabixIterator_4__next__;
4486 static PyObject *__pyx_pw_6ctabix_13TabixIterator_5__next__(PyObject *__pyx_v_self) {
4487 PyObject *__pyx_r = 0;
4488 __Pyx_RefNannyDeclarations
4489 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
4490 __pyx_r = __pyx_pf_6ctabix_13TabixIterator_4__next__(((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self));
4491 __Pyx_RefNannyFinishContext();
4498 * def __next__(self): # <<<<<<<<<<<<<<
4499 * """python version of next().
4503 static PyObject *__pyx_pf_6ctabix_13TabixIterator_4__next__(struct __pyx_obj_6ctabix_TabixIterator *__pyx_v_self) {
4506 PyObject *__pyx_v_retval = NULL;
4507 PyObject *__pyx_r = NULL;
4508 __Pyx_RefNannyDeclarations
4510 PyObject *__pyx_t_2 = NULL;
4511 int __pyx_lineno = 0;
4512 const char *__pyx_filename = NULL;
4513 int __pyx_clineno = 0;
4514 __Pyx_RefNannySetupContext("__next__", 0);
4518 * # simply use '#' for now.
4519 * while 1: # <<<<<<<<<<<<<<
4520 * s = ti_read(self.tabixfile, self.iterator, &len)
4521 * if s == NULL: raise StopIteration
4527 * # simply use '#' for now.
4529 * s = ti_read(self.tabixfile, self.iterator, &len) # <<<<<<<<<<<<<<
4530 * if s == NULL: raise StopIteration
4531 * if s[0] != '#': break
4533 __pyx_v_s = ti_read(__pyx_v_self->tabixfile, __pyx_v_self->iterator, (&__pyx_v_len));
4537 * s = ti_read(self.tabixfile, self.iterator, &len)
4538 * if s == NULL: raise StopIteration # <<<<<<<<<<<<<<
4539 * if s[0] != '#': break
4542 __pyx_t_1 = (__pyx_v_s == NULL);
4544 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
4545 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4551 * s = ti_read(self.tabixfile, self.iterator, &len)
4552 * if s == NULL: raise StopIteration
4553 * if s[0] != '#': break # <<<<<<<<<<<<<<
4555 * retval = _charptr_to_str( s )
4557 __pyx_t_1 = ((__pyx_v_s[0]) != '#');
4559 goto __pyx_L4_break;
4567 * if s[0] != '#': break
4569 * retval = _charptr_to_str( s ) # <<<<<<<<<<<<<<
4573 __pyx_t_2 = __pyx_f_6ctabix__charptr_to_str(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4574 __Pyx_GOTREF(__pyx_t_2);
4575 __pyx_v_retval = __pyx_t_2;
4580 * retval = _charptr_to_str( s )
4581 * return retval # <<<<<<<<<<<<<<
4583 * def __dealloc__(self):
4585 __Pyx_XDECREF(__pyx_r);
4586 __Pyx_INCREF(__pyx_v_retval);
4587 __pyx_r = __pyx_v_retval;
4590 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4593 __Pyx_XDECREF(__pyx_t_2);
4594 __Pyx_AddTraceback("ctabix.TabixIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4597 __Pyx_XDECREF(__pyx_v_retval);
4598 __Pyx_XGIVEREF(__pyx_r);
4599 __Pyx_RefNannyFinishContext();
4603 /* Python wrapper */
4604 static void __pyx_pw_6ctabix_13TabixIterator_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
4605 static void __pyx_pw_6ctabix_13TabixIterator_7__dealloc__(PyObject *__pyx_v_self) {
4606 __Pyx_RefNannyDeclarations
4607 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
4608 __pyx_pf_6ctabix_13TabixIterator_6__dealloc__(((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self));
4609 __Pyx_RefNannyFinishContext();
4615 * def __dealloc__(self): # <<<<<<<<<<<<<<
4616 * if <void*>self.iterator != NULL:
4617 * ti_iter_destroy(self.iterator)
4620 static void __pyx_pf_6ctabix_13TabixIterator_6__dealloc__(struct __pyx_obj_6ctabix_TabixIterator *__pyx_v_self) {
4621 __Pyx_RefNannyDeclarations
4623 __Pyx_RefNannySetupContext("__dealloc__", 0);
4627 * def __dealloc__(self):
4628 * if <void*>self.iterator != NULL: # <<<<<<<<<<<<<<
4629 * ti_iter_destroy(self.iterator)
4632 __pyx_t_1 = (((void *)__pyx_v_self->iterator) != NULL);
4636 * def __dealloc__(self):
4637 * if <void*>self.iterator != NULL:
4638 * ti_iter_destroy(self.iterator) # <<<<<<<<<<<<<<
4640 * cdef class TabixHeaderIterator:
4642 ti_iter_destroy(__pyx_v_self->iterator);
4647 __Pyx_RefNannyFinishContext();
4650 /* Python wrapper */
4651 static int __pyx_pw_6ctabix_19TabixHeaderIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4652 static int __pyx_pw_6ctabix_19TabixHeaderIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4653 struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile = 0;
4655 __Pyx_RefNannyDeclarations
4656 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
4658 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,0};
4659 PyObject* values[1] = {0};
4660 if (unlikely(__pyx_kwds)) {
4662 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4664 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4666 default: goto __pyx_L5_argtuple_error;
4668 kw_args = PyDict_Size(__pyx_kwds);
4671 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile)) != 0)) kw_args--;
4672 else goto __pyx_L5_argtuple_error;
4674 if (unlikely(kw_args > 0)) {
4675 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4677 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
4678 goto __pyx_L5_argtuple_error;
4680 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4682 __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)values[0]);
4684 goto __pyx_L4_argument_unpacking_done;
4685 __pyx_L5_argtuple_error:;
4686 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4688 __Pyx_AddTraceback("ctabix.TabixHeaderIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4689 __Pyx_RefNannyFinishContext();
4691 __pyx_L4_argument_unpacking_done:;
4692 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tabixfile), __pyx_ptype_6ctabix_Tabixfile, 1, "tabixfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4693 __pyx_r = __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self), __pyx_v_tabixfile);
4698 __Pyx_RefNannyFinishContext();
4705 * def __cinit__(self, Tabixfile tabixfile ): # <<<<<<<<<<<<<<
4707 * assert tabixfile._isOpen()
4710 static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(struct __pyx_obj_6ctabix_TabixHeaderIterator *__pyx_v_self, struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile) {
4712 __Pyx_RefNannyDeclarations
4713 PyObject *__pyx_t_1 = NULL;
4714 PyObject *__pyx_t_2 = NULL;
4716 int __pyx_lineno = 0;
4717 const char *__pyx_filename = NULL;
4718 int __pyx_clineno = 0;
4719 __Pyx_RefNannySetupContext("__cinit__", 0);
4722 * def __cinit__(self, Tabixfile tabixfile ):
4724 * assert tabixfile._isOpen() # <<<<<<<<<<<<<<
4726 * # makes sure that samfile stays alive as long as the
4728 #ifndef CYTHON_WITHOUT_ASSERTIONS
4729 __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 = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4730 __Pyx_GOTREF(__pyx_t_1);
4731 __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 = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4732 __Pyx_GOTREF(__pyx_t_2);
4733 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4734 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4735 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4736 if (unlikely(!__pyx_t_3)) {
4737 PyErr_SetNone(PyExc_AssertionError);
4738 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4743 * # makes sure that samfile stays alive as long as the
4744 * # iterator is alive.
4745 * self.tabixfile = tabixfile.tabixfile # <<<<<<<<<<<<<<
4747 * self.iterator = ti_query(self.tabixfile, NULL, 0, 0)
4749 __pyx_v_self->tabixfile = __pyx_v_tabixfile->tabixfile;
4752 * self.tabixfile = tabixfile.tabixfile
4754 * self.iterator = ti_query(self.tabixfile, NULL, 0, 0) # <<<<<<<<<<<<<<
4756 * if <void*>self.iterator == NULL:
4758 __pyx_v_self->iterator = ti_query(__pyx_v_self->tabixfile, NULL, 0, 0);
4761 * self.iterator = ti_query(self.tabixfile, NULL, 0, 0)
4763 * if <void*>self.iterator == NULL: # <<<<<<<<<<<<<<
4764 * raise ValueError("can't open header.\n")
4767 __pyx_t_3 = (((void *)__pyx_v_self->iterator) == NULL);
4772 * if <void*>self.iterator == NULL:
4773 * raise ValueError("can't open header.\n") # <<<<<<<<<<<<<<
4775 * def __iter__(self):
4777 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4778 __Pyx_GOTREF(__pyx_t_2);
4779 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
4780 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4781 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4789 __Pyx_XDECREF(__pyx_t_1);
4790 __Pyx_XDECREF(__pyx_t_2);
4791 __Pyx_AddTraceback("ctabix.TabixHeaderIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4794 __Pyx_RefNannyFinishContext();
4798 /* Python wrapper */
4799 static PyObject *__pyx_pw_6ctabix_19TabixHeaderIterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
4800 static PyObject *__pyx_pw_6ctabix_19TabixHeaderIterator_3__iter__(PyObject *__pyx_v_self) {
4801 PyObject *__pyx_r = 0;
4802 __Pyx_RefNannyDeclarations
4803 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
4804 __pyx_r = __pyx_pf_6ctabix_19TabixHeaderIterator_2__iter__(((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self));
4805 __Pyx_RefNannyFinishContext();
4810 * raise ValueError("can't open header.\n")
4812 * def __iter__(self): # <<<<<<<<<<<<<<
4817 static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_2__iter__(struct __pyx_obj_6ctabix_TabixHeaderIterator *__pyx_v_self) {
4818 PyObject *__pyx_r = NULL;
4819 __Pyx_RefNannyDeclarations
4820 __Pyx_RefNannySetupContext("__iter__", 0);
4824 * def __iter__(self):
4825 * return self # <<<<<<<<<<<<<<
4827 * def __next__(self):
4829 __Pyx_XDECREF(__pyx_r);
4830 __Pyx_INCREF(((PyObject *)__pyx_v_self));
4831 __pyx_r = ((PyObject *)__pyx_v_self);
4834 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4836 __Pyx_XGIVEREF(__pyx_r);
4837 __Pyx_RefNannyFinishContext();
4841 /* Python wrapper */
4842 static PyObject *__pyx_pw_6ctabix_19TabixHeaderIterator_5__next__(PyObject *__pyx_v_self); /*proto*/
4843 static char __pyx_doc_6ctabix_19TabixHeaderIterator_4__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n ";
4844 #if CYTHON_COMPILING_IN_CPYTHON
4845 struct wrapperbase __pyx_wrapperbase_6ctabix_19TabixHeaderIterator_4__next__;
4847 static PyObject *__pyx_pw_6ctabix_19TabixHeaderIterator_5__next__(PyObject *__pyx_v_self) {
4848 PyObject *__pyx_r = 0;
4849 __Pyx_RefNannyDeclarations
4850 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
4851 __pyx_r = __pyx_pf_6ctabix_19TabixHeaderIterator_4__next__(((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self));
4852 __Pyx_RefNannyFinishContext();
4859 * def __next__(self): # <<<<<<<<<<<<<<
4860 * """python version of next().
4864 static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_4__next__(struct __pyx_obj_6ctabix_TabixHeaderIterator *__pyx_v_self) {
4867 PyObject *__pyx_r = NULL;
4868 __Pyx_RefNannyDeclarations
4870 PyObject *__pyx_t_2 = NULL;
4871 int __pyx_lineno = 0;
4872 const char *__pyx_filename = NULL;
4873 int __pyx_clineno = 0;
4874 __Pyx_RefNannySetupContext("__next__", 0);
4877 * # Getting the metachar is a pain as ti_index_t is incomplete type.
4878 * # simply use '#' for now.
4879 * s = ti_read(self.tabixfile, self.iterator, &len) # <<<<<<<<<<<<<<
4880 * if s == NULL: raise StopIteration
4881 * # stop at first non-header line
4883 __pyx_v_s = ti_read(__pyx_v_self->tabixfile, __pyx_v_self->iterator, (&__pyx_v_len));
4886 * # simply use '#' for now.
4887 * s = ti_read(self.tabixfile, self.iterator, &len)
4888 * if s == NULL: raise StopIteration # <<<<<<<<<<<<<<
4889 * # stop at first non-header line
4890 * if s[0] != '#': raise StopIteration
4892 __pyx_t_1 = (__pyx_v_s == NULL);
4894 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
4895 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4901 * if s == NULL: raise StopIteration
4902 * # stop at first non-header line
4903 * if s[0] != '#': raise StopIteration # <<<<<<<<<<<<<<
4907 __pyx_t_1 = ((__pyx_v_s[0]) != '#');
4909 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
4910 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4916 * if s[0] != '#': raise StopIteration
4918 * return s # <<<<<<<<<<<<<<
4920 * def __dealloc__(self):
4922 __Pyx_XDECREF(__pyx_r);
4923 __pyx_t_2 = PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4924 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
4925 __pyx_r = ((PyObject *)__pyx_t_2);
4929 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4932 __Pyx_XDECREF(__pyx_t_2);
4933 __Pyx_AddTraceback("ctabix.TabixHeaderIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4936 __Pyx_XGIVEREF(__pyx_r);
4937 __Pyx_RefNannyFinishContext();
4941 /* Python wrapper */
4942 static void __pyx_pw_6ctabix_19TabixHeaderIterator_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
4943 static void __pyx_pw_6ctabix_19TabixHeaderIterator_7__dealloc__(PyObject *__pyx_v_self) {
4944 __Pyx_RefNannyDeclarations
4945 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
4946 __pyx_pf_6ctabix_19TabixHeaderIterator_6__dealloc__(((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self));
4947 __Pyx_RefNannyFinishContext();
4953 * def __dealloc__(self): # <<<<<<<<<<<<<<
4954 * if <void*>self.iterator != NULL:
4955 * ti_iter_destroy(self.iterator)
4958 static void __pyx_pf_6ctabix_19TabixHeaderIterator_6__dealloc__(struct __pyx_obj_6ctabix_TabixHeaderIterator *__pyx_v_self) {
4959 __Pyx_RefNannyDeclarations
4961 __Pyx_RefNannySetupContext("__dealloc__", 0);
4965 * def __dealloc__(self):
4966 * if <void*>self.iterator != NULL: # <<<<<<<<<<<<<<
4967 * ti_iter_destroy(self.iterator)
4970 __pyx_t_1 = (((void *)__pyx_v_self->iterator) != NULL);
4974 * def __dealloc__(self):
4975 * if <void*>self.iterator != NULL:
4976 * ti_iter_destroy(self.iterator) # <<<<<<<<<<<<<<
4980 ti_iter_destroy(__pyx_v_self->iterator);
4985 __Pyx_RefNannyFinishContext();
4988 /* Python wrapper */
4989 static PyObject *__pyx_pw_6ctabix_7asTuple_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4990 static PyObject *__pyx_pw_6ctabix_7asTuple_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4991 char *__pyx_v_buffer;
4993 PyObject *__pyx_r = 0;
4994 __Pyx_RefNannyDeclarations
4995 __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
4997 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
4998 PyObject* values[2] = {0,0};
4999 if (unlikely(__pyx_kwds)) {
5001 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5003 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5004 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5006 default: goto __pyx_L5_argtuple_error;
5008 kw_args = PyDict_Size(__pyx_kwds);
5011 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer)) != 0)) kw_args--;
5012 else goto __pyx_L5_argtuple_error;
5014 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len)) != 0)) kw_args--;
5016 __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5019 if (unlikely(kw_args > 0)) {
5020 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5022 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5023 goto __pyx_L5_argtuple_error;
5025 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5026 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5028 __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5029 __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5031 goto __pyx_L4_argument_unpacking_done;
5032 __pyx_L5_argtuple_error:;
5033 __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5035 __Pyx_AddTraceback("ctabix.asTuple.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5036 __Pyx_RefNannyFinishContext();
5038 __pyx_L4_argument_unpacking_done:;
5039 __pyx_r = __pyx_pf_6ctabix_7asTuple___call__(((struct __pyx_obj_6ctabix_asTuple *)__pyx_v_self), __pyx_v_buffer, __pyx_v_len);
5040 __Pyx_RefNannyFinishContext();
5045 * Access is by numeric index.
5047 * def __call__(self, char * buffer, int len): # <<<<<<<<<<<<<<
5048 * cdef TabProxies.TupleProxy r
5049 * r = TabProxies.TupleProxy()
5052 static PyObject *__pyx_pf_6ctabix_7asTuple___call__(CYTHON_UNUSED struct __pyx_obj_6ctabix_asTuple *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len) {
5053 struct __pyx_obj_10TabProxies_TupleProxy *__pyx_v_r = 0;
5054 PyObject *__pyx_r = NULL;
5055 __Pyx_RefNannyDeclarations
5056 PyObject *__pyx_t_1 = NULL;
5057 int __pyx_lineno = 0;
5058 const char *__pyx_filename = NULL;
5059 int __pyx_clineno = 0;
5060 __Pyx_RefNannySetupContext("__call__", 0);
5063 * def __call__(self, char * buffer, int len):
5064 * cdef TabProxies.TupleProxy r
5065 * r = TabProxies.TupleProxy() # <<<<<<<<<<<<<<
5066 * # need to copy - there were some
5067 * # persistence issues with "present"
5069 __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 = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5070 __Pyx_GOTREF(__pyx_t_1);
5071 __pyx_v_r = ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_t_1);
5075 * # need to copy - there were some
5076 * # persistence issues with "present"
5077 * r.copy( buffer, len ) # <<<<<<<<<<<<<<
5081 __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 = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5082 __Pyx_GOTREF(__pyx_t_1);
5083 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5086 * # persistence issues with "present"
5087 * r.copy( buffer, len )
5088 * return r # <<<<<<<<<<<<<<
5090 * cdef class asGTF(Parser):
5092 __Pyx_XDECREF(__pyx_r);
5093 __Pyx_INCREF(((PyObject *)__pyx_v_r));
5094 __pyx_r = ((PyObject *)__pyx_v_r);
5097 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5100 __Pyx_XDECREF(__pyx_t_1);
5101 __Pyx_AddTraceback("ctabix.asTuple.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5104 __Pyx_XDECREF((PyObject *)__pyx_v_r);
5105 __Pyx_XGIVEREF(__pyx_r);
5106 __Pyx_RefNannyFinishContext();
5110 /* Python wrapper */
5111 static PyObject *__pyx_pw_6ctabix_5asGTF_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5112 static PyObject *__pyx_pw_6ctabix_5asGTF_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5113 char *__pyx_v_buffer;
5115 PyObject *__pyx_r = 0;
5116 __Pyx_RefNannyDeclarations
5117 __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
5119 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
5120 PyObject* values[2] = {0,0};
5121 if (unlikely(__pyx_kwds)) {
5123 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5125 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5126 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5128 default: goto __pyx_L5_argtuple_error;
5130 kw_args = PyDict_Size(__pyx_kwds);
5133 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer)) != 0)) kw_args--;
5134 else goto __pyx_L5_argtuple_error;
5136 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len)) != 0)) kw_args--;
5138 __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5141 if (unlikely(kw_args > 0)) {
5142 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5144 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5145 goto __pyx_L5_argtuple_error;
5147 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5148 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5150 __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5151 __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5153 goto __pyx_L4_argument_unpacking_done;
5154 __pyx_L5_argtuple_error:;
5155 __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5157 __Pyx_AddTraceback("ctabix.asGTF.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5158 __Pyx_RefNannyFinishContext();
5160 __pyx_L4_argument_unpacking_done:;
5161 __pyx_r = __pyx_pf_6ctabix_5asGTF___call__(((struct __pyx_obj_6ctabix_asGTF *)__pyx_v_self), __pyx_v_buffer, __pyx_v_len);
5162 __Pyx_RefNannyFinishContext();
5169 * def __call__(self, char * buffer, int len): # <<<<<<<<<<<<<<
5170 * cdef TabProxies.GTFProxy r
5171 * r = TabProxies.GTFProxy()
5174 static PyObject *__pyx_pf_6ctabix_5asGTF___call__(CYTHON_UNUSED struct __pyx_obj_6ctabix_asGTF *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len) {
5175 struct __pyx_obj_10TabProxies_GTFProxy *__pyx_v_r = 0;
5176 PyObject *__pyx_r = NULL;
5177 __Pyx_RefNannyDeclarations
5178 PyObject *__pyx_t_1 = NULL;
5179 int __pyx_lineno = 0;
5180 const char *__pyx_filename = NULL;
5181 int __pyx_clineno = 0;
5182 __Pyx_RefNannySetupContext("__call__", 0);
5185 * def __call__(self, char * buffer, int len):
5186 * cdef TabProxies.GTFProxy r
5187 * r = TabProxies.GTFProxy() # <<<<<<<<<<<<<<
5188 * r.copy( buffer, len )
5191 __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 = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5192 __Pyx_GOTREF(__pyx_t_1);
5193 __pyx_v_r = ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_t_1);
5197 * cdef TabProxies.GTFProxy r
5198 * r = TabProxies.GTFProxy()
5199 * r.copy( buffer, len ) # <<<<<<<<<<<<<<
5203 __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 = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5204 __Pyx_GOTREF(__pyx_t_1);
5205 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5208 * r = TabProxies.GTFProxy()
5209 * r.copy( buffer, len )
5210 * return r # <<<<<<<<<<<<<<
5212 * cdef class asBed( Parser ):
5214 __Pyx_XDECREF(__pyx_r);
5215 __Pyx_INCREF(((PyObject *)__pyx_v_r));
5216 __pyx_r = ((PyObject *)__pyx_v_r);
5219 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5222 __Pyx_XDECREF(__pyx_t_1);
5223 __Pyx_AddTraceback("ctabix.asGTF.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5226 __Pyx_XDECREF((PyObject *)__pyx_v_r);
5227 __Pyx_XGIVEREF(__pyx_r);
5228 __Pyx_RefNannyFinishContext();
5232 /* Python wrapper */
5233 static PyObject *__pyx_pw_6ctabix_5asBed_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5234 static PyObject *__pyx_pw_6ctabix_5asBed_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5235 char *__pyx_v_buffer;
5237 PyObject *__pyx_r = 0;
5238 __Pyx_RefNannyDeclarations
5239 __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
5241 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
5242 PyObject* values[2] = {0,0};
5243 if (unlikely(__pyx_kwds)) {
5245 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5247 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5248 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5250 default: goto __pyx_L5_argtuple_error;
5252 kw_args = PyDict_Size(__pyx_kwds);
5255 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer)) != 0)) kw_args--;
5256 else goto __pyx_L5_argtuple_error;
5258 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len)) != 0)) kw_args--;
5260 __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5263 if (unlikely(kw_args > 0)) {
5264 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5266 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5267 goto __pyx_L5_argtuple_error;
5269 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5270 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5272 __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5273 __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5275 goto __pyx_L4_argument_unpacking_done;
5276 __pyx_L5_argtuple_error:;
5277 __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5279 __Pyx_AddTraceback("ctabix.asBed.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5280 __Pyx_RefNannyFinishContext();
5282 __pyx_L4_argument_unpacking_done:;
5283 __pyx_r = __pyx_pf_6ctabix_5asBed___call__(((struct __pyx_obj_6ctabix_asBed *)__pyx_v_self), __pyx_v_buffer, __pyx_v_len);
5284 __Pyx_RefNannyFinishContext();
5291 * def __call__(self, char * buffer, int len): # <<<<<<<<<<<<<<
5292 * cdef TabProxies.BedProxy r
5293 * r = TabProxies.BedProxy()
5296 static PyObject *__pyx_pf_6ctabix_5asBed___call__(CYTHON_UNUSED struct __pyx_obj_6ctabix_asBed *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len) {
5297 struct __pyx_obj_10TabProxies_BedProxy *__pyx_v_r = 0;
5298 PyObject *__pyx_r = NULL;
5299 __Pyx_RefNannyDeclarations
5300 PyObject *__pyx_t_1 = NULL;
5301 int __pyx_lineno = 0;
5302 const char *__pyx_filename = NULL;
5303 int __pyx_clineno = 0;
5304 __Pyx_RefNannySetupContext("__call__", 0);
5307 * def __call__(self, char * buffer, int len):
5308 * cdef TabProxies.BedProxy r
5309 * r = TabProxies.BedProxy() # <<<<<<<<<<<<<<
5310 * r.copy( buffer, len )
5313 __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 = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5314 __Pyx_GOTREF(__pyx_t_1);
5315 __pyx_v_r = ((struct __pyx_obj_10TabProxies_BedProxy *)__pyx_t_1);
5319 * cdef TabProxies.BedProxy r
5320 * r = TabProxies.BedProxy()
5321 * r.copy( buffer, len ) # <<<<<<<<<<<<<<
5325 __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 = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5326 __Pyx_GOTREF(__pyx_t_1);
5327 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5330 * r = TabProxies.BedProxy()
5331 * r.copy( buffer, len )
5332 * return r # <<<<<<<<<<<<<<
5334 * cdef class asVCF( Parser ):
5336 __Pyx_XDECREF(__pyx_r);
5337 __Pyx_INCREF(((PyObject *)__pyx_v_r));
5338 __pyx_r = ((PyObject *)__pyx_v_r);
5341 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5344 __Pyx_XDECREF(__pyx_t_1);
5345 __Pyx_AddTraceback("ctabix.asBed.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5348 __Pyx_XDECREF((PyObject *)__pyx_v_r);
5349 __Pyx_XGIVEREF(__pyx_r);
5350 __Pyx_RefNannyFinishContext();
5354 /* Python wrapper */
5355 static PyObject *__pyx_pw_6ctabix_5asVCF_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5356 static PyObject *__pyx_pw_6ctabix_5asVCF_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5357 char *__pyx_v_buffer;
5359 PyObject *__pyx_r = 0;
5360 __Pyx_RefNannyDeclarations
5361 __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
5363 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0};
5364 PyObject* values[2] = {0,0};
5365 if (unlikely(__pyx_kwds)) {
5367 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5369 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5370 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5372 default: goto __pyx_L5_argtuple_error;
5374 kw_args = PyDict_Size(__pyx_kwds);
5377 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer)) != 0)) kw_args--;
5378 else goto __pyx_L5_argtuple_error;
5380 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len)) != 0)) kw_args--;
5382 __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5385 if (unlikely(kw_args > 0)) {
5386 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5388 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5389 goto __pyx_L5_argtuple_error;
5391 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5392 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5394 __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5395 __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5397 goto __pyx_L4_argument_unpacking_done;
5398 __pyx_L5_argtuple_error:;
5399 __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5401 __Pyx_AddTraceback("ctabix.asVCF.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5402 __Pyx_RefNannyFinishContext();
5404 __pyx_L4_argument_unpacking_done:;
5405 __pyx_r = __pyx_pf_6ctabix_5asVCF___call__(((struct __pyx_obj_6ctabix_asVCF *)__pyx_v_self), __pyx_v_buffer, __pyx_v_len);
5406 __Pyx_RefNannyFinishContext();
5413 * def __call__(self, char * buffer, int len ): # <<<<<<<<<<<<<<
5414 * cdef TabProxies.VCFProxy r
5415 * r = TabProxies.VCFProxy()
5418 static PyObject *__pyx_pf_6ctabix_5asVCF___call__(CYTHON_UNUSED struct __pyx_obj_6ctabix_asVCF *__pyx_v_self, char *__pyx_v_buffer, int __pyx_v_len) {
5419 struct __pyx_obj_10TabProxies_VCFProxy *__pyx_v_r = 0;
5420 PyObject *__pyx_r = NULL;
5421 __Pyx_RefNannyDeclarations
5422 PyObject *__pyx_t_1 = NULL;
5423 int __pyx_lineno = 0;
5424 const char *__pyx_filename = NULL;
5425 int __pyx_clineno = 0;
5426 __Pyx_RefNannySetupContext("__call__", 0);
5429 * def __call__(self, char * buffer, int len ):
5430 * cdef TabProxies.VCFProxy r
5431 * r = TabProxies.VCFProxy() # <<<<<<<<<<<<<<
5432 * r.copy( buffer, len )
5435 __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 = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5436 __Pyx_GOTREF(__pyx_t_1);
5437 __pyx_v_r = ((struct __pyx_obj_10TabProxies_VCFProxy *)__pyx_t_1);
5441 * cdef TabProxies.VCFProxy r
5442 * r = TabProxies.VCFProxy()
5443 * r.copy( buffer, len ) # <<<<<<<<<<<<<<
5447 __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 = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5448 __Pyx_GOTREF(__pyx_t_1);
5449 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5452 * r = TabProxies.VCFProxy()
5453 * r.copy( buffer, len )
5454 * return r # <<<<<<<<<<<<<<
5456 * #########################################################
5458 __Pyx_XDECREF(__pyx_r);
5459 __Pyx_INCREF(((PyObject *)__pyx_v_r));
5460 __pyx_r = ((PyObject *)__pyx_v_r);
5463 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5466 __Pyx_XDECREF(__pyx_t_1);
5467 __Pyx_AddTraceback("ctabix.asVCF.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5470 __Pyx_XDECREF((PyObject *)__pyx_v_r);
5471 __Pyx_XGIVEREF(__pyx_r);
5472 __Pyx_RefNannyFinishContext();
5476 /* Python wrapper */
5477 static int __pyx_pw_6ctabix_19TabixIteratorParsed_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5478 static int __pyx_pw_6ctabix_19TabixIteratorParsed_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5479 struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile = 0;
5483 struct __pyx_obj_6ctabix_Parser *__pyx_v_parser = 0;
5485 __Pyx_RefNannyDeclarations
5486 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
5488 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};
5489 PyObject* values[5] = {0,0,0,0,0};
5490 if (unlikely(__pyx_kwds)) {
5492 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5494 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5495 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5496 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5497 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5498 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5500 default: goto __pyx_L5_argtuple_error;
5502 kw_args = PyDict_Size(__pyx_kwds);
5505 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile)) != 0)) kw_args--;
5506 else goto __pyx_L5_argtuple_error;
5508 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid)) != 0)) kw_args--;
5510 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5513 if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start)) != 0)) kw_args--;
5515 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5518 if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end)) != 0)) kw_args--;
5520 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5523 if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser)) != 0)) kw_args--;
5525 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5528 if (unlikely(kw_args > 0)) {
5529 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5531 } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5532 goto __pyx_L5_argtuple_error;
5534 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5535 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5536 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5537 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5538 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5540 __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)values[0]);
5541 __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5542 __pyx_v_start = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5543 __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5544 __pyx_v_parser = ((struct __pyx_obj_6ctabix_Parser *)values[4]);
5546 goto __pyx_L4_argument_unpacking_done;
5547 __pyx_L5_argtuple_error:;
5548 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5550 __Pyx_AddTraceback("ctabix.TabixIteratorParsed.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5551 __Pyx_RefNannyFinishContext();
5553 __pyx_L4_argument_unpacking_done:;
5554 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tabixfile), __pyx_ptype_6ctabix_Tabixfile, 1, "tabixfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5555 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_6ctabix_Parser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5556 __pyx_r = __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self), __pyx_v_tabixfile, __pyx_v_tid, __pyx_v_start, __pyx_v_end, __pyx_v_parser);
5561 __Pyx_RefNannyFinishContext();
5568 * def __cinit__(self, # <<<<<<<<<<<<<<
5569 * Tabixfile tabixfile,
5573 static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(struct __pyx_obj_6ctabix_TabixIteratorParsed *__pyx_v_self, struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end, struct __pyx_obj_6ctabix_Parser *__pyx_v_parser) {
5575 __Pyx_RefNannyDeclarations
5576 PyObject *__pyx_t_1 = NULL;
5577 PyObject *__pyx_t_2 = NULL;
5579 int __pyx_lineno = 0;
5580 const char *__pyx_filename = NULL;
5581 int __pyx_clineno = 0;
5582 __Pyx_RefNannySetupContext("__cinit__", 0);
5587 * assert tabixfile._isOpen() # <<<<<<<<<<<<<<
5588 * self.parser = parser
5591 #ifndef CYTHON_WITHOUT_ASSERTIONS
5592 __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 = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5593 __Pyx_GOTREF(__pyx_t_1);
5594 __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 = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5595 __Pyx_GOTREF(__pyx_t_2);
5596 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5597 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5598 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5599 if (unlikely(!__pyx_t_3)) {
5600 PyErr_SetNone(PyExc_AssertionError);
5601 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5607 * assert tabixfile._isOpen()
5608 * self.parser = parser # <<<<<<<<<<<<<<
5610 * # makes sure that samfile stays alive as long as the
5612 __Pyx_INCREF(((PyObject *)__pyx_v_parser));
5613 __Pyx_GIVEREF(((PyObject *)__pyx_v_parser));
5614 __Pyx_GOTREF(__pyx_v_self->parser);
5615 __Pyx_DECREF(((PyObject *)__pyx_v_self->parser));
5616 __pyx_v_self->parser = __pyx_v_parser;
5619 * # makes sure that samfile stays alive as long as the
5620 * # iterator is alive.
5621 * self.tabixfile = tabixfile.tabixfile # <<<<<<<<<<<<<<
5625 __pyx_v_self->tabixfile = __pyx_v_tabixfile->tabixfile;
5628 * self.tabixfile = tabixfile.tabixfile
5630 * if tid < 0: # <<<<<<<<<<<<<<
5631 * # seek to start of file to ensure iteration is over
5634 __pyx_t_3 = (__pyx_v_tid < 0);
5638 * # seek to start of file to ensure iteration is over
5640 * bgzf_seek( self.tabixfile.fp, 0, 0) # <<<<<<<<<<<<<<
5641 * self.iterator = ti_iter_first()
5644 bgzf_seek(__pyx_v_self->tabixfile->fp, 0, 0);
5648 * bgzf_seek( self.tabixfile.fp, 0, 0)
5649 * self.iterator = ti_iter_first() # <<<<<<<<<<<<<<
5651 * self.iterator = ti_queryi(self.tabixfile, tid, start, end)
5653 __pyx_v_self->iterator = ti_iter_first();
5659 * self.iterator = ti_iter_first()
5661 * self.iterator = ti_queryi(self.tabixfile, tid, start, end) # <<<<<<<<<<<<<<
5663 * if <void*>self.iterator == NULL:
5665 __pyx_v_self->iterator = ti_queryi(__pyx_v_self->tabixfile, __pyx_v_tid, __pyx_v_start, __pyx_v_end);
5670 * self.iterator = ti_queryi(self.tabixfile, tid, start, end)
5672 * if <void*>self.iterator == NULL: # <<<<<<<<<<<<<<
5673 * raise ValueError("malformatted query or wrong sequence name.\n")
5676 __pyx_t_3 = (((void *)__pyx_v_self->iterator) == NULL);
5681 * if <void*>self.iterator == NULL:
5682 * raise ValueError("malformatted query or wrong sequence name.\n") # <<<<<<<<<<<<<<
5684 * def __iter__(self):
5686 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5687 __Pyx_GOTREF(__pyx_t_2);
5688 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5689 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5690 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5698 __Pyx_XDECREF(__pyx_t_1);
5699 __Pyx_XDECREF(__pyx_t_2);
5700 __Pyx_AddTraceback("ctabix.TabixIteratorParsed.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5703 __Pyx_RefNannyFinishContext();
5707 /* Python wrapper */
5708 static PyObject *__pyx_pw_6ctabix_19TabixIteratorParsed_3__iter__(PyObject *__pyx_v_self); /*proto*/
5709 static PyObject *__pyx_pw_6ctabix_19TabixIteratorParsed_3__iter__(PyObject *__pyx_v_self) {
5710 PyObject *__pyx_r = 0;
5711 __Pyx_RefNannyDeclarations
5712 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
5713 __pyx_r = __pyx_pf_6ctabix_19TabixIteratorParsed_2__iter__(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self));
5714 __Pyx_RefNannyFinishContext();
5719 * raise ValueError("malformatted query or wrong sequence name.\n")
5721 * def __iter__(self): # <<<<<<<<<<<<<<
5726 static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_2__iter__(struct __pyx_obj_6ctabix_TabixIteratorParsed *__pyx_v_self) {
5727 PyObject *__pyx_r = NULL;
5728 __Pyx_RefNannyDeclarations
5729 __Pyx_RefNannySetupContext("__iter__", 0);
5733 * def __iter__(self):
5734 * return self # <<<<<<<<<<<<<<
5736 * def __next__(self):
5738 __Pyx_XDECREF(__pyx_r);
5739 __Pyx_INCREF(((PyObject *)__pyx_v_self));
5740 __pyx_r = ((PyObject *)__pyx_v_self);
5743 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5745 __Pyx_XGIVEREF(__pyx_r);
5746 __Pyx_RefNannyFinishContext();
5750 /* Python wrapper */
5751 static PyObject *__pyx_pw_6ctabix_19TabixIteratorParsed_5__next__(PyObject *__pyx_v_self); /*proto*/
5752 static char __pyx_doc_6ctabix_19TabixIteratorParsed_4__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n ";
5753 #if CYTHON_COMPILING_IN_CPYTHON
5754 struct wrapperbase __pyx_wrapperbase_6ctabix_19TabixIteratorParsed_4__next__;
5756 static PyObject *__pyx_pw_6ctabix_19TabixIteratorParsed_5__next__(PyObject *__pyx_v_self) {
5757 PyObject *__pyx_r = 0;
5758 __Pyx_RefNannyDeclarations
5759 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
5760 __pyx_r = __pyx_pf_6ctabix_19TabixIteratorParsed_4__next__(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self));
5761 __Pyx_RefNannyFinishContext();
5768 * def __next__(self): # <<<<<<<<<<<<<<
5769 * """python version of next().
5773 static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_4__next__(struct __pyx_obj_6ctabix_TabixIteratorParsed *__pyx_v_self) {
5776 PyObject *__pyx_r = NULL;
5777 __Pyx_RefNannyDeclarations
5779 PyObject *__pyx_t_2 = NULL;
5780 PyObject *__pyx_t_3 = NULL;
5781 PyObject *__pyx_t_4 = NULL;
5782 int __pyx_lineno = 0;
5783 const char *__pyx_filename = NULL;
5784 int __pyx_clineno = 0;
5785 __Pyx_RefNannySetupContext("__next__", 0);
5790 * while 1: # <<<<<<<<<<<<<<
5791 * s = ti_read(self.tabixfile, self.iterator, &len)
5792 * if s == NULL: raise StopIteration
5800 * s = ti_read(self.tabixfile, self.iterator, &len) # <<<<<<<<<<<<<<
5801 * if s == NULL: raise StopIteration
5802 * # todo: read metachar from configuration
5804 __pyx_v_s = ti_read(__pyx_v_self->tabixfile, __pyx_v_self->iterator, (&__pyx_v_len));
5808 * s = ti_read(self.tabixfile, self.iterator, &len)
5809 * if s == NULL: raise StopIteration # <<<<<<<<<<<<<<
5810 * # todo: read metachar from configuration
5811 * if s[0] != '#': break
5813 __pyx_t_1 = (__pyx_v_s == NULL);
5815 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
5816 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5822 * if s == NULL: raise StopIteration
5823 * # todo: read metachar from configuration
5824 * if s[0] != '#': break # <<<<<<<<<<<<<<
5826 * return self.parser(s, len)
5828 __pyx_t_1 = ((__pyx_v_s[0]) != '#');
5830 goto __pyx_L4_break;
5838 * if s[0] != '#': break
5840 * return self.parser(s, len) # <<<<<<<<<<<<<<
5842 * def __dealloc__(self):
5844 __Pyx_XDECREF(__pyx_r);
5845 __pyx_t_2 = PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5846 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
5847 __pyx_t_3 = PyInt_FromLong(__pyx_v_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5848 __Pyx_GOTREF(__pyx_t_3);
5849 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5850 __Pyx_GOTREF(__pyx_t_4);
5851 PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_2));
5852 __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
5853 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
5854 __Pyx_GIVEREF(__pyx_t_3);
5857 __pyx_t_3 = PyObject_Call(((PyObject *)__pyx_v_self->parser), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5858 __Pyx_GOTREF(__pyx_t_3);
5859 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
5860 __pyx_r = __pyx_t_3;
5864 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5867 __Pyx_XDECREF(__pyx_t_2);
5868 __Pyx_XDECREF(__pyx_t_3);
5869 __Pyx_XDECREF(__pyx_t_4);
5870 __Pyx_AddTraceback("ctabix.TabixIteratorParsed.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5873 __Pyx_XGIVEREF(__pyx_r);
5874 __Pyx_RefNannyFinishContext();
5878 /* Python wrapper */
5879 static void __pyx_pw_6ctabix_19TabixIteratorParsed_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
5880 static void __pyx_pw_6ctabix_19TabixIteratorParsed_7__dealloc__(PyObject *__pyx_v_self) {
5881 __Pyx_RefNannyDeclarations
5882 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
5883 __pyx_pf_6ctabix_19TabixIteratorParsed_6__dealloc__(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self));
5884 __Pyx_RefNannyFinishContext();
5888 * return self.parser(s, len)
5890 * def __dealloc__(self): # <<<<<<<<<<<<<<
5891 * if <void*>self.iterator != NULL:
5892 * ti_iter_destroy(self.iterator)
5895 static void __pyx_pf_6ctabix_19TabixIteratorParsed_6__dealloc__(struct __pyx_obj_6ctabix_TabixIteratorParsed *__pyx_v_self) {
5896 __Pyx_RefNannyDeclarations
5898 __Pyx_RefNannySetupContext("__dealloc__", 0);
5902 * def __dealloc__(self):
5903 * if <void*>self.iterator != NULL: # <<<<<<<<<<<<<<
5904 * ti_iter_destroy(self.iterator)
5907 __pyx_t_1 = (((void *)__pyx_v_self->iterator) != NULL);
5911 * def __dealloc__(self):
5912 * if <void*>self.iterator != NULL:
5913 * ti_iter_destroy(self.iterator) # <<<<<<<<<<<<<<
5915 * def tabix_compress( filename_in,
5917 ti_iter_destroy(__pyx_v_self->iterator);
5922 __Pyx_RefNannyFinishContext();
5925 /* Python wrapper */
5926 static PyObject *__pyx_pw_6ctabix_1tabix_compress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5927 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 ";
5928 static PyMethodDef __pyx_mdef_6ctabix_1tabix_compress = {__Pyx_NAMESTR("tabix_compress"), (PyCFunction)__pyx_pw_6ctabix_1tabix_compress, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_tabix_compress)};
5929 static PyObject *__pyx_pw_6ctabix_1tabix_compress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5930 PyObject *__pyx_v_filename_in = 0;
5931 PyObject *__pyx_v_filename_out = 0;
5932 PyObject *__pyx_v_force = 0;
5933 PyObject *__pyx_r = 0;
5934 __Pyx_RefNannyDeclarations
5935 __Pyx_RefNannySetupContext("tabix_compress (wrapper)", 0);
5937 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename_in,&__pyx_n_s__filename_out,&__pyx_n_s__force,0};
5938 PyObject* values[3] = {0,0,0};
5939 values[2] = __pyx_k_30;
5940 if (unlikely(__pyx_kwds)) {
5942 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5944 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5945 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5946 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5948 default: goto __pyx_L5_argtuple_error;
5950 kw_args = PyDict_Size(__pyx_kwds);
5953 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename_in)) != 0)) kw_args--;
5954 else goto __pyx_L5_argtuple_error;
5956 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename_out)) != 0)) kw_args--;
5958 __Pyx_RaiseArgtupleInvalid("tabix_compress", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5962 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__force);
5963 if (value) { values[2] = value; kw_args--; }
5966 if (unlikely(kw_args > 0)) {
5967 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tabix_compress") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5970 switch (PyTuple_GET_SIZE(__pyx_args)) {
5971 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5972 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5973 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5975 default: goto __pyx_L5_argtuple_error;
5978 __pyx_v_filename_in = values[0];
5979 __pyx_v_filename_out = values[1];
5980 __pyx_v_force = values[2];
5982 goto __pyx_L4_argument_unpacking_done;
5983 __pyx_L5_argtuple_error:;
5984 __Pyx_RaiseArgtupleInvalid("tabix_compress", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
5986 __Pyx_AddTraceback("ctabix.tabix_compress", __pyx_clineno, __pyx_lineno, __pyx_filename);
5987 __Pyx_RefNannyFinishContext();
5989 __pyx_L4_argument_unpacking_done:;
5990 __pyx_r = __pyx_pf_6ctabix_tabix_compress(__pyx_self, __pyx_v_filename_in, __pyx_v_filename_out, __pyx_v_force);
5991 __Pyx_RefNannyFinishContext();
5996 * ti_iter_destroy(self.iterator)
5998 * def tabix_compress( filename_in, # <<<<<<<<<<<<<<
6003 static PyObject *__pyx_pf_6ctabix_tabix_compress(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename_in, PyObject *__pyx_v_filename_out, PyObject *__pyx_v_force) {
6004 int __pyx_v_WINDOW_SIZE;
6007 void *__pyx_v_buffer;
6010 int __pyx_v_O_RDONLY;
6011 PyObject *__pyx_v_fn = NULL;
6012 PyObject *__pyx_r = NULL;
6013 __Pyx_RefNannyDeclarations
6016 PyObject *__pyx_t_3 = NULL;
6017 PyObject *__pyx_t_4 = NULL;
6018 PyObject *__pyx_t_5 = NULL;
6022 int __pyx_lineno = 0;
6023 const char *__pyx_filename = NULL;
6024 int __pyx_clineno = 0;
6025 __Pyx_RefNannySetupContext("tabix_compress", 0);
6030 * if not force and os.path.exists(filename_out ): # <<<<<<<<<<<<<<
6031 * raise IOError( "Filename '%s' already exists, use *force* to overwrite" % filename_out)
6034 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_force); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6035 __pyx_t_2 = (!__pyx_t_1);
6037 __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6038 __Pyx_GOTREF(__pyx_t_3);
6039 __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__path); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6040 __Pyx_GOTREF(__pyx_t_4);
6041 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6042 __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__exists); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6043 __Pyx_GOTREF(__pyx_t_3);
6044 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6045 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6046 __Pyx_GOTREF(__pyx_t_4);
6047 __Pyx_INCREF(__pyx_v_filename_out);
6048 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filename_out);
6049 __Pyx_GIVEREF(__pyx_v_filename_out);
6050 __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 = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6051 __Pyx_GOTREF(__pyx_t_5);
6052 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6053 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
6054 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6055 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6056 __pyx_t_6 = __pyx_t_1;
6058 __pyx_t_6 = __pyx_t_2;
6064 * if not force and os.path.exists(filename_out ):
6065 * raise IOError( "Filename '%s' already exists, use *force* to overwrite" % filename_out) # <<<<<<<<<<<<<<
6067 * cdef int WINDOW_SIZE
6069 __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), __pyx_v_filename_out); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6070 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
6071 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6072 __Pyx_GOTREF(__pyx_t_4);
6073 PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
6074 __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
6076 __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 = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6077 __Pyx_GOTREF(__pyx_t_5);
6078 __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
6079 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
6080 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6081 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6089 * O_RDONLY = os.O_RDONLY # <<<<<<<<<<<<<<
6091 * WINDOW_SIZE = 64 * 1024
6093 __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6094 __Pyx_GOTREF(__pyx_t_5);
6095 __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 = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6096 __Pyx_GOTREF(__pyx_t_4);
6097 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6098 __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 = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6099 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6100 __pyx_v_O_RDONLY = __pyx_t_7;
6103 * O_RDONLY = os.O_RDONLY
6105 * WINDOW_SIZE = 64 * 1024 # <<<<<<<<<<<<<<
6107 * fn = _force_bytes(filename_out)
6109 __pyx_v_WINDOW_SIZE = 65536;
6112 * WINDOW_SIZE = 64 * 1024
6114 * fn = _force_bytes(filename_out) # <<<<<<<<<<<<<<
6115 * fp = bgzf_open( fn, "w")
6118 __pyx_t_4 = ((PyObject *)__pyx_f_6ctabix__force_bytes(__pyx_v_filename_out)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6119 __Pyx_GOTREF(__pyx_t_4);
6120 __pyx_v_fn = ((PyObject*)__pyx_t_4);
6125 * fn = _force_bytes(filename_out)
6126 * fp = bgzf_open( fn, "w") # <<<<<<<<<<<<<<
6128 * raise IOError( "could not open '%s' for writing" )
6130 __pyx_t_8 = PyBytes_AsString(((PyObject *)__pyx_v_fn)); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6131 __pyx_v_fp = bgzf_open(__pyx_t_8, __pyx_k__w);
6134 * fn = _force_bytes(filename_out)
6135 * fp = bgzf_open( fn, "w")
6136 * if fp == NULL: # <<<<<<<<<<<<<<
6137 * raise IOError( "could not open '%s' for writing" )
6140 __pyx_t_6 = (__pyx_v_fp == NULL);
6144 * fp = bgzf_open( fn, "w")
6146 * raise IOError( "could not open '%s' for writing" ) # <<<<<<<<<<<<<<
6148 * fn = _force_bytes(filename_in)
6150 __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6151 __Pyx_GOTREF(__pyx_t_4);
6152 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6153 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6154 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6160 * raise IOError( "could not open '%s' for writing" )
6162 * fn = _force_bytes(filename_in) # <<<<<<<<<<<<<<
6163 * fd_src = open(fn, O_RDONLY)
6166 __pyx_t_4 = ((PyObject *)__pyx_f_6ctabix__force_bytes(__pyx_v_filename_in)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6167 __Pyx_GOTREF(__pyx_t_4);
6168 __Pyx_DECREF(((PyObject *)__pyx_v_fn));
6169 __pyx_v_fn = ((PyObject*)__pyx_t_4);
6174 * fn = _force_bytes(filename_in)
6175 * fd_src = open(fn, O_RDONLY) # <<<<<<<<<<<<<<
6177 * raise IOError( "could not open '%s' for reading" )
6179 __pyx_t_8 = PyBytes_AsString(((PyObject *)__pyx_v_fn)); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6180 __pyx_v_fd_src = open(__pyx_t_8, __pyx_v_O_RDONLY);
6183 * fn = _force_bytes(filename_in)
6184 * fd_src = open(fn, O_RDONLY)
6185 * if fd_src == 0: # <<<<<<<<<<<<<<
6186 * raise IOError( "could not open '%s' for reading" )
6189 __pyx_t_6 = (__pyx_v_fd_src == 0);
6193 * fd_src = open(fn, O_RDONLY)
6195 * raise IOError( "could not open '%s' for reading" ) # <<<<<<<<<<<<<<
6197 * buffer = malloc(WINDOW_SIZE)
6199 __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6200 __Pyx_GOTREF(__pyx_t_4);
6201 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6202 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6203 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6209 * raise IOError( "could not open '%s' for reading" )
6211 * buffer = malloc(WINDOW_SIZE) # <<<<<<<<<<<<<<
6215 __pyx_v_buffer = malloc(__pyx_v_WINDOW_SIZE);
6219 * buffer = malloc(WINDOW_SIZE)
6220 * c = 1 # <<<<<<<<<<<<<<
6229 * while c > 0: # <<<<<<<<<<<<<<
6230 * c = read(fd_src, buffer, WINDOW_SIZE)
6231 * r = bgzf_write(fp, buffer, c)
6234 __pyx_t_6 = (__pyx_v_c > 0);
6235 if (!__pyx_t_6) break;
6240 * c = read(fd_src, buffer, WINDOW_SIZE) # <<<<<<<<<<<<<<
6241 * r = bgzf_write(fp, buffer, c)
6244 __pyx_v_c = read(__pyx_v_fd_src, __pyx_v_buffer, __pyx_v_WINDOW_SIZE);
6248 * c = read(fd_src, buffer, WINDOW_SIZE)
6249 * r = bgzf_write(fp, buffer, c) # <<<<<<<<<<<<<<
6253 __pyx_v_r = bgzf_write(__pyx_v_fp, __pyx_v_buffer, __pyx_v_c);
6256 * c = read(fd_src, buffer, WINDOW_SIZE)
6257 * r = bgzf_write(fp, buffer, c)
6258 * if r < 0: # <<<<<<<<<<<<<<
6260 * raise OSError("writing failed")
6262 __pyx_t_6 = (__pyx_v_r < 0);
6266 * r = bgzf_write(fp, buffer, c)
6268 * free( buffer ) # <<<<<<<<<<<<<<
6269 * raise OSError("writing failed")
6272 free(__pyx_v_buffer);
6277 * raise OSError("writing failed") # <<<<<<<<<<<<<<
6281 __pyx_t_4 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6282 __Pyx_GOTREF(__pyx_t_4);
6283 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6284 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6285 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6292 * raise OSError("writing failed")
6294 * free( buffer ) # <<<<<<<<<<<<<<
6295 * r = bgzf_close(fp)
6296 * if r < 0: raise OSError("writing failed")
6298 free(__pyx_v_buffer);
6303 * r = bgzf_close(fp) # <<<<<<<<<<<<<<
6304 * if r < 0: raise OSError("writing failed")
6307 __pyx_v_r = bgzf_close(__pyx_v_fp);
6311 * r = bgzf_close(fp)
6312 * if r < 0: raise OSError("writing failed") # <<<<<<<<<<<<<<
6314 * def tabix_index( filename,
6316 __pyx_t_6 = (__pyx_v_r < 0);
6318 __pyx_t_4 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6319 __Pyx_GOTREF(__pyx_t_4);
6320 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6321 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6322 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6327 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6330 __Pyx_XDECREF(__pyx_t_3);
6331 __Pyx_XDECREF(__pyx_t_4);
6332 __Pyx_XDECREF(__pyx_t_5);
6333 __Pyx_AddTraceback("ctabix.tabix_compress", __pyx_clineno, __pyx_lineno, __pyx_filename);
6336 __Pyx_XDECREF(__pyx_v_fn);
6337 __Pyx_XGIVEREF(__pyx_r);
6338 __Pyx_RefNannyFinishContext();
6342 /* Python wrapper */
6343 static PyObject *__pyx_pw_6ctabix_3tabix_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6344 static char __pyx_doc_6ctabix_2tabix_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 ";
6345 static PyMethodDef __pyx_mdef_6ctabix_3tabix_index = {__Pyx_NAMESTR("tabix_index"), (PyCFunction)__pyx_pw_6ctabix_3tabix_index, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_2tabix_index)};
6346 static PyObject *__pyx_pw_6ctabix_3tabix_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6347 PyObject *__pyx_v_filename = 0;
6348 PyObject *__pyx_v_force = 0;
6349 PyObject *__pyx_v_seq_col = 0;
6350 PyObject *__pyx_v_start_col = 0;
6351 PyObject *__pyx_v_end_col = 0;
6352 PyObject *__pyx_v_preset = 0;
6353 PyObject *__pyx_v_meta_char = 0;
6354 PyObject *__pyx_v_zerobased = 0;
6355 PyObject *__pyx_r = 0;
6356 __Pyx_RefNannyDeclarations
6357 __Pyx_RefNannySetupContext("tabix_index (wrapper)", 0);
6359 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};
6360 PyObject* values[8] = {0,0,0,0,0,0,0,0};
6361 values[1] = __pyx_k_39;
6364 * def tabix_index( filename,
6366 * seq_col = None, # <<<<<<<<<<<<<<
6370 values[2] = ((PyObject *)Py_None);
6375 * start_col = None, # <<<<<<<<<<<<<<
6379 values[3] = ((PyObject *)Py_None);
6384 * end_col = None, # <<<<<<<<<<<<<<
6388 values[4] = ((PyObject *)Py_None);
6393 * preset = None, # <<<<<<<<<<<<<<
6395 * zerobased = False,
6397 values[5] = ((PyObject *)Py_None);
6398 values[6] = ((PyObject *)__pyx_kp_s_40);
6399 values[7] = __pyx_k_41;
6400 if (unlikely(__pyx_kwds)) {
6402 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6404 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
6405 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6406 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6407 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6408 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6409 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6410 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6411 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6413 default: goto __pyx_L5_argtuple_error;
6415 kw_args = PyDict_Size(__pyx_kwds);
6418 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--;
6419 else goto __pyx_L5_argtuple_error;
6422 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__force);
6423 if (value) { values[1] = value; kw_args--; }
6427 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seq_col);
6428 if (value) { values[2] = value; kw_args--; }
6432 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start_col);
6433 if (value) { values[3] = value; kw_args--; }
6437 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end_col);
6438 if (value) { values[4] = value; kw_args--; }
6442 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__preset);
6443 if (value) { values[5] = value; kw_args--; }
6447 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__meta_char);
6448 if (value) { values[6] = value; kw_args--; }
6452 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__zerobased);
6453 if (value) { values[7] = value; kw_args--; }
6456 if (unlikely(kw_args > 0)) {
6457 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tabix_index") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
6460 switch (PyTuple_GET_SIZE(__pyx_args)) {
6461 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
6462 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6463 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6464 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6465 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6466 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6467 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6468 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6470 default: goto __pyx_L5_argtuple_error;
6473 __pyx_v_filename = values[0];
6474 __pyx_v_force = values[1];
6475 __pyx_v_seq_col = values[2];
6476 __pyx_v_start_col = values[3];
6477 __pyx_v_end_col = values[4];
6478 __pyx_v_preset = values[5];
6479 __pyx_v_meta_char = values[6];
6480 __pyx_v_zerobased = values[7];
6482 goto __pyx_L4_argument_unpacking_done;
6483 __pyx_L5_argtuple_error:;
6484 __Pyx_RaiseArgtupleInvalid("tabix_index", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
6486 __Pyx_AddTraceback("ctabix.tabix_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
6487 __Pyx_RefNannyFinishContext();
6489 __pyx_L4_argument_unpacking_done:;
6490 __pyx_r = __pyx_pf_6ctabix_2tabix_index(__pyx_self, __pyx_v_filename, __pyx_v_force, __pyx_v_seq_col, __pyx_v_start_col, __pyx_v_end_col, __pyx_v_preset, __pyx_v_meta_char, __pyx_v_zerobased);
6491 __Pyx_RefNannyFinishContext();
6496 * if r < 0: raise OSError("writing failed")
6498 * def tabix_index( filename, # <<<<<<<<<<<<<<
6503 static PyObject *__pyx_pf_6ctabix_2tabix_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_force, PyObject *__pyx_v_seq_col, PyObject *__pyx_v_start_col, PyObject *__pyx_v_end_col, PyObject *__pyx_v_preset, PyObject *__pyx_v_meta_char, PyObject *__pyx_v_zerobased) {
6504 PyObject *__pyx_v_preset2conf = NULL;
6505 PyObject *__pyx_v_conf_data = NULL;
6506 ti_conf_t __pyx_v_conf;
6507 PyObject *__pyx_v_fn = NULL;
6508 PyObject *__pyx_r = NULL;
6509 __Pyx_RefNannyDeclarations
6510 PyObject *__pyx_t_1 = NULL;
6511 PyObject *__pyx_t_2 = NULL;
6512 PyObject *__pyx_t_3 = NULL;
6515 PyObject *__pyx_t_6 = NULL;
6517 PyObject *__pyx_t_8 = NULL;
6518 PyObject *__pyx_t_9 = NULL;
6519 PyObject *__pyx_t_10 = NULL;
6521 PyObject *__pyx_t_12 = NULL;
6522 PyObject *__pyx_t_13 = NULL;
6523 PyObject *__pyx_t_14 = NULL;
6524 PyObject *(*__pyx_t_15)(PyObject *);
6532 int __pyx_lineno = 0;
6533 const char *__pyx_filename = NULL;
6534 int __pyx_clineno = 0;
6535 __Pyx_RefNannySetupContext("tabix_index", 0);
6536 __Pyx_INCREF(__pyx_v_filename);
6537 __Pyx_INCREF(__pyx_v_end_col);
6538 __Pyx_INCREF(__pyx_v_preset);
6543 * if not os.path.exists(filename): raise IOError("No such file '%s'" % filename) # <<<<<<<<<<<<<<
6545 * if not filename.endswith(".gz"):
6547 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6548 __Pyx_GOTREF(__pyx_t_1);
6549 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6550 __Pyx_GOTREF(__pyx_t_2);
6551 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6552 __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6553 __Pyx_GOTREF(__pyx_t_1);
6554 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6555 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6556 __Pyx_GOTREF(__pyx_t_2);
6557 __Pyx_INCREF(__pyx_v_filename);
6558 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_filename);
6559 __Pyx_GIVEREF(__pyx_v_filename);
6560 __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 = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6561 __Pyx_GOTREF(__pyx_t_3);
6562 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6563 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
6564 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6565 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6566 __pyx_t_5 = (!__pyx_t_4);
6568 __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), __pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6569 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
6570 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6571 __Pyx_GOTREF(__pyx_t_2);
6572 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
6573 __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
6575 __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 = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6576 __Pyx_GOTREF(__pyx_t_3);
6577 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
6578 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6579 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6580 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6586 * if not os.path.exists(filename): raise IOError("No such file '%s'" % filename)
6588 * if not filename.endswith(".gz"): # <<<<<<<<<<<<<<
6589 * tabix_compress( filename, filename + ".gz", force = force )
6590 * os.unlink( filename )
6592 __pyx_t_3 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__endswith); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6593 __Pyx_GOTREF(__pyx_t_3);
6594 __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_44), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6595 __Pyx_GOTREF(__pyx_t_2);
6596 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6597 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6598 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6599 __pyx_t_4 = (!__pyx_t_5);
6604 * if not filename.endswith(".gz"):
6605 * tabix_compress( filename, filename + ".gz", force = force ) # <<<<<<<<<<<<<<
6606 * os.unlink( filename )
6609 __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__tabix_compress); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6610 __Pyx_GOTREF(__pyx_t_2);
6611 __pyx_t_3 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_43)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6612 __Pyx_GOTREF(__pyx_t_3);
6613 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6614 __Pyx_GOTREF(__pyx_t_1);
6615 __Pyx_INCREF(__pyx_v_filename);
6616 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
6617 __Pyx_GIVEREF(__pyx_v_filename);
6618 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
6619 __Pyx_GIVEREF(__pyx_t_3);
6621 __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6622 __Pyx_GOTREF(((PyObject *)__pyx_t_3));
6623 if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__force), __pyx_v_force) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6624 __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6625 __Pyx_GOTREF(__pyx_t_6);
6626 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6627 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
6628 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
6629 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6632 * if not filename.endswith(".gz"):
6633 * tabix_compress( filename, filename + ".gz", force = force )
6634 * os.unlink( filename ) # <<<<<<<<<<<<<<
6638 __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6639 __Pyx_GOTREF(__pyx_t_6);
6640 __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__unlink); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6641 __Pyx_GOTREF(__pyx_t_3);
6642 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6643 __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6644 __Pyx_GOTREF(__pyx_t_6);
6645 __Pyx_INCREF(__pyx_v_filename);
6646 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_filename);
6647 __Pyx_GIVEREF(__pyx_v_filename);
6648 __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 = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6649 __Pyx_GOTREF(__pyx_t_1);
6650 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6651 __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
6652 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6655 * tabix_compress( filename, filename + ".gz", force = force )
6656 * os.unlink( filename )
6657 * filename += ".gz" # <<<<<<<<<<<<<<
6659 * if not force and os.path.exists(filename + ".tbi" ):
6661 __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_filename, ((PyObject *)__pyx_kp_s_43)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6662 __Pyx_GOTREF(__pyx_t_1);
6663 __Pyx_DECREF(__pyx_v_filename);
6664 __pyx_v_filename = __pyx_t_1;
6673 * if not force and os.path.exists(filename + ".tbi" ): # <<<<<<<<<<<<<<
6674 * raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" )
6677 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_force); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6678 __pyx_t_5 = (!__pyx_t_4);
6680 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6681 __Pyx_GOTREF(__pyx_t_1);
6682 __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6683 __Pyx_GOTREF(__pyx_t_6);
6684 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6685 __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6686 __Pyx_GOTREF(__pyx_t_1);
6687 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6688 __pyx_t_6 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_6)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6689 __Pyx_GOTREF(__pyx_t_6);
6690 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6691 __Pyx_GOTREF(__pyx_t_3);
6692 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
6693 __Pyx_GIVEREF(__pyx_t_6);
6695 __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 = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6696 __Pyx_GOTREF(__pyx_t_6);
6697 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6698 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
6699 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6700 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6701 __pyx_t_7 = __pyx_t_4;
6703 __pyx_t_7 = __pyx_t_5;
6709 * if not force and os.path.exists(filename + ".tbi" ):
6710 * raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" ) # <<<<<<<<<<<<<<
6712 * # columns (1-based)
6714 __pyx_t_6 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_k_tuple_46), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6715 __Pyx_GOTREF(__pyx_t_6);
6716 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
6717 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6718 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6724 * # preset-code, contig, start, end, metachar for commends, lines to ignore at beginning
6725 * # 0 is a missing column
6726 * preset2conf = { # <<<<<<<<<<<<<<
6727 * 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),
6728 * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
6730 __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6731 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
6734 * # 0 is a missing column
6736 * 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ), # <<<<<<<<<<<<<<
6737 * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
6738 * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
6740 __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6741 __Pyx_GOTREF(__pyx_t_3);
6742 __Pyx_INCREF(__pyx_int_0);
6743 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0);
6744 __Pyx_GIVEREF(__pyx_int_0);
6745 __Pyx_INCREF(__pyx_int_1);
6746 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1);
6747 __Pyx_GIVEREF(__pyx_int_1);
6748 __Pyx_INCREF(__pyx_int_4);
6749 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_4);
6750 __Pyx_GIVEREF(__pyx_int_4);
6751 __Pyx_INCREF(__pyx_int_5);
6752 PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_int_5);
6753 __Pyx_GIVEREF(__pyx_int_5);
6754 __Pyx_INCREF(__pyx_int_35);
6755 PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_int_35);
6756 __Pyx_GIVEREF(__pyx_int_35);
6757 __Pyx_INCREF(__pyx_int_0);
6758 PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0);
6759 __Pyx_GIVEREF(__pyx_int_0);
6760 if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__gff), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6761 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
6765 * 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),
6766 * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ), # <<<<<<<<<<<<<<
6767 * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
6768 * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
6770 __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6771 __Pyx_GOTREF(__pyx_t_3);
6772 __Pyx_INCREF(__pyx_int_65536);
6773 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_65536);
6774 __Pyx_GIVEREF(__pyx_int_65536);
6775 __Pyx_INCREF(__pyx_int_1);
6776 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1);
6777 __Pyx_GIVEREF(__pyx_int_1);
6778 __Pyx_INCREF(__pyx_int_2);
6779 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_2);
6780 __Pyx_GIVEREF(__pyx_int_2);
6781 __Pyx_INCREF(__pyx_int_3);
6782 PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_int_3);
6783 __Pyx_GIVEREF(__pyx_int_3);
6784 __Pyx_INCREF(__pyx_int_35);
6785 PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_int_35);
6786 __Pyx_GIVEREF(__pyx_int_35);
6787 __Pyx_INCREF(__pyx_int_0);
6788 PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0);
6789 __Pyx_GIVEREF(__pyx_int_0);
6790 if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__bed), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6791 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
6794 * 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ),
6795 * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
6796 * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ), # <<<<<<<<<<<<<<
6797 * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
6798 * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
6800 __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6801 __Pyx_GOTREF(__pyx_t_3);
6802 __Pyx_INCREF(__pyx_int_65536);
6803 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_65536);
6804 __Pyx_GIVEREF(__pyx_int_65536);
6805 __Pyx_INCREF(__pyx_int_15);
6806 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_15);
6807 __Pyx_GIVEREF(__pyx_int_15);
6808 __Pyx_INCREF(__pyx_int_17);
6809 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_17);
6810 __Pyx_GIVEREF(__pyx_int_17);
6811 __Pyx_INCREF(__pyx_int_18);
6812 PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_int_18);
6813 __Pyx_GIVEREF(__pyx_int_18);
6814 __Pyx_INCREF(__pyx_int_35);
6815 PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_int_35);
6816 __Pyx_GIVEREF(__pyx_int_35);
6817 __Pyx_INCREF(__pyx_int_0);
6818 PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0);
6819 __Pyx_GIVEREF(__pyx_int_0);
6820 if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__psltbl), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6821 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
6824 * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ),
6825 * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
6826 * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ), # <<<<<<<<<<<<<<
6827 * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
6828 * 'pileup': (3, 1, 2, 0, ord('#'), 0 ),
6830 __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6831 __Pyx_GOTREF(__pyx_t_3);
6832 __Pyx_INCREF(__pyx_int_1);
6833 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_1);
6834 __Pyx_GIVEREF(__pyx_int_1);
6835 __Pyx_INCREF(__pyx_int_3);
6836 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_3);
6837 __Pyx_GIVEREF(__pyx_int_3);
6838 __Pyx_INCREF(__pyx_int_4);
6839 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_4);
6840 __Pyx_GIVEREF(__pyx_int_4);
6841 __Pyx_INCREF(__pyx_int_0);
6842 PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_int_0);
6843 __Pyx_GIVEREF(__pyx_int_0);
6844 __Pyx_INCREF(__pyx_int_35);
6845 PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_int_35);
6846 __Pyx_GIVEREF(__pyx_int_35);
6847 __Pyx_INCREF(__pyx_int_0);
6848 PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0);
6849 __Pyx_GIVEREF(__pyx_int_0);
6850 if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__sam), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6851 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
6854 * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ),
6855 * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
6856 * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ), # <<<<<<<<<<<<<<
6857 * 'pileup': (3, 1, 2, 0, ord('#'), 0 ),
6860 __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6861 __Pyx_GOTREF(__pyx_t_3);
6862 __Pyx_INCREF(__pyx_int_2);
6863 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_2);
6864 __Pyx_GIVEREF(__pyx_int_2);
6865 __Pyx_INCREF(__pyx_int_1);
6866 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1);
6867 __Pyx_GIVEREF(__pyx_int_1);
6868 __Pyx_INCREF(__pyx_int_2);
6869 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_2);
6870 __Pyx_GIVEREF(__pyx_int_2);
6871 __Pyx_INCREF(__pyx_int_0);
6872 PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_int_0);
6873 __Pyx_GIVEREF(__pyx_int_0);
6874 __Pyx_INCREF(__pyx_int_35);
6875 PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_int_35);
6876 __Pyx_GIVEREF(__pyx_int_35);
6877 __Pyx_INCREF(__pyx_int_0);
6878 PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0);
6879 __Pyx_GIVEREF(__pyx_int_0);
6880 if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__vcf), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6881 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
6884 * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ),
6885 * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ),
6886 * 'pileup': (3, 1, 2, 0, ord('#'), 0 ), # <<<<<<<<<<<<<<
6890 __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6891 __Pyx_GOTREF(__pyx_t_3);
6892 __Pyx_INCREF(__pyx_int_3);
6893 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_3);
6894 __Pyx_GIVEREF(__pyx_int_3);
6895 __Pyx_INCREF(__pyx_int_1);
6896 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1);
6897 __Pyx_GIVEREF(__pyx_int_1);
6898 __Pyx_INCREF(__pyx_int_2);
6899 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_2);
6900 __Pyx_GIVEREF(__pyx_int_2);
6901 __Pyx_INCREF(__pyx_int_0);
6902 PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_int_0);
6903 __Pyx_GIVEREF(__pyx_int_0);
6904 __Pyx_INCREF(__pyx_int_35);
6905 PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_int_35);
6906 __Pyx_GIVEREF(__pyx_int_35);
6907 __Pyx_INCREF(__pyx_int_0);
6908 PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0);
6909 __Pyx_GIVEREF(__pyx_int_0);
6910 if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__pileup), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6911 __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
6912 __pyx_v_preset2conf = __pyx_t_6;
6918 * if preset: # <<<<<<<<<<<<<<
6920 * conf_data = preset2conf[preset]
6922 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_preset); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6928 * try: # <<<<<<<<<<<<<<
6929 * conf_data = preset2conf[preset]
6933 __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
6934 __Pyx_XGOTREF(__pyx_t_8);
6935 __Pyx_XGOTREF(__pyx_t_9);
6936 __Pyx_XGOTREF(__pyx_t_10);
6942 * conf_data = preset2conf[preset] # <<<<<<<<<<<<<<
6944 * raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() )))
6946 __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_preset2conf), __pyx_v_preset); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
6947 __Pyx_GOTREF(__pyx_t_6);
6948 __pyx_v_conf_data = __pyx_t_6;
6951 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
6952 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
6953 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6954 goto __pyx_L14_try_end;
6956 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6957 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6958 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6959 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6963 * conf_data = preset2conf[preset]
6964 * except KeyError: # <<<<<<<<<<<<<<
6965 * raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() )))
6968 __pyx_t_11 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
6970 __Pyx_AddTraceback("ctabix.tabix_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
6971 if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
6972 __Pyx_GOTREF(__pyx_t_6);
6973 __Pyx_GOTREF(__pyx_t_3);
6974 __Pyx_GOTREF(__pyx_t_1);
6977 * conf_data = preset2conf[preset]
6979 * raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() ))) # <<<<<<<<<<<<<<
6981 * if end_col == None: end_col = -1
6983 __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_48), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
6984 __Pyx_GOTREF(__pyx_t_2);
6985 __pyx_t_12 = PyDict_Keys(__pyx_v_preset2conf); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
6986 __Pyx_GOTREF(__pyx_t_12);
6987 __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
6988 __Pyx_GOTREF(__pyx_t_13);
6989 PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
6990 __Pyx_GIVEREF(__pyx_t_12);
6992 __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
6993 __Pyx_GOTREF(__pyx_t_12);
6994 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6995 __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
6996 __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
6997 __Pyx_GOTREF(__pyx_t_13);
6998 __Pyx_INCREF(__pyx_v_preset);
6999 PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_preset);
7000 __Pyx_GIVEREF(__pyx_v_preset);
7001 PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_12);
7002 __Pyx_GIVEREF(__pyx_t_12);
7004 __pyx_t_12 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_47), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
7005 __Pyx_GOTREF(((PyObject *)__pyx_t_12));
7006 __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
7007 __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
7008 __Pyx_GOTREF(__pyx_t_13);
7009 PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_12));
7010 __Pyx_GIVEREF(((PyObject *)__pyx_t_12));
7012 __pyx_t_12 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
7013 __Pyx_GOTREF(__pyx_t_12);
7014 __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
7015 __Pyx_Raise(__pyx_t_12, 0, 0, 0);
7016 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7017 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
7018 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7019 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7020 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7021 goto __pyx_L8_exception_handled;
7023 __pyx_L9_except_error:;
7024 __Pyx_XGIVEREF(__pyx_t_8);
7025 __Pyx_XGIVEREF(__pyx_t_9);
7026 __Pyx_XGIVEREF(__pyx_t_10);
7027 __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
7028 goto __pyx_L1_error;
7029 __pyx_L8_exception_handled:;
7030 __Pyx_XGIVEREF(__pyx_t_8);
7031 __Pyx_XGIVEREF(__pyx_t_9);
7032 __Pyx_XGIVEREF(__pyx_t_10);
7033 __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
7041 * raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() )))
7043 * if end_col == None: end_col = -1 # <<<<<<<<<<<<<<
7047 __pyx_t_1 = PyObject_RichCompare(__pyx_v_end_col, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7048 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7049 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7051 __Pyx_INCREF(__pyx_int_neg_1);
7052 __Pyx_DECREF(__pyx_v_end_col);
7053 __pyx_v_end_col = __pyx_int_neg_1;
7060 * if end_col == None: end_col = -1
7061 * preset = 0 # <<<<<<<<<<<<<<
7063 * # note that tabix internally works with 0-based coordinates and open/closed intervals.
7065 __Pyx_INCREF(__pyx_int_0);
7066 __Pyx_DECREF(__pyx_v_preset);
7067 __pyx_v_preset = __pyx_int_0;
7070 * # -1 is subtracted from the start coordinate. To avoid doing this, set
7071 * # the TI_FLAG_UCSC=0x10000 flag:
7072 * if zerobased: preset = preset | 0x10000 # <<<<<<<<<<<<<<
7074 * conf_data = (preset, seq_col+1, start_col+1, end_col+1, ord(meta_char), 0)
7076 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_zerobased); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7078 __pyx_t_1 = PyNumber_Or(__pyx_v_preset, __pyx_int_65536); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7079 __Pyx_GOTREF(__pyx_t_1);
7080 __Pyx_DECREF(__pyx_v_preset);
7081 __pyx_v_preset = __pyx_t_1;
7088 * if zerobased: preset = preset | 0x10000
7090 * conf_data = (preset, seq_col+1, start_col+1, end_col+1, ord(meta_char), 0) # <<<<<<<<<<<<<<
7092 * cdef ti_conf_t conf
7094 __pyx_t_1 = PyNumber_Add(__pyx_v_seq_col, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7095 __Pyx_GOTREF(__pyx_t_1);
7096 __pyx_t_3 = PyNumber_Add(__pyx_v_start_col, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7097 __Pyx_GOTREF(__pyx_t_3);
7098 __pyx_t_6 = PyNumber_Add(__pyx_v_end_col, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7099 __Pyx_GOTREF(__pyx_t_6);
7100 __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7101 __Pyx_GOTREF(__pyx_t_12);
7102 __Pyx_INCREF(__pyx_v_meta_char);
7103 PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_meta_char);
7104 __Pyx_GIVEREF(__pyx_v_meta_char);
7105 __pyx_t_13 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7106 __Pyx_GOTREF(__pyx_t_13);
7107 __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
7108 __pyx_t_12 = PyTuple_New(6); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7109 __Pyx_GOTREF(__pyx_t_12);
7110 __Pyx_INCREF(__pyx_v_preset);
7111 PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_preset);
7112 __Pyx_GIVEREF(__pyx_v_preset);
7113 PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_1);
7114 __Pyx_GIVEREF(__pyx_t_1);
7115 PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_3);
7116 __Pyx_GIVEREF(__pyx_t_3);
7117 PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_6);
7118 __Pyx_GIVEREF(__pyx_t_6);
7119 PyTuple_SET_ITEM(__pyx_t_12, 4, __pyx_t_13);
7120 __Pyx_GIVEREF(__pyx_t_13);
7121 __Pyx_INCREF(__pyx_int_0);
7122 PyTuple_SET_ITEM(__pyx_t_12, 5, __pyx_int_0);
7123 __Pyx_GIVEREF(__pyx_int_0);
7128 __pyx_v_conf_data = ((PyObject *)__pyx_t_12);
7135 * cdef ti_conf_t conf
7136 * conf.preset, conf.sc, conf.bc, conf.ec, conf.meta_char, conf.line_skip = conf_data # <<<<<<<<<<<<<<
7138 * fn = _my_encodeFilename( filename )
7140 if ((likely(PyTuple_CheckExact(__pyx_v_conf_data))) || (PyList_CheckExact(__pyx_v_conf_data))) {
7141 PyObject* sequence = __pyx_v_conf_data;
7142 #if CYTHON_COMPILING_IN_CPYTHON
7143 Py_ssize_t size = Py_SIZE(sequence);
7145 Py_ssize_t size = PySequence_Size(sequence);
7147 if (unlikely(size != 6)) {
7148 if (size > 6) __Pyx_RaiseTooManyValuesError(6);
7149 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7150 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7152 #if CYTHON_COMPILING_IN_CPYTHON
7153 if (likely(PyTuple_CheckExact(sequence))) {
7154 __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0);
7155 __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1);
7156 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2);
7157 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3);
7158 __pyx_t_1 = PyTuple_GET_ITEM(sequence, 4);
7159 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 5);
7161 __pyx_t_12 = PyList_GET_ITEM(sequence, 0);
7162 __pyx_t_13 = PyList_GET_ITEM(sequence, 1);
7163 __pyx_t_6 = PyList_GET_ITEM(sequence, 2);
7164 __pyx_t_3 = PyList_GET_ITEM(sequence, 3);
7165 __pyx_t_1 = PyList_GET_ITEM(sequence, 4);
7166 __pyx_t_2 = PyList_GET_ITEM(sequence, 5);
7168 __Pyx_INCREF(__pyx_t_12);
7169 __Pyx_INCREF(__pyx_t_13);
7170 __Pyx_INCREF(__pyx_t_6);
7171 __Pyx_INCREF(__pyx_t_3);
7172 __Pyx_INCREF(__pyx_t_1);
7173 __Pyx_INCREF(__pyx_t_2);
7176 PyObject** temps[6] = {&__pyx_t_12,&__pyx_t_13,&__pyx_t_6,&__pyx_t_3,&__pyx_t_1,&__pyx_t_2};
7177 for (i=0; i < 6; i++) {
7178 PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7184 Py_ssize_t index = -1;
7185 PyObject** temps[6] = {&__pyx_t_12,&__pyx_t_13,&__pyx_t_6,&__pyx_t_3,&__pyx_t_1,&__pyx_t_2};
7186 __pyx_t_14 = PyObject_GetIter(__pyx_v_conf_data); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7187 __Pyx_GOTREF(__pyx_t_14);
7188 __pyx_t_15 = Py_TYPE(__pyx_t_14)->tp_iternext;
7189 for (index=0; index < 6; index++) {
7190 PyObject* item = __pyx_t_15(__pyx_t_14); if (unlikely(!item)) goto __pyx_L19_unpacking_failed;
7192 *(temps[index]) = item;
7194 if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7196 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7197 goto __pyx_L20_unpacking_done;
7198 __pyx_L19_unpacking_failed:;
7199 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7201 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7202 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7203 __pyx_L20_unpacking_done:;
7205 __pyx_t_16 = __Pyx_PyInt_from_py_int32_t(__pyx_t_12); if (unlikely((__pyx_t_16 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7206 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7207 __pyx_t_17 = __Pyx_PyInt_from_py_int32_t(__pyx_t_13); if (unlikely((__pyx_t_17 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7208 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7209 __pyx_t_18 = __Pyx_PyInt_from_py_int32_t(__pyx_t_6); if (unlikely((__pyx_t_18 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7210 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7211 __pyx_t_19 = __Pyx_PyInt_from_py_int32_t(__pyx_t_3); if (unlikely((__pyx_t_19 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7212 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7213 __pyx_t_20 = __Pyx_PyInt_from_py_int32_t(__pyx_t_1); if (unlikely((__pyx_t_20 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7214 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7215 __pyx_t_21 = __Pyx_PyInt_from_py_int32_t(__pyx_t_2); if (unlikely((__pyx_t_21 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7216 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7217 __pyx_v_conf.preset = __pyx_t_16;
7218 __pyx_v_conf.sc = __pyx_t_17;
7219 __pyx_v_conf.bc = __pyx_t_18;
7220 __pyx_v_conf.ec = __pyx_t_19;
7221 __pyx_v_conf.meta_char = __pyx_t_20;
7222 __pyx_v_conf.line_skip = __pyx_t_21;
7225 * conf.preset, conf.sc, conf.bc, conf.ec, conf.meta_char, conf.line_skip = conf_data
7227 * fn = _my_encodeFilename( filename ) # <<<<<<<<<<<<<<
7228 * ti_index_build( fn, &conf)
7231 __pyx_t_2 = ((PyObject *)__pyx_f_6ctabix__my_encodeFilename(__pyx_v_filename)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7232 __Pyx_GOTREF(__pyx_t_2);
7233 __pyx_v_fn = ((PyObject*)__pyx_t_2);
7238 * fn = _my_encodeFilename( filename )
7239 * ti_index_build( fn, &conf) # <<<<<<<<<<<<<<
7243 __pyx_t_22 = PyBytes_AsString(((PyObject *)__pyx_v_fn)); if (unlikely((!__pyx_t_22) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7244 ti_index_build(__pyx_t_22, (&__pyx_v_conf));
7247 * ti_index_build( fn, &conf)
7249 * return filename # <<<<<<<<<<<<<<
7251 * #########################################################
7253 __Pyx_XDECREF(__pyx_r);
7254 __Pyx_INCREF(__pyx_v_filename);
7255 __pyx_r = __pyx_v_filename;
7258 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7261 __Pyx_XDECREF(__pyx_t_1);
7262 __Pyx_XDECREF(__pyx_t_2);
7263 __Pyx_XDECREF(__pyx_t_3);
7264 __Pyx_XDECREF(__pyx_t_6);
7265 __Pyx_XDECREF(__pyx_t_12);
7266 __Pyx_XDECREF(__pyx_t_13);
7267 __Pyx_XDECREF(__pyx_t_14);
7268 __Pyx_AddTraceback("ctabix.tabix_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
7271 __Pyx_XDECREF(__pyx_v_preset2conf);
7272 __Pyx_XDECREF(__pyx_v_conf_data);
7273 __Pyx_XDECREF(__pyx_v_fn);
7274 __Pyx_XDECREF(__pyx_v_filename);
7275 __Pyx_XDECREF(__pyx_v_end_col);
7276 __Pyx_XDECREF(__pyx_v_preset);
7277 __Pyx_XGIVEREF(__pyx_r);
7278 __Pyx_RefNannyFinishContext();
7282 /* Python wrapper */
7283 static int __pyx_pw_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7284 static int __pyx_pw_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7285 PyObject *__pyx_v_infile = 0;
7286 int __pyx_v_buffer_size;
7288 __Pyx_RefNannyDeclarations
7289 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
7291 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__infile,&__pyx_n_s__buffer_size,0};
7292 PyObject* values[2] = {0,0};
7293 if (unlikely(__pyx_kwds)) {
7295 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7297 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7298 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7300 default: goto __pyx_L5_argtuple_error;
7302 kw_args = PyDict_Size(__pyx_kwds);
7305 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile)) != 0)) kw_args--;
7306 else goto __pyx_L5_argtuple_error;
7309 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer_size);
7310 if (value) { values[1] = value; kw_args--; }
7313 if (unlikely(kw_args > 0)) {
7314 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7317 switch (PyTuple_GET_SIZE(__pyx_args)) {
7318 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7319 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7321 default: goto __pyx_L5_argtuple_error;
7324 __pyx_v_infile = values[0];
7326 __pyx_v_buffer_size = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_buffer_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7328 __pyx_v_buffer_size = ((int)65536);
7331 goto __pyx_L4_argument_unpacking_done;
7332 __pyx_L5_argtuple_error:;
7333 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7335 __Pyx_AddTraceback("ctabix.tabix_inplace_iterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7336 __Pyx_RefNannyFinishContext();
7338 __pyx_L4_argument_unpacking_done:;
7339 __pyx_r = __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(((struct __pyx_obj_6ctabix_tabix_inplace_iterator *)__pyx_v_self), __pyx_v_infile, __pyx_v_buffer_size);
7340 __Pyx_RefNannyFinishContext();
7347 * def __cinit__(self, infile, int buffer_size = 65536 ): # <<<<<<<<<<<<<<
7349 * cdef int fd = PyObject_AsFileDescriptor( infile )
7352 static int __pyx_pf_6ctabix_22tabix_inplace_iterator___cinit__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self, PyObject *__pyx_v_infile, int __pyx_v_buffer_size) {
7355 __Pyx_RefNannyDeclarations
7358 PyObject *__pyx_t_3 = NULL;
7359 int __pyx_lineno = 0;
7360 const char *__pyx_filename = NULL;
7361 int __pyx_clineno = 0;
7362 __Pyx_RefNannySetupContext("__cinit__", 0);
7365 * def __cinit__(self, infile, int buffer_size = 65536 ):
7367 * cdef int fd = PyObject_AsFileDescriptor( infile ) # <<<<<<<<<<<<<<
7368 * if fd == -1: raise ValueError( "I/O operation on closed file." )
7369 * self.infile = fdopen( fd, 'r')
7371 __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_infile); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7372 __pyx_v_fd = __pyx_t_1;
7376 * cdef int fd = PyObject_AsFileDescriptor( infile )
7377 * if fd == -1: raise ValueError( "I/O operation on closed file." ) # <<<<<<<<<<<<<<
7378 * self.infile = fdopen( fd, 'r')
7381 __pyx_t_2 = (__pyx_v_fd == -1);
7383 __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_50), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7384 __Pyx_GOTREF(__pyx_t_3);
7385 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7386 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7387 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7393 * cdef int fd = PyObject_AsFileDescriptor( infile )
7394 * if fd == -1: raise ValueError( "I/O operation on closed file." )
7395 * self.infile = fdopen( fd, 'r') # <<<<<<<<<<<<<<
7397 * if self.infile == NULL: raise ValueError( "I/O operation on closed file." )
7399 __pyx_v_self->infile = fdopen(__pyx_v_fd, __pyx_k__r);
7402 * self.infile = fdopen( fd, 'r')
7404 * if self.infile == NULL: raise ValueError( "I/O operation on closed file." ) # <<<<<<<<<<<<<<
7406 * self.buffer = <char*>malloc( buffer_size )
7408 __pyx_t_2 = (__pyx_v_self->infile == NULL);
7410 __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7411 __Pyx_GOTREF(__pyx_t_3);
7412 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7413 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7414 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7420 * if self.infile == NULL: raise ValueError( "I/O operation on closed file." )
7422 * self.buffer = <char*>malloc( buffer_size ) # <<<<<<<<<<<<<<
7423 * self.size = buffer_size
7426 __pyx_v_self->buffer = ((char *)malloc(__pyx_v_buffer_size));
7430 * self.buffer = <char*>malloc( buffer_size )
7431 * self.size = buffer_size # <<<<<<<<<<<<<<
7433 * def __iter__(self):
7435 __pyx_v_self->size = __pyx_v_buffer_size;
7440 __Pyx_XDECREF(__pyx_t_3);
7441 __Pyx_AddTraceback("ctabix.tabix_inplace_iterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7444 __Pyx_RefNannyFinishContext();
7448 /* Python wrapper */
7449 static PyObject *__pyx_pw_6ctabix_22tabix_inplace_iterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
7450 static PyObject *__pyx_pw_6ctabix_22tabix_inplace_iterator_3__iter__(PyObject *__pyx_v_self) {
7451 PyObject *__pyx_r = 0;
7452 __Pyx_RefNannyDeclarations
7453 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
7454 __pyx_r = __pyx_pf_6ctabix_22tabix_inplace_iterator_2__iter__(((struct __pyx_obj_6ctabix_tabix_inplace_iterator *)__pyx_v_self));
7455 __Pyx_RefNannyFinishContext();
7460 * self.size = buffer_size
7462 * def __iter__(self): # <<<<<<<<<<<<<<
7467 static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_2__iter__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self) {
7468 PyObject *__pyx_r = NULL;
7469 __Pyx_RefNannyDeclarations
7470 __Pyx_RefNannySetupContext("__iter__", 0);
7474 * def __iter__(self):
7475 * return self # <<<<<<<<<<<<<<
7477 * cdef __cnext__(self):
7479 __Pyx_XDECREF(__pyx_r);
7480 __Pyx_INCREF(((PyObject *)__pyx_v_self));
7481 __pyx_r = ((PyObject *)__pyx_v_self);
7484 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7486 __Pyx_XGIVEREF(__pyx_r);
7487 __Pyx_RefNannyFinishContext();
7494 * cdef __cnext__(self): # <<<<<<<<<<<<<<
7499 static PyObject *__pyx_f_6ctabix_22tabix_inplace_iterator___cnext__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self) {
7501 size_t __pyx_v_nbytes;
7502 PyObject *__pyx_v_r = NULL;
7503 char *__pyx_v_result;
7504 PyObject *__pyx_r = NULL;
7505 __Pyx_RefNannyDeclarations
7506 PyObject *__pyx_t_1 = NULL;
7507 PyObject *__pyx_t_2 = NULL;
7512 PyObject *__pyx_t_7 = NULL;
7513 PyObject *__pyx_t_8 = NULL;
7514 int __pyx_lineno = 0;
7515 const char *__pyx_filename = NULL;
7516 int __pyx_clineno = 0;
7517 __Pyx_RefNannySetupContext("__cnext__", 0);
7521 * cdef size_t nbytes
7522 * b = self.buffer # <<<<<<<<<<<<<<
7526 __pyx_v_b = __pyx_v_self->buffer;
7529 * cdef size_t nbytes
7531 * r = self.Parser() # <<<<<<<<<<<<<<
7533 * while not feof( self.infile ):
7535 __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__Parser); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7536 __Pyx_GOTREF(__pyx_t_1);
7537 __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 = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7538 __Pyx_GOTREF(__pyx_t_2);
7539 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7540 __pyx_v_r = __pyx_t_2;
7546 * while not feof( self.infile ): # <<<<<<<<<<<<<<
7547 * nbytes = getline( &b, &self.size, self.infile)
7551 __pyx_t_3 = (!feof(__pyx_v_self->infile));
7552 if (!__pyx_t_3) break;
7556 * while not feof( self.infile ):
7557 * nbytes = getline( &b, &self.size, self.infile) # <<<<<<<<<<<<<<
7559 * # stop at first error or eof
7561 __pyx_v_nbytes = getline((&__pyx_v_b), (&__pyx_v_self->size), __pyx_v_self->infile);
7565 * # stop at first error or eof
7566 * if (nbytes == -1): break # <<<<<<<<<<<<<<
7568 * if (b[0] == '#'): continue
7570 __pyx_t_3 = (__pyx_v_nbytes == -1);
7572 goto __pyx_L4_break;
7578 * if (nbytes == -1): break
7580 * if (b[0] == '#'): continue # <<<<<<<<<<<<<<
7582 * # skip empty lines
7584 __pyx_t_3 = ((__pyx_v_b[0]) == '#');
7586 goto __pyx_L3_continue;
7593 * # skip empty lines
7594 * if b[0] == '\0' or b[0] == '\n' or b[0] == '\r': continue # <<<<<<<<<<<<<<
7596 * # make sure that entry is complete
7598 __pyx_t_3 = ((__pyx_v_b[0]) == '\x00');
7600 __pyx_t_4 = ((__pyx_v_b[0]) == '\n');
7602 __pyx_t_5 = ((__pyx_v_b[0]) == '\r');
7603 __pyx_t_6 = __pyx_t_5;
7605 __pyx_t_6 = __pyx_t_4;
7607 __pyx_t_4 = __pyx_t_6;
7609 __pyx_t_4 = __pyx_t_3;
7612 goto __pyx_L3_continue;
7619 * # make sure that entry is complete
7620 * if b[nbytes-1] != '\n' and b[nbytes-1] != '\r': # <<<<<<<<<<<<<<
7622 * raise ValueError( "incomplete line at %s" % result )
7624 __pyx_t_4 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\n');
7626 __pyx_t_3 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\r');
7627 __pyx_t_6 = __pyx_t_3;
7629 __pyx_t_6 = __pyx_t_4;
7634 * # make sure that entry is complete
7635 * if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
7636 * result = b # <<<<<<<<<<<<<<
7637 * raise ValueError( "incomplete line at %s" % result )
7640 __pyx_v_result = __pyx_v_b;
7643 * if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
7645 * raise ValueError( "incomplete line at %s" % result ) # <<<<<<<<<<<<<<
7647 * # make sure that this goes fully through C
7649 __pyx_t_2 = PyBytes_FromString(__pyx_v_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7650 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
7651 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7652 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
7653 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
7654 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7655 __Pyx_GOTREF(__pyx_t_2);
7656 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
7657 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
7659 __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7660 __Pyx_GOTREF(__pyx_t_1);
7661 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
7662 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
7663 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7664 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7670 * # Python object causing segfaults as
7671 * # the wrong memory is freed
7672 * r.present( b, nbytes ) # <<<<<<<<<<<<<<
7676 __pyx_t_1 = PyObject_GetAttr(__pyx_v_r, __pyx_n_s__present); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7677 __Pyx_GOTREF(__pyx_t_1);
7678 __pyx_t_2 = PyBytes_FromString(__pyx_v_b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7679 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
7680 __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7681 __Pyx_GOTREF(__pyx_t_7);
7682 __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7683 __Pyx_GOTREF(__pyx_t_8);
7684 PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_2));
7685 __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
7686 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
7687 __Pyx_GIVEREF(__pyx_t_7);
7690 __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7691 __Pyx_GOTREF(__pyx_t_7);
7692 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7693 __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
7694 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7697 * # the wrong memory is freed
7698 * r.present( b, nbytes )
7699 * return r # <<<<<<<<<<<<<<
7701 * raise StopIteration
7703 __Pyx_XDECREF(__pyx_r);
7704 __Pyx_INCREF(__pyx_v_r);
7705 __pyx_r = __pyx_v_r;
7714 * raise StopIteration # <<<<<<<<<<<<<<
7716 * def __dealloc__(self):
7718 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
7719 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7721 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7724 __Pyx_XDECREF(__pyx_t_1);
7725 __Pyx_XDECREF(__pyx_t_2);
7726 __Pyx_XDECREF(__pyx_t_7);
7727 __Pyx_XDECREF(__pyx_t_8);
7728 __Pyx_AddTraceback("ctabix.tabix_inplace_iterator.__cnext__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7731 __Pyx_XDECREF(__pyx_v_r);
7732 __Pyx_XGIVEREF(__pyx_r);
7733 __Pyx_RefNannyFinishContext();
7737 /* Python wrapper */
7738 static void __pyx_pw_6ctabix_22tabix_inplace_iterator_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
7739 static void __pyx_pw_6ctabix_22tabix_inplace_iterator_5__dealloc__(PyObject *__pyx_v_self) {
7740 __Pyx_RefNannyDeclarations
7741 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
7742 __pyx_pf_6ctabix_22tabix_inplace_iterator_4__dealloc__(((struct __pyx_obj_6ctabix_tabix_inplace_iterator *)__pyx_v_self));
7743 __Pyx_RefNannyFinishContext();
7747 * raise StopIteration
7749 * def __dealloc__(self): # <<<<<<<<<<<<<<
7754 static void __pyx_pf_6ctabix_22tabix_inplace_iterator_4__dealloc__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self) {
7755 __Pyx_RefNannyDeclarations
7756 __Pyx_RefNannySetupContext("__dealloc__", 0);
7760 * def __dealloc__(self):
7761 * free(self.buffer) # <<<<<<<<<<<<<<
7763 * def __next__(self):
7765 free(__pyx_v_self->buffer);
7767 __Pyx_RefNannyFinishContext();
7770 /* Python wrapper */
7771 static PyObject *__pyx_pw_6ctabix_22tabix_inplace_iterator_7__next__(PyObject *__pyx_v_self); /*proto*/
7772 static PyObject *__pyx_pw_6ctabix_22tabix_inplace_iterator_7__next__(PyObject *__pyx_v_self) {
7773 PyObject *__pyx_r = 0;
7774 __Pyx_RefNannyDeclarations
7775 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
7776 __pyx_r = __pyx_pf_6ctabix_22tabix_inplace_iterator_6__next__(((struct __pyx_obj_6ctabix_tabix_inplace_iterator *)__pyx_v_self));
7777 __Pyx_RefNannyFinishContext();
7784 * def __next__(self): # <<<<<<<<<<<<<<
7785 * return self.__cnext__()
7789 static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_6__next__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self) {
7790 PyObject *__pyx_r = NULL;
7791 __Pyx_RefNannyDeclarations
7792 PyObject *__pyx_t_1 = NULL;
7793 int __pyx_lineno = 0;
7794 const char *__pyx_filename = NULL;
7795 int __pyx_clineno = 0;
7796 __Pyx_RefNannySetupContext("__next__", 0);
7800 * def __next__(self):
7801 * return self.__cnext__() # <<<<<<<<<<<<<<
7803 * ctypedef class tabix_copy_iterator:
7805 __Pyx_XDECREF(__pyx_r);
7806 __pyx_t_1 = ((struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator *)__pyx_v_self->__pyx_vtab)->__pyx___cnext__(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7807 __Pyx_GOTREF(__pyx_t_1);
7808 __pyx_r = __pyx_t_1;
7812 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7815 __Pyx_XDECREF(__pyx_t_1);
7816 __Pyx_AddTraceback("ctabix.tabix_inplace_iterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7819 __Pyx_XGIVEREF(__pyx_r);
7820 __Pyx_RefNannyFinishContext();
7824 /* Python wrapper */
7825 static int __pyx_pw_6ctabix_19tabix_copy_iterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7826 static int __pyx_pw_6ctabix_19tabix_copy_iterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7827 PyObject *__pyx_v_infile = 0;
7828 struct __pyx_obj_6ctabix_Parser *__pyx_v_parser = 0;
7830 __Pyx_RefNannyDeclarations
7831 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
7833 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__infile,&__pyx_n_s__parser,0};
7834 PyObject* values[2] = {0,0};
7835 if (unlikely(__pyx_kwds)) {
7837 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7839 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7840 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7842 default: goto __pyx_L5_argtuple_error;
7844 kw_args = PyDict_Size(__pyx_kwds);
7847 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile)) != 0)) kw_args--;
7848 else goto __pyx_L5_argtuple_error;
7850 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser)) != 0)) kw_args--;
7852 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7855 if (unlikely(kw_args > 0)) {
7856 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7858 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
7859 goto __pyx_L5_argtuple_error;
7861 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7862 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7864 __pyx_v_infile = values[0];
7865 __pyx_v_parser = ((struct __pyx_obj_6ctabix_Parser *)values[1]);
7867 goto __pyx_L4_argument_unpacking_done;
7868 __pyx_L5_argtuple_error:;
7869 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
7871 __Pyx_AddTraceback("ctabix.tabix_copy_iterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7872 __Pyx_RefNannyFinishContext();
7874 __pyx_L4_argument_unpacking_done:;
7875 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_6ctabix_Parser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7876 __pyx_r = __pyx_pf_6ctabix_19tabix_copy_iterator___cinit__(((struct __pyx_obj_6ctabix_tabix_copy_iterator *)__pyx_v_self), __pyx_v_infile, __pyx_v_parser);
7881 __Pyx_RefNannyFinishContext();
7888 * def __cinit__(self, infile, Parser parser ): # <<<<<<<<<<<<<<
7890 * cdef int fd = PyObject_AsFileDescriptor( infile )
7893 static int __pyx_pf_6ctabix_19tabix_copy_iterator___cinit__(struct __pyx_obj_6ctabix_tabix_copy_iterator *__pyx_v_self, PyObject *__pyx_v_infile, struct __pyx_obj_6ctabix_Parser *__pyx_v_parser) {
7896 __Pyx_RefNannyDeclarations
7899 PyObject *__pyx_t_3 = NULL;
7900 int __pyx_lineno = 0;
7901 const char *__pyx_filename = NULL;
7902 int __pyx_clineno = 0;
7903 __Pyx_RefNannySetupContext("__cinit__", 0);
7906 * def __cinit__(self, infile, Parser parser ):
7908 * cdef int fd = PyObject_AsFileDescriptor( infile ) # <<<<<<<<<<<<<<
7909 * if fd == -1: raise ValueError( "I/O operation on closed file." )
7910 * self.infile = fdopen( fd, 'r')
7912 __pyx_t_1 = PyObject_AsFileDescriptor(__pyx_v_infile); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7913 __pyx_v_fd = __pyx_t_1;
7917 * cdef int fd = PyObject_AsFileDescriptor( infile )
7918 * if fd == -1: raise ValueError( "I/O operation on closed file." ) # <<<<<<<<<<<<<<
7919 * self.infile = fdopen( fd, 'r')
7920 * if self.infile == NULL: raise ValueError( "I/O operation on closed file." )
7922 __pyx_t_2 = (__pyx_v_fd == -1);
7924 __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7925 __Pyx_GOTREF(__pyx_t_3);
7926 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7927 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7928 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7934 * cdef int fd = PyObject_AsFileDescriptor( infile )
7935 * if fd == -1: raise ValueError( "I/O operation on closed file." )
7936 * self.infile = fdopen( fd, 'r') # <<<<<<<<<<<<<<
7937 * if self.infile == NULL: raise ValueError( "I/O operation on closed file." )
7938 * self.parser = parser
7940 __pyx_v_self->infile = fdopen(__pyx_v_fd, __pyx_k__r);
7943 * if fd == -1: raise ValueError( "I/O operation on closed file." )
7944 * self.infile = fdopen( fd, 'r')
7945 * if self.infile == NULL: raise ValueError( "I/O operation on closed file." ) # <<<<<<<<<<<<<<
7946 * self.parser = parser
7949 __pyx_t_2 = (__pyx_v_self->infile == NULL);
7951 __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_54), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7952 __Pyx_GOTREF(__pyx_t_3);
7953 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7954 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7955 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7961 * self.infile = fdopen( fd, 'r')
7962 * if self.infile == NULL: raise ValueError( "I/O operation on closed file." )
7963 * self.parser = parser # <<<<<<<<<<<<<<
7965 * def __iter__(self):
7967 __Pyx_INCREF(((PyObject *)__pyx_v_parser));
7968 __Pyx_GIVEREF(((PyObject *)__pyx_v_parser));
7969 __Pyx_GOTREF(__pyx_v_self->parser);
7970 __Pyx_DECREF(((PyObject *)__pyx_v_self->parser));
7971 __pyx_v_self->parser = __pyx_v_parser;
7976 __Pyx_XDECREF(__pyx_t_3);
7977 __Pyx_AddTraceback("ctabix.tabix_copy_iterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7980 __Pyx_RefNannyFinishContext();
7984 /* Python wrapper */
7985 static PyObject *__pyx_pw_6ctabix_19tabix_copy_iterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
7986 static PyObject *__pyx_pw_6ctabix_19tabix_copy_iterator_3__iter__(PyObject *__pyx_v_self) {
7987 PyObject *__pyx_r = 0;
7988 __Pyx_RefNannyDeclarations
7989 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
7990 __pyx_r = __pyx_pf_6ctabix_19tabix_copy_iterator_2__iter__(((struct __pyx_obj_6ctabix_tabix_copy_iterator *)__pyx_v_self));
7991 __Pyx_RefNannyFinishContext();
7996 * self.parser = parser
7998 * def __iter__(self): # <<<<<<<<<<<<<<
8003 static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_2__iter__(struct __pyx_obj_6ctabix_tabix_copy_iterator *__pyx_v_self) {
8004 PyObject *__pyx_r = NULL;
8005 __Pyx_RefNannyDeclarations
8006 __Pyx_RefNannySetupContext("__iter__", 0);
8010 * def __iter__(self):
8011 * return self # <<<<<<<<<<<<<<
8013 * cdef __cnext__(self):
8015 __Pyx_XDECREF(__pyx_r);
8016 __Pyx_INCREF(((PyObject *)__pyx_v_self));
8017 __pyx_r = ((PyObject *)__pyx_v_self);
8020 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8022 __Pyx_XGIVEREF(__pyx_r);
8023 __Pyx_RefNannyFinishContext();
8030 * cdef __cnext__(self): # <<<<<<<<<<<<<<
8035 static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_obj_6ctabix_tabix_copy_iterator *__pyx_v_self) {
8037 size_t __pyx_v_nbytes;
8038 char *__pyx_v_result;
8039 PyObject *__pyx_r = NULL;
8040 __Pyx_RefNannyDeclarations
8045 PyObject *__pyx_t_5 = NULL;
8046 PyObject *__pyx_t_6 = NULL;
8047 PyObject *__pyx_t_7 = NULL;
8048 int __pyx_lineno = 0;
8049 const char *__pyx_filename = NULL;
8050 int __pyx_clineno = 0;
8051 __Pyx_RefNannySetupContext("__cnext__", 0);
8056 * b = NULL # <<<<<<<<<<<<<<
8058 * while not feof( self.infile ):
8065 * while not feof( self.infile ): # <<<<<<<<<<<<<<
8067 * # getline allocates on demand
8070 __pyx_t_1 = (!feof(__pyx_v_self->infile));
8071 if (!__pyx_t_1) break;
8074 * # getline allocates on demand
8075 * # return number of characters read excluding null byte
8076 * nbytes = getline( &b, &nbytes, self.infile) # <<<<<<<<<<<<<<
8077 * # stop at first error
8078 * if (nbytes == -1): break
8080 __pyx_v_nbytes = getline((&__pyx_v_b), (&__pyx_v_nbytes), __pyx_v_self->infile);
8083 * nbytes = getline( &b, &nbytes, self.infile)
8084 * # stop at first error
8085 * if (nbytes == -1): break # <<<<<<<<<<<<<<
8087 * if (b[0] == '#'): continue
8089 __pyx_t_1 = (__pyx_v_nbytes == -1);
8091 goto __pyx_L4_break;
8097 * if (nbytes == -1): break
8099 * if (b[0] == '#'): continue # <<<<<<<<<<<<<<
8101 * # skip empty lines
8103 __pyx_t_1 = ((__pyx_v_b[0]) == '#');
8105 goto __pyx_L3_continue;
8112 * # skip empty lines
8113 * if b[0] == '\0' or b[0] == '\n' or b[0] == '\r': continue # <<<<<<<<<<<<<<
8115 * # make sure that entry is complete
8117 __pyx_t_1 = ((__pyx_v_b[0]) == '\x00');
8119 __pyx_t_2 = ((__pyx_v_b[0]) == '\n');
8121 __pyx_t_3 = ((__pyx_v_b[0]) == '\r');
8122 __pyx_t_4 = __pyx_t_3;
8124 __pyx_t_4 = __pyx_t_2;
8126 __pyx_t_2 = __pyx_t_4;
8128 __pyx_t_2 = __pyx_t_1;
8131 goto __pyx_L3_continue;
8138 * # make sure that entry is complete
8139 * if b[nbytes-1] != '\n' and b[nbytes-1] != '\r': # <<<<<<<<<<<<<<
8143 __pyx_t_2 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\n');
8145 __pyx_t_1 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\r');
8146 __pyx_t_4 = __pyx_t_1;
8148 __pyx_t_4 = __pyx_t_2;
8153 * # make sure that entry is complete
8154 * if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
8155 * result = b # <<<<<<<<<<<<<<
8157 * raise ValueError( "incomplete line at %s" % result )
8159 __pyx_v_result = __pyx_v_b;
8162 * if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
8164 * free(b) # <<<<<<<<<<<<<<
8165 * raise ValueError( "incomplete line at %s" % result )
8173 * raise ValueError( "incomplete line at %s" % result ) # <<<<<<<<<<<<<<
8175 * # make sure that this goes fully through C
8177 __pyx_t_5 = PyBytes_FromString(__pyx_v_result); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8178 __Pyx_GOTREF(((PyObject *)__pyx_t_5));
8179 __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8180 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
8181 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
8182 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8183 __Pyx_GOTREF(__pyx_t_5);
8184 PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
8185 __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
8187 __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 = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8188 __Pyx_GOTREF(__pyx_t_6);
8189 __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
8190 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
8191 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8192 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8198 * # the wrong memory is freed
8199 * # -1 to remove the new-line character
8200 * return self.parser(b, nbytes) # <<<<<<<<<<<<<<
8204 __Pyx_XDECREF(__pyx_r);
8205 __pyx_t_6 = PyBytes_FromString(__pyx_v_b); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8206 __Pyx_GOTREF(((PyObject *)__pyx_t_6));
8207 __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8208 __Pyx_GOTREF(__pyx_t_5);
8209 __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8210 __Pyx_GOTREF(__pyx_t_7);
8211 PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6));
8212 __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
8213 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
8214 __Pyx_GIVEREF(__pyx_t_5);
8217 __pyx_t_5 = PyObject_Call(((PyObject *)__pyx_v_self->parser), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8218 __Pyx_GOTREF(__pyx_t_5);
8219 __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
8220 __pyx_r = __pyx_t_5;
8228 * return self.parser(b, nbytes)
8230 * free(b) # <<<<<<<<<<<<<<
8231 * raise StopIteration
8239 * raise StopIteration # <<<<<<<<<<<<<<
8241 * def __next__(self):
8243 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
8244 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8246 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8249 __Pyx_XDECREF(__pyx_t_5);
8250 __Pyx_XDECREF(__pyx_t_6);
8251 __Pyx_XDECREF(__pyx_t_7);
8252 __Pyx_AddTraceback("ctabix.tabix_copy_iterator.__cnext__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8255 __Pyx_XGIVEREF(__pyx_r);
8256 __Pyx_RefNannyFinishContext();
8260 /* Python wrapper */
8261 static PyObject *__pyx_pw_6ctabix_19tabix_copy_iterator_5__next__(PyObject *__pyx_v_self); /*proto*/
8262 static PyObject *__pyx_pw_6ctabix_19tabix_copy_iterator_5__next__(PyObject *__pyx_v_self) {
8263 PyObject *__pyx_r = 0;
8264 __Pyx_RefNannyDeclarations
8265 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
8266 __pyx_r = __pyx_pf_6ctabix_19tabix_copy_iterator_4__next__(((struct __pyx_obj_6ctabix_tabix_copy_iterator *)__pyx_v_self));
8267 __Pyx_RefNannyFinishContext();
8272 * raise StopIteration
8274 * def __next__(self): # <<<<<<<<<<<<<<
8275 * return self.__cnext__()
8279 static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_4__next__(struct __pyx_obj_6ctabix_tabix_copy_iterator *__pyx_v_self) {
8280 PyObject *__pyx_r = NULL;
8281 __Pyx_RefNannyDeclarations
8282 PyObject *__pyx_t_1 = NULL;
8283 int __pyx_lineno = 0;
8284 const char *__pyx_filename = NULL;
8285 int __pyx_clineno = 0;
8286 __Pyx_RefNannySetupContext("__next__", 0);
8290 * def __next__(self):
8291 * return self.__cnext__() # <<<<<<<<<<<<<<
8293 * class tabix_generic_iterator:
8295 __Pyx_XDECREF(__pyx_r);
8296 __pyx_t_1 = ((struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator *)__pyx_v_self->__pyx_vtab)->__pyx___cnext__(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8297 __Pyx_GOTREF(__pyx_t_1);
8298 __pyx_r = __pyx_t_1;
8302 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8305 __Pyx_XDECREF(__pyx_t_1);
8306 __Pyx_AddTraceback("ctabix.tabix_copy_iterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8309 __Pyx_XGIVEREF(__pyx_r);
8310 __Pyx_RefNannyFinishContext();
8314 /* Python wrapper */
8315 static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8316 static char __pyx_doc_6ctabix_22tabix_generic_iterator___init__[] = "tabix_generic_iterator.__init__(self, infile, parser)";
8317 static PyMethodDef __pyx_mdef_6ctabix_22tabix_generic_iterator_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_6ctabix_22tabix_generic_iterator_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_22tabix_generic_iterator___init__)};
8318 static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8319 PyObject *__pyx_v_self = 0;
8320 PyObject *__pyx_v_infile = 0;
8321 PyObject *__pyx_v_parser = 0;
8322 PyObject *__pyx_r = 0;
8323 __Pyx_RefNannyDeclarations
8324 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
8326 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__infile,&__pyx_n_s__parser,0};
8327 PyObject* values[3] = {0,0,0};
8328 if (unlikely(__pyx_kwds)) {
8330 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8332 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8333 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8334 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8336 default: goto __pyx_L5_argtuple_error;
8338 kw_args = PyDict_Size(__pyx_kwds);
8341 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
8342 else goto __pyx_L5_argtuple_error;
8344 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile)) != 0)) kw_args--;
8346 __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8349 if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser)) != 0)) kw_args--;
8351 __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8354 if (unlikely(kw_args > 0)) {
8355 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8357 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
8358 goto __pyx_L5_argtuple_error;
8360 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8361 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8362 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8364 __pyx_v_self = values[0];
8365 __pyx_v_infile = values[1];
8366 __pyx_v_parser = values[2];
8368 goto __pyx_L4_argument_unpacking_done;
8369 __pyx_L5_argtuple_error:;
8370 __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8372 __Pyx_AddTraceback("ctabix.tabix_generic_iterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8373 __Pyx_RefNannyFinishContext();
8375 __pyx_L4_argument_unpacking_done:;
8376 __pyx_r = __pyx_pf_6ctabix_22tabix_generic_iterator___init__(__pyx_self, __pyx_v_self, __pyx_v_infile, __pyx_v_parser);
8377 __Pyx_RefNannyFinishContext();
8382 * Permits the use of file-like objects for example from the gzip module.
8384 * def __init__(self, infile, parser ): # <<<<<<<<<<<<<<
8386 * self.infile = infile
8389 static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_infile, PyObject *__pyx_v_parser) {
8390 PyObject *__pyx_r = NULL;
8391 __Pyx_RefNannyDeclarations
8392 PyObject *__pyx_t_1 = NULL;
8393 PyObject *__pyx_t_2 = NULL;
8395 int __pyx_lineno = 0;
8396 const char *__pyx_filename = NULL;
8397 int __pyx_clineno = 0;
8398 __Pyx_RefNannySetupContext("__init__", 0);
8401 * def __init__(self, infile, parser ):
8403 * self.infile = infile # <<<<<<<<<<<<<<
8404 * if self.infile.closed: raise ValueError( "I/O operation on closed file." )
8405 * self.parser = parser
8407 if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__infile, __pyx_v_infile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8411 * self.infile = infile
8412 * if self.infile.closed: raise ValueError( "I/O operation on closed file." ) # <<<<<<<<<<<<<<
8413 * self.parser = parser
8416 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__infile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8417 __Pyx_GOTREF(__pyx_t_1);
8418 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__closed); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8419 __Pyx_GOTREF(__pyx_t_2);
8420 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8421 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8422 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8424 __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8425 __Pyx_GOTREF(__pyx_t_2);
8426 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
8427 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8428 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8434 * self.infile = infile
8435 * if self.infile.closed: raise ValueError( "I/O operation on closed file." )
8436 * self.parser = parser # <<<<<<<<<<<<<<
8438 * def __iter__(self):
8440 if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__parser, __pyx_v_parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8442 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8445 __Pyx_XDECREF(__pyx_t_1);
8446 __Pyx_XDECREF(__pyx_t_2);
8447 __Pyx_AddTraceback("ctabix.tabix_generic_iterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8450 __Pyx_XGIVEREF(__pyx_r);
8451 __Pyx_RefNannyFinishContext();
8455 /* Python wrapper */
8456 static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_3__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
8457 static char __pyx_doc_6ctabix_22tabix_generic_iterator_2__iter__[] = "tabix_generic_iterator.__iter__(self)";
8458 static PyMethodDef __pyx_mdef_6ctabix_22tabix_generic_iterator_3__iter__ = {__Pyx_NAMESTR("__iter__"), (PyCFunction)__pyx_pw_6ctabix_22tabix_generic_iterator_3__iter__, METH_O, __Pyx_DOCSTR(__pyx_doc_6ctabix_22tabix_generic_iterator_2__iter__)};
8459 static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_3__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
8460 PyObject *__pyx_r = 0;
8461 __Pyx_RefNannyDeclarations
8462 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
8463 __pyx_r = __pyx_pf_6ctabix_22tabix_generic_iterator_2__iter__(__pyx_self, ((PyObject *)__pyx_v_self));
8464 __Pyx_RefNannyFinishContext();
8469 * self.parser = parser
8471 * def __iter__(self): # <<<<<<<<<<<<<<
8476 static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_2__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
8477 PyObject *__pyx_r = NULL;
8478 __Pyx_RefNannyDeclarations
8479 __Pyx_RefNannySetupContext("__iter__", 0);
8483 * def __iter__(self):
8484 * return self # <<<<<<<<<<<<<<
8486 * # cython version - required for python 3
8488 __Pyx_XDECREF(__pyx_r);
8489 __Pyx_INCREF(__pyx_v_self);
8490 __pyx_r = __pyx_v_self;
8493 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8495 __Pyx_XGIVEREF(__pyx_r);
8496 __Pyx_RefNannyFinishContext();
8500 /* Python wrapper */
8501 static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_5__next__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
8502 static char __pyx_doc_6ctabix_22tabix_generic_iterator_4__next__[] = "tabix_generic_iterator.__next__(self)";
8503 static PyMethodDef __pyx_mdef_6ctabix_22tabix_generic_iterator_5__next__ = {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_6ctabix_22tabix_generic_iterator_5__next__, METH_O, __Pyx_DOCSTR(__pyx_doc_6ctabix_22tabix_generic_iterator_4__next__)};
8504 static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_5__next__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
8505 PyObject *__pyx_r = 0;
8506 __Pyx_RefNannyDeclarations
8507 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
8508 __pyx_r = __pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(__pyx_self, ((PyObject *)__pyx_v_self));
8509 __Pyx_RefNannyFinishContext();
8515 * # cython version - required for python 3
8516 * def __next__(self): # <<<<<<<<<<<<<<
8518 * cdef char * b, * cpy
8521 static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
8524 size_t __pyx_v_nbytes;
8525 PyObject *__pyx_v_line = NULL;
8526 PyObject *__pyx_v_s = NULL;
8527 PyObject *__pyx_r = NULL;
8528 __Pyx_RefNannyDeclarations
8529 PyObject *__pyx_t_1 = NULL;
8530 PyObject *__pyx_t_2 = NULL;
8534 Py_ssize_t __pyx_t_6;
8537 PyObject *__pyx_t_9 = NULL;
8538 PyObject *__pyx_t_10 = NULL;
8539 int __pyx_lineno = 0;
8540 const char *__pyx_filename = NULL;
8541 int __pyx_clineno = 0;
8542 __Pyx_RefNannySetupContext("__next__", 0);
8545 * cdef char * b, * cpy
8546 * cdef size_t nbytes
8547 * while 1: # <<<<<<<<<<<<<<
8549 * line = self.infile.readline()
8557 * line = self.infile.readline() # <<<<<<<<<<<<<<
8558 * if not line: break
8561 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__infile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8562 __Pyx_GOTREF(__pyx_t_1);
8563 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__readline); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8564 __Pyx_GOTREF(__pyx_t_2);
8565 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8566 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8567 __Pyx_GOTREF(__pyx_t_1);
8568 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8569 __Pyx_XDECREF(__pyx_v_line);
8570 __pyx_v_line = __pyx_t_1;
8575 * line = self.infile.readline()
8576 * if not line: break # <<<<<<<<<<<<<<
8578 * s = _force_bytes( line )
8580 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_line); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8581 __pyx_t_4 = (!__pyx_t_3);
8583 goto __pyx_L4_break;
8589 * if not line: break
8591 * s = _force_bytes( line ) # <<<<<<<<<<<<<<
8593 * nbytes = len( line )
8595 __pyx_t_1 = ((PyObject *)__pyx_f_6ctabix__force_bytes(__pyx_v_line)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8596 __Pyx_GOTREF(__pyx_t_1);
8597 __Pyx_XDECREF(((PyObject *)__pyx_v_s));
8598 __pyx_v_s = ((PyObject*)__pyx_t_1);
8603 * s = _force_bytes( line )
8604 * b = s # <<<<<<<<<<<<<<
8605 * nbytes = len( line )
8606 * assert b[nbytes] == '\0'
8608 __pyx_t_5 = PyBytes_AsString(((PyObject *)__pyx_v_s)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8609 __pyx_v_b = __pyx_t_5;
8612 * s = _force_bytes( line )
8614 * nbytes = len( line ) # <<<<<<<<<<<<<<
8615 * assert b[nbytes] == '\0'
8618 __pyx_t_6 = PyObject_Length(__pyx_v_line); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8619 __pyx_v_nbytes = __pyx_t_6;
8623 * nbytes = len( line )
8624 * assert b[nbytes] == '\0' # <<<<<<<<<<<<<<
8628 #ifndef CYTHON_WITHOUT_ASSERTIONS
8629 if (unlikely(!((__pyx_v_b[__pyx_v_nbytes]) == '\x00'))) {
8630 PyErr_SetNone(PyExc_AssertionError);
8631 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8638 * if (b[0] == '#'): continue # <<<<<<<<<<<<<<
8640 * # skip empty lines
8642 __pyx_t_4 = ((__pyx_v_b[0]) == '#');
8644 goto __pyx_L3_continue;
8651 * # skip empty lines
8652 * if b[0] == '\0' or b[0] == '\n' or b[0] == '\r': continue # <<<<<<<<<<<<<<
8654 * # make sure that entry is complete
8656 __pyx_t_4 = ((__pyx_v_b[0]) == '\x00');
8658 __pyx_t_3 = ((__pyx_v_b[0]) == '\n');
8660 __pyx_t_7 = ((__pyx_v_b[0]) == '\r');
8661 __pyx_t_8 = __pyx_t_7;
8663 __pyx_t_8 = __pyx_t_3;
8665 __pyx_t_3 = __pyx_t_8;
8667 __pyx_t_3 = __pyx_t_4;
8670 goto __pyx_L3_continue;
8677 * # make sure that entry is complete
8678 * if b[nbytes-1] != '\n' and b[nbytes-1] != '\r': # <<<<<<<<<<<<<<
8679 * raise ValueError( "incomplete line at %s" % line )
8682 __pyx_t_3 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\n');
8684 __pyx_t_4 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\r');
8685 __pyx_t_8 = __pyx_t_4;
8687 __pyx_t_8 = __pyx_t_3;
8692 * # make sure that entry is complete
8693 * if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
8694 * raise ValueError( "incomplete line at %s" % line ) # <<<<<<<<<<<<<<
8698 __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), __pyx_v_line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8699 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
8700 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8701 __Pyx_GOTREF(__pyx_t_2);
8702 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
8703 __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
8705 __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8706 __Pyx_GOTREF(__pyx_t_1);
8707 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
8708 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8709 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8710 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8718 * cpy = <char*>malloc(nbytes+1) # <<<<<<<<<<<<<<
8719 * if cpy == NULL: raise MemoryError()
8720 * memcpy( cpy, b, nbytes+1)
8722 __pyx_v_cpy = ((char *)malloc((__pyx_v_nbytes + 1)));
8726 * cpy = <char*>malloc(nbytes+1)
8727 * if cpy == NULL: raise MemoryError() # <<<<<<<<<<<<<<
8728 * memcpy( cpy, b, nbytes+1)
8731 __pyx_t_8 = (__pyx_v_cpy == NULL);
8733 PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8739 * cpy = <char*>malloc(nbytes+1)
8740 * if cpy == NULL: raise MemoryError()
8741 * memcpy( cpy, b, nbytes+1) # <<<<<<<<<<<<<<
8743 * return self.parser(cpy, nbytes)
8745 memcpy(__pyx_v_cpy, __pyx_v_b, (__pyx_v_nbytes + 1));
8748 * memcpy( cpy, b, nbytes+1)
8750 * return self.parser(cpy, nbytes) # <<<<<<<<<<<<<<
8752 * raise StopIteration
8754 __Pyx_XDECREF(__pyx_r);
8755 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parser); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8756 __Pyx_GOTREF(__pyx_t_1);
8757 __pyx_t_2 = PyBytes_FromString(__pyx_v_cpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8758 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
8759 __pyx_t_9 = __Pyx_PyInt_FromSize_t(__pyx_v_nbytes); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8760 __Pyx_GOTREF(__pyx_t_9);
8761 __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8762 __Pyx_GOTREF(__pyx_t_10);
8763 PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_2));
8764 __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
8765 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
8766 __Pyx_GIVEREF(__pyx_t_9);
8769 __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8770 __Pyx_GOTREF(__pyx_t_9);
8771 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8772 __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
8773 __pyx_r = __pyx_t_9;
8781 * return self.parser(cpy, nbytes)
8783 * raise StopIteration # <<<<<<<<<<<<<<
8785 * # python version - required for python 2.7
8787 __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
8788 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8790 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8793 __Pyx_XDECREF(__pyx_t_1);
8794 __Pyx_XDECREF(__pyx_t_2);
8795 __Pyx_XDECREF(__pyx_t_9);
8796 __Pyx_XDECREF(__pyx_t_10);
8797 __Pyx_AddTraceback("ctabix.tabix_generic_iterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8800 __Pyx_XDECREF(__pyx_v_line);
8801 __Pyx_XDECREF(__pyx_v_s);
8802 __Pyx_XGIVEREF(__pyx_r);
8803 __Pyx_RefNannyFinishContext();
8807 /* Python wrapper */
8808 static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_7next(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
8809 static char __pyx_doc_6ctabix_22tabix_generic_iterator_6next[] = "tabix_generic_iterator.next(self)";
8810 static PyMethodDef __pyx_mdef_6ctabix_22tabix_generic_iterator_7next = {__Pyx_NAMESTR("next"), (PyCFunction)__pyx_pw_6ctabix_22tabix_generic_iterator_7next, METH_O, __Pyx_DOCSTR(__pyx_doc_6ctabix_22tabix_generic_iterator_6next)};
8811 static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_7next(PyObject *__pyx_self, PyObject *__pyx_v_self) {
8812 PyObject *__pyx_r = 0;
8813 __Pyx_RefNannyDeclarations
8814 __Pyx_RefNannySetupContext("next (wrapper)", 0);
8815 __pyx_r = __pyx_pf_6ctabix_22tabix_generic_iterator_6next(__pyx_self, ((PyObject *)__pyx_v_self));
8816 __Pyx_RefNannyFinishContext();
8822 * # python version - required for python 2.7
8823 * def next(self): # <<<<<<<<<<<<<<
8824 * return self.__next__()
8828 static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_6next(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
8829 PyObject *__pyx_r = NULL;
8830 __Pyx_RefNannyDeclarations
8831 PyObject *__pyx_t_1 = NULL;
8832 PyObject *__pyx_t_2 = NULL;
8833 int __pyx_lineno = 0;
8834 const char *__pyx_filename = NULL;
8835 int __pyx_clineno = 0;
8836 __Pyx_RefNannySetupContext("next", 0);
8839 * # python version - required for python 2.7
8841 * return self.__next__() # <<<<<<<<<<<<<<
8843 * def tabix_iterator( infile, parser ):
8845 __Pyx_XDECREF(__pyx_r);
8846 __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____next__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8847 __Pyx_GOTREF(__pyx_t_1);
8848 __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 = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8849 __Pyx_GOTREF(__pyx_t_2);
8850 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8851 __pyx_r = __pyx_t_2;
8855 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8858 __Pyx_XDECREF(__pyx_t_1);
8859 __Pyx_XDECREF(__pyx_t_2);
8860 __Pyx_AddTraceback("ctabix.tabix_generic_iterator.next", __pyx_clineno, __pyx_lineno, __pyx_filename);
8863 __Pyx_XGIVEREF(__pyx_r);
8864 __Pyx_RefNannyFinishContext();
8868 /* Python wrapper */
8869 static PyObject *__pyx_pw_6ctabix_5tabix_iterator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8870 static char __pyx_doc_6ctabix_4tabix_iterator[] = "tabix_iterator(infile, parser)\nreturn an iterator over all entries in a file.";
8871 static PyMethodDef __pyx_mdef_6ctabix_5tabix_iterator = {__Pyx_NAMESTR("tabix_iterator"), (PyCFunction)__pyx_pw_6ctabix_5tabix_iterator, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_4tabix_iterator)};
8872 static PyObject *__pyx_pw_6ctabix_5tabix_iterator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8873 PyObject *__pyx_v_infile = 0;
8874 PyObject *__pyx_v_parser = 0;
8875 PyObject *__pyx_r = 0;
8876 __Pyx_RefNannyDeclarations
8877 __Pyx_RefNannySetupContext("tabix_iterator (wrapper)", 0);
8879 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__infile,&__pyx_n_s__parser,0};
8880 PyObject* values[2] = {0,0};
8881 if (unlikely(__pyx_kwds)) {
8883 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8885 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8886 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8888 default: goto __pyx_L5_argtuple_error;
8890 kw_args = PyDict_Size(__pyx_kwds);
8893 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile)) != 0)) kw_args--;
8894 else goto __pyx_L5_argtuple_error;
8896 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser)) != 0)) kw_args--;
8898 __Pyx_RaiseArgtupleInvalid("tabix_iterator", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8901 if (unlikely(kw_args > 0)) {
8902 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tabix_iterator") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8904 } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
8905 goto __pyx_L5_argtuple_error;
8907 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8908 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8910 __pyx_v_infile = values[0];
8911 __pyx_v_parser = values[1];
8913 goto __pyx_L4_argument_unpacking_done;
8914 __pyx_L5_argtuple_error:;
8915 __Pyx_RaiseArgtupleInvalid("tabix_iterator", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
8917 __Pyx_AddTraceback("ctabix.tabix_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
8918 __Pyx_RefNannyFinishContext();
8920 __pyx_L4_argument_unpacking_done:;
8921 __pyx_r = __pyx_pf_6ctabix_4tabix_iterator(__pyx_self, __pyx_v_infile, __pyx_v_parser);
8922 __Pyx_RefNannyFinishContext();
8927 * return self.__next__()
8929 * def tabix_iterator( infile, parser ): # <<<<<<<<<<<<<<
8930 * """return an iterator over all entries in a file."""
8931 * return tabix_generic_iterator( infile, parser )
8934 static PyObject *__pyx_pf_6ctabix_4tabix_iterator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_infile, PyObject *__pyx_v_parser) {
8935 PyObject *__pyx_r = NULL;
8936 __Pyx_RefNannyDeclarations
8937 PyObject *__pyx_t_1 = NULL;
8938 PyObject *__pyx_t_2 = NULL;
8939 PyObject *__pyx_t_3 = NULL;
8940 int __pyx_lineno = 0;
8941 const char *__pyx_filename = NULL;
8942 int __pyx_clineno = 0;
8943 __Pyx_RefNannySetupContext("tabix_iterator", 0);
8946 * def tabix_iterator( infile, parser ):
8947 * """return an iterator over all entries in a file."""
8948 * return tabix_generic_iterator( infile, parser ) # <<<<<<<<<<<<<<
8949 * # file objects can use C stdio
8950 * # used to be: isinstance( infile, file):
8952 __Pyx_XDECREF(__pyx_r);
8953 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_56); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8954 __Pyx_GOTREF(__pyx_t_1);
8955 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8956 __Pyx_GOTREF(__pyx_t_2);
8957 __Pyx_INCREF(__pyx_v_infile);
8958 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_infile);
8959 __Pyx_GIVEREF(__pyx_v_infile);
8960 __Pyx_INCREF(__pyx_v_parser);
8961 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_parser);
8962 __Pyx_GIVEREF(__pyx_v_parser);
8963 __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 = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8964 __Pyx_GOTREF(__pyx_t_3);
8965 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8966 __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
8967 __pyx_r = __pyx_t_3;
8971 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8974 __Pyx_XDECREF(__pyx_t_1);
8975 __Pyx_XDECREF(__pyx_t_2);
8976 __Pyx_XDECREF(__pyx_t_3);
8977 __Pyx_AddTraceback("ctabix.tabix_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
8980 __Pyx_XGIVEREF(__pyx_r);
8981 __Pyx_RefNannyFinishContext();
8985 static PyObject *__pyx_tp_new_6ctabix_Tabixfile(PyTypeObject *t, PyObject *a, PyObject *k) {
8986 PyObject *o = (*t->tp_alloc)(t, 0);
8988 if (__pyx_pw_6ctabix_9Tabixfile_1__cinit__(o, a, k) < 0) {
8989 Py_DECREF(o); o = 0;
8994 static void __pyx_tp_dealloc_6ctabix_Tabixfile(PyObject *o) {
8996 PyObject *etype, *eval, *etb;
8997 PyErr_Fetch(&etype, &eval, &etb);
8999 __pyx_pw_6ctabix_9Tabixfile_13__dealloc__(o);
9000 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
9002 PyErr_Restore(etype, eval, etb);
9004 (*Py_TYPE(o)->tp_free)(o);
9007 static PyObject *__pyx_getprop_6ctabix_9Tabixfile_filename(PyObject *o, CYTHON_UNUSED void *x) {
9008 return __pyx_pw_6ctabix_9Tabixfile_8filename_1__get__(o);
9011 static PyObject *__pyx_getprop_6ctabix_9Tabixfile_header(PyObject *o, CYTHON_UNUSED void *x) {
9012 return __pyx_pw_6ctabix_9Tabixfile_6header_1__get__(o);
9015 static PyObject *__pyx_getprop_6ctabix_9Tabixfile_contigs(PyObject *o, CYTHON_UNUSED void *x) {
9016 return __pyx_pw_6ctabix_9Tabixfile_7contigs_1__get__(o);
9019 static PyMethodDef __pyx_methods_6ctabix_Tabixfile[] = {
9020 {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pw_6ctabix_9Tabixfile_3_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_2_isOpen)},
9021 {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pw_6ctabix_9Tabixfile_5_open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_4_open)},
9022 {__Pyx_NAMESTR("_parseRegion"), (PyCFunction)__pyx_pw_6ctabix_9Tabixfile_7_parseRegion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_6_parseRegion)},
9023 {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pw_6ctabix_9Tabixfile_9fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_8fetch)},
9024 {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_6ctabix_9Tabixfile_11close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_10close)},
9028 static struct PyGetSetDef __pyx_getsets_6ctabix_Tabixfile[] = {
9029 {(char *)"filename", __pyx_getprop_6ctabix_9Tabixfile_filename, 0, __Pyx_DOCSTR(__pyx_k_57), 0},
9030 {(char *)"header", __pyx_getprop_6ctabix_9Tabixfile_header, 0, __Pyx_DOCSTR(__pyx_k_58), 0},
9031 {(char *)"contigs", __pyx_getprop_6ctabix_9Tabixfile_contigs, 0, __Pyx_DOCSTR(__pyx_k_59), 0},
9035 static PyNumberMethods __pyx_tp_as_number_Tabixfile = {
9039 #if PY_MAJOR_VERSION < 3
9055 #if PY_MAJOR_VERSION < 3
9059 #if PY_MAJOR_VERSION < 3
9065 #if PY_MAJOR_VERSION < 3
9068 #if PY_MAJOR_VERSION < 3
9071 0, /*nb_inplace_add*/
9072 0, /*nb_inplace_subtract*/
9073 0, /*nb_inplace_multiply*/
9074 #if PY_MAJOR_VERSION < 3
9075 0, /*nb_inplace_divide*/
9077 0, /*nb_inplace_remainder*/
9078 0, /*nb_inplace_power*/
9079 0, /*nb_inplace_lshift*/
9080 0, /*nb_inplace_rshift*/
9081 0, /*nb_inplace_and*/
9082 0, /*nb_inplace_xor*/
9083 0, /*nb_inplace_or*/
9084 0, /*nb_floor_divide*/
9085 0, /*nb_true_divide*/
9086 0, /*nb_inplace_floor_divide*/
9087 0, /*nb_inplace_true_divide*/
9088 #if PY_VERSION_HEX >= 0x02050000
9093 static PySequenceMethods __pyx_tp_as_sequence_Tabixfile = {
9102 0, /*sq_inplace_concat*/
9103 0, /*sq_inplace_repeat*/
9106 static PyMappingMethods __pyx_tp_as_mapping_Tabixfile = {
9109 0, /*mp_ass_subscript*/
9112 static PyBufferProcs __pyx_tp_as_buffer_Tabixfile = {
9113 #if PY_MAJOR_VERSION < 3
9114 0, /*bf_getreadbuffer*/
9116 #if PY_MAJOR_VERSION < 3
9117 0, /*bf_getwritebuffer*/
9119 #if PY_MAJOR_VERSION < 3
9120 0, /*bf_getsegcount*/
9122 #if PY_MAJOR_VERSION < 3
9123 0, /*bf_getcharbuffer*/
9125 #if PY_VERSION_HEX >= 0x02060000
9128 #if PY_VERSION_HEX >= 0x02060000
9129 0, /*bf_releasebuffer*/
9133 static PyTypeObject __pyx_type_6ctabix_Tabixfile = {
9134 PyVarObject_HEAD_INIT(0, 0)
9135 __Pyx_NAMESTR("ctabix.Tabixfile"), /*tp_name*/
9136 sizeof(struct __pyx_obj_6ctabix_Tabixfile), /*tp_basicsize*/
9138 __pyx_tp_dealloc_6ctabix_Tabixfile, /*tp_dealloc*/
9142 #if PY_MAJOR_VERSION < 3
9148 &__pyx_tp_as_number_Tabixfile, /*tp_as_number*/
9149 &__pyx_tp_as_sequence_Tabixfile, /*tp_as_sequence*/
9150 &__pyx_tp_as_mapping_Tabixfile, /*tp_as_mapping*/
9156 &__pyx_tp_as_buffer_Tabixfile, /*tp_as_buffer*/
9157 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
9158 __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*/
9161 0, /*tp_richcompare*/
9162 0, /*tp_weaklistoffset*/
9165 __pyx_methods_6ctabix_Tabixfile, /*tp_methods*/
9167 __pyx_getsets_6ctabix_Tabixfile, /*tp_getset*/
9172 0, /*tp_dictoffset*/
9175 __pyx_tp_new_6ctabix_Tabixfile, /*tp_new*/
9181 0, /*tp_subclasses*/
9184 #if PY_VERSION_HEX >= 0x02060000
9185 0, /*tp_version_tag*/
9189 static PyObject *__pyx_tp_new_6ctabix_TabixIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
9190 PyObject *o = (*t->tp_alloc)(t, 0);
9192 if (__pyx_pw_6ctabix_13TabixIterator_1__cinit__(o, a, k) < 0) {
9193 Py_DECREF(o); o = 0;
9198 static void __pyx_tp_dealloc_6ctabix_TabixIterator(PyObject *o) {
9200 PyObject *etype, *eval, *etb;
9201 PyErr_Fetch(&etype, &eval, &etb);
9203 __pyx_pw_6ctabix_13TabixIterator_7__dealloc__(o);
9204 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
9206 PyErr_Restore(etype, eval, etb);
9208 (*Py_TYPE(o)->tp_free)(o);
9211 static PyMethodDef __pyx_methods_6ctabix_TabixIterator[] = {
9212 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_6ctabix_13TabixIterator_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_13TabixIterator_4__next__)},
9216 static PyNumberMethods __pyx_tp_as_number_TabixIterator = {
9220 #if PY_MAJOR_VERSION < 3
9236 #if PY_MAJOR_VERSION < 3
9240 #if PY_MAJOR_VERSION < 3
9246 #if PY_MAJOR_VERSION < 3
9249 #if PY_MAJOR_VERSION < 3
9252 0, /*nb_inplace_add*/
9253 0, /*nb_inplace_subtract*/
9254 0, /*nb_inplace_multiply*/
9255 #if PY_MAJOR_VERSION < 3
9256 0, /*nb_inplace_divide*/
9258 0, /*nb_inplace_remainder*/
9259 0, /*nb_inplace_power*/
9260 0, /*nb_inplace_lshift*/
9261 0, /*nb_inplace_rshift*/
9262 0, /*nb_inplace_and*/
9263 0, /*nb_inplace_xor*/
9264 0, /*nb_inplace_or*/
9265 0, /*nb_floor_divide*/
9266 0, /*nb_true_divide*/
9267 0, /*nb_inplace_floor_divide*/
9268 0, /*nb_inplace_true_divide*/
9269 #if PY_VERSION_HEX >= 0x02050000
9274 static PySequenceMethods __pyx_tp_as_sequence_TabixIterator = {
9283 0, /*sq_inplace_concat*/
9284 0, /*sq_inplace_repeat*/
9287 static PyMappingMethods __pyx_tp_as_mapping_TabixIterator = {
9290 0, /*mp_ass_subscript*/
9293 static PyBufferProcs __pyx_tp_as_buffer_TabixIterator = {
9294 #if PY_MAJOR_VERSION < 3
9295 0, /*bf_getreadbuffer*/
9297 #if PY_MAJOR_VERSION < 3
9298 0, /*bf_getwritebuffer*/
9300 #if PY_MAJOR_VERSION < 3
9301 0, /*bf_getsegcount*/
9303 #if PY_MAJOR_VERSION < 3
9304 0, /*bf_getcharbuffer*/
9306 #if PY_VERSION_HEX >= 0x02060000
9309 #if PY_VERSION_HEX >= 0x02060000
9310 0, /*bf_releasebuffer*/
9314 static PyTypeObject __pyx_type_6ctabix_TabixIterator = {
9315 PyVarObject_HEAD_INIT(0, 0)
9316 __Pyx_NAMESTR("ctabix.TabixIterator"), /*tp_name*/
9317 sizeof(struct __pyx_obj_6ctabix_TabixIterator), /*tp_basicsize*/
9319 __pyx_tp_dealloc_6ctabix_TabixIterator, /*tp_dealloc*/
9323 #if PY_MAJOR_VERSION < 3
9329 &__pyx_tp_as_number_TabixIterator, /*tp_as_number*/
9330 &__pyx_tp_as_sequence_TabixIterator, /*tp_as_sequence*/
9331 &__pyx_tp_as_mapping_TabixIterator, /*tp_as_mapping*/
9337 &__pyx_tp_as_buffer_TabixIterator, /*tp_as_buffer*/
9338 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
9339 __Pyx_DOCSTR("iterates over rows in *tabixfile* in region\n given by *tid*, *start* and *end*.\n "), /*tp_doc*/
9342 0, /*tp_richcompare*/
9343 0, /*tp_weaklistoffset*/
9344 __pyx_pw_6ctabix_13TabixIterator_3__iter__, /*tp_iter*/
9345 __pyx_pw_6ctabix_13TabixIterator_5__next__, /*tp_iternext*/
9346 __pyx_methods_6ctabix_TabixIterator, /*tp_methods*/
9353 0, /*tp_dictoffset*/
9356 __pyx_tp_new_6ctabix_TabixIterator, /*tp_new*/
9362 0, /*tp_subclasses*/
9365 #if PY_VERSION_HEX >= 0x02060000
9366 0, /*tp_version_tag*/
9370 static PyObject *__pyx_tp_new_6ctabix_TabixHeaderIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
9371 PyObject *o = (*t->tp_alloc)(t, 0);
9373 if (__pyx_pw_6ctabix_19TabixHeaderIterator_1__cinit__(o, a, k) < 0) {
9374 Py_DECREF(o); o = 0;
9379 static void __pyx_tp_dealloc_6ctabix_TabixHeaderIterator(PyObject *o) {
9381 PyObject *etype, *eval, *etb;
9382 PyErr_Fetch(&etype, &eval, &etb);
9384 __pyx_pw_6ctabix_19TabixHeaderIterator_7__dealloc__(o);
9385 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
9387 PyErr_Restore(etype, eval, etb);
9389 (*Py_TYPE(o)->tp_free)(o);
9392 static PyMethodDef __pyx_methods_6ctabix_TabixHeaderIterator[] = {
9393 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_6ctabix_19TabixHeaderIterator_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_19TabixHeaderIterator_4__next__)},
9397 static PyNumberMethods __pyx_tp_as_number_TabixHeaderIterator = {
9401 #if PY_MAJOR_VERSION < 3
9417 #if PY_MAJOR_VERSION < 3
9421 #if PY_MAJOR_VERSION < 3
9427 #if PY_MAJOR_VERSION < 3
9430 #if PY_MAJOR_VERSION < 3
9433 0, /*nb_inplace_add*/
9434 0, /*nb_inplace_subtract*/
9435 0, /*nb_inplace_multiply*/
9436 #if PY_MAJOR_VERSION < 3
9437 0, /*nb_inplace_divide*/
9439 0, /*nb_inplace_remainder*/
9440 0, /*nb_inplace_power*/
9441 0, /*nb_inplace_lshift*/
9442 0, /*nb_inplace_rshift*/
9443 0, /*nb_inplace_and*/
9444 0, /*nb_inplace_xor*/
9445 0, /*nb_inplace_or*/
9446 0, /*nb_floor_divide*/
9447 0, /*nb_true_divide*/
9448 0, /*nb_inplace_floor_divide*/
9449 0, /*nb_inplace_true_divide*/
9450 #if PY_VERSION_HEX >= 0x02050000
9455 static PySequenceMethods __pyx_tp_as_sequence_TabixHeaderIterator = {
9464 0, /*sq_inplace_concat*/
9465 0, /*sq_inplace_repeat*/
9468 static PyMappingMethods __pyx_tp_as_mapping_TabixHeaderIterator = {
9471 0, /*mp_ass_subscript*/
9474 static PyBufferProcs __pyx_tp_as_buffer_TabixHeaderIterator = {
9475 #if PY_MAJOR_VERSION < 3
9476 0, /*bf_getreadbuffer*/
9478 #if PY_MAJOR_VERSION < 3
9479 0, /*bf_getwritebuffer*/
9481 #if PY_MAJOR_VERSION < 3
9482 0, /*bf_getsegcount*/
9484 #if PY_MAJOR_VERSION < 3
9485 0, /*bf_getcharbuffer*/
9487 #if PY_VERSION_HEX >= 0x02060000
9490 #if PY_VERSION_HEX >= 0x02060000
9491 0, /*bf_releasebuffer*/
9495 static PyTypeObject __pyx_type_6ctabix_TabixHeaderIterator = {
9496 PyVarObject_HEAD_INIT(0, 0)
9497 __Pyx_NAMESTR("ctabix.TabixHeaderIterator"), /*tp_name*/
9498 sizeof(struct __pyx_obj_6ctabix_TabixHeaderIterator), /*tp_basicsize*/
9500 __pyx_tp_dealloc_6ctabix_TabixHeaderIterator, /*tp_dealloc*/
9504 #if PY_MAJOR_VERSION < 3
9510 &__pyx_tp_as_number_TabixHeaderIterator, /*tp_as_number*/
9511 &__pyx_tp_as_sequence_TabixHeaderIterator, /*tp_as_sequence*/
9512 &__pyx_tp_as_mapping_TabixHeaderIterator, /*tp_as_mapping*/
9518 &__pyx_tp_as_buffer_TabixHeaderIterator, /*tp_as_buffer*/
9519 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
9520 __Pyx_DOCSTR("return header lines.\n "), /*tp_doc*/
9523 0, /*tp_richcompare*/
9524 0, /*tp_weaklistoffset*/
9525 __pyx_pw_6ctabix_19TabixHeaderIterator_3__iter__, /*tp_iter*/
9526 __pyx_pw_6ctabix_19TabixHeaderIterator_5__next__, /*tp_iternext*/
9527 __pyx_methods_6ctabix_TabixHeaderIterator, /*tp_methods*/
9534 0, /*tp_dictoffset*/
9537 __pyx_tp_new_6ctabix_TabixHeaderIterator, /*tp_new*/
9543 0, /*tp_subclasses*/
9546 #if PY_VERSION_HEX >= 0x02060000
9547 0, /*tp_version_tag*/
9551 static PyObject *__pyx_tp_new_6ctabix_Parser(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
9552 PyObject *o = (*t->tp_alloc)(t, 0);
9557 static void __pyx_tp_dealloc_6ctabix_Parser(PyObject *o) {
9558 (*Py_TYPE(o)->tp_free)(o);
9561 static PyMethodDef __pyx_methods_6ctabix_Parser[] = {
9565 static PyNumberMethods __pyx_tp_as_number_Parser = {
9569 #if PY_MAJOR_VERSION < 3
9585 #if PY_MAJOR_VERSION < 3
9589 #if PY_MAJOR_VERSION < 3
9595 #if PY_MAJOR_VERSION < 3
9598 #if PY_MAJOR_VERSION < 3
9601 0, /*nb_inplace_add*/
9602 0, /*nb_inplace_subtract*/
9603 0, /*nb_inplace_multiply*/
9604 #if PY_MAJOR_VERSION < 3
9605 0, /*nb_inplace_divide*/
9607 0, /*nb_inplace_remainder*/
9608 0, /*nb_inplace_power*/
9609 0, /*nb_inplace_lshift*/
9610 0, /*nb_inplace_rshift*/
9611 0, /*nb_inplace_and*/
9612 0, /*nb_inplace_xor*/
9613 0, /*nb_inplace_or*/
9614 0, /*nb_floor_divide*/
9615 0, /*nb_true_divide*/
9616 0, /*nb_inplace_floor_divide*/
9617 0, /*nb_inplace_true_divide*/
9618 #if PY_VERSION_HEX >= 0x02050000
9623 static PySequenceMethods __pyx_tp_as_sequence_Parser = {
9632 0, /*sq_inplace_concat*/
9633 0, /*sq_inplace_repeat*/
9636 static PyMappingMethods __pyx_tp_as_mapping_Parser = {
9639 0, /*mp_ass_subscript*/
9642 static PyBufferProcs __pyx_tp_as_buffer_Parser = {
9643 #if PY_MAJOR_VERSION < 3
9644 0, /*bf_getreadbuffer*/
9646 #if PY_MAJOR_VERSION < 3
9647 0, /*bf_getwritebuffer*/
9649 #if PY_MAJOR_VERSION < 3
9650 0, /*bf_getsegcount*/
9652 #if PY_MAJOR_VERSION < 3
9653 0, /*bf_getcharbuffer*/
9655 #if PY_VERSION_HEX >= 0x02060000
9658 #if PY_VERSION_HEX >= 0x02060000
9659 0, /*bf_releasebuffer*/
9663 static PyTypeObject __pyx_type_6ctabix_Parser = {
9664 PyVarObject_HEAD_INIT(0, 0)
9665 __Pyx_NAMESTR("ctabix.Parser"), /*tp_name*/
9666 sizeof(struct __pyx_obj_6ctabix_Parser), /*tp_basicsize*/
9668 __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/
9672 #if PY_MAJOR_VERSION < 3
9678 &__pyx_tp_as_number_Parser, /*tp_as_number*/
9679 &__pyx_tp_as_sequence_Parser, /*tp_as_sequence*/
9680 &__pyx_tp_as_mapping_Parser, /*tp_as_mapping*/
9686 &__pyx_tp_as_buffer_Parser, /*tp_as_buffer*/
9687 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
9691 0, /*tp_richcompare*/
9692 0, /*tp_weaklistoffset*/
9695 __pyx_methods_6ctabix_Parser, /*tp_methods*/
9702 0, /*tp_dictoffset*/
9705 __pyx_tp_new_6ctabix_Parser, /*tp_new*/
9711 0, /*tp_subclasses*/
9714 #if PY_VERSION_HEX >= 0x02060000
9715 0, /*tp_version_tag*/
9719 static PyObject *__pyx_tp_new_6ctabix_asTuple(PyTypeObject *t, PyObject *a, PyObject *k) {
9720 PyObject *o = __pyx_tp_new_6ctabix_Parser(t, a, k);
9725 static PyMethodDef __pyx_methods_6ctabix_asTuple[] = {
9729 static PyNumberMethods __pyx_tp_as_number_asTuple = {
9733 #if PY_MAJOR_VERSION < 3
9749 #if PY_MAJOR_VERSION < 3
9753 #if PY_MAJOR_VERSION < 3
9759 #if PY_MAJOR_VERSION < 3
9762 #if PY_MAJOR_VERSION < 3
9765 0, /*nb_inplace_add*/
9766 0, /*nb_inplace_subtract*/
9767 0, /*nb_inplace_multiply*/
9768 #if PY_MAJOR_VERSION < 3
9769 0, /*nb_inplace_divide*/
9771 0, /*nb_inplace_remainder*/
9772 0, /*nb_inplace_power*/
9773 0, /*nb_inplace_lshift*/
9774 0, /*nb_inplace_rshift*/
9775 0, /*nb_inplace_and*/
9776 0, /*nb_inplace_xor*/
9777 0, /*nb_inplace_or*/
9778 0, /*nb_floor_divide*/
9779 0, /*nb_true_divide*/
9780 0, /*nb_inplace_floor_divide*/
9781 0, /*nb_inplace_true_divide*/
9782 #if PY_VERSION_HEX >= 0x02050000
9787 static PySequenceMethods __pyx_tp_as_sequence_asTuple = {
9796 0, /*sq_inplace_concat*/
9797 0, /*sq_inplace_repeat*/
9800 static PyMappingMethods __pyx_tp_as_mapping_asTuple = {
9803 0, /*mp_ass_subscript*/
9806 static PyBufferProcs __pyx_tp_as_buffer_asTuple = {
9807 #if PY_MAJOR_VERSION < 3
9808 0, /*bf_getreadbuffer*/
9810 #if PY_MAJOR_VERSION < 3
9811 0, /*bf_getwritebuffer*/
9813 #if PY_MAJOR_VERSION < 3
9814 0, /*bf_getsegcount*/
9816 #if PY_MAJOR_VERSION < 3
9817 0, /*bf_getcharbuffer*/
9819 #if PY_VERSION_HEX >= 0x02060000
9822 #if PY_VERSION_HEX >= 0x02060000
9823 0, /*bf_releasebuffer*/
9827 static PyTypeObject __pyx_type_6ctabix_asTuple = {
9828 PyVarObject_HEAD_INIT(0, 0)
9829 __Pyx_NAMESTR("ctabix.asTuple"), /*tp_name*/
9830 sizeof(struct __pyx_obj_6ctabix_asTuple), /*tp_basicsize*/
9832 __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/
9836 #if PY_MAJOR_VERSION < 3
9842 &__pyx_tp_as_number_asTuple, /*tp_as_number*/
9843 &__pyx_tp_as_sequence_asTuple, /*tp_as_sequence*/
9844 &__pyx_tp_as_mapping_asTuple, /*tp_as_mapping*/
9846 __pyx_pw_6ctabix_7asTuple_1__call__, /*tp_call*/
9850 &__pyx_tp_as_buffer_asTuple, /*tp_as_buffer*/
9851 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
9852 __Pyx_DOCSTR("converts a :term:`tabix row` into a python tuple.\n\n Access is by numeric index.\n "), /*tp_doc*/
9855 0, /*tp_richcompare*/
9856 0, /*tp_weaklistoffset*/
9859 __pyx_methods_6ctabix_asTuple, /*tp_methods*/
9866 0, /*tp_dictoffset*/
9869 __pyx_tp_new_6ctabix_asTuple, /*tp_new*/
9875 0, /*tp_subclasses*/
9878 #if PY_VERSION_HEX >= 0x02060000
9879 0, /*tp_version_tag*/
9883 static PyObject *__pyx_tp_new_6ctabix_asGTF(PyTypeObject *t, PyObject *a, PyObject *k) {
9884 PyObject *o = __pyx_tp_new_6ctabix_Parser(t, a, k);
9889 static PyMethodDef __pyx_methods_6ctabix_asGTF[] = {
9893 static PyNumberMethods __pyx_tp_as_number_asGTF = {
9897 #if PY_MAJOR_VERSION < 3
9913 #if PY_MAJOR_VERSION < 3
9917 #if PY_MAJOR_VERSION < 3
9923 #if PY_MAJOR_VERSION < 3
9926 #if PY_MAJOR_VERSION < 3
9929 0, /*nb_inplace_add*/
9930 0, /*nb_inplace_subtract*/
9931 0, /*nb_inplace_multiply*/
9932 #if PY_MAJOR_VERSION < 3
9933 0, /*nb_inplace_divide*/
9935 0, /*nb_inplace_remainder*/
9936 0, /*nb_inplace_power*/
9937 0, /*nb_inplace_lshift*/
9938 0, /*nb_inplace_rshift*/
9939 0, /*nb_inplace_and*/
9940 0, /*nb_inplace_xor*/
9941 0, /*nb_inplace_or*/
9942 0, /*nb_floor_divide*/
9943 0, /*nb_true_divide*/
9944 0, /*nb_inplace_floor_divide*/
9945 0, /*nb_inplace_true_divide*/
9946 #if PY_VERSION_HEX >= 0x02050000
9951 static PySequenceMethods __pyx_tp_as_sequence_asGTF = {
9960 0, /*sq_inplace_concat*/
9961 0, /*sq_inplace_repeat*/
9964 static PyMappingMethods __pyx_tp_as_mapping_asGTF = {
9967 0, /*mp_ass_subscript*/
9970 static PyBufferProcs __pyx_tp_as_buffer_asGTF = {
9971 #if PY_MAJOR_VERSION < 3
9972 0, /*bf_getreadbuffer*/
9974 #if PY_MAJOR_VERSION < 3
9975 0, /*bf_getwritebuffer*/
9977 #if PY_MAJOR_VERSION < 3
9978 0, /*bf_getsegcount*/
9980 #if PY_MAJOR_VERSION < 3
9981 0, /*bf_getcharbuffer*/
9983 #if PY_VERSION_HEX >= 0x02060000
9986 #if PY_VERSION_HEX >= 0x02060000
9987 0, /*bf_releasebuffer*/
9991 static PyTypeObject __pyx_type_6ctabix_asGTF = {
9992 PyVarObject_HEAD_INIT(0, 0)
9993 __Pyx_NAMESTR("ctabix.asGTF"), /*tp_name*/
9994 sizeof(struct __pyx_obj_6ctabix_asGTF), /*tp_basicsize*/
9996 __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/
10000 #if PY_MAJOR_VERSION < 3
10006 &__pyx_tp_as_number_asGTF, /*tp_as_number*/
10007 &__pyx_tp_as_sequence_asGTF, /*tp_as_sequence*/
10008 &__pyx_tp_as_mapping_asGTF, /*tp_as_mapping*/
10010 __pyx_pw_6ctabix_5asGTF_1__call__, /*tp_call*/
10014 &__pyx_tp_as_buffer_asGTF, /*tp_as_buffer*/
10015 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
10016 __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*/
10019 0, /*tp_richcompare*/
10020 0, /*tp_weaklistoffset*/
10023 __pyx_methods_6ctabix_asGTF, /*tp_methods*/
10028 0, /*tp_descr_get*/
10029 0, /*tp_descr_set*/
10030 0, /*tp_dictoffset*/
10033 __pyx_tp_new_6ctabix_asGTF, /*tp_new*/
10039 0, /*tp_subclasses*/
10042 #if PY_VERSION_HEX >= 0x02060000
10043 0, /*tp_version_tag*/
10047 static PyObject *__pyx_tp_new_6ctabix_asBed(PyTypeObject *t, PyObject *a, PyObject *k) {
10048 PyObject *o = __pyx_tp_new_6ctabix_Parser(t, a, k);
10053 static PyMethodDef __pyx_methods_6ctabix_asBed[] = {
10057 static PyNumberMethods __pyx_tp_as_number_asBed = {
10061 #if PY_MAJOR_VERSION < 3
10064 0, /*nb_remainder*/
10077 #if PY_MAJOR_VERSION < 3
10081 #if PY_MAJOR_VERSION < 3
10087 #if PY_MAJOR_VERSION < 3
10090 #if PY_MAJOR_VERSION < 3
10093 0, /*nb_inplace_add*/
10094 0, /*nb_inplace_subtract*/
10095 0, /*nb_inplace_multiply*/
10096 #if PY_MAJOR_VERSION < 3
10097 0, /*nb_inplace_divide*/
10099 0, /*nb_inplace_remainder*/
10100 0, /*nb_inplace_power*/
10101 0, /*nb_inplace_lshift*/
10102 0, /*nb_inplace_rshift*/
10103 0, /*nb_inplace_and*/
10104 0, /*nb_inplace_xor*/
10105 0, /*nb_inplace_or*/
10106 0, /*nb_floor_divide*/
10107 0, /*nb_true_divide*/
10108 0, /*nb_inplace_floor_divide*/
10109 0, /*nb_inplace_true_divide*/
10110 #if PY_VERSION_HEX >= 0x02050000
10115 static PySequenceMethods __pyx_tp_as_sequence_asBed = {
10122 0, /*sq_ass_slice*/
10124 0, /*sq_inplace_concat*/
10125 0, /*sq_inplace_repeat*/
10128 static PyMappingMethods __pyx_tp_as_mapping_asBed = {
10130 0, /*mp_subscript*/
10131 0, /*mp_ass_subscript*/
10134 static PyBufferProcs __pyx_tp_as_buffer_asBed = {
10135 #if PY_MAJOR_VERSION < 3
10136 0, /*bf_getreadbuffer*/
10138 #if PY_MAJOR_VERSION < 3
10139 0, /*bf_getwritebuffer*/
10141 #if PY_MAJOR_VERSION < 3
10142 0, /*bf_getsegcount*/
10144 #if PY_MAJOR_VERSION < 3
10145 0, /*bf_getcharbuffer*/
10147 #if PY_VERSION_HEX >= 0x02060000
10148 0, /*bf_getbuffer*/
10150 #if PY_VERSION_HEX >= 0x02060000
10151 0, /*bf_releasebuffer*/
10155 static PyTypeObject __pyx_type_6ctabix_asBed = {
10156 PyVarObject_HEAD_INIT(0, 0)
10157 __Pyx_NAMESTR("ctabix.asBed"), /*tp_name*/
10158 sizeof(struct __pyx_obj_6ctabix_asBed), /*tp_basicsize*/
10160 __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/
10164 #if PY_MAJOR_VERSION < 3
10170 &__pyx_tp_as_number_asBed, /*tp_as_number*/
10171 &__pyx_tp_as_sequence_asBed, /*tp_as_sequence*/
10172 &__pyx_tp_as_mapping_asBed, /*tp_as_mapping*/
10174 __pyx_pw_6ctabix_5asBed_1__call__, /*tp_call*/
10178 &__pyx_tp_as_buffer_asBed, /*tp_as_buffer*/
10179 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
10180 __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*/
10183 0, /*tp_richcompare*/
10184 0, /*tp_weaklistoffset*/
10187 __pyx_methods_6ctabix_asBed, /*tp_methods*/
10192 0, /*tp_descr_get*/
10193 0, /*tp_descr_set*/
10194 0, /*tp_dictoffset*/
10197 __pyx_tp_new_6ctabix_asBed, /*tp_new*/
10203 0, /*tp_subclasses*/
10206 #if PY_VERSION_HEX >= 0x02060000
10207 0, /*tp_version_tag*/
10211 static PyObject *__pyx_tp_new_6ctabix_asVCF(PyTypeObject *t, PyObject *a, PyObject *k) {
10212 PyObject *o = __pyx_tp_new_6ctabix_Parser(t, a, k);
10217 static PyMethodDef __pyx_methods_6ctabix_asVCF[] = {
10221 static PyNumberMethods __pyx_tp_as_number_asVCF = {
10225 #if PY_MAJOR_VERSION < 3
10228 0, /*nb_remainder*/
10241 #if PY_MAJOR_VERSION < 3
10245 #if PY_MAJOR_VERSION < 3
10251 #if PY_MAJOR_VERSION < 3
10254 #if PY_MAJOR_VERSION < 3
10257 0, /*nb_inplace_add*/
10258 0, /*nb_inplace_subtract*/
10259 0, /*nb_inplace_multiply*/
10260 #if PY_MAJOR_VERSION < 3
10261 0, /*nb_inplace_divide*/
10263 0, /*nb_inplace_remainder*/
10264 0, /*nb_inplace_power*/
10265 0, /*nb_inplace_lshift*/
10266 0, /*nb_inplace_rshift*/
10267 0, /*nb_inplace_and*/
10268 0, /*nb_inplace_xor*/
10269 0, /*nb_inplace_or*/
10270 0, /*nb_floor_divide*/
10271 0, /*nb_true_divide*/
10272 0, /*nb_inplace_floor_divide*/
10273 0, /*nb_inplace_true_divide*/
10274 #if PY_VERSION_HEX >= 0x02050000
10279 static PySequenceMethods __pyx_tp_as_sequence_asVCF = {
10286 0, /*sq_ass_slice*/
10288 0, /*sq_inplace_concat*/
10289 0, /*sq_inplace_repeat*/
10292 static PyMappingMethods __pyx_tp_as_mapping_asVCF = {
10294 0, /*mp_subscript*/
10295 0, /*mp_ass_subscript*/
10298 static PyBufferProcs __pyx_tp_as_buffer_asVCF = {
10299 #if PY_MAJOR_VERSION < 3
10300 0, /*bf_getreadbuffer*/
10302 #if PY_MAJOR_VERSION < 3
10303 0, /*bf_getwritebuffer*/
10305 #if PY_MAJOR_VERSION < 3
10306 0, /*bf_getsegcount*/
10308 #if PY_MAJOR_VERSION < 3
10309 0, /*bf_getcharbuffer*/
10311 #if PY_VERSION_HEX >= 0x02060000
10312 0, /*bf_getbuffer*/
10314 #if PY_VERSION_HEX >= 0x02060000
10315 0, /*bf_releasebuffer*/
10319 static PyTypeObject __pyx_type_6ctabix_asVCF = {
10320 PyVarObject_HEAD_INIT(0, 0)
10321 __Pyx_NAMESTR("ctabix.asVCF"), /*tp_name*/
10322 sizeof(struct __pyx_obj_6ctabix_asVCF), /*tp_basicsize*/
10324 __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/
10328 #if PY_MAJOR_VERSION < 3
10334 &__pyx_tp_as_number_asVCF, /*tp_as_number*/
10335 &__pyx_tp_as_sequence_asVCF, /*tp_as_sequence*/
10336 &__pyx_tp_as_mapping_asVCF, /*tp_as_mapping*/
10338 __pyx_pw_6ctabix_5asVCF_1__call__, /*tp_call*/
10342 &__pyx_tp_as_buffer_asVCF, /*tp_as_buffer*/
10343 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
10344 __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*/
10347 0, /*tp_richcompare*/
10348 0, /*tp_weaklistoffset*/
10351 __pyx_methods_6ctabix_asVCF, /*tp_methods*/
10356 0, /*tp_descr_get*/
10357 0, /*tp_descr_set*/
10358 0, /*tp_dictoffset*/
10361 __pyx_tp_new_6ctabix_asVCF, /*tp_new*/
10367 0, /*tp_subclasses*/
10370 #if PY_VERSION_HEX >= 0x02060000
10371 0, /*tp_version_tag*/
10375 static PyObject *__pyx_tp_new_6ctabix_TabixIteratorParsed(PyTypeObject *t, PyObject *a, PyObject *k) {
10376 struct __pyx_obj_6ctabix_TabixIteratorParsed *p;
10377 PyObject *o = (*t->tp_alloc)(t, 0);
10379 p = ((struct __pyx_obj_6ctabix_TabixIteratorParsed *)o);
10380 p->parser = ((struct __pyx_obj_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
10381 if (__pyx_pw_6ctabix_19TabixIteratorParsed_1__cinit__(o, a, k) < 0) {
10382 Py_DECREF(o); o = 0;
10387 static void __pyx_tp_dealloc_6ctabix_TabixIteratorParsed(PyObject *o) {
10388 struct __pyx_obj_6ctabix_TabixIteratorParsed *p = (struct __pyx_obj_6ctabix_TabixIteratorParsed *)o;
10390 PyObject *etype, *eval, *etb;
10391 PyErr_Fetch(&etype, &eval, &etb);
10393 __pyx_pw_6ctabix_19TabixIteratorParsed_7__dealloc__(o);
10394 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
10396 PyErr_Restore(etype, eval, etb);
10398 Py_CLEAR(p->parser);
10399 (*Py_TYPE(o)->tp_free)(o);
10402 static int __pyx_tp_traverse_6ctabix_TabixIteratorParsed(PyObject *o, visitproc v, void *a) {
10404 struct __pyx_obj_6ctabix_TabixIteratorParsed *p = (struct __pyx_obj_6ctabix_TabixIteratorParsed *)o;
10406 e = (*v)(((PyObject*)p->parser), a); if (e) return e;
10411 static int __pyx_tp_clear_6ctabix_TabixIteratorParsed(PyObject *o) {
10412 struct __pyx_obj_6ctabix_TabixIteratorParsed *p = (struct __pyx_obj_6ctabix_TabixIteratorParsed *)o;
10414 tmp = ((PyObject*)p->parser);
10415 p->parser = ((struct __pyx_obj_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
10420 static PyMethodDef __pyx_methods_6ctabix_TabixIteratorParsed[] = {
10421 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_6ctabix_19TabixIteratorParsed_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_19TabixIteratorParsed_4__next__)},
10425 static PyNumberMethods __pyx_tp_as_number_TabixIteratorParsed = {
10429 #if PY_MAJOR_VERSION < 3
10432 0, /*nb_remainder*/
10445 #if PY_MAJOR_VERSION < 3
10449 #if PY_MAJOR_VERSION < 3
10455 #if PY_MAJOR_VERSION < 3
10458 #if PY_MAJOR_VERSION < 3
10461 0, /*nb_inplace_add*/
10462 0, /*nb_inplace_subtract*/
10463 0, /*nb_inplace_multiply*/
10464 #if PY_MAJOR_VERSION < 3
10465 0, /*nb_inplace_divide*/
10467 0, /*nb_inplace_remainder*/
10468 0, /*nb_inplace_power*/
10469 0, /*nb_inplace_lshift*/
10470 0, /*nb_inplace_rshift*/
10471 0, /*nb_inplace_and*/
10472 0, /*nb_inplace_xor*/
10473 0, /*nb_inplace_or*/
10474 0, /*nb_floor_divide*/
10475 0, /*nb_true_divide*/
10476 0, /*nb_inplace_floor_divide*/
10477 0, /*nb_inplace_true_divide*/
10478 #if PY_VERSION_HEX >= 0x02050000
10483 static PySequenceMethods __pyx_tp_as_sequence_TabixIteratorParsed = {
10490 0, /*sq_ass_slice*/
10492 0, /*sq_inplace_concat*/
10493 0, /*sq_inplace_repeat*/
10496 static PyMappingMethods __pyx_tp_as_mapping_TabixIteratorParsed = {
10498 0, /*mp_subscript*/
10499 0, /*mp_ass_subscript*/
10502 static PyBufferProcs __pyx_tp_as_buffer_TabixIteratorParsed = {
10503 #if PY_MAJOR_VERSION < 3
10504 0, /*bf_getreadbuffer*/
10506 #if PY_MAJOR_VERSION < 3
10507 0, /*bf_getwritebuffer*/
10509 #if PY_MAJOR_VERSION < 3
10510 0, /*bf_getsegcount*/
10512 #if PY_MAJOR_VERSION < 3
10513 0, /*bf_getcharbuffer*/
10515 #if PY_VERSION_HEX >= 0x02060000
10516 0, /*bf_getbuffer*/
10518 #if PY_VERSION_HEX >= 0x02060000
10519 0, /*bf_releasebuffer*/
10523 static PyTypeObject __pyx_type_6ctabix_TabixIteratorParsed = {
10524 PyVarObject_HEAD_INIT(0, 0)
10525 __Pyx_NAMESTR("ctabix.TabixIteratorParsed"), /*tp_name*/
10526 sizeof(struct __pyx_obj_6ctabix_TabixIteratorParsed), /*tp_basicsize*/
10528 __pyx_tp_dealloc_6ctabix_TabixIteratorParsed, /*tp_dealloc*/
10532 #if PY_MAJOR_VERSION < 3
10538 &__pyx_tp_as_number_TabixIteratorParsed, /*tp_as_number*/
10539 &__pyx_tp_as_sequence_TabixIteratorParsed, /*tp_as_sequence*/
10540 &__pyx_tp_as_mapping_TabixIteratorParsed, /*tp_as_mapping*/
10546 &__pyx_tp_as_buffer_TabixIteratorParsed, /*tp_as_buffer*/
10547 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
10548 __Pyx_DOCSTR("iterates over mapped reads in a region.\n\n Returns parsed data.\n "), /*tp_doc*/
10549 __pyx_tp_traverse_6ctabix_TabixIteratorParsed, /*tp_traverse*/
10550 __pyx_tp_clear_6ctabix_TabixIteratorParsed, /*tp_clear*/
10551 0, /*tp_richcompare*/
10552 0, /*tp_weaklistoffset*/
10553 __pyx_pw_6ctabix_19TabixIteratorParsed_3__iter__, /*tp_iter*/
10554 __pyx_pw_6ctabix_19TabixIteratorParsed_5__next__, /*tp_iternext*/
10555 __pyx_methods_6ctabix_TabixIteratorParsed, /*tp_methods*/
10560 0, /*tp_descr_get*/
10561 0, /*tp_descr_set*/
10562 0, /*tp_dictoffset*/
10565 __pyx_tp_new_6ctabix_TabixIteratorParsed, /*tp_new*/
10571 0, /*tp_subclasses*/
10574 #if PY_VERSION_HEX >= 0x02060000
10575 0, /*tp_version_tag*/
10578 static struct __pyx_vtabstruct_6ctabix_tabix_inplace_iterator __pyx_vtable_6ctabix_tabix_inplace_iterator;
10580 static PyObject *__pyx_tp_new_6ctabix_tabix_inplace_iterator(PyTypeObject *t, PyObject *a, PyObject *k) {
10581 struct __pyx_obj_6ctabix_tabix_inplace_iterator *p;
10582 PyObject *o = (*t->tp_alloc)(t, 0);
10584 p = ((struct __pyx_obj_6ctabix_tabix_inplace_iterator *)o);
10585 p->__pyx_vtab = __pyx_vtabptr_6ctabix_tabix_inplace_iterator;
10586 p->parser = ((struct __pyx_obj_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
10587 if (__pyx_pw_6ctabix_22tabix_inplace_iterator_1__cinit__(o, a, k) < 0) {
10588 Py_DECREF(o); o = 0;
10593 static void __pyx_tp_dealloc_6ctabix_tabix_inplace_iterator(PyObject *o) {
10594 struct __pyx_obj_6ctabix_tabix_inplace_iterator *p = (struct __pyx_obj_6ctabix_tabix_inplace_iterator *)o;
10596 PyObject *etype, *eval, *etb;
10597 PyErr_Fetch(&etype, &eval, &etb);
10599 __pyx_pw_6ctabix_22tabix_inplace_iterator_5__dealloc__(o);
10600 if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
10602 PyErr_Restore(etype, eval, etb);
10604 Py_CLEAR(p->parser);
10605 (*Py_TYPE(o)->tp_free)(o);
10608 static int __pyx_tp_traverse_6ctabix_tabix_inplace_iterator(PyObject *o, visitproc v, void *a) {
10610 struct __pyx_obj_6ctabix_tabix_inplace_iterator *p = (struct __pyx_obj_6ctabix_tabix_inplace_iterator *)o;
10612 e = (*v)(((PyObject*)p->parser), a); if (e) return e;
10617 static int __pyx_tp_clear_6ctabix_tabix_inplace_iterator(PyObject *o) {
10618 struct __pyx_obj_6ctabix_tabix_inplace_iterator *p = (struct __pyx_obj_6ctabix_tabix_inplace_iterator *)o;
10620 tmp = ((PyObject*)p->parser);
10621 p->parser = ((struct __pyx_obj_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
10626 static PyMethodDef __pyx_methods_6ctabix_tabix_inplace_iterator[] = {
10627 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_6ctabix_22tabix_inplace_iterator_7__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
10631 static PyNumberMethods __pyx_tp_as_number_tabix_inplace_iterator = {
10635 #if PY_MAJOR_VERSION < 3
10638 0, /*nb_remainder*/
10651 #if PY_MAJOR_VERSION < 3
10655 #if PY_MAJOR_VERSION < 3
10661 #if PY_MAJOR_VERSION < 3
10664 #if PY_MAJOR_VERSION < 3
10667 0, /*nb_inplace_add*/
10668 0, /*nb_inplace_subtract*/
10669 0, /*nb_inplace_multiply*/
10670 #if PY_MAJOR_VERSION < 3
10671 0, /*nb_inplace_divide*/
10673 0, /*nb_inplace_remainder*/
10674 0, /*nb_inplace_power*/
10675 0, /*nb_inplace_lshift*/
10676 0, /*nb_inplace_rshift*/
10677 0, /*nb_inplace_and*/
10678 0, /*nb_inplace_xor*/
10679 0, /*nb_inplace_or*/
10680 0, /*nb_floor_divide*/
10681 0, /*nb_true_divide*/
10682 0, /*nb_inplace_floor_divide*/
10683 0, /*nb_inplace_true_divide*/
10684 #if PY_VERSION_HEX >= 0x02050000
10689 static PySequenceMethods __pyx_tp_as_sequence_tabix_inplace_iterator = {
10696 0, /*sq_ass_slice*/
10698 0, /*sq_inplace_concat*/
10699 0, /*sq_inplace_repeat*/
10702 static PyMappingMethods __pyx_tp_as_mapping_tabix_inplace_iterator = {
10704 0, /*mp_subscript*/
10705 0, /*mp_ass_subscript*/
10708 static PyBufferProcs __pyx_tp_as_buffer_tabix_inplace_iterator = {
10709 #if PY_MAJOR_VERSION < 3
10710 0, /*bf_getreadbuffer*/
10712 #if PY_MAJOR_VERSION < 3
10713 0, /*bf_getwritebuffer*/
10715 #if PY_MAJOR_VERSION < 3
10716 0, /*bf_getsegcount*/
10718 #if PY_MAJOR_VERSION < 3
10719 0, /*bf_getcharbuffer*/
10721 #if PY_VERSION_HEX >= 0x02060000
10722 0, /*bf_getbuffer*/
10724 #if PY_VERSION_HEX >= 0x02060000
10725 0, /*bf_releasebuffer*/
10729 static PyTypeObject __pyx_type_6ctabix_tabix_inplace_iterator = {
10730 PyVarObject_HEAD_INIT(0, 0)
10731 __Pyx_NAMESTR("ctabix.tabix_inplace_iterator"), /*tp_name*/
10732 sizeof(struct __pyx_obj_6ctabix_tabix_inplace_iterator), /*tp_basicsize*/
10734 __pyx_tp_dealloc_6ctabix_tabix_inplace_iterator, /*tp_dealloc*/
10738 #if PY_MAJOR_VERSION < 3
10744 &__pyx_tp_as_number_tabix_inplace_iterator, /*tp_as_number*/
10745 &__pyx_tp_as_sequence_tabix_inplace_iterator, /*tp_as_sequence*/
10746 &__pyx_tp_as_mapping_tabix_inplace_iterator, /*tp_as_mapping*/
10752 &__pyx_tp_as_buffer_tabix_inplace_iterator, /*tp_as_buffer*/
10753 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
10754 __Pyx_DOCSTR("iterate over ``infile``.\n\n This iterator is not safe. If the :meth:`__next__()` method is called \n after ``infile`` is closed, the result is undefined (see ``fclose()``).\n\n The iterator might either raise a StopIteration or segfault.\n "), /*tp_doc*/
10755 __pyx_tp_traverse_6ctabix_tabix_inplace_iterator, /*tp_traverse*/
10756 __pyx_tp_clear_6ctabix_tabix_inplace_iterator, /*tp_clear*/
10757 0, /*tp_richcompare*/
10758 0, /*tp_weaklistoffset*/
10759 __pyx_pw_6ctabix_22tabix_inplace_iterator_3__iter__, /*tp_iter*/
10760 __pyx_pw_6ctabix_22tabix_inplace_iterator_7__next__, /*tp_iternext*/
10761 __pyx_methods_6ctabix_tabix_inplace_iterator, /*tp_methods*/
10766 0, /*tp_descr_get*/
10767 0, /*tp_descr_set*/
10768 0, /*tp_dictoffset*/
10771 __pyx_tp_new_6ctabix_tabix_inplace_iterator, /*tp_new*/
10777 0, /*tp_subclasses*/
10780 #if PY_VERSION_HEX >= 0x02060000
10781 0, /*tp_version_tag*/
10784 static struct __pyx_vtabstruct_6ctabix_tabix_copy_iterator __pyx_vtable_6ctabix_tabix_copy_iterator;
10786 static PyObject *__pyx_tp_new_6ctabix_tabix_copy_iterator(PyTypeObject *t, PyObject *a, PyObject *k) {
10787 struct __pyx_obj_6ctabix_tabix_copy_iterator *p;
10788 PyObject *o = (*t->tp_alloc)(t, 0);
10790 p = ((struct __pyx_obj_6ctabix_tabix_copy_iterator *)o);
10791 p->__pyx_vtab = __pyx_vtabptr_6ctabix_tabix_copy_iterator;
10792 p->parser = ((struct __pyx_obj_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
10793 if (__pyx_pw_6ctabix_19tabix_copy_iterator_1__cinit__(o, a, k) < 0) {
10794 Py_DECREF(o); o = 0;
10799 static void __pyx_tp_dealloc_6ctabix_tabix_copy_iterator(PyObject *o) {
10800 struct __pyx_obj_6ctabix_tabix_copy_iterator *p = (struct __pyx_obj_6ctabix_tabix_copy_iterator *)o;
10801 Py_CLEAR(p->parser);
10802 (*Py_TYPE(o)->tp_free)(o);
10805 static int __pyx_tp_traverse_6ctabix_tabix_copy_iterator(PyObject *o, visitproc v, void *a) {
10807 struct __pyx_obj_6ctabix_tabix_copy_iterator *p = (struct __pyx_obj_6ctabix_tabix_copy_iterator *)o;
10809 e = (*v)(((PyObject*)p->parser), a); if (e) return e;
10814 static int __pyx_tp_clear_6ctabix_tabix_copy_iterator(PyObject *o) {
10815 struct __pyx_obj_6ctabix_tabix_copy_iterator *p = (struct __pyx_obj_6ctabix_tabix_copy_iterator *)o;
10817 tmp = ((PyObject*)p->parser);
10818 p->parser = ((struct __pyx_obj_6ctabix_Parser *)Py_None); Py_INCREF(Py_None);
10823 static PyMethodDef __pyx_methods_6ctabix_tabix_copy_iterator[] = {
10824 {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_6ctabix_19tabix_copy_iterator_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
10828 static PyNumberMethods __pyx_tp_as_number_tabix_copy_iterator = {
10832 #if PY_MAJOR_VERSION < 3
10835 0, /*nb_remainder*/
10848 #if PY_MAJOR_VERSION < 3
10852 #if PY_MAJOR_VERSION < 3
10858 #if PY_MAJOR_VERSION < 3
10861 #if PY_MAJOR_VERSION < 3
10864 0, /*nb_inplace_add*/
10865 0, /*nb_inplace_subtract*/
10866 0, /*nb_inplace_multiply*/
10867 #if PY_MAJOR_VERSION < 3
10868 0, /*nb_inplace_divide*/
10870 0, /*nb_inplace_remainder*/
10871 0, /*nb_inplace_power*/
10872 0, /*nb_inplace_lshift*/
10873 0, /*nb_inplace_rshift*/
10874 0, /*nb_inplace_and*/
10875 0, /*nb_inplace_xor*/
10876 0, /*nb_inplace_or*/
10877 0, /*nb_floor_divide*/
10878 0, /*nb_true_divide*/
10879 0, /*nb_inplace_floor_divide*/
10880 0, /*nb_inplace_true_divide*/
10881 #if PY_VERSION_HEX >= 0x02050000
10886 static PySequenceMethods __pyx_tp_as_sequence_tabix_copy_iterator = {
10893 0, /*sq_ass_slice*/
10895 0, /*sq_inplace_concat*/
10896 0, /*sq_inplace_repeat*/
10899 static PyMappingMethods __pyx_tp_as_mapping_tabix_copy_iterator = {
10901 0, /*mp_subscript*/
10902 0, /*mp_ass_subscript*/
10905 static PyBufferProcs __pyx_tp_as_buffer_tabix_copy_iterator = {
10906 #if PY_MAJOR_VERSION < 3
10907 0, /*bf_getreadbuffer*/
10909 #if PY_MAJOR_VERSION < 3
10910 0, /*bf_getwritebuffer*/
10912 #if PY_MAJOR_VERSION < 3
10913 0, /*bf_getsegcount*/
10915 #if PY_MAJOR_VERSION < 3
10916 0, /*bf_getcharbuffer*/
10918 #if PY_VERSION_HEX >= 0x02060000
10919 0, /*bf_getbuffer*/
10921 #if PY_VERSION_HEX >= 0x02060000
10922 0, /*bf_releasebuffer*/
10926 static PyTypeObject __pyx_type_6ctabix_tabix_copy_iterator = {
10927 PyVarObject_HEAD_INIT(0, 0)
10928 __Pyx_NAMESTR("ctabix.tabix_copy_iterator"), /*tp_name*/
10929 sizeof(struct __pyx_obj_6ctabix_tabix_copy_iterator), /*tp_basicsize*/
10931 __pyx_tp_dealloc_6ctabix_tabix_copy_iterator, /*tp_dealloc*/
10935 #if PY_MAJOR_VERSION < 3
10941 &__pyx_tp_as_number_tabix_copy_iterator, /*tp_as_number*/
10942 &__pyx_tp_as_sequence_tabix_copy_iterator, /*tp_as_sequence*/
10943 &__pyx_tp_as_mapping_tabix_copy_iterator, /*tp_as_mapping*/
10949 &__pyx_tp_as_buffer_tabix_copy_iterator, /*tp_as_buffer*/
10950 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
10951 __Pyx_DOCSTR("iterate over ``infile``.\n\n This iterator is not save. If the :meth:`__next__()` method is called \n after ``infile`` is closed, the result is undefined (see ``fclose()``).\n\n The iterator might either raise a StopIteration or segfault.\n "), /*tp_doc*/
10952 __pyx_tp_traverse_6ctabix_tabix_copy_iterator, /*tp_traverse*/
10953 __pyx_tp_clear_6ctabix_tabix_copy_iterator, /*tp_clear*/
10954 0, /*tp_richcompare*/
10955 0, /*tp_weaklistoffset*/
10956 __pyx_pw_6ctabix_19tabix_copy_iterator_3__iter__, /*tp_iter*/
10957 __pyx_pw_6ctabix_19tabix_copy_iterator_5__next__, /*tp_iternext*/
10958 __pyx_methods_6ctabix_tabix_copy_iterator, /*tp_methods*/
10963 0, /*tp_descr_get*/
10964 0, /*tp_descr_set*/
10965 0, /*tp_dictoffset*/
10968 __pyx_tp_new_6ctabix_tabix_copy_iterator, /*tp_new*/
10974 0, /*tp_subclasses*/
10977 #if PY_VERSION_HEX >= 0x02060000
10978 0, /*tp_version_tag*/
10982 static PyMethodDef __pyx_methods[] = {
10986 #if PY_MAJOR_VERSION >= 3
10987 static struct PyModuleDef __pyx_moduledef = {
10988 PyModuleDef_HEAD_INIT,
10989 __Pyx_NAMESTR("ctabix"),
10992 __pyx_methods /* m_methods */,
10993 NULL, /* m_reload */
10994 NULL, /* m_traverse */
10995 NULL, /* m_clear */
11000 static __Pyx_StringTabEntry __pyx_string_tab[] = {
11001 {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0},
11002 {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
11003 {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
11004 {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
11005 {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
11006 {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
11007 {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
11008 {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
11009 {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
11010 {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
11011 {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
11012 {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
11013 {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0},
11014 {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0},
11015 {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
11016 {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
11017 {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
11018 {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0},
11019 {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
11020 {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
11021 {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0},
11022 {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0},
11023 {&__pyx_kp_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 0},
11024 {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0},
11025 {&__pyx_kp_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 0},
11026 {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
11027 {&__pyx_kp_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0},
11028 {&__pyx_n_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 1},
11029 {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
11030 {&__pyx_n_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 1},
11031 {&__pyx_kp_s_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 0, 1, 0},
11032 {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
11033 {&__pyx_kp_s_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 0, 1, 0},
11034 {&__pyx_n_s_77, __pyx_k_77, sizeof(__pyx_k_77), 0, 0, 1, 1},
11035 {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
11036 {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1},
11037 {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1},
11038 {&__pyx_n_s__MemoryError, __pyx_k__MemoryError, sizeof(__pyx_k__MemoryError), 0, 0, 1, 1},
11039 {&__pyx_n_s__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1},
11040 {&__pyx_n_s__OSError, __pyx_k__OSError, sizeof(__pyx_k__OSError), 0, 0, 1, 1},
11041 {&__pyx_n_s__O_RDONLY, __pyx_k__O_RDONLY, sizeof(__pyx_k__O_RDONLY), 0, 0, 1, 1},
11042 {&__pyx_n_s__PYTHON3, __pyx_k__PYTHON3, sizeof(__pyx_k__PYTHON3), 0, 0, 1, 1},
11043 {&__pyx_n_s__Parser, __pyx_k__Parser, sizeof(__pyx_k__Parser), 0, 0, 1, 1},
11044 {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1},
11045 {&__pyx_n_s__Tabixfile, __pyx_k__Tabixfile, sizeof(__pyx_k__Tabixfile), 0, 0, 1, 1},
11046 {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
11047 {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
11048 {&__pyx_n_s__WINDOW_SIZE, __pyx_k__WINDOW_SIZE, sizeof(__pyx_k__WINDOW_SIZE), 0, 0, 1, 1},
11049 {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1},
11050 {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
11051 {&__pyx_n_s____iter__, __pyx_k____iter__, sizeof(__pyx_k____iter__), 0, 0, 1, 1},
11052 {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
11053 {&__pyx_n_s____next__, __pyx_k____next__, sizeof(__pyx_k____next__), 0, 0, 1, 1},
11054 {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
11055 {&__pyx_n_s___isOpen, __pyx_k___isOpen, sizeof(__pyx_k___isOpen), 0, 0, 1, 1},
11056 {&__pyx_n_s___open, __pyx_k___open, sizeof(__pyx_k___open), 0, 0, 1, 1},
11057 {&__pyx_n_s___parseRegion, __pyx_k___parseRegion, sizeof(__pyx_k___parseRegion), 0, 0, 1, 1},
11058 {&__pyx_n_s__asBed, __pyx_k__asBed, sizeof(__pyx_k__asBed), 0, 0, 1, 1},
11059 {&__pyx_n_s__asGTF, __pyx_k__asGTF, sizeof(__pyx_k__asGTF), 0, 0, 1, 1},
11060 {&__pyx_n_s__asTuple, __pyx_k__asTuple, sizeof(__pyx_k__asTuple), 0, 0, 1, 1},
11061 {&__pyx_n_s__asVCF, __pyx_k__asVCF, sizeof(__pyx_k__asVCF), 0, 0, 1, 1},
11062 {&__pyx_n_s__ascii, __pyx_k__ascii, sizeof(__pyx_k__ascii), 0, 0, 1, 1},
11063 {&__pyx_n_s__b, __pyx_k__b, sizeof(__pyx_k__b), 0, 0, 1, 1},
11064 {&__pyx_n_s__bed, __pyx_k__bed, sizeof(__pyx_k__bed), 0, 0, 1, 1},
11065 {&__pyx_n_s__buffer, __pyx_k__buffer, sizeof(__pyx_k__buffer), 0, 0, 1, 1},
11066 {&__pyx_n_s__buffer_size, __pyx_k__buffer_size, sizeof(__pyx_k__buffer_size), 0, 0, 1, 1},
11067 {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1},
11068 {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1},
11069 {&__pyx_n_s__closed, __pyx_k__closed, sizeof(__pyx_k__closed), 0, 0, 1, 1},
11070 {&__pyx_n_s__conf, __pyx_k__conf, sizeof(__pyx_k__conf), 0, 0, 1, 1},
11071 {&__pyx_n_s__conf_data, __pyx_k__conf_data, sizeof(__pyx_k__conf_data), 0, 0, 1, 1},
11072 {&__pyx_n_s__cpy, __pyx_k__cpy, sizeof(__pyx_k__cpy), 0, 0, 1, 1},
11073 {&__pyx_n_s__ctabix, __pyx_k__ctabix, sizeof(__pyx_k__ctabix), 0, 0, 1, 1},
11074 {&__pyx_n_s__ctypes, __pyx_k__ctypes, sizeof(__pyx_k__ctypes), 0, 0, 1, 1},
11075 {&__pyx_n_s__decode, __pyx_k__decode, sizeof(__pyx_k__decode), 0, 0, 1, 1},
11076 {&__pyx_n_s__encode, __pyx_k__encode, sizeof(__pyx_k__encode), 0, 0, 1, 1},
11077 {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1},
11078 {&__pyx_n_s__end_col, __pyx_k__end_col, sizeof(__pyx_k__end_col), 0, 0, 1, 1},
11079 {&__pyx_n_s__endswith, __pyx_k__endswith, sizeof(__pyx_k__endswith), 0, 0, 1, 1},
11080 {&__pyx_n_s__exists, __pyx_k__exists, sizeof(__pyx_k__exists), 0, 0, 1, 1},
11081 {&__pyx_n_s__fd_src, __pyx_k__fd_src, sizeof(__pyx_k__fd_src), 0, 0, 1, 1},
11082 {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1},
11083 {&__pyx_n_s__filename_in, __pyx_k__filename_in, sizeof(__pyx_k__filename_in), 0, 0, 1, 1},
11084 {&__pyx_n_s__filename_out, __pyx_k__filename_out, sizeof(__pyx_k__filename_out), 0, 0, 1, 1},
11085 {&__pyx_n_s__fn, __pyx_k__fn, sizeof(__pyx_k__fn), 0, 0, 1, 1},
11086 {&__pyx_n_s__force, __pyx_k__force, sizeof(__pyx_k__force), 0, 0, 1, 1},
11087 {&__pyx_n_s__fp, __pyx_k__fp, sizeof(__pyx_k__fp), 0, 0, 1, 1},
11088 {&__pyx_n_s__getdefaultencoding, __pyx_k__getdefaultencoding, sizeof(__pyx_k__getdefaultencoding), 0, 0, 1, 1},
11089 {&__pyx_n_s__gff, __pyx_k__gff, sizeof(__pyx_k__gff), 0, 0, 1, 1},
11090 {&__pyx_n_s__gzip, __pyx_k__gzip, sizeof(__pyx_k__gzip), 0, 0, 1, 1},
11091 {&__pyx_n_s__infile, __pyx_k__infile, sizeof(__pyx_k__infile), 0, 0, 1, 1},
11092 {&__pyx_n_s__io, __pyx_k__io, sizeof(__pyx_k__io), 0, 0, 1, 1},
11093 {&__pyx_n_s__itertools, __pyx_k__itertools, sizeof(__pyx_k__itertools), 0, 0, 1, 1},
11094 {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1},
11095 {&__pyx_n_s__len, __pyx_k__len, sizeof(__pyx_k__len), 0, 0, 1, 1},
11096 {&__pyx_n_s__line, __pyx_k__line, sizeof(__pyx_k__line), 0, 0, 1, 1},
11097 {&__pyx_n_s__meta_char, __pyx_k__meta_char, sizeof(__pyx_k__meta_char), 0, 0, 1, 1},
11098 {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1},
11099 {&__pyx_n_s__nbytes, __pyx_k__nbytes, sizeof(__pyx_k__nbytes), 0, 0, 1, 1},
11100 {&__pyx_n_s__next, __pyx_k__next, sizeof(__pyx_k__next), 0, 0, 1, 1},
11101 {&__pyx_n_s__ord, __pyx_k__ord, sizeof(__pyx_k__ord), 0, 0, 1, 1},
11102 {&__pyx_n_s__os, __pyx_k__os, sizeof(__pyx_k__os), 0, 0, 1, 1},
11103 {&__pyx_n_s__parser, __pyx_k__parser, sizeof(__pyx_k__parser), 0, 0, 1, 1},
11104 {&__pyx_n_s__path, __pyx_k__path, sizeof(__pyx_k__path), 0, 0, 1, 1},
11105 {&__pyx_n_s__pileup, __pyx_k__pileup, sizeof(__pyx_k__pileup), 0, 0, 1, 1},
11106 {&__pyx_n_s__present, __pyx_k__present, sizeof(__pyx_k__present), 0, 0, 1, 1},
11107 {&__pyx_n_s__preset, __pyx_k__preset, sizeof(__pyx_k__preset), 0, 0, 1, 1},
11108 {&__pyx_n_s__preset2conf, __pyx_k__preset2conf, sizeof(__pyx_k__preset2conf), 0, 0, 1, 1},
11109 {&__pyx_n_s__psltbl, __pyx_k__psltbl, sizeof(__pyx_k__psltbl), 0, 0, 1, 1},
11110 {&__pyx_n_s__r, __pyx_k__r, sizeof(__pyx_k__r), 0, 0, 1, 1},
11111 {&__pyx_n_s__readline, __pyx_k__readline, sizeof(__pyx_k__readline), 0, 0, 1, 1},
11112 {&__pyx_n_s__reference, __pyx_k__reference, sizeof(__pyx_k__reference), 0, 0, 1, 1},
11113 {&__pyx_n_s__region, __pyx_k__region, sizeof(__pyx_k__region), 0, 0, 1, 1},
11114 {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1},
11115 {&__pyx_n_s__sam, __pyx_k__sam, sizeof(__pyx_k__sam), 0, 0, 1, 1},
11116 {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
11117 {&__pyx_n_s__seq_col, __pyx_k__seq_col, sizeof(__pyx_k__seq_col), 0, 0, 1, 1},
11118 {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1},
11119 {&__pyx_n_s__start_col, __pyx_k__start_col, sizeof(__pyx_k__start_col), 0, 0, 1, 1},
11120 {&__pyx_n_s__startswith, __pyx_k__startswith, sizeof(__pyx_k__startswith), 0, 0, 1, 1},
11121 {&__pyx_n_s__struct, __pyx_k__struct, sizeof(__pyx_k__struct), 0, 0, 1, 1},
11122 {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1},
11123 {&__pyx_n_s__tabix_compress, __pyx_k__tabix_compress, sizeof(__pyx_k__tabix_compress), 0, 0, 1, 1},
11124 {&__pyx_n_s__tabix_index, __pyx_k__tabix_index, sizeof(__pyx_k__tabix_index), 0, 0, 1, 1},
11125 {&__pyx_n_s__tabix_iterator, __pyx_k__tabix_iterator, sizeof(__pyx_k__tabix_iterator), 0, 0, 1, 1},
11126 {&__pyx_n_s__tabixfile, __pyx_k__tabixfile, sizeof(__pyx_k__tabixfile), 0, 0, 1, 1},
11127 {&__pyx_n_s__tempfile, __pyx_k__tempfile, sizeof(__pyx_k__tempfile), 0, 0, 1, 1},
11128 {&__pyx_n_s__tid, __pyx_k__tid, sizeof(__pyx_k__tid), 0, 0, 1, 1},
11129 {&__pyx_n_s__types, __pyx_k__types, sizeof(__pyx_k__types), 0, 0, 1, 1},
11130 {&__pyx_n_s__unlink, __pyx_k__unlink, sizeof(__pyx_k__unlink), 0, 0, 1, 1},
11131 {&__pyx_n_s__vcf, __pyx_k__vcf, sizeof(__pyx_k__vcf), 0, 0, 1, 1},
11132 {&__pyx_n_s__w, __pyx_k__w, sizeof(__pyx_k__w), 0, 0, 1, 1},
11133 {&__pyx_n_s__zerobased, __pyx_k__zerobased, sizeof(__pyx_k__zerobased), 0, 0, 1, 1},
11134 {0, 0, 0, 0, 0, 0, 0}
11136 static int __Pyx_InitCachedBuiltins(void) {
11137 __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11138 __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11139 __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11140 __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11141 __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11142 __pyx_builtin_OSError = __Pyx_GetName(__pyx_b, __pyx_n_s__OSError); if (!__pyx_builtin_OSError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11143 __pyx_builtin_ord = __Pyx_GetName(__pyx_b, __pyx_n_s__ord); if (!__pyx_builtin_ord) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11144 __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11145 __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11151 static int __Pyx_InitCachedConstants(void) {
11152 __Pyx_RefNannyDeclarations
11153 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
11157 * elif PyUnicode_Check(s):
11158 * return s.encode('ascii') # <<<<<<<<<<<<<<
11160 * raise TypeError, u"Argument must be string, bytes or unicode."
11162 __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11163 __Pyx_GOTREF(__pyx_k_tuple_2);
11164 __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
11165 PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_n_s__ascii));
11166 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
11167 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
11171 * elif PyBytes_Check(s):
11172 * return s.decode('ascii') # <<<<<<<<<<<<<<
11176 __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11177 __Pyx_GOTREF(__pyx_k_tuple_4);
11178 __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
11179 PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_n_s__ascii));
11180 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
11181 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
11183 /* "ctabix.pyx":112
11185 * filename_index = filename + ".tbi"
11186 * self.isremote = filename.startswith( "http:") or filename.startswith( "ftp:" ) # <<<<<<<<<<<<<<
11188 * # encode all the strings
11190 __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11191 __Pyx_GOTREF(__pyx_k_tuple_8);
11192 __Pyx_INCREF(((PyObject *)__pyx_kp_s_7));
11193 PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_7));
11194 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7));
11195 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));
11196 __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11197 __Pyx_GOTREF(__pyx_k_tuple_10);
11198 __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
11199 PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_s_9));
11200 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
11201 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
11203 /* "ctabix.pyx":117
11204 * filename = _my_encodeFilename(filename)
11205 * filename_index = _my_encodeFilename(filename_index)
11206 * cdef bytes bmode = mode.encode('ascii') # <<<<<<<<<<<<<<
11208 * if self._filename != NULL: free(self._filename )
11210 __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11211 __Pyx_GOTREF(__pyx_k_tuple_11);
11212 __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
11213 PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_n_s__ascii));
11214 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
11215 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11));
11217 /* "ctabix.pyx":125
11218 * if mode[0] == 'w':
11219 * # open file for writing
11220 * raise NotImplementedError("writing to tabix files not implemented" ) # <<<<<<<<<<<<<<
11222 * elif mode[0] == "r":
11224 __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11225 __Pyx_GOTREF(__pyx_k_tuple_13);
11226 __Pyx_INCREF(((PyObject *)__pyx_kp_s_12));
11227 PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_s_12));
11228 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_12));
11229 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));
11231 /* "ctabix.pyx":212
11233 * if not self._isOpen():
11234 * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
11236 * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region )
11238 __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11239 __Pyx_GOTREF(__pyx_k_tuple_23);
11240 __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
11241 PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_s_22));
11242 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
11243 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));
11245 /* "ctabix.pyx":235
11246 * '''filename associated with this object.'''
11247 * def __get__(self):
11248 * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<<
11249 * return self._filename
11252 __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11253 __Pyx_GOTREF(__pyx_k_tuple_24);
11254 __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
11255 PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_s_22));
11256 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
11257 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
11259 /* "ctabix.pyx":302
11261 * if <void*>self.iterator == NULL:
11262 * raise ValueError("malformatted query or wrong sequence name.\n") # <<<<<<<<<<<<<<
11264 * def __iter__(self):
11266 __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11267 __Pyx_GOTREF(__pyx_k_tuple_26);
11268 __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
11269 PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_25));
11270 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
11271 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
11273 /* "ctabix.pyx":347
11275 * if <void*>self.iterator == NULL:
11276 * raise ValueError("can't open header.\n") # <<<<<<<<<<<<<<
11278 * def __iter__(self):
11280 __pyx_k_tuple_28 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11281 __Pyx_GOTREF(__pyx_k_tuple_28);
11282 __Pyx_INCREF(((PyObject *)__pyx_kp_s_27));
11283 PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_kp_s_27));
11284 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_27));
11285 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));
11287 /* "ctabix.pyx":539
11289 * if <void*>self.iterator == NULL:
11290 * raise ValueError("malformatted query or wrong sequence name.\n") # <<<<<<<<<<<<<<
11292 * def __iter__(self):
11294 __pyx_k_tuple_29 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11295 __Pyx_GOTREF(__pyx_k_tuple_29);
11296 __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
11297 PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_kp_s_25));
11298 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
11299 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));
11301 /* "ctabix.pyx":590
11302 * fp = bgzf_open( fn, "w")
11304 * raise IOError( "could not open '%s' for writing" ) # <<<<<<<<<<<<<<
11306 * fn = _force_bytes(filename_in)
11308 __pyx_k_tuple_33 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11309 __Pyx_GOTREF(__pyx_k_tuple_33);
11310 __Pyx_INCREF(((PyObject *)__pyx_kp_s_32));
11311 PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_kp_s_32));
11312 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_32));
11313 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));
11315 /* "ctabix.pyx":595
11316 * fd_src = open(fn, O_RDONLY)
11318 * raise IOError( "could not open '%s' for reading" ) # <<<<<<<<<<<<<<
11320 * buffer = malloc(WINDOW_SIZE)
11322 __pyx_k_tuple_35 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11323 __Pyx_GOTREF(__pyx_k_tuple_35);
11324 __Pyx_INCREF(((PyObject *)__pyx_kp_s_34));
11325 PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, ((PyObject *)__pyx_kp_s_34));
11326 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_34));
11327 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
11329 /* "ctabix.pyx":605
11332 * raise OSError("writing failed") # <<<<<<<<<<<<<<
11336 __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11337 __Pyx_GOTREF(__pyx_k_tuple_37);
11338 __Pyx_INCREF(((PyObject *)__pyx_kp_s_36));
11339 PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_kp_s_36));
11340 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_36));
11341 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));
11343 /* "ctabix.pyx":609
11345 * r = bgzf_close(fp)
11346 * if r < 0: raise OSError("writing failed") # <<<<<<<<<<<<<<
11348 * def tabix_index( filename,
11350 __pyx_k_tuple_38 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11351 __Pyx_GOTREF(__pyx_k_tuple_38);
11352 __Pyx_INCREF(((PyObject *)__pyx_kp_s_36));
11353 PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, ((PyObject *)__pyx_kp_s_36));
11354 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_36));
11355 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
11357 /* "ctabix.pyx":655
11358 * if not os.path.exists(filename): raise IOError("No such file '%s'" % filename)
11360 * if not filename.endswith(".gz"): # <<<<<<<<<<<<<<
11361 * tabix_compress( filename, filename + ".gz", force = force )
11362 * os.unlink( filename )
11364 __pyx_k_tuple_44 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11365 __Pyx_GOTREF(__pyx_k_tuple_44);
11366 __Pyx_INCREF(((PyObject *)__pyx_kp_s_43));
11367 PyTuple_SET_ITEM(__pyx_k_tuple_44, 0, ((PyObject *)__pyx_kp_s_43));
11368 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43));
11369 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44));
11371 /* "ctabix.pyx":661
11373 * if not force and os.path.exists(filename + ".tbi" ):
11374 * raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" ) # <<<<<<<<<<<<<<
11376 * # columns (1-based)
11378 __pyx_k_tuple_46 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11379 __Pyx_GOTREF(__pyx_k_tuple_46);
11380 __Pyx_INCREF(((PyObject *)__pyx_kp_s_45));
11381 PyTuple_SET_ITEM(__pyx_k_tuple_46, 0, ((PyObject *)__pyx_kp_s_45));
11382 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_45));
11383 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46));
11385 /* "ctabix.pyx":719
11387 * cdef int fd = PyObject_AsFileDescriptor( infile )
11388 * if fd == -1: raise ValueError( "I/O operation on closed file." ) # <<<<<<<<<<<<<<
11389 * self.infile = fdopen( fd, 'r')
11392 __pyx_k_tuple_50 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11393 __Pyx_GOTREF(__pyx_k_tuple_50);
11394 __Pyx_INCREF(((PyObject *)__pyx_kp_s_49));
11395 PyTuple_SET_ITEM(__pyx_k_tuple_50, 0, ((PyObject *)__pyx_kp_s_49));
11396 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_49));
11397 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50));
11399 /* "ctabix.pyx":722
11400 * self.infile = fdopen( fd, 'r')
11402 * if self.infile == NULL: raise ValueError( "I/O operation on closed file." ) # <<<<<<<<<<<<<<
11404 * self.buffer = <char*>malloc( buffer_size )
11406 __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11407 __Pyx_GOTREF(__pyx_k_tuple_51);
11408 __Pyx_INCREF(((PyObject *)__pyx_kp_s_49));
11409 PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, ((PyObject *)__pyx_kp_s_49));
11410 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_49));
11411 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));
11413 /* "ctabix.pyx":780
11415 * cdef int fd = PyObject_AsFileDescriptor( infile )
11416 * if fd == -1: raise ValueError( "I/O operation on closed file." ) # <<<<<<<<<<<<<<
11417 * self.infile = fdopen( fd, 'r')
11418 * if self.infile == NULL: raise ValueError( "I/O operation on closed file." )
11420 __pyx_k_tuple_53 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11421 __Pyx_GOTREF(__pyx_k_tuple_53);
11422 __Pyx_INCREF(((PyObject *)__pyx_kp_s_49));
11423 PyTuple_SET_ITEM(__pyx_k_tuple_53, 0, ((PyObject *)__pyx_kp_s_49));
11424 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_49));
11425 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));
11427 /* "ctabix.pyx":782
11428 * if fd == -1: raise ValueError( "I/O operation on closed file." )
11429 * self.infile = fdopen( fd, 'r')
11430 * if self.infile == NULL: raise ValueError( "I/O operation on closed file." ) # <<<<<<<<<<<<<<
11431 * self.parser = parser
11434 __pyx_k_tuple_54 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11435 __Pyx_GOTREF(__pyx_k_tuple_54);
11436 __Pyx_INCREF(((PyObject *)__pyx_kp_s_49));
11437 PyTuple_SET_ITEM(__pyx_k_tuple_54, 0, ((PyObject *)__pyx_kp_s_49));
11438 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_49));
11439 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54));
11441 /* "ctabix.pyx":836
11443 * self.infile = infile
11444 * if self.infile.closed: raise ValueError( "I/O operation on closed file." ) # <<<<<<<<<<<<<<
11445 * self.parser = parser
11448 __pyx_k_tuple_55 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11449 __Pyx_GOTREF(__pyx_k_tuple_55);
11450 __Pyx_INCREF(((PyObject *)__pyx_kp_s_49));
11451 PyTuple_SET_ITEM(__pyx_k_tuple_55, 0, ((PyObject *)__pyx_kp_s_49));
11452 __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_49));
11453 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
11455 /* "ctabix.pyx":564
11456 * ti_iter_destroy(self.iterator)
11458 * def tabix_compress( filename_in, # <<<<<<<<<<<<<<
11462 __pyx_k_tuple_61 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11463 __Pyx_GOTREF(__pyx_k_tuple_61);
11464 __Pyx_INCREF(((PyObject *)__pyx_n_s__filename_in));
11465 PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, ((PyObject *)__pyx_n_s__filename_in));
11466 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filename_in));
11467 __Pyx_INCREF(((PyObject *)__pyx_n_s__filename_out));
11468 PyTuple_SET_ITEM(__pyx_k_tuple_61, 1, ((PyObject *)__pyx_n_s__filename_out));
11469 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filename_out));
11470 __Pyx_INCREF(((PyObject *)__pyx_n_s__force));
11471 PyTuple_SET_ITEM(__pyx_k_tuple_61, 2, ((PyObject *)__pyx_n_s__force));
11472 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__force));
11473 __Pyx_INCREF(((PyObject *)__pyx_n_s__WINDOW_SIZE));
11474 PyTuple_SET_ITEM(__pyx_k_tuple_61, 3, ((PyObject *)__pyx_n_s__WINDOW_SIZE));
11475 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__WINDOW_SIZE));
11476 __Pyx_INCREF(((PyObject *)__pyx_n_s__c));
11477 PyTuple_SET_ITEM(__pyx_k_tuple_61, 4, ((PyObject *)__pyx_n_s__c));
11478 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c));
11479 __Pyx_INCREF(((PyObject *)__pyx_n_s__r));
11480 PyTuple_SET_ITEM(__pyx_k_tuple_61, 5, ((PyObject *)__pyx_n_s__r));
11481 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r));
11482 __Pyx_INCREF(((PyObject *)__pyx_n_s__buffer));
11483 PyTuple_SET_ITEM(__pyx_k_tuple_61, 6, ((PyObject *)__pyx_n_s__buffer));
11484 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__buffer));
11485 __Pyx_INCREF(((PyObject *)__pyx_n_s__fp));
11486 PyTuple_SET_ITEM(__pyx_k_tuple_61, 7, ((PyObject *)__pyx_n_s__fp));
11487 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fp));
11488 __Pyx_INCREF(((PyObject *)__pyx_n_s__fd_src));
11489 PyTuple_SET_ITEM(__pyx_k_tuple_61, 8, ((PyObject *)__pyx_n_s__fd_src));
11490 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fd_src));
11491 __Pyx_INCREF(((PyObject *)__pyx_n_s__O_RDONLY));
11492 PyTuple_SET_ITEM(__pyx_k_tuple_61, 9, ((PyObject *)__pyx_n_s__O_RDONLY));
11493 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__O_RDONLY));
11494 __Pyx_INCREF(((PyObject *)__pyx_n_s__fn));
11495 PyTuple_SET_ITEM(__pyx_k_tuple_61, 10, ((PyObject *)__pyx_n_s__fn));
11496 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fn));
11497 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));
11498 __pyx_k_codeobj_62 = (PyObject*)__Pyx_PyCode_New(3, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_63, __pyx_n_s__tabix_compress, 564, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11500 /* "ctabix.pyx":611
11501 * if r < 0: raise OSError("writing failed")
11503 * def tabix_index( filename, # <<<<<<<<<<<<<<
11507 __pyx_k_tuple_64 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11508 __Pyx_GOTREF(__pyx_k_tuple_64);
11509 __Pyx_INCREF(((PyObject *)__pyx_n_s__filename));
11510 PyTuple_SET_ITEM(__pyx_k_tuple_64, 0, ((PyObject *)__pyx_n_s__filename));
11511 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filename));
11512 __Pyx_INCREF(((PyObject *)__pyx_n_s__force));
11513 PyTuple_SET_ITEM(__pyx_k_tuple_64, 1, ((PyObject *)__pyx_n_s__force));
11514 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__force));
11515 __Pyx_INCREF(((PyObject *)__pyx_n_s__seq_col));
11516 PyTuple_SET_ITEM(__pyx_k_tuple_64, 2, ((PyObject *)__pyx_n_s__seq_col));
11517 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__seq_col));
11518 __Pyx_INCREF(((PyObject *)__pyx_n_s__start_col));
11519 PyTuple_SET_ITEM(__pyx_k_tuple_64, 3, ((PyObject *)__pyx_n_s__start_col));
11520 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__start_col));
11521 __Pyx_INCREF(((PyObject *)__pyx_n_s__end_col));
11522 PyTuple_SET_ITEM(__pyx_k_tuple_64, 4, ((PyObject *)__pyx_n_s__end_col));
11523 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__end_col));
11524 __Pyx_INCREF(((PyObject *)__pyx_n_s__preset));
11525 PyTuple_SET_ITEM(__pyx_k_tuple_64, 5, ((PyObject *)__pyx_n_s__preset));
11526 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__preset));
11527 __Pyx_INCREF(((PyObject *)__pyx_n_s__meta_char));
11528 PyTuple_SET_ITEM(__pyx_k_tuple_64, 6, ((PyObject *)__pyx_n_s__meta_char));
11529 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__meta_char));
11530 __Pyx_INCREF(((PyObject *)__pyx_n_s__zerobased));
11531 PyTuple_SET_ITEM(__pyx_k_tuple_64, 7, ((PyObject *)__pyx_n_s__zerobased));
11532 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zerobased));
11533 __Pyx_INCREF(((PyObject *)__pyx_n_s__preset2conf));
11534 PyTuple_SET_ITEM(__pyx_k_tuple_64, 8, ((PyObject *)__pyx_n_s__preset2conf));
11535 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__preset2conf));
11536 __Pyx_INCREF(((PyObject *)__pyx_n_s__conf_data));
11537 PyTuple_SET_ITEM(__pyx_k_tuple_64, 9, ((PyObject *)__pyx_n_s__conf_data));
11538 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__conf_data));
11539 __Pyx_INCREF(((PyObject *)__pyx_n_s__conf));
11540 PyTuple_SET_ITEM(__pyx_k_tuple_64, 10, ((PyObject *)__pyx_n_s__conf));
11541 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__conf));
11542 __Pyx_INCREF(((PyObject *)__pyx_n_s__fn));
11543 PyTuple_SET_ITEM(__pyx_k_tuple_64, 11, ((PyObject *)__pyx_n_s__fn));
11544 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fn));
11545 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64));
11546 __pyx_k_codeobj_65 = (PyObject*)__Pyx_PyCode_New(8, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_63, __pyx_n_s__tabix_index, 611, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11548 /* "ctabix.pyx":833
11549 * Permits the use of file-like objects for example from the gzip module.
11551 * def __init__(self, infile, parser ): # <<<<<<<<<<<<<<
11553 * self.infile = infile
11555 __pyx_k_tuple_66 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11556 __Pyx_GOTREF(__pyx_k_tuple_66);
11557 __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
11558 PyTuple_SET_ITEM(__pyx_k_tuple_66, 0, ((PyObject *)__pyx_n_s__self));
11559 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
11560 __Pyx_INCREF(((PyObject *)__pyx_n_s__infile));
11561 PyTuple_SET_ITEM(__pyx_k_tuple_66, 1, ((PyObject *)__pyx_n_s__infile));
11562 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__infile));
11563 __Pyx_INCREF(((PyObject *)__pyx_n_s__parser));
11564 PyTuple_SET_ITEM(__pyx_k_tuple_66, 2, ((PyObject *)__pyx_n_s__parser));
11565 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__parser));
11566 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66));
11567 __pyx_k_codeobj_67 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_63, __pyx_n_s____init__, 833, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11569 /* "ctabix.pyx":839
11570 * self.parser = parser
11572 * def __iter__(self): # <<<<<<<<<<<<<<
11576 __pyx_k_tuple_68 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11577 __Pyx_GOTREF(__pyx_k_tuple_68);
11578 __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
11579 PyTuple_SET_ITEM(__pyx_k_tuple_68, 0, ((PyObject *)__pyx_n_s__self));
11580 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
11581 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68));
11582 __pyx_k_codeobj_69 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_63, __pyx_n_s____iter__, 839, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11584 /* "ctabix.pyx":843
11586 * # cython version - required for python 3
11587 * def __next__(self): # <<<<<<<<<<<<<<
11589 * cdef char * b, * cpy
11591 __pyx_k_tuple_70 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11592 __Pyx_GOTREF(__pyx_k_tuple_70);
11593 __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
11594 PyTuple_SET_ITEM(__pyx_k_tuple_70, 0, ((PyObject *)__pyx_n_s__self));
11595 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
11596 __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
11597 PyTuple_SET_ITEM(__pyx_k_tuple_70, 1, ((PyObject *)__pyx_n_s__b));
11598 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
11599 __Pyx_INCREF(((PyObject *)__pyx_n_s__cpy));
11600 PyTuple_SET_ITEM(__pyx_k_tuple_70, 2, ((PyObject *)__pyx_n_s__cpy));
11601 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cpy));
11602 __Pyx_INCREF(((PyObject *)__pyx_n_s__nbytes));
11603 PyTuple_SET_ITEM(__pyx_k_tuple_70, 3, ((PyObject *)__pyx_n_s__nbytes));
11604 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nbytes));
11605 __Pyx_INCREF(((PyObject *)__pyx_n_s__line));
11606 PyTuple_SET_ITEM(__pyx_k_tuple_70, 4, ((PyObject *)__pyx_n_s__line));
11607 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__line));
11608 __Pyx_INCREF(((PyObject *)__pyx_n_s__s));
11609 PyTuple_SET_ITEM(__pyx_k_tuple_70, 5, ((PyObject *)__pyx_n_s__s));
11610 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s));
11611 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70));
11612 __pyx_k_codeobj_71 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_63, __pyx_n_s____next__, 843, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11614 /* "ctabix.pyx":877
11616 * # python version - required for python 2.7
11617 * def next(self): # <<<<<<<<<<<<<<
11618 * return self.__next__()
11621 __pyx_k_tuple_72 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11622 __Pyx_GOTREF(__pyx_k_tuple_72);
11623 __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
11624 PyTuple_SET_ITEM(__pyx_k_tuple_72, 0, ((PyObject *)__pyx_n_s__self));
11625 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
11626 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_72));
11627 __pyx_k_codeobj_73 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_63, __pyx_n_s__next, 877, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11629 /* "ctabix.pyx":880
11630 * return self.__next__()
11632 * def tabix_iterator( infile, parser ): # <<<<<<<<<<<<<<
11633 * """return an iterator over all entries in a file."""
11634 * return tabix_generic_iterator( infile, parser )
11636 __pyx_k_tuple_75 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11637 __Pyx_GOTREF(__pyx_k_tuple_75);
11638 __Pyx_INCREF(((PyObject *)__pyx_n_s__infile));
11639 PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, ((PyObject *)__pyx_n_s__infile));
11640 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__infile));
11641 __Pyx_INCREF(((PyObject *)__pyx_n_s__parser));
11642 PyTuple_SET_ITEM(__pyx_k_tuple_75, 1, ((PyObject *)__pyx_n_s__parser));
11643 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__parser));
11644 __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75));
11645 __pyx_k_codeobj_76 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_63, __pyx_n_s__tabix_iterator, 880, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11646 __Pyx_RefNannyFinishContext();
11649 __Pyx_RefNannyFinishContext();
11653 static int __Pyx_InitGlobals(void) {
11654 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
11655 __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;};
11656 __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;};
11657 __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;};
11658 __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;};
11659 __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;};
11660 __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;};
11661 __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;};
11662 __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;};
11663 __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;};
11664 __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;};
11665 __pyx_int_35 = PyInt_FromLong(35); if (unlikely(!__pyx_int_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
11666 __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;};
11672 #if PY_MAJOR_VERSION < 3
11673 PyMODINIT_FUNC initctabix(void); /*proto*/
11674 PyMODINIT_FUNC initctabix(void)
11676 PyMODINIT_FUNC PyInit_ctabix(void); /*proto*/
11677 PyMODINIT_FUNC PyInit_ctabix(void)
11680 PyObject *__pyx_t_1 = NULL;
11681 PyObject *__pyx_t_2 = NULL;
11683 __Pyx_RefNannyDeclarations
11684 #if CYTHON_REFNANNY
11685 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
11686 if (!__Pyx_RefNanny) {
11688 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
11689 if (!__Pyx_RefNanny)
11690 Py_FatalError("failed to import 'refnanny' module");
11693 __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_ctabix(void)", 0);
11694 if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11695 __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;}
11696 __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;}
11697 #ifdef __Pyx_CyFunction_USED
11698 if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11700 #ifdef __Pyx_FusedFunction_USED
11701 if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11703 #ifdef __Pyx_Generator_USED
11704 if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11706 /*--- Library function declarations ---*/
11707 /*--- Threads initialization code ---*/
11708 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
11709 #ifdef WITH_THREAD /* Python build with threading support? */
11710 PyEval_InitThreads();
11713 /*--- Module creation code ---*/
11714 #if PY_MAJOR_VERSION < 3
11715 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("ctabix"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
11717 __pyx_m = PyModule_Create(&__pyx_moduledef);
11719 if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11720 __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11721 #if CYTHON_COMPILING_IN_PYPY
11722 Py_INCREF(__pyx_b);
11724 if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
11725 /*--- Initialize various global constants etc. ---*/
11726 if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11727 if (__pyx_module_is_main_ctabix) {
11728 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;};
11730 /*--- Builtin init code ---*/
11731 if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11732 /*--- Constants init code ---*/
11733 if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11734 /*--- Global init code ---*/
11735 __pyx_v_6ctabix__FILENAME_ENCODING = ((PyObject*)Py_None); Py_INCREF(Py_None);
11736 /*--- Variable export code ---*/
11737 /*--- Function export code ---*/
11738 /*--- Type init code ---*/
11739 if (PyType_Ready(&__pyx_type_6ctabix_Tabixfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11740 if (__Pyx_SetAttrString(__pyx_m, "Tabixfile", (PyObject *)&__pyx_type_6ctabix_Tabixfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11741 __pyx_ptype_6ctabix_Tabixfile = &__pyx_type_6ctabix_Tabixfile;
11742 if (PyType_Ready(&__pyx_type_6ctabix_TabixIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11743 #if CYTHON_COMPILING_IN_CPYTHON
11745 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6ctabix_TabixIterator, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11746 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
11747 __pyx_wrapperbase_6ctabix_13TabixIterator_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
11748 __pyx_wrapperbase_6ctabix_13TabixIterator_4__next__.doc = __pyx_doc_6ctabix_13TabixIterator_4__next__;
11749 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6ctabix_13TabixIterator_4__next__;
11753 if (__Pyx_SetAttrString(__pyx_m, "TabixIterator", (PyObject *)&__pyx_type_6ctabix_TabixIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11754 __pyx_ptype_6ctabix_TabixIterator = &__pyx_type_6ctabix_TabixIterator;
11755 if (PyType_Ready(&__pyx_type_6ctabix_TabixHeaderIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11756 #if CYTHON_COMPILING_IN_CPYTHON
11758 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6ctabix_TabixHeaderIterator, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11759 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
11760 __pyx_wrapperbase_6ctabix_19TabixHeaderIterator_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
11761 __pyx_wrapperbase_6ctabix_19TabixHeaderIterator_4__next__.doc = __pyx_doc_6ctabix_19TabixHeaderIterator_4__next__;
11762 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6ctabix_19TabixHeaderIterator_4__next__;
11766 if (__Pyx_SetAttrString(__pyx_m, "TabixHeaderIterator", (PyObject *)&__pyx_type_6ctabix_TabixHeaderIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11767 __pyx_ptype_6ctabix_TabixHeaderIterator = &__pyx_type_6ctabix_TabixHeaderIterator;
11768 if (PyType_Ready(&__pyx_type_6ctabix_Parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11769 if (__Pyx_SetAttrString(__pyx_m, "Parser", (PyObject *)&__pyx_type_6ctabix_Parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11770 __pyx_ptype_6ctabix_Parser = &__pyx_type_6ctabix_Parser;
11771 __pyx_type_6ctabix_asTuple.tp_base = __pyx_ptype_6ctabix_Parser;
11772 if (PyType_Ready(&__pyx_type_6ctabix_asTuple) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11773 if (__Pyx_SetAttrString(__pyx_m, "asTuple", (PyObject *)&__pyx_type_6ctabix_asTuple) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11774 __pyx_ptype_6ctabix_asTuple = &__pyx_type_6ctabix_asTuple;
11775 __pyx_type_6ctabix_asGTF.tp_base = __pyx_ptype_6ctabix_Parser;
11776 if (PyType_Ready(&__pyx_type_6ctabix_asGTF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11777 if (__Pyx_SetAttrString(__pyx_m, "asGTF", (PyObject *)&__pyx_type_6ctabix_asGTF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11778 __pyx_ptype_6ctabix_asGTF = &__pyx_type_6ctabix_asGTF;
11779 __pyx_type_6ctabix_asBed.tp_base = __pyx_ptype_6ctabix_Parser;
11780 if (PyType_Ready(&__pyx_type_6ctabix_asBed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11781 if (__Pyx_SetAttrString(__pyx_m, "asBed", (PyObject *)&__pyx_type_6ctabix_asBed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11782 __pyx_ptype_6ctabix_asBed = &__pyx_type_6ctabix_asBed;
11783 __pyx_type_6ctabix_asVCF.tp_base = __pyx_ptype_6ctabix_Parser;
11784 if (PyType_Ready(&__pyx_type_6ctabix_asVCF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11785 if (__Pyx_SetAttrString(__pyx_m, "asVCF", (PyObject *)&__pyx_type_6ctabix_asVCF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11786 __pyx_ptype_6ctabix_asVCF = &__pyx_type_6ctabix_asVCF;
11787 if (PyType_Ready(&__pyx_type_6ctabix_TabixIteratorParsed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11788 #if CYTHON_COMPILING_IN_CPYTHON
11790 PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6ctabix_TabixIteratorParsed, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11791 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
11792 __pyx_wrapperbase_6ctabix_19TabixIteratorParsed_4__next__ = *((PyWrapperDescrObject *)wrapper)->d_base;
11793 __pyx_wrapperbase_6ctabix_19TabixIteratorParsed_4__next__.doc = __pyx_doc_6ctabix_19TabixIteratorParsed_4__next__;
11794 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6ctabix_19TabixIteratorParsed_4__next__;
11798 if (__Pyx_SetAttrString(__pyx_m, "TabixIteratorParsed", (PyObject *)&__pyx_type_6ctabix_TabixIteratorParsed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11799 __pyx_ptype_6ctabix_TabixIteratorParsed = &__pyx_type_6ctabix_TabixIteratorParsed;
11800 __pyx_vtabptr_6ctabix_tabix_inplace_iterator = &__pyx_vtable_6ctabix_tabix_inplace_iterator;
11801 __pyx_vtable_6ctabix_tabix_inplace_iterator.__pyx___cnext__ = (PyObject *(*)(struct __pyx_obj_6ctabix_tabix_inplace_iterator *))__pyx_f_6ctabix_22tabix_inplace_iterator___cnext__;
11802 if (PyType_Ready(&__pyx_type_6ctabix_tabix_inplace_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11803 if (__Pyx_SetVtable(__pyx_type_6ctabix_tabix_inplace_iterator.tp_dict, __pyx_vtabptr_6ctabix_tabix_inplace_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11804 if (__Pyx_SetAttrString(__pyx_m, "tabix_inplace_iterator", (PyObject *)&__pyx_type_6ctabix_tabix_inplace_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11805 __pyx_ptype_6ctabix_tabix_inplace_iterator = &__pyx_type_6ctabix_tabix_inplace_iterator;
11806 __pyx_vtabptr_6ctabix_tabix_copy_iterator = &__pyx_vtable_6ctabix_tabix_copy_iterator;
11807 __pyx_vtable_6ctabix_tabix_copy_iterator.__pyx___cnext__ = (PyObject *(*)(struct __pyx_obj_6ctabix_tabix_copy_iterator *))__pyx_f_6ctabix_19tabix_copy_iterator___cnext__;
11808 if (PyType_Ready(&__pyx_type_6ctabix_tabix_copy_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11809 if (__Pyx_SetVtable(__pyx_type_6ctabix_tabix_copy_iterator.tp_dict, __pyx_vtabptr_6ctabix_tabix_copy_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11810 if (__Pyx_SetAttrString(__pyx_m, "tabix_copy_iterator", (PyObject *)&__pyx_type_6ctabix_tabix_copy_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11811 __pyx_ptype_6ctabix_tabix_copy_iterator = &__pyx_type_6ctabix_tabix_copy_iterator;
11812 /*--- Type import code ---*/
11813 __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[1]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11814 __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[1]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11815 __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[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11816 __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[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11817 __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[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11818 __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[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11819 __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[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11820 __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[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11821 __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[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11822 __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[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11823 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
11824 #if CYTHON_COMPILING_IN_PYPY
11825 sizeof(PyTypeObject),
11827 sizeof(PyHeapTypeObject),
11829 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11830 __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[3]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11831 __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[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11832 /*--- Variable import code ---*/
11833 /*--- Function import code ---*/
11834 /*--- Execution code ---*/
11837 * # Helper functions for python 3 compatibility - taken
11838 * # from csamtools.pyx
11839 * import tempfile, os, sys, types, itertools, struct, ctypes, gzip # <<<<<<<<<<<<<<
11841 * cimport TabProxies
11843 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__tempfile), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11844 __Pyx_GOTREF(__pyx_t_1);
11845 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tempfile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11846 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11847 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11848 __Pyx_GOTREF(__pyx_t_1);
11849 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11850 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11851 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11852 __Pyx_GOTREF(__pyx_t_1);
11853 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11854 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11855 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__types), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11856 __Pyx_GOTREF(__pyx_t_1);
11857 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__types, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11858 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11859 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__itertools), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11860 __Pyx_GOTREF(__pyx_t_1);
11861 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__itertools, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11862 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11863 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11864 __Pyx_GOTREF(__pyx_t_1);
11865 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__struct, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11866 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11867 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__ctypes), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11868 __Pyx_GOTREF(__pyx_t_1);
11869 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ctypes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11870 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11871 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__gzip), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11872 __Pyx_GOTREF(__pyx_t_1);
11873 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gzip, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11874 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11877 * # from csamtools.pyx
11878 * import tempfile, os, sys, types, itertools, struct, ctypes, gzip
11879 * import io # <<<<<<<<<<<<<<
11880 * cimport TabProxies
11883 __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__io), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11884 __Pyx_GOTREF(__pyx_t_1);
11885 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__io, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11886 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11889 * PyObject_AsFileDescriptor
11891 * PYTHON3 = PY_MAJOR_VERSION >= 3 # <<<<<<<<<<<<<<
11893 * # from cpython cimport PyString_FromStringAndSize, PyString_AS_STRING
11895 __pyx_t_1 = __Pyx_PyBool_FromLong((PY_MAJOR_VERSION >= 3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11896 __Pyx_GOTREF(__pyx_t_1);
11897 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PYTHON3, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11898 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11901 * # filename encoding (copied from lxml.etree.pyx)
11902 * cdef str _FILENAME_ENCODING
11903 * _FILENAME_ENCODING = sys.getfilesystemencoding() # <<<<<<<<<<<<<<
11904 * if _FILENAME_ENCODING is None:
11905 * _FILENAME_ENCODING = sys.getdefaultencoding()
11907 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11908 __Pyx_GOTREF(__pyx_t_1);
11909 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_60); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11910 __Pyx_GOTREF(__pyx_t_2);
11911 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11912 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11913 __Pyx_GOTREF(__pyx_t_1);
11914 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11915 if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11916 __Pyx_XGOTREF(((PyObject *)__pyx_v_6ctabix__FILENAME_ENCODING));
11917 __Pyx_DECREF(((PyObject *)__pyx_v_6ctabix__FILENAME_ENCODING));
11918 __Pyx_GIVEREF(__pyx_t_1);
11919 __pyx_v_6ctabix__FILENAME_ENCODING = ((PyObject*)__pyx_t_1);
11923 * cdef str _FILENAME_ENCODING
11924 * _FILENAME_ENCODING = sys.getfilesystemencoding()
11925 * if _FILENAME_ENCODING is None: # <<<<<<<<<<<<<<
11926 * _FILENAME_ENCODING = sys.getdefaultencoding()
11927 * if _FILENAME_ENCODING is None:
11929 __pyx_t_3 = (__pyx_v_6ctabix__FILENAME_ENCODING == ((PyObject*)Py_None));
11933 * _FILENAME_ENCODING = sys.getfilesystemencoding()
11934 * if _FILENAME_ENCODING is None:
11935 * _FILENAME_ENCODING = sys.getdefaultencoding() # <<<<<<<<<<<<<<
11936 * if _FILENAME_ENCODING is None:
11937 * _FILENAME_ENCODING = 'ascii'
11939 __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11940 __Pyx_GOTREF(__pyx_t_1);
11941 __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__getdefaultencoding); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11942 __Pyx_GOTREF(__pyx_t_2);
11943 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11944 __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11945 __Pyx_GOTREF(__pyx_t_1);
11946 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11947 if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11948 __Pyx_XGOTREF(((PyObject *)__pyx_v_6ctabix__FILENAME_ENCODING));
11949 __Pyx_DECREF(((PyObject *)__pyx_v_6ctabix__FILENAME_ENCODING));
11950 __Pyx_GIVEREF(__pyx_t_1);
11951 __pyx_v_6ctabix__FILENAME_ENCODING = ((PyObject*)__pyx_t_1);
11958 * if _FILENAME_ENCODING is None:
11959 * _FILENAME_ENCODING = sys.getdefaultencoding()
11960 * if _FILENAME_ENCODING is None: # <<<<<<<<<<<<<<
11961 * _FILENAME_ENCODING = 'ascii'
11964 __pyx_t_3 = (__pyx_v_6ctabix__FILENAME_ENCODING == ((PyObject*)Py_None));
11968 * _FILENAME_ENCODING = sys.getdefaultencoding()
11969 * if _FILENAME_ENCODING is None:
11970 * _FILENAME_ENCODING = 'ascii' # <<<<<<<<<<<<<<
11972 * #cdef char* _C_FILENAME_ENCODING
11974 __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii));
11975 __Pyx_XGOTREF(((PyObject *)__pyx_v_6ctabix__FILENAME_ENCODING));
11976 __Pyx_DECREF(((PyObject *)__pyx_v_6ctabix__FILENAME_ENCODING));
11977 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii));
11978 __pyx_v_6ctabix__FILENAME_ENCODING = __pyx_n_s__ascii;
11983 /* "ctabix.pyx":566
11984 * def tabix_compress( filename_in,
11986 * force = False ): # <<<<<<<<<<<<<<
11988 * compress *filename_in* writing the output to *filename_out*.
11990 __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
11991 __Pyx_GOTREF(__pyx_t_1);
11992 __pyx_k_30 = __pyx_t_1;
11993 __Pyx_GIVEREF(__pyx_t_1);
11996 /* "ctabix.pyx":564
11997 * ti_iter_destroy(self.iterator)
11999 * def tabix_compress( filename_in, # <<<<<<<<<<<<<<
12003 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6ctabix_1tabix_compress, NULL, __pyx_n_s__ctabix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12004 __Pyx_GOTREF(__pyx_t_1);
12005 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tabix_compress, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12006 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12008 /* "ctabix.pyx":612
12010 * def tabix_index( filename,
12011 * force = False, # <<<<<<<<<<<<<<
12013 * start_col = None,
12015 __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12016 __Pyx_GOTREF(__pyx_t_1);
12017 __pyx_k_39 = __pyx_t_1;
12018 __Pyx_GIVEREF(__pyx_t_1);
12021 /* "ctabix.pyx":618
12024 * zerobased = False, # <<<<<<<<<<<<<<
12028 __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12029 __Pyx_GOTREF(__pyx_t_1);
12030 __pyx_k_41 = __pyx_t_1;
12031 __Pyx_GIVEREF(__pyx_t_1);
12034 /* "ctabix.pyx":611
12035 * if r < 0: raise OSError("writing failed")
12037 * def tabix_index( filename, # <<<<<<<<<<<<<<
12041 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6ctabix_3tabix_index, NULL, __pyx_n_s__ctabix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12042 __Pyx_GOTREF(__pyx_t_1);
12043 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tabix_index, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12044 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12046 /* "ctabix.pyx":828
12047 * return self.__cnext__()
12049 * class tabix_generic_iterator: # <<<<<<<<<<<<<<
12050 * '''iterate over ``infile``.
12053 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12054 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
12056 /* "ctabix.pyx":833
12057 * Permits the use of file-like objects for example from the gzip module.
12059 * def __init__(self, infile, parser ): # <<<<<<<<<<<<<<
12061 * self.infile = infile
12063 __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6ctabix_22tabix_generic_iterator_1__init__, 0, NULL, __pyx_n_s__ctabix, ((PyObject *)__pyx_k_codeobj_67)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12064 __Pyx_GOTREF(__pyx_t_2);
12065 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12066 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12068 /* "ctabix.pyx":839
12069 * self.parser = parser
12071 * def __iter__(self): # <<<<<<<<<<<<<<
12075 __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6ctabix_22tabix_generic_iterator_3__iter__, 0, NULL, __pyx_n_s__ctabix, ((PyObject *)__pyx_k_codeobj_69)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12076 __Pyx_GOTREF(__pyx_t_2);
12077 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____iter__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12078 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12080 /* "ctabix.pyx":843
12082 * # cython version - required for python 3
12083 * def __next__(self): # <<<<<<<<<<<<<<
12085 * cdef char * b, * cpy
12087 __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6ctabix_22tabix_generic_iterator_5__next__, 0, NULL, __pyx_n_s__ctabix, ((PyObject *)__pyx_k_codeobj_71)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12088 __Pyx_GOTREF(__pyx_t_2);
12089 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____next__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12090 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12092 /* "ctabix.pyx":877
12094 * # python version - required for python 2.7
12095 * def next(self): # <<<<<<<<<<<<<<
12096 * return self.__next__()
12099 __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6ctabix_22tabix_generic_iterator_7next, 0, NULL, __pyx_n_s__ctabix, ((PyObject *)__pyx_k_codeobj_73)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12100 __Pyx_GOTREF(__pyx_t_2);
12101 if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__next, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12102 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12104 /* "ctabix.pyx":828
12105 * return self.__cnext__()
12107 * class tabix_generic_iterator: # <<<<<<<<<<<<<<
12108 * '''iterate over ``infile``.
12111 if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_74)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12112 __pyx_t_2 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s_56, __pyx_n_s__ctabix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12113 __Pyx_GOTREF(__pyx_t_2);
12114 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_56, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12115 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12116 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
12118 /* "ctabix.pyx":880
12119 * return self.__next__()
12121 * def tabix_iterator( infile, parser ): # <<<<<<<<<<<<<<
12122 * """return an iterator over all entries in a file."""
12123 * return tabix_generic_iterator( infile, parser )
12125 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6ctabix_5tabix_iterator, NULL, __pyx_n_s__ctabix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12126 __Pyx_GOTREF(__pyx_t_1);
12127 if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tabix_iterator, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12128 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12130 /* "ctabix.pyx":896
12131 * # return tabix_generic_iterator( infile, parser )
12133 * __all__ = ["tabix_index", # <<<<<<<<<<<<<<
12134 * "tabix_compress",
12137 __pyx_t_1 = PyList_New(9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12138 __Pyx_GOTREF(__pyx_t_1);
12139 __Pyx_INCREF(((PyObject *)__pyx_n_s__tabix_index));
12140 PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__tabix_index));
12141 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tabix_index));
12142 __Pyx_INCREF(((PyObject *)__pyx_n_s__tabix_compress));
12143 PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__tabix_compress));
12144 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tabix_compress));
12145 __Pyx_INCREF(((PyObject *)__pyx_n_s__Tabixfile));
12146 PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__Tabixfile));
12147 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Tabixfile));
12148 __Pyx_INCREF(((PyObject *)__pyx_n_s__asTuple));
12149 PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__asTuple));
12150 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__asTuple));
12151 __Pyx_INCREF(((PyObject *)__pyx_n_s__asGTF));
12152 PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__asGTF));
12153 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__asGTF));
12154 __Pyx_INCREF(((PyObject *)__pyx_n_s__asVCF));
12155 PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s__asVCF));
12156 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__asVCF));
12157 __Pyx_INCREF(((PyObject *)__pyx_n_s__asBed));
12158 PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_n_s__asBed));
12159 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__asBed));
12160 __Pyx_INCREF(((PyObject *)__pyx_n_s__tabix_iterator));
12161 PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_n_s__tabix_iterator));
12162 __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tabix_iterator));
12163 __Pyx_INCREF(((PyObject *)__pyx_n_s_77));
12164 PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s_77));
12165 __Pyx_GIVEREF(((PyObject *)__pyx_n_s_77));
12166 if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
12167 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
12170 * # cython: embedsignature=True # <<<<<<<<<<<<<<
12171 * # adds doc-strings for sphinx
12174 __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;}
12175 __Pyx_GOTREF(((PyObject *)__pyx_t_1));
12176 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;}
12177 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
12180 __Pyx_XDECREF(__pyx_t_1);
12181 __Pyx_XDECREF(__pyx_t_2);
12183 __Pyx_AddTraceback("init ctabix", __pyx_clineno, __pyx_lineno, __pyx_filename);
12184 Py_DECREF(__pyx_m); __pyx_m = 0;
12185 } else if (!PyErr_Occurred()) {
12186 PyErr_SetString(PyExc_ImportError, "init ctabix");
12189 __Pyx_RefNannyFinishContext();
12190 #if PY_MAJOR_VERSION < 3
12197 /* Runtime support code */
12198 #if CYTHON_REFNANNY
12199 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
12200 PyObject *m = NULL, *p = NULL;
12202 m = PyImport_ImportModule((char *)modname);
12204 p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
12206 r = PyLong_AsVoidPtr(p);
12210 return (__Pyx_RefNannyAPIStruct *)r;
12212 #endif /* CYTHON_REFNANNY */
12214 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
12216 result = PyObject_GetAttr(dict, name);
12218 if (dict != __pyx_b) {
12220 result = PyObject_GetAttr(__pyx_b, name);
12223 PyErr_SetObject(PyExc_NameError, name);
12229 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
12230 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
12231 const char* encoding, const char* errors,
12232 PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
12234 if (unlikely((start < 0) | (stop < 0))) {
12235 length = strlen(cstring);
12244 length = stop - start;
12245 if (unlikely(length <= 0))
12246 return PyUnicode_FromUnicode(NULL, 0);
12249 return decode_func(cstring, length, errors);
12251 return PyUnicode_Decode(cstring, length, encoding, errors);
12255 static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
12256 #if CYTHON_COMPILING_IN_CPYTHON
12257 PyObject *tmp_type, *tmp_value, *tmp_tb;
12258 PyThreadState *tstate = PyThreadState_GET();
12259 tmp_type = tstate->curexc_type;
12260 tmp_value = tstate->curexc_value;
12261 tmp_tb = tstate->curexc_traceback;
12262 tstate->curexc_type = type;
12263 tstate->curexc_value = value;
12264 tstate->curexc_traceback = tb;
12265 Py_XDECREF(tmp_type);
12266 Py_XDECREF(tmp_value);
12267 Py_XDECREF(tmp_tb);
12269 PyErr_Restore(type, value, tb);
12272 static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
12273 #if CYTHON_COMPILING_IN_CPYTHON
12274 PyThreadState *tstate = PyThreadState_GET();
12275 *type = tstate->curexc_type;
12276 *value = tstate->curexc_value;
12277 *tb = tstate->curexc_traceback;
12278 tstate->curexc_type = 0;
12279 tstate->curexc_value = 0;
12280 tstate->curexc_traceback = 0;
12282 PyErr_Fetch(type, value, tb);
12286 #if PY_MAJOR_VERSION < 3
12287 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
12288 CYTHON_UNUSED PyObject *cause) {
12290 if (!value || value == Py_None)
12294 if (!tb || tb == Py_None)
12298 if (!PyTraceBack_Check(tb)) {
12299 PyErr_SetString(PyExc_TypeError,
12300 "raise: arg 3 must be a traceback or None");
12304 #if PY_VERSION_HEX < 0x02050000
12305 if (PyClass_Check(type)) {
12307 if (PyType_Check(type)) {
12309 #if CYTHON_COMPILING_IN_PYPY
12311 Py_INCREF(Py_None);
12315 PyErr_NormalizeException(&type, &value, &tb);
12318 PyErr_SetString(PyExc_TypeError,
12319 "instance exception may not have a separate value");
12323 #if PY_VERSION_HEX < 0x02050000
12324 if (PyInstance_Check(type)) {
12325 type = (PyObject*) ((PyInstanceObject*)type)->in_class;
12330 PyErr_SetString(PyExc_TypeError,
12331 "raise: exception must be an old-style class or instance");
12335 type = (PyObject*) Py_TYPE(type);
12337 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
12338 PyErr_SetString(PyExc_TypeError,
12339 "raise: exception class must be a subclass of BaseException");
12344 __Pyx_ErrRestore(type, value, tb);
12352 #else /* Python 3+ */
12353 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
12354 PyObject* owned_instance = NULL;
12355 if (tb == Py_None) {
12357 } else if (tb && !PyTraceBack_Check(tb)) {
12358 PyErr_SetString(PyExc_TypeError,
12359 "raise: arg 3 must be a traceback or None");
12362 if (value == Py_None)
12364 if (PyExceptionInstance_Check(type)) {
12366 PyErr_SetString(PyExc_TypeError,
12367 "instance exception may not have a separate value");
12371 type = (PyObject*) Py_TYPE(value);
12372 } else if (PyExceptionClass_Check(type)) {
12375 args = PyTuple_New(0);
12376 else if (PyTuple_Check(value)) {
12381 args = PyTuple_Pack(1, value);
12384 owned_instance = PyEval_CallObject(type, args);
12386 if (!owned_instance)
12388 value = owned_instance;
12389 if (!PyExceptionInstance_Check(value)) {
12390 PyErr_Format(PyExc_TypeError,
12391 "calling %R should have returned an instance of "
12392 "BaseException, not %R",
12393 type, Py_TYPE(value));
12397 PyErr_SetString(PyExc_TypeError,
12398 "raise: exception class must be a subclass of BaseException");
12401 if (cause && cause != Py_None) {
12402 PyObject *fixed_cause;
12403 if (PyExceptionClass_Check(cause)) {
12404 fixed_cause = PyObject_CallObject(cause, NULL);
12405 if (fixed_cause == NULL)
12408 else if (PyExceptionInstance_Check(cause)) {
12409 fixed_cause = cause;
12410 Py_INCREF(fixed_cause);
12413 PyErr_SetString(PyExc_TypeError,
12414 "exception causes must derive from "
12418 PyException_SetCause(value, fixed_cause);
12420 PyErr_SetObject(type, value);
12422 PyThreadState *tstate = PyThreadState_GET();
12423 PyObject* tmp_tb = tstate->curexc_traceback;
12424 if (tb != tmp_tb) {
12426 tstate->curexc_traceback = tb;
12427 Py_XDECREF(tmp_tb);
12431 Py_XDECREF(owned_instance);
12436 static void __Pyx_RaiseDoubleKeywordsError(
12437 const char* func_name,
12440 PyErr_Format(PyExc_TypeError,
12441 #if PY_MAJOR_VERSION >= 3
12442 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
12444 "%s() got multiple values for keyword argument '%s'", func_name,
12445 PyString_AsString(kw_name));
12449 static int __Pyx_ParseOptionalKeywords(
12451 PyObject **argnames[],
12453 PyObject *values[],
12454 Py_ssize_t num_pos_args,
12455 const char* function_name)
12457 PyObject *key = 0, *value = 0;
12458 Py_ssize_t pos = 0;
12460 PyObject*** first_kw_arg = argnames + num_pos_args;
12461 while (PyDict_Next(kwds, &pos, &key, &value)) {
12462 name = first_kw_arg;
12463 while (*name && (**name != key)) name++;
12465 values[name-argnames] = value;
12468 name = first_kw_arg;
12469 #if PY_MAJOR_VERSION < 3
12470 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
12472 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
12473 && _PyString_Eq(**name, key)) {
12474 values[name-argnames] = value;
12479 if (*name) continue;
12481 PyObject*** argname = argnames;
12482 while (argname != first_kw_arg) {
12483 if ((**argname == key) || (
12484 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
12485 && _PyString_Eq(**argname, key))) {
12486 goto arg_passed_twice;
12493 if (likely(PyUnicode_Check(key))) {
12495 int cmp = (**name == key) ? 0 :
12496 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
12497 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
12499 PyUnicode_Compare(**name, key);
12500 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
12502 values[name-argnames] = value;
12507 if (*name) continue;
12509 PyObject*** argname = argnames;
12510 while (argname != first_kw_arg) {
12511 int cmp = (**argname == key) ? 0 :
12512 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
12513 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
12515 PyUnicode_Compare(**argname, key);
12516 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
12517 if (cmp == 0) goto arg_passed_twice;
12522 goto invalid_keyword_type;
12524 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
12526 goto invalid_keyword;
12531 __Pyx_RaiseDoubleKeywordsError(function_name, key);
12533 invalid_keyword_type:
12534 PyErr_Format(PyExc_TypeError,
12535 "%s() keywords must be strings", function_name);
12538 PyErr_Format(PyExc_TypeError,
12539 #if PY_MAJOR_VERSION < 3
12540 "%s() got an unexpected keyword argument '%s'",
12541 function_name, PyString_AsString(key));
12543 "%s() got an unexpected keyword argument '%U'",
12544 function_name, key);
12550 static void __Pyx_RaiseArgtupleInvalid(
12551 const char* func_name,
12553 Py_ssize_t num_min,
12554 Py_ssize_t num_max,
12555 Py_ssize_t num_found)
12557 Py_ssize_t num_expected;
12558 const char *more_or_less;
12559 if (num_found < num_min) {
12560 num_expected = num_min;
12561 more_or_less = "at least";
12563 num_expected = num_max;
12564 more_or_less = "at most";
12567 more_or_less = "exactly";
12569 PyErr_Format(PyExc_TypeError,
12570 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
12571 func_name, more_or_less, num_expected,
12572 (num_expected == 1) ? "" : "s", num_found);
12575 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
12576 PyErr_Format(PyExc_ValueError,
12577 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
12580 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
12581 PyErr_Format(PyExc_ValueError,
12582 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
12583 index, (index == 1) ? "" : "s");
12586 static CYTHON_INLINE int __Pyx_IterFinish(void) {
12587 #if CYTHON_COMPILING_IN_CPYTHON
12588 PyThreadState *tstate = PyThreadState_GET();
12589 PyObject* exc_type = tstate->curexc_type;
12590 if (unlikely(exc_type)) {
12591 if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
12592 PyObject *exc_value, *exc_tb;
12593 exc_value = tstate->curexc_value;
12594 exc_tb = tstate->curexc_traceback;
12595 tstate->curexc_type = 0;
12596 tstate->curexc_value = 0;
12597 tstate->curexc_traceback = 0;
12598 Py_DECREF(exc_type);
12599 Py_XDECREF(exc_value);
12600 Py_XDECREF(exc_tb);
12608 if (unlikely(PyErr_Occurred())) {
12609 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
12620 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
12621 if (unlikely(retval)) {
12623 __Pyx_RaiseTooManyValuesError(expected);
12626 return __Pyx_IterFinish();
12631 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
12632 const char *name, int exact)
12635 PyErr_Format(PyExc_SystemError, "Missing type object");
12638 if (none_allowed && obj == Py_None) return 1;
12640 if (Py_TYPE(obj) == type) return 1;
12643 if (PyObject_TypeCheck(obj, type)) return 1;
12645 PyErr_Format(PyExc_TypeError,
12646 "Argument '%s' has incorrect type (expected %s, got %s)",
12647 name, type->tp_name, Py_TYPE(obj)->tp_name);
12651 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
12652 PyObject *local_type, *local_value, *local_tb;
12653 #if CYTHON_COMPILING_IN_CPYTHON
12654 PyObject *tmp_type, *tmp_value, *tmp_tb;
12655 PyThreadState *tstate = PyThreadState_GET();
12656 local_type = tstate->curexc_type;
12657 local_value = tstate->curexc_value;
12658 local_tb = tstate->curexc_traceback;
12659 tstate->curexc_type = 0;
12660 tstate->curexc_value = 0;
12661 tstate->curexc_traceback = 0;
12663 PyErr_Fetch(&local_type, &local_value, &local_tb);
12665 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
12666 #if CYTHON_COMPILING_IN_CPYTHON
12667 if (unlikely(tstate->curexc_type))
12669 if (unlikely(PyErr_Occurred()))
12672 #if PY_MAJOR_VERSION >= 3
12673 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
12676 Py_INCREF(local_type);
12677 Py_INCREF(local_value);
12678 Py_INCREF(local_tb);
12679 *type = local_type;
12680 *value = local_value;
12682 #if CYTHON_COMPILING_IN_CPYTHON
12683 tmp_type = tstate->exc_type;
12684 tmp_value = tstate->exc_value;
12685 tmp_tb = tstate->exc_traceback;
12686 tstate->exc_type = local_type;
12687 tstate->exc_value = local_value;
12688 tstate->exc_traceback = local_tb;
12689 /* Make sure tstate is in a consistent state when we XDECREF
12690 these objects (DECREF may run arbitrary code). */
12691 Py_XDECREF(tmp_type);
12692 Py_XDECREF(tmp_value);
12693 Py_XDECREF(tmp_tb);
12695 PyErr_SetExcInfo(local_type, local_value, local_tb);
12702 Py_XDECREF(local_type);
12703 Py_XDECREF(local_value);
12704 Py_XDECREF(local_tb);
12708 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
12709 #if CYTHON_COMPILING_IN_CPYTHON
12710 PyThreadState *tstate = PyThreadState_GET();
12711 *type = tstate->exc_type;
12712 *value = tstate->exc_value;
12713 *tb = tstate->exc_traceback;
12715 Py_XINCREF(*value);
12718 PyErr_GetExcInfo(type, value, tb);
12721 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
12722 #if CYTHON_COMPILING_IN_CPYTHON
12723 PyObject *tmp_type, *tmp_value, *tmp_tb;
12724 PyThreadState *tstate = PyThreadState_GET();
12725 tmp_type = tstate->exc_type;
12726 tmp_value = tstate->exc_value;
12727 tmp_tb = tstate->exc_traceback;
12728 tstate->exc_type = type;
12729 tstate->exc_value = value;
12730 tstate->exc_traceback = tb;
12731 Py_XDECREF(tmp_type);
12732 Py_XDECREF(tmp_value);
12733 Py_XDECREF(tmp_tb);
12735 PyErr_SetExcInfo(type, value, tb);
12739 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
12740 PyObject *py_import = 0;
12741 PyObject *empty_list = 0;
12742 PyObject *module = 0;
12743 PyObject *global_dict = 0;
12744 PyObject *empty_dict = 0;
12746 py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
12752 empty_list = PyList_New(0);
12757 global_dict = PyModule_GetDict(__pyx_m);
12760 empty_dict = PyDict_New();
12763 #if PY_VERSION_HEX >= 0x02050000
12765 #if PY_MAJOR_VERSION >= 3
12767 if (strchr(__Pyx_MODULE_NAME, '.')) {
12768 /* try package relative import first */
12769 PyObject *py_level = PyInt_FromLong(1);
12772 module = PyObject_CallFunctionObjArgs(py_import,
12773 name, global_dict, empty_dict, list, py_level, NULL);
12774 Py_DECREF(py_level);
12776 if (!PyErr_ExceptionMatches(PyExc_ImportError))
12781 level = 0; /* try absolute import on failure */
12785 PyObject *py_level = PyInt_FromLong(level);
12788 module = PyObject_CallFunctionObjArgs(py_import,
12789 name, global_dict, empty_dict, list, py_level, NULL);
12790 Py_DECREF(py_level);
12795 PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
12798 module = PyObject_CallFunctionObjArgs(py_import,
12799 name, global_dict, empty_dict, list, NULL);
12802 Py_XDECREF(empty_list);
12803 Py_XDECREF(py_import);
12804 Py_XDECREF(empty_dict);
12808 static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
12809 PyObject *metaclass;
12810 #if PY_MAJOR_VERSION < 3
12811 if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
12812 PyObject *base = PyTuple_GET_ITEM(bases, 0);
12813 metaclass = PyObject_GetAttrString(base, (char *)"__class__");
12816 metaclass = (PyObject*) Py_TYPE(base);
12819 metaclass = (PyObject *) &PyClass_Type;
12822 if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
12823 PyObject *base = PyTuple_GET_ITEM(bases, 0);
12824 metaclass = (PyObject*) Py_TYPE(base);
12826 metaclass = (PyObject *) &PyType_Type;
12829 Py_INCREF(metaclass);
12833 static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
12834 PyObject *modname) {
12836 PyObject *metaclass;
12837 if (PyDict_SetItemString(dict, "__module__", modname) < 0)
12839 metaclass = PyDict_GetItemString(dict, "__metaclass__");
12841 Py_INCREF(metaclass);
12843 metaclass = __Pyx_FindPy2Metaclass(bases);
12845 result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
12846 Py_DECREF(metaclass);
12851 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
12853 if (op->func_doc == NULL && op->func.m_ml->ml_doc) {
12854 #if PY_MAJOR_VERSION >= 3
12855 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
12857 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
12860 if (op->func_doc == 0) {
12861 Py_INCREF(Py_None);
12864 Py_INCREF(op->func_doc);
12865 return op->func_doc;
12868 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
12870 PyObject *tmp = op->func_doc;
12872 op->func_doc = Py_None; /* Mark as deleted */
12874 op->func_doc = value;
12875 Py_INCREF(op->func_doc);
12880 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
12882 if (op->func_name == NULL) {
12883 #if PY_MAJOR_VERSION >= 3
12884 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
12886 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
12889 Py_INCREF(op->func_name);
12890 return op->func_name;
12893 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
12896 #if PY_MAJOR_VERSION >= 3
12897 if (value == NULL || !PyUnicode_Check(value)) {
12899 if (value == NULL || !PyString_Check(value)) {
12901 PyErr_SetString(PyExc_TypeError,
12902 "__name__ must be set to a string object");
12905 tmp = op->func_name;
12907 op->func_name = value;
12912 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
12915 self = m->func_closure;
12922 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
12924 if (op->func_dict == NULL) {
12925 op->func_dict = PyDict_New();
12926 if (op->func_dict == NULL)
12929 Py_INCREF(op->func_dict);
12930 return op->func_dict;
12933 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
12936 if (value == NULL) {
12937 PyErr_SetString(PyExc_TypeError,
12938 "function's dictionary may not be deleted");
12941 if (!PyDict_Check(value)) {
12942 PyErr_SetString(PyExc_TypeError,
12943 "setting function's dictionary to a non-dict");
12946 tmp = op->func_dict;
12948 op->func_dict = value;
12953 __Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op)
12955 PyObject* dict = PyModule_GetDict(__pyx_m);
12960 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
12962 Py_INCREF(Py_None);
12966 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
12968 PyObject* result = (op->func_code) ? op->func_code : Py_None;
12973 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op)
12975 if (op->defaults_tuple) {
12976 Py_INCREF(op->defaults_tuple);
12977 return op->defaults_tuple;
12979 if (op->defaults_getter) {
12980 PyObject *res = op->defaults_getter((PyObject *) op);
12983 op->defaults_tuple = res;
12987 Py_INCREF(Py_None);
12990 static PyGetSetDef __pyx_CyFunction_getsets[] = {
12991 {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
12992 {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
12993 {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
12994 {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
12995 {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
12996 {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
12997 {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
12998 {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
12999 {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
13000 {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
13001 {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
13002 {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
13003 {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
13004 {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0},
13005 {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0},
13008 #ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
13009 #define PY_WRITE_RESTRICTED WRITE_RESTRICTED
13011 static PyMemberDef __pyx_CyFunction_members[] = {
13012 {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
13016 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
13018 #if PY_MAJOR_VERSION >= 3
13019 return PyUnicode_FromString(m->func.m_ml->ml_name);
13021 return PyString_FromString(m->func.m_ml->ml_name);
13024 static PyMethodDef __pyx_CyFunction_methods[] = {
13025 {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
13028 static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags,
13029 PyObject *closure, PyObject *module, PyObject* code) {
13030 __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
13034 op->func_weakreflist = NULL;
13035 op->func.m_ml = ml;
13036 op->func.m_self = (PyObject *) op;
13037 Py_XINCREF(closure);
13038 op->func_closure = closure;
13039 Py_XINCREF(module);
13040 op->func.m_module = module;
13041 op->func_dict = NULL;
13042 op->func_name = NULL;
13043 op->func_doc = NULL;
13044 op->func_classobj = NULL;
13046 op->func_code = code;
13047 op->defaults_pyobjects = 0;
13048 op->defaults = NULL;
13049 op->defaults_tuple = NULL;
13050 op->defaults_getter = NULL;
13051 PyObject_GC_Track(op);
13052 return (PyObject *) op;
13055 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
13057 Py_CLEAR(m->func_closure);
13058 Py_CLEAR(m->func.m_module);
13059 Py_CLEAR(m->func_dict);
13060 Py_CLEAR(m->func_name);
13061 Py_CLEAR(m->func_doc);
13062 Py_CLEAR(m->func_code);
13063 Py_CLEAR(m->func_classobj);
13064 Py_CLEAR(m->defaults_tuple);
13066 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
13068 for (i = 0; i < m->defaults_pyobjects; i++)
13069 Py_XDECREF(pydefaults[i]);
13070 PyMem_Free(m->defaults);
13071 m->defaults = NULL;
13075 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
13077 PyObject_GC_UnTrack(m);
13078 if (m->func_weakreflist != NULL)
13079 PyObject_ClearWeakRefs((PyObject *) m);
13080 __Pyx_CyFunction_clear(m);
13081 PyObject_GC_Del(m);
13083 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
13085 Py_VISIT(m->func_closure);
13086 Py_VISIT(m->func.m_module);
13087 Py_VISIT(m->func_dict);
13088 Py_VISIT(m->func_name);
13089 Py_VISIT(m->func_doc);
13090 Py_VISIT(m->func_code);
13091 Py_VISIT(m->func_classobj);
13092 Py_VISIT(m->defaults_tuple);
13094 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
13096 for (i = 0; i < m->defaults_pyobjects; i++)
13097 Py_VISIT(pydefaults[i]);
13101 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
13103 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13104 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
13108 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
13110 type = (PyObject *)(Py_TYPE(obj));
13111 return PyMethod_New(func,
13112 type, (PyObject *)(Py_TYPE(type)));
13114 if (obj == Py_None)
13116 return PyMethod_New(func, obj, type);
13119 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
13121 PyObject *func_name = __Pyx_CyFunction_get_name(op);
13122 #if PY_MAJOR_VERSION >= 3
13123 return PyUnicode_FromFormat("<cyfunction %U at %p>",
13124 func_name, (void *)op);
13126 return PyString_FromFormat("<cyfunction %s at %p>",
13127 PyString_AsString(func_name), (void *)op);
13130 #if CYTHON_COMPILING_IN_PYPY
13131 static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
13132 PyCFunctionObject* f = (PyCFunctionObject*)func;
13133 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
13134 PyObject *self = PyCFunction_GET_SELF(func);
13136 switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
13138 if (likely(kw == NULL) || PyDict_Size(kw) == 0)
13139 return (*meth)(self, arg);
13141 case METH_VARARGS | METH_KEYWORDS:
13142 return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
13144 if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
13145 size = PyTuple_GET_SIZE(arg);
13147 return (*meth)(self, NULL);
13148 PyErr_Format(PyExc_TypeError,
13149 "%.200s() takes no arguments (%zd given)",
13150 f->m_ml->ml_name, size);
13155 if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
13156 size = PyTuple_GET_SIZE(arg);
13158 return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
13159 PyErr_Format(PyExc_TypeError,
13160 "%.200s() takes exactly one argument (%zd given)",
13161 f->m_ml->ml_name, size);
13166 PyErr_SetString(PyExc_SystemError, "Bad call flags in "
13167 "__Pyx_CyFunction_Call. METH_OLDARGS is no "
13168 "longer supported!");
13171 PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
13176 static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
13177 return PyCFunction_Call(func, arg, kw);
13180 static PyTypeObject __pyx_CyFunctionType_type = {
13181 PyVarObject_HEAD_INIT(0, 0)
13182 __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
13183 sizeof(__pyx_CyFunctionObject), /*tp_basicsize*/
13185 (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
13189 #if PY_MAJOR_VERSION < 3
13194 (reprfunc) __Pyx_CyFunction_repr, /*tp_repr*/
13195 0, /*tp_as_number*/
13196 0, /*tp_as_sequence*/
13197 0, /*tp_as_mapping*/
13199 __Pyx_CyFunction_Call, /*tp_call*/
13203 0, /*tp_as_buffer*/
13204 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
13206 (traverseproc) __Pyx_CyFunction_traverse, /*tp_traverse*/
13207 (inquiry) __Pyx_CyFunction_clear, /*tp_clear*/
13208 0, /*tp_richcompare*/
13209 offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
13212 __pyx_CyFunction_methods, /*tp_methods*/
13213 __pyx_CyFunction_members, /*tp_members*/
13214 __pyx_CyFunction_getsets, /*tp_getset*/
13217 __Pyx_CyFunction_descr_get, /*tp_descr_get*/
13218 0, /*tp_descr_set*/
13219 offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
13228 0, /*tp_subclasses*/
13231 #if PY_VERSION_HEX >= 0x02060000
13232 0, /*tp_version_tag*/
13235 static int __Pyx_CyFunction_init(void) {
13236 #if !CYTHON_COMPILING_IN_PYPY
13237 __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
13239 if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
13241 __pyx_CyFunctionType = &__pyx_CyFunctionType_type;
13244 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
13245 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13246 m->defaults = PyMem_Malloc(size);
13248 return PyErr_NoMemory();
13249 memset(m->defaults, 0, sizeof(size));
13250 m->defaults_pyobjects = pyobjects;
13251 return m->defaults;
13253 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
13254 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13255 m->defaults_tuple = tuple;
13259 static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject* x) {
13260 const int32_t neg_one = (int32_t)-1, const_zero = (int32_t)0;
13261 const int is_unsigned = const_zero < neg_one;
13262 if (sizeof(int32_t) == sizeof(char)) {
13264 return (int32_t)__Pyx_PyInt_AsUnsignedChar(x);
13266 return (int32_t)__Pyx_PyInt_AsSignedChar(x);
13267 } else if (sizeof(int32_t) == sizeof(short)) {
13269 return (int32_t)__Pyx_PyInt_AsUnsignedShort(x);
13271 return (int32_t)__Pyx_PyInt_AsSignedShort(x);
13272 } else if (sizeof(int32_t) == sizeof(int)) {
13274 return (int32_t)__Pyx_PyInt_AsUnsignedInt(x);
13276 return (int32_t)__Pyx_PyInt_AsSignedInt(x);
13277 } else if (sizeof(int32_t) == sizeof(long)) {
13279 return (int32_t)__Pyx_PyInt_AsUnsignedLong(x);
13281 return (int32_t)__Pyx_PyInt_AsSignedLong(x);
13282 } else if (sizeof(int32_t) == sizeof(PY_LONG_LONG)) {
13284 return (int32_t)__Pyx_PyInt_AsUnsignedLongLong(x);
13286 return (int32_t)__Pyx_PyInt_AsSignedLongLong(x);
13289 PyObject *v = __Pyx_PyNumber_Int(x);
13290 #if PY_VERSION_HEX < 0x03000000
13291 if (likely(v) && !PyLong_Check(v)) {
13293 v = PyNumber_Long(tmp);
13298 int one = 1; int is_little = (int)*(unsigned char *)&one;
13299 unsigned char *bytes = (unsigned char *)&val;
13300 int ret = _PyLong_AsByteArray((PyLongObject *)v,
13301 bytes, sizeof(val),
13302 is_little, !is_unsigned);
13307 return (int32_t)-1;
13311 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
13312 const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
13313 const int is_unsigned = neg_one > const_zero;
13314 if (sizeof(unsigned char) < sizeof(long)) {
13315 long val = __Pyx_PyInt_AsLong(x);
13316 if (unlikely(val != (long)(unsigned char)val)) {
13317 if (!unlikely(val == -1 && PyErr_Occurred())) {
13318 PyErr_SetString(PyExc_OverflowError,
13319 (is_unsigned && unlikely(val < 0)) ?
13320 "can't convert negative value to unsigned char" :
13321 "value too large to convert to unsigned char");
13323 return (unsigned char)-1;
13325 return (unsigned char)val;
13327 return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
13330 static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
13331 const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
13332 const int is_unsigned = neg_one > const_zero;
13333 if (sizeof(unsigned short) < sizeof(long)) {
13334 long val = __Pyx_PyInt_AsLong(x);
13335 if (unlikely(val != (long)(unsigned short)val)) {
13336 if (!unlikely(val == -1 && PyErr_Occurred())) {
13337 PyErr_SetString(PyExc_OverflowError,
13338 (is_unsigned && unlikely(val < 0)) ?
13339 "can't convert negative value to unsigned short" :
13340 "value too large to convert to unsigned short");
13342 return (unsigned short)-1;
13344 return (unsigned short)val;
13346 return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
13349 static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
13350 const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
13351 const int is_unsigned = neg_one > const_zero;
13352 if (sizeof(unsigned int) < sizeof(long)) {
13353 long val = __Pyx_PyInt_AsLong(x);
13354 if (unlikely(val != (long)(unsigned int)val)) {
13355 if (!unlikely(val == -1 && PyErr_Occurred())) {
13356 PyErr_SetString(PyExc_OverflowError,
13357 (is_unsigned && unlikely(val < 0)) ?
13358 "can't convert negative value to unsigned int" :
13359 "value too large to convert to unsigned int");
13361 return (unsigned int)-1;
13363 return (unsigned int)val;
13365 return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
13368 static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
13369 const char neg_one = (char)-1, const_zero = 0;
13370 const int is_unsigned = neg_one > const_zero;
13371 if (sizeof(char) < sizeof(long)) {
13372 long val = __Pyx_PyInt_AsLong(x);
13373 if (unlikely(val != (long)(char)val)) {
13374 if (!unlikely(val == -1 && PyErr_Occurred())) {
13375 PyErr_SetString(PyExc_OverflowError,
13376 (is_unsigned && unlikely(val < 0)) ?
13377 "can't convert negative value to char" :
13378 "value too large to convert to char");
13384 return (char)__Pyx_PyInt_AsLong(x);
13387 static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
13388 const short neg_one = (short)-1, const_zero = 0;
13389 const int is_unsigned = neg_one > const_zero;
13390 if (sizeof(short) < sizeof(long)) {
13391 long val = __Pyx_PyInt_AsLong(x);
13392 if (unlikely(val != (long)(short)val)) {
13393 if (!unlikely(val == -1 && PyErr_Occurred())) {
13394 PyErr_SetString(PyExc_OverflowError,
13395 (is_unsigned && unlikely(val < 0)) ?
13396 "can't convert negative value to short" :
13397 "value too large to convert to short");
13403 return (short)__Pyx_PyInt_AsLong(x);
13406 static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
13407 const int neg_one = (int)-1, const_zero = 0;
13408 const int is_unsigned = neg_one > const_zero;
13409 if (sizeof(int) < sizeof(long)) {
13410 long val = __Pyx_PyInt_AsLong(x);
13411 if (unlikely(val != (long)(int)val)) {
13412 if (!unlikely(val == -1 && PyErr_Occurred())) {
13413 PyErr_SetString(PyExc_OverflowError,
13414 (is_unsigned && unlikely(val < 0)) ?
13415 "can't convert negative value to int" :
13416 "value too large to convert to int");
13422 return (int)__Pyx_PyInt_AsLong(x);
13425 static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
13426 const signed char neg_one = (signed char)-1, const_zero = 0;
13427 const int is_unsigned = neg_one > const_zero;
13428 if (sizeof(signed char) < sizeof(long)) {
13429 long val = __Pyx_PyInt_AsLong(x);
13430 if (unlikely(val != (long)(signed char)val)) {
13431 if (!unlikely(val == -1 && PyErr_Occurred())) {
13432 PyErr_SetString(PyExc_OverflowError,
13433 (is_unsigned && unlikely(val < 0)) ?
13434 "can't convert negative value to signed char" :
13435 "value too large to convert to signed char");
13437 return (signed char)-1;
13439 return (signed char)val;
13441 return (signed char)__Pyx_PyInt_AsSignedLong(x);
13444 static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
13445 const signed short neg_one = (signed short)-1, const_zero = 0;
13446 const int is_unsigned = neg_one > const_zero;
13447 if (sizeof(signed short) < sizeof(long)) {
13448 long val = __Pyx_PyInt_AsLong(x);
13449 if (unlikely(val != (long)(signed short)val)) {
13450 if (!unlikely(val == -1 && PyErr_Occurred())) {
13451 PyErr_SetString(PyExc_OverflowError,
13452 (is_unsigned && unlikely(val < 0)) ?
13453 "can't convert negative value to signed short" :
13454 "value too large to convert to signed short");
13456 return (signed short)-1;
13458 return (signed short)val;
13460 return (signed short)__Pyx_PyInt_AsSignedLong(x);
13463 static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
13464 const signed int neg_one = (signed int)-1, const_zero = 0;
13465 const int is_unsigned = neg_one > const_zero;
13466 if (sizeof(signed int) < sizeof(long)) {
13467 long val = __Pyx_PyInt_AsLong(x);
13468 if (unlikely(val != (long)(signed int)val)) {
13469 if (!unlikely(val == -1 && PyErr_Occurred())) {
13470 PyErr_SetString(PyExc_OverflowError,
13471 (is_unsigned && unlikely(val < 0)) ?
13472 "can't convert negative value to signed int" :
13473 "value too large to convert to signed int");
13475 return (signed int)-1;
13477 return (signed int)val;
13479 return (signed int)__Pyx_PyInt_AsSignedLong(x);
13482 static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
13483 const int neg_one = (int)-1, const_zero = 0;
13484 const int is_unsigned = neg_one > const_zero;
13485 if (sizeof(int) < sizeof(long)) {
13486 long val = __Pyx_PyInt_AsLong(x);
13487 if (unlikely(val != (long)(int)val)) {
13488 if (!unlikely(val == -1 && PyErr_Occurred())) {
13489 PyErr_SetString(PyExc_OverflowError,
13490 (is_unsigned && unlikely(val < 0)) ?
13491 "can't convert negative value to int" :
13492 "value too large to convert to int");
13498 return (int)__Pyx_PyInt_AsLong(x);
13501 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
13502 const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
13503 const int is_unsigned = neg_one > const_zero;
13504 #if PY_VERSION_HEX < 0x03000000
13505 if (likely(PyInt_Check(x))) {
13506 long val = PyInt_AS_LONG(x);
13507 if (is_unsigned && unlikely(val < 0)) {
13508 PyErr_SetString(PyExc_OverflowError,
13509 "can't convert negative value to unsigned long");
13510 return (unsigned long)-1;
13512 return (unsigned long)val;
13515 if (likely(PyLong_Check(x))) {
13517 if (unlikely(Py_SIZE(x) < 0)) {
13518 PyErr_SetString(PyExc_OverflowError,
13519 "can't convert negative value to unsigned long");
13520 return (unsigned long)-1;
13522 return (unsigned long)PyLong_AsUnsignedLong(x);
13524 return (unsigned long)PyLong_AsLong(x);
13528 PyObject *tmp = __Pyx_PyNumber_Int(x);
13529 if (!tmp) return (unsigned long)-1;
13530 val = __Pyx_PyInt_AsUnsignedLong(tmp);
13536 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
13537 const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
13538 const int is_unsigned = neg_one > const_zero;
13539 #if PY_VERSION_HEX < 0x03000000
13540 if (likely(PyInt_Check(x))) {
13541 long val = PyInt_AS_LONG(x);
13542 if (is_unsigned && unlikely(val < 0)) {
13543 PyErr_SetString(PyExc_OverflowError,
13544 "can't convert negative value to unsigned PY_LONG_LONG");
13545 return (unsigned PY_LONG_LONG)-1;
13547 return (unsigned PY_LONG_LONG)val;
13550 if (likely(PyLong_Check(x))) {
13552 if (unlikely(Py_SIZE(x) < 0)) {
13553 PyErr_SetString(PyExc_OverflowError,
13554 "can't convert negative value to unsigned PY_LONG_LONG");
13555 return (unsigned PY_LONG_LONG)-1;
13557 return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
13559 return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
13562 unsigned PY_LONG_LONG val;
13563 PyObject *tmp = __Pyx_PyNumber_Int(x);
13564 if (!tmp) return (unsigned PY_LONG_LONG)-1;
13565 val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
13571 static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
13572 const long neg_one = (long)-1, const_zero = 0;
13573 const int is_unsigned = neg_one > const_zero;
13574 #if PY_VERSION_HEX < 0x03000000
13575 if (likely(PyInt_Check(x))) {
13576 long val = PyInt_AS_LONG(x);
13577 if (is_unsigned && unlikely(val < 0)) {
13578 PyErr_SetString(PyExc_OverflowError,
13579 "can't convert negative value to long");
13585 if (likely(PyLong_Check(x))) {
13587 if (unlikely(Py_SIZE(x) < 0)) {
13588 PyErr_SetString(PyExc_OverflowError,
13589 "can't convert negative value to long");
13592 return (long)PyLong_AsUnsignedLong(x);
13594 return (long)PyLong_AsLong(x);
13598 PyObject *tmp = __Pyx_PyNumber_Int(x);
13599 if (!tmp) return (long)-1;
13600 val = __Pyx_PyInt_AsLong(tmp);
13606 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
13607 const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
13608 const int is_unsigned = neg_one > const_zero;
13609 #if PY_VERSION_HEX < 0x03000000
13610 if (likely(PyInt_Check(x))) {
13611 long val = PyInt_AS_LONG(x);
13612 if (is_unsigned && unlikely(val < 0)) {
13613 PyErr_SetString(PyExc_OverflowError,
13614 "can't convert negative value to PY_LONG_LONG");
13615 return (PY_LONG_LONG)-1;
13617 return (PY_LONG_LONG)val;
13620 if (likely(PyLong_Check(x))) {
13622 if (unlikely(Py_SIZE(x) < 0)) {
13623 PyErr_SetString(PyExc_OverflowError,
13624 "can't convert negative value to PY_LONG_LONG");
13625 return (PY_LONG_LONG)-1;
13627 return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
13629 return (PY_LONG_LONG)PyLong_AsLongLong(x);
13633 PyObject *tmp = __Pyx_PyNumber_Int(x);
13634 if (!tmp) return (PY_LONG_LONG)-1;
13635 val = __Pyx_PyInt_AsLongLong(tmp);
13641 static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
13642 const signed long neg_one = (signed long)-1, const_zero = 0;
13643 const int is_unsigned = neg_one > const_zero;
13644 #if PY_VERSION_HEX < 0x03000000
13645 if (likely(PyInt_Check(x))) {
13646 long val = PyInt_AS_LONG(x);
13647 if (is_unsigned && unlikely(val < 0)) {
13648 PyErr_SetString(PyExc_OverflowError,
13649 "can't convert negative value to signed long");
13650 return (signed long)-1;
13652 return (signed long)val;
13655 if (likely(PyLong_Check(x))) {
13657 if (unlikely(Py_SIZE(x) < 0)) {
13658 PyErr_SetString(PyExc_OverflowError,
13659 "can't convert negative value to signed long");
13660 return (signed long)-1;
13662 return (signed long)PyLong_AsUnsignedLong(x);
13664 return (signed long)PyLong_AsLong(x);
13668 PyObject *tmp = __Pyx_PyNumber_Int(x);
13669 if (!tmp) return (signed long)-1;
13670 val = __Pyx_PyInt_AsSignedLong(tmp);
13676 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
13677 const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
13678 const int is_unsigned = neg_one > const_zero;
13679 #if PY_VERSION_HEX < 0x03000000
13680 if (likely(PyInt_Check(x))) {
13681 long val = PyInt_AS_LONG(x);
13682 if (is_unsigned && unlikely(val < 0)) {
13683 PyErr_SetString(PyExc_OverflowError,
13684 "can't convert negative value to signed PY_LONG_LONG");
13685 return (signed PY_LONG_LONG)-1;
13687 return (signed PY_LONG_LONG)val;
13690 if (likely(PyLong_Check(x))) {
13692 if (unlikely(Py_SIZE(x) < 0)) {
13693 PyErr_SetString(PyExc_OverflowError,
13694 "can't convert negative value to signed PY_LONG_LONG");
13695 return (signed PY_LONG_LONG)-1;
13697 return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
13699 return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
13702 signed PY_LONG_LONG val;
13703 PyObject *tmp = __Pyx_PyNumber_Int(x);
13704 if (!tmp) return (signed PY_LONG_LONG)-1;
13705 val = __Pyx_PyInt_AsSignedLongLong(tmp);
13711 static int __Pyx_check_binary_version(void) {
13712 char ctversion[4], rtversion[4];
13713 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
13714 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
13715 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
13717 PyOS_snprintf(message, sizeof(message),
13718 "compiletime version %s of module '%.100s' "
13719 "does not match runtime version %s",
13720 ctversion, __Pyx_MODULE_NAME, rtversion);
13721 #if PY_VERSION_HEX < 0x02050000
13722 return PyErr_Warn(NULL, message);
13724 return PyErr_WarnEx(NULL, message, 1);
13730 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
13731 #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
13732 PyObject *ob = PyCapsule_New(vtable, 0, 0);
13734 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
13738 if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
13747 #ifndef __PYX_HAVE_RT_ImportModule
13748 #define __PYX_HAVE_RT_ImportModule
13749 static PyObject *__Pyx_ImportModule(const char *name) {
13750 PyObject *py_name = 0;
13751 PyObject *py_module = 0;
13752 py_name = __Pyx_PyIdentifier_FromString(name);
13755 py_module = PyImport_Import(py_name);
13756 Py_DECREF(py_name);
13759 Py_XDECREF(py_name);
13764 #ifndef __PYX_HAVE_RT_ImportType
13765 #define __PYX_HAVE_RT_ImportType
13766 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
13767 size_t size, int strict)
13769 PyObject *py_module = 0;
13770 PyObject *result = 0;
13771 PyObject *py_name = 0;
13773 py_module = __Pyx_ImportModule(module_name);
13776 py_name = __Pyx_PyIdentifier_FromString(class_name);
13779 result = PyObject_GetAttr(py_module, py_name);
13780 Py_DECREF(py_name);
13782 Py_DECREF(py_module);
13786 if (!PyType_Check(result)) {
13787 PyErr_Format(PyExc_TypeError,
13788 "%s.%s is not a type object",
13789 module_name, class_name);
13792 if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) {
13793 PyOS_snprintf(warning, sizeof(warning),
13794 "%s.%s size changed, may indicate binary incompatibility",
13795 module_name, class_name);
13796 #if PY_VERSION_HEX < 0x02050000
13797 if (PyErr_Warn(NULL, warning) < 0) goto bad;
13799 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
13802 else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) {
13803 PyErr_Format(PyExc_ValueError,
13804 "%s.%s has the wrong size, try recompiling",
13805 module_name, class_name);
13808 return (PyTypeObject *)result;
13810 Py_XDECREF(py_module);
13811 Py_XDECREF(result);
13816 static void* __Pyx_GetVtable(PyObject *dict) {
13818 PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__");
13821 #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
13822 ptr = PyCapsule_GetPointer(ob, 0);
13824 ptr = PyCObject_AsVoidPtr(ob);
13826 if (!ptr && !PyErr_Occurred())
13827 PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
13835 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
13836 int start = 0, mid = 0, end = count - 1;
13837 if (end >= 0 && code_line > entries[end].code_line) {
13840 while (start < end) {
13841 mid = (start + end) / 2;
13842 if (code_line < entries[mid].code_line) {
13844 } else if (code_line > entries[mid].code_line) {
13850 if (code_line <= entries[mid].code_line) {
13856 static PyCodeObject *__pyx_find_code_object(int code_line) {
13857 PyCodeObject* code_object;
13859 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
13862 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
13863 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
13866 code_object = __pyx_code_cache.entries[pos].code_object;
13867 Py_INCREF(code_object);
13868 return code_object;
13870 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
13872 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
13873 if (unlikely(!code_line)) {
13876 if (unlikely(!entries)) {
13877 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
13878 if (likely(entries)) {
13879 __pyx_code_cache.entries = entries;
13880 __pyx_code_cache.max_count = 64;
13881 __pyx_code_cache.count = 1;
13882 entries[0].code_line = code_line;
13883 entries[0].code_object = code_object;
13884 Py_INCREF(code_object);
13888 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
13889 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
13890 PyCodeObject* tmp = entries[pos].code_object;
13891 entries[pos].code_object = code_object;
13895 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
13896 int new_max = __pyx_code_cache.max_count + 64;
13897 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
13898 __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
13899 if (unlikely(!entries)) {
13902 __pyx_code_cache.entries = entries;
13903 __pyx_code_cache.max_count = new_max;
13905 for (i=__pyx_code_cache.count; i>pos; i--) {
13906 entries[i] = entries[i-1];
13908 entries[pos].code_line = code_line;
13909 entries[pos].code_object = code_object;
13910 __pyx_code_cache.count++;
13911 Py_INCREF(code_object);
13914 #include "compile.h"
13915 #include "frameobject.h"
13916 #include "traceback.h"
13917 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
13918 const char *funcname, int c_line,
13919 int py_line, const char *filename) {
13920 PyCodeObject *py_code = 0;
13921 PyObject *py_srcfile = 0;
13922 PyObject *py_funcname = 0;
13923 #if PY_MAJOR_VERSION < 3
13924 py_srcfile = PyString_FromString(filename);
13926 py_srcfile = PyUnicode_FromString(filename);
13928 if (!py_srcfile) goto bad;
13930 #if PY_MAJOR_VERSION < 3
13931 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
13933 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
13937 #if PY_MAJOR_VERSION < 3
13938 py_funcname = PyString_FromString(funcname);
13940 py_funcname = PyUnicode_FromString(funcname);
13943 if (!py_funcname) goto bad;
13944 py_code = __Pyx_PyCode_New(
13945 0, /*int argcount,*/
13946 0, /*int kwonlyargcount,*/
13947 0, /*int nlocals,*/
13948 0, /*int stacksize,*/
13950 __pyx_empty_bytes, /*PyObject *code,*/
13951 __pyx_empty_tuple, /*PyObject *consts,*/
13952 __pyx_empty_tuple, /*PyObject *names,*/
13953 __pyx_empty_tuple, /*PyObject *varnames,*/
13954 __pyx_empty_tuple, /*PyObject *freevars,*/
13955 __pyx_empty_tuple, /*PyObject *cellvars,*/
13956 py_srcfile, /*PyObject *filename,*/
13957 py_funcname, /*PyObject *name,*/
13958 py_line, /*int firstlineno,*/
13959 __pyx_empty_bytes /*PyObject *lnotab*/
13961 Py_DECREF(py_srcfile);
13962 Py_DECREF(py_funcname);
13965 Py_XDECREF(py_srcfile);
13966 Py_XDECREF(py_funcname);
13969 static void __Pyx_AddTraceback(const char *funcname, int c_line,
13970 int py_line, const char *filename) {
13971 PyCodeObject *py_code = 0;
13972 PyObject *py_globals = 0;
13973 PyFrameObject *py_frame = 0;
13974 py_code = __pyx_find_code_object(c_line ? c_line : py_line);
13976 py_code = __Pyx_CreateCodeObjectForTraceback(
13977 funcname, c_line, py_line, filename);
13978 if (!py_code) goto bad;
13979 __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
13981 py_globals = PyModule_GetDict(__pyx_m);
13982 if (!py_globals) goto bad;
13983 py_frame = PyFrame_New(
13984 PyThreadState_GET(), /*PyThreadState *tstate,*/
13985 py_code, /*PyCodeObject *code,*/
13986 py_globals, /*PyObject *globals,*/
13987 0 /*PyObject *locals*/
13989 if (!py_frame) goto bad;
13990 py_frame->f_lineno = py_line;
13991 PyTraceBack_Here(py_frame);
13993 Py_XDECREF(py_code);
13994 Py_XDECREF(py_frame);
13997 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
13999 #if PY_MAJOR_VERSION < 3
14000 if (t->is_unicode) {
14001 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
14002 } else if (t->intern) {
14003 *t->p = PyString_InternFromString(t->s);
14005 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
14007 #else /* Python 3+ has unicode identifiers */
14008 if (t->is_unicode | t->is_str) {
14010 *t->p = PyUnicode_InternFromString(t->s);
14011 } else if (t->encoding) {
14012 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
14014 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
14017 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
14028 /* Type Conversion Functions */
14030 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
14031 int is_true = x == Py_True;
14032 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
14033 else return PyObject_IsTrue(x);
14036 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
14037 PyNumberMethods *m;
14038 const char *name = NULL;
14039 PyObject *res = NULL;
14040 #if PY_VERSION_HEX < 0x03000000
14041 if (PyInt_Check(x) || PyLong_Check(x))
14043 if (PyLong_Check(x))
14045 return Py_INCREF(x), x;
14046 m = Py_TYPE(x)->tp_as_number;
14047 #if PY_VERSION_HEX < 0x03000000
14048 if (m && m->nb_int) {
14050 res = PyNumber_Int(x);
14052 else if (m && m->nb_long) {
14054 res = PyNumber_Long(x);
14057 if (m && m->nb_int) {
14059 res = PyNumber_Long(x);
14063 #if PY_VERSION_HEX < 0x03000000
14064 if (!PyInt_Check(res) && !PyLong_Check(res)) {
14066 if (!PyLong_Check(res)) {
14068 PyErr_Format(PyExc_TypeError,
14069 "__%s__ returned non-%s (type %.200s)",
14070 name, name, Py_TYPE(res)->tp_name);
14075 else if (!PyErr_Occurred()) {
14076 PyErr_SetString(PyExc_TypeError,
14077 "an integer is required");
14082 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
14084 PyObject* x = PyNumber_Index(b);
14086 ival = PyInt_AsSsize_t(x);
14091 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
14092 #if PY_VERSION_HEX < 0x02050000
14093 if (ival <= LONG_MAX)
14094 return PyInt_FromLong((long)ival);
14096 unsigned char *bytes = (unsigned char *) &ival;
14097 int one = 1; int little = (int)*(unsigned char*)&one;
14098 return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
14101 return PyInt_FromSize_t(ival);
14105 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
14106 unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
14107 if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
14109 } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
14110 PyErr_SetString(PyExc_OverflowError,
14111 "value too large to convert to size_t");
14114 return (size_t)val;
14118 #endif /* Py_PYTHON_H */