Class: HTS::Bcf::Header
- Inherits:
-
Object
- Object
- HTS::Bcf::Header
- Defined in:
- lib/hts/bcf/header.rb
Overview
A class for working with VCF records.
Instance Method Summary collapse
- #get_version ⇒ Object
-
#initialize(hts_file) ⇒ Header
constructor
A new instance of Header.
- #nsamples ⇒ Object
- #samples ⇒ Object
- #struct ⇒ Object
- #to_ptr ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(hts_file) ⇒ Header
Returns a new instance of Header.
7 8 9 |
# File 'lib/hts/bcf/header.rb', line 7 def initialize(hts_file) @bcf_hdr = LibHTS.bcf_hdr_read(hts_file) end |
Instance Method Details
#get_version ⇒ Object
19 20 21 |
# File 'lib/hts/bcf/header.rb', line 19 def get_version LibHTS.bcf_hdr_get_version(@bcf_hdr) end |
#nsamples ⇒ Object
23 24 25 |
# File 'lib/hts/bcf/header.rb', line 23 def nsamples LibHTS.bcf_hdr_nsamples(@bcf_hdr) end |
#samples ⇒ Object
27 28 29 30 31 32 |
# File 'lib/hts/bcf/header.rb', line 27 def samples # bcf_hdr_id2name is macro function @bcf_hdr[:samples] .read_array_of_pointer(nsamples) .map(&:read_string) end |
#struct ⇒ Object
11 12 13 |
# File 'lib/hts/bcf/header.rb', line 11 def struct @bcf_hdr end |
#to_ptr ⇒ Object
15 16 17 |
# File 'lib/hts/bcf/header.rb', line 15 def to_ptr @bcf_hdr.to_ptr end |
#to_s ⇒ Object
34 35 36 37 38 39 |
# File 'lib/hts/bcf/header.rb', line 34 def to_s kstr = LibHTS::KString.new raise "Failed to get header string" unless LibHTS.bcf_hdr_format(@bcf_hdr, 0, kstr) kstr[:s] end |