htslib 0.0.10 → 0.2.1

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.
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTS
4
+ # Module for working with C HTSlib.
4
5
  module LibHTS
5
6
  typedef :int64, :hts_pos_t
6
7
  typedef :pointer, :bam_plp_auto_f
@@ -24,9 +25,9 @@ module HTS
24
25
  :f, :pointer # kstream_t
25
26
  end
26
27
 
27
- # HFILE
28
+ # HFile
28
29
 
29
- class HFILE < FFI::BitStruct
30
+ class HFile < FFI::BitStruct
30
31
  layout \
31
32
  :buffer, :string,
32
33
  :begin, :string,
@@ -36,7 +37,7 @@ module HTS
36
37
  :offset, :size_t,
37
38
  :_flags, :uint,
38
39
  :has_errno, :int
39
-
40
+
40
41
  bit_fields :_flags,
41
42
  :at_eof, 1,
42
43
  :mobile, 1,
@@ -56,7 +57,7 @@ module HTS
56
57
  :uncompressed_block, :pointer,
57
58
  :compressed_block, :pointer,
58
59
  :cache, :pointer,
59
- :fp, HFILE.ptr,
60
+ :fp, HFile.ptr,
60
61
  :mt, :pointer,
61
62
  :idx, :pointer,
62
63
  :idx_build_otf, :int,
@@ -189,6 +190,16 @@ module HTS
189
190
  )
190
191
  end
191
192
 
193
+ class HtsReglist < FFI::Struct
194
+ layout \
195
+ :reg, :string,
196
+ :intervals, :pointer, # hts_pair_pos_t
197
+ :tid, :int,
198
+ :count, :uint32_t,
199
+ :min_beg, :hts_pos_t,
200
+ :max_end, :hts_pos_t
201
+ end
202
+
192
203
  # HtsFile
193
204
  class SamHdr < FFI::Struct
194
205
  layout \
@@ -217,7 +228,7 @@ module HTS
217
228
  union_layout(
218
229
  :bgzf, BGZF.ptr,
219
230
  :cram, :pointer, # cram_fd
220
- :hfile, HFILE.ptr
231
+ :hfile, HFile.ptr
221
232
  ),
222
233
  :state, :pointer,
223
234
  :format, HtsFormat,
@@ -263,7 +274,7 @@ module HTS
263
274
  :n_reg, :int,
264
275
  :beg, :int64,
265
276
  :end, :int64,
266
- :reg_list, :pointer,
277
+ :reg_list, :pointer, # HtsReglist.ptr,
267
278
  :curr_tid, :int,
268
279
  :curr_reg, :int,
269
280
  :curr_intv, :int,
@@ -392,6 +403,7 @@ module HTS
392
403
  :n, :int
393
404
  end
394
405
 
406
+ # Complete textual representation of a header line
395
407
  class BcfHrec < FFI::Struct
396
408
  layout \
397
409
  :type, :int,
@@ -402,21 +414,6 @@ module HTS
402
414
  :vals, :pointer
403
415
  end
404
416
 
405
- class BcfFmt < FFI::BitStruct
406
- layout \
407
- :id, :int,
408
- :n, :int,
409
- :size, :int,
410
- :type, :int,
411
- :p, :pointer, # uint8_t
412
- :p_len, :uint32,
413
- :_p_off_free, :uint32 # bit_fields
414
-
415
- bit_fields :_p_off_free,
416
- :p_off, 31,
417
- :p_free, 1
418
- end
419
-
420
417
  class BcfInfo < FFI::BitStruct
421
418
  layout \
422
419
  :key, :int,
@@ -466,6 +463,21 @@ module HTS
466
463
  :m, [:int, 3]
467
464
  end
468
465
 
466
+ class BcfFmt < FFI::BitStruct
467
+ layout \
468
+ :id, :int,
469
+ :n, :int,
470
+ :size, :int,
471
+ :type, :int,
472
+ :p, :pointer, # uint8_t
473
+ :p_len, :uint32,
474
+ :_p_off_free, :uint32 # bit_fields
475
+
476
+ bit_fields :_p_off_free,
477
+ :p_off, 31,
478
+ :p_free, 1
479
+ end
480
+
469
481
  class BcfDec < FFI::Struct
470
482
  layout \
471
483
  :m_fmt, :int,
@@ -479,8 +491,8 @@ module HTS
479
491
  :id, :string,
480
492
  :als, :pointer, # (\\0-separated string)
481
493
  :allele, :pointer,
482
- :info, :pointer, # BcfInfo.ptr,
483
- :fmt, BcfFmt.ptr,
494
+ :info, :pointer, # array of BcfInfo.ptr,
495
+ :fmt, :pointer, # array of BcfFmt.ptr,
484
496
  :var, BcfVariant.ptr,
485
497
  :n_var, :int,
486
498
  :var_type, :int,
@@ -516,5 +528,15 @@ module HTS
516
528
  LibHTS.bcf_destroy(ptr) unless ptr.null?
517
529
  end
518
530
  end
531
+
532
+ CramContentType = enum(
533
+ :ct_error, -1,
534
+ :file_header, 0,
535
+ :compression_header, 1,
536
+ :mapped_slice, 2,
537
+ :unmapped_slice, 3, # cram v1.0 only
538
+ :external, 4,
539
+ :core, 5
540
+ )
519
541
  end
520
542
  end