Class: HTS::Bcf::Header
- Inherits:
-
Object
- Object
- HTS::Bcf::Header
- Defined in:
- lib/hts/bcf/header.rb
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.
6 7 8 |
# File 'lib/hts/bcf/header.rb', line 6 def initialize(hts_file) @bcf_hdr = LibHTS.bcf_hdr_read(hts_file) end |
Instance Method Details
#get_version ⇒ Object
18 19 20 |
# File 'lib/hts/bcf/header.rb', line 18 def get_version LibHTS.bcf_hdr_get_version(@bcf_hdr) end |
#nsamples ⇒ Object
22 23 24 |
# File 'lib/hts/bcf/header.rb', line 22 def nsamples LibHTS.bcf_hdr_nsamples(@bcf_hdr) end |
#samples ⇒ Object
26 27 28 29 30 31 |
# File 'lib/hts/bcf/header.rb', line 26 def samples # bcf_hdr_id2name is macro function @bcf_hdr[:samples] .read_array_of_pointer(nsamples) .map(&:read_string) end |
#struct ⇒ Object
10 11 12 |
# File 'lib/hts/bcf/header.rb', line 10 def struct @bcf_hdr end |
#to_ptr ⇒ Object
14 15 16 |
# File 'lib/hts/bcf/header.rb', line 14 def to_ptr @bcf_hdr.to_ptr end |
#to_s ⇒ Object
33 34 35 36 37 38 |
# File 'lib/hts/bcf/header.rb', line 33 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 |