Class: Bio::KEGG::COMPOUND

Inherits:
Bio::KEGGDB show all
Includes:
Bio::KEGG::Common::DblinksAsHash, Bio::KEGG::Common::PathwaysAsHash
Defined in:
lib/bio/db/kegg/compound.rb

Overview

Description

Bio::KEGG::COMPOUND is a parser class for the KEGG COMPOUND database entry. KEGG COMPOUND is a chemical structure database.

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) ⇒ COMPOUND

Creates a new Bio::KEGG::COMPOUND object.


Arguments:

  • (required) entry: (String) single entry as a string

Returns

Bio::KEGG::COMPOUND object



45
46
47
# File 'lib/bio/db/kegg/compound.rb', line 45

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

Instance Method Details

#commentObject

COMMENT



132
133
134
# File 'lib/bio/db/kegg/compound.rb', line 132

def comment
  field_fetch('COMMENT')
end

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



32
# File 'lib/bio/db/kegg/compound.rb', line 32

def dblinks_as_hash; super; end

DBLINKS



122
123
124
# File 'lib/bio/db/kegg/compound.rb', line 122

def dblinks_as_strings
  lines_fetch('DBLINKS')
end

#entry_idObject

ENTRY



50
51
52
# File 'lib/bio/db/kegg/compound.rb', line 50

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

#enzymesObject

ENZYME



109
110
111
112
113
114
115
116
117
118
119
# File 'lib/bio/db/kegg/compound.rb', line 109

def enzymes
  unless @data['ENZYME']
    field = fetch('ENZYME')
    if /\(/.match(field)	# old version
      @data['ENZYME'] = field.scan(/\S+ \(\S+\)/)
    else
      @data['ENZYME'] = field.scan(/\S+/)
    end
  end
  @data['ENZYME']
end

#formulaObject

FORMULA



65
66
67
# File 'lib/bio/db/kegg/compound.rb', line 65

def formula
  field_fetch('FORMULA')
end

#glycansObject

GLYCAN



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

def glycans
  unless @data['GLYCAN']
    @data['GLYCAN'] = fetch('GLYCAN').split(/\s+/)
  end
  @data['GLYCAN']
end

#kcfObject

ATOM, BOND



127
128
129
# File 'lib/bio/db/kegg/compound.rb', line 127

def kcf
  return "#{get('ATOM')}#{get('BOND')}"
end

#massObject

MASS



70
71
72
# File 'lib/bio/db/kegg/compound.rb', line 70

def mass
  field_fetch('MASS').to_f
end

#nameObject

The first name recorded in the NAME field.



60
61
62
# File 'lib/bio/db/kegg/compound.rb', line 60

def name
  names.first
end

#namesObject

NAME



55
56
57
# File 'lib/bio/db/kegg/compound.rb', line 55

def names
  field_fetch('NAME').split(/\s*;\s*/)
end

#pathways_as_hashObject Also known as: pathways

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



37
# File 'lib/bio/db/kegg/compound.rb', line 37

def pathways_as_hash; super; end

#pathways_as_stringsObject

PATHWAY



104
105
106
# File 'lib/bio/db/kegg/compound.rb', line 104

def pathways_as_strings
  lines_fetch('PATHWAY') 
end

#reactionsObject

REACTION



88
89
90
91
92
93
# File 'lib/bio/db/kegg/compound.rb', line 88

def reactions
  unless @data['REACTION']
    @data['REACTION'] = fetch('REACTION').split(/\s+/)
  end
  @data['REACTION']
end

#remarkObject

REMARK



75
76
77
# File 'lib/bio/db/kegg/compound.rb', line 75

def remark
  field_fetch('REMARK')
end

#rpairsObject

RPAIR



96
97
98
99
100
101
# File 'lib/bio/db/kegg/compound.rb', line 96

def rpairs
  unless @data['RPAIR']
    @data['RPAIR'] = fetch('RPAIR').split(/\s+/)
  end
  @data['RPAIR']
end