| Class | Bio::KEGG::ORTHOLOGY |
| In: |
lib/bio/db/kegg/orthology.rb
|
| Parent: | KEGGDB |
| DELIMITER | = | RS = "\n///\n" |
| TAGSIZE | = | 12 |
Reads a flat file format entry of the KO database.
# File lib/bio/db/kegg/orthology.rb, line 31
31: def initialize(entry)
32: super(entry, TAGSIZE)
33: end
Returns a Hash of the DB name and an Array of entry IDs in DBLINKS field.
# File lib/bio/db/kegg/orthology.rb, line 79
79: def dblinks_as_hash
80: hash = {}
81: dblinks.each do |line|
82: name, *list = line.split(/\s+/)
83: db = name.downcase.sub(/:/, '')
84: hash[db] = list
85: end
86: return hash
87: end
Returns DEFINITION field of the entry.
# File lib/bio/db/kegg/orthology.rb, line 51
51: def definition
52: field_fetch('DEFINITION')
53: end
Returns ID of the entry.
# File lib/bio/db/kegg/orthology.rb, line 36
36: def entry_id
37: field_fetch('ENTRY')[/\S+/]
38: end
Returns a Hash of the organism ID and an Array of entry IDs in GENES field.
# File lib/bio/db/kegg/orthology.rb, line 98
98: def genes_as_hash
99: hash = {}
100: genes.each do |line|
101: name, *list = line.split(/\s+/)
102: org = name.downcase.sub(/:/, '')
103: genes = list.map {|x| x.sub(/\(.*\)/, '')}
104: #names = list.map {|x| x.scan(/.*\((.*)\)/)}
105: hash[org] = genes
106: end
107: return hash
108: end
Returns CLASS field of the entry.
# File lib/bio/db/kegg/orthology.rb, line 56
56: def keggclass
57: field_fetch('CLASS')
58: end
Returns an Array of biological classes in CLASS field.
# File lib/bio/db/kegg/orthology.rb, line 61
61: def keggclasses
62: keggclass.gsub(/ \[[^\]]+/, '').split(/\] ?/)
63: end
Returns NAME field of the entry.
# File lib/bio/db/kegg/orthology.rb, line 41
41: def name
42: field_fetch('NAME')
43: end