htslib 0.0.4 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,430 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HTS
4
+ module LibHTS
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
+ attach_function \
131
+ :bcf_hdr_merge,
132
+ [BcfHdr, BcfHdr],
133
+ BcfHdr.by_ref
134
+
135
+ attach_function \
136
+ :bcf_hdr_add_sample,
137
+ [BcfHdr, :string],
138
+ :int
139
+
140
+ attach_function \
141
+ :bcf_hdr_set,
142
+ [BcfHdr, :string],
143
+ :int
144
+
145
+ attach_function \
146
+ :bcf_hdr_format,
147
+ [BcfHdr, :int, KString],
148
+ :int
149
+
150
+ attach_function \
151
+ :bcf_hdr_fmt_text,
152
+ [BcfHdr, :int, :pointer],
153
+ :string
154
+
155
+ attach_function \
156
+ :bcf_hdr_append,
157
+ [BcfHdr, :string],
158
+ :int
159
+
160
+ attach_function \
161
+ :bcf_hdr_printf,
162
+ [BcfHdr, :string, :varargs],
163
+ :int
164
+
165
+ attach_function \
166
+ :bcf_hdr_get_version,
167
+ [BcfHdr],
168
+ :string
169
+
170
+ attach_function \
171
+ :bcf_hdr_set_version,
172
+ [BcfHdr, :string],
173
+ :int
174
+
175
+ attach_function \
176
+ :bcf_hdr_remove,
177
+ [BcfHdr, :int, :string],
178
+ :void
179
+
180
+ attach_function \
181
+ :bcf_hdr_subset,
182
+ [BcfHdr, :int, :pointer, :pointer],
183
+ BcfHdr.by_ref
184
+
185
+ attach_function \
186
+ :bcf_hdr_seqnames,
187
+ [BcfHdr, :pointer],
188
+ :pointer
189
+
190
+ attach_function \
191
+ :bcf_hdr_parse,
192
+ [BcfHdr, :string],
193
+ :int
194
+
195
+ attach_function \
196
+ :bcf_hdr_sync,
197
+ [BcfHdr],
198
+ :int
199
+
200
+ attach_function \
201
+ :bcf_hdr_parse_line,
202
+ [BcfHdr, :string, :pointer],
203
+ BcfHrec.by_ref
204
+
205
+ attach_function \
206
+ :bcf_hrec_format,
207
+ [BcfHrec, KString],
208
+ :int
209
+
210
+ attach_function \
211
+ :bcf_hdr_add_hrec,
212
+ [BcfHdr, BcfHrec],
213
+ :int
214
+
215
+ attach_function \
216
+ :bcf_hdr_get_hrec,
217
+ [BcfHdr, :int, :string, :string, :string],
218
+ BcfHrec.by_ref
219
+
220
+ attach_function \
221
+ :bcf_hrec_dup,
222
+ [BcfHrec],
223
+ BcfHrec.by_ref
224
+
225
+ attach_function \
226
+ :bcf_hrec_add_key,
227
+ [BcfHrec, :string, :size_t],
228
+ :int
229
+
230
+ attach_function \
231
+ :bcf_hrec_set_val,
232
+ [BcfHrec, :int, :string, :size_t, :int],
233
+ :int
234
+
235
+ attach_function \
236
+ :bcf_hrec_find_key,
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
429
+ end
430
+ end
data/lib/hts/libhts.rb CHANGED
@@ -31,3 +31,4 @@ require_relative "libhts/sam"
31
31
  require_relative "libhts/kfunc"
32
32
  require_relative "libhts/tbx"
33
33
  require_relative "libhts/vcf"
34
+ require_relative "libhts/thread_pool"
data/lib/hts/tabix.rb CHANGED
@@ -3,13 +3,21 @@
3
3
  # Based on hts-python
4
4
  # https://github.com/quinlan-lab/hts-python
5
5
 
6
- require_relative "utils/open_method"
7
-
8
6
  module HTS
9
7
  class Tabix
10
- extend Utils::OpenMethod
11
-
12
- def initialize; end
8
+ class << self
9
+ alias open new
10
+ end
11
+ def initialize
12
+ # IO like API
13
+ if block_given?
14
+ begin
15
+ yield self
16
+ ensure
17
+ close
18
+ end
19
+ end
20
+ end
13
21
 
14
22
  def build; end
15
23
 
data/lib/hts/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTS
4
- VERSION = "0.0.4"
4
+ VERSION = "0.0.8"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: htslib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - kojix2
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-22 00:00:00.000000000 Z
11
+ date: 2022-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -152,10 +152,12 @@ files:
152
152
  - lib/hts/libhts/hts.rb
153
153
  - lib/hts/libhts/kfunc.rb
154
154
  - lib/hts/libhts/sam.rb
155
+ - lib/hts/libhts/sam_funcs.rb
155
156
  - lib/hts/libhts/tbx.rb
157
+ - lib/hts/libhts/thread_pool.rb
156
158
  - lib/hts/libhts/vcf.rb
159
+ - lib/hts/libhts/vcf_funcs.rb
157
160
  - lib/hts/tabix.rb
158
- - lib/hts/utils/open_method.rb
159
161
  - lib/hts/version.rb
160
162
  - lib/htslib.rb
161
163
  homepage: https://github.com/kojix2/ruby-htslib
@@ -177,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
179
  - !ruby/object:Gem::Version
178
180
  version: '0'
179
181
  requirements: []
180
- rubygems_version: 3.2.26
182
+ rubygems_version: 3.3.7
181
183
  signing_key:
182
184
  specification_version: 4
183
185
  summary: HTSlib bindings for Ruby
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module HTS
4
- module Utils
5
- module OpenMethod
6
- def open(path)
7
- object = new(path)
8
- if block_given?
9
- yield(object)
10
- object.close
11
- else
12
- object
13
- end
14
- end
15
- end
16
- end
17
- end