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_funcs.rb
CHANGED
@@ -2,429 +2,237 @@
|
|
2
2
|
|
3
3
|
module HTS
|
4
4
|
module LibHTS
|
5
|
-
|
6
|
-
|
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
|
-
[BcfHrec, :string],
|
238
|
-
:int
|
239
|
-
|
240
|
-
attach_function \
|
241
|
-
:hrec_add_idx,
|
242
|
-
[BcfHrec, :int],
|
243
|
-
:int
|
244
|
-
|
245
|
-
attach_function \
|
246
|
-
:bcf_hrec_destroy,
|
247
|
-
[BcfHrec],
|
248
|
-
:void
|
249
|
-
|
250
|
-
attach_function \
|
251
|
-
:bcf_subset,
|
252
|
-
[BcfHdr, Bcf1, :int, :pointer],
|
253
|
-
:int
|
254
|
-
|
255
|
-
attach_function \
|
256
|
-
:bcf_translate,
|
257
|
-
[BcfHdr, BcfHdr, Bcf1],
|
258
|
-
:int
|
259
|
-
|
260
|
-
attach_function \
|
261
|
-
:bcf_get_variant_types,
|
262
|
-
[Bcf1],
|
263
|
-
:int
|
264
|
-
|
265
|
-
attach_function \
|
266
|
-
:bcf_get_variant_type,
|
267
|
-
[Bcf1, :int],
|
268
|
-
:int
|
269
|
-
|
270
|
-
attach_function \
|
271
|
-
:bcf_is_snp,
|
272
|
-
[Bcf1],
|
273
|
-
:int
|
274
|
-
|
275
|
-
attach_function \
|
276
|
-
:bcf_update_filter,
|
277
|
-
[BcfHdr, Bcf1, :pointer, :int],
|
278
|
-
:int
|
279
|
-
|
280
|
-
attach_function \
|
281
|
-
:bcf_add_filter,
|
282
|
-
[BcfHdr, Bcf1, :int],
|
283
|
-
:int
|
284
|
-
|
285
|
-
attach_function \
|
286
|
-
:bcf_remove_filter,
|
287
|
-
[BcfHdr, Bcf1, :int, :int],
|
288
|
-
:int
|
289
|
-
|
290
|
-
attach_function \
|
291
|
-
:bcf_has_filter,
|
292
|
-
[BcfHdr, Bcf1, :string],
|
293
|
-
:int
|
294
|
-
|
295
|
-
attach_function \
|
296
|
-
:bcf_update_alleles,
|
297
|
-
[BcfHdr, Bcf1, :pointer, :int],
|
298
|
-
:int
|
299
|
-
|
300
|
-
attach_function \
|
301
|
-
:bcf_update_alleles_str,
|
302
|
-
[BcfHdr, Bcf1, :string],
|
303
|
-
:int
|
304
|
-
|
305
|
-
attach_function \
|
306
|
-
:bcf_update_id,
|
307
|
-
[BcfHdr, Bcf1, :string],
|
308
|
-
:int
|
309
|
-
|
310
|
-
attach_function \
|
311
|
-
:bcf_add_id,
|
312
|
-
[BcfHdr, Bcf1, :string],
|
313
|
-
:int
|
314
|
-
|
315
|
-
attach_function \
|
316
|
-
:bcf_update_info,
|
317
|
-
[BcfHdr, Bcf1, :string, :pointer, :int, :int],
|
318
|
-
:int
|
319
|
-
|
320
|
-
attach_function \
|
321
|
-
:bcf_update_format_string,
|
322
|
-
[BcfHdr, Bcf1, :string, :pointer, :int],
|
323
|
-
:int
|
324
|
-
|
325
|
-
attach_function \
|
326
|
-
:bcf_update_format,
|
327
|
-
[BcfHdr, Bcf1, :string, :pointer, :int, :int],
|
328
|
-
:int
|
329
|
-
|
330
|
-
attach_function \
|
331
|
-
:bcf_get_fmt,
|
332
|
-
[BcfHdr, Bcf1, :string],
|
333
|
-
BcfFmt.by_ref
|
334
|
-
|
335
|
-
attach_function \
|
336
|
-
:bcf_get_info,
|
337
|
-
[BcfHdr, Bcf1, :string],
|
338
|
-
BcfInfo.by_ref
|
339
|
-
|
340
|
-
attach_function \
|
341
|
-
:bcf_get_fmt_id,
|
342
|
-
[Bcf1, :int],
|
343
|
-
BcfFmt.by_ref
|
344
|
-
|
345
|
-
attach_function \
|
346
|
-
:bcf_get_info_id,
|
347
|
-
[Bcf1, :int],
|
348
|
-
BcfInfo.by_ref
|
349
|
-
|
350
|
-
attach_function \
|
351
|
-
:bcf_get_info_values,
|
352
|
-
[BcfHdr, Bcf1, :string, :pointer, :pointer, :int],
|
353
|
-
:int
|
354
|
-
|
355
|
-
attach_function \
|
356
|
-
:bcf_get_format_string,
|
357
|
-
[BcfHdr, Bcf1, :string, :pointer, :pointer],
|
358
|
-
:int
|
359
|
-
|
360
|
-
attach_function \
|
361
|
-
:bcf_get_format_values,
|
362
|
-
[BcfHdr, Bcf1, :string, :pointer, :pointer, :int],
|
363
|
-
:int
|
364
|
-
|
365
|
-
attach_function \
|
366
|
-
:bcf_hdr_id2int,
|
367
|
-
[BcfHdr, :int, :string],
|
368
|
-
:int
|
369
|
-
|
370
|
-
attach_function \
|
371
|
-
:bcf_fmt_array,
|
372
|
-
[KString, :int, :int, :pointer],
|
373
|
-
:int
|
374
|
-
|
375
|
-
attach_function \
|
376
|
-
:bcf_fmt_sized_array,
|
377
|
-
[KString, :pointer],
|
378
|
-
:uint8_t
|
379
|
-
|
380
|
-
attach_function \
|
381
|
-
:bcf_enc_vchar,
|
382
|
-
[KString, :int, :string],
|
383
|
-
:int
|
384
|
-
|
385
|
-
attach_function \
|
386
|
-
:bcf_enc_vint,
|
387
|
-
[KString, :int, :pointer, :int],
|
388
|
-
:int
|
389
|
-
|
390
|
-
attach_function \
|
391
|
-
:bcf_enc_vfloat,
|
392
|
-
[KString, :int, :pointer],
|
393
|
-
:int
|
394
|
-
|
395
|
-
attach_function \
|
396
|
-
:bcf_index_load2,
|
397
|
-
%i[string string],
|
398
|
-
HtsIdx.by_ref
|
399
|
-
|
400
|
-
attach_function \
|
401
|
-
:bcf_index_load3,
|
402
|
-
%i[string string int],
|
403
|
-
HtsIdx.by_ref
|
404
|
-
|
405
|
-
attach_function \
|
406
|
-
:bcf_index_build,
|
407
|
-
%i[string int],
|
408
|
-
:int
|
409
|
-
|
410
|
-
attach_function \
|
411
|
-
:bcf_index_build2,
|
412
|
-
%i[string string int],
|
413
|
-
:int
|
414
|
-
|
415
|
-
attach_function \
|
416
|
-
:bcf_index_build3,
|
417
|
-
%i[string string int int],
|
418
|
-
:int
|
419
|
-
|
420
|
-
attach_function \
|
421
|
-
:bcf_idx_init,
|
422
|
-
[HtsFile, BcfHdr, :int, :string],
|
423
|
-
:int
|
424
|
-
|
425
|
-
attach_function \
|
426
|
-
:bcf_idx_save,
|
427
|
-
[HtsFile],
|
428
|
-
:int
|
5
|
+
# constants
|
6
|
+
BCF_HL_FLT = 0 # header line
|
7
|
+
BCF_HL_INFO = 1
|
8
|
+
BCF_HL_FMT = 2
|
9
|
+
BCF_HL_CTG = 3
|
10
|
+
BCF_HL_STR = 4 # structured header line TAG=<A=..,B=..>
|
11
|
+
BCF_HL_GEN = 5 # generic header line
|
12
|
+
|
13
|
+
BCF_HT_FLAG = 0 # header type
|
14
|
+
BCF_HT_INT = 1
|
15
|
+
BCF_HT_REAL = 2
|
16
|
+
BCF_HT_STR = 3
|
17
|
+
BCF_HT_LONG = (BCF_HT_INT | 0x100) # BCF_HT_INT, but for int64_t values; VCF only!
|
18
|
+
|
19
|
+
BCF_VL_FIXED = 0 # variable length
|
20
|
+
BCF_VL_VAR = 1
|
21
|
+
BCF_VL_A = 2
|
22
|
+
BCF_VL_G = 3
|
23
|
+
BCF_VL_R = 4
|
24
|
+
|
25
|
+
BCF_DT_ID = 0 # dictionary type
|
26
|
+
BCF_DT_CTG = 1
|
27
|
+
BCF_DT_SAMPLE = 2
|
28
|
+
|
29
|
+
BCF_BT_NULL = 0
|
30
|
+
BCF_BT_INT8 = 1
|
31
|
+
BCF_BT_INT16 = 2
|
32
|
+
BCF_BT_INT32 = 3
|
33
|
+
BCF_BT_INT64 = 4 # Unofficial, for internal use only.
|
34
|
+
BCF_BT_FLOAT = 5
|
35
|
+
BCF_BT_CHAR = 7
|
36
|
+
|
37
|
+
VCF_REF = 0
|
38
|
+
VCF_SNP = 1
|
39
|
+
VCF_MNP = 2
|
40
|
+
VCF_INDEL = 4
|
41
|
+
VCF_OTHER = 8
|
42
|
+
VCF_BND = 16 # breakend
|
43
|
+
VCF_OVERLAP = 32 # overlapping deletion, ALT=*
|
44
|
+
|
45
|
+
BCF1_DIRTY_ID = 1
|
46
|
+
BCF1_DIRTY_ALS = 2
|
47
|
+
BCF1_DIRTY_FLT = 4
|
48
|
+
BCF1_DIRTY_INF = 8
|
49
|
+
|
50
|
+
BCF_ERR_CTG_UNDEF = 1
|
51
|
+
BCF_ERR_TAG_UNDEF = 2
|
52
|
+
BCF_ERR_NCOLS = 4
|
53
|
+
BCF_ERR_LIMITS = 8
|
54
|
+
BCF_ERR_CHAR = 16
|
55
|
+
BCF_ERR_CTG_INVALID = 32
|
56
|
+
BCF_ERR_TAG_INVALID = 64
|
57
|
+
|
58
|
+
# macros
|
59
|
+
class << self
|
60
|
+
alias bcf_init1 bcf_init
|
61
|
+
alias bcf_read1 bcf_read
|
62
|
+
alias vcf_read1 vcf_read
|
63
|
+
alias bcf_write1 bcf_write
|
64
|
+
alias vcf_write1 vcf_write
|
65
|
+
alias bcf_destroy1 bcf_destroy
|
66
|
+
alias bcf_empty1 bcf_empty
|
67
|
+
alias vcf_parse1 vcf_parse
|
68
|
+
alias bcf_clear1 bcf_clear
|
69
|
+
alias vcf_format1 vcf_format
|
70
|
+
|
71
|
+
alias bcf_open hts_open
|
72
|
+
alias vcf_open hts_open
|
73
|
+
if respond_to?(:hts_flush)
|
74
|
+
alias bcf_flush hts_flush
|
75
|
+
alias vcf_flush hts_flush
|
76
|
+
end
|
77
|
+
alias bcf_close hts_close
|
78
|
+
alias vcf_close hts_close
|
79
|
+
end
|
80
|
+
|
81
|
+
BCF_UN_STR = 1 # up to ALT inclusive
|
82
|
+
BCF_UN_FLT = 2 # up to FILTER
|
83
|
+
BCF_UN_INFO = 4 # up to INFO
|
84
|
+
BCF_UN_SHR = (BCF_UN_STR | BCF_UN_FLT | BCF_UN_INFO) # all shared information
|
85
|
+
BCF_UN_FMT = 8 # unpack format and each sample
|
86
|
+
BCF_UN_IND = BCF_UN_FMT # a synonym of BCF_UN_FMT
|
87
|
+
BCF_UN_ALL = (BCF_UN_SHR | BCF_UN_FMT) # everything
|
88
|
+
|
89
|
+
class << self
|
90
|
+
def bcf_hdr_nsamples(hdr)
|
91
|
+
hdr[:n][BCF_DT_SAMPLE]
|
92
|
+
end
|
93
|
+
|
94
|
+
def bcf_update_info_int32(hdr, line, key, values, n)
|
95
|
+
bcf_update_info(hdr, line, key, values, n, BCF_HT_INT)
|
96
|
+
end
|
97
|
+
|
98
|
+
def bcf_update_info_float(hdr, line, key, values, n)
|
99
|
+
bcf_update_info(hdr, line, key, values, n, BCF_HT_REAL)
|
100
|
+
end
|
101
|
+
|
102
|
+
def bcf_update_info_flag(hdr, line, key, string, n)
|
103
|
+
bcf_update_info(hdr, line, key, string, n, BCF_HT_FLAG)
|
104
|
+
end
|
105
|
+
|
106
|
+
def bcf_update_info_string(hdr, line, key, string)
|
107
|
+
bcf_update_info(hdr, line, key, string, 1, BCF_HT_STR)
|
108
|
+
end
|
109
|
+
|
110
|
+
def bcf_update_format_int32(hdr, line, key, values, n)
|
111
|
+
bcf_update_format(hdr, line, key, values, n,
|
112
|
+
BCF_HT_INT)
|
113
|
+
end
|
114
|
+
|
115
|
+
def bcf_update_format_float(hdr, line, key, values, n)
|
116
|
+
bcf_update_format(hdr, line, key, values, n,
|
117
|
+
BCF_HT_REAL)
|
118
|
+
end
|
119
|
+
|
120
|
+
def bcf_update_format_char(hdr, line, key, values, n)
|
121
|
+
bcf_update_format(hdr, line, key, values, n,
|
122
|
+
BCF_HT_STR)
|
123
|
+
end
|
124
|
+
|
125
|
+
def bcf_update_genotypes(hdr, line, gts, n)
|
126
|
+
bcf_update_format(hdr, line, "GT", gts, n, BCF_HT_INT)
|
127
|
+
end
|
128
|
+
|
129
|
+
def bcf_gt_phased(idx)
|
130
|
+
((idx + 1) << 1 | 1)
|
131
|
+
end
|
132
|
+
|
133
|
+
def bcf_gt_unphased(idx)
|
134
|
+
((idx + 1) << 1)
|
135
|
+
end
|
136
|
+
|
137
|
+
def bcf_gt_missing
|
138
|
+
0
|
139
|
+
end
|
140
|
+
|
141
|
+
def bcf_gt_is_missing(val)
|
142
|
+
((val) >> 1 ? 0 : 1)
|
143
|
+
end
|
144
|
+
|
145
|
+
def bcf_gt_is_phased(idx)
|
146
|
+
((idx) & 1)
|
147
|
+
end
|
148
|
+
|
149
|
+
def bcf_gt_allele(val)
|
150
|
+
(((val) >> 1) - 1)
|
151
|
+
end
|
152
|
+
|
153
|
+
def bcf_alleles2gt(a, b)
|
154
|
+
((a) > (b) ? (a * (a + 1) / 2 + b) : (b * (b + 1) / 2 + a))
|
155
|
+
end
|
156
|
+
|
157
|
+
def bcf_get_info_int32(hdr, line, tag, dst, ndst)
|
158
|
+
bcf_get_info_values(hdr, line, tag, dst, ndst, BCF_HT_INT)
|
159
|
+
end
|
160
|
+
|
161
|
+
def bcf_get_info_float(hdr, line, tag, dst, ndst)
|
162
|
+
bcf_get_info_values(hdr, line, tag, dst, ndst, BCF_HT_REAL)
|
163
|
+
end
|
164
|
+
|
165
|
+
def bcf_get_info_string(hdr, line, tag, dst, ndst)
|
166
|
+
bcf_get_info_values(hdr, line, tag, dst, ndst, BCF_HT_STR)
|
167
|
+
end
|
168
|
+
|
169
|
+
def bcf_get_info_flag(hdr, line, tag, dst, ndst)
|
170
|
+
bcf_get_info_values(hdr, line, tag, dst, ndst, BCF_HT_FLAG)
|
171
|
+
end
|
172
|
+
|
173
|
+
def bcf_get_format_int32(hdr, line, tag, dst, ndst)
|
174
|
+
bcf_get_format_values(hdr, line, tag, dst, ndst, BCF_HT_INT)
|
175
|
+
end
|
176
|
+
|
177
|
+
def bcf_get_format_float(hdr, line, tag, dst, ndst)
|
178
|
+
bcf_get_format_values(hdr, line, tag, dst, ndst, BCF_HT_REAL)
|
179
|
+
end
|
180
|
+
|
181
|
+
def bcf_get_format_char(hdr, line, tag, dst, ndst)
|
182
|
+
bcf_get_format_values(hdr, line, tag, dst, ndst, BCF_HT_STR)
|
183
|
+
end
|
184
|
+
|
185
|
+
def bcf_get_genotypes(hdr, line, dst, ndst)
|
186
|
+
bcf_get_format_values(hdr, line, "GT", dst, ndst, BCF_HT_INT)
|
187
|
+
end
|
188
|
+
|
189
|
+
def bcf_hdr_int2id(hdr, type, int_id)
|
190
|
+
LibHTS::BcfIdpair.new(
|
191
|
+
hdr[:id][type].to_ptr +
|
192
|
+
LibHTS::BcfIdpair.size * int_id # offsets
|
193
|
+
)[:key]
|
194
|
+
end
|
195
|
+
|
196
|
+
def bcf_hdr_name2id(hdr, id)
|
197
|
+
bcf_hdr_id2int(hdr, BCF_DT_CTG, id)
|
198
|
+
end
|
199
|
+
|
200
|
+
def bcf_hdr_id2name(hdr, rid)
|
201
|
+
return nil if hdr.null? || rid < 0 || rid >= hdr[:n][LibHTS::BCF_DT_CTG]
|
202
|
+
|
203
|
+
LibHTS::BcfIdpair.new(
|
204
|
+
hdr[:id][LibHTS::BCF_DT_CTG].to_ptr +
|
205
|
+
LibHTS::BcfIdpair.size * rid # offset
|
206
|
+
)[:key]
|
207
|
+
end
|
208
|
+
|
209
|
+
def bcf_hdr_id2length(hdr, type, int_id)
|
210
|
+
LibHTS::BcfIdpair.new(
|
211
|
+
hdr[:id][LibHTS::BCF_DT_ID].to_ptr +
|
212
|
+
LibHTS::BcfIdpair.size * int_id # offset
|
213
|
+
)[:val][:info][type] >> 8 & 0xf
|
214
|
+
end
|
215
|
+
|
216
|
+
def bcf_hdr_id2number(hdr, type, int_id)
|
217
|
+
LibHTS::BcfIdpair.new(
|
218
|
+
hdr[:id][LibHTS::BCF_DT_ID].to_ptr +
|
219
|
+
LibHTS::BcfIdpair.size * int_id # offset
|
220
|
+
)[:val][:info][type] >> 12
|
221
|
+
end
|
222
|
+
|
223
|
+
def bcf_hdr_id2type(hdr, type, int_id)
|
224
|
+
LibHTS::BcfIdpair.new(
|
225
|
+
hdr[:id][LibHTS::BCF_DT_ID].to_ptr +
|
226
|
+
LibHTS::BcfIdpair.size * int_id # offset
|
227
|
+
)[:val][:info][type] >> 4 & 0xf
|
228
|
+
end
|
229
|
+
|
230
|
+
def bcf_hdr_id2coltype(hdr, type, int_id)
|
231
|
+
LibHTS::BcfIdpair.new(
|
232
|
+
hdr[:id][LibHTS::BCF_DT_ID].to_ptr +
|
233
|
+
LibHTS::BcfIdpair.size * int_id # offset
|
234
|
+
)[:val][:info][type] & 0xf
|
235
|
+
end
|
236
|
+
end
|
429
237
|
end
|
430
238
|
end
|
data/lib/hts/libhts.rb
CHANGED
data/lib/hts/tbx.rb
CHANGED
@@ -37,10 +37,9 @@ module HTS
|
|
37
37
|
|
38
38
|
raise Errno::ENOENT, "Failed to open #{@file_name}" if @hts_file.null?
|
39
39
|
|
40
|
-
if threads
|
41
|
-
|
42
|
-
|
43
|
-
end
|
40
|
+
set_threads(threads) if threads
|
41
|
+
|
42
|
+
super # do nothing
|
44
43
|
end
|
45
44
|
end
|
46
45
|
end
|
data/lib/hts/version.rb
CHANGED