Class: HTS::Bam::Header

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

Overview

A class for working with alignment header.

Instance Method Summary collapse

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

#structObject



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

def struct
  @sam_hdr
end

#target_countObject



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

def target_count
  @sam_hdr[:n_targets]
end

#target_lenObject



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_namesObject



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_ptrObject



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

def to_ptr
  @sam_hdr.to_ptr
end

#to_sObject



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

def to_s
  LibHTS.sam_hdr_str(@sam_hdr)
end