Method: HTS::Bcf::Record#filter

Defined in:
lib/hts/bcf/record.rb

#filterObject



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/hts/bcf/record.rb', line 92

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
    id = d[:flt].read_int
    LibHTS.bcf_hdr_int2id(@header.struct, LibHTS::BCF_DT_ID, id)
  when 2..nil
    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