htslib 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "vcf_funcs"
4
+
3
5
  module HTS
4
6
  module LibHTS
5
7
  # constants
@@ -9,8 +11,8 @@ module HTS
9
11
  BCF_HL_CTG = 3
10
12
  BCF_HL_STR = 4 # structured header line TAG=<A=..,B=..>
11
13
  BCF_HL_GEN = 5 # generic header line
12
- BCF_HT_FLAG = 0 # header type
13
14
 
15
+ BCF_HT_FLAG = 0 # header type
14
16
  BCF_HT_INT = 1
15
17
  BCF_HT_REAL = 2
16
18
  BCF_HT_STR = 3
@@ -57,11 +59,36 @@ module HTS
57
59
 
58
60
  # macros
59
61
  class << self
60
- alias bcf_open hts_open
61
- alias vcf_open hts_open
62
- alias bcf_close hts_close
63
- alias vcf_close hts_close
62
+ alias bcf_init1 bcf_init
63
+ alias bcf_read1 bcf_read
64
+ alias vcf_read1 vcf_read
65
+ alias bcf_write1 bcf_write
66
+ alias vcf_write1 vcf_write
67
+ alias bcf_destroy1 bcf_destroy
68
+ alias bcf_empty1 bcf_empty
69
+ alias vcf_parse1 vcf_parse
70
+ alias bcf_clear1 bcf_clear
71
+ alias vcf_format1 vcf_format
72
+
73
+ alias bcf_open hts_open
74
+ alias vcf_open hts_open
75
+ if respond_to?(:hts_flush)
76
+ alias bcf_flush hts_flush
77
+ alias vcf_flush hts_flush
78
+ end
79
+ alias bcf_close hts_close
80
+ alias vcf_close hts_close
81
+ end
82
+
83
+ BCF_UN_STR = 1 # up to ALT inclusive
84
+ BCF_UN_FLT = 2 # up to FILTER
85
+ BCF_UN_INFO = 4 # up to INFO
86
+ BCF_UN_SHR = (BCF_UN_STR | BCF_UN_FLT | BCF_UN_INFO) # all shared information
87
+ BCF_UN_FMT = 8 # unpack format and each sample
88
+ BCF_UN_IND = BCF_UN_FMT # a synonym of BCF_UN_FMT
89
+ BCF_UN_ALL = (BCF_UN_SHR | BCF_UN_FMT) # everything
64
90
 
91
+ class << self
65
92
  def bcf_hdr_nsamples(hdr)
66
93
  hdr[:n][BCF_DT_SAMPLE]
67
94
  end
@@ -195,439 +222,5 @@ module HTS
195
222
  )[:val][:info][type] >> 12
196
223
  end
197
224
  end
