Method: Bio::GenBank#basecount

Defined in:
lib/bio/db/genbank/genbank.rb

#basecount(base = nil) ⇒ Object

BASE COUNT (this field is obsoleted after GenBank release 138.0) – Returns the BASE COUNT as a Hash. When the base is specified, returns count of the base as a Fixnum. The base can be one of ‘a’, ‘t’, ‘g’, ‘c’, and ‘o’ (others).



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/bio/db/genbank/genbank.rb', line 99

def basecount(base = nil)
  unless @data['BASE COUNT']
    hash = Hash.new(0)
    get('BASE COUNT').scan(/(\d+) (\w)/).each do |c, b|
      hash[b] = c.to_i
    end
    @data['BASE COUNT'] = hash
  end

  if base
    base.downcase!
    @data['BASE COUNT'][base]
  else
    @data['BASE COUNT']
  end
end