class HTS::Fai
Public Class Methods
new(path)
click to toggle source
# File lib/hts/fai.rb, line 19 def initialize(path) @path = File.expand_path(path) @path.delete_suffix!(".fai") LibHTS.fai_build(@path) unless File.exist?("#{@path}.fai") @fai = LibHTS.fai_load(@path) raise if @fai.null? # at_exit{LibHTS.fai_destroy(@fai)} end
open(path) { |fai| ... }
click to toggle source
FIXME: API
# File lib/hts/fai.rb, line 9 def self.open(path) fai = new(path) if block_given? yield(fai) fai.close else fai end end
Public Instance Methods
cget()
click to toggle source
FIXME: naming and syntax
# File lib/hts/fai.rb, line 50 def cget; end
chrom_size(chrom)
click to toggle source
return the length of the requested chromosome.
# File lib/hts/fai.rb, line 40 def chrom_size(chrom) raise ArgumentError, "Expect chrom to be String or Symbol" unless chrom.is_a?(String) || chrom.is_a?(Symbol) chrom = chrom.to_s result = LibHTS.faidx_seq_len(@fai, chrom) result == -1 ? nil : result end
Also aliased as: chrom_length
close()
click to toggle source
# File lib/hts/fai.rb, line 29 def close LibHTS.fai_destroy(@fai) end
get()
click to toggle source
FIXME: naming and syntax
# File lib/hts/fai.rb, line 53 def get; end
size()
click to toggle source
the number of sequences in the index.
# File lib/hts/fai.rb, line 34 def size LibHTS.faidx_nseq(@fai) end
Also aliased as: length