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



6
7
8
# File 'lib/hts/bam/header.rb', line 6

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

Instance Method Details

#structObject



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

def struct
  @sam_hdr
end

#target_countObject



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

def target_count
  @sam_hdr[:n_targets]
end

#target_lenObject



28
29
30
31
32
# File 'lib/hts/bam/header.rb', line 28

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

#target_namesObject



22
23
24
25
26
# File 'lib/hts/bam/header.rb', line 22

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

#to_ptrObject



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

def to_ptr
  @sam_hdr.to_ptr
end

#to_sObject



34
35
36
# File 'lib/hts/bam/header.rb', line 34

def to_s
  LibHTS.sam_hdr_str(@sam_hdr)
end