Class: Bio::KEGG::ORTHOLOGY

Inherits:
Bio::KEGGDB show all
Defined in:
lib/bio/db/kegg/orthology.rb

Overview

Description

KO (KEGG Orthology) entry parser.

References

Constant Summary collapse

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

Instance Method Summary collapse

Methods inherited from DB

#exists?, #fetch, #get, open, #tags

Constructor Details

#initialize(entry) ⇒ ORTHOLOGY

Reads a flat file format entry of the KO database.



31
32
33
# File 'lib/bio/db/kegg/orthology.rb', line 31

def initialize(entry)
  super(entry, TAGSIZE)
end

Instance Method Details

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



71
72
73
74
75
76
# File 'lib/bio/db/kegg/orthology.rb', line 71

def dblinks
  unless @data['DBLINKS']
    @data['DBLINKS'] = lines_fetch('DBLINKS')
  end
  @data['DBLINKS']
end

#definitionObject

Returns DEFINITION field of the entry.



51
52
53
# File 'lib/bio/db/kegg/orthology.rb', line 51

def definition
  field_fetch('DEFINITION')
end

#entry_idObject

Returns ID of the entry.



36
37
38
# File 'lib/bio/db/kegg/orthology.rb', line 36

def entry_id
  field_fetch('ENTRY')[/\S+/]
end

#genesObject

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



79
80
81
82
83
84
# File 'lib/bio/db/kegg/orthology.rb', line 79

def genes
  unless @data['GENES']
    @data['GENES'] = lines_fetch('GENES')
  end
  @data['GENES']
end

#keggclassObject

Returns CLASS field of the entry.



56
57
58
# File 'lib/bio/db/kegg/orthology.rb', line 56

def keggclass
  field_fetch('CLASS')
end

#keggclassesObject

Returns an Array of biological classes in CLASS field.



61
62
63
# File 'lib/bio/db/kegg/orthology.rb', line 61

def keggclasses
  keggclass.gsub(/ \[[^\]]+/, '').split(/\] ?/)
end

#nameObject

Returns NAME field of the entry.



41
42
43
# File 'lib/bio/db/kegg/orthology.rb', line 41

def name
  field_fetch('NAME')
end

#namesObject

Returns an Array of names in NAME field.



46
47
48
# File 'lib/bio/db/kegg/orthology.rb', line 46

def names
  name.split(', ')
end

#pathwaysObject

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



66
67
68
# File 'lib/bio/db/kegg/orthology.rb', line 66

def pathways
  keggclass.scan(/\[PATH:(.*?)\]/).flatten
end