htslib 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -7
- data/lib/hts/bam/aux.rb +1 -0
- data/lib/hts/bam/cigar.rb +5 -7
- data/lib/hts/bam/flag.rb +5 -0
- data/lib/hts/bam/header.rb +1 -0
- data/lib/hts/bam/record.rb +7 -4
- data/lib/hts/bam.rb +82 -21
- data/lib/hts/bcf/format.rb +4 -4
- data/lib/hts/bcf/header.rb +1 -0
- data/lib/hts/bcf/info.rb +3 -2
- data/lib/hts/bcf/record.rb +30 -29
- data/lib/hts/bcf.rb +106 -26
- data/lib/hts/faidx.rb +24 -14
- data/lib/hts/hts.rb +49 -2
- data/lib/hts/libhts/bgzf.rb +5 -5
- data/lib/hts/libhts/constants.rb +26 -5
- data/lib/hts/libhts/cram.rb +287 -279
- data/lib/hts/libhts/hfile.rb +29 -11
- data/lib/hts/libhts/hts.rb +158 -25
- data/lib/hts/libhts/sam.rb +683 -94
- data/lib/hts/libhts/sam_funcs.rb +92 -588
- data/lib/hts/libhts/vcf.rb +433 -234
- data/lib/hts/libhts/vcf_funcs.rb +232 -424
- data/lib/hts/libhts.rb +1 -0
- data/lib/hts/tbx.rb +3 -4
- data/lib/hts/version.rb +1 -1
- metadata +3 -3
data/lib/hts/libhts/vcf.rb
CHANGED
@@ -1,240 +1,439 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "vcf_funcs"
|
4
|
-
|
5
3
|
module HTS
|
6
4
|
module LibHTS
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
5
|
+
attach_function \
|
6
|
+
:bcf_hdr_init,
|
7
|
+
[:string],
|
8
|
+
BcfHdr.by_ref
|
9
|
+
|
10
|
+
attach_function \
|
11
|
+
:bcf_hdr_destroy,
|
12
|
+
[BcfHdr],
|
13
|
+
:void
|
14
|
+
|
15
|
+
attach_function \
|
16
|
+
:bcf_init,
|
17
|
+
[],
|
18
|
+
Bcf1.by_ref
|
19
|
+
|
20
|
+
attach_function \
|
21
|
+
:bcf_destroy,
|
22
|
+
[Bcf1],
|
23
|
+
:void
|
24
|
+
|
25
|
+
attach_function \
|
26
|
+
:bcf_empty,
|
27
|
+
[Bcf1],
|
28
|
+
:void
|
29
|
+
|
30
|
+
attach_function \
|
31
|
+
:bcf_clear,
|
32
|
+
[Bcf1],
|
33
|
+
:void
|
34
|
+
|
35
|
+
attach_function \
|
36
|
+
:bcf_hdr_read,
|
37
|
+
[HtsFile],
|
38
|
+
BcfHdr.by_ref
|
39
|
+
|
40
|
+
attach_function \
|
41
|
+
:bcf_hdr_set_samples,
|
42
|
+
[BcfHdr, :string, :int],
|
43
|
+
:int
|
44
|
+
|
45
|
+
attach_function \
|
46
|
+
:bcf_subset_format,
|
47
|
+
[BcfHdr, Bcf1],
|
48
|
+
:int
|
49
|
+
|
50
|
+
attach_function \
|
51
|
+
:bcf_hdr_write,
|
52
|
+
[HtsFile, BcfHdr],
|
53
|
+
:int
|
54
|
+
|
55
|
+
attach_function \
|
56
|
+
:vcf_parse,
|
57
|
+
[KString, BcfHdr, Bcf1],
|
58
|
+
:int
|
59
|
+
|
60
|
+
attach_function \
|
61
|
+
:vcf_open_mode,
|
62
|
+
%i[string string string],
|
63
|
+
:int
|
64
|
+
|
65
|
+
attach_function \
|
66
|
+
:vcf_format,
|
67
|
+
[BcfHdr, Bcf1, KString],
|
68
|
+
:int
|
69
|
+
|
70
|
+
attach_function \
|
71
|
+
:bcf_read,
|
72
|
+
[HtsFile, BcfHdr, Bcf1],
|
73
|
+
:int
|
74
|
+
|
75
|
+
attach_function \
|
76
|
+
:bcf_unpack,
|
77
|
+
[Bcf1, :int],
|
78
|
+
:int
|
79
|
+
|
80
|
+
attach_function \
|
81
|
+
:bcf_dup,
|
82
|
+
[Bcf1],
|
83
|
+
Bcf1.by_ref
|
84
|
+
|
85
|
+
attach_function \
|
86
|
+
:bcf_copy,
|
87
|
+
[Bcf1, Bcf1],
|
88
|
+
Bcf1.by_ref
|
89
|
+
|
90
|
+
attach_function \
|
91
|
+
:bcf_write,
|
92
|
+
[HtsFile, BcfHdr, Bcf1],
|
93
|
+
:int
|
94
|
+
|
95
|
+
attach_function \
|
96
|
+
:vcf_hdr_read,
|
97
|
+
[HtsFile],
|
98
|
+
BcfHdr.by_ref
|
99
|
+
|
100
|
+
attach_function \
|
101
|
+
:vcf_hdr_write,
|
102
|
+
[HtsFile, BcfHdr],
|
103
|
+
:int
|
104
|
+
|
105
|
+
attach_function \
|
106
|
+
:vcf_read,
|
107
|
+
[HtsFile, BcfHdr, Bcf1],
|
108
|
+
:int
|
109
|
+
|
110
|
+
attach_function \
|
111
|
+
:vcf_write,
|
112
|
+
[HtsFile, BcfHdr, Bcf1],
|
113
|
+
:int
|
114
|
+
|
115
|
+
attach_function \
|
116
|
+
:bcf_readrec,
|
117
|
+
[BGZF, :pointer, :pointer, :pointer, :hts_pos_t, :hts_pos_t],
|
118
|
+
:int
|
119
|
+
|
120
|
+
attach_function \
|
121
|
+
:vcf_write_line,
|
122
|
+
[HtsFile, KString],
|
123
|
+
:int
|
124
|
+
|
125
|
+
attach_function \
|
126
|
+
:bcf_hdr_dup,
|
127
|
+
[BcfHdr],
|
128
|
+
BcfHdr.by_ref
|
129
|
+
|
130
|
+
# DEPRECATED
|
131
|
+
#
|
132
|
+
# attach_function \
|
133
|
+
# :bcf_hdr_combine,
|
134
|
+
# [BcfHdr, BcfHdr],
|
135
|
+
# :int
|
136
|
+
|
137
|
+
attach_function \
|
138
|
+
:bcf_hdr_merge,
|
139
|
+
[BcfHdr, BcfHdr],
|
140
|
+
BcfHdr.by_ref
|
141
|
+
|
142
|
+
attach_function \
|
143
|
+
:bcf_hdr_add_sample,
|
144
|
+
[BcfHdr, :string],
|
145
|
+
:int
|
146
|
+
|
147
|
+
attach_function \
|
148
|
+
:bcf_hdr_set,
|
149
|
+
[BcfHdr, :string],
|
150
|
+
:int
|
151
|
+
|
152
|
+
attach_function \
|
153
|
+
:bcf_hdr_format,
|
154
|
+
[BcfHdr, :int, KString],
|
155
|
+
:int
|
156
|
+
|
157
|
+
attach_function \
|
158
|
+
:bcf_hdr_fmt_text,
|
159
|
+
[BcfHdr, :int, :pointer],
|
160
|
+
:string
|
161
|
+
|
162
|
+
attach_function \
|
163
|
+
:bcf_hdr_append,
|
164
|
+
[BcfHdr, :string],
|
165
|
+
:int
|
166
|
+
|
167
|
+
attach_function \
|
168
|
+
:bcf_hdr_printf,
|
169
|
+
[BcfHdr, :string, :varargs],
|
170
|
+
:int
|
171
|
+
|
172
|
+
attach_function \
|
173
|
+
:bcf_hdr_get_version,
|
174
|
+
[BcfHdr],
|
175
|
+
:string
|
176
|
+
|
177
|
+
attach_function \
|
178
|
+
:bcf_hdr_set_version,
|
179
|
+
[BcfHdr, :string],
|
180
|
+
:int
|
181
|
+
|
182
|
+
attach_function \
|
183
|
+
:bcf_hdr_remove,
|
184
|
+
[BcfHdr, :int, :string],
|
185
|
+
:void
|
186
|
+
|
187
|
+
attach_function \
|
188
|
+
:bcf_hdr_subset,
|
189
|
+
[BcfHdr, :int, :pointer, :pointer],
|
190
|
+
BcfHdr.by_ref
|
191
|
+
|
192
|
+
attach_function \
|
193
|
+
:bcf_hdr_seqnames,
|
194
|
+
[BcfHdr, :pointer],
|
195
|
+
:pointer
|
196
|
+
|
197
|
+
attach_function \
|
198
|
+
:bcf_hdr_parse,
|
199
|
+
[BcfHdr, :string],
|
200
|
+
:int
|
201
|
+
|
202
|
+
attach_function \
|
203
|
+
:bcf_hdr_sync,
|
204
|
+
[BcfHdr],
|
205
|
+
:int
|
206
|
+
|
207
|
+
attach_function \
|
208
|
+
:bcf_hdr_parse_line,
|
209
|
+
[BcfHdr, :string, :pointer],
|
210
|
+
BcfHrec.by_ref
|
211
|
+
|
212
|
+
attach_function \
|
213
|
+
:bcf_hrec_format,
|
214
|
+
[BcfHrec, KString],
|
215
|
+
:int
|
216
|
+
|
217
|
+
attach_function \
|
218
|
+
:bcf_hdr_add_hrec,
|
219
|
+
[BcfHdr, BcfHrec],
|
220
|
+
:int
|
221
|
+
|
222
|
+
attach_function \
|
223
|
+
:bcf_hdr_get_hrec,
|
224
|
+
[BcfHdr, :int, :string, :string, :string],
|
225
|
+
BcfHrec.by_ref
|
226
|
+
|
227
|
+
attach_function \
|
228
|
+
:bcf_hrec_dup,
|
229
|
+
[BcfHrec],
|
230
|
+
BcfHrec.by_ref
|
231
|
+
|
232
|
+
attach_function \
|
233
|
+
:bcf_hrec_add_key,
|
234
|
+
[BcfHrec, :string, :size_t],
|
235
|
+
:int
|
236
|
+
|
237
|
+
attach_function \
|
238
|
+
:bcf_hrec_set_val,
|
239
|
+
[BcfHrec, :int, :string, :size_t, :int],
|
240
|
+
:int
|
241
|
+
|
242
|
+
attach_function \
|
243
|
+
:bcf_hrec_find_key,
|
244
|
+
[BcfHrec, :string],
|
245
|
+
:int
|
246
|
+
|
247
|
+
attach_function \
|
248
|
+
:hrec_add_idx,
|
249
|
+
[BcfHrec, :int],
|
250
|
+
:int
|
251
|
+
|
252
|
+
attach_function \
|
253
|
+
:bcf_hrec_destroy,
|
254
|
+
[BcfHrec],
|
255
|
+
:void
|
256
|
+
|
257
|
+
attach_function \
|
258
|
+
:bcf_subset,
|
259
|
+
[BcfHdr, Bcf1, :int, :pointer],
|
260
|
+
:int
|
261
|
+
|
262
|
+
attach_function \
|
263
|
+
:bcf_translate,
|
264
|
+
[BcfHdr, BcfHdr, Bcf1],
|
265
|
+
:int
|
266
|
+
|
267
|
+
attach_function \
|
268
|
+
:bcf_get_variant_types,
|
269
|
+
[Bcf1],
|
270
|
+
:int
|
271
|
+
|
272
|
+
attach_function \
|
273
|
+
:bcf_get_variant_type,
|
274
|
+
[Bcf1, :int],
|
275
|
+
:int
|
276
|
+
|
277
|
+
attach_function \
|
278
|
+
:bcf_is_snp,
|
279
|
+
[Bcf1],
|
280
|
+
:int
|
281
|
+
|
282
|
+
attach_function \
|
283
|
+
:bcf_update_filter,
|
284
|
+
[BcfHdr, Bcf1, :pointer, :int],
|
285
|
+
:int
|
286
|
+
|
287
|
+
attach_function \
|
288
|
+
:bcf_add_filter,
|
289
|
+
[BcfHdr, Bcf1, :int],
|
290
|
+
:int
|
291
|
+
|
292
|
+
attach_function \
|
293
|
+
:bcf_remove_filter,
|
294
|
+
[BcfHdr, Bcf1, :int, :int],
|
295
|
+
:int
|
296
|
+
|
297
|
+
attach_function \
|
298
|
+
:bcf_has_filter,
|
299
|
+
[BcfHdr, Bcf1, :string],
|
300
|
+
:int
|
301
|
+
|
302
|
+
attach_function \
|
303
|
+
:bcf_update_alleles,
|
304
|
+
[BcfHdr, Bcf1, :pointer, :int],
|
305
|
+
:int
|
306
|
+
|
307
|
+
attach_function \
|
308
|
+
:bcf_update_alleles_str,
|
309
|
+
[BcfHdr, Bcf1, :string],
|
310
|
+
:int
|
311
|
+
|
312
|
+
attach_function \
|
313
|
+
:bcf_update_id,
|
314
|
+
[BcfHdr, Bcf1, :string],
|
315
|
+
:int
|
316
|
+
|
317
|
+
attach_function \
|
318
|
+
:bcf_add_id,
|
319
|
+
[BcfHdr, Bcf1, :string],
|
320
|
+
:int
|
321
|
+
|
322
|
+
attach_function \
|
323
|
+
:bcf_update_info,
|
324
|
+
[BcfHdr, Bcf1, :string, :pointer, :int, :int],
|
325
|
+
:int
|
326
|
+
|
327
|
+
attach_function \
|
328
|
+
:bcf_update_format_string,
|
329
|
+
[BcfHdr, Bcf1, :string, :pointer, :int],
|
330
|
+
:int
|
331
|
+
|
332
|
+
attach_function \
|
333
|
+
:bcf_update_format,
|
334
|
+
[BcfHdr, Bcf1, :string, :pointer, :int, :int],
|
335
|
+
:int
|
336
|
+
|
337
|
+
attach_function \
|
338
|
+
:bcf_get_fmt,
|
339
|
+
[BcfHdr, Bcf1, :string],
|
340
|
+
BcfFmt.by_ref
|
341
|
+
|
342
|
+
attach_function \
|
343
|
+
:bcf_get_info,
|
344
|
+
[BcfHdr, Bcf1, :string],
|
345
|
+
BcfInfo.by_ref
|
346
|
+
|
347
|
+
attach_function \
|
348
|
+
:bcf_get_fmt_id,
|
349
|
+
[Bcf1, :int],
|
350
|
+
BcfFmt.by_ref
|
351
|
+
|
352
|
+
attach_function \
|
353
|
+
:bcf_get_info_id,
|
354
|
+
[Bcf1, :int],
|
355
|
+
BcfInfo.by_ref
|
356
|
+
|
357
|
+
attach_function \
|
358
|
+
:bcf_get_info_values,
|
359
|
+
[BcfHdr, Bcf1, :string, :pointer, :pointer, :int],
|
360
|
+
:int
|
361
|
+
|
362
|
+
attach_function \
|
363
|
+
:bcf_get_format_string,
|
364
|
+
[BcfHdr, Bcf1, :string, :pointer, :pointer],
|
365
|
+
:int
|
366
|
+
|
367
|
+
attach_function \
|
368
|
+
:bcf_get_format_values,
|
369
|
+
[BcfHdr, Bcf1, :string, :pointer, :pointer, :int],
|
370
|
+
:int
|
371
|
+
|
372
|
+
attach_function \
|
373
|
+
:bcf_hdr_id2int,
|
374
|
+
[BcfHdr, :int, :string],
|
375
|
+
:int
|
376
|
+
|
377
|
+
attach_function \
|
378
|
+
:bcf_fmt_array,
|
379
|
+
[KString, :int, :int, :pointer],
|
380
|
+
:int
|
381
|
+
|
382
|
+
attach_function \
|
383
|
+
:bcf_fmt_sized_array,
|
384
|
+
[KString, :pointer],
|
385
|
+
:uint8_t
|
386
|
+
|
387
|
+
attach_function \
|
388
|
+
:bcf_enc_vchar,
|
389
|
+
[KString, :int, :string],
|
390
|
+
:int
|
391
|
+
|
392
|
+
attach_function \
|
393
|
+
:bcf_enc_vint,
|
394
|
+
[KString, :int, :pointer, :int],
|
395
|
+
:int
|
396
|
+
|
397
|
+
attach_function \
|
398
|
+
:bcf_enc_vfloat,
|
399
|
+
[KString, :int, :pointer],
|
400
|
+
:int
|
401
|
+
|
402
|
+
attach_function \
|
403
|
+
:bcf_index_load2,
|
404
|
+
%i[string string],
|
405
|
+
HtsIdx.by_ref
|
406
|
+
|
407
|
+
attach_function \
|
408
|
+
:bcf_index_load3,
|
409
|
+
%i[string string int],
|
410
|
+
HtsIdx.by_ref
|
411
|
+
|
412
|
+
attach_function \
|
413
|
+
:bcf_index_build,
|
414
|
+
%i[string int],
|
415
|
+
:int
|
416
|
+
|
417
|
+
attach_function \
|
418
|
+
:bcf_index_build2,
|
419
|
+
%i[string string int],
|
420
|
+
:int
|
421
|
+
|
422
|
+
attach_function \
|
423
|
+
:bcf_index_build3,
|
424
|
+
%i[string string int int],
|
425
|
+
:int
|
426
|
+
|
427
|
+
attach_function \
|
428
|
+
:bcf_idx_init,
|
429
|
+
[HtsFile, BcfHdr, :int, :string],
|
430
|
+
:int
|
431
|
+
|
432
|
+
attach_function \
|
433
|
+
:bcf_idx_save,
|
434
|
+
[HtsFile],
|
435
|
+
:int
|
239
436
|
end
|
240
437
|
end
|
438
|
+
|
439
|
+
require_relative "vcf_funcs"
|