Class: HTS::Bam::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/hts/bam/header.rb

Instance Method Summary collapse

Constructor Details

#initialize(hts_file) ⇒ Header

Returns a new instance of Header.



9
10
11
# File 'lib/hts/bam/header.rb', line 9

def initialize(hts_file)
  @sam_hdr = LibHTS.sam_hdr_read(hts_file)
end

Instance Method Details

#structObject



13
14
15
# File 'lib/hts/bam/header.rb', line 13

def struct
  @sam_hdr
end

#target_countObject



21
22
23
# File 'lib/hts/bam/header.rb', line 21

def target_count
  @sam_hdr[:n_targets]
end

#target_lengthsObject



31
32
33
34
35
# File 'lib/hts/bam/header.rb', line 31

def target_lengths
  Array.new(target_count) do |i|
    LibHTS.sam_hdr_tid2len(@sam_hdr, i)
  end
end

#target_namesObject



25
26
27
28
29
# File 'lib/hts/bam/header.rb', line 25

def target_names
  Array.new(target_count) do |i|
    LibHTS.sam_hdr_tid2name(@sam_hdr, i)
  end
end

#to_ptrObject



17
18
19
# File 'lib/hts/bam/header.rb', line 17

def to_ptr
  @sam_hdr.to_ptr
end

#to_sObject



37
38
39
# File 'lib/hts/bam/header.rb', line 37

def to_s
  LibHTS.sam_hdr_str(@sam_hdr)
end