[BioRuby-cvs] bioruby/lib/bio/db/kegg keggtab.rb,1.8,1.9

Katayama Toshiaki k at dev.open-bio.org
Tue Sep 19 05:54:32 UTC 2006


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

Modified Files:
	keggtab.rb 
Log Message:
* document is changed to RDoc


Index: keggtab.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/keggtab.rb,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** keggtab.rb	8 May 2006 14:26:35 -0000	1.8
--- keggtab.rb	19 Sep 2006 05:54:29 -0000	1.9
***************
*** 2,8 ****
  # = bio/db/kegg/keggtab.rb - KEGG keggtab class
  #
! # Copyright::	Copyright (C) 2001 Mitsuteru C. Nakao <n at bioruby.org>
! # 		Copyright (C) 2003, 2006 KATAYAMA Toshiaki <k at bioruby.org>
! # License::	Ruby's
  #
  #  $Id$
--- 2,8 ----
  # = bio/db/kegg/keggtab.rb - KEGG keggtab class
  #
! # Copyright::  Copyright (C) 2001 Mitsuteru C. Nakao <n at bioruby.org>
! #              Copyright (C) 2003, 2006 Toshiaki Katayama <k at bioruby.org>
! # License::    Ruby's
  #
  #  $Id$
***************
*** 12,23 ****
  class KEGG
  
  # Parse 'keggtab' KEGG database definition file which also includes
! # Taxonomic category of the KEGG organisms.  The 'keggtab' file can
! # be found in
  #
! # * ((<URL:ftp://ftp.genome.jp/pub/kegg/tarfiles/genes.tar.gz>))
  #
  class Keggtab
  
    def initialize(file_path, bioroot = nil)
      @bioroot = ENV['BIOROOT'] || bioroot
--- 12,55 ----
  class KEGG
  
+ # == Description
+ #
  # Parse 'keggtab' KEGG database definition file which also includes
! # Taxonomic category of the KEGG organisms.
  #
! # == References
! #
! # The 'keggtab' file is included in
! #
! # * ftp://ftp.genome.jp/pub/kegg/tarfiles/genes.tar.gz
! # * ftp://ftp.genome.jp/pub/kegg/tarfiles/genes.weekly.last.tar.Z
! #
! # == Format
! #
! # File format is something like
! # 
! #   # KEGGTAB
! #   #
! #   # name            type            directory                    abbreviation
! #   #
! #   enzyme            enzyme          $BIOROOT/db/ideas/ligand     ec
! #   ec                alias           enzyme
! #   (snip)
! #   # Human
! #   h.sapiens         genes           $BIOROOT/db/kegg/genes       hsa
! #   H.sapiens         alias           h.sapiens
! #   hsa               alias           h.sapiens
! #   (snip)
! #   #
! #   # Taxonomy
! #   #
! #   (snip)
! #   animals           alias           hsa+mmu+rno+dre+dme+cel
! #   eukaryotes        alias           animals+plants+protists+fungi
! #   genes             alias           eubacteria+archaea+eukaryotes
  #
  class Keggtab
  
+   # Path for keggtab file and optionally set bioroot top directory.
+   # Environmental variable BIOROOT overrides bioroot.
    def initialize(file_path, bioroot = nil)
      @bioroot = ENV['BIOROOT'] || bioroot
***************
*** 29,33 ****
      end
    end
!   attr_reader :bioroot, :db_names
  
  
--- 61,68 ----
      end
    end
! 
!   # Returns a string of the BIOROOT path prefix.
!   attr_reader :bioroot
!   attr_reader :db_names
  
  
***************
*** 35,38 ****
--- 70,74 ----
  
    class DB
+     # Create a container object for database definitions.
      def initialize(db_name, db_type, db_path, db_abbrev)
        @name = db_name
***************
*** 42,46 ****
        @aliases = Array.new
      end
!     attr_reader :name, :type, :path, :abbrev, :aliases
      alias korg abbrev
      alias keggorg abbrev
--- 78,94 ----
        @aliases = Array.new
      end
!     # Database name. (e.g. 'enzyme', 'h.sapies', 'e.coli', ...)
!     attr_reader :name
!     # Definition type. (e.g. 'enzyme', 'alias', 'genes', ...)
!     attr_reader :type
!     # Database flat file path. (e.g. '$BIOROOT/db/kegg/genes', ...)
!     attr_reader :path
!     # Short name for the database. (e.g. 'ec', 'hsa', 'eco', ...)
!     # korg and keggorg are alias for abbrev method.
!     attr_reader :abbrev
!     # Array containing all alias names for the database.
!     # (e.g. ["H.sapiens", "hsa"], ["E.coli", "eco"], ...)
!     attr_reader :aliases
! 
      alias korg abbrev
      alias keggorg abbrev
