htslib 0.0.1 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
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.1
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - kojix2
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-25 00:00:00.000000000 Z
11
+ date: 2021-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -25,13 +25,13 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: bundler
28
+ name: ffi-bitfield
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
- type: :development
34
+ type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
@@ -39,7 +39,21 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: minitest
42
+ name: pkg-config
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - ">="
@@ -53,7 +67,7 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
- name: pry
70
+ name: irb
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
@@ -67,7 +81,7 @@ dependencies:
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: rake
84
+ name: minitest
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - ">="
@@ -81,7 +95,7 @@ dependencies:
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
- name: rubocop
98
+ name: rake
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - ">="
@@ -108,7 +122,7 @@ dependencies:
108
122
  - - ">="
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
- description:
125
+ description:
112
126
  email:
113
127
  - 2xijok@gmail.com
114
128
  executables: []
@@ -118,29 +132,36 @@ files:
118
132
  - LICENSE.txt
119
133
  - README.md
120
134
  - lib/hts/bam.rb
121
- - lib/hts/bam/alignment.rb
122
135
  - lib/hts/bam/cigar.rb
136
+ - lib/hts/bam/flag.rb
123
137
  - lib/hts/bam/header.rb
124
- - lib/hts/fai.rb
125
- - lib/hts/ffi.rb
126
- - lib/hts/ffi/bgzf.rb
127
- - lib/hts/ffi/constants.rb
128
- - lib/hts/ffi/faidx.rb
129
- - lib/hts/ffi/hfile.rb
130
- - lib/hts/ffi/hts.rb
131
- - lib/hts/ffi/kfunc.rb
132
- - lib/hts/ffi/sam.rb
133
- - lib/hts/ffi/tbx.rb
134
- - lib/hts/ffi/vcf.rb
135
- - lib/hts/tbx.rb
136
- - lib/hts/vcf.rb
138
+ - lib/hts/bam/record.rb
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
147
+ - lib/hts/libhts.rb
148
+ - lib/hts/libhts/bgzf.rb
149
+ - lib/hts/libhts/constants.rb
150
+ - lib/hts/libhts/faidx.rb
151
+ - lib/hts/libhts/hfile.rb
152
+ - lib/hts/libhts/hts.rb
153
+ - lib/hts/libhts/kfunc.rb
154
+ - lib/hts/libhts/sam.rb
155
+ - lib/hts/libhts/tbx.rb
156
+ - lib/hts/libhts/vcf.rb
157
+ - lib/hts/tabix.rb
137
158
  - lib/hts/version.rb
138
159
  - lib/htslib.rb
139
160
  homepage: https://github.com/kojix2/ruby-htslib
140
161
  licenses:
141
162
  - MIT
142
163
  metadata: {}
143
- post_install_message:
164
+ post_install_message:
144
165
  rdoc_options: []
145
166
  require_paths:
146
167
  - lib
@@ -148,15 +169,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
169
  requirements:
149
170
  - - ">="
150
171
  - !ruby/object:Gem::Version
151
- version: '2.4'
172
+ version: '2.7'
152
173
  required_rubygems_version: !ruby/object:Gem::Requirement
153
174
  requirements:
154
175
  - - ">="
155
176
  - !ruby/object:Gem::Version
156
177
  version: '0'
157
178
  requirements: []
158
- rubygems_version: 3.0.3
159
- signing_key:
179
+ rubygems_version: 3.3.3
180
+ signing_key:
160
181
  specification_version: 4
161
182
  summary: HTSlib bindings for Ruby
162
183
  test_files: []
