class Bio::KEGG::KGML

KGML (KEGG XML) parser

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

Note for older version users

Incompatible attribute names with KGML tags

<entry>
:map -> :pathway
names()
<subtype>
edge()

Examples

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

# <pathway> attributes
puts kgml.name
puts kgml.org
puts kgml.number
puts kgml.title
puts kgml.image
puts kgml.link

kgml.entries.each do |entry|
  # <entry> attributes
  puts entry.id
  puts entry.name
  puts entry.type
  puts entry.link
  puts entry.reaction
  # <graphics> attributes
  entry.graphics.each do |graphics|
    puts graphics.name
    puts graphics.type
    puts graphics.x
    puts graphics.y
    puts graphics.width
    puts graphics.height
    puts graphics.fgcolor
    puts graphics.bgcolor
  end
  # <component> attributes
  puts entry.components
  # methood
  puts entry.names
end

kgml.relations.each do |relation|
  # <relation> attributes
  puts relation.entry1
  puts relation.entry2
  puts relation.type
  # <subtype> attributes
  puts relation.name
  puts relation.value
end

kgml.reactions.each do |reaction|
  # <reaction> attributes
  puts reaction.name
  puts reaction.type
  # <substrate> attributes
  reaction.substrates.each do |substrate|
    puts substrate.id
    puts substrate.name
    # <alt> attributes
    altnames = reaction.alt[entry_id]
    altnames.each do |name|
      puts name
    end
  end
  # <product> attributes
  reaction.products.each do |product|
    puts product.id
    puts product.name
    # <alt> attributes
    altnames = reaction.alt[entry_id]
    altnames.each do |name|
      puts name
    end
  end
end

References

Attributes

entries[RW]

entry elements (Array containing KGML::Entry objects, or nil)

image[R]

image URL of this pathway map (String or nil) (‘pathway’ element)

name[R]

KEGG-style ID string of this pathway map (String or nil) (‘pathway’ element)

number[R]

map number (String or nil) (‘pathway’ element)

org[R]

“ko” (KEGG Orthology), “ec” (KEGG ENZYME), or the KEGG 3-letter organism code (String or nil) (‘pathway’ element)

reactions[RW]

reaction elements (Array containing KGML::Reactions objects, or nil)

relations[RW]

relation elements (Array containing KGML::Relations objects, or nil)

title[R]

title (String or nil) (‘pathway’ element)

Public Class Methods

new(xml) click to toggle source

Creates a new KGML object.


Arguments:

  • (required) str: String containing xml data

Returns

Bio::KEGG::KGML object

    # File lib/bio/db/kegg/kgml.rb
141 def initialize(xml)
142   dom = REXML::Document.new(xml)
143   parse_root(dom)
144   parse_entry(dom)
145   parse_relation(dom)
146   parse_reaction(dom)
147 end