[BioRuby-cvs] bioruby/lib/bio/db/kegg kgml.rb,1.1,1.2

Katayama Toshiaki k at pub.open-bio.org
Sat Nov 5 03:29:55 EST 2005


Update of /home/repository/bioruby/bioruby/lib/bio/db/kegg
In directory pub.open-bio.org:/tmp/cvs-serv29593/lib/bio/db/kegg

Modified Files:
	kgml.rb 
Log Message:
* entry ids are converted to int (to_i)


Index: kgml.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/kgml.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** kgml.rb	23 Oct 2005 08:27:22 -0000	1.1
--- kgml.rb	5 Nov 2005 08:29:53 -0000	1.2
***************
*** 2,7 ****
  # = bio/db/kegg/kgml.rb - KEGG KGML parser class
  #
! # Author::	Toshiaki Katayama <k at bioruby.org>
! # Copyright::	Copyright (C) 2005 BioRuby project
  # License::	LGPL
  #
--- 2,7 ----
  # = bio/db/kegg/kgml.rb - KEGG KGML parser class
  #
! # Copyright::	Copyright (C) 2005
! # 		Toshiaki Katayama <k at bioruby.org>
  # License::	LGPL
  #
***************
*** 29,32 ****
--- 29,33 ----
  #    puts entry.id
  #    puts entry.name
+ #    puts entry.names
  #    puts entry.type
  #    puts entry.link
***************
*** 50,53 ****
--- 51,57 ----
  #    puts relation.type
  #    # <subtype> attributes
+ #    puts relation.name
+ #    puts relation.value
+ #    # or
  #    relation.subtype.each do |value, name|
  #      puts value, name
***************
*** 116,120 ****
  
    class Entry
!     attr_accessor :id, :name, :type, :link, :reaction, :map
      attr_accessor :label, :x, :y, :type, :width, :height, :fgcolor, :bgcolor
    end
--- 120,124 ----
  
    class Entry
!     attr_accessor :id, :name, :names, :type, :link, :reaction, :map
      attr_accessor :label, :x, :y, :type, :width, :height, :fgcolor, :bgcolor
    end
***************
*** 122,125 ****
--- 126,130 ----
    class Relation
      attr_accessor :entry1, :entry2, :type
+     attr_accessor :name, :value
      attr_accessor :subtype      			# Hash
    end
***************
*** 150,153 ****
--- 155,159 ----
        entry.map       = attr["map"]
        entry.name      = attr["name"]
+       entry.names     = entry.name.split(/\s+/)
        entry.type      = attr["type"]
        entry.link      = attr["link"]
***************
*** 175,180 ****
        attr = node.attributes
        relation = Relation.new
!       relation.entry1 = attr["entry1"]
!       relation.entry2 = attr["entry2"]
        relation.type   = attr["type"]
  
--- 181,186 ----
        attr = node.attributes
        relation = Relation.new
!       relation.entry1 = attr["entry1"].to_i
!       relation.entry2 = attr["entry2"].to_i
        relation.type   = attr["type"]
  
***************
*** 182,190 ****
        node.elements.each("subtype") { |subtype|
          attr = subtype.attributes
!         name = attr["name"]
!         e_id = attr["value"].to_i
!         hash[e_id] = name
        }
        relation.subtype = hash
      }
    end
--- 188,197 ----
        node.elements.each("subtype") { |subtype|
          attr = subtype.attributes
!         relation.name  = name  = attr["name"]
!         relation.value = value = attr["value"].to_i
!         hash[value] = name
        }
        relation.subtype = hash
+       @relations << relation
      }
    end
***************
*** 223,226 ****
--- 230,235 ----
        reaction.products   = products
        reaction.alt        = hash
+ 
+       @reactions << reaction
      }
    end



More information about the bioruby-cvs mailing list