Imported Upstream version 0.7
[pysam.git] / pysam / ctabix.pxd
index ef735b64f9230f8851b1ab147a77fcad2835ce1b..a14016985a8eead0139c90b71d9bdb4ceae7d0b9 100644 (file)
@@ -76,7 +76,6 @@ cdef extern from "stdint.h":
 
 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)
@@ -84,6 +83,7 @@ cdef extern from "Python.h":
     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":
 
@@ -101,9 +101,14 @@ 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
@@ -113,11 +118,6 @@ cdef extern from "tabix.h":
   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)
@@ -135,7 +135,6 @@ cdef extern from "tabix.h":
   #    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)
@@ -169,3 +168,55 @@ cdef extern from "tabix.h":
 
   #  /* 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)
+