***************
*** 50,53 ****
--- 98,103 ----
    # DB section
  
+   # Returns a hash containing DB definition section of the keggtab file.
+   # If database name is given as an argument, returns a Keggtab::DB object.
    def database(db_abbrev = nil)
      if db_abbrev
***************
*** 58,61 ****
--- 108,113 ----
    end
  
+   # Returns an Array containing all alias names for the database.
+   # (e.g. 'hsa' -> ["H.sapiens", "hsa"], 'hpj' -> ["H.pylori_J99", "hpj"])
    def aliases(db_abbrev)
      if @database[db_abbrev]
***************
*** 64,67 ****
--- 116,121 ----
    end
  
+   # Returns a canonical database name for the abbreviation.
+   # (e.g. 'ec' -> 'enzyme',  'hsa' -> 'h.sapies', ...)
    def name(db_abbrev)
      if @database[db_abbrev]
***************
*** 70,73 ****
--- 124,129 ----
    end
  
+   # Returns an absolute path for the flat file database.
+   # (e.g. '/bio/db/kegg/genes', ...)
    def path(db_abbrev)
      if @database[db_abbrev]
***************
*** 82,85 ****
--- 138,142 ----
  
  
+   # deprecated
    def alias_list(db_name)
      if @db_names[db_name]
***************
*** 88,91 ****
--- 145,149 ----
    end
  
+   # deprecated
    def db_path(db_name)
      if @bioroot
***************
*** 96,99 ****
--- 154,158 ----
    end
  
+   # deprecated
    def db_by_abbrev(db_abbrev)
      @db_names.each do |k, db|
***************
*** 103,110 ****
--- 162,171 ----
    end
  
+   # deprecated
    def name_by_abbrev(db_abbrev)
      db_by_abbrev(db_abbrev).name
    end
  
+   # deprecated
    def db_path_by_abbrev(db_abbrev)
      db_name = name_by_abbrev(db_abbrev)
***************
*** 115,118 ****
--- 176,183 ----
    # Taxonomy section
  
+   # Returns a hash containing Taxonomy section of the keggtab file.
+   # If argument is given, returns a List of all child nodes belongs
+   # to the label node.
+   # (e.g. "eukaryotes" -> ["animals", "plants", "protists", "fungi"], ...)
    def taxonomy(node = nil)
      if node
***************
*** 123,126 ****
--- 188,193 ----
    end
  
+   # List of all node labels from Taxonomy section.
+   # (e.g. ["actinobacteria", "animals", "archaea", "bacillales", ...)
    def taxa_list
      @taxonomy.keys.sort
***************
*** 131,134 ****
--- 198,204 ----
    end
  
+   # Returns an array of organism names included in the specified taxon
+   # label. (e.g. 'proteobeta' -> ["nme", "nma", "rso"])
+   # This method has taxo2keggorgs, taxon2korgs, and taxon2keggorgs aliases.
    def taxo2korgs(node = 'genes')
      if node.length == 3
***************
*** 150,153 ****
--- 220,226 ----
    alias taxon2keggorgs taxo2korgs
  
+   # Returns an array of taxonomy names the organism belongs.
+   # (e.g. 'eco' -> ['proteogamma','proteobacteria','eubacteria','genes'])
+   # This method has aliases as keggorg2taxo, korg2taxonomy, keggorg2taxonomy.
    def korg2taxo(keggorg)
      tmp = Array.new
