class Bio::DB::FastaLengthDB

Simple class representing a file of Fasta format sequences and each ones length

Public Class Methods

new(args) click to toggle source
# File lib/bio/util/bio-gngm.rb, line 20
def initialize(args)
  @file = args[:file]
  @seqs = {}
  file = Bio::FastaFormat.open(@file)
  file.each do |entry|
    @seqs[entry.entry_id] = entry.length
  end
  
  def each
    @seqs.keys.sort.each do |k|
      yield k, @seqs[k]
    end
  end
  
end

Public Instance Methods

each() { |k, seqs| ... } click to toggle source
# File lib/bio/util/bio-gngm.rb, line 28
def each
  @seqs.keys.sort.each do |k|
    yield k, @seqs[k]
  end
end