Class | Bio::KEGG::ORTHOLOGY
In: | lib/bio/db/kegg/orthology.rb
Parent: | KEGGDB

## Description

KO (KEGG Orthology) entry parser.

## References

- www.genome.jp/dbget-bin/get_htext?KO
- ftp.genome.jp/pub/kegg/genes/ko

### Methods

dblinks dblinks_as_hash definition entry_id genes genes_as_hash keggclass keggclasses name names new pathways

### Constants

DELIMITER | = | RS = "\n///\n"
TAGSIZE | = | 12

### Public Class methods

new(entry)

Reads a flat file format entry of the KO database.

[Source]

        # File lib/bio/db/kegg/orthology.rb, line 31
    31:   def initialize(entry)
    32:     super(entry, TAGSIZE)
    33:   end

### Public Instance methods

dblinks()

Returns an Array of a database name and entry IDs in DBLINKS field.

[Source]

        # File lib/bio/db/kegg/orthology.rb, line 71
    71:   def dblinks
    72:     unless @data['DBLINKS']
    73:       @data['DBLINKS'] = lines_fetch('DBLINKS')
    74:     end
    75:     @data['DBLINKS']
    76:   end

dblinks_as_hash()

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

[Source]

        # 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

definition()

Returns DEFINITION field of the entry.

[Source]

        # File lib/bio/db/kegg/orthology.rb, line 51
    51:   def definition
    52:     field_fetch('DEFINITION')
    53:   end

entry_id()

Returns ID of the entry.

[Source]

        # File lib/bio/db/kegg/orthology.rb, line 36
    36:   def entry_id
    37:     field_fetch('ENTRY')[/\S+/]
    38:   end

genes()

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

[Source]

        # File lib/bio/db/kegg/orthology.rb, line 90
    90:   def genes
    91:     unless @data['GENES']
    92:       @data['GENES'] = lines_fetch('GENES')
    93:     end
    94:     @data['GENES']
    95:   end

genes_as_hash()

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

[Source]

         # 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

keggclass()

Returns CLASS field of the entry.

[Source]

        # File lib/bio/db/kegg/orthology.rb, line 56
    56:   def keggclass
    57:     field_fetch('CLASS')
    58:   end

keggclasses()

Returns an Array of biological classes in CLASS field.

[Source]

        # File lib/bio/db/kegg/orthology.rb, line 61
    61:   def keggclasses
    62:     keggclass.gsub(/ \[[^\]]+/, '').split(/\] ?/)
    63:   end

name()

Returns NAME field of the entry.

[Source]

        # File lib/bio/db/kegg/orthology.rb, line 41
    41:   def name
    42:     field_fetch('NAME')
    43:   end

names()

Returns an Array of names in NAME field.

[Source]

        # File lib/bio/db/kegg/orthology.rb, line 46
    46:   def names
    47:     name.split(', ')
    48:   end

pathways()

Returns an Array of KEGG/PATHWAY ID in CLASS field.

[Source]

        # File lib/bio/db/kegg/orthology.rb, line 66
    66:   def pathways
    67:     keggclass.scan(/\[PATH:(.*?)\]/).flatten
    68:   end

[Validate]