comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/site-packages/pysam/libcbcf.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 ###############################################################################
3 ###############################################################################
4 ## Cython wrapper for htslib VCF/BCF reader/writer
5 ###############################################################################
6 #
7 # The MIT License
8 #
9 # Copyright (c) 2015, 2016 Kevin Jacobs (jacobs@bioinformed.com)
10 #
11 # Permission is hereby granted, free of charge, to any person obtaining a
12 # copy of this software and associated documentation files (the "Software"),
13 # to deal in the Software without restriction, including without limitation
14 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 # and/or sell copies of the Software, and to permit persons to whom the
16 # Software is furnished to do so, subject to the following conditions:
17 #
18 # The above copyright notice and this permission notice shall be included in
19 # all copies or substantial portions of the Software.
20 #
21 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 # DEALINGS IN THE SOFTWARE.
28 #
29 ###############################################################################
30
31 from libc.stdint cimport int8_t, int16_t, int32_t, int64_t
32 from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t
33 from libc.stdlib cimport malloc, calloc, realloc, free
34 from libc.string cimport memcpy, memcmp, memmove, strncpy, strlen, strdup
35
36 from pysam.libchtslib cimport *
37
38
39 cdef class VariantHeader(object):
40 cdef bcf_hdr_t *ptr
41
42 cdef _add_sample(self, name)
43 cdef _hdr_sync(self)
44 cdef _subset_samples(self, include_samples)
45
46
47 cdef class VariantHeaderRecord(object):
48 cdef readonly VariantHeader header
49 cdef bcf_hrec_t *ptr
50
51
52 cdef class VariantHeaderRecords(object):
53 cdef readonly VariantHeader header
54
55
56 cdef class VariantHeaderContigs(object):
57 cdef readonly VariantHeader header
58
59
60 cdef class VariantHeaderSamples(object):
61 cdef readonly VariantHeader header
62
63
64 cdef class VariantContig(object):
65 cdef readonly VariantHeader header
66 cdef int id
67
68
69 cdef class VariantMetadata(object):
70 cdef readonly VariantHeader header
71 cdef int type
72 cdef int id
73
74
75 cdef class VariantHeaderMetadata(object):
76 cdef readonly VariantHeader header
77 cdef int32_t type
78
79
80 cdef class VariantRecord(object):
81 cdef readonly VariantHeader header
82 cdef bcf1_t *ptr
83
84
85 cdef class VariantRecordFilter(object):
86 cdef VariantRecord record
87
88
89 cdef class VariantRecordFormat(object):
90 cdef VariantRecord record
91
92
93 cdef class VariantRecordInfo(object):
94 cdef VariantRecord record
95
96
97 cdef class VariantRecordSamples(object):
98 cdef VariantRecord record
99
100
101 cdef class VariantRecordSample(object):
102 cdef VariantRecord record
103 cdef readonly int32_t index
104
105
106 cdef class BaseIndex(object):
107 cdef tuple refs
108 cdef dict refmap
109
110
111 cdef class BCFIndex(BaseIndex):
112 cdef readonly VariantHeader header
113 cdef hts_idx_t *ptr
114
115
116 cdef class TabixIndex(BaseIndex):
117 cdef tbx_t *ptr
118
119
120 cdef class BaseIterator(object):
121 cdef VariantFile bcf
122 cdef hts_itr_t *iter
123
124
125 cdef class BCFIterator(BaseIterator):
126 cdef BCFIndex index
127
128
129 cdef class TabixIterator(BaseIterator):
130 cdef TabixIndex index
131 cdef kstring_t line_buffer
132
133
134 cdef class VariantFile(HTSFile):
135 cdef readonly VariantHeader header
136 cdef readonly BaseIndex index
137
138 cdef readonly bint drop_samples # true if sample information is to be ignored
139
140 # FIXME: Temporary, use htsFormat when it is available
141 cdef readonly bint is_reading # true if file has begun reading records
142 cdef readonly bint header_written # true if header has already been written
143
144 cpdef int write(self, VariantRecord record) except -1