module Bio::KEGG::Common::GenesAsHash

This module provides #genes_as_hash method.

Bio::KEGG::* internal use only.

Public Instance Methods

genes_as_hash() click to toggle source

Returns a Hash of the organism ID and an Array of entry IDs in GENES field.

# File lib/bio/db/kegg/common.rb, line 157
def genes_as_hash
  unless defined? @genes_as_hash
    hash = {}
    genes_as_strings.each do |line|
      name, *list = line.split(/\s+/)
      org = name.downcase.sub(/:/, '')
      genes = list.map {|x| x.sub(/\(.*\)/, '')}
      #names = list.map {|x| x.scan(/.*\((.*)\)/)}
      hash[org] = genes
    end
    @genes_as_hash = hash
  end
  @genes_as_hash
end