Class: HTS::Bam::Header
- Inherits:
-
Object
- Object
- HTS::Bam::Header
- Defined in:
- lib/hts/bam/header.rb
Overview
A class for working with alignment header.
Instance Method Summary collapse
-
#initialize(hts_file) ⇒ Header
constructor
A new instance of Header.
- #struct ⇒ Object
- #target_count ⇒ Object
- #target_len ⇒ Object
- #target_names ⇒ Object
- #to_ptr ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(hts_file) ⇒ Header
7 8 9 |
# File 'lib/hts/bam/header.rb', line 7 def initialize(hts_file) @sam_hdr = LibHTS.sam_hdr_read(hts_file) end |
Instance Method Details
#struct ⇒ Object
11 12 13 |
# File 'lib/hts/bam/header.rb', line 11 def struct @sam_hdr end |
#target_count ⇒ Object
19 20 21 |
# File 'lib/hts/bam/header.rb', line 19 def target_count @sam_hdr[:n_targets] end |
#target_len ⇒ Object
29 30 31 32 33 |
# File 'lib/hts/bam/header.rb', line 29 def target_len Array.new(target_count) do |i| LibHTS.sam_hdr_tid2len(@sam_hdr, i) end end |
#target_names ⇒ Object
23 24 25 26 27 |
# File 'lib/hts/bam/header.rb', line 23 def target_names Array.new(target_count) do |i| LibHTS.sam_hdr_tid2name(@sam_hdr, i) end end |
#to_ptr ⇒ Object
15 16 17 |
# File 'lib/hts/bam/header.rb', line 15 def to_ptr @sam_hdr.to_ptr end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/hts/bam/header.rb', line 35 def to_s LibHTS.sam_hdr_str(@sam_hdr) end |