Module: Bio::KEGG::Common::PathwaysAsHash

Included in:
Bio::KEGG::COMPOUND, DRUG, ENZYME, GENES, GLYCAN, ORTHOLOGY, PATHWAY, REACTION
Defined in:
lib/bio/db/kegg/common.rb

Overview

The module providing pathways_as_hash method.

Bio::KEGG::* internal use only.

Instance Method Summary collapse

Instance Method Details

#pathways_as_hashObject

Returns a Hash of the pathway ID and name in PATHWAY field.



116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/bio/db/kegg/common.rb', line 116

def pathways_as_hash
  unless defined? @pathways_as_hash then
    hash = {}
    pathways_as_strings.each do |line|
      line = line.sub(/\APATH\:\s+/, '')
      entry_id, name = line.split(/\s+/, 2)
      hash[entry_id] = name
    end
    @pathways_as_hash = hash
  end
  @pathways_as_hash
end