cdef extern from "Python.h":
ctypedef struct FILE
- FILE* PyFile_AsFile(object)
char *fgets(char *str, int size, FILE *ifile)
int feof(FILE *stream)
size_t strlen(char *s)
char *strstr(char *, char *)
char *strchr(char *string, int c)
int fileno(FILE *stream)
+ FILE *fdopen(int fd, char *mode)
cdef extern from "bgzf.h":
# tabix support
cdef extern from "tabix.h":
- ctypedef struct ti_index_t:
- pass
+ ctypedef struct ti_conf_t:
+ int32_t preset
+ int32_t sc, bc, ec
+ int32_t meta_char, line_skip
+ ctypedef struct ti_index_t:
+ pass
+
ctypedef struct tabix_t:
BGZF *fp
ti_index_t *idx
ctypedef struct ti_iter_t:
pass
- ctypedef struct ti_conf_t:
- int32_t preset
- int32_t sc, bc, ec
- int32_t meta_char, line_skip
-
tabix_t *ti_open(char *fn, char *fnidx)
int ti_lazy_index_load(tabix_t *t)
# pointer should be freed by a single free() call by the routine
# calling this function. The number of sequences is returned at *n
char **ti_seqname(ti_index_t *idx, int *n)
-
# Destroy the iterator
void ti_iter_destroy(ti_iter_t iter)
# /* Get the data line pointed by the iterator and iterate to the next record. */
# char *ti_iter_read(BGZF *fp, ti_iter_t iter, int *len)
+
+cdef class Tabixfile:
+
+ # pointer to tabixfile
+ cdef tabix_t * tabixfile
+
+ # flag indicating whether file is remote
+ cdef int isremote
+
+ cdef char * _filename
+
+cdef class TabixIterator:
+ cdef ti_iter_t iterator
+ cdef tabix_t * tabixfile
+
+cdef class TabixHeaderIterator:
+ cdef ti_iter_t iterator
+ cdef tabix_t * tabixfile
+
+cdef class Parser:
+ pass
+
+cdef class asTuple(Parser):
+ pass
+
+cdef class asGTF(Parser):
+ pass
+
+cdef class asBed(Parser):
+ pass
+
+cdef class asVCF(Parser):
+ pass
+
+cdef class TabixIteratorParsed:
+ cdef ti_iter_t iterator
+ cdef tabix_t * tabixfile
+ cdef Parser parser
+
+ctypedef class tabix_inplace_iterator:
+ cdef FILE * infile
+ cdef char * buffer
+ cdef size_t size
+ cdef Parser parser
+
+ cdef __cnext__(self)
+
+ctypedef class tabix_copy_iterator:
+ cdef FILE * infile
+ cdef Parser parser
+ cdef __cnext__(self)
+