comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/site-packages/pysam/libctabix.pxd @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
comparison
equal deleted inserted replaced
67:0e9998148a16 69:33d812a61356
1 # cython: language_level=3
2 from libc.stdint cimport int8_t, int16_t, int32_t, int64_t
3 from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t
4 from libc.stdlib cimport malloc, calloc, realloc, free
5 from libc.string cimport memcpy, memcmp, strncpy, strlen, strdup
6 from libc.stdio cimport FILE, printf
7
8 # Note: this replaces python "open"!
9 cdef extern from "fcntl.h":
10 int open(char *pathname, int flags)
11
12 cdef extern from "unistd.h" nogil:
13 ctypedef int ssize_t
14 ssize_t read(int fd, void *buf, size_t count)
15 int close(int fd)
16
17 from pysam.libchtslib cimport hts_idx_t, hts_itr_t, htsFile, \
18 tbx_t, kstring_t, BGZF, HTSFile
19
20
21 # These functions are put here and not in chtslib.pxd in order
22 # to avoid warnings for unused functions.
23 cdef extern from "pysam_stream.h" nogil:
24
25 ctypedef struct kstream_t:
26 pass
27
28 ctypedef struct kseq_t:
29 kstring_t name
30 kstring_t comment
31 kstring_t seq
32 kstring_t qual
33
34 kseq_t *kseq_init(BGZF *)
35 int kseq_read(kseq_t *)
36 void kseq_destroy(kseq_t *)
37 kstream_t *ks_init(BGZF *)
38 void ks_destroy(kstream_t *)
39
40 # Retrieve characters from stream until delimiter
41 # is reached placing results in str.
42 int ks_getuntil(kstream_t *,
43 int delimiter,
44 kstring_t * str,
45 int * dret)
46
47
48 cdef class tabix_file_iterator:
49 cdef BGZF * fh
50 cdef kstream_t * kstream
51 cdef kstring_t buffer
52 cdef size_t size
53 cdef Parser parser
54 cdef int fd
55 cdef int duplicated_fd
56 cdef infile
57
58 cdef __cnext__(self)
59
60
61 cdef class TabixFile(HTSFile):
62 # pointer to index structure
63 cdef tbx_t * index
64
65 cdef readonly object filename_index
66
67 cdef Parser parser
68
69 cdef encoding
70
71
72 cdef class Parser:
73 cdef encoding
74 cdef parse(self, char * buffer, int len)
75
76
77 cdef class asTuple(Parser):
78 cdef parse(self, char * buffer, int len)
79
80
81 cdef class asGTF(Parser):
82 pass
83
84
85 cdef class asGFF3(Parser):
86 pass
87
88
89 cdef class asBed(Parser):
90 pass
91
92
93 cdef class asVCF(Parser):
94 pass
95
96
97 cdef class TabixIterator:
98 cdef hts_itr_t * iterator
99 cdef TabixFile tabixfile
100 cdef kstring_t buffer
101 cdef encoding
102 cdef int __cnext__(self)
103
104
105 cdef class TabixIteratorParsed(TabixIterator):
106 cdef Parser parser
107
108
109 cdef class GZIterator:
110 cdef object _filename
111 cdef BGZF * gzipfile
112 cdef kstream_t * kstream
113 cdef kstring_t buffer
114 cdef int __cnext__(self)
115 cdef encoding
116
117
118 cdef class GZIteratorHead(GZIterator):
119 pass
120
121
122 cdef class GZIteratorParsed(GZIterator):
123 cdef Parser parser
124
125
126 # Compatibility Layer for pysam < 0.8
127 cdef class Tabixfile(TabixFile):
128 pass