Parent

Methods

Class/Module Index [+]

Quicksearch

Bio::KEGG::KGML

KGML (KEGG XML) parser

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

Incompatible attribute names with KGML tags

<entry>

:id -> :entry_id
:type -> :category
:map -> :pathway
names()
<graphics>
:name -> :label
:type -> :shape

<relation>

:entry1 -> :node1
:entry2 -> :node2
:type -> :rel
<subtype>
edge()

<reaction>

:name -> :entry_id
:type -> :direction

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.entry_id
  puts entry.name
  puts entry.category
  puts entry.link
  puts entry.reaction
  puts entry.pathway
  # <graphics> 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
  # <component> attributes
  puts entry.components
  # methood
  puts entry.names
end

kgml.relations.each do |relation|
  # <relation> attributes
  puts relation.node1      # entry1
  puts relation.node2      # entry2
  puts relation.rel        # type
  # method
  puts relation.edge
  # <subtype> attributes
  puts relation.name
  puts relation.value
end

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

Attributes

entries[RW]
image[R]
name[R]
number[R]
org[R]
reactions[RW]
relations[RW]
title[R]

Public Class Methods

new(xml) click to toggle source
# 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.