htslib 0.0.3 → 0.0.4
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 +31 -13
- data/lib/hts/bam/cigar.rb +7 -4
- data/lib/hts/bam/flag.rb +4 -2
- data/lib/hts/bam/header.rb +12 -6
- data/lib/hts/bam/record.rb +48 -33
- data/lib/hts/bam.rb +46 -17
- data/lib/hts/bcf/format.rb +52 -0
- data/lib/hts/bcf/header.rb +19 -0
- data/lib/hts/bcf/info.rb +40 -0
- data/lib/hts/bcf/record.rb +116 -0
- data/lib/hts/bcf.rb +75 -0
- data/lib/hts/{fai.rb → faidx.rb} +12 -19
- data/lib/hts/ffi_ext/README.md +8 -0
- data/lib/hts/ffi_ext/struct.rb +45 -0
- data/lib/hts/libhts/constants.rb +3 -3
- data/lib/hts/libhts/sam.rb +0 -1
- data/lib/hts/libhts/vcf.rb +107 -0
- data/lib/hts/libhts.rb +3 -111
- data/lib/hts/{tbx.rb → tabix.rb} +5 -1
- data/lib/hts/utils/open_method.rb +17 -0
- data/lib/hts/version.rb +1 -1
- data/lib/htslib.rb +3 -3
- metadata +28 -11
- data/lib/hts/vcf/format.rb +0 -24
- data/lib/hts/vcf/header.rb +0 -24
- data/lib/hts/vcf/info.rb +0 -24
- data/lib/hts/vcf/record.rb +0 -43
- data/lib/hts/vcf.rb +0 -42
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: htslib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kojix2
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ffi-bitfield
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: pkg-config
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +136,14 @@ files:
|
|
122
136
|
- lib/hts/bam/flag.rb
|
123
137
|
- lib/hts/bam/header.rb
|
124
138
|
- lib/hts/bam/record.rb
|
125
|
-
- lib/hts/
|
139
|
+
- lib/hts/bcf.rb
|
140
|
+
- lib/hts/bcf/format.rb
|
141
|
+
- lib/hts/bcf/header.rb
|
142
|
+
- lib/hts/bcf/info.rb
|
143
|
+
- lib/hts/bcf/record.rb
|
144
|
+
- lib/hts/faidx.rb
|
145
|
+
- lib/hts/ffi_ext/README.md
|
146
|
+
- lib/hts/ffi_ext/struct.rb
|
126
147
|
- lib/hts/libhts.rb
|
127
148
|
- lib/hts/libhts/bgzf.rb
|
128
149
|
- lib/hts/libhts/constants.rb
|
@@ -133,12 +154,8 @@ files:
|
|
133
154
|
- lib/hts/libhts/sam.rb
|
134
155
|
- lib/hts/libhts/tbx.rb
|
135
156
|
- lib/hts/libhts/vcf.rb
|
136
|
-
- lib/hts/
|
137
|
-
- lib/hts/
|
138
|
-
- lib/hts/vcf/format.rb
|
139
|
-
- lib/hts/vcf/header.rb
|
140
|
-
- lib/hts/vcf/info.rb
|
141
|
-
- lib/hts/vcf/record.rb
|
157
|
+
- lib/hts/tabix.rb
|
158
|
+
- lib/hts/utils/open_method.rb
|
142
159
|
- lib/hts/version.rb
|
143
160
|
- lib/htslib.rb
|
144
161
|
homepage: https://github.com/kojix2/ruby-htslib
|
@@ -153,14 +170,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
153
170
|
requirements:
|
154
171
|
- - ">="
|
155
172
|
- !ruby/object:Gem::Version
|
156
|
-
version: '2.
|
173
|
+
version: '2.7'
|
157
174
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
175
|
requirements:
|
159
176
|
- - ">="
|
160
177
|
- !ruby/object:Gem::Version
|
161
178
|
version: '0'
|
162
179
|
requirements: []
|
163
|
-
rubygems_version: 3.2.
|
180
|
+
rubygems_version: 3.2.26
|
164
181
|
signing_key:
|
165
182
|
specification_version: 4
|
166
183
|
summary: HTSlib bindings for Ruby
|
data/lib/hts/vcf/format.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# https://github.com/brentp/hts-nim/blob/master/src/hts/vcf.nim
|
4
|
-
# This is a port from Nim.
|
5
|
-
# TODO: Make it more like Ruby.
|
6
|
-
|
7
|
-
module HTS
|
8
|
-
class VCF
|
9
|
-
class Format
|
10
|
-
def initialize; end
|
11
|
-
|
12
|
-
def delete; end
|
13
|
-
|
14
|
-
def get; end
|
15
|
-
|
16
|
-
def set; end
|
17
|
-
|
18
|
-
# def fields # iterator
|
19
|
-
# end
|
20
|
-
|
21
|
-
def genotypes; end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
data/lib/hts/vcf/header.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module HTS
|
4
|
-
class VCF
|
5
|
-
class Header
|
6
|
-
attr_reader :h
|
7
|
-
|
8
|
-
def initialize(h)
|
9
|
-
@h = h
|
10
|
-
end
|
11
|
-
|
12
|
-
# FIXME: better name?
|
13
|
-
def seqs
|
14
|
-
Array.new(@h[:n_targets]) do |i|
|
15
|
-
LibHTS.sam_hdr_tid2name(@h, i)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def text
|
20
|
-
LibHTS.sam_hdr_str(@h)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
data/lib/hts/vcf/info.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# https://github.com/brentp/hts-nim/blob/master/src/hts/vcf.nim
|
4
|
-
# This is a port from Nim.
|
5
|
-
# TODO: Make it more like Ruby.
|
6
|
-
|
7
|
-
module HTS
|
8
|
-
class VCF
|
9
|
-
class Info
|
10
|
-
def initialize; end
|
11
|
-
|
12
|
-
def has_flag?; end
|
13
|
-
|
14
|
-
def get; end
|
15
|
-
|
16
|
-
def set; end
|
17
|
-
|
18
|
-
def delete; end
|
19
|
-
|
20
|
-
# def fields # iterator
|
21
|
-
# end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
data/lib/hts/vcf/record.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module HTS
|
4
|
-
class VCF
|
5
|
-
class Record
|
6
|
-
def initialize(bcf_t, vcf)
|
7
|
-
@c = bcf_t
|
8
|
-
LibHTS.bcf_unpack(@c, LibHTS::BCF_UN_ALL) # FIXME
|
9
|
-
@vcf = vcf
|
10
|
-
end
|
11
|
-
|
12
|
-
# def inspect; end
|
13
|
-
|
14
|
-
def formats; end
|
15
|
-
|
16
|
-
def genotypes; end
|
17
|
-
|
18
|
-
def pos
|
19
|
-
@c[:pos] + 1 # FIXME
|
20
|
-
end
|
21
|
-
|
22
|
-
def start
|
23
|
-
@c[:pos]
|
24
|
-
end
|
25
|
-
|
26
|
-
def stop
|
27
|
-
@c[:pos] + @c[:rlen]
|
28
|
-
end
|
29
|
-
|
30
|
-
def id
|
31
|
-
@c[:d][:id]
|
32
|
-
end
|
33
|
-
|
34
|
-
def qual
|
35
|
-
@c[:qual]
|
36
|
-
end
|
37
|
-
|
38
|
-
def ref
|
39
|
-
@c[:d][:allele].get_pointer(0).read_string
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
data/lib/hts/vcf.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Based on hts-python
|
4
|
-
# https://github.com/quinlan-lab/hts-python
|
5
|
-
|
6
|
-
require_relative "vcf/header"
|
7
|
-
require_relative "vcf/record"
|
8
|
-
|
9
|
-
module HTS
|
10
|
-
class VCF
|
11
|
-
include Enumerable
|
12
|
-
attr_reader :file_path, :mode, :htf, :header
|
13
|
-
|
14
|
-
def initialize(file_path, mode = "r")
|
15
|
-
file_path = File.expand_path(file_path)
|
16
|
-
raise("No such VCF/BCF file - #{file_path}") unless File.exist?(file_path)
|
17
|
-
|
18
|
-
@file_path = file_path
|
19
|
-
@mode = mode
|
20
|
-
@htf = LibHTS.hts_open(file_path, mode)
|
21
|
-
@header = VCF::Header.new(LibHTS.bcf_hdr_read(htf))
|
22
|
-
|
23
|
-
# FIXME: should be defined here?
|
24
|
-
@c = LibHTS.bcf_init
|
25
|
-
end
|
26
|
-
|
27
|
-
# def inspect; end
|
28
|
-
|
29
|
-
def each(&block)
|
30
|
-
while LibHTS.bcf_read(htf, header.h, @c) != -1
|
31
|
-
record = Record.new(@c, self)
|
32
|
-
block.call(record)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def seq(tid); end
|
37
|
-
|
38
|
-
def n_samples
|
39
|
-
LibHTS.bcf_hdr_nsamples(header.h)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|