Module: Bio::KEGG::Common::DblinksAsHash

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

Overview

The module providing dblinks_as_hash methods.

Bio::KEGG::* internal use only.

Instance Method Summary collapse

Instance Method Details

Returns a Hash of the DB name and an Array of entry IDs in DBLINKS field.



96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/bio/db/kegg/common.rb', line 96

def dblinks_as_hash
  unless defined? @dblinks_as_hash
    hash = {}
    dblinks_as_strings.each do |line|
      db, ids = line.split(/\:\s*/, 2)
      list = ids.split(/\s+/)
      hash[db] = list
    end
    @dblinks_as_hash = hash
  end
  @dblinks_as_hash
end