@@ -1,156 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Based on hts-python
4
- # https://github.com/quinlan-lab/hts-python
5
-
6
- module HTS
7
- # A cigar object usually created from `Alignment`.
8
- class Bam
9
- class Alignment
10
- def initialize(bam1_t, bam_hdr_t)
11
- @b = bam1_t
12
- @h = bam_hdr_t
13
- end
14
-
15
- # def initialize_copy
16
- # super
17
- # end
18
-
19
- def self.rom_sam_str; end
20
-
21
- def tags; end
22
-
23
- # Read (query) name.
24
- def qname
25
- FFI.bam_get_qname(@b).read_string
26
- end
27
-
28
- # Set (query) name.
29
- # def qname=(name)
30
- # raise 'Not Implemented'
31
- # end
32
-
33
- # returns the chromosome of the mate or '' if not mapped.
34
- def mate_chrom
35
- tid = @b[:core][:mtid]
36
- return '' if tid == -1
37
-
38
- FFI.sam_hdr_tid2name(@h, tid)
39
- end
40
-
41
- # returns the tid of the mate or -1 if not mapped.
42
- def mate_tid
43
- @b[:core][:mtid]
44
- end
45
-
46
- # returns the tid of the alignment or -1 if not mapped.
47
- def tid
48
- @b[:core][:tid]
49
- end
50
-
51
- # mate position
52
- def mate_pos
53
- @b[:core][:mpos]
54
- end
55
-
56
- # returns 0-based start position.
57
- def start
58
- @b[:core][:pos]
59
- end
60
-
61
- # returns end position of the read.
62
- def stop
63
- FFI.bam_endpos @b
64
- end
65
-
66
- # returns the chromosome or '' if not mapped.
67
- def chrom
68
- tid = @b[:core][:tid]
69
- return '' if tid == -1
70
-
71
- FFI.sam_hdr_tid2name(@h, tid)
72
- end
73
-
74
- def strand
75
- FFI.bam_is_rev(@b) ? '-' : '+'
76
- end
77
-
78
- # def start=(v)
79
- # raise 'Not Implemented'
80
- # end
81
-
82
- # insert size
83
- def isize
84
- @b[:core][:isize]
85
- end
86
-
87
- # mapping quality
88
- def mapping_quality
89
- @b[:core][:qual]
90
- end
91
-
92
- # returns a `Cigar` object.
93
- def cigar
94
- Cigar.new(FFI.bam_get_cigar(@b), @b[:core][:n_cigar])
95
- end
96
-
97
- def qlen
98
- FFI.bam_cigar2qlen(
99
- @b[:core][:n_cigar],
100
- FFI.bam_get_cigar(@b)
101
- )
102
- end
103
-
104
- def rlen
105
- FFI.bam_cigar2rlen(
106
- @b[:core][:n_cigar],
107
- FFI.bam_get_cigar(@b)
108
- )
109
- end
110
-
111
- # return the read sequence
112
- def sequence
113
- seq_nt16_str = '=ACMGRSVTWYHKDBN'
114
- r = FFI.bam_get_seq(@b)
115
- Array.new(@b[:core][:l_qseq]) do |i|
116
- seq_nt16_str[FFI.bam_seqi(r, i)]
117
- end.join
118
- end
119
-
120
- def base_at(n)
121
- n += @b[:core][:l_qseq] if n < 0
122
- seq_nt16_str = '=ACMGRSVTWYHKDBN'
123
- return '.' if (n >= @b[:core][:l_qseq]) || (n < 0) # eg. base_at(-1000)
124
-
125
- r = FFI.bam_get_seq(@b)
126
- seq_nt16_str[FFI.bam_seqi(r, n)]
127
- end
128
-
129
- def base_qualities
130
- q_ptr = FFI.bam_get_qual(@b)
131
- q_ptr.read_array_of_uint8(@b[:core][:l_qseq])
132
- end
133
-
134
- def base_quality_at(n)
135
- n += @b[:core][:l_qseq] if n < 0 # eg. base_quality_at(-1000)
136
- return 0 if (n >= @b[:core][:l_qseq]) || (n < 0)
137
-
138
- q_ptr = FFI.bam_get_qual(@b)
139
- q_ptr.get_uint8(n)
140
- end
141
-
142
- def flag_str
143
- FFI.bam_flag2str(flag)
144
- end
145
-
146
- # returns a `Flag` object.
147
- def flag
148
- @b[:core][:flag]
149
- end
150
-
151
- # TODO:
152
- # def eql?
153
- # def hash
154
- end
155
- end
156
- end
data/lib/hts/fai.rb DELETED
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Based on hts-python
4
- # https://github.com/quinlan-lab/hts-python
5
-
6
- module HTS
7
- class Fai
8
- def initialize; end
9
-
10
- # def call
11
-
12
- def nseqs; end
13
-
14
- def include?; end
15
-
16
- # __iter__
17
- end
18
- end
data/lib/hts/ffi.rb DELETED
@@ -1,43 +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
- def self.union_layout(*args)
24
- Class.new(FFI::Union) { layout(*args) }
25
- end
26
-
27
- def self.struct_layout(*args)
28
- Class.new(FFI::Struct) { layout(*args) }
29
- end
30
- end
31
- end
32
-
33
- require_relative 'ffi/constants'
34
-
35
- # alphabetical order
36
- require_relative 'ffi/bgzf'
37
- require_relative 'ffi/faidx'
38
- require_relative 'ffi/hfile'
39
- require_relative 'ffi/hts'
40
- require_relative 'ffi/sam'
41
- require_relative 'ffi/kfunc'
42
- require_relative 'ffi/tbx'
43
- require_relative 'ffi/vcf'
data/lib/hts/tbx.rb DELETED
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Based on hts-python
4
- # https://github.com/quinlan-lab/hts-python
5
-
6
- module HTS
7
- class Tbx
8
- def initialize; end
9
-
10
- def build; end
11
-
12
- def sequences; end
13
-
14
- # def __call__\
15
- end
16
- end
data/lib/hts/vcf.rb DELETED
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Based on hts-python
4
- # https://github.com/quinlan-lab/hts-python
5
-
6
- module HTS
7
- class VCF
8
- def initialize; end
9
-
10
- def inspect; end
11
-
12
- def each; end
13
-
14
- def seq; end
15
-
16
- def n_samples; end
17
- end
18
-
19
- class Variant
20
- def initialize; end
21
-
22
- def inspect; end
23
-
24
- def formats; end
25
-
26
- def genotypes; end
27
- end
28
-
29
- class Format
30
- def initialize; end
31
- end
32
- end