+ __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;}
+ ti_index_build(__pyx_t_22, (&__pyx_v_conf));
+
+ /* "ctabix.pyx":699
+ * ti_index_build( fn, &conf)
+ *
+ * return filename # <<<<<<<<<<<<<<
+ *
+ * #########################################################
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_filename);
+ __pyx_r = __pyx_v_filename;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_12);
+ __Pyx_XDECREF(__pyx_t_13);
+ __Pyx_XDECREF(__pyx_t_14);
+ __Pyx_AddTraceback("ctabix.tabix_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_preset2conf);
+ __Pyx_XDECREF(__pyx_v_conf_data);
+ __Pyx_XDECREF(__pyx_v_fn);
+ __Pyx_XDECREF(__pyx_v_filename);
+ __Pyx_XDECREF(__pyx_v_end_col);
+ __Pyx_XDECREF(__pyx_v_preset);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_6ctabix_22tabix_inplace_iterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_infile = 0;
+ int __pyx_v_buffer_size;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__infile,&__pyx_n_s__buffer_size,0};
+ PyObject* values[2] = {0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer_size);
+ if (value) { values[1] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else {
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ __pyx_v_infile = values[0];
+ if (values[1]) {
+ __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;}
+ } else {
+ __pyx_v_buffer_size = ((int)65536);
+ }
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __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;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("ctabix.tabix_inplace_iterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return -1;
+ __pyx_L4_argument_unpacking_done:;
+ __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);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "ctabix.pyx":716
+ *
+ *
+ * def __cinit__(self, infile, int buffer_size = 65536 ): # <<<<<<<<<<<<<<
+ *
+ * cdef int fd = PyObject_AsFileDescriptor( infile )
+ */
+
+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) {
+ int __pyx_v_fd;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__cinit__", 0);
+
+ /* "ctabix.pyx":718
+ * def __cinit__(self, infile, int buffer_size = 65536 ):
+ *
+ * cdef int fd = PyObject_AsFileDescriptor( infile ) # <<<<<<<<<<<<<<
+ * if fd == -1: raise ValueError( "I/O operation on closed file." )
+ * self.infile = fdopen( fd, 'r')
+ */
+ __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;}
+ __pyx_v_fd = __pyx_t_1;
+
+ /* "ctabix.pyx":719
+ *
+ * cdef int fd = PyObject_AsFileDescriptor( infile )
+ * if fd == -1: raise ValueError( "I/O operation on closed file." ) # <<<<<<<<<<<<<<
+ * self.infile = fdopen( fd, 'r')
+ *
+ */
+ __pyx_t_2 = (__pyx_v_fd == -1);
+ if (__pyx_t_2) {
+ __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;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "ctabix.pyx":720
+ * cdef int fd = PyObject_AsFileDescriptor( infile )
+ * if fd == -1: raise ValueError( "I/O operation on closed file." )
+ * self.infile = fdopen( fd, 'r') # <<<<<<<<<<<<<<
+ *
+ * if self.infile == NULL: raise ValueError( "I/O operation on closed file." )
+ */
+ __pyx_v_self->infile = fdopen(__pyx_v_fd, __pyx_k__r);
+
+ /* "ctabix.pyx":722
+ * self.infile = fdopen( fd, 'r')
+ *
+ * if self.infile == NULL: raise ValueError( "I/O operation on closed file." ) # <<<<<<<<<<<<<<
+ *
+ * self.buffer = <char*>malloc( buffer_size )
+ */
+ __pyx_t_2 = (__pyx_v_self->infile == NULL);
+ if (__pyx_t_2) {
+ __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;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "ctabix.pyx":724
+ * if self.infile == NULL: raise ValueError( "I/O operation on closed file." )
+ *
+ * self.buffer = <char*>malloc( buffer_size ) # <<<<<<<<<<<<<<
+ * self.size = buffer_size
+ *
+ */
+ __pyx_v_self->buffer = ((char *)malloc(__pyx_v_buffer_size));
+
+ /* "ctabix.pyx":725
+ *
+ * self.buffer = <char*>malloc( buffer_size )
+ * self.size = buffer_size # <<<<<<<<<<<<<<
+ *
+ * def __iter__(self):
+ */
+ __pyx_v_self->size = __pyx_v_buffer_size;
+
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("ctabix.tabix_inplace_iterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6ctabix_22tabix_inplace_iterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_6ctabix_22tabix_inplace_iterator_3__iter__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_6ctabix_22tabix_inplace_iterator_2__iter__(((struct __pyx_obj_6ctabix_tabix_inplace_iterator *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "ctabix.pyx":727
+ * self.size = buffer_size
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * return self
+ *
+ */
+
+static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_2__iter__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__iter__", 0);
+
+ /* "ctabix.pyx":728
+ *
+ * def __iter__(self):
+ * return self # <<<<<<<<<<<<<<
+ *
+ * cdef __cnext__(self):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(((PyObject *)__pyx_v_self));
+ __pyx_r = ((PyObject *)__pyx_v_self);
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "ctabix.pyx":730
+ * return self
+ *
+ * cdef __cnext__(self): # <<<<<<<<<<<<<<
+ *
+ * cdef char * b
+ */
+
+static PyObject *__pyx_f_6ctabix_22tabix_inplace_iterator___cnext__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self) {
+ char *__pyx_v_b;
+ size_t __pyx_v_nbytes;
+ PyObject *__pyx_v_r = NULL;
+ char *__pyx_v_result;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ int __pyx_t_5;
+ int __pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__cnext__", 0);
+
+ /* "ctabix.pyx":734
+ * cdef char * b
+ * cdef size_t nbytes
+ * b = self.buffer # <<<<<<<<<<<<<<
+ * r = self.Parser()
+ *
+ */
+ __pyx_v_b = __pyx_v_self->buffer;
+
+ /* "ctabix.pyx":735
+ * cdef size_t nbytes
+ * b = self.buffer
+ * r = self.Parser() # <<<<<<<<<<<<<<
+ *
+ * while not feof( self.infile ):
+ */
+ __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;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __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;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+
+ /* "ctabix.pyx":737
+ * r = self.Parser()
+ *
+ * while not feof( self.infile ): # <<<<<<<<<<<<<<
+ * nbytes = getline( &b, &self.size, self.infile)
+ *
+ */
+ while (1) {
+ __pyx_t_3 = (!feof(__pyx_v_self->infile));
+ if (!__pyx_t_3) break;
+
+ /* "ctabix.pyx":738
+ *
+ * while not feof( self.infile ):
+ * nbytes = getline( &b, &self.size, self.infile) # <<<<<<<<<<<<<<
+ *
+ * # stop at first error or eof
+ */
+ __pyx_v_nbytes = getline((&__pyx_v_b), (&__pyx_v_self->size), __pyx_v_self->infile);
+
+ /* "ctabix.pyx":741
+ *
+ * # stop at first error or eof
+ * if (nbytes == -1): break # <<<<<<<<<<<<<<
+ * # skip comments
+ * if (b[0] == '#'): continue
+ */
+ __pyx_t_3 = (__pyx_v_nbytes == -1);
+ if (__pyx_t_3) {
+ goto __pyx_L4_break;
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "ctabix.pyx":743
+ * if (nbytes == -1): break
+ * # skip comments
+ * if (b[0] == '#'): continue # <<<<<<<<<<<<<<
+ *
+ * # skip empty lines
+ */
+ __pyx_t_3 = ((__pyx_v_b[0]) == '#');
+ if (__pyx_t_3) {
+ goto __pyx_L3_continue;
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "ctabix.pyx":746
+ *
+ * # skip empty lines
+ * if b[0] == '\0' or b[0] == '\n' or b[0] == '\r': continue # <<<<<<<<<<<<<<
+ *
+ * # make sure that entry is complete
+ */
+ __pyx_t_3 = ((__pyx_v_b[0]) == '\x00');
+ if (!__pyx_t_3) {
+ __pyx_t_4 = ((__pyx_v_b[0]) == '\n');
+ if (!__pyx_t_4) {
+ __pyx_t_5 = ((__pyx_v_b[0]) == '\r');
+ __pyx_t_6 = __pyx_t_5;
+ } else {
+ __pyx_t_6 = __pyx_t_4;
+ }
+ __pyx_t_4 = __pyx_t_6;
+ } else {
+ __pyx_t_4 = __pyx_t_3;
+ }
+ if (__pyx_t_4) {
+ goto __pyx_L3_continue;
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ /* "ctabix.pyx":749
+ *
+ * # make sure that entry is complete
+ * if b[nbytes-1] != '\n' and b[nbytes-1] != '\r': # <<<<<<<<<<<<<<
+ * result = b
+ * raise ValueError( "incomplete line at %s" % result )
+ */
+ __pyx_t_4 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\n');
+ if (__pyx_t_4) {
+ __pyx_t_3 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\r');
+ __pyx_t_6 = __pyx_t_3;
+ } else {
+ __pyx_t_6 = __pyx_t_4;
+ }
+ if (__pyx_t_6) {
+
+ /* "ctabix.pyx":750
+ * # make sure that entry is complete
+ * if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
+ * result = b # <<<<<<<<<<<<<<
+ * raise ValueError( "incomplete line at %s" % result )
+ *
+ */
+ __pyx_v_result = __pyx_v_b;
+
+ /* "ctabix.pyx":751
+ * if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
+ * result = b
+ * raise ValueError( "incomplete line at %s" % result ) # <<<<<<<<<<<<<<
+ *
+ * # make sure that this goes fully through C
+ */
+ __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;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __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;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __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;}
+ __Pyx_GOTREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ __pyx_t_1 = 0;
+ __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;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L8;
+ }
+ __pyx_L8:;
+
+ /* "ctabix.pyx":757
+ * # Python object causing segfaults as
+ * # the wrong memory is freed
+ * r.present( b, nbytes ) # <<<<<<<<<<<<<<
+ * return r
+ *
+ */
+ __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;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __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;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __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;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __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;}
+ __Pyx_GOTREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_2));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
+ PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ __pyx_t_2 = 0;
+ __pyx_t_7 = 0;
+ __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;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "ctabix.pyx":758
+ * # the wrong memory is freed
+ * r.present( b, nbytes )
+ * return r # <<<<<<<<<<<<<<
+ *
+ * raise StopIteration
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_r);
+ __pyx_r = __pyx_v_r;
+ goto __pyx_L0;
+ __pyx_L3_continue:;
+ }
+ __pyx_L4_break:;
+
+ /* "ctabix.pyx":760
+ * return r
+ *
+ * raise StopIteration # <<<<<<<<<<<<<<
+ *
+ * def __dealloc__(self):
+ */
+ __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_AddTraceback("ctabix.tabix_inplace_iterator.__cnext__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_r);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static void __pyx_pw_6ctabix_22tabix_inplace_iterator_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pw_6ctabix_22tabix_inplace_iterator_5__dealloc__(PyObject *__pyx_v_self) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
+ __pyx_pf_6ctabix_22tabix_inplace_iterator_4__dealloc__(((struct __pyx_obj_6ctabix_tabix_inplace_iterator *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+}
+
+/* "ctabix.pyx":762
+ * raise StopIteration
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * free(self.buffer)
+ *
+ */
+
+static void __pyx_pf_6ctabix_22tabix_inplace_iterator_4__dealloc__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__dealloc__", 0);
+
+ /* "ctabix.pyx":763
+ *
+ * def __dealloc__(self):
+ * free(self.buffer) # <<<<<<<<<<<<<<
+ *
+ * def __next__(self):
+ */
+ free(__pyx_v_self->buffer);
+
+ __Pyx_RefNannyFinishContext();
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6ctabix_22tabix_inplace_iterator_7__next__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_6ctabix_22tabix_inplace_iterator_7__next__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_6ctabix_22tabix_inplace_iterator_6__next__(((struct __pyx_obj_6ctabix_tabix_inplace_iterator *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "ctabix.pyx":765
+ * free(self.buffer)
+ *
+ * def __next__(self): # <<<<<<<<<<<<<<
+ * return self.__cnext__()
+ *
+ */
+
+static PyObject *__pyx_pf_6ctabix_22tabix_inplace_iterator_6__next__(struct __pyx_obj_6ctabix_tabix_inplace_iterator *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__next__", 0);
+
+ /* "ctabix.pyx":766
+ *
+ * def __next__(self):
+ * return self.__cnext__() # <<<<<<<<<<<<<<
+ *
+ * ctypedef class tabix_copy_iterator:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __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;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("ctabix.tabix_inplace_iterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static int __pyx_pw_6ctabix_19tabix_copy_iterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_6ctabix_19tabix_copy_iterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_infile = 0;
+ struct __pyx_obj_6ctabix_Parser *__pyx_v_parser = 0;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__infile,&__pyx_n_s__parser,0};
+ PyObject* values[2] = {0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ }
+ __pyx_v_infile = values[0];
+ __pyx_v_parser = ((struct __pyx_obj_6ctabix_Parser *)values[1]);
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __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;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("ctabix.tabix_copy_iterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return -1;
+ __pyx_L4_argument_unpacking_done:;
+ 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;}
+ __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);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "ctabix.pyx":777
+ * '''
+ *
+ * def __cinit__(self, infile, Parser parser ): # <<<<<<<<<<<<<<
+ *
+ * cdef int fd = PyObject_AsFileDescriptor( infile )
+ */
+
+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) {
+ int __pyx_v_fd;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__cinit__", 0);
+
+ /* "ctabix.pyx":779
+ * def __cinit__(self, infile, Parser parser ):
+ *
+ * cdef int fd = PyObject_AsFileDescriptor( infile ) # <<<<<<<<<<<<<<
+ * if fd == -1: raise ValueError( "I/O operation on closed file." )
+ * self.infile = fdopen( fd, 'r')
+ */
+ __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;}
+ __pyx_v_fd = __pyx_t_1;
+
+ /* "ctabix.pyx":780
+ *
+ * cdef int fd = PyObject_AsFileDescriptor( infile )
+ * if fd == -1: raise ValueError( "I/O operation on closed file." ) # <<<<<<<<<<<<<<
+ * self.infile = fdopen( fd, 'r')
+ * if self.infile == NULL: raise ValueError( "I/O operation on closed file." )
+ */
+ __pyx_t_2 = (__pyx_v_fd == -1);
+ if (__pyx_t_2) {
+ __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;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "ctabix.pyx":781
+ * cdef int fd = PyObject_AsFileDescriptor( infile )
+ * if fd == -1: raise ValueError( "I/O operation on closed file." )
+ * self.infile = fdopen( fd, 'r') # <<<<<<<<<<<<<<
+ * if self.infile == NULL: raise ValueError( "I/O operation on closed file." )
+ * self.parser = parser
+ */
+ __pyx_v_self->infile = fdopen(__pyx_v_fd, __pyx_k__r);
+
+ /* "ctabix.pyx":782
+ * if fd == -1: raise ValueError( "I/O operation on closed file." )
+ * self.infile = fdopen( fd, 'r')
+ * if self.infile == NULL: raise ValueError( "I/O operation on closed file." ) # <<<<<<<<<<<<<<
+ * self.parser = parser
+ *
+ */
+ __pyx_t_2 = (__pyx_v_self->infile == NULL);
+ if (__pyx_t_2) {
+ __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;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
+
+ /* "ctabix.pyx":783
+ * self.infile = fdopen( fd, 'r')
+ * if self.infile == NULL: raise ValueError( "I/O operation on closed file." )
+ * self.parser = parser # <<<<<<<<<<<<<<
+ *
+ * def __iter__(self):
+ */
+ __Pyx_INCREF(((PyObject *)__pyx_v_parser));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_parser));
+ __Pyx_GOTREF(__pyx_v_self->parser);
+ __Pyx_DECREF(((PyObject *)__pyx_v_self->parser));
+ __pyx_v_self->parser = __pyx_v_parser;
+
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("ctabix.tabix_copy_iterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6ctabix_19tabix_copy_iterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_6ctabix_19tabix_copy_iterator_3__iter__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_6ctabix_19tabix_copy_iterator_2__iter__(((struct __pyx_obj_6ctabix_tabix_copy_iterator *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "ctabix.pyx":785
+ * self.parser = parser
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * return self
+ *
+ */
+
+static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_2__iter__(struct __pyx_obj_6ctabix_tabix_copy_iterator *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__iter__", 0);
+
+ /* "ctabix.pyx":786
+ *
+ * def __iter__(self):
+ * return self # <<<<<<<<<<<<<<
+ *
+ * cdef __cnext__(self):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(((PyObject *)__pyx_v_self));
+ __pyx_r = ((PyObject *)__pyx_v_self);
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "ctabix.pyx":788
+ * return self
+ *
+ * cdef __cnext__(self): # <<<<<<<<<<<<<<
+ *
+ * cdef char * b
+ */
+
+static PyObject *__pyx_f_6ctabix_19tabix_copy_iterator___cnext__(struct __pyx_obj_6ctabix_tabix_copy_iterator *__pyx_v_self) {
+ char *__pyx_v_b;
+ size_t __pyx_v_nbytes;
+ char *__pyx_v_result;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__cnext__", 0);
+
+ /* "ctabix.pyx":794
+ * cdef int x
+ *
+ * b = NULL # <<<<<<<<<<<<<<
+ *
+ * while not feof( self.infile ):
+ */
+ __pyx_v_b = NULL;
+
+ /* "ctabix.pyx":796
+ * b = NULL
+ *
+ * while not feof( self.infile ): # <<<<<<<<<<<<<<
+ *
+ * # getline allocates on demand
+ */
+ while (1) {
+ __pyx_t_1 = (!feof(__pyx_v_self->infile));
+ if (!__pyx_t_1) break;
+
+ /* "ctabix.pyx":800
+ * # getline allocates on demand
+ * # return number of characters read excluding null byte
+ * nbytes = getline( &b, &nbytes, self.infile) # <<<<<<<<<<<<<<
+ * # stop at first error
+ * if (nbytes == -1): break
+ */
+ __pyx_v_nbytes = getline((&__pyx_v_b), (&__pyx_v_nbytes), __pyx_v_self->infile);
+
+ /* "ctabix.pyx":802
+ * nbytes = getline( &b, &nbytes, self.infile)
+ * # stop at first error
+ * if (nbytes == -1): break # <<<<<<<<<<<<<<
+ * # skip comments
+ * if (b[0] == '#'): continue
+ */
+ __pyx_t_1 = (__pyx_v_nbytes == -1);
+ if (__pyx_t_1) {
+ goto __pyx_L4_break;
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "ctabix.pyx":804
+ * if (nbytes == -1): break
+ * # skip comments
+ * if (b[0] == '#'): continue # <<<<<<<<<<<<<<
+ *
+ * # skip empty lines
+ */
+ __pyx_t_1 = ((__pyx_v_b[0]) == '#');
+ if (__pyx_t_1) {
+ goto __pyx_L3_continue;
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "ctabix.pyx":807
+ *
+ * # skip empty lines
+ * if b[0] == '\0' or b[0] == '\n' or b[0] == '\r': continue # <<<<<<<<<<<<<<
+ *
+ * # make sure that entry is complete
+ */
+ __pyx_t_1 = ((__pyx_v_b[0]) == '\x00');
+ if (!__pyx_t_1) {
+ __pyx_t_2 = ((__pyx_v_b[0]) == '\n');
+ if (!__pyx_t_2) {
+ __pyx_t_3 = ((__pyx_v_b[0]) == '\r');
+ __pyx_t_4 = __pyx_t_3;
+ } else {
+ __pyx_t_4 = __pyx_t_2;
+ }
+ __pyx_t_2 = __pyx_t_4;
+ } else {
+ __pyx_t_2 = __pyx_t_1;
+ }
+ if (__pyx_t_2) {
+ goto __pyx_L3_continue;
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ /* "ctabix.pyx":810
+ *
+ * # make sure that entry is complete
+ * if b[nbytes-1] != '\n' and b[nbytes-1] != '\r': # <<<<<<<<<<<<<<
+ * result = b
+ * free(b)
+ */
+ __pyx_t_2 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\n');
+ if (__pyx_t_2) {
+ __pyx_t_1 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\r');
+ __pyx_t_4 = __pyx_t_1;
+ } else {
+ __pyx_t_4 = __pyx_t_2;
+ }
+ if (__pyx_t_4) {
+
+ /* "ctabix.pyx":811
+ * # make sure that entry is complete
+ * if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
+ * result = b # <<<<<<<<<<<<<<
+ * free(b)
+ * raise ValueError( "incomplete line at %s" % result )
+ */
+ __pyx_v_result = __pyx_v_b;
+
+ /* "ctabix.pyx":812
+ * if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
+ * result = b
+ * free(b) # <<<<<<<<<<<<<<
+ * raise ValueError( "incomplete line at %s" % result )
+ *
+ */
+ free(__pyx_v_b);
+
+ /* "ctabix.pyx":813
+ * result = b
+ * free(b)
+ * raise ValueError( "incomplete line at %s" % result ) # <<<<<<<<<<<<<<
+ *
+ * # make sure that this goes fully through C
+ */
+ __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;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ __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;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
+ __pyx_t_6 = 0;
+ __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;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_t_6, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L8;
+ }
+ __pyx_L8:;
+
+ /* "ctabix.pyx":820
+ * # the wrong memory is freed
+ * # -1 to remove the new-line character
+ * return self.parser(b, nbytes) # <<<<<<<<<<<<<<
+ *
+ * free(b)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __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;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+ __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;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __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;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
+ PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_6 = 0;
+ __pyx_t_5 = 0;
+ __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;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+ __pyx_r = __pyx_t_5;
+ __pyx_t_5 = 0;
+ goto __pyx_L0;
+ __pyx_L3_continue:;
+ }
+ __pyx_L4_break:;
+
+ /* "ctabix.pyx":822
+ * return self.parser(b, nbytes)
+ *
+ * free(b) # <<<<<<<<<<<<<<
+ * raise StopIteration
+ *
+ */
+ free(__pyx_v_b);
+
+ /* "ctabix.pyx":823
+ *
+ * free(b)
+ * raise StopIteration # <<<<<<<<<<<<<<
+ *
+ * def __next__(self):
+ */
+ __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("ctabix.tabix_copy_iterator.__cnext__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6ctabix_19tabix_copy_iterator_5__next__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_6ctabix_19tabix_copy_iterator_5__next__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_6ctabix_19tabix_copy_iterator_4__next__(((struct __pyx_obj_6ctabix_tabix_copy_iterator *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "ctabix.pyx":825
+ * raise StopIteration
+ *
+ * def __next__(self): # <<<<<<<<<<<<<<
+ * return self.__cnext__()
+ *
+ */
+
+static PyObject *__pyx_pf_6ctabix_19tabix_copy_iterator_4__next__(struct __pyx_obj_6ctabix_tabix_copy_iterator *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__next__", 0);
+
+ /* "ctabix.pyx":826
+ *
+ * def __next__(self):
+ * return self.__cnext__() # <<<<<<<<<<<<<<
+ *
+ * class tabix_generic_iterator:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __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;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("ctabix.tabix_copy_iterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6ctabix_22tabix_generic_iterator___init__[] = "tabix_generic_iterator.__init__(self, infile, parser)";
+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__)};
+static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_self = 0;
+ PyObject *__pyx_v_infile = 0;
+ PyObject *__pyx_v_parser = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__infile,&__pyx_n_s__parser,0};
+ PyObject* values[3] = {0,0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ case 2:
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ 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;}
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+ }
+ __pyx_v_self = values[0];
+ __pyx_v_infile = values[1];
+ __pyx_v_parser = values[2];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __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;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("ctabix.tabix_generic_iterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_6ctabix_22tabix_generic_iterator___init__(__pyx_self, __pyx_v_self, __pyx_v_infile, __pyx_v_parser);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "ctabix.pyx":833
+ * Permits the use of file-like objects for example from the gzip module.
+ * '''
+ * def __init__(self, infile, parser ): # <<<<<<<<<<<<<<
+ *
+ * self.infile = infile
+ */
+
+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) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__init__", 0);
+
+ /* "ctabix.pyx":835
+ * def __init__(self, infile, parser ):
+ *
+ * self.infile = infile # <<<<<<<<<<<<<<
+ * if self.infile.closed: raise ValueError( "I/O operation on closed file." )
+ * self.parser = parser
+ */
+ 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;}
+
+ /* "ctabix.pyx":836
+ *
+ * self.infile = infile
+ * if self.infile.closed: raise ValueError( "I/O operation on closed file." ) # <<<<<<<<<<<<<<
+ * self.parser = parser
+ *
+ */
+ __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;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __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;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_3) {
+ __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;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_Raise(__pyx_t_2, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L3;
+ }
+ __pyx_L3:;
+
+ /* "ctabix.pyx":837
+ * self.infile = infile
+ * if self.infile.closed: raise ValueError( "I/O operation on closed file." )
+ * self.parser = parser # <<<<<<<<<<<<<<
+ *
+ * def __iter__(self):
+ */
+ 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;}
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("ctabix.tabix_generic_iterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_3__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_6ctabix_22tabix_generic_iterator_2__iter__[] = "tabix_generic_iterator.__iter__(self)";
+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__)};
+static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_3__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_6ctabix_22tabix_generic_iterator_2__iter__(__pyx_self, ((PyObject *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "ctabix.pyx":839
+ * self.parser = parser
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * return self
+ *
+ */
+
+static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_2__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__iter__", 0);
+
+ /* "ctabix.pyx":840
+ *
+ * def __iter__(self):
+ * return self # <<<<<<<<<<<<<<
+ *
+ * # cython version - required for python 3
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_self);
+ __pyx_r = __pyx_v_self;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_5__next__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_6ctabix_22tabix_generic_iterator_4__next__[] = "tabix_generic_iterator.__next__(self)";
+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__)};
+static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_5__next__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
+ __pyx_r = __pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(__pyx_self, ((PyObject *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "ctabix.pyx":843
+ *
+ * # cython version - required for python 3
+ * def __next__(self): # <<<<<<<<<<<<<<
+ *
+ * cdef char * b, * cpy
+ */
+
+static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_4__next__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
+ char *__pyx_v_b;
+ char *__pyx_v_cpy;
+ size_t __pyx_v_nbytes;
+ PyObject *__pyx_v_line = NULL;
+ PyObject *__pyx_v_s = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ char *__pyx_t_5;
+ Py_ssize_t __pyx_t_6;
+ int __pyx_t_7;
+ int __pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__next__", 0);
+
+ /* "ctabix.pyx":847
+ * cdef char * b, * cpy
+ * cdef size_t nbytes
+ * while 1: # <<<<<<<<<<<<<<
+ *
+ * line = self.infile.readline()
+ */
+ while (1) {
+ if (!1) break;
+
+ /* "ctabix.pyx":849
+ * while 1:
+ *
+ * line = self.infile.readline() # <<<<<<<<<<<<<<
+ * if not line: break
+ *
+ */
+ __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;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __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;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __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;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_v_line);
+ __pyx_v_line = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "ctabix.pyx":850
+ *
+ * line = self.infile.readline()
+ * if not line: break # <<<<<<<<<<<<<<
+ *
+ * s = _force_bytes( line )
+ */
+ __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;}
+ __pyx_t_4 = (!__pyx_t_3);
+ if (__pyx_t_4) {
+ goto __pyx_L4_break;
+ goto __pyx_L5;
+ }
+ __pyx_L5:;
+
+ /* "ctabix.pyx":852
+ * if not line: break
+ *
+ * s = _force_bytes( line ) # <<<<<<<<<<<<<<
+ * b = s
+ * nbytes = len( line )
+ */
+ __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;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_XDECREF(((PyObject *)__pyx_v_s));
+ __pyx_v_s = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "ctabix.pyx":853
+ *
+ * s = _force_bytes( line )
+ * b = s # <<<<<<<<<<<<<<
+ * nbytes = len( line )
+ * assert b[nbytes] == '\0'
+ */
+ __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;}
+ __pyx_v_b = __pyx_t_5;
+
+ /* "ctabix.pyx":854
+ * s = _force_bytes( line )
+ * b = s
+ * nbytes = len( line ) # <<<<<<<<<<<<<<
+ * assert b[nbytes] == '\0'
+ *
+ */
+ __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;}
+ __pyx_v_nbytes = __pyx_t_6;
+
+ /* "ctabix.pyx":855
+ * b = s
+ * nbytes = len( line )
+ * assert b[nbytes] == '\0' # <<<<<<<<<<<<<<
+ *
+ * # skip comments
+ */
+ #ifndef CYTHON_WITHOUT_ASSERTIONS
+ if (unlikely(!((__pyx_v_b[__pyx_v_nbytes]) == '\x00'))) {
+ PyErr_SetNone(PyExc_AssertionError);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ #endif
+
+ /* "ctabix.pyx":858
+ *
+ * # skip comments
+ * if (b[0] == '#'): continue # <<<<<<<<<<<<<<
+ *
+ * # skip empty lines
+ */
+ __pyx_t_4 = ((__pyx_v_b[0]) == '#');
+ if (__pyx_t_4) {
+ goto __pyx_L3_continue;
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "ctabix.pyx":861
+ *
+ * # skip empty lines
+ * if b[0] == '\0' or b[0] == '\n' or b[0] == '\r': continue # <<<<<<<<<<<<<<
+ *
+ * # make sure that entry is complete
+ */
+ __pyx_t_4 = ((__pyx_v_b[0]) == '\x00');
+ if (!__pyx_t_4) {
+ __pyx_t_3 = ((__pyx_v_b[0]) == '\n');
+ if (!__pyx_t_3) {
+ __pyx_t_7 = ((__pyx_v_b[0]) == '\r');
+ __pyx_t_8 = __pyx_t_7;
+ } else {
+ __pyx_t_8 = __pyx_t_3;
+ }
+ __pyx_t_3 = __pyx_t_8;
+ } else {
+ __pyx_t_3 = __pyx_t_4;
+ }
+ if (__pyx_t_3) {
+ goto __pyx_L3_continue;
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ /* "ctabix.pyx":864
+ *
+ * # make sure that entry is complete
+ * if b[nbytes-1] != '\n' and b[nbytes-1] != '\r': # <<<<<<<<<<<<<<
+ * raise ValueError( "incomplete line at %s" % line )
+ *
+ */
+ __pyx_t_3 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\n');
+ if (__pyx_t_3) {
+ __pyx_t_4 = ((__pyx_v_b[(__pyx_v_nbytes - 1)]) != '\r');
+ __pyx_t_8 = __pyx_t_4;
+ } else {
+ __pyx_t_8 = __pyx_t_3;
+ }
+ if (__pyx_t_8) {
+
+ /* "ctabix.pyx":865
+ * # make sure that entry is complete
+ * if b[nbytes-1] != '\n' and b[nbytes-1] != '\r':
+ * raise ValueError( "incomplete line at %s" % line ) # <<<<<<<<<<<<<<
+ *
+ * # create a copy
+ */
+ __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;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __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;}
+ __Pyx_GOTREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ __pyx_t_1 = 0;
+ __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;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_Raise(__pyx_t_1, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L8;
+ }
+ __pyx_L8:;
+
+ /* "ctabix.pyx":868
+ *
+ * # create a copy
+ * cpy = <char*>malloc(nbytes+1) # <<<<<<<<<<<<<<
+ * if cpy == NULL: raise MemoryError()
+ * memcpy( cpy, b, nbytes+1)
+ */
+ __pyx_v_cpy = ((char *)malloc((__pyx_v_nbytes + 1)));
+
+ /* "ctabix.pyx":869
+ * # create a copy
+ * cpy = <char*>malloc(nbytes+1)
+ * if cpy == NULL: raise MemoryError() # <<<<<<<<<<<<<<
+ * memcpy( cpy, b, nbytes+1)
+ *
+ */
+ __pyx_t_8 = (__pyx_v_cpy == NULL);
+ if (__pyx_t_8) {
+ PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L9;
+ }
+ __pyx_L9:;
+
+ /* "ctabix.pyx":870
+ * cpy = <char*>malloc(nbytes+1)
+ * if cpy == NULL: raise MemoryError()
+ * memcpy( cpy, b, nbytes+1) # <<<<<<<<<<<<<<
+ *
+ * return self.parser(cpy, nbytes)
+ */
+ memcpy(__pyx_v_cpy, __pyx_v_b, (__pyx_v_nbytes + 1));
+
+ /* "ctabix.pyx":872
+ * memcpy( cpy, b, nbytes+1)
+ *
+ * return self.parser(cpy, nbytes) # <<<<<<<<<<<<<<
+ *
+ * raise StopIteration
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __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;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __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;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __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;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __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;}
+ __Pyx_GOTREF(__pyx_t_10);
+ PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_2));
+ __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
+ PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
+ __Pyx_GIVEREF(__pyx_t_9);
+ __pyx_t_2 = 0;
+ __pyx_t_9 = 0;
+ __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;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
+ __pyx_r = __pyx_t_9;
+ __pyx_t_9 = 0;
+ goto __pyx_L0;
+ __pyx_L3_continue:;
+ }
+ __pyx_L4_break:;
+
+ /* "ctabix.pyx":874
+ * return self.parser(cpy, nbytes)
+ *
+ * raise StopIteration # <<<<<<<<<<<<<<
+ *
+ * # python version - required for python 2.7
+ */
+ __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_AddTraceback("ctabix.tabix_generic_iterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_line);
+ __Pyx_XDECREF(__pyx_v_s);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_7next(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
+static char __pyx_doc_6ctabix_22tabix_generic_iterator_6next[] = "tabix_generic_iterator.next(self)";
+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)};
+static PyObject *__pyx_pw_6ctabix_22tabix_generic_iterator_7next(PyObject *__pyx_self, PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("next (wrapper)", 0);
+ __pyx_r = __pyx_pf_6ctabix_22tabix_generic_iterator_6next(__pyx_self, ((PyObject *)__pyx_v_self));
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "ctabix.pyx":877
+ *
+ * # python version - required for python 2.7
+ * def next(self): # <<<<<<<<<<<<<<
+ * return self.__next__()
+ *
+ */
+
+static PyObject *__pyx_pf_6ctabix_22tabix_generic_iterator_6next(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("next", 0);
+
+ /* "ctabix.pyx":878
+ * # python version - required for python 2.7
+ * def next(self):
+ * return self.__next__() # <<<<<<<<<<<<<<
+ *
+ * def tabix_iterator( infile, parser ):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __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;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __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;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("ctabix.tabix_generic_iterator.next", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6ctabix_5tabix_iterator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6ctabix_4tabix_iterator[] = "tabix_iterator(infile, parser)\nreturn an iterator over all entries in a file.";
+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)};
+static PyObject *__pyx_pw_6ctabix_5tabix_iterator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_infile = 0;
+ PyObject *__pyx_v_parser = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("tabix_iterator (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__infile,&__pyx_n_s__parser,0};
+ PyObject* values[2] = {0,0};
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__infile)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser)) != 0)) kw_args--;
+ else {
+ __Pyx_RaiseArgtupleInvalid("tabix_iterator", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ 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;}
+ }
+ } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ }
+ __pyx_v_infile = values[0];
+ __pyx_v_parser = values[1];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __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;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("ctabix.tabix_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_6ctabix_4tabix_iterator(__pyx_self, __pyx_v_infile, __pyx_v_parser);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "ctabix.pyx":880
+ * return self.__next__()
+ *
+ * def tabix_iterator( infile, parser ): # <<<<<<<<<<<<<<
+ * """return an iterator over all entries in a file."""
+ * return tabix_generic_iterator( infile, parser )
+ */
+
+static PyObject *__pyx_pf_6ctabix_4tabix_iterator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_infile, PyObject *__pyx_v_parser) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("tabix_iterator", 0);
+
+ /* "ctabix.pyx":882
+ * def tabix_iterator( infile, parser ):
+ * """return an iterator over all entries in a file."""
+ * return tabix_generic_iterator( infile, parser ) # <<<<<<<<<<<<<<
+ * # file objects can use C stdio
+ * # used to be: isinstance( infile, file):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __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;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __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;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_v_infile);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_infile);
+ __Pyx_GIVEREF(__pyx_v_infile);
+ __Pyx_INCREF(__pyx_v_parser);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_parser);
+ __Pyx_GIVEREF(__pyx_v_parser);
+ __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;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("ctabix.tabix_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_tp_new_6ctabix_Tabixfile(PyTypeObject *t, PyObject *a, PyObject *k) {
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ if (__pyx_pw_6ctabix_9Tabixfile_1__cinit__(o, a, k) < 0) {
+ Py_DECREF(o); o = 0;
+ }
+ return o;
+}
+
+static void __pyx_tp_dealloc_6ctabix_Tabixfile(PyObject *o) {
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_6ctabix_9Tabixfile_13__dealloc__(o);
+ if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static PyObject *__pyx_getprop_6ctabix_9Tabixfile_filename(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_6ctabix_9Tabixfile_8filename_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_6ctabix_9Tabixfile_header(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_6ctabix_9Tabixfile_6header_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_6ctabix_9Tabixfile_contigs(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_6ctabix_9Tabixfile_7contigs_1__get__(o);
+}
+
+static PyMethodDef __pyx_methods_6ctabix_Tabixfile[] = {
+ {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pw_6ctabix_9Tabixfile_3_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_2_isOpen)},
+ {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pw_6ctabix_9Tabixfile_5_open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_4_open)},
+ {__Pyx_NAMESTR("_parseRegion"), (PyCFunction)__pyx_pw_6ctabix_9Tabixfile_7_parseRegion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_6_parseRegion)},
+ {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pw_6ctabix_9Tabixfile_9fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_8fetch)},
+ {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_6ctabix_9Tabixfile_11close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_10close)},
+ {0, 0, 0, 0}
+};
+
+static struct PyGetSetDef __pyx_getsets_6ctabix_Tabixfile[] = {
+ {(char *)"filename", __pyx_getprop_6ctabix_9Tabixfile_filename, 0, __Pyx_DOCSTR(__pyx_k_57), 0},
+ {(char *)"header", __pyx_getprop_6ctabix_9Tabixfile_header, 0, __Pyx_DOCSTR(__pyx_k_58), 0},
+ {(char *)"contigs", __pyx_getprop_6ctabix_9Tabixfile_contigs, 0, __Pyx_DOCSTR(__pyx_k_59), 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number_Tabixfile = {
+ 0, /*nb_add*/
+ 0, /*nb_subtract*/
+ 0, /*nb_multiply*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_divide*/
+ #endif
+ 0, /*nb_remainder*/
+ 0, /*nb_divmod*/
+ 0, /*nb_power*/
+ 0, /*nb_negative*/
+ 0, /*nb_positive*/
+ 0, /*nb_absolute*/
+ 0, /*nb_nonzero*/
+ 0, /*nb_invert*/
+ 0, /*nb_lshift*/
+ 0, /*nb_rshift*/
+ 0, /*nb_and*/
+ 0, /*nb_xor*/
+ 0, /*nb_or*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_coerce*/
+ #endif
+ 0, /*nb_int*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_long*/
+ #else
+ 0, /*reserved*/
+ #endif
+ 0, /*nb_float*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_oct*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_hex*/
+ #endif
+ 0, /*nb_inplace_add*/
+ 0, /*nb_inplace_subtract*/
+ 0, /*nb_inplace_multiply*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_inplace_divide*/
+ #endif
+ 0, /*nb_inplace_remainder*/
+ 0, /*nb_inplace_power*/
+ 0, /*nb_inplace_lshift*/
+ 0, /*nb_inplace_rshift*/
+ 0, /*nb_inplace_and*/
+ 0, /*nb_inplace_xor*/
+ 0, /*nb_inplace_or*/
+ 0, /*nb_floor_divide*/
+ 0, /*nb_true_divide*/
+ 0, /*nb_inplace_floor_divide*/
+ 0, /*nb_inplace_true_divide*/
+ #if PY_VERSION_HEX >= 0x02050000
+ 0, /*nb_index*/
+ #endif
+};
+
+static PySequenceMethods __pyx_tp_as_sequence_Tabixfile = {
+ 0, /*sq_length*/
+ 0, /*sq_concat*/
+ 0, /*sq_repeat*/
+ 0, /*sq_item*/
+ 0, /*sq_slice*/
+ 0, /*sq_ass_item*/
+ 0, /*sq_ass_slice*/
+ 0, /*sq_contains*/
+ 0, /*sq_inplace_concat*/
+ 0, /*sq_inplace_repeat*/
+};
+
+static PyMappingMethods __pyx_tp_as_mapping_Tabixfile = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer_Tabixfile = {
+ #if PY_MAJOR_VERSION < 3
+ 0, /*bf_getreadbuffer*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*bf_getwritebuffer*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*bf_getsegcount*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*bf_getcharbuffer*/
+ #endif
+ #if PY_VERSION_HEX >= 0x02060000
+ 0, /*bf_getbuffer*/
+ #endif
+ #if PY_VERSION_HEX >= 0x02060000
+ 0, /*bf_releasebuffer*/
+ #endif
+};
+
+static PyTypeObject __pyx_type_6ctabix_Tabixfile = {
+ PyVarObject_HEAD_INIT(0, 0)
+ __Pyx_NAMESTR("ctabix.Tabixfile"), /*tp_name*/
+ sizeof(struct __pyx_obj_6ctabix_Tabixfile), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_6ctabix_Tabixfile, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*tp_compare*/
+ #else
+ 0, /*reserved*/
+ #endif
+ 0, /*tp_repr*/
+ &__pyx_tp_as_number_Tabixfile, /*tp_as_number*/
+ &__pyx_tp_as_sequence_Tabixfile, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_Tabixfile, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ &__pyx_tp_as_buffer_Tabixfile, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ __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*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_6ctabix_Tabixfile, /*tp_methods*/
+ 0, /*tp_members*/
+ __pyx_getsets_6ctabix_Tabixfile, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ 0, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_6ctabix_Tabixfile, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ #if PY_VERSION_HEX >= 0x02060000
+ 0, /*tp_version_tag*/
+ #endif
+};
+
+static PyObject *__pyx_tp_new_6ctabix_TabixIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
+ PyObject *o = (*t->tp_alloc)(t, 0);
+ if (!o) return 0;
+ if (__pyx_pw_6ctabix_13TabixIterator_1__cinit__(o, a, k) < 0) {
+ Py_DECREF(o); o = 0;
+ }
+ return o;
+}
+
+static void __pyx_tp_dealloc_6ctabix_TabixIterator(PyObject *o) {
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_6ctabix_13TabixIterator_7__dealloc__(o);
+ if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static PyMethodDef __pyx_methods_6ctabix_TabixIterator[] = {
+ {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_6ctabix_13TabixIterator_5__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_13TabixIterator_4__next__)},
+ {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number_TabixIterator = {
+ 0, /*nb_add*/
+ 0, /*nb_subtract*/
+ 0, /*nb_multiply*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_divide*/
+ #endif
+ 0, /*nb_remainder*/
+ 0, /*nb_divmod*/
+ 0, /*nb_power*/
+ 0, /*nb_negative*/
+ 0, /*nb_positive*/
+ 0, /*nb_absolute*/
+ 0, /*nb_nonzero*/
+ 0, /*nb_invert*/
+ 0, /*nb_lshift*/
+ 0, /*nb_rshift*/
+ 0, /*nb_and*/
+ 0, /*nb_xor*/
+ 0, /*nb_or*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_coerce*/
+ #endif
+ 0, /*nb_int*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_long*/
+ #else
+ 0, /*reserved*/
+ #endif
+ 0, /*nb_float*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_oct*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_hex*/
+ #endif
+ 0, /*nb_inplace_add*/
+ 0, /*nb_inplace_subtract*/
+ 0, /*nb_inplace_multiply*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_inplace_divide*/
+ #endif
+ 0, /*nb_inplace_remainder*/
+ 0, /*nb_inplace_power*/
+ 0, /*nb_inplace_lshift*/
+ 0, /*nb_inplace_rshift*/
+ 0, /*nb_inplace_and*/
+ 0, /*nb_inplace_xor*/
+ 0, /*nb_inplace_or*/
+ 0, /*nb_floor_divide*/
+ 0, /*nb_true_divide*/
+ 0, /*nb_inplace_floor_divide*/
+ 0, /*nb_inplace_true_divide*/
+ #if PY_VERSION_HEX >= 0x02050000
+ 0, /*nb_index*/
+ #endif
+};
+
+static PySequenceMethods __pyx_tp_as_sequence_TabixIterator = {
+ 0, /*sq_length*/
+ 0, /*sq_concat*/
+ 0, /*sq_repeat*/
+ 0, /*sq_item*/
+ 0, /*sq_slice*/
+ 0, /*sq_ass_item*/
+ 0, /*sq_ass_slice*/
+ 0, /*sq_contains*/
+ 0, /*sq_inplace_concat*/
+ 0, /*sq_inplace_repeat*/
+};
+
+static PyMappingMethods __pyx_tp_as_mapping_TabixIterator = {
+ 0, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};