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
157 def genes_as_hash
158   unless defined? @genes_as_hash
159     hash = {}
160     genes_as_strings.each do |line|
161       name, *list = line.split(/\s+/)
162       org = name.downcase.sub(/:/, '')
163       genes = list.map {|x| x.sub(/\(.*\)/, '')}
164       #names = list.map {|x| x.scan(/.*\((.*)\)/)}
165       hash[org] = genes
166     end
167     @genes_as_hash = hash
168   end
169   @genes_as_hash
170 end