Class: Bio::KEGG::KGML

Inherits:
Object show all
Defined in:
lib/bio/db/kegg/kgml.rb

Overview

KGML (KEGG XML) parser

See http://www.genome.jp/kegg/xml/ for more details on KGML.

Incompatible attribute names with KGML tags

:id -> :entry_id :type -> :category :map -> :pathway names() :name -> :label :type -> :shape :entry1 -> :node1 :entry2 -> :node2 :type -> :rel edge() :name -> :entry_id :type -> :direction

Examples

file = File.read("kgml/hsa/hsa00010.xml") kgml = Bio::KEGG::KGML.new(file)

attributes

puts kgml.name puts kgml.org puts kgml.number puts kgml.title puts kgml.image puts kgml.link

kgml.entries.each do |entry|

attributes

puts entry.entry_id puts entry.name puts entry.category puts entry.link puts entry.reaction puts entry.pathway

attributes

puts entry.label # name puts entry.shape # type puts entry.x puts entry.y puts entry.width puts entry.height puts entry.fgcolor puts entry.bgcolor

attributes

puts entry.components

methood

puts entry.names end

kgml.relations.each do |relation|

attributes

puts relation.node1 # entry1 puts relation.node2 # entry2 puts relation.rel # type

method

puts relation.edge

attributes

puts relation.name puts relation.value end

kgml.reactions.each do |reaction|

attributes

puts reaction.entry_id # name puts reaction.direction # type

attributes

reaction.substrates.each do |entry_id| puts entry_id # attributes altnames = reaction.alt altnames.each do |name| puts name end end

attributes

reaction.products.each do |entry_id| puts entry_id # attributes altnames = reaction.alt altnames.each do |name| puts name end end end

Defined Under Namespace

Classes: Entry, Reaction, Relation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ KGML

Returns a new instance of KGML.



114
115
116
117
118
119
120
# File 'lib/bio/db/kegg/kgml.rb', line 114

def initialize(xml)
  dom = REXML::Document.new(xml)
  parse_root(dom)
  parse_entry(dom)
  parse_relation(dom)
  parse_reaction(dom)
end

Instance Attribute Details

#entriesObject

Returns the value of attribute entries.



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

def entries
  @entries
end

#imageObject (readonly)

Returns the value of attribute image.



121
122
123
# File 'lib/bio/db/kegg/kgml.rb', line 121

def image
  @image
end

Returns the value of attribute link.



121
122
123
# File 'lib/bio/db/kegg/kgml.rb', line 121

def link
  @link
end

#nameObject (readonly)

Returns the value of attribute name.



121
122
123
# File 'lib/bio/db/kegg/kgml.rb', line 121

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



121
122
123
# File 'lib/bio/db/kegg/kgml.rb', line 121

def number
  @number
end

#orgObject (readonly)

Returns the value of attribute org.



121
122
123
# File 'lib/bio/db/kegg/kgml.rb', line 121

def org
  @org
end

#reactionsObject

Returns the value of attribute reactions.



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

def reactions
  @reactions
end

#relationsObject

Returns the value of attribute relations.



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

def relations
  @relations
end

#titleObject (readonly)

Returns the value of attribute title.



121
122
123
# File 'lib/bio/db/kegg/kgml.rb', line 121

def title
  @title
end