198
-
199
- # constants
200
- BCF_UN_STR = 1 # up to ALT inclusive
201
- BCF_UN_FLT = 2 # up to FILTER
202
- BCF_UN_INFO = 4 # up to INFO
203
- BCF_UN_SHR = (BCF_UN_STR | BCF_UN_FLT | BCF_UN_INFO) # all shared information
204
- BCF_UN_FMT = 8 # unpack format and each sample
205
- BCF_UN_IND = BCF_UN_FMT # a synonym of BCF_UN_FMT
206
- BCF_UN_ALL = (BCF_UN_SHR | BCF_UN_FMT) # everything
207
-
208
- attach_function \
209
- :bcf_hdr_init,
210
- [:string],
211
- BcfHdr.by_ref
212
-
213
- attach_function \
214
- :bcf_hdr_destroy,
215
- [BcfHdr],
216
- :void
217
-
218
- attach_function \
219
- :bcf_init,
220
- [],
221
- Bcf1.by_ref
222
-
223
- attach_function \
224
- :bcf_destroy,
225
- [Bcf1],
226
- :void
227
-
228
- attach_function \
229
- :bcf_empty,
230
- [Bcf1],
231
- :void
232
-
233
- attach_function \
234
- :bcf_clear,
235
- [Bcf1],
236
- :void
237
-
238
- attach_function \
239
- :bcf_hdr_read,
240
- [HtsFile],
241
- BcfHdr.by_ref
242
-
243
- attach_function \
244
- :bcf_hdr_set_samples,
245
- [BcfHdr, :string, :int],
246
- :int
247
-
248
- attach_function \
249
- :bcf_subset_format,
250
- [BcfHdr, Bcf1],
251
- :int
252
-
253
- attach_function \
254
- :bcf_hdr_write,
255
- [HtsFile, BcfHdr],
256
- :int
257
-
258
- attach_function \
259
- :vcf_parse,
260
- [KString, BcfHdr, Bcf1],
261
- :int
262
-
263
- attach_function \
264
- :vcf_open_mode,
265
- %i[string string string],
266
- :int
267
-
268
- attach_function \
269
- :vcf_format,
270
- [BcfHdr, Bcf1, KString],
271
- :int
272
-
273
- attach_function \
274
- :bcf_read,
275
- [HtsFile, BcfHdr, Bcf1],
276
- :int
277
-
278
- attach_function \
279
- :bcf_unpack,
280
- [Bcf1, :int],
281
- :int
282
-
283
- attach_function \
284
- :bcf_dup,
285
- [Bcf1],
286
- Bcf1.by_ref
287
-
288
- attach_function \
289
- :bcf_copy,
290
- [Bcf1, Bcf1],
291
- Bcf1.by_ref
292
-
293
- attach_function \
294
- :bcf_write,
295
- [HtsFile, BcfHdr, Bcf1],
296
- :int
297
-
298
- attach_function \
299
- :vcf_hdr_read,
300
- [HtsFile],
301
- BcfHdr.by_ref
302
-
303
- attach_function \
304
- :vcf_hdr_write,
305
- [HtsFile, BcfHdr],
306
- :int
307
-
308
- attach_function \
309
- :vcf_read,
310
- [HtsFile, BcfHdr, Bcf1],
311
- :int
312
-
313
- attach_function \
314
- :vcf_write,
315
- [HtsFile, BcfHdr, Bcf1],
316
- :int
317
-
318
- attach_function \
319
- :bcf_readrec,
320
- [BGZF, :pointer, :pointer, :pointer, :hts_pos_t, :hts_pos_t],
321
- :int
322
-
323
- attach_function \
324
- :vcf_write_line,
325
- [HtsFile, KString],
326
- :int
327
-
328
- attach_function \
329
- :bcf_hdr_dup,
330
- [BcfHdr],
331
- BcfHdr.by_ref
332
-
333
- attach_function \
334
- :bcf_hdr_merge,
335
- [BcfHdr, BcfHdr],
336
- BcfHdr.by_ref
337
-
338
- attach_function \
339
- :bcf_hdr_add_sample,
340
- [BcfHdr, :string],
341
- :int
342
-
343
- attach_function \
344
- :bcf_hdr_set,
345
- [BcfHdr, :string],
346
- :int
347
-
348
- attach_function \
349
- :bcf_hdr_format,
350
- [BcfHdr, :int, KString],
351
- :int
352
-
353
- attach_function \
354
- :bcf_hdr_fmt_text,
355
- [BcfHdr, :int, :pointer],
356
- :string
357
-
358
- attach_function \
359
- :bcf_hdr_append,
360
- [BcfHdr, :string],
361
- :int
362
-
363
- attach_function \
364
- :bcf_hdr_printf,
365
- [BcfHdr, :string, :varargs],
366
- :int
367
-
368
- attach_function \
369
- :bcf_hdr_get_version,
370
- [BcfHdr],
371
- :string
372
-
373
- attach_function \
374
- :bcf_hdr_set_version,
375
- [BcfHdr, :string],
376
- :int
377
-
378
- attach_function \
379
- :bcf_hdr_remove,
380
- [BcfHdr, :int, :string],
381
- :void
382
-
383
- attach_function \
384
- :bcf_hdr_subset,
385
- [BcfHdr, :int, :pointer, :pointer],
386
- BcfHdr.by_ref
387
-
388
- attach_function \
389
- :bcf_hdr_seqnames,
390
- [BcfHdr, :pointer],
391
- :pointer
392
-
393
- attach_function \
394
- :bcf_hdr_parse,
395
- [BcfHdr, :string],
396
- :int
397
-
398
- attach_function \
399
- :bcf_hdr_sync,
400
- [BcfHdr],
401
- :int
402
-
403
- attach_function \
404
- :bcf_hdr_parse_line,
405
- [BcfHdr, :string, :pointer],
406
- BcfHrec.by_ref
407
-
408
- attach_function \
409
- :bcf_hrec_format,
410
- [BcfHrec, KString],
411
- :int
412
-
413
- attach_function \
414
- :bcf_hdr_add_hrec,
415
- [BcfHdr, BcfHrec],
416
- :int
417
-
418
- attach_function \
419
- :bcf_hdr_get_hrec,
420
- [BcfHdr, :int, :string, :string, :string],
421
- BcfHrec.by_ref
422
-
423
- attach_function \
424
- :bcf_hrec_dup,
425
- [BcfHrec],
426
- BcfHrec.by_ref
427
-
428
- attach_function \
429
- :bcf_hrec_add_key,
430
- [BcfHrec, :string, :size_t],
431
- :int
432
-
433
- attach_function \
434
- :bcf_hrec_set_val,
435
- [BcfHrec, :int, :string, :size_t, :int],
436
- :int
437
-
438
- attach_function \
439
- :bcf_hrec_find_key,
440
- [BcfHrec, :string],
441
- :int
442
-
443
- attach_function \
444
- :hrec_add_idx,
445
- [BcfHrec, :int],
446
- :int
447
-
448
- attach_function \
449
- :bcf_hrec_destroy,
450
- [BcfHrec],
451
- :void
452
-
453
- attach_function \
454
- :bcf_subset,
455
- [BcfHdr, Bcf1, :int, :pointer],
456
- :int
457
-
458
- attach_function \
459
- :bcf_translate,
460
- [BcfHdr, BcfHdr, Bcf1],
461
- :int
462
-
463
- attach_function \
464
- :bcf_get_variant_types,
465
- [Bcf1],
466
- :int
467
-
468
- attach_function \
469
- :bcf_get_variant_type,
470
- [Bcf1, :int],
471
- :int
472
-
473
- attach_function \
474
- :bcf_is_snp,
475
- [Bcf1],
476
- :int
477
-
478
- attach_function \
479
- :bcf_update_filter,
480
- [BcfHdr, Bcf1, :pointer, :int],
481
- :int
482
-
483
- attach_function \
484
- :bcf_add_filter,
485
- [BcfHdr, Bcf1, :int],
486
- :int
487
-
488
- attach_function \
489
- :bcf_remove_filter,
490
- [BcfHdr, Bcf1, :int, :int],
491
- :int
492
-
493
- attach_function \
494
- :bcf_has_filter,
495
- [BcfHdr, Bcf1, :string],
496
- :int
497
-
498
- attach_function \
499
- :bcf_update_alleles,
500
- [BcfHdr, Bcf1, :pointer, :int],
501
- :int
502
-
503
- attach_function \
504
- :bcf_update_alleles_str,
505
- [BcfHdr, Bcf1, :string],
506
- :int
507
-
508
- attach_function \
509
- :bcf_update_id,
510
- [BcfHdr, Bcf1, :string],
511
- :int
512
-
513
- attach_function \
514
- :bcf_add_id,
515
- [BcfHdr, Bcf1, :string],
516
- :int
517
-
518
- attach_function \
519
- :bcf_update_info,
520
- [BcfHdr, Bcf1, :string, :pointer, :int, :int],
521
- :int
522
-
523
- attach_function \
524
- :bcf_update_format_string,
525
- [BcfHdr, Bcf1, :string, :pointer, :int],
526
- :int
527
-
528
- attach_function \
529
- :bcf_update_format,
530
- [BcfHdr, Bcf1, :string, :pointer, :int, :int],
531
- :int
532
-
533
- attach_function \
534
- :bcf_get_fmt,
535
- [BcfHdr, Bcf1, :string],
536
- BcfFmt.by_ref
537
-
538
- attach_function \
539
- :bcf_get_info,
540
- [BcfHdr, Bcf1, :string],
541
- BcfInfo.by_ref
542
-
543
- attach_function \
544
- :bcf_get_fmt_id,
545
- [Bcf1, :int],
546
- BcfFmt.by_ref
547
-
548
- attach_function \
549
- :bcf_get_info_id,
550
- [Bcf1, :int],
551
- BcfInfo.by_ref
552
-
553
- attach_function \
554
- :bcf_get_info_values,
555
- [BcfHdr, Bcf1, :string, :pointer, :pointer, :int],
556
- :int
557
-
558
- attach_function \
559
- :bcf_get_format_string,
560
- [BcfHdr, Bcf1, :string, :pointer, :pointer],
561
- :int
562
-
563
- attach_function \
564
- :bcf_get_format_values,
565
- [BcfHdr, Bcf1, :string, :pointer, :pointer, :int],
566
- :int
567
-
568
- attach_function \
569
- :bcf_hdr_id2int,
570
- [BcfHdr, :int, :string],
571
- :int
572
-
573
- attach_function \
574
- :bcf_fmt_array,
575
- [KString, :int, :int, :pointer],
576
- :int
577
-
578
- attach_function \
579
- :bcf_fmt_sized_array,
580
- [KString, :pointer],
581
- :uint8_t
582
-
583
- attach_function \
584
- :bcf_enc_vchar,
585
- [KString, :int, :string],
586
- :int
587
-
588
- attach_function \
589
- :bcf_enc_vint,
590
- [KString, :int, :pointer, :int],
591
- :int
592
-
593
- attach_function \
594
- :bcf_enc_vfloat,
595
- [KString, :int, :pointer],
596
- :int
597
-
598
- attach_function \
599
- :bcf_index_load2,
600
- %i[string string],
601
- HtsIdx.by_ref
602
-
603
- attach_function \
604
- :bcf_index_load3,
605
- %i[string string int],
606
- HtsIdx.by_ref
607
-
608
- attach_function \
609
- :bcf_index_build,
610
- %i[string int],
611
- :int
612
-
613
- attach_function \
614
- :bcf_index_build2,
615
- %i[string string int],
616
- :int
617
-
618
- attach_function \
619
- :bcf_index_build3,
620
- %i[string string int int],
621
- :int
622
-
623
- attach_function \
624
- :bcf_idx_init,
625
- [HtsFile, BcfHdr, :int, :string],
626
- :int
627
-
628
- attach_function \
629
- :bcf_idx_save,
630
- [HtsFile],
631
- :int
632
225
  end
633
226
  end