Class: Bio::KEGG::KGML
Overview
KGML (KEGG XML) parser
See http://www.genome.jp/kegg/xml/ for more details on KGML.
Incompatible attribute names with KGML tags
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
reaction.products.each do |entry_id|
puts entry_id
#
Defined Under Namespace
Classes: Entry, Reaction, Relation
Instance Attribute Summary collapse
-
#entries ⇒ Object
Returns the value of attribute entries.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#org ⇒ Object
readonly
Returns the value of attribute org.
-
#reactions ⇒ Object
Returns the value of attribute reactions.
-
#relations ⇒ Object
Returns the value of attribute relations.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(xml) ⇒ KGML
constructor
A new instance of KGML.
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
#entries ⇒ Object
Returns the value of attribute entries.
122 123 124 |
# File 'lib/bio/db/kegg/kgml.rb', line 122 def entries @entries end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
121 122 123 |
# File 'lib/bio/db/kegg/kgml.rb', line 121 def image @image end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
121 122 123 |
# File 'lib/bio/db/kegg/kgml.rb', line 121 def link @link end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
121 122 123 |
# File 'lib/bio/db/kegg/kgml.rb', line 121 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
121 122 123 |
# File 'lib/bio/db/kegg/kgml.rb', line 121 def number @number end |
#org ⇒ Object (readonly)
Returns the value of attribute org.
121 122 123 |
# File 'lib/bio/db/kegg/kgml.rb', line 121 def org @org end |
#reactions ⇒ Object
Returns the value of attribute reactions.
122 123 124 |
# File 'lib/bio/db/kegg/kgml.rb', line 122 def reactions @reactions end |
#relations ⇒ Object
Returns the value of attribute relations.
122 123 124 |
# File 'lib/bio/db/kegg/kgml.rb', line 122 def relations @relations end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
121 122 123 |
# File 'lib/bio/db/kegg/kgml.rb', line 121 def title @title end |