***************
*** 283,413 ****
  
  
- 
- =begin
- 
- The keggtab file is included in
- 
-   * ((URL:ftp://ftp.genome.jp/pub/kegg/tarfiles/genes.weekly.last.tar.Z>))
- 
- File format is something like
- 
-   # KEGGTAB
-   #
-   # name            type            directory                     abbreviation
-   #
-   enzyme            enzyme          $BIOROOT/db/ideas/ligand      ec
-   ec                alias           enzyme
-   (snip)
-   # Human
-   h.sapiens         genes           $BIOROOT/db/kegg/genes        hsa
-   H.sapiens         alias           h.sapiens
-   hsa               alias           h.sapiens
-   (snip)
-   #
-   # Taxonomy
-   #
-   (snip)
-   animals           alias           hsa+mmu+rno+dre+dme+cel
-   eukaryotes        alias           animals+plants+protists+fungi
-   genes             alias           eubacteria+archaea+eukaryotes
- 
- = Bio::KEGG::Keggtab
- 
- --- Bio::KEGG::Keggtab.new(file_path, bioroot = nil)
- 
-       Path for keggtab file and optionally set bioroot top directory.
-       Environmental variable BIOROOT overrides bioroot.
- 
- --- Bio::KEGG::Keggtab#database -> Hash
- 
-       Returns a hash containing DB definition section of the keggtab file.
- 
- --- Bio::KEGG::Keggtab#database(db_abbrev) -> Keggtab::DB
- 
-       Returns a Keggtab::DB object.
- 
- --- Bio::KEGG::Keggtab#taxonomy -> Hash
- 
-       Returns a hash containing Taxonomy section of the keggtab file.
- 
- --- Bio::KEGG::Keggtab#taxonomy(node) -> Array
- 
-       Returns a List of all child nodes belongs to the label node.
-       (e.g. "eukaryotes" -> ["animals", "plants", "protists", "fungi"], ...)
- 
- --- Bio::KEGG::Keggtab#bioroot -> String
- 
-       Returns a string of the BIOROOT path prefix.
- 
- --- Bio::KEGG::Keggtab#name(db_abbrev) -> String
- 
-       Returns a canonical database name for the abbreviation.
-       (e.g. 'ec' -> 'enzyme',  'hsa' -> 'h.sapies', ...)
- 
- --- Bio::KEGG::Keggtab#aliases(db_abbrev) -> Array
- 
-       Returns an Array containing all alias names for the database.
-       (e.g. 'hsa' -> ["H.sapiens", "hsa"], 'hpj' -> ["H.pylori_J99", "hpj"])
- 
- --- Bio::KEGG::Keggtab#path(db_abbrev) -> String
- 
-       Returns an absolute path for the flat file database.
-       (e.g. '/bio/db/kegg/genes', ...)
- 
- --- Bio::KEGG::Keggtab#taxa_list -> Array
- 
-       List of all node labels from Taxonomy section.
-       (e.g. ["actinobacteria", "animals", "archaea", "bacillales", ...)
- 
- --- Bio::KEGG::Keggtab#taxo2korgs(taxon) -> Array
- 
-       Returns an array of organism names included in the specified taxon
-       label. (e.g. 'proteobeta' -> ["nme", "nma", "rso"])
-       This method has taxo2keggorgs, taxon2korgs, and taxon2keggorgs aliases.
- 
- --- Bio::KEGG::Keggtab#korg2taxo(keggorg) -> Array
- 
-       Returns an array of taxonomy names the organism belongs.
-       (e.g. 'eco' -> ['proteogamma','proteobacteria','eubacteria','genes'])
-       This method has aliases as keggorg2taxo, korg2taxonomy, keggorg2taxonomy.
- 
- * following methods are deprecated
- 
- --- Bio::KEGG::Keggtab#db_names[db_name] -> Keggtab::DB
- --- Bio::KEGG::Keggtab#db_by_abbrev(db_abbrev) -> Keggtab::DB
- --- Bio::KEGG::Keggtab#alias_list(db_name) -> Array
- --- Bio::KEGG::Keggtab#name_by_abbrev(db_abbrev) -> String
- --- Bio::KEGG::Keggtab#db_path(db_name) -> String
- --- Bio::KEGG::Keggtab#db_path_by_abbrev(keggorg) -> String
- 
- 
- == Bio::KEGG::Keggtab::DB
- 
- --- Bio::KEGG::Keggtab::DB.new(db_name, db_type, db_path, db_abbrev)
- 
-       Create a container object for database definitions.
- 
- --- Bio::KEGG::Keggtab::DB#name -> String
- 
-       Database name. (e.g. 'enzyme', 'h.sapies', 'e.coli', ...)
- 
- --- Bio::KEGG::Keggtab::DB#type -> String
- 
-       Definition type. (e.g. 'enzyme', 'alias', 'genes', ...)
- 
- --- Bio::KEGG::Keggtab::DB#path -> String
- 
-       Database flat file path. (e.g. '$BIOROOT/db/kegg/genes', ...)
- 
- --- Bio::KEGG::Keggtab::DB#abbrev -> String
- 
-       Short name for the database. (e.g. 'ec', 'hsa', 'eco', ...)
-       korg and keggorg are alias for abbrev method.
- 
- --- Bio::KEGG::Keggtab::DB#aliases -> Array
- 
-       Array containing all alias names for the database.
-       (e.g. ["H.sapiens", "hsa"], ["E.coli", "eco"], ...)
- 
- =end
- 
--- 356,357 ----




More information about the bioruby-cvs mailing list