htslib 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -16
- data/lib/hts/bam.rb +38 -32
- data/lib/hts/bam/cigar.rb +3 -3
- data/lib/hts/bam/flag.rb +91 -0
- data/lib/hts/bam/header.rb +2 -2
- data/lib/hts/bam/{alignment.rb → record.rb} +49 -43
- data/lib/hts/fai.rb +8 -8
- data/lib/hts/libhts.rb +141 -0
- data/lib/hts/{ffi → libhts}/bgzf.rb +1 -1
- data/lib/hts/{ffi → libhts}/constants.rb +114 -43
- data/lib/hts/{ffi → libhts}/faidx.rb +1 -1
- data/lib/hts/{ffi → libhts}/hfile.rb +1 -1
- data/lib/hts/{ffi → libhts}/hts.rb +7 -1
- data/lib/hts/{ffi → libhts}/kfunc.rb +1 -1
- data/lib/hts/{ffi → libhts}/sam.rb +25 -25
- data/lib/hts/{ffi → libhts}/tbx.rb +1 -1
- data/lib/hts/{ffi → libhts}/vcf.rb +1 -1
- data/lib/hts/vcf.rb +17 -17
- data/lib/hts/vcf/format.rb +24 -0
- data/lib/hts/vcf/header.rb +2 -2
- data/lib/hts/vcf/info.rb +24 -0
- data/lib/hts/vcf/{variant.rb → record.rb} +2 -2
- data/lib/hts/version.rb +1 -1
- data/lib/htslib.rb +16 -19
- metadata +20 -17
- data/lib/hts/ffi.rb +0 -85
data/lib/hts/ffi.rb
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module HTS
|
4
|
-
module FFI
|
5
|
-
extend ::FFI::Library
|
6
|
-
|
7
|
-
begin
|
8
|
-
ffi_lib HTS.ffi_lib
|
9
|
-
rescue LoadError => e
|
10
|
-
raise LoadError, "#{e}\nCould not find #{HTS.ffi_lib}"
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.attach_function(*)
|
14
|
-
super
|
15
|
-
rescue ::FFI::NotFoundError => e
|
16
|
-
warn e.message
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
module FFI
|
22
|
-
class Struct
|
23
|
-
class << self
|
24
|
-
def union_layout(*args)
|
25
|
-
Class.new(FFI::Union) { layout(*args) }
|
26
|
-
end
|
27
|
-
|
28
|
-
def struct_layout(*args)
|
29
|
-
Class.new(FFI::Struct) { layout(*args) }
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
class BitStruct < Struct
|
35
|
-
class << self
|
36
|
-
module BitFieldsModule
|
37
|
-
def [](name)
|
38
|
-
bit_fields = self.class.bit_fields_hash_table
|
39
|
-
parent, start, width = bit_fields[name]
|
40
|
-
if parent
|
41
|
-
(super(parent) >> start) & ((1 << width) - 1)
|
42
|
-
else
|
43
|
-
super(name)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
private_constant :BitFieldsModule
|
48
|
-
|
49
|
-
attr_reader :bit_fields_hash_table
|
50
|
-
|
51
|
-
def bitfields(*args)
|
52
|
-
unless instance_variable_defined?(:@bit_fields_hash_table)
|
53
|
-
@bit_fields_hash_table = {}
|
54
|
-
prepend BitFieldsModule
|
55
|
-
end
|
56
|
-
|
57
|
-
parent = args.shift
|
58
|
-
labels = []
|
59
|
-
widths = []
|
60
|
-
args.each_slice(2) do |l, w|
|
61
|
-
labels << l
|
62
|
-
widths << w
|
63
|
-
end
|
64
|
-
starts = widths.inject([0]) do |result, w|
|
65
|
-
result << (result.last + w)
|
66
|
-
end
|
67
|
-
labels.zip(starts, widths).each do |l, s, w|
|
68
|
-
@bit_fields_hash_table[l] = [parent, s, w]
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
require_relative 'ffi/constants'
|
76
|
-
|
77
|
-
# alphabetical order
|
78
|
-
require_relative 'ffi/bgzf'
|
79
|
-
require_relative 'ffi/faidx'
|
80
|
-
require_relative 'ffi/hfile'
|
81
|
-
require_relative 'ffi/hts'
|
82
|
-
require_relative 'ffi/sam'
|
83
|
-
require_relative 'ffi/kfunc'
|
84
|
-
require_relative 'ffi/tbx'
|
85
|
-
require_relative 'ffi/vcf'
|