class HTS::VCF

Attributes

file_path[R]
header[R]
htf[R]
mode[R]

Public Class Methods

new(file_path, mode = "r") click to toggle source
# File lib/hts/vcf.rb, line 14
def initialize(file_path, mode = "r")
  file_path = File.expand_path(file_path)
  raise("No such VCF/BCF file - #{file_path}") unless File.exist?(file_path)

  @file_path = file_path
  @mode      = mode
  @htf       = LibHTS.hts_open(file_path, mode)
  @header = VCF::Header.new(LibHTS.bcf_hdr_read(htf))

  # FIXME: should be defined here?
  @c = LibHTS.bcf_init
end

Public Instance Methods

each(&block) click to toggle source

def inspect; end

# File lib/hts/vcf.rb, line 29
def each(&block)
  while LibHTS.bcf_read(htf, header.h, @c) != -1
    record = Record.new(@c, self)
    block.call(record)
  end
end
n_samples() click to toggle source
# File lib/hts/vcf.rb, line 38
def n_samples
  LibHTS.bcf_hdr_nsamples(header.h)
end
seq(tid) click to toggle source
# File lib/hts/vcf.rb, line 36
def seq(tid); end