Class: HTS::VCF
- Inherits:
-
Object
- Object
- HTS::VCF
- Includes:
- Enumerable
- Defined in:
- lib/hts/vcf.rb,
lib/hts/vcf/header.rb,
lib/hts/vcf/variant.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#htf ⇒ Object
readonly
Returns the value of attribute htf.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
Instance Method Summary collapse
-
#each(&block) ⇒ Object
def inspect; end.
-
#initialize(file_path, mode = 'r') ⇒ VCF
constructor
A new instance of VCF.
- #n_samples ⇒ Object
- #seq(tid) ⇒ Object
Constructor Details
#initialize(file_path, mode = 'r') ⇒ VCF
Returns a new instance of VCF.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/hts/vcf.rb', line 14 def initialize(file_path, mode = 'r') @file_path = File.(file_path) File.exist?(@file_path) || raise("No such VCF/BCF file - #{@file_path}") @mode = mode @htf = FFI.hts_open(@file_path, mode) @header = VCF::Header.new(FFI.bcf_hdr_read(@htf)) @c = FFI.bcf_init end |
Instance Attribute Details
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
12 13 14 |
# File 'lib/hts/vcf.rb', line 12 def file_path @file_path end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
12 13 14 |
# File 'lib/hts/vcf.rb', line 12 def header @header end |
#htf ⇒ Object (readonly)
Returns the value of attribute htf.
12 13 14 |
# File 'lib/hts/vcf.rb', line 12 def htf @htf end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
12 13 14 |
# File 'lib/hts/vcf.rb', line 12 def mode @mode end |
Instance Method Details
#each(&block) ⇒ Object
def inspect; end
28 29 30 |
# File 'lib/hts/vcf.rb', line 28 def each(&block) block.call(Variant.new(@c, self)) while FFI.bcf_read(@htf, @header.h, @c) != -1 end |
#n_samples ⇒ Object
34 35 36 |
# File 'lib/hts/vcf.rb', line 34 def n_samples FFI.bcf_hdr_nsamples(header.h) end |
#seq(tid) ⇒ Object
32 |
# File 'lib/hts/vcf.rb', line 32 def seq(tid); end |