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/hts.rb
CHANGED
@@ -6,7 +6,13 @@ module HTS
|
|
6
6
|
# hts_expand3
|
7
7
|
# hts_resize
|
8
8
|
|
9
|
-
#
|
9
|
+
# Sets the selected log level.
|
10
|
+
attach_function \
|
11
|
+
:hts_set_log_level,
|
12
|
+
[HtsLogLevel],
|
13
|
+
:void
|
14
|
+
|
15
|
+
# Gets the selected log level.
|
10
16
|
attach_function \
|
11
17
|
:hts_get_log_level,
|
12
18
|
[],
|
@@ -58,10 +64,33 @@ module HTS
|
|
58
64
|
[],
|
59
65
|
:string
|
60
66
|
|
67
|
+
# Introspection on the features enabled in htslib
|
68
|
+
attach_function \
|
69
|
+
:hts_features,
|
70
|
+
[],
|
71
|
+
:uint
|
72
|
+
|
73
|
+
attach_function \
|
74
|
+
:hts_test_feature,
|
75
|
+
[:uint],
|
76
|
+
:string
|
77
|
+
|
78
|
+
# Introspection on the features enabled in htslib, string form
|
79
|
+
attach_function \
|
80
|
+
:hts_feature_string,
|
81
|
+
[],
|
82
|
+
:string
|
83
|
+
|
61
84
|
# Determine format by peeking at the start of a file
|
62
85
|
attach_function \
|
63
86
|
:hts_detect_format,
|
64
|
-
[
|
87
|
+
[HFile, HtsFormat],
|
88
|
+
:int
|
89
|
+
|
90
|
+
# Determine format primarily by peeking at the start of a file
|
91
|
+
attach_function \
|
92
|
+
:hts_detect_format2,
|
93
|
+
[HFile, :string, HtsFormat],
|
65
94
|
:int
|
66
95
|
|
67
96
|
# Get a human-readable description of the file format
|
@@ -86,7 +115,7 @@ module HTS
|
|
86
115
|
# Open an existing stream as a SAM/BAM/CRAM/VCF/BCF/etc file
|
87
116
|
attach_function \
|
88
117
|
:hts_hopen,
|
89
|
-
[
|
118
|
+
[HFile, :string, :string],
|
90
119
|
HtsFile.by_ref
|
91
120
|
|
92
121
|
# For output streams, flush any buffered data
|
@@ -160,6 +189,12 @@ module HTS
|
|
160
189
|
[HtsFile, :string],
|
161
190
|
:int
|
162
191
|
|
192
|
+
# Sets a filter expression
|
193
|
+
attach_function \
|
194
|
+
:hts_set_filter_expression,
|
195
|
+
[HtsFile, :string],
|
196
|
+
:int
|
197
|
+
|
163
198
|
# Determine whether a given htsFile contains a valid EOF block
|
164
199
|
attach_function \
|
165
200
|
:hts_check_EOF,
|
@@ -264,11 +299,26 @@ module HTS
|
|
264
299
|
[HtsIdx],
|
265
300
|
:uint64
|
266
301
|
|
302
|
+
# Return a list of target names from an index
|
303
|
+
attach_function \
|
304
|
+
:hts_idx_seqnames,
|
305
|
+
[HtsIdx, :pointer, :pointer, :pointer],
|
306
|
+
:pointer
|
307
|
+
|
308
|
+
# Return the number of targets from an index
|
309
|
+
attach_function \
|
310
|
+
:hts_idx_nseq,
|
311
|
+
[HtsIdx],
|
312
|
+
:int
|
313
|
+
|
314
|
+
# Parse a numeric string
|
267
315
|
attach_function \
|
268
316
|
:hts_parse_decimal,
|
269
317
|
%i[string pointer int],
|
270
318
|
:long_long
|
271
319
|
|
320
|
+
callback :hts_name2id_f, %i[pointer string], :int
|
321
|
+
|
272
322
|
# Parse a "CHR:START-END"-style region string
|
273
323
|
attach_function \
|
274
324
|
:hts_parse_reg64,
|
@@ -284,7 +334,7 @@ module HTS
|
|
284
334
|
# Parse a "CHR:START-END"-style region string
|
285
335
|
attach_function \
|
286
336
|
:hts_parse_region,
|
287
|
-
%i[string pointer pointer pointer
|
337
|
+
%i[string pointer pointer pointer hts_name2id_f pointer int],
|
288
338
|
:string
|
289
339
|
|
290
340
|
# Create a single-region iterator
|
@@ -302,7 +352,7 @@ module HTS
|
|
302
352
|
# Create a single-region iterator from a text region specification
|
303
353
|
attach_function \
|
304
354
|
:hts_itr_querys,
|
305
|
-
[HtsIdx, :string, :
|
355
|
+
[HtsIdx, :string, :hts_name2id_f, :pointer, :pointer, :pointer],
|
306
356
|
HtsItr.by_ref
|
307
357
|
|
308
358
|
# Return the next record from an iterator
|
@@ -312,27 +362,110 @@ module HTS
|
|
312
362
|
:int
|
313
363
|
|
314
364
|
attach_function \
|
315
|
-
:
|
316
|
-
[HtsIdx,
|
365
|
+
:hts_itr_multi_bam,
|
366
|
+
[HtsIdx, HtsItr],
|
367
|
+
:int
|
368
|
+
|
369
|
+
attach_function \
|
370
|
+
:hts_itr_multi_cram,
|
371
|
+
[HtsIdx, HtsItr],
|
372
|
+
:int
|
373
|
+
|
374
|
+
# Create a multi-region iterator from a region list
|
375
|
+
attach_function \
|
376
|
+
:hts_itr_regions,
|
377
|
+
[HtsIdx,
|
378
|
+
:pointer, # hts_reglist_t *
|
379
|
+
:int,
|
380
|
+
:hts_name2id_f,
|
381
|
+
:pointer,
|
382
|
+
:pointer, # hts_itr_multi_query_func
|
383
|
+
:pointer, # hts_readrec_func
|
384
|
+
:pointer, # hts_seek_func
|
385
|
+
:pointer # hts_tell_func
|
386
|
+
],
|
387
|
+
HtsItr.by_ref
|
388
|
+
|
389
|
+
# Return the next record from an iterator
|
390
|
+
attach_function \
|
391
|
+
:hts_itr_multi_next,
|
392
|
+
[HtsFile, HtsItr, :pointer],
|
393
|
+
:int
|
394
|
+
|
395
|
+
# Create a region list from a char array
|
396
|
+
attach_function \
|
397
|
+
:hts_reglist_create,
|
398
|
+
%i[pointer int pointer pointer hts_name2id_f],
|
399
|
+
HtsReglist.by_ref
|
400
|
+
|
401
|
+
# Free a region list
|
402
|
+
attach_function \
|
403
|
+
:hts_reglist_free,
|
404
|
+
[HtsReglist, :int],
|
405
|
+
:void
|
406
|
+
|
407
|
+
# Deprecated
|
408
|
+
# Convenience function to determine file type
|
409
|
+
# attach_function \
|
410
|
+
# :hts_file_type,
|
411
|
+
# [:string],
|
412
|
+
# :int
|
413
|
+
|
414
|
+
attach_function \
|
415
|
+
:errmod_init,
|
416
|
+
[:double],
|
317
417
|
:pointer
|
318
418
|
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
#
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
419
|
+
attach_function \
|
420
|
+
:errmod_destroy,
|
421
|
+
[:pointer],
|
422
|
+
:void
|
423
|
+
|
424
|
+
attach_function \
|
425
|
+
:errmod_cal,
|
426
|
+
%i[pointer int int pointer pointer],
|
427
|
+
:int
|
428
|
+
|
429
|
+
# Perform probabilistic banded glocal alignment
|
430
|
+
attach_function \
|
431
|
+
:probaln_glocal,
|
432
|
+
%i[pointer int pointer int pointer pointer pointer pointer],
|
433
|
+
:int
|
434
|
+
|
435
|
+
# Initialises an MD5 context.
|
436
|
+
attach_function \
|
437
|
+
:hts_md5_init,
|
438
|
+
[],
|
439
|
+
:pointer # hts_md5_context
|
440
|
+
|
441
|
+
# Updates the context with the MD5 of the data.
|
442
|
+
attach_function \
|
443
|
+
:hts_md5_update,
|
444
|
+
%i[pointer pointer ulong],
|
445
|
+
:void
|
446
|
+
|
447
|
+
# Computes the final 128-bit MD5 hash from the given context
|
448
|
+
attach_function \
|
449
|
+
:hts_md5_final,
|
450
|
+
%i[pointer pointer], # unsinged char
|
451
|
+
:void
|
452
|
+
|
453
|
+
# Resets an md5_context to the initial state, as returned by hts_md5_init().
|
454
|
+
attach_function \
|
455
|
+
:hts_md5_reset,
|
456
|
+
[:pointer],
|
457
|
+
:void
|
458
|
+
|
459
|
+
# Converts a 128-bit MD5 hash into a 33-byte nul-termninated by string.
|
460
|
+
attach_function \
|
461
|
+
:hts_md5_hex,
|
462
|
+
%i[string pointer],
|
463
|
+
:void
|
464
|
+
|
465
|
+
# Deallocates any memory allocated by hts_md5_init.
|
466
|
+
attach_function \
|
467
|
+
:hts_md5_destroy,
|
468
|
+
[:pointer],
|
469
|
+
:void
|
337
470
|
end
|
338
471
|
end
|