Class: HTS::Bcf::HeaderRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/hts/bcf/header_record.rb

Instance Method Summary collapse

Constructor Details

#initialize(arg = nil) ⇒ HeaderRecord

Returns a new instance of HeaderRecord.



6
7
8
9
10
11
12
13
# File 'lib/hts/bcf/header_record.rb', line 6

def initialize(arg = nil)
  case arg
  when LibHTS::BcfHrec
    @bcf_hrec = arg
  else
    raise TypeError, "Invalid argument"
  end
end

Instance Method Details

#add_key(key) ⇒ Object



19
20
21
# File 'lib/hts/bcf/header_record.rb', line 19

def add_key(key)
  LibHTS.bcf_hrec_add_key(@bcf_hrec, key, key.length)
end

#find_key(key) ⇒ Object



28
29
30
# File 'lib/hts/bcf/header_record.rb', line 28

def find_key(key)
  LibHTS.bcf_hrec_find_key(@bcf_hrec, key)
end

#set_value(i, val, quote: true) ⇒ Object



23
24
25
26
# File 'lib/hts/bcf/header_record.rb', line 23

def set_value(i, val, quote: true)
  is_quoted = quote ? 1 : 0
  LibHTS.bcf_hrec_set_val(@bcf_hrec, i, val, val.length, is_quoted)
end

#structObject



15
16
17
# File 'lib/hts/bcf/header_record.rb', line 15

def struct
  @bcf_hrec
end

#to_sObject



32
33
34
35
36
# File 'lib/hts/bcf/header_record.rb', line 32

def to_s
  kstr = LibHTS::KString.new
  LibHTS.bcf_hrec_format(@bcf_hrec, kstr)
  kstr[:s]
end