htslib 0.4.1 → 0.5.0
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.
- checksums.yaml +4 -4
- data/README.md +79 -49
- data/TUTORIAL.md +9 -20
- data/ext/htslib_native/extconf.rb +41 -0
- data/ext/htslib_native/htslib_native.h +11 -0
- data/ext/htslib_native/htslib_native_ext.c +48 -0
- data/ext/htslib_native/native_bam.c +1108 -0
- data/ext/htslib_native/native_bcf.c +369 -0
- data/ext/htslib_native/native_faidx.c +155 -0
- data/ext/htslib_native/native_tabix.c +246 -0
- data/lib/hts/bam/auxi.rb +87 -342
- data/lib/hts/bam/base_mod.rb +37 -73
- data/lib/hts/bam/cigar.rb +9 -55
- data/lib/hts/bam/flag.rb +19 -27
- data/lib/hts/bam/header.rb +29 -56
- data/lib/hts/bam/mpileup.rb +158 -132
- data/lib/hts/bam/pileup.rb +120 -145
- data/lib/hts/bam/record.rb +233 -270
- data/lib/hts/bam.rb +102 -42
- data/lib/hts/bcf/errors.rb +1 -0
- data/lib/hts/bcf/format.rb +278 -379
- data/lib/hts/bcf/header.rb +38 -123
- data/lib/hts/bcf/header_record.rb +9 -35
- data/lib/hts/bcf/info.rb +72 -320
- data/lib/hts/bcf/record.rb +61 -102
- data/lib/hts/bcf.rb +149 -323
- data/lib/hts/faidx.rb +28 -87
- data/lib/hts/hts.rb +6 -94
- data/lib/hts/native.rb +13 -0
- data/lib/hts/tabix.rb +93 -48
- data/lib/hts/version.rb +1 -1
- data/lib/htslib.rb +6 -52
- metadata +13 -64
- data/lib/hts/ffi_ext/README.md +0 -8
- data/lib/hts/ffi_ext/pointer.rb +0 -18
- data/lib/hts/ffi_ext/struct.rb +0 -45
- data/lib/hts/libhts/bgzf.rb +0 -199
- data/lib/hts/libhts/constants.rb +0 -658
- data/lib/hts/libhts/cram.rb +0 -471
- data/lib/hts/libhts/fai.rb +0 -146
- data/lib/hts/libhts/hfile.rb +0 -109
- data/lib/hts/libhts/hts.rb +0 -477
- data/lib/hts/libhts/kfunc.rb +0 -38
- data/lib/hts/libhts/sam.rb +0 -760
- data/lib/hts/libhts/sam_funcs.rb +0 -155
- data/lib/hts/libhts/tbx.rb +0 -79
- data/lib/hts/libhts/tbx_funcs.rb +0 -32
- data/lib/hts/libhts/thread_pool.rb +0 -139
- data/lib/hts/libhts/vcf.rb +0 -557
- data/lib/hts/libhts/vcf_funcs.rb +0 -353
- data/lib/hts/libhts.rb +0 -47
metadata
CHANGED
|
@@ -1,65 +1,31 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: htslib
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- kojix2
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
-
dependencies:
|
|
12
|
-
- !ruby/object:Gem::Dependency
|
|
13
|
-
name: ffi
|
|
14
|
-
requirement: !ruby/object:Gem::Requirement
|
|
15
|
-
requirements:
|
|
16
|
-
- - ">="
|
|
17
|
-
- !ruby/object:Gem::Version
|
|
18
|
-
version: '0'
|
|
19
|
-
type: :runtime
|
|
20
|
-
prerelease: false
|
|
21
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
-
requirements:
|
|
23
|
-
- - ">="
|
|
24
|
-
- !ruby/object:Gem::Version
|
|
25
|
-
version: '0'
|
|
26
|
-
- !ruby/object:Gem::Dependency
|
|
27
|
-
name: ffi-bitfield
|
|
28
|
-
requirement: !ruby/object:Gem::Requirement
|
|
29
|
-
requirements:
|
|
30
|
-
- - ">="
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: '0'
|
|
33
|
-
type: :runtime
|
|
34
|
-
prerelease: false
|
|
35
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
-
requirements:
|
|
37
|
-
- - ">="
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: '0'
|
|
40
|
-
- !ruby/object:Gem::Dependency
|
|
41
|
-
name: pkg-config
|
|
42
|
-
requirement: !ruby/object:Gem::Requirement
|
|
43
|
-
requirements:
|
|
44
|
-
- - ">="
|
|
45
|
-
- !ruby/object:Gem::Version
|
|
46
|
-
version: '0'
|
|
47
|
-
type: :runtime
|
|
48
|
-
prerelease: false
|
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
-
requirements:
|
|
51
|
-
- - ">="
|
|
52
|
-
- !ruby/object:Gem::Version
|
|
53
|
-
version: '0'
|
|
11
|
+
dependencies: []
|
|
54
12
|
email:
|
|
55
13
|
- 2xijok@gmail.com
|
|
56
14
|
executables: []
|
|
57
|
-
extensions:
|
|
15
|
+
extensions:
|
|
16
|
+
- ext/htslib_native/extconf.rb
|
|
58
17
|
extra_rdoc_files: []
|
|
59
18
|
files:
|
|
60
19
|
- LICENSE.txt
|
|
61
20
|
- README.md
|
|
62
21
|
- TUTORIAL.md
|
|
22
|
+
- ext/htslib_native/extconf.rb
|
|
23
|
+
- ext/htslib_native/htslib_native.h
|
|
24
|
+
- ext/htslib_native/htslib_native_ext.c
|
|
25
|
+
- ext/htslib_native/native_bam.c
|
|
26
|
+
- ext/htslib_native/native_bcf.c
|
|
27
|
+
- ext/htslib_native/native_faidx.c
|
|
28
|
+
- ext/htslib_native/native_tabix.c
|
|
63
29
|
- lib/hts/bam.rb
|
|
64
30
|
- lib/hts/bam/auxi.rb
|
|
65
31
|
- lib/hts/bam/base_mod.rb
|
|
@@ -78,25 +44,8 @@ files:
|
|
|
78
44
|
- lib/hts/bcf/info.rb
|
|
79
45
|
- lib/hts/bcf/record.rb
|
|
80
46
|
- lib/hts/faidx.rb
|
|
81
|
-
- lib/hts/ffi_ext/README.md
|
|
82
|
-
- lib/hts/ffi_ext/pointer.rb
|
|
83
|
-
- lib/hts/ffi_ext/struct.rb
|
|
84
47
|
- lib/hts/hts.rb
|
|
85
|
-
- lib/hts/
|
|
86
|
-
- lib/hts/libhts/bgzf.rb
|
|
87
|
-
- lib/hts/libhts/constants.rb
|
|
88
|
-
- lib/hts/libhts/cram.rb
|
|
89
|
-
- lib/hts/libhts/fai.rb
|
|
90
|
-
- lib/hts/libhts/hfile.rb
|
|
91
|
-
- lib/hts/libhts/hts.rb
|
|
92
|
-
- lib/hts/libhts/kfunc.rb
|
|
93
|
-
- lib/hts/libhts/sam.rb
|
|
94
|
-
- lib/hts/libhts/sam_funcs.rb
|
|
95
|
-
- lib/hts/libhts/tbx.rb
|
|
96
|
-
- lib/hts/libhts/tbx_funcs.rb
|
|
97
|
-
- lib/hts/libhts/thread_pool.rb
|
|
98
|
-
- lib/hts/libhts/vcf.rb
|
|
99
|
-
- lib/hts/libhts/vcf_funcs.rb
|
|
48
|
+
- lib/hts/native.rb
|
|
100
49
|
- lib/hts/tabix.rb
|
|
101
50
|
- lib/hts/version.rb
|
|
102
51
|
- lib/htslib.rb
|
|
@@ -119,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
119
68
|
- !ruby/object:Gem::Version
|
|
120
69
|
version: '0'
|
|
121
70
|
requirements: []
|
|
122
|
-
rubygems_version: 4.0.
|
|
71
|
+
rubygems_version: 4.0.3
|
|
123
72
|
specification_version: 4
|
|
124
73
|
summary: HTSlib bindings for Ruby
|
|
125
74
|
test_files: []
|
data/lib/hts/ffi_ext/README.md
DELETED
data/lib/hts/ffi_ext/pointer.rb
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module FFI
|
|
4
|
-
class Pointer
|
|
5
|
-
unless method_defined?(:read_array_of_struct)
|
|
6
|
-
def read_array_of_struct(type, length)
|
|
7
|
-
ary = []
|
|
8
|
-
size = type.size
|
|
9
|
-
tmp = self
|
|
10
|
-
length.times do |j|
|
|
11
|
-
ary << type.new(tmp)
|
|
12
|
-
tmp += size unless j == length - 1 # avoid OOB
|
|
13
|
-
end
|
|
14
|
-
ary
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
data/lib/hts/ffi_ext/struct.rb
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "ffi/bit_field"
|
|
4
|
-
|
|
5
|
-
module FFI
|
|
6
|
-
class Struct
|
|
7
|
-
class << self
|
|
8
|
-
# @example HtsOpt
|
|
9
|
-
# class HtsOpt < FFI::Struct
|
|
10
|
-
# layout \
|
|
11
|
-
# :arg, :string,
|
|
12
|
-
# :opt, HtsFmtOption,
|
|
13
|
-
# :val,
|
|
14
|
-
# union_layout(
|
|
15
|
-
# :i, :int,
|
|
16
|
-
# :s, :string
|
|
17
|
-
# ),
|
|
18
|
-
# :next, HtsOpt.ptr
|
|
19
|
-
# end
|
|
20
|
-
|
|
21
|
-
def union_layout(*args)
|
|
22
|
-
Class.new(FFI::Union) { layout(*args) }
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
# @example HtsFormat
|
|
26
|
-
# class HtsFormat < FFI::Struct
|
|
27
|
-
# layout \
|
|
28
|
-
# :category, HtsFormatCategory,
|
|
29
|
-
# :format, HtsExactFormat,
|
|
30
|
-
# :version,
|
|
31
|
-
# struct_layout(
|
|
32
|
-
# :major, :short,
|
|
33
|
-
# :minor, :short
|
|
34
|
-
# ),
|
|
35
|
-
# :compression, HtsCompression,
|
|
36
|
-
# :compression_level, :short,
|
|
37
|
-
# :specific, :pointer
|
|
38
|
-
# end
|
|
39
|
-
|
|
40
|
-
def struct_layout(*args)
|
|
41
|
-
Class.new(FFI::Struct) { layout(*args) }
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
data/lib/hts/libhts/bgzf.rb
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# BGZF
|
|
4
|
-
module HTS
|
|
5
|
-
module LibHTS
|
|
6
|
-
# Open an existing file descriptor for reading or writing.
|
|
7
|
-
attach_function \
|
|
8
|
-
:bgzf_dopen,
|
|
9
|
-
%i[int string],
|
|
10
|
-
BGZF.by_ref
|
|
11
|
-
|
|
12
|
-
# Open the specified file for reading or writing.
|
|
13
|
-
attach_function \
|
|
14
|
-
:bgzf_open,
|
|
15
|
-
%i[string string],
|
|
16
|
-
BGZF.by_ref
|
|
17
|
-
|
|
18
|
-
# Open an existing hFILE stream for reading or writing.
|
|
19
|
-
attach_function \
|
|
20
|
-
:bgzf_hopen,
|
|
21
|
-
[HFile, :string],
|
|
22
|
-
BGZF.by_ref
|
|
23
|
-
|
|
24
|
-
# Close the BGZF and free all associated resources.
|
|
25
|
-
attach_function \
|
|
26
|
-
:bgzf_close,
|
|
27
|
-
[HFile],
|
|
28
|
-
:int
|
|
29
|
-
|
|
30
|
-
# Read up to _length_ bytes from the file storing into _data_.
|
|
31
|
-
attach_function \
|
|
32
|
-
:bgzf_read,
|
|
33
|
-
[HFile, :pointer, :size_t],
|
|
34
|
-
:ssize_t
|
|
35
|
-
|
|
36
|
-
# Write _length_ bytes from _data_ to the file. If no I/O errors occur,
|
|
37
|
-
# the complete _length_ bytes will be written (or queued for writing).
|
|
38
|
-
attach_function \
|
|
39
|
-
:bgzf_write,
|
|
40
|
-
[BGZF, :pointer, :size_t],
|
|
41
|
-
:ssize_t
|
|
42
|
-
|
|
43
|
-
# Write _length_ bytes from _data_ to the file, the index will be used to
|
|
44
|
-
# decide the amount of uncompressed data to be written to each bgzip block.
|
|
45
|
-
attach_function \
|
|
46
|
-
:bgzf_block_write,
|
|
47
|
-
[BGZF, :pointer, :size_t],
|
|
48
|
-
:ssize_t
|
|
49
|
-
|
|
50
|
-
# Returns the next byte in the file without consuming it.
|
|
51
|
-
attach_function \
|
|
52
|
-
:bgzf_peek,
|
|
53
|
-
[BGZF],
|
|
54
|
-
:int
|
|
55
|
-
|
|
56
|
-
# Read up to _length_ bytes directly from the underlying stream without
|
|
57
|
-
# decompressing. Bypasses BGZF blocking, so must be used with care in
|
|
58
|
-
# specialised circumstances only.
|
|
59
|
-
attach_function \
|
|
60
|
-
:bgzf_raw_read,
|
|
61
|
-
[BGZF, :pointer, :size_t],
|
|
62
|
-
:ssize_t
|
|
63
|
-
|
|
64
|
-
# Write _length_ bytes directly to the underlying stream without
|
|
65
|
-
# compressing. Bypasses BGZF blocking, so must be used with care
|
|
66
|
-
# in specialised circumstances only.
|
|
67
|
-
attach_function \
|
|
68
|
-
:bgzf_raw_write,
|
|
69
|
-
[BGZF, :pointer, :size_t],
|
|
70
|
-
:ssize_t
|
|
71
|
-
|
|
72
|
-
# Write the data in the buffer to the file.
|
|
73
|
-
attach_function \
|
|
74
|
-
:bgzf_flush,
|
|
75
|
-
[BGZF],
|
|
76
|
-
:int
|
|
77
|
-
|
|
78
|
-
# Return a virtual file pointer to the current location in the file.
|
|
79
|
-
def self.bgzf_tell(fp)
|
|
80
|
-
(fp[:block_address] << 16) | (fp[:block_offset] & 0xFFFF)
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
# Set the file to read from the location specified by _pos_.
|
|
84
|
-
attach_function \
|
|
85
|
-
:bgzf_seek,
|
|
86
|
-
[BGZF, :int64, :int],
|
|
87
|
-
:int64
|
|
88
|
-
|
|
89
|
-
# Check if the BGZF end-of-file (EOF) marker is present
|
|
90
|
-
attach_function \
|
|
91
|
-
:bgzf_check_EOF,
|
|
92
|
-
[BGZF],
|
|
93
|
-
:int
|
|
94
|
-
|
|
95
|
-
# Return the file's compression format
|
|
96
|
-
attach_function \
|
|
97
|
-
:bgzf_compression,
|
|
98
|
-
[BGZF],
|
|
99
|
-
:int
|
|
100
|
-
|
|
101
|
-
# Check if a file is in the BGZF format
|
|
102
|
-
attach_function \
|
|
103
|
-
:bgzf_is_bgzf,
|
|
104
|
-
[:string],
|
|
105
|
-
:int
|
|
106
|
-
|
|
107
|
-
# Set the cache size. Only effective when compiled with -DBGZF_CACHE.
|
|
108
|
-
attach_function \
|
|
109
|
-
:bgzf_set_cache_size,
|
|
110
|
-
[BGZF, :int],
|
|
111
|
-
:void
|
|
112
|
-
|
|
113
|
-
# Flush the file if the remaining buffer size is smaller than _size_
|
|
114
|
-
attach_function \
|
|
115
|
-
:bgzf_flush_try,
|
|
116
|
-
[BGZF, :ssize_t],
|
|
117
|
-
:int
|
|
118
|
-
|
|
119
|
-
# Read one byte from a BGZF file. It is faster than bgzf_read()
|
|
120
|
-
attach_function \
|
|
121
|
-
:bgzf_getc,
|
|
122
|
-
[BGZF],
|
|
123
|
-
:int
|
|
124
|
-
|
|
125
|
-
# Read one line from a BGZF file. It is faster than bgzf_getc()
|
|
126
|
-
attach_function \
|
|
127
|
-
:bgzf_getline,
|
|
128
|
-
[BGZF, :int, KString],
|
|
129
|
-
:int
|
|
130
|
-
|
|
131
|
-
# Read the next BGZF block.
|
|
132
|
-
attach_function \
|
|
133
|
-
:bgzf_read_block,
|
|
134
|
-
[BGZF],
|
|
135
|
-
:int
|
|
136
|
-
|
|
137
|
-
# Enable multi-threading (when compiled with -DBGZF_MT) via a shared
|
|
138
|
-
# thread pool.
|
|
139
|
-
attach_function \
|
|
140
|
-
:bgzf_thread_pool,
|
|
141
|
-
[BGZF, :pointer, :int],
|
|
142
|
-
:int
|
|
143
|
-
|
|
144
|
-
# Enable multi-threading (only effective when the library was compiled
|
|
145
|
-
# with -DBGZF_MT)
|
|
146
|
-
attach_function \
|
|
147
|
-
:bgzf_mt,
|
|
148
|
-
[BGZF, :int, :int],
|
|
149
|
-
:int
|
|
150
|
-
|
|
151
|
-
# Compress a single BGZF block.
|
|
152
|
-
attach_function \
|
|
153
|
-
:bgzf_compress,
|
|
154
|
-
%i[pointer pointer pointer size_t int],
|
|
155
|
-
:int
|
|
156
|
-
|
|
157
|
-
# Position BGZF at the uncompressed offset
|
|
158
|
-
attach_function \
|
|
159
|
-
:bgzf_useek,
|
|
160
|
-
[BGZF, :off_t, :int],
|
|
161
|
-
:int
|
|
162
|
-
|
|
163
|
-
# Position in uncompressed BGZF
|
|
164
|
-
attach_function \
|
|
165
|
-
:bgzf_utell,
|
|
166
|
-
[BGZF],
|
|
167
|
-
:off_t
|
|
168
|
-
|
|
169
|
-
# Tell BGZF to build index while compressing.
|
|
170
|
-
attach_function \
|
|
171
|
-
:bgzf_index_build_init,
|
|
172
|
-
[BGZF],
|
|
173
|
-
:int
|
|
174
|
-
|
|
175
|
-
# Load BGZF index
|
|
176
|
-
attach_function \
|
|
177
|
-
:bgzf_index_load,
|
|
178
|
-
[BGZF, :string, :string],
|
|
179
|
-
:int
|
|
180
|
-
|
|
181
|
-
# Load BGZF index from an hFILE
|
|
182
|
-
attach_function \
|
|
183
|
-
:bgzf_index_load_hfile,
|
|
184
|
-
[BGZF, HFile, :string],
|
|
185
|
-
:int
|
|
186
|
-
|
|
187
|
-
# Save BGZF index
|
|
188
|
-
attach_function \
|
|
189
|
-
:bgzf_index_dump,
|
|
190
|
-
[BGZF, :string, :string],
|
|
191
|
-
:int
|
|
192
|
-
|
|
193
|
-
# Write a BGZF index to an hFILE
|
|
194
|
-
attach_function \
|
|
195
|
-
:bgzf_index_dump_hfile,
|
|
196
|
-
[BGZF, HFile, :string],
|
|
197
|
-
:int
|
|
198
|
-
end
|
|
199
|
-
end
|