Class: HTS::Bcf::Record
- Inherits:
-
Object
- Object
- HTS::Bcf::Record
- Defined in:
- lib/hts/bcf/record.rb
Instance Attribute Summary collapse
-
#header ⇒ Object
readonly
Returns the value of attribute header.
Instance Method Summary collapse
- #alleles ⇒ Object
- #alt ⇒ Object
- #chrom ⇒ Object
- #filter ⇒ Object
- #format ⇒ Object
-
#formats ⇒ Object
def inspect; end.
- #genotypes ⇒ Object
- #id ⇒ Object
- #info ⇒ Object
-
#initialize(bcf_t, header) ⇒ Record
constructor
A new instance of Record.
- #pos ⇒ Object
- #qual ⇒ Object
- #ref ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
- #struct ⇒ Object
- #to_ptr ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(bcf_t, header) ⇒ Record
Returns a new instance of Record.
6 7 8 9 |
# File 'lib/hts/bcf/record.rb', line 6 def initialize(bcf_t, header) @bcf1 = bcf_t @header = header end |
Instance Attribute Details
#header ⇒ Object (readonly)
Returns the value of attribute header.
11 12 13 |
# File 'lib/hts/bcf/record.rb', line 11 def header @header end |
Instance Method Details
#alleles ⇒ Object
86 87 88 89 90 91 |
# File 'lib/hts/bcf/record.rb', line 86 def alleles LibHTS.bcf_unpack(@bcf1, LibHTS::BCF_UN_STR) @bcf1[:d][:allele].get_array_of_pointer( 0, @bcf1[:n_allele] ).map(&:read_string) end |
#alt ⇒ Object
79 80 81 82 83 84 |
# File 'lib/hts/bcf/record.rb', line 79 def alt LibHTS.bcf_unpack(@bcf1, LibHTS::BCF_UN_STR) @bcf1[:d][:allele].get_array_of_pointer( FFI::TYPE_POINTER.size, @bcf1[:n_allele] - 1 ).map(&:read_string) end |
#chrom ⇒ Object
27 28 29 30 31 |
# File 'lib/hts/bcf/record.rb', line 27 def chrom rid = @bcf1[:rid] LibHTS.bcf_hdr_id2name(@header.struct, rid) end |
#filter ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/hts/bcf/record.rb', line 50 def filter LibHTS.bcf_unpack(@bcf1, LibHTS::BCF_UN_FLT) d = @bcf1[:d] n_flt = d[:n_flt] case n_flt when 0 "PASS" when 1 i = d[:flt].read_int LibHTS.bcf_hdr_int2id(@header.struct, LibHTS::BCF_DT_ID, i) when 2 d[:flt].get_array_of_int(0, n_flt).map do |i| LibHTS.bcf_hdr_int2id(@header.struct, LibHTS::BCF_DT_ID, i) end else raise "Unexpected number of filters. n_flt: #{n_flt}" end end |
#format ⇒ Object
98 99 100 101 |
# File 'lib/hts/bcf/record.rb', line 98 def format LibHTS.bcf_unpack(@bcf1, LibHTS::BCF_UN_FMT) Format.new(self) end |
#formats ⇒ Object
def inspect; end
23 |
# File 'lib/hts/bcf/record.rb', line 23 def formats; end |
#genotypes ⇒ Object
25 |
# File 'lib/hts/bcf/record.rb', line 25 def genotypes; end |
#id ⇒ Object
45 46 47 48 |
# File 'lib/hts/bcf/record.rb', line 45 def id LibHTS.bcf_unpack(@bcf1, LibHTS::BCF_UN_INFO) @bcf1[:d][:id] end |
#info ⇒ Object
93 94 95 96 |
# File 'lib/hts/bcf/record.rb', line 93 def info LibHTS.bcf_unpack(@bcf1, LibHTS::BCF_UN_SHR) Info.new(self) end |
#pos ⇒ Object
33 34 35 |
# File 'lib/hts/bcf/record.rb', line 33 def pos @bcf1[:pos] + 1 # FIXME end |
#qual ⇒ Object
70 71 72 |
# File 'lib/hts/bcf/record.rb', line 70 def qual @bcf1[:qual] end |
#ref ⇒ Object
74 75 76 77 |
# File 'lib/hts/bcf/record.rb', line 74 def ref LibHTS.bcf_unpack(@bcf1, LibHTS::BCF_UN_STR) @bcf1[:d][:allele].get_pointer(0).read_string end |
#start ⇒ Object
37 38 39 |
# File 'lib/hts/bcf/record.rb', line 37 def start @bcf1[:pos] end |
#stop ⇒ Object
41 42 43 |
# File 'lib/hts/bcf/record.rb', line 41 def stop @bcf1[:pos] + @bcf1[:rlen] end |
#struct ⇒ Object
13 14 15 |
# File 'lib/hts/bcf/record.rb', line 13 def struct @bcf1 end |
#to_ptr ⇒ Object
17 18 19 |
# File 'lib/hts/bcf/record.rb', line 17 def to_ptr @bcf1.to_ptr end |