From k at dev.open-bio.org Tue Sep 19 01:39:07 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Tue, 19 Sep 2006 05:39:07 +0000 Subject: [BioRuby-cvs] bioruby README.DEV,1.10,1.11 Message-ID: <200609190539.k8J5d7bK031135@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv31131 Modified Files: README.DEV Log Message: * fix of the code template Index: README.DEV =================================================================== RCS file: /home/repository/bioruby/bioruby/README.DEV,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** README.DEV 11 May 2006 10:53:25 -0000 1.10 --- README.DEV 19 Sep 2006 05:39:05 -0000 1.11 *************** *** 1,6 **** ! $Id$ ! Copyright (C):: 2005, 2006 Toshiaki Katayama ! Copyright (C):: 2006 Jan Aerts = HOW TO CONTRIBUTE TO THE BIORUBY PROJECT? --- 1,8 ---- ! = README.DEV ! Copyright:: Copyright (C) 2005, 2006 Toshiaki Katayama ! Copyright:: Copyright (C) 2006 Jan Aerts ! ! $Id$ = HOW TO CONTRIBUTE TO THE BIORUBY PROJECT? *************** *** 71,89 **** The header should be formatted as follows: # # = bio/db/hoge.rb - Hoge database parser classes # ! # Copyright (C):: 2001, 2003-2005 Bio R. Hacker , ! # Copyright (C):: 2006 Chem R. Hacker # ! # License:: Ruby's # ! # $Id$ # ! # = Description # # This file contains classes that implement an interface to the Hoge database. # ! # = References # # * Hoge F. et al., The Hoge database, Nucleic. Acid. Res. 123:100--123 (2030) --- 73,92 ---- The header should be formatted as follows: + # # = bio/db/hoge.rb - Hoge database parser classes # ! # Copyright:: Copyright (C) 2001, 2003-2005 Bio R. Hacker , ! # Copyright:: Copyright (C) 2006 Chem R. Hacker # ! # License:: Ruby's # ! # $ I d: $ # ! # == Description # # This file contains classes that implement an interface to the Hoge database. # ! # == References # # * Hoge F. et al., The Hoge database, Nucleic. Acid. Res. 123:100--123 (2030) *************** *** 91,98 **** # ! In the above sample, the ! $Id$ ! will be automatically changed into something like $Id$ when commiting to the CVS repository for the first time. --- 94,114 ---- # ! require 'foo' ! ! module Bio ! ! autoload :Bar, 'bio/bar' ! ! class Hoge ! : ! end # Hoge ! ! end # Bio ! ! In the above sample, the '$ I d : $' (without spaces) will be automatically ! changed into something like ! $Id$ + when commiting to the CVS repository for the first time. *************** *** 102,106 **** following example (from lib/bio/sequence.rb): ! # = DESCRIPTION # Bio::Sequence objects represent annotated sequences in bioruby. # A Bio::Sequence object is a wrapper around the actual sequence, --- 118,123 ---- following example (from lib/bio/sequence.rb): ! # == Description ! # # Bio::Sequence objects represent annotated sequences in bioruby. # A Bio::Sequence object is a wrapper around the actual sequence, *************** *** 111,115 **** # these methods are not documented specifically for Bio::Sequence). # ! # = USAGE # require 'bio' # --- 128,133 ---- # these methods are not documented specifically for Bio::Sequence). # ! # == Usage ! # # require 'bio' # *************** *** 168,173 **** --- 186,194 ---- example too much, try to provide any input data directly into the usage example, instead of refering to ARGV or ARGF for input. + dna = Bio::Sequence.auto('atgcatgcATGCATGCAAAA') + Otherwise, describe the input shortly, for example: + # input should be string consisting of nucleotides dna = Bio::Sequence.auto(ARGF.read) *************** *** 178,181 **** --- 199,203 ---- be listed, as well as the type of thing that is returned by the method. The format of this information is as follows: + # --- # *Arguments*: *************** *** 189,193 **** --- 211,217 ---- Don't use + $stderr.puts "WARNING" + in your code. Instead, try to avoid printing error messages. For fatal errors, use +raise+ with an appropriate message. *************** *** 198,202 **** you meant to do with each method. The test code is useful to make maintenance easy and ensure stability. The use of ! if __FILE__ == $0 is deprecated. --- 222,228 ---- you meant to do with each method. The test code is useful to make maintenance easy and ensure stability. The use of ! ! if __FILE__ == $0 ! is deprecated. *************** *** 204,209 **** To quicken the initial load time we have replaced most of 'require' to ! 'autoload' ! since BioRuby version 0.7. During this change, we have found some tips: --- 230,234 ---- To quicken the initial load time we have replaced most of 'require' to ! 'autoload' since BioRuby version 0.7. During this change, we have found some tips: From k at dev.open-bio.org Tue Sep 19 01:41:47 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Tue, 19 Sep 2006 05:41:47 +0000 Subject: [BioRuby-cvs] bioruby/lib bio.rb,1.69,1.70 Message-ID: <200609190541.k8J5fl0p031252@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib In directory dev.open-bio.org:/tmp/cvs-serv31246/lib Modified Files: bio.rb Log Message: * added ebisoap and ncbisoap Index: bio.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio.rb,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** bio.rb 14 Jul 2006 14:27:10 -0000 1.69 --- bio.rb 19 Sep 2006 05:41:45 -0000 1.70 *************** *** 121,124 **** --- 121,125 ---- autoload :Fetch, 'bio/io/fetch' autoload :SQL, 'bio/io/sql' + autoload :SOAPWSDL, 'bio/io/soapwsdl' autoload :FlatFile, 'bio/io/flatfile' autoload :FlatFileIndex, 'bio/io/flatfile/index' # chage to FlatFile::Index ? *************** *** 155,159 **** end ! # autoload :ESOAP, 'bio/io/esoap' # NCBI::ESOAP ? --- 156,166 ---- end ! class EBI ! autoload :SOAP, 'bio/io/ebisoap' ! end ! ! class NCBI ! autoload :SOAP, 'bio/io/ncbisoap' ! end From k at dev.open-bio.org Tue Sep 19 01:41:47 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Tue, 19 Sep 2006 05:41:47 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io ebisoap.rb, NONE, 1.1 ncbisoap.rb, NONE, 1.1 Message-ID: <200609190541.k8J5flio031257@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory dev.open-bio.org:/tmp/cvs-serv31246/lib/bio/io Added Files: ebisoap.rb ncbisoap.rb Log Message: * added ebisoap and ncbisoap --- NEW FILE: ebisoap.rb --- # # = bio/io/emblsoap.rb - EBI SOAP server access class # # Copyright:: Copyright (C) 2006 # Toshiaki Katayama # License:: Ruby's # # $Id: ebisoap.rb,v 1.1 2006/09/19 05:41:45 k Exp $ # require 'bio/io/soapwsdl' module Bio class EBI class SOAP < Bio::SOAPWSDL BASE_URI = "http://www.ebi.ac.uk/Tools/webservices/wsdl/" def initialize(wsdl = nil) super(wsdl || self.class::SERVER_URI) end # * fetchData # * getSupportedDBs # * getSupportedFormats # * getSupportedStyles class Dbfetch < Bio::EBI::SOAP SERVER_URI = BASE_URI + "WSDbfetch.wsdl" end # * checkStatus # * doIprscan # * getResults # * poll # * polljob # * runInterProScan # * test class InterProScan < Bio::EBI::SOAP SERVER_URI = BASE_URI + "WSInterProScan.wsdl" end # * checkStatus # * getInfo # * getResults # * getTools # * poll # * run # * test class Emboss < Bio::EBI::SOAP SERVER_URI = BASE_URI + "WSEmboss.wsdl" end # * checkStatus # * getResults # * poll # * runClustalW # * test class ClustalW < Bio::EBI::SOAP SERVER_URI = BASE_URI + "WSClustalW.wsdl" end # * checkStatus # * getResults # * poll # * runTCoffee class TCoffee < Bio::EBI::SOAP SERVER_URI = BASE_URI + "WSTCoffee.wsdl" end # * checkStatus # * getResults # * poll # * runMuscle # * test class Muscle < Bio::EBI::SOAP SERVER_URI = BASE_URI + "WSMuscle.wsdl" end # * checkStatus # * doFasta # * getResults # * poll # * polljob # * runFasta class Fasta < Bio::EBI::SOAP SERVER_URI = BASE_URI + "WSFasta.wsdl" end # * checkStatus # * doWUBlast # * getIds # * getResults # * poll # * polljob # * runWUBlast # * test class WUBlast < Bio::EBI::SOAP SERVER_URI = BASE_URI + "WSWUBlast.wsdl" end # * checkStatus # * getResults # * poll # * runMPsrch # * test class MPsrch < Bio::EBI::SOAP SERVER_URI = BASE_URI + "WSMPsrch.wsdl" end # * checkStatus # * getResults # * poll # * runScanPS # * test class ScanPS < Bio::EBI::SOAP SERVER_URI = BASE_URI + "WSScanPS.wsdl" end class MSD < Bio::EBI::SOAP SERVER_URI = "http://www.ebi.ac.uk/msd-srv/docs/api/msd_soap_service.wsdl" end class Ontology < Bio::EBI::SOAP SERVER_URI = "http://www.ebi.ac.uk/ontology-lookup/OntologyQuery.wsdl" end class Citation < Bio::EBI::SOAP SERVER_URI = "http://www.ebi.ac.uk/citations/webservices/wsdl" end end # SOAP end # EBI end # Bio if __FILE__ == $0 serv = Bio::EBI::SOAP::Dbfetch.new p serv.getSupportedDBs require 'base64' serv = Bio::EBI::SOAP::Emboss.new hash = {"tool" => "water", "asequence" => "uniprot:alk1_human", "bsequence" => "uniprot:alk1_mouse", "email" => "ebisoap at example.org"} poll = serv.run(hash, []) puts poll base = serv.poll(poll, "tooloutput") puts Base64.decode64(base) end --- NEW FILE: ncbisoap.rb --- # # = bio/io/ncbisoap.rb - SOAP interface for NCBI Entrez Utilities # # Copyright:: Copyright (C) 2004, 2006 # Toshiaki Katayama # License:: Ruby's # # $Id: ncbisoap.rb,v 1.1 2006/09/19 05:41:45 k Exp $ # require 'bio/io/soapwsdl' module Bio class NCBI # == References # # * http://eutils.ncbi.nlm.nih.gov/entrez/query/static/esoap_help.html # # == Methods # # All methods accept a hash as its argument and most of the keys can be # ommited (values are string). # # Note: Methods which name ends with _MS are designed for use with # Microsoft Visual Studio and SOAP Toolkit 3.0 # # * http://www.ncbi.nlm.nih.gov/entrez/query/static/esoap_ms_help.html # # * run_eFetch(_MS) # * "db", "id", "WebEnv", "query_key", "tool", "email", "retstart", # "retmax", "rettype", "strand", "seq_start", "seq_stop", "complexity", # "report" # # * run_eGquery(_MS) # * "term", "tool", "email" # # * run_eInfo(_MS) # * "db", "tool", "email" # # * run_eSpell(_MS) # * "db", "term", "tool", "email" # # * run_eLink(_MS) # * "db", "id", "reldate", "mindate", "maxdate", "datetype", "term" # "dbfrom", "WebEnv", "query_key", "cmd", "tool", "email" # # * run_eSearch(_MS) # * "db", "term", "WebEnv", "QueryKey", "usehistory", "tool", "email", # "field", "reldate", "mindate", "maxdate", "datetype", "RetStart", # "RetMax", "rettype", "sort" # # * run_eSummary(_MS) # * "db", "id", "WebEnv", "query_key", "retstart", "retmax", "tool", "email" # # == Complex data types # # * http://www.ncbi.nlm.nih.gov/entrez/eutils/soap/egquery.xsd # * http://www.ncbi.nlm.nih.gov/entrez/eutils/soap/einfo.xsd # * http://www.ncbi.nlm.nih.gov/entrez/eutils/soap/esearch.xsd # * http://www.ncbi.nlm.nih.gov/entrez/eutils/soap/esummary.xsd # * http://www.ncbi.nlm.nih.gov/entrez/eutils/soap/elink.xsd # * http://www.ncbi.nlm.nih.gov/entrez/eutils/soap/efetch.xsd # * http://www.ncbi.nlm.nih.gov/entrez/eutils/soap/espell.xsd # class SOAP < Bio::SOAPWSDL BASE_URI = "http://www.ncbi.nlm.nih.gov/entrez/eutils/soap/" def initialize(wsdl = nil) super(wsdl || self.class::SERVER_URI) end def method_missing(*arg) sleep 3 # make sure to rest for 3 seconds per request @driver.send(*arg) end class EUtils < Bio::NCBI::SOAP SERVER_URI = BASE_URI + "eutils.wsdl" end class EUtilsLite < Bio::NCBI::SOAP SERVER_URI = BASE_URI + "eutils_lite.wsdl" end class EFetch < Bio::NCBI::SOAP SERVER_URI = BASE_URI + "efetch.wsdl" end class EFetchLite < Bio::NCBI::SOAP SERVER_URI = BASE_URI + "efetch_lit.wsdl" end end # SOAP end # NCBI end # Bio if __FILE__ == $0 puts ">>> Bio::NCBI::SOAP::EFetch" efetch = Bio::NCBI::SOAP::EFetch.new puts "### run_eFetch in EFetch" hash = {"db" => "protein", "id" => "37776955"} result = efetch.run_eFetch(hash) p result puts ">>> Bio::NCBI::SOAP::EUtils" eutils = Bio::NCBI::SOAP::EUtils.new puts "### run_eFetch in EUtils" hash = {"db" => "pubmed", "id" => "12345"} result = eutils.run_eFetch(hash) p result puts "### run_eGquery - Entrez meta search to count hits in each DB" hash = {"term" => "kinase"} result = eutils.run_eGquery(hash) # working? p result puts "### run_eInfo - listing of the databases" hash = {"db" => "protein"} result = eutils.run_eInfo(hash) p result puts "### run_eSpell" hash = {"db" => "pubmed", "term" => "kinas"} result = eutils.run_eSpell(hash) p result p result["CorrectedQuery"] puts "### run_eLink" hash = {"db" => "protein", "id" => "37776955"} result = eutils.run_eLink(hash) # working? p result puts "### run_eSearch" hash = {"db" => "pubmed", "term" => "kinase"} result = eutils.run_eSearch(hash) p result puts "### run_eSummary" hash = {"db" => "protein", "id" => "37776955"} result = eutils.run_eSummary(hash) p result end From k at dev.open-bio.org Tue Sep 19 01:43:08 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Tue, 19 Sep 2006 05:43:08 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io soapwsdl.rb,1.5,1.6 Message-ID: <200609190543.k8J5h8qD031301@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory dev.open-bio.org:/tmp/cvs-serv31297/lib/bio/io Modified Files: soapwsdl.rb Log Message: * minor change Index: soapwsdl.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/soapwsdl.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** soapwsdl.rb 29 May 2006 15:28:18 -0000 1.5 --- soapwsdl.rb 19 Sep 2006 05:43:06 -0000 1.6 *************** *** 3,11 **** # # Copyright:: Copyright (C) 2004 ! # KATAYAMA Toshiaki # License:: Ruby's # # $Id$ # # == Examples # --- 3,18 ---- # # Copyright:: Copyright (C) 2004 ! # Toshiaki Katayama # License:: Ruby's # # $Id$ # + begin + require 'soap/wsdlDriver' + rescue LoadError + end + + module Bio + # == Examples # *************** *** 36,53 **** # % export http_proxy=http://localhost:8080 # - - begin - require 'soap/wsdlDriver' - rescue LoadError - end - - module Bio - class SOAPWSDL ! # WSDL URL attr_reader :wsdl ! # log IO attr_reader :log --- 43,52 ---- # % export http_proxy=http://localhost:8080 # class SOAPWSDL ! # Returns URL of the current WSDL file. attr_reader :wsdl ! # Returns current logging IO. attr_reader :log *************** *** 71,75 **** ! # Set a WSDL URL. def wsdl=(url) @wsdl = url --- 70,85 ---- ! # Change the URL for WSDL file ! # ! # serv = Bio::SOAPWSDL.new("http://soap.genome.jp/KEGG.wsdl") ! # ! # or ! # ! # serv = Bio::SOAPWSDL.new ! # serv.wsdl = "http://soap.genome.jp/KEGG.wsdl" ! # ! # Note that you can't read two or more different WSDL files at once. ! # In that case, create Bio::SOAPWSDL object for each. ! # def wsdl=(url) @wsdl = url *************** *** 78,82 **** ! # Set log IO def log=(io) @log = io --- 88,100 ---- ! # Change the IO for logging. The argument is passed to wiredump_dev method ! # of the SOAP4R, thus ! # ! # serv = Bio::SOAPWSDL.new ! # serv.log = STDERR ! # ! # will print all the SOAP transactions in standard error. ! # This feature is especially useful for debug. ! # def log=(io) @log = io *************** *** 96,100 **** private :method_missing ! end # SOAP end # Bio --- 114,118 ---- private :method_missing ! end # SOAPWSDL end # Bio From k at dev.open-bio.org Tue Sep 19 01:44:43 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Tue, 19 Sep 2006 05:44:43 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io ddbjxml.rb,1.11,1.12 Message-ID: <200609190544.k8J5ihmC031344@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory dev.open-bio.org:/tmp/cvs-serv31340/lib/bio/io Modified Files: ddbjxml.rb Log Message: * initialize methods are unified in the super class Index: ddbjxml.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/ddbjxml.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ddbjxml.rb 8 May 2006 14:29:58 -0000 1.11 --- ddbjxml.rb 19 Sep 2006 05:44:41 -0000 1.12 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2003, 2004 ! # KATAYAMA Toshiaki # License:: Ruby's # --- 3,7 ---- # # Copyright:: Copyright (C) 2003, 2004 ! # Toshiaki Katayama # License:: Ruby's # *************** *** 28,31 **** --- 28,35 ---- BASE_URI = "http://xml.nig.ac.jp/wsdl/" + def initialize(wsdl = nil) + super(wsdl || self.class::SERVER_URI) + end + # === Description # *************** *** 55,63 **** # === WSDL Methods # ! # ==== searchSimple(program, database, query) # # Returns a blast report in the default format. # ! # ==== searchParam(program, database, query, param) # # Blasts with param and returns a blast report. --- 59,67 ---- # === WSDL Methods # ! # * searchSimple(program, database, query) # # Returns a blast report in the default format. # ! # * searchParam(program, database, query, param) # # Blasts with param and returns a blast report. *************** *** 69,77 **** class Blast < XML SERVER_URI = BASE_URI + "Blast.wsdl" - - # returns a Bio::DDBJ::XML::Blast object. - def initialize(wsdl = nil) - super(wsdl || SERVER_URI) - end end --- 73,76 ---- *************** *** 106,111 **** # === WSDL Methods # ! # ==== analyzeSimple(query) ! # ==== analyzeParam(query, param) # # === References --- 105,110 ---- # === WSDL Methods # ! # * analyzeSimple(query) ! # * analyzeParam(query, param) # # === References *************** *** 115,123 **** class ClustalW < XML SERVER_URI = BASE_URI + "ClustalW.wsdl" - - # returns a Bio::DDBJ::XML::ClustalW object. - def initialize(wsdl = nil) - super(wsdl || SERVER_URI) - end end --- 114,117 ---- *************** *** 141,150 **** # === WSDL Methods # ! # ==== getFFEntry(accession) ! # ==== getXMLEntry(accession) ! # ==== getFeatureInfo(accession, feature) ! # ==== getAllFeatures(accession) ! # ==== getRelatedFeatures(accession, start, stop) ! # ==== getRelatedFeaturesSeq(accession, start, stop) # # === References --- 135,144 ---- # === WSDL Methods # ! # * getFFEntry(accession) ! # * getXMLEntry(accession) ! # * getFeatureInfo(accession, feature) ! # * getAllFeatures(accession) ! # * getRelatedFeatures(accession, start, stop) ! # * getRelatedFeaturesSeq(accession, start, stop) # # === References *************** *** 154,162 **** class DDBJ < XML SERVER_URI = BASE_URI + "DDBJ.wsdl" - - # returns a Bio::DDBJ::XML::DDBJ object. - def initialize(wsdl = nil) - super(wsdl || SERVER_URI) - end end --- 148,151 ---- *************** *** 179,184 **** # === WSDL Methods # ! # ==== searchSimple(program, database, query) ! # ==== searchParam(program, database, query, param) # # === References --- 168,173 ---- # === WSDL Methods # ! # * searchSimple(program, database, query) ! # * searchParam(program, database, query, param) # # === References *************** *** 188,196 **** class Fasta < XML SERVER_URI = BASE_URI + "Fasta.wsdl" - - # returns a Bio::DDBJ::XML::Fasta object. - def initialize(wsdl = nil) - super(wsdl || SERVER_URI) - end end --- 177,180 ---- *************** *** 210,242 **** # === WSDL Methods # ! # ==== getEntry(database, var, param1, param2) ! # ==== getEntry(database, var) ! # ==== getDDBJEntry(accession) ! # ==== getDDBJCONEntry(accession) ! # ==== getDDBJVerEntry(accession) ! # ==== getLocus_DDBJEntry(locus) ! # ==== getGene_DDBJEntry(gene) ! # ==== getProd_DDBJEntry(products) ! # ==== getPID_DDBJEntry(pid) ! # ==== getClone_DDBJEntry(clone) ! # ==== getXML_DDBJEntry(accession) ! # ==== getEMBLEntry(accession) ! # ==== getSWISSEntry(accession) ! # ==== getPIREntry(accession) ! # ==== getPRFEntry(accession) ! # ==== getPDBEntry(accession) ! # ==== getQVEntry(accession) ! # ==== getDADEntry(accession) ! # ==== getPID_DADEntry(pid) ! # ==== getFASTA_DDBJEntry(accession) ! # ==== getFASTA_DDBJCONEntry(accession) ! # ==== getFASTA_DDBJVerEntry(accession) ! # ==== getFASTA_DDBJSeqEntry(accession, start, end) ! # ==== getFASTA_DADEntry(accession) ! # ==== getFASTA_PIREntry(accession) ! # ==== getFASTA_SWISSEntry(accession) ! # ==== getFASTA_PDBEntry(accession) ! # ==== getFASTA_PRFEntry(accession) ! # ==== getFASTA_CDSEntry(accession) # # === References --- 194,226 ---- # === WSDL Methods # ! # * getEntry(database, var, param1, param2) ! # * getEntry(database, var) ! # * getDDBJEntry(accession) ! # * getDDBJCONEntry(accession) ! # * getDDBJVerEntry(accession) ! # * getLocus_DDBJEntry(locus) ! # * getGene_DDBJEntry(gene) ! # * getProd_DDBJEntry(products) ! # * getPID_DDBJEntry(pid) ! # * getClone_DDBJEntry(clone) ! # * getXML_DDBJEntry(accession) ! # * getEMBLEntry(accession) ! # * getSWISSEntry(accession) ! # * getPIREntry(accession) ! # * getPRFEntry(accession) ! # * getPDBEntry(accession) ! # * getQVEntry(accession) ! # * getDADEntry(accession) ! # * getPID_DADEntry(pid) ! # * getFASTA_DDBJEntry(accession) ! # * getFASTA_DDBJCONEntry(accession) ! # * getFASTA_DDBJVerEntry(accession) ! # * getFASTA_DDBJSeqEntry(accession, start, end) ! # * getFASTA_DADEntry(accession) ! # * getFASTA_PIREntry(accession) ! # * getFASTA_SWISSEntry(accession) ! # * getFASTA_PDBEntry(accession) ! # * getFASTA_PRFEntry(accession) ! # * getFASTA_CDSEntry(accession) # # === References *************** *** 246,254 **** class GetEntry < XML SERVER_URI = BASE_URI + "GetEntry.wsdl" - - # returns a Bio::DDBJ::XML::GetEntry object. - def initialize(wsdl = nil) - super(wsdl || SERVER_URI) - end end --- 230,233 ---- *************** *** 277,291 **** # === WSDL Methods # ! # ==== getOrganismList ! # ==== getChIDList ! # ==== getOrganismNameFromChid(chid) ! # ==== getChIDFromOrganismName(orgName) ! # ==== getAccession(chid) ! # ==== getPieceNumber(chid) ! # ==== getDivision(chid) ! # ==== getType(chid) ! # ==== getFlatFile(chid) ! # ==== getFastaFile(chid, type) ! # ==== getCDS(chid) # # === References --- 256,270 ---- # === WSDL Methods # ! # * getOrganismList ! # * getChIDList ! # * getOrganismNameFromChid(chid) ! # * getChIDFromOrganismName(orgName) ! # * getAccession(chid) ! # * getPieceNumber(chid) ! # * getDivision(chid) ! # * getType(chid) ! # * getFlatFile(chid) ! # * getFastaFile(chid, type) ! # * getCDS(chid) # # === References *************** *** 295,303 **** class Gib < XML SERVER_URI = BASE_URI + "Gib.wsdl" - - # returns a Bio::DDBJ::XML::Gib object. - def initialize(wsdl = nil) - super(wsdl || SERVER_URI) - end end --- 274,277 ---- *************** *** 317,322 **** # === WSDL Methods # ! # ==== getOrganismList ! # ==== getMasterInfo(orfID, organism) # # === References --- 291,296 ---- # === WSDL Methods # ! # * getOrganismList ! # * getMasterInfo(orfID, organism) # # === References *************** *** 326,334 **** class Gtop < XML SERVER_URI = BASE_URI + "Gtop.wsdl" - - # returns a Bio::DDBJ::XML::Gtop object. - def initialize(wsdl = nil) - super(wsdl || SERVER_URI) - end end --- 300,303 ---- *************** *** 347,356 **** # === WSDL Methods # ! # ==== searchVariation(field, query, order) ! # ==== searchVariationSimple(field, query) ! # ==== searchFrequency(field, query, order) ! # ==== searchFrequencySimple(field, query) ! # ==== getVariation(variation_id) ! # ==== getFrequency(variation_id, population_id) # # === References --- 316,325 ---- # === WSDL Methods # ! # * searchVariation(field, query, order) ! # * searchVariationSimple(field, query) ! # * searchFrequency(field, query, order) ! # * searchFrequencySimple(field, query) ! # * getVariation(variation_id) ! # * getFrequency(variation_id, population_id) # # === References *************** *** 360,368 **** class PML < XML SERVER_URI = BASE_URI + "PML.wsdl" - - # returns a Bio::DDBJ::XML::PML object. - def initialize(wsdl = nil) - super(wsdl || SERVER_URI) - end end --- 329,332 ---- *************** *** 382,387 **** # === WSDL Methods # ! # ==== searchSimple(query) ! # ==== searchParam(query, param) # # === Examples --- 346,351 ---- # === WSDL Methods # ! # * searchSimple(query) ! # * searchParam(query, param) # # === Examples *************** *** 391,399 **** class SRS < XML SERVER_URI = BASE_URI + "SRS.wsdl" - - # returns a Bio::DDBJ::XML::SRS object. - def initialize(wsdl = nil) - super(wsdl || SERVER_URI) - end end --- 355,358 ---- *************** *** 419,427 **** # === WSDL Methdos # ! # ==== searchSimple(tx_Name) ! # ==== searchParam(tx_Name, tx_Clas, tx_Rank, tx_Rmax, tx_Dcls) ! # ==== getTxId(tx_Name) ! # ==== getTxName(tx_Id) ! # ==== searchLineage(query, ranks, superkingdom) # # === References --- 378,386 ---- # === WSDL Methdos # ! # * searchSimple(tx_Name) ! # * searchParam(tx_Name, tx_Clas, tx_Rank, tx_Rmax, tx_Dcls) ! # * getTxId(tx_Name) ! # * getTxName(tx_Id) ! # * searchLineage(query, ranks, superkingdom) # # === References *************** *** 431,439 **** class TxSearch < XML SERVER_URI = BASE_URI + "TxSearch.wsdl" - - # returns a Bio::DDBJ::XML::TxSearch object. - def initialize(wsdl = nil) - super(wsdl || SERVER_URI) - end end --- 390,393 ---- From k at dev.open-bio.org Tue Sep 19 01:45:50 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Tue, 19 Sep 2006 05:45:50 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io keggapi.rb,1.12,1.13 Message-ID: <200609190545.k8J5joPl031387@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory dev.open-bio.org:/tmp/cvs-serv31383/lib/bio/io Modified Files: keggapi.rb Log Message: * documentations are moved to RDoc Index: keggapi.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/keggapi.rb,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** keggapi.rb 14 Jul 2006 14:48:56 -0000 1.12 --- keggapi.rb 19 Sep 2006 05:45:48 -0000 1.13 *************** *** 1,22 **** # ! # bio/io/keggapi.rb - KEGG API access class ! # ! # Copyright (C) 2003, 2004 KATAYAMA Toshiaki ! # ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 1,9 ---- # ! # = bio/io/keggapi.rb - KEGG API access class # ! # Copyright:: Copyright (C) 2003, 2004 Toshiaki Katayama ! # License:: Ruby's # ! # $Id$ # *************** *** 29,36 **** --- 16,197 ---- class KEGG + # == Description + # + # KEGG API is a web service to use KEGG system via SOAP/WSDL. + # + # == References + # + # For more informations on KEGG API, see the following site and read the + # reference manual. + # + # * http://www.genome.jp/kegg/soap/ + # * http://www.genome.jp/kegg/soap/doc/keggapi_manual.html + # + # == List of methods + # + # As of KEGG API v5.0 + # + # * list_databases + # * list_organisms + # * list_pathways(org) + # * binfo(string) + # * bget(string) + # * bfind(string) + # * btit(string) + # * get_linkdb_by_entry(entry_id, db, start, max_results) + # * get_best_best_neighbors_by_gene(genes_id, start, max_results) + # * get_best_neighbors_by_gene(genes_id, start, max_results) + # * get_reverse_best_neighbors_by_gene(genes_id, start, max_results) + # * get_paralogs_by_gene(genes_id, start, max_results) + # * get_similarity_between_genes(genes_id1, genes_id2) + # * get_motifs_by_gene(genes_id, db) + # * get_genes_by_motifs(motif_id_list, start, max_results) + # * get_ko_by_gene(genes_id) + # * get_ko_members(ko_id) + # * get_oc_members_by_gene(genes_id, start, max_results) + # * get_pc_members_by_gene(genes_id, start, max_results) + # * mark_pathway_by_objects(pathway_id, object_id_list) + # * color_pathway_by_objects(pathway_id, object_id_list, fg_color_list, bg_color_list) + # * get_genes_by_pathway(pathway_id) + # * get_enzymes_by_pathway(pathway_id) + # * get_compounds_by_pathway(pathway_id) + # * get_reactions_by_pathway(pathway_id) + # * get_pathways_by_genes(genes_id_list) + # * get_pathways_by_enzymes(enzyme_id_list) + # * get_pathways_by_compounds(compound_id_list) + # * get_pathways_by_reactions(reaction_id_list) + # * get_linked_pathways(pathway_id) + # * get_genes_by_enzyme(enzyme_id, org) + # * get_enzymes_by_gene(genes_id) + # * get_enzymes_by_compound(compound_id) + # * get_enzymes_by_reaction(reaction_id) + # * get_compounds_by_enzyme(enzyme_id) + # * get_compounds_by_reaction(reaction_id) + # * get_reactions_by_enzyme(enzyme_id) + # * get_reactions_by_compound(compound_id) + # * get_genes_by_organism(org, start, max_results) + # * get_number_of_genes_by_organism(org) + # + # == KEGG API methods implemented only in BioRuby + # + # In BioRuby, returned values are added filter method to pick up + # values in a complex data type as an array. + # + # #!/usr/bin/env ruby + # + # require 'bio' + # + # serv = Bio::KEGG::API.new + # results = serv.get_best_neighbors_by_gene("eco:b0002", "bsu") + # + # # case 0 : without filter + # results.each do |hit| + # print hit.genes_id1, "\t", hit.genes_id2, "\t", hit.sw_score, "\n" + # end + # + # # case 1 : select gene names and SW score only + # fields = [:genes_id1, :genes_id2, :sw_score] + # results.each do |hit| + # puts hit.filter(fields).join("\t") + # end + # + # # case 2 : also uses aligned position in each amino acid sequence etc. + # fields1 = [:genes_id1, :start_position1, :end_position1, :best_flag_1to2] + # fields2 = [:genes_id2, :start_position2, :end_position2, :best_flag_2to1] + # results.each do |hit| + # print "> score: ", hit.sw_score, ", identity: ", hit.identity, "\n" + # print "1:\t", hit.filter(fields1).join("\t"), "\n" + # print "2:\t", hit.filter(fields2).join("\t"), "\n" + # end + # + # Using filter method will make it easy to change fields to select and + # keep the script clean. + # + # * Bio::KEGG::API#get_all_neighbors_by_gene(genes_id, org) + # * Bio::KEGG::API#get_all_best_best_neighbors_by_gene(genes_id) + # * Bio::KEGG::API#get_all_best_neighbors_by_gene(genes_id) + # * Bio::KEGG::API#get_all_reverse_best_neighbors_by_gene(genes_id) + # * Bio::KEGG::API#get_all_paralogs_by_gene(genes_id) + # * Bio::KEGG::API#get_all_genes_by_motifs(motif_id_list) + # * Bio::KEGG::API#get_all_oc_members_by_gene(genes_id) + # * Bio::KEGG::API#get_all_pc_members_by_gene(genes_id) + # * Bio::KEGG::API#get_all_genes_by_organism(org) + # + # These methods are wrapper for the methods without _all_ in its name + # and internally iterate to retrive all the results using start/max_results + # value pairs described above. For example, + # + # #!/usr/bin/env ruby + # + # require 'soap/wsdlDriver' + # + # wsdl = "http://soap.genome.jp/KEGG.wsdl" + # serv = SOAP::WSDLDriverFactory.new(wsdl).create_driver + # serv.generate_explicit_type = true + # + # start = 1 + # max_results = 100 + # + # loop do + # results = serv.get_best_neighbors_by_gene('eco:b0002', start, max_results) + # break unless results # when no more results returned + # results.each do |hit| + # print hit.genes_id1, "\t", hit.genes_id2, "\t", hit.sw_score, "\n" + # end + # start += max_results + # end + # + # can be witten as + # + # #!/usr/bin/env ruby + # + # require 'bio' + # + # serv = Bio::KEGG::API.new + # + # results = serv.get_all_best_neighbors_by_gene('eco:b0002') + # results.each do |hit| + # print hit.genes_id1, "\t", hit.genes_id2, "\t", hit.sw_score, "\n" + # end + # + # + # * Bio::KEGG::API#save_image(url, filename = nil) + # + # Some methods of the KEGG API will return a URL of the generated image. + # This method save an image specified by the URL. The filename can be + # specified by its second argument, otherwise basename of the URL will + # be used. + # + # #!/usr/bin/env ruby + # + # require 'bio' + # + # serv = Bio::KEGG::API.new("http://soap.genome.jp/v3.0/KEGG.wsdl") + # + # list = ["eco:b1002", "eco:b2388"] + # url = serv.mark_pathway_by_objects("path:eco00010", list) + # + # # Save with the original filename (eco00010.gif in this case) + # serv.save_image(url) + # + # # or save as "save_image.gif" + # serv.save_image(url, "save_image.gif") + # + # * Bio::KEGG::API#get_entries(entry_id_list) + # * Bio::KEGG::API#get_aaseqs(entry_id_list) + # * Bio::KEGG::API#get_naseqs(entry_id_list) + # * Bio::KEGG::API#get_definitions(entry_id_list) + # + # These methods are for the shortcut and backward compatibility + # (these methods existed in the older version of the KEGG API). + # class API < Bio::SOAPWSDL SERVER_URI = "http://soap.genome.jp/KEGG.wsdl" + # Connect to the KEGG API's SOAP server. A WSDL file will be automatically + # downloaded and parsed to generate the SOAP client driver. The default URL + # for the WSDL is http://soap.genome.jp/KEGG.wsdl but it can be changed by + # the argument or by wsdl= method. def initialize(wsdl = nil) @wsdl = wsdl || SERVER_URI *************** *** 40,44 **** create_driver end ! attr_accessor :start, :max_results def method_missing(*arg) --- 201,215 ---- create_driver end ! ! # Returns current value for the 'start' count for the methods having ! # start/max_results argument pairs or changes the default value for ! # the 'start' count. ! attr_accessor :start ! ! # Returns current value for the 'max_results' number for the methods having ! # start/max_results argument pairs or changes the default value for the ! # 'max_results' count. If your request timeouts, try smaller value for ! # the max_results. ! attr_accessor :max_results def method_missing(*arg) *************** *** 52,55 **** --- 223,227 ---- end + # def get_all_neighbors_by_gene(genes_id, org) # get_all(:get_neighbors_by_gene, genes_id, org) *************** *** 202,206 **** # serv.log = STDERR ! puts "--- parameters" puts " wsdl : #{serv.wsdl}" puts " log : #{serv.log}" --- 374,378 ---- # serv.log = STDERR ! puts "# * parameters" puts " wsdl : #{serv.wsdl}" puts " log : #{serv.log}" *************** *** 254,270 **** puts serv.btit("eco:b0002 eco:b0003") ! puts "--- get_entries(['eco:b0002', 'eco:b0003'])" puts serv.get_entries(["eco:b0002", "eco:b0003"]) ! puts "--- get_aaseqs(['eco:b0002', 'eco:b0003'])" puts serv.get_aaseqs(["eco:b0002", "eco:b0003"]) ! puts "--- get_naseqs(['eco:b0002', 'eco:b0003'])" puts serv.get_naseqs(["eco:b0002", "eco:b0003"]) ! puts "--- get_definitions(['eco:b0002', 'eco:b0003'])" puts serv.get_definitions(["eco:b0002", "eco:b0003"]) ! puts "--- get_definitions(('eco:b0001'..'eco:b0200').to_a)" puts serv.get_definitions(("eco:b0001".."eco:b0200").to_a) --- 426,442 ---- puts serv.btit("eco:b0002 eco:b0003") ! puts "# * get_entries(['eco:b0002', 'eco:b0003'])" puts serv.get_entries(["eco:b0002", "eco:b0003"]) ! puts "# * get_aaseqs(['eco:b0002', 'eco:b0003'])" puts serv.get_aaseqs(["eco:b0002", "eco:b0003"]) ! puts "# * get_naseqs(['eco:b0002', 'eco:b0003'])" puts serv.get_naseqs(["eco:b0002", "eco:b0003"]) ! puts "# * get_definitions(['eco:b0002', 'eco:b0003'])" puts serv.get_definitions(["eco:b0002", "eco:b0003"]) ! puts "# * get_definitions(('eco:b0001'..'eco:b0200').to_a)" puts serv.get_definitions(("eco:b0001".."eco:b0200").to_a) *************** *** 277,281 **** end ! puts "--- get_all_linkdb_by_entry('eco:b0002', 'pathway')" list = serv.get_all_linkdb_by_entry("eco:b0002", "pathway") list.each do |link| --- 449,453 ---- end ! puts "# * get_all_linkdb_by_entry('eco:b0002', 'pathway')" list = serv.get_all_linkdb_by_entry("eco:b0002", "pathway") list.each do |link| *************** *** 291,295 **** end ! puts "--- get_all_neighbors_by_gene('eco:b0002', 'bsu')" list = serv.get_all_neighbors_by_gene("eco:b0002", "bsu") list.each do |hit| --- 463,467 ---- end ! puts "# * get_all_neighbors_by_gene('eco:b0002', 'bsu')" list = serv.get_all_neighbors_by_gene("eco:b0002", "bsu") list.each do |hit| *************** *** 303,307 **** end ! puts "--- get_all_best_best_neighbors_by_gene('eco:b0002')" list = serv.get_all_best_best_neighbors_by_gene("eco:b0002") list.each do |hit| --- 475,479 ---- end ! puts "# * get_all_best_best_neighbors_by_gene('eco:b0002')" list = serv.get_all_best_best_neighbors_by_gene("eco:b0002") list.each do |hit| *************** *** 315,319 **** end ! puts "--- get_all_best_neighbors_by_gene('eco:b0002')" list = serv.get_all_best_neighbors_by_gene("eco:b0002") list.each do |hit| --- 487,491 ---- end ! puts "# * get_all_best_neighbors_by_gene('eco:b0002')" list = serv.get_all_best_neighbors_by_gene("eco:b0002") list.each do |hit| *************** *** 327,331 **** end ! puts "--- get_all_reverse_best_neighbors_by_gene('eco:b0002')" list = serv.get_all_reverse_best_neighbors_by_gene("eco:b0002") list.each do |hit| --- 499,503 ---- end ! puts "# * get_all_reverse_best_neighbors_by_gene('eco:b0002')" list = serv.get_all_reverse_best_neighbors_by_gene("eco:b0002") list.each do |hit| *************** *** 339,343 **** end ! puts "--- get_all_paralogs_by_gene('eco:b0002')" list = serv.get_all_paralogs_by_gene("eco:b0002") list.each do |hit| --- 511,515 ---- end ! puts "# * get_all_paralogs_by_gene('eco:b0002')" list = serv.get_all_paralogs_by_gene("eco:b0002") list.each do |hit| *************** *** 393,397 **** list = serv.get_motifs_by_gene("eco:b0002", "all") list.each do |motif| ! puts "--- motif result" puts " motif_id : #{motif.motif_id}" puts " definition : #{motif.definition}" --- 565,569 ---- list = serv.get_motifs_by_gene("eco:b0002", "all") list.each do |motif| ! puts "# * motif result" puts " motif_id : #{motif.motif_id}" puts " definition : #{motif.definition}" *************** *** 409,413 **** end ! puts "--- get_all_genes_by_motifs(['pf:ACT', 'ps:ASPARTOKINASE'])" list = serv.get_all_genes_by_motifs(["pf:ACT", "ps:ASPARTOKINASE"]) list.each do |gene| --- 581,585 ---- end ! puts "# * get_all_genes_by_motifs(['pf:ACT', 'ps:ASPARTOKINASE'])" list = serv.get_all_genes_by_motifs(["pf:ACT", "ps:ASPARTOKINASE"]) list.each do |gene| *************** *** 435,439 **** end ! puts "--- get_all_oc_members_by_gene('eco:b0002')" list = serv.get_all_oc_members_by_gene("eco:b0002") list.each do |gene| --- 607,611 ---- end ! puts "# * get_all_oc_members_by_gene('eco:b0002')" list = serv.get_all_oc_members_by_gene("eco:b0002") list.each do |gene| *************** *** 447,451 **** end ! puts "--- get_all_pc_members_by_gene('eco:b0002')" list = serv.get_all_pc_members_by_gene("eco:b0002") list.each do |gene| --- 619,623 ---- end ! puts "# * get_all_pc_members_by_gene('eco:b0002')" list = serv.get_all_pc_members_by_gene("eco:b0002") list.each do |gene| *************** *** 473,477 **** puts url ! #puts "--- save_image(#{url})" #filename = serv.save_image(url, "test.gif") #filename = serv.save_image(url) --- 645,649 ---- puts url ! #puts "# * save_image(#{url})" #filename = serv.save_image(url, "test.gif") #filename = serv.save_image(url) *************** *** 618,622 **** end ! puts "--- get_all_genes_by_organism('mge')" list = serv.get_all_genes_by_organism("mge") list.each do |gene| --- 790,794 ---- end ! puts "# * get_all_genes_by_organism('mge')" list = serv.get_all_genes_by_organism("mge") list.each do |gene| *************** *** 631,864 **** end - - =begin - - = Bio::KEGG::API - - KEGG API is a web service to use KEGG system via SOAP/WSDL. For more - informations on KEGG API, see the following site and its reference manual. - - * (()) - - --- Bio::KEGG::API.new(wsdl = nil) - - Connect to the KEGG API's SOAP server. A WSDL file will be automatically - downloaded and parsed to generate the SOAP client driver. The default URL - for the WSDL is http://soap.genome.jp/KEGG.wsdl but it can be changed by - the argument or by wsdl= method. - - --- Bio::KEGG::API#wsdl - - Returns URL of the current WSDL file. - - --- Bio::KEGG::API#wsdl=(url) - - Change the URL for WSDL file of the KEGG API if needed for some reason: - - serv = Bio::KEGG::API.new("http://133.103.100.186/KEGG.wsdl") - - or - - serv = Bio::KEGG::API.new - serv.wsdl = "http://133.103.100.186/KEGG.wsdl" - - note that both can't read two or more different WSDL files. - - --- Bio::KEGG::API#log - - Returns current logging IO. - - --- Bio::KEGG::API#log=(io) - - Change the IO for logging. The argument is passed to wiredump_dev method - of the SOAP4R, thus - - serv = Bio::KEGG::API.new - serv.log = STDERR - - will print all the SOAP transactions in standard error. - This feature is especially useful for debug. - - --- Bio::KEGG::API#start - - Returns current value for the 'start' count for the methods having - start/max_results argument pairs. - - --- Bio::KEGG::API#start=(number) - - Changes the default value for the 'start' count. - - --- Bio::KEGG::API#max_results - - Returns current value for the 'max_results' number for the methods having - start/max_results argument pairs. - - --- Bio::KEGG::API#max_results=(number) - - Changes the default value for the 'max_results' count. - If your request timeouts, try smaller value for the max_results. - - === KEGG API methods implemented only in BioRuby - - In BioRuby, returned values are added filter method to pick up - values in a complex data type as an array. - - #!/usr/bin/env ruby - - require 'bio' - - serv = Bio::KEGG::API.new - results = serv.get_best_neighbors_by_gene("eco:b0002", "bsu") - - # case 0 : without filter - results.each do |hit| - print hit.genes_id1, "\t", hit.genes_id2, "\t", hit.sw_score, "\n" - end - - # case 1 : select gene names and SW score only - fields = [:genes_id1, :genes_id2, :sw_score] - results.each do |hit| - puts hit.filter(fields).join("\t") - end - - # case 2 : also uses aligned position in each amino acid sequence etc. - fields1 = [:genes_id1, :start_position1, :end_position1, :best_flag_1to2] - fields2 = [:genes_id2, :start_position2, :end_position2, :best_flag_2to1] - results.each do |hit| - print "> score: ", hit.sw_score, ", identity: ", hit.identity, "\n" - print "1:\t", hit.filter(fields1).join("\t"), "\n" - print "2:\t", hit.filter(fields2).join("\t"), "\n" - end - - Using filter method will make it easy to change fields to select and - keep the script clean. - - - --- Bio::KEGG::API#get_all_neighbors_by_gene(genes_id, org) - --- Bio::KEGG::API#get_all_best_best_neighbors_by_gene(genes_id) - --- Bio::KEGG::API#get_all_best_neighbors_by_gene(genes_id) - --- Bio::KEGG::API#get_all_reverse_best_neighbors_by_gene(genes_id) - --- Bio::KEGG::API#get_all_paralogs_by_gene(genes_id) - --- Bio::KEGG::API#get_all_genes_by_motifs(motif_id_list) - --- Bio::KEGG::API#get_all_oc_members_by_gene(genes_id) - --- Bio::KEGG::API#get_all_pc_members_by_gene(genes_id) - --- Bio::KEGG::API#get_all_genes_by_organism(org) - - These methods are wrapper for the methods without _all_ in its name - and internally iterate to retrive all the results using start/max_results - value pairs described above. For example, - - #!/usr/bin/env ruby - - require 'soap/wsdlDriver' - - wsdl = "http://soap.genome.jp/KEGG.wsdl" - serv = SOAP::WSDLDriverFactory.new(wsdl).create_driver - serv.generate_explicit_type = true - - start = 1 - max_results = 100 - - loop do - results = serv.get_best_neighbors_by_gene('eco:b0002', start, max_results) - break unless results # when no more results returned - results.each do |hit| - print hit.genes_id1, "\t", hit.genes_id2, "\t", hit.sw_score, "\n" - end - start += max_results - end - - can be witten as - - #!/usr/bin/env ruby - - require 'bio' - - serv = Bio::KEGG::API.new - - results = serv.get_all_best_neighbors_by_gene('eco:b0002') - results.each do |hit| - print hit.genes_id1, "\t", hit.genes_id2, "\t", hit.sw_score, "\n" - end - - - --- Bio::KEGG::API#save_image(url, filename = nil) - - Some methods of the KEGG API will return a URL of the generated image. - This method save an image specified by the URL. The filename can be - specified by its second argument, otherwise basename of the URL will - be used. - - #!/usr/bin/env ruby - - require 'bio' - - serv = Bio::KEGG::API.new("http://soap.genome.jp/v3.0/KEGG.wsdl") - - list = ["eco:b1002", "eco:b2388"] - url = serv.mark_pathway_by_objects("path:eco00010", list) - - # Save with the original filename (eco00010.gif in this case) - serv.save_image(url) - - # or save as "save_image.gif" - serv.save_image(url, "save_image.gif") - - --- Bio::KEGG::API#get_entries(entry_id_list) - --- Bio::KEGG::API#get_aaseqs(entry_id_list) - --- Bio::KEGG::API#get_naseqs(entry_id_list) - --- Bio::KEGG::API#get_definitions(entry_id_list) - - For the shortcut and backward compatibility. - - - === General KEGG API methods - - For the methods listed below, consult the KEGG API manual at - - * (()) - - --- list_databases - --- list_organisms - --- list_pathways(org) - --- binfo(string) - --- bget(string) - --- bfind(string) - --- btit(string) - --- get_linkdb_by_entry(entry_id, db, start, max_results) - #--- get_neighbors_by_gene(genes_id, org, start, max_results) - --- get_best_best_neighbors_by_gene(genes_id, start, max_results) - --- get_best_neighbors_by_gene(genes_id, start, max_results) - --- get_reverse_best_neighbors_by_gene(genes_id, start, max_results) - --- get_paralogs_by_gene(genes_id, start, max_results) - --- get_similarity_between_genes(genes_id1, genes_id2) - --- get_motifs_by_gene(genes_id, db) - --- get_genes_by_motifs(motif_id_list, start, max_results) - --- get_ko_by_gene(genes_id) - --- get_ko_members(ko_id) - --- get_oc_members_by_gene(genes_id, start, max_results) - --- get_pc_members_by_gene(genes_id, start, max_results) - --- mark_pathway_by_objects(pathway_id, object_id_list) - --- color_pathway_by_objects(pathway_id, object_id_list, fg_color_list, bg_color_list) - --- get_genes_by_pathway(pathway_id) - --- get_enzymes_by_pathway(pathway_id) - --- get_compounds_by_pathway(pathway_id) - --- get_reactions_by_pathway(pathway_id) - --- get_pathways_by_genes(genes_id_list) - --- get_pathways_by_enzymes(enzyme_id_list) - --- get_pathways_by_compounds(compound_id_list) - --- get_pathways_by_reactions(reaction_id_list) - --- get_linked_pathways(pathway_id) - --- get_genes_by_enzyme(enzyme_id, org) - --- get_enzymes_by_gene(genes_id) - --- get_enzymes_by_compound(compound_id) - --- get_enzymes_by_reaction(reaction_id) - --- get_compounds_by_enzyme(enzyme_id) - --- get_compounds_by_reaction(reaction_id) - --- get_reactions_by_enzyme(enzyme_id) - --- get_reactions_by_compound(compound_id) - --- get_genes_by_organism(org, start, max_results) - --- get_number_of_genes_by_organism(org) - - =end - --- 803,804 ---- From k at dev.open-bio.org Tue Sep 19 01:46:24 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Tue, 19 Sep 2006 05:46:24 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io higet.rb,1.2,1.3 Message-ID: <200609190546.k8J5kO59031430@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory dev.open-bio.org:/tmp/cvs-serv31426/lib/bio/io Modified Files: higet.rb Log Message: * changed from LGPL to Ruby's Index: higet.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/higet.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** higet.rb 26 Sep 2005 13:00:08 -0000 1.2 --- higet.rb 19 Sep 2006 05:46:22 -0000 1.3 *************** *** 1,22 **** # ! # bio/io/higet.rb - SOAP interface for HGC HiGet ! # ! # Copyright (C) 2005 KATAYAMA Toshiaki ! # ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 1,8 ---- # ! # = bio/io/higet.rb - SOAP interface for HGC HiGet # ! # Copyright:: Copyright (C) 2005 Toshiaki Katayama # ! # $Id$ # *************** *** 26,29 **** --- 12,24 ---- class HGC + # == Description + # + # Interface for the HiGet service provided by Human Genome Center (HGC), Japan. + # HiGet performs full-text search against various biological databases. + # + # == References + # + # * http://higet.hgc.jp/ + # class HiGet < Bio::SOAPWSDL *************** *** 77,92 **** end - - =begin - - = Bio::HGC::HiGet - - * (()) - - == HiGet#hifind - == HiGet#higet - == HiGet#higet_in_fasta - == HiGet#higet_in_xml - - =end - --- 72,73 ---- From k at dev.open-bio.org Tue Sep 19 01:47:54 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Tue, 19 Sep 2006 05:47:54 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io pubmed.rb,1.14,1.15 Message-ID: <200609190547.k8J5lsL4031491@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory dev.open-bio.org:/tmp/cvs-serv31487/lib/bio/io Modified Files: pubmed.rb Log Message: * changed from LGPL to Ruby's * minor change of doc format Index: pubmed.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/pubmed.rb,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pubmed.rb 14 Jul 2006 14:48:56 -0000 1.14 --- pubmed.rb 19 Sep 2006 05:47:52 -0000 1.15 *************** *** 1,23 **** # ! # bio/io/pubmed.rb - NCBI Entrez/PubMed client module ! # ! # Copyright (C) 2001 KATAYAMA Toshiaki ! # 2006 Jan Aerts ! # ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 1,10 ---- # ! # = bio/io/pubmed.rb - NCBI Entrez/PubMed client module # ! # Copyright:: Copyright (C) 2001 Toshiaki Katayama ! # Copyright:: Copyright (C) 2006 Jan Aerts ! # License:: Ruby's # ! # $Id$ # *************** *** 28,203 **** module Bio ! # = DESCRIPTION ! # The Bio::PubMed class provides several ways to retrieve bibliographic ! # information from the PubMed database at ! # http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=PubMed. Basically, two ! # types of queries are possible: ! # * searching for PubMed IDs given a query string: ! # * Bio::PubMed#search ! # * Bio::PubMed#esearch ! # * retrieving the MEDLINE text (i.e. authors, journal, abstract, ...) given a PubMed ID ! # * Bio::PubMed#query ! # * Bio::PubMed#pmfetch ! # * Bio::PubMed#efetch ! # ! # The different methods within the same group are interchangeable and should ! # return the same result. ! # ! # Additional information about the MEDLINE format and PubMed programmable ! # APIs can be found on the following websites: ! # * Overview: http://www.ncbi.nlm.nih.gov/entrez/query/static/overview.html ! # * How to link: http://www.ncbi.nlm.nih.gov/entrez/query/static/linking.html ! # * MEDLINE format: http://www.ncbi.nlm.nih.gov/entrez/query/static/help/pmhelp.html#MEDLINEDisplayFormat ! # * Search field descriptions and tags: http://www.ncbi.nlm.nih.gov/entrez/query/static/help/pmhelp.html#SearchFieldDescriptionsandTags ! # * Entrez utilities index: http://www.ncbi.nlm.nih.gov/entrez/utils/utils_index.html ! # * PmFetch CGI help: http://www.ncbi.nlm.nih.gov/entrez/utils/pmfetch_help.html ! # * E-Utilities CGI help: http://eutils.ncbi.nlm.nih.gov/entrez/query/static/eutils_help.html ! # ! # = USAGE ! # require 'bio' ! # ! # # If you don't know the pubmed ID: ! # Bio::PubMed.search("(genome AND analysis) OR bioinformatics)").each do |x| ! # p x ! # end ! # Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics)").each do |x| ! # p x ! # end ! # ! # # To retrieve the MEDLINE entry for a given PubMed ID: ! # puts Bio::PubMed.query("10592173") ! # puts Bio::PubMed.pmfetch("10592173") ! # puts Bio::PubMed.efetch("10592173", "14693808") ! # # This can be converted into a Bio::MEDLINE object: ! # manuscript = Bio::PubMed.query("10592173") ! # medline = Bio::MEDLINE(manuscript) ! # ! # = REMARK ! # This class can not be used at the moment if you're behind a proxy server. This will be solved in the near future. ! class PubMed ! # Search the PubMed database by given keywords using entrez query and returns ! # an array of PubMed IDs. ! # --- ! # *Arguments*: ! # * _id_: query string (required) ! # *Returns*:: array of PubMed IDs ! def self.search(str) ! host = "www.ncbi.nlm.nih.gov" ! path = "/entrez/query.fcgi?tool=bioruby&cmd=Search&doptcmdl=MEDLINE&db=PubMed&term=" ! http = Bio::Command.new_http(host) ! response, = http.get(path + CGI.escape(str)) ! result = response.body ! result = result.gsub("\r", "\n").squeeze("\n") ! result = result.scan(/
(.*?)<\/pre>/m).flatten
!       return result
!     end
  
!     # Search the PubMed database by given keywords using E-Utils and returns 
!     # an array of PubMed IDs.
!     # 
!     # For information on the possible arguments, see
!     # http://eutils.ncbi.nlm.nih.gov/entrez/query/static/esearch_help.html#PubMed
!     # ---
!     # *Arguments*:
!     # * _id_: query string (required)
!     # * _field_
!     # * _reldate_
!     # * _mindate_
!     # * _maxdate_
!     # * _datetype_
!     # * _retstart_
!     # * _retmax_ (default 100)
!     # * _retmode_
!     # * _rettype_
!     # *Returns*:: array of PubMed IDs
!     def self.esearch(str, hash = {})
!       hash['retmax'] = 100 unless hash['retmax']
  
!       opts = []
!       hash.each do |k, v|
!         opts << "#{k}=#{v}"
!       end
  
!       host = "eutils.ncbi.nlm.nih.gov"
!       path = "/entrez/eutils/esearch.fcgi?tool=bioruby&db=pubmed&#{opts.join('&')}&term="
  
!       http = Bio::Command.new_http(host)
!       response, = http.get(path + CGI.escape(str))
!       result = response.body
!       result = result.scan(/(.*?)<\/Id>/m).flatten
!       return result
!     end
  
!     # Retrieve PubMed entry by PMID and returns MEDLINE formatted string using
!     # entrez query.
!     # ---
!     # *Arguments*:
!     # * _id_: PubMed ID (required)
!     # *Returns*:: MEDLINE formatted String
!     def self.query(id)
!       host = "www.ncbi.nlm.nih.gov"
!       path = "/entrez/query.fcgi?tool=bioruby&cmd=Text&dopt=MEDLINE&db=PubMed&uid="
  
!       http = Bio::Command.new_http(host)
!       response, = http.get(path + id.to_s)
!       result = response.body
!       if result =~ /#{id}\s+Error/
!         raise( result )
!       else
!         result = result.gsub("\r", "\n").squeeze("\n").gsub(/<\/?pre>/, '')
!         return result
!       end
      end
  
!     # Retrieve PubMed entry by PMID and returns MEDLINE formatted string using
!     # entrez pmfetch.
!     # ---
!     # *Arguments*:
!     # * _id_: PubMed ID (required)
!     # *Returns*:: MEDLINE formatted String
!     def self.pmfetch(id)
!       host = "www.ncbi.nlm.nih.gov"
!       path = "/entrez/utils/pmfetch.fcgi?tool=bioruby&mode=text&report=medline&db=PubMed&id="
  
!       http = Bio::Command.new_http(host)
!       response, = http.get(path + id.to_s)
!       result = response.body
!       if result =~ /#{id}\s+Error/
!         raise( result )
!       else
!         result = result.gsub("\r", "\n").squeeze("\n").gsub(/<\/?pre>/, '')
!         return result
!       end
      end
  
!     # Retrieve PubMed entry by PMID and returns MEDLINE formatted string using
!     # entrez efetch. Multiple PubMed IDs can be provided:
!     #   Bio::PubMed.efetch(123)
!     #   Bio::PubMed.efetch(123,456,789)
!     #   Bio::PubMed.efetch([123,456,789])
!     # ---
!     # *Arguments*:
!     # * _ids_: list of PubMed IDs (required)
!     # *Returns*:: MEDLINE formatted String
!     def self.efetch(*ids)
!       return [] if ids.empty?
! 
!       host = "eutils.ncbi.nlm.nih.gov"
!       path = "/entrez/eutils/efetch.fcgi?tool=bioruby&db=pubmed&retmode=text&rettype=medline&id="
  
!       ids = ids.join(",")
  
!       http = Bio::Command.new_http(host)
!       response, = http.get(path + ids)
!       result = response.body
!       result = result.split(/\n\n+/)
!       return result
!     end
  
    end
  
! end
  
  
--- 15,194 ----
  module Bio
  
! # == Description
! #
! # The Bio::PubMed class provides several ways to retrieve bibliographic
! # information from the PubMed database at
! # http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=PubMed. Basically, two
! # types of queries are possible:
! #
! # * searching for PubMed IDs given a query string:
! #   * Bio::PubMed#search
! #   * Bio::PubMed#esearch
! #
! # * retrieving the MEDLINE text (i.e. authors, journal, abstract, ...)
! #   given a PubMed ID
! #   * Bio::PubMed#query
! #   * Bio::PubMed#pmfetch
! #   * Bio::PubMed#efetch
! #
! # The different methods within the same group are interchangeable and should
! # return the same result.
! # 
! # Additional information about the MEDLINE format and PubMed programmable
! # APIs can be found on the following websites:
! #
! # * Overview: http://www.ncbi.nlm.nih.gov/entrez/query/static/overview.html
! # * How to link: http://www.ncbi.nlm.nih.gov/entrez/query/static/linking.html
! # * MEDLINE format: http://www.ncbi.nlm.nih.gov/entrez/query/static/help/pmhelp.html#MEDLINEDisplayFormat
! # * Search field descriptions and tags: http://www.ncbi.nlm.nih.gov/entrez/query/static/help/pmhelp.html#SearchFieldDescriptionsandTags
! # * Entrez utilities index: http://www.ncbi.nlm.nih.gov/entrez/utils/utils_index.html
! # * PmFetch CGI help: http://www.ncbi.nlm.nih.gov/entrez/utils/pmfetch_help.html
! # * E-Utilities CGI help: http://eutils.ncbi.nlm.nih.gov/entrez/query/static/eutils_help.html
! #
! # == Usage
! #
! #   require 'bio'
! #
! #   # If you don't know the pubmed ID:
! #   Bio::PubMed.search("(genome AND analysis) OR bioinformatics)").each do |x|
! #     p x
! #   end
! #   Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics)").each do |x|
! #     p x
! #   end
! #   
! #   # To retrieve the MEDLINE entry for a given PubMed ID:
! #   puts Bio::PubMed.query("10592173")
! #   puts Bio::PubMed.pmfetch("10592173")
! #   puts Bio::PubMed.efetch("10592173", "14693808")
! #   # This can be converted into a Bio::MEDLINE object:
! #   manuscript = Bio::PubMed.query("10592173")
! #   medline = Bio::MEDLINE(manuscript)
! #  
! class PubMed
  
!   # Search the PubMed database by given keywords using entrez query and returns
!   # an array of PubMed IDs.
!   # ---
!   # *Arguments*:
!   # * _id_: query string (required)
!   # *Returns*:: array of PubMed IDs
!   def self.search(str)
!     host = "www.ncbi.nlm.nih.gov"
!     path = "/entrez/query.fcgi?tool=bioruby&cmd=Search&doptcmdl=MEDLINE&db=PubMed&term="
  
!     http = Bio::Command.new_http(host)
!     response, = http.get(path + CGI.escape(str))
!     result = response.body
!     result = result.gsub("\r", "\n").squeeze("\n")
!     result = result.scan(/
(.*?)<\/pre>/m).flatten
!     return result
!   end
  
!   # Search the PubMed database by given keywords using E-Utils and returns 
!   # an array of PubMed IDs.
!   # 
!   # For information on the possible arguments, see
!   # http://eutils.ncbi.nlm.nih.gov/entrez/query/static/esearch_help.html#PubMed
!   # ---
!   # *Arguments*:
!   # * _id_: query string (required)
!   # * _field_
!   # * _reldate_
!   # * _mindate_
!   # * _maxdate_
!   # * _datetype_
!   # * _retstart_
!   # * _retmax_ (default 100)
!   # * _retmode_
!   # * _rettype_
!   # *Returns*:: array of PubMed IDs
!   def self.esearch(str, hash = {})
!     hash['retmax'] = 100 unless hash['retmax']
  
!     opts = []
!     hash.each do |k, v|
!       opts << "#{k}=#{v}"
!     end
  
!     host = "eutils.ncbi.nlm.nih.gov"
!     path = "/entrez/eutils/esearch.fcgi?tool=bioruby&db=pubmed&#{opts.join('&')}&term="
  
!     http = Bio::Command.new_http(host)
!     response, = http.get(path + CGI.escape(str))
!     result = response.body
!     result = result.scan(/(.*?)<\/Id>/m).flatten
!     return result
!   end
  
!   # Retrieve PubMed entry by PMID and returns MEDLINE formatted string using
!   # entrez query.
!   # ---
!   # *Arguments*:
!   # * _id_: PubMed ID (required)
!   # *Returns*:: MEDLINE formatted String
!   def self.query(id)
!     host = "www.ncbi.nlm.nih.gov"
!     path = "/entrez/query.fcgi?tool=bioruby&cmd=Text&dopt=MEDLINE&db=PubMed&uid="
  
!     http = Bio::Command.new_http(host)
!     response, = http.get(path + id.to_s)
!     result = response.body
!     if result =~ /#{id}\s+Error/
!       raise( result )
!     else
!       result = result.gsub("\r", "\n").squeeze("\n").gsub(/<\/?pre>/, '')
!       return result
      end
+   end
  
!   # Retrieve PubMed entry by PMID and returns MEDLINE formatted string using
!   # entrez pmfetch.
!   # ---
!   # *Arguments*:
!   # * _id_: PubMed ID (required)
!   # *Returns*:: MEDLINE formatted String
!   def self.pmfetch(id)
!     host = "www.ncbi.nlm.nih.gov"
!     path = "/entrez/utils/pmfetch.fcgi?tool=bioruby&mode=text&report=medline&db=PubMed&id="
  
!     http = Bio::Command.new_http(host)
!     response, = http.get(path + id.to_s)
!     result = response.body
!     if result =~ /#{id}\s+Error/
!       raise( result )
!     else
!       result = result.gsub("\r", "\n").squeeze("\n").gsub(/<\/?pre>/, '')
!       return result
      end
+   end
  
!   # Retrieve PubMed entry by PMID and returns MEDLINE formatted string using
!   # entrez efetch. Multiple PubMed IDs can be provided:
!   #   Bio::PubMed.efetch(123)
!   #   Bio::PubMed.efetch(123,456,789)
!   #   Bio::PubMed.efetch([123,456,789])
!   # ---
!   # *Arguments*:
!   # * _ids_: list of PubMed IDs (required)
!   # *Returns*:: MEDLINE formatted String
!   def self.efetch(*ids)
!     return [] if ids.empty?
  
!     host = "eutils.ncbi.nlm.nih.gov"
!     path = "/entrez/eutils/efetch.fcgi?tool=bioruby&db=pubmed&retmode=text&rettype=medline&id="
  
!     ids = ids.join(",")
  
+     http = Bio::Command.new_http(host)
+     response, = http.get(path + ids)
+     result = response.body
+     result = result.split(/\n\n+/)
+     return result
    end
  
! end # PubMed
! 
! end # Bio
  
  


From k at dev.open-bio.org  Tue Sep 19 01:49:22 2006
From: k at dev.open-bio.org (Katayama Toshiaki)
Date: Tue, 19 Sep 2006 05:49:22 +0000
Subject: [BioRuby-cvs] bioruby/lib/bio/io sql.rb,1.4,1.5
Message-ID: <200609190549.k8J5nMjc031590@dev.open-bio.org>

Update of /home/repository/bioruby/bioruby/lib/bio/io
In directory dev.open-bio.org:/tmp/cvs-serv31586/lib/bio/io

Modified Files:
	sql.rb 
Log Message:
* changed to RDoc
* license is changed from LGPL to Ruby's


Index: sql.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/io/sql.rb,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** sql.rb	26 Sep 2005 13:04:28 -0000	1.4
--- sql.rb	19 Sep 2006 05:49:19 -0000	1.5
***************
*** 1,22 ****
  #
! # bio/io/sql.rb - BioSQL access module
! #
! #   Copyright (C) 2002 KATAYAMA Toshiaki 
! #
! #  This library is free software; you can redistribute it and/or
! #  modify it under the terms of the GNU Lesser General Public
! #  License as published by the Free Software Foundation; either
! #  version 2 of the License, or (at your option) any later version.
! #
! #  This library is distributed in the hope that it will be useful,
! #  but WITHOUT ANY WARRANTY; without even the implied warranty of
! #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
! #  Lesser General Public License for more details.
  #
! #  You should have received a copy of the GNU Lesser General Public
! #  License along with this library; if not, write to the Free Software
! #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  #
! #  $Id$
  #
  
--- 1,9 ----
  #
! # = bio/io/sql.rb - BioSQL access module
  #
! # Copyright::  Copyright (C) 2002 Toshiaki Katayama 
! # License::    Ruby's
  #
! # $Id$
  #
  
***************
*** 31,321 ****
  module Bio
  
!   class SQL
  
!     def initialize(db = 'dbi:Mysql:biosql', user = nil, pass = nil)
!       @dbh = DBI.connect(db, user, pass)
!     end
  
!     def close
!       @dbh.disconnect
!     end
  
!     def fetch(accession)	# or display_id for fall back
!       query = "select * from bioentry where accession = ?"
!       entry = @dbh.execute(query, accession).fetch
!       return Sequence.new(@dbh, entry) if entry
  
!       query = "select * from bioentry where display_id = ?"
!       entry = @dbh.execute(query, accession).fetch
!       return Sequence.new(@dbh, entry) if entry
!     end
!     alias get_by_id fetch
  
  
!     # for lazy fetching
  
!     class Sequence
  
!       def initialize(dbh, entry)
!         @dbh = dbh
!         @bioentry_id = entry['bioentry_id']
!         @database_id = entry['biodatabase_id']
!         @entry_id = entry['display_id']
!         @accession = entry['accession']
!         @version = entry['entry_version']
!         @division = entry['division']
!       end
!       attr_reader :accession, :division, :entry_id, :version
  
  
!       def to_fasta
!         if seq = seq
!           return seq.to_fasta(@accession)
!         end
        end
  
!       def seq
!         query = "select * from biosequence where bioentry_id = ?"
!         row = @dbh.execute(query, @bioentry_id).fetch
!         return unless row
  
!         mol = row['molecule']
!         seq = row['biosequence_str']
  
!         case mol
!         when /.na/i			# 'dna' or 'rna'
!           Bio::Sequence::NA.new(seq)
!         else				# 'protein'
!           Bio::Sequence::AA.new(seq)
!         end
        end
  
!       def subseq(from, to)
!         length = to - from + 1
!         query = "select molecule, substring(biosequence_str, ?, ?) as subseq" +
!                 " from biosequence where bioentry_id = ?"
!         row = @dbh.execute(query, from, length, @bioentry_id).fetch
!         return unless row
  
!         mol = row['molecule']
!         seq = row['subseq']
  
!         case mol
!         when /.na/i			# 'dna' or 'rna'
!           Bio::Sequence::NA.new(seq)
!         else				# 'protein'
!           Bio::Sequence::AA.new(seq)
!         end
        end
  
  
!       def features
!         array = []
!         query = "select * from seqfeature where bioentry_id = ?"
!         @dbh.execute(query, @bioentry_id).fetch_all.each do |row|
!           next unless row
  
!           f_id = row['seqfeature_id']
!           k_id = row['seqfeature_key_id']
!           s_id = row['seqfeature_source_id']
!           rank = row['seqfeature_rank'].to_i - 1
  
!           # key : type (gene, CDS, ...)
!           type = feature_key(k_id)
  
!           # source : database (EMBL/GenBank/SwissProt)
!           database = feature_source(s_id)
  
!           # location : position
!           locations = feature_locations(f_id)
  
!           # qualifier
!           qualifiers = feature_qualifiers(f_id)
!   
!           # rank
!           array[rank] = Bio::Feature.new(type, locations, qualifiers)
!         end
!         return Bio::Features.new(array)
        end
  
  
!       def references
!         array = []
!         query = <<-END
!           select * from bioentry_reference, reference
!           where bioentry_id = ? and
!           bioentry_reference.reference_id = reference.reference_id
!         END
!         @dbh.execute(query, @bioentry_id).fetch_all.each do |row|
!           next unless row
  
!           hash = {
!             'start'	=> row['reference_start'],
!             'end'	=> row['reference_end'],
!             'journal'	=> row['reference_location'],
!             'title'	=> row['reference_title'],
!             'authors'	=> row['reference_authors'],
!             'medline'	=> row['reference_medline']
!           }
!           hash.default = ''
  
!           rank = row['reference_rank'].to_i - 1
!           array[rank] = hash
!         end
!         return array
        end
  
  
!       def comment
!         query = "select * from comment where bioentry_id = ?"
!         row = @dbh.execute(query, @bioentry_id).fetch
!         row ? row['comment_text'] : ''
!       end
! 
!       def comments
!         array = []
!         query = "select * from comment where bioentry_id = ?"
!         @dbh.execute(query, @bioentry_id).fetch_all.each do |row|
!           next unless row
!           rank = row['comment_rank'].to_i - 1
!           array[rank] = row['comment_text']
!         end
!         return array
!       end
  
!       def database
!         query = "select * from biodatabase where biodatabase_id = ?"
!         row = @dbh.execute(query, @database_id).fetch
!         row ? row['name'] : ''
        end
  
!       def date
!         query = "select * from bioentry_date where bioentry_id = ?"
!         row = @dbh.execute(query, @bioentry_id).fetch
!         row ? row['date'] : ''
!       end
  
!       def dblink
!         query = "select * from bioentry_direct_links where source_bioentry_id = ?"
!         row = @dbh.execute(query, @bioentry_id).fetch
!         row ? [row['dbname'], row['accession']] : []
!       end
  
!       def definition
!         query = "select * from bioentry_description where bioentry_id = ?"
!         row = @dbh.execute(query, @bioentry_id).fetch
!         row ? row['description'] : ''
!       end
  
!       def keyword
!         query = "select * from bioentry_keywords where bioentry_id = ?"
!         row = @dbh.execute(query, @bioentry_id).fetch
!         row ? row['keywords'] : ''
!       end
  
!       def taxonomy
!         query = <<-END
!           select full_lineage, common_name, ncbi_taxa_id
!           from bioentry_taxa, taxa
!           where bioentry_id = ? and bioentry_taxa.taxa_id = taxa.taxa_id
!         END
!         row = @dbh.execute(query, @bioentry_id).fetch
!         @lineage = row ? row['full_lineage'] : ''
!         @common_name = row ? row['common_name'] : ''
!         @ncbi_taxa_id = row ? row['ncbi_taxa_id'] : ''
!         row ? [@lineage, @common_name, @ncbi_taxa_id] : []
!       end
  
!       def lineage
!         taxonomy unless @lineage
!         return @lineage
!       end
  
!       def common_name
!         taxonomy unless @common_name
!         return @common_name
!       end
  
!       def ncbi_taxa_id
!         taxonomy unless @ncbi_taxa_id
!         return @ncbi_taxa_id
!       end
  
  
-       private
  
!       def feature_key(k_id)
!         query = "select * from seqfeature_key where seqfeature_key_id = ?"
!         row = @dbh.execute(query, k_id).fetch
!         row ? row['key_name'] : ''
!       end
  
!       def feature_source(s_id)
!         query = "select * from seqfeature_source where seqfeature_source_id = ?"
!         row = @dbh.execute(query, s_id).fetch
!         row ? row['source_name'] : ''
!       end
  
!       def feature_locations(f_id)
!         locations = []
!         query = "select * from seqfeature_location where seqfeature_id = ?"
!         @dbh.execute(query, f_id).fetch_all.each do |row|
!           next unless row
  
!           location = Bio::Location.new
!           location.strand = row['seq_strand']
!           location.from = row['seq_start']
!           location.to = row['seq_end']
  
!           xref = feature_locations_remote(row['seqfeature_location_id'])
!           location.xref_id = xref.shift unless xref.empty?
  
!           # just omit fuzzy location for now...
!           #feature_locations_qv(row['seqfeature_location_id'])
  
!           rank = row['location_rank'].to_i - 1
!           locations[rank] = location
!         end
!         return Bio::Locations.new(locations)
!       end
  
!       def feature_locations_remote(l_id)
!         query = "select * from remote_seqfeature_name where seqfeature_location_id = ?"
!         row = @dbh.execute(query, l_id).fetch
!         row ? [row['accession'], row['version']] : []
        end
  
!       def feature_locations_qv(l_id)
!         query = "select * from location_qualifier_value where seqfeature_location_id = ?"
!         row = @dbh.execute(query, l_id).fetch
!         row ? [row['qualifier_value'], row['slot_value']] : []
!       end
  
!       def feature_qualifiers(f_id)
!         qualifiers = []
!         query = "select * from seqfeature_qualifier_value where seqfeature_id = ?"
!         @dbh.execute(query, f_id).fetch_all.each do |row|
!           next unless row
  
!           key = feature_qualifiers_key(row['seqfeature_qualifier_id'])
!           value = row['qualifier_value']
!           qualifier = Bio::Feature::Qualifier.new(key, value)
  
!           rank = row['seqfeature_qualifier_rank'].to_i - 1
!           qualifiers[rank] = qualifier
!         end
!         return qualifiers.compact	# .compact is nasty hack for a while
!       end
  
!       def feature_qualifiers_key(q_id)
!         query = "select * from seqfeature_qualifier where seqfeature_qualifier_id = ?"
!         row = @dbh.execute(query, q_id).fetch
!         row ? row['qualifier_name'] : ''
        end
      end
  
    end
  
! end
  
  
--- 18,316 ----
  module Bio
  
! class SQL
  
!   def initialize(db = 'dbi:Mysql:biosql', user = nil, pass = nil)
!     @dbh = DBI.connect(db, user, pass)
!   end
  
!   def close
!     @dbh.disconnect
!   end
  
!   # Returns Bio::SQL::Sequence object.
!   def fetch(accession)	# or display_id for fall back
!     query = "select * from bioentry where accession = ?"
!     entry = @dbh.execute(query, accession).fetch
!     return Sequence.new(@dbh, entry) if entry
  
!     query = "select * from bioentry where display_id = ?"
!     entry = @dbh.execute(query, accession).fetch
!     return Sequence.new(@dbh, entry) if entry
!   end
!   alias get_by_id fetch
  
  
!   # for lazy fetching
  
!   class Sequence
  
!     def initialize(dbh, entry)
!       @dbh = dbh
!       @bioentry_id = entry['bioentry_id']
!       @database_id = entry['biodatabase_id']
!       @entry_id = entry['display_id']
!       @accession = entry['accession']
!       @version = entry['entry_version']
!       @division = entry['division']
!     end
!     attr_reader :accession, :division, :entry_id, :version
  
  
!     def to_fasta
!       if seq = seq
!         return seq.to_fasta(@accession)
        end
+     end
  
!     # Returns Bio::Sequence::NA or AA object.
!     def seq
!       query = "select * from biosequence where bioentry_id = ?"
!       row = @dbh.execute(query, @bioentry_id).fetch
!       return unless row
  
!       mol = row['molecule']
!       seq = row['biosequence_str']
  
!       case mol
!       when /.na/i			# 'dna' or 'rna'
!         Bio::Sequence::NA.new(seq)
!       else				# 'protein'
!         Bio::Sequence::AA.new(seq)
        end
+     end
  
!     # Returns Bio::Sequence::NA or AA object (by lazy fetching).
!     def subseq(from, to)
!       length = to - from + 1
!       query = "select molecule, substring(biosequence_str, ?, ?) as subseq" +
!               " from biosequence where bioentry_id = ?"
!       row = @dbh.execute(query, from, length, @bioentry_id).fetch
!       return unless row
  
!       mol = row['molecule']
!       seq = row['subseq']
  
!       case mol
!       when /.na/i			# 'dna' or 'rna'
!         Bio::Sequence::NA.new(seq)
!       else				# 'protein'
!         Bio::Sequence::AA.new(seq)
        end
+     end
  
  
!     # Returns Bio::Features object.
!     def features
!       array = []
!       query = "select * from seqfeature where bioentry_id = ?"
!       @dbh.execute(query, @bioentry_id).fetch_all.each do |row|
!         next unless row
  
!         f_id = row['seqfeature_id']
!         k_id = row['seqfeature_key_id']
!         s_id = row['seqfeature_source_id']
!         rank = row['seqfeature_rank'].to_i - 1
  
!         # key : type (gene, CDS, ...)
!         type = feature_key(k_id)
  
!         # source : database (EMBL/GenBank/SwissProt)
!         database = feature_source(s_id)
  
!         # location : position
!         locations = feature_locations(f_id)
  
!         # qualifier
!         qualifiers = feature_qualifiers(f_id)
! 
!         # rank
!         array[rank] = Bio::Feature.new(type, locations, qualifiers)
        end
+       return Bio::Features.new(array)
+     end
  
  
!     # Returns reference informations in Array of Hash (not Bio::Reference).
!     def references
!       array = []
!       query = <<-END
!         select * from bioentry_reference, reference
!         where bioentry_id = ? and
!         bioentry_reference.reference_id = reference.reference_id
!       END
!       @dbh.execute(query, @bioentry_id).fetch_all.each do |row|
!         next unless row
  
!         hash = {
!           'start'	=> row['reference_start'],
!           'end'	=> row['reference_end'],
!           'journal'	=> row['reference_location'],
!           'title'	=> row['reference_title'],
!           'authors'	=> row['reference_authors'],
!           'medline'	=> row['reference_medline']
!         }
!         hash.default = ''
  
!         rank = row['reference_rank'].to_i - 1
!         array[rank] = hash
        end
+       return array
+     end
  
  
!     # Returns the first comment.  For complete comments, use comments method.
!     def comment
!       query = "select * from comment where bioentry_id = ?"
!       row = @dbh.execute(query, @bioentry_id).fetch
!       row ? row['comment_text'] : ''
!     end
  
!     # Returns comments in an Array of Strings.
!     def comments
!       array = []
!       query = "select * from comment where bioentry_id = ?"
!       @dbh.execute(query, @bioentry_id).fetch_all.each do |row|
!         next unless row
!         rank = row['comment_rank'].to_i - 1
!         array[rank] = row['comment_text']
        end
+       return array
+     end
  
!     def database
!       query = "select * from biodatabase where biodatabase_id = ?"
!       row = @dbh.execute(query, @database_id).fetch
!       row ? row['name'] : ''
!     end
  
!     def date
!       query = "select * from bioentry_date where bioentry_id = ?"
!       row = @dbh.execute(query, @bioentry_id).fetch
!       row ? row['date'] : ''
!     end
  
!     def dblink
!       query = "select * from bioentry_direct_links where source_bioentry_id = ?"
!       row = @dbh.execute(query, @bioentry_id).fetch
!       row ? [row['dbname'], row['accession']] : []
!     end
  
!     def definition
!       query = "select * from bioentry_description where bioentry_id = ?"
!       row = @dbh.execute(query, @bioentry_id).fetch
!       row ? row['description'] : ''
!     end
  
!     def keyword
!       query = "select * from bioentry_keywords where bioentry_id = ?"
!       row = @dbh.execute(query, @bioentry_id).fetch
!       row ? row['keywords'] : ''
!     end
  
!     # Use lineage, common_name, ncbi_taxa_id methods to extract in detail.
!     def taxonomy
!       query = <<-END
!         select full_lineage, common_name, ncbi_taxa_id
!         from bioentry_taxa, taxa
!         where bioentry_id = ? and bioentry_taxa.taxa_id = taxa.taxa_id
!       END
!       row = @dbh.execute(query, @bioentry_id).fetch
!       @lineage = row ? row['full_lineage'] : ''
!       @common_name = row ? row['common_name'] : ''
!       @ncbi_taxa_id = row ? row['ncbi_taxa_id'] : ''
!       row ? [@lineage, @common_name, @ncbi_taxa_id] : []
!     end
  
!     def lineage
!       taxonomy unless @lineage
!       return @lineage
!     end
  
!     def common_name
!       taxonomy unless @common_name
!       return @common_name
!     end
  
+     def ncbi_taxa_id
+       taxonomy unless @ncbi_taxa_id
+       return @ncbi_taxa_id
+     end
  
  
!     private
  
!     def feature_key(k_id)
!       query = "select * from seqfeature_key where seqfeature_key_id = ?"
!       row = @dbh.execute(query, k_id).fetch
!       row ? row['key_name'] : ''
!     end
  
!     def feature_source(s_id)
!       query = "select * from seqfeature_source where seqfeature_source_id = ?"
!       row = @dbh.execute(query, s_id).fetch
!       row ? row['source_name'] : ''
!     end
  
!     def feature_locations(f_id)
!       locations = []
!       query = "select * from seqfeature_location where seqfeature_id = ?"
!       @dbh.execute(query, f_id).fetch_all.each do |row|
!         next unless row
  
!         location = Bio::Location.new
!         location.strand = row['seq_strand']
!         location.from = row['seq_start']
!         location.to = row['seq_end']
  
!         xref = feature_locations_remote(row['seqfeature_location_id'])
!         location.xref_id = xref.shift unless xref.empty?
  
!         # just omit fuzzy location for now...
!         #feature_locations_qv(row['seqfeature_location_id'])
  
!         rank = row['location_rank'].to_i - 1
!         locations[rank] = location
        end
+       return Bio::Locations.new(locations)
+     end
  
!     def feature_locations_remote(l_id)
!       query = "select * from remote_seqfeature_name where seqfeature_location_id = ?"
!       row = @dbh.execute(query, l_id).fetch
!       row ? [row['accession'], row['version']] : []
!     end
  
!     def feature_locations_qv(l_id)
!       query = "select * from location_qualifier_value where seqfeature_location_id = ?"
!       row = @dbh.execute(query, l_id).fetch
!       row ? [row['qualifier_value'], row['slot_value']] : []
!     end
  
!     def feature_qualifiers(f_id)
!       qualifiers = []
!       query = "select * from seqfeature_qualifier_value where seqfeature_id = ?"
!       @dbh.execute(query, f_id).fetch_all.each do |row|
!         next unless row
  
!         key = feature_qualifiers_key(row['seqfeature_qualifier_id'])
!         value = row['qualifier_value']
!         qualifier = Bio::Feature::Qualifier.new(key, value)
  
!         rank = row['seqfeature_qualifier_rank'].to_i - 1
!         qualifiers[rank] = qualifier
        end
+       return qualifiers.compact	# .compact is nasty hack for a while
      end
  
+     def feature_qualifiers_key(q_id)
+       query = "select * from seqfeature_qualifier where seqfeature_qualifier_id = ?"
+       row = @dbh.execute(query, q_id).fetch
+       row ? row['qualifier_name'] : ''
+     end
    end
  
! end # SQL
! 
! end # Bio
  
  
***************
*** 365,428 ****
  end
  
- 
- =begin
- 
- = Bio::SQL
- 
- --- Bio::SQL.new(db = 'dbi:Mysql:biosql', user = nil, pass = nil)
- 
- --- Bio::SQL.close
- 
- --- Bio::SQL#fetch(accession)
- 
-       Returns Bio::SQL::Sequence object.
- 
- == Bio::SQL::Sequence
- 
- --- Bio::SQL::Sequence.new(dbh, entry)
- 
- --- Bio::SQL::Sequence#accession -> String
- --- Bio::SQL::Sequence#comment -> String
- 
-       Returns the first comment.  For complete comments, use comments method.
- 
- --- Bio::SQL::Sequence#comments -> Array
- 
-       Returns comments in an Array of Strings.
- 
- --- Bio::SQL::Sequence#common_name -> String
- --- Bio::SQL::Sequence#database -> String
- --- Bio::SQL::Sequence#date -> String
- --- Bio::SQL::Sequence#dblink -> Array
- --- Bio::SQL::Sequence#definition -> String
- --- Bio::SQL::Sequence#division -> String
- --- Bio::SQL::Sequence#entry_id -> String
- 
- --- Bio::SQL::Sequence#features
- 
-       Returns Bio::Features object.
- 
- --- Bio::SQL::Sequence#keyword -> String
- --- Bio::SQL::Sequence#lineage -> String
- --- Bio::SQL::Sequence#ncbi_taxa_id -> String
- 
- --- Bio::SQL::Sequence#references -> Array
- 
-       Returns reference informations in Array of Hash (not Bio::Reference).
- 
- --- Bio::SQL::Sequence#seq
- 
-       Returns Bio::Sequence::NA or AA object.
- 
- --- Bio::SQL::Sequence#subseq(from, to)
- 
-       Returns Bio::Sequence::NA or AA object (by lazy fetching).
- 
- --- Bio::SQL::Sequence#taxonomy -> DBI::Row
- 
-       Use lineage, common_name, ncbi_taxa_id methods to extract in detail.
- 
- --- Bio::SQL::Sequence#version -> String
- 
- =end
- 
--- 360,361 ----


From k at dev.open-bio.org  Tue Sep 19 01:50:47 2006
From: k at dev.open-bio.org (Katayama Toshiaki)
Date: Tue, 19 Sep 2006 05:50:47 +0000
Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg brite.rb,0.6,0.7
Message-ID: <200609190550.k8J5ol6R031669@dev.open-bio.org>

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

Modified Files:
	brite.rb 
Log Message:
* license is changed from LGPL to Ruby's


Index: brite.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/brite.rb,v
retrieving revision 0.6
retrieving revision 0.7
diff -C2 -d -r0.6 -r0.7
*** brite.rb	8 Sep 2005 01:22:11 -0000	0.6
--- brite.rb	19 Sep 2006 05:50:45 -0000	0.7
***************
*** 1,22 ****
  #
! # bio/db/kegg/brite.rb - KEGG/BRITE database class
! #
! #   Copyright (C) 2001 KATAYAMA Toshiaki 
! #
! #  This library is free software; you can redistribute it and/or
! #  modify it under the terms of the GNU Lesser General Public
! #  License as published by the Free Software Foundation; either
! #  version 2 of the License, or (at your option) any later version.
! #
! #  This library is distributed in the hope that it will be useful,
! #  but WITHOUT ANY WARRANTY; without even the implied warranty of
! #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
! #  Lesser General Public License for more details.
  #
! #  You should have received a copy of the GNU Lesser General Public
! #  License along with this library; if not, write to the Free Software
! #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  #
! #  $Id$
  #
  
--- 1,9 ----
  #
! # = bio/db/kegg/brite.rb - KEGG/BRITE database class
  #
! # Copyright::  Copyright (C) 2001 Toshiaki Katayama 
! # License::    Ruby's
  #
! # $Id$
  #
  
***************
*** 24,51 ****
  
  module Bio
  
!   class KEGG
! 
!     class BRITE < KEGGDB
! 
!       DELIMITER	= RS = "\n///\n"
!       TAGSIZE	= 12
  
!       def initialize(entry)
!         super(entry, TAGSIZE)
!       end
  
!       # ENTRY
!       # DEFINITION
!       # RELATION
!       # FACTORS
!       # INTERACTION
!       # SOURCE
!       # REFERENCE
  
!     end
  
!   end
  
! end
  
--- 11,41 ----
  
  module Bio
+ class KEGG
  
! # == Note
! #
! # This class is not completely implemented, but obsolete as the original
! # database BRITE has changed it's meaning.
! #
! class BRITE < KEGGDB
  
!   DELIMITER	= RS = "\n///\n"
!   TAGSIZE	= 12
  
!   def initialize(entry)
!     super(entry, TAGSIZE)
!   end
  
!   # ENTRY
!   # DEFINITION
!   # RELATION
!   # FACTORS
!   # INTERACTION
!   # SOURCE
!   # REFERENCE
  
! end # BRITE
  
! end # KEGG
! end # Bio
  


From k at dev.open-bio.org  Tue Sep 19 01:51:31 2006
From: k at dev.open-bio.org (Katayama Toshiaki)
Date: Tue, 19 Sep 2006 05:51:31 +0000
Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg compound.rb,0.11,0.12
Message-ID: <200609190551.k8J5pVOi031729@dev.open-bio.org>

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

Modified Files:
	compound.rb 
Log Message:
* license is changed from LGPL to Ruby's


Index: compound.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/compound.rb,v
retrieving revision 0.11
retrieving revision 0.12
diff -C2 -d -r0.11 -r0.12
*** compound.rb	8 Sep 2005 01:22:11 -0000	0.11
--- compound.rb	19 Sep 2006 05:51:29 -0000	0.12
***************
*** 1,22 ****
  #
! # bio/db/kegg/compound.rb - KEGG COMPOUND database class
! #
! #   Copyright (C) 2001, 2002, 2004 KATAYAMA Toshiaki 
! #
! #  This library is free software; you can redistribute it and/or
! #  modify it under the terms of the GNU Lesser General Public
! #  License as published by the Free Software Foundation; either
! #  version 2 of the License, or (at your option) any later version.
! #
! #  This library is distributed in the hope that it will be useful,
! #  but WITHOUT ANY WARRANTY; without even the implied warranty of
! #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
! #  Lesser General Public License for more details.
  #
! #  You should have received a copy of the GNU Lesser General Public
! #  License along with this library; if not, write to the Free Software
! #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  #
! #  $Id$
  #
  
--- 1,9 ----
  #
! # = bio/db/kegg/compound.rb - KEGG COMPOUND database class
  #
! # Copyright::  Copyright (C) 2001, 2002, 2004 Toshiaki Katayama 
! # License::    Ruby's
  #
! # $Id$
  #
  
***************
*** 24,114 ****
  
  module Bio
  
!   class KEGG
! 
!     class COMPOUND < KEGGDB
! 
!       DELIMITER	= RS = "\n///\n"
!       TAGSIZE	= 12
! 
!       def initialize(entry)
!         super(entry, TAGSIZE)
!       end
  
!       # ENTRY
!       def entry_id
!         unless @data['ENTRY']
!           @data['ENTRY'] = fetch('ENTRY').split(/\s+/).first
!         end
!         @data['ENTRY']
!       end
  
!       # NAME
!       def names
!         lines_fetch('NAME') 
!       end
!       def name
!         names[0]
!       end
  
!       # FORMULA
!       def formula
!         field_fetch('FORMULA')
!       end
  
!       # MASS
!       def mass
!         field_fetch('MASS').to_f
!       end
  
!       # REACTION
!       def reactions
!         unless @data['REACTION']
!           @data['REACTION'] = fetch('REACTION').split(/\s+/)
!         end
!         @data['REACTION']
!       end
  
!       # RPAIR
!       def rpairs
!         unless @data['RPAIR']
!           @data['RPAIR'] = fetch('RPAIR').split(/\s+/)
!         end
!         @data['RPAIR']
!       end
  
!       # PATHWAY
!       def pathways
!         lines_fetch('PATHWAY') 
!       end
  
!       # ENZYME
!       def enzymes
!         unless @data['ENZYME']
!           field = fetch('ENZYME')
!           if /\(/.match(field)	# old version
!             @data['ENZYME'] = field.scan(/\S+ \(\S+\)/)
!           else
!             @data['ENZYME'] = field.scan(/\S+/)
!           end
!         end
!         @data['ENZYME']
!       end
  
!       # DBLINKS
!       def dblinks
!         lines_fetch('DBLINKS')
!       end
  
!       # ATOM, BOND
!       def kcf
!         return "#{get('ATOM')}#{get('BOND')}"
        end
- 
      end
  
    end
  
! end
  
  
--- 11,99 ----
  
  module Bio
+ class KEGG
  
! class COMPOUND < KEGGDB
  
!   DELIMITER	= RS = "\n///\n"
!   TAGSIZE	= 12
  
!   def initialize(entry)
!     super(entry, TAGSIZE)
!   end
  
!   # ENTRY
!   def entry_id
!     unless @data['ENTRY']
!       @data['ENTRY'] = fetch('ENTRY').split(/\s+/).first
!     end
!     @data['ENTRY']
!   end
  
!   # NAME
!   def names
!     lines_fetch('NAME') 
!   end
!   def name
!     names[0]
!   end
  
!   # FORMULA
!   def formula
!     field_fetch('FORMULA')
!   end
  
!   # MASS
!   def mass
!     field_fetch('MASS').to_f
!   end
  
!   # REACTION
!   def reactions
!     unless @data['REACTION']
!       @data['REACTION'] = fetch('REACTION').split(/\s+/)
!     end
!     @data['REACTION']
!   end
  
!   # RPAIR
!   def rpairs
!     unless @data['RPAIR']
!       @data['RPAIR'] = fetch('RPAIR').split(/\s+/)
!     end
!     @data['RPAIR']
!   end
  
!   # PATHWAY
!   def pathways
!     lines_fetch('PATHWAY') 
!   end
  
!   # ENZYME
!   def enzymes
!     unless @data['ENZYME']
!       field = fetch('ENZYME')
!       if /\(/.match(field)	# old version
!         @data['ENZYME'] = field.scan(/\S+ \(\S+\)/)
!       else
!         @data['ENZYME'] = field.scan(/\S+/)
        end
      end
+     @data['ENZYME']
+   end
+ 
+   # DBLINKS
+   def dblinks
+     lines_fetch('DBLINKS')
+   end
  
+   # ATOM, BOND
+   def kcf
+     return "#{get('ATOM')}#{get('BOND')}"
    end
  
! end # COMPOUND
! 
! end # KEGG
! end # Bio
  
  


From k at dev.open-bio.org  Tue Sep 19 01:52:07 2006
From: k at dev.open-bio.org (Katayama Toshiaki)
Date: Tue, 19 Sep 2006 05:52:07 +0000
Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg enzyme.rb,0.8,0.9
Message-ID: <200609190552.k8J5q73d031772@dev.open-bio.org>

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

Modified Files:
	enzyme.rb 
Log Message:
* license is changed from LGPL to Ruby's


Index: enzyme.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/enzyme.rb,v
retrieving revision 0.8
retrieving revision 0.9
diff -C2 -d -r0.8 -r0.9
*** enzyme.rb	8 Sep 2005 01:22:11 -0000	0.8
--- enzyme.rb	19 Sep 2006 05:52:05 -0000	0.9
***************
*** 1,22 ****
  #
! # bio/db/kegg/enzyme.rb - KEGG/ENZYME database class
! #
! #   Copyright (C) 2001, 2002 KATAYAMA Toshiaki 
! #
! #  This library is free software; you can redistribute it and/or
! #  modify it under the terms of the GNU Lesser General Public
! #  License as published by the Free Software Foundation; either
! #  version 2 of the License, or (at your option) any later version.
! #
! #  This library is distributed in the hope that it will be useful,
! #  but WITHOUT ANY WARRANTY; without even the implied warranty of
! #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
! #  Lesser General Public License for more details.
  #
! #  You should have received a copy of the GNU Lesser General Public
! #  License along with this library; if not, write to the Free Software
! #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  #
! #  $Id$
  #
  
--- 1,9 ----
  #
! # = bio/db/kegg/enzyme.rb - KEGG/ENZYME database class
  #
! # Copyright::  Copyright (C) 2001, 2002 Toshiaki Katayama 
! # License::    Ruby's
  #
! # $Id$
  #
  
***************
*** 24,125 ****
  
  module Bio
  
!   class KEGG
! 
!     class ENZYME < KEGGDB
! 
!       DELIMITER	= RS = "\n///\n"
!       TAGSIZE	= 12
! 
!       def initialize(entry)
!         super(entry, TAGSIZE)
!       end
  
!       # ENTRY
!       def entry_id
!         field_fetch('ENTRY')
!       end
  
!       # NAME
!       def names
!         lines_fetch('NAME')
!       end
!       def name
!         names[0]
!       end
  
!       # CLASS
!       def classes
!         lines_fetch('CLASS')
!       end
  
!       # SYSNAME
!       def sysname
!         field_fetch('SYSNAME')
!       end
  
!       # REACTION ';'
!       def reaction
!         field_fetch('REACTION')
!       end
!       
!       # SUBSTRATE
!       def substrates
!         lines_fetch('SUBSTRATE')
!       end
  
!       # PRODUCT
!       def products
!         lines_fetch('PRODUCT')
!       end
  
!       # COFACTOR
!       def cofactors
!         lines_fetch('COFACTOR')
!       end
  
!       # COMMENT
!       def comment
!         field_fetch('COMMENT')
!       end
  
!       # PATHWAY
!       def pathways
!         lines_fetch('PATHWAY')
!       end
  
!       # GENES
!       def genes
!         lines_fetch('GENES')
!       end
  
!       # DISEASE
!       def diseases
!         lines_fetch('DISEASE')
!       end
  
!       # MOTIF
!       def motifs
!         lines_fetch('MOTIF')
!       end
  
!       # STRUCTURES
!       def structures
!         unless @data['STRUCTURES']
!           @data['STRUCTURES'] =
!             fetch('STRUCTURES').sub(/(PDB: )*/,'').split(/\s+/)
!         end
!         @data['STRUCTURES']
!       end
  
!       # DBLINKS
!       def dblinks
!         lines_fetch('DBLINKS')
!       end
  
      end
  
    end
  
! end
  
--- 11,110 ----
  
  module Bio
+ class KEGG
  
! class ENZYME < KEGGDB
  
!   DELIMITER	= RS = "\n///\n"
!   TAGSIZE	= 12
  
!   def initialize(entry)
!     super(entry, TAGSIZE)
!   end
  
!   # ENTRY
!   def entry_id
!     field_fetch('ENTRY')
!   end
  
!   # NAME
!   def names
!     lines_fetch('NAME')
!   end
!   def name
!     names[0]
!   end
  
!   # CLASS
!   def classes
!     lines_fetch('CLASS')
!   end
  
!   # SYSNAME
!   def sysname
!     field_fetch('SYSNAME')
!   end
  
!   # REACTION ';'
!   def reaction
!     field_fetch('REACTION')
!   end
!   
!   # SUBSTRATE
!   def substrates
!     lines_fetch('SUBSTRATE')
!   end
  
!   # PRODUCT
!   def products
!     lines_fetch('PRODUCT')
!   end
  
!   # COFACTOR
!   def cofactors
!     lines_fetch('COFACTOR')
!   end
  
!   # COMMENT
!   def comment
!     field_fetch('COMMENT')
!   end
  
!   # PATHWAY
!   def pathways
!     lines_fetch('PATHWAY')
!   end
  
!   # GENES
!   def genes
!     lines_fetch('GENES')
!   end
  
!   # DISEASE
!   def diseases
!     lines_fetch('DISEASE')
!   end
  
!   # MOTIF
!   def motifs
!     lines_fetch('MOTIF')
!   end
  
+   # STRUCTURES
+   def structures
+     unless @data['STRUCTURES']
+       @data['STRUCTURES'] =
+         fetch('STRUCTURES').sub(/(PDB: )*/,'').split(/\s+/)
      end
+     @data['STRUCTURES']
+   end
  
+   # DBLINKS
+   def dblinks
+     lines_fetch('DBLINKS')
    end
  
! end # ENZYME
! 
! end # KEGG
! end # Bio
  


From k at dev.open-bio.org  Tue Sep 19 01:52:47 2006
From: k at dev.open-bio.org (Katayama Toshiaki)
Date: Tue, 19 Sep 2006 05:52:47 +0000
Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg genome.rb,0.14,0.15
Message-ID: <200609190552.k8J5qlIc031815@dev.open-bio.org>

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

Modified Files:
	genome.rb 
Log Message:
* license is changed from LGPL to Ruby's
* document is changed to RDoc


Index: genome.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/genome.rb,v
retrieving revision 0.14
retrieving revision 0.15
diff -C2 -d -r0.14 -r0.15
*** genome.rb	8 Sep 2005 01:22:11 -0000	0.14
--- genome.rb	19 Sep 2006 05:52:45 -0000	0.15
***************
*** 1,22 ****
  #
! # bio/db/kegg/genome.rb - KEGG/GENOME database class
! #
! #   Copyright (C) 2001, 2002 KATAYAMA Toshiaki 
! #
! #  This library is free software; you can redistribute it and/or
! #  modify it under the terms of the GNU Lesser General Public
! #  License as published by the Free Software Foundation; either
! #  version 2 of the License, or (at your option) any later version.
! #
! #  This library is distributed in the hope that it will be useful,
! #  but WITHOUT ANY WARRANTY; without even the implied warranty of
! #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
! #  Lesser General Public License for more details.
  #
! #  You should have received a copy of the GNU Lesser General Public
! #  License along with this library; if not, write to the Free Software
! #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  #
! #  $Id$
  #
  
--- 1,9 ----
  #
! # = bio/db/kegg/genome.rb - KEGG/GENOME database class
  #
! # Copyright::  Copyright (C) 2001, 2002 Toshiaki Katayama 
! # License::    Ruby's
  #
! # $Id$
  #
  
***************
*** 24,213 ****
  
  module Bio
  
!   class KEGG
! 
!     class GENOME < KEGGDB
  
!       DELIMITER	= RS = "\n///\n"
!       TAGSIZE	= 12
  
!       def initialize(entry)
!         super(entry, TAGSIZE)
!       end
  
  
!       # ENTRY
!       def entry_id
!         field_fetch('ENTRY')
!       end
!       
!       # NAME
!       def name
!         field_fetch('NAME')
!       end
  
!       # DEFINITION
!       def definition
!         field_fetch('DEFINITION')
!       end
!       alias organism definition
  
!       # TAXONOMY
!       def taxonomy
!         unless @data['TAXONOMY']
!           taxid, lineage = subtag2array(get('TAXONOMY'))
!           taxid   = taxid   ? truncate(tag_cut(taxid))   : ''
!           lineage = lineage ? truncate(tag_cut(lineage)) : ''
!           @data['TAXONOMY'] = {
!             'taxid'	=> taxid,
!             'lineage'	=> lineage,
!           }
!           @data['TAXONOMY'].default = ''
!         end
!         @data['TAXONOMY']
!       end
  
!       def taxid
!         taxonomy['taxid']
!       end
  
!       def lineage
!         taxonomy['lineage']
!       end
  
!       # COMMENT
!       def comment
!         field_fetch('COMMENT')
!       end
!       
!       # REFERENCE
!       def references
!         unless @data['REFERENCE']
!           ary = []
!           toptag2array(get('REFERENCE')).each do |ref|
!             hash = Hash.new('')
!             subtag2array(ref).each do |field|
!               case tag_get(field)
!               when /AUTHORS/
!                 authors = truncate(tag_cut(field))
!                 authors = authors.split(', ')
!                 authors[-1] = authors[-1].split(/\s+and\s+/)
!                 authors = authors.flatten.map { |a| a.sub(',', ', ') }
!                 hash['authors']	= authors
!               when /TITLE/
!                 hash['title']	= truncate(tag_cut(field))
!               when /JOURNAL/
!                 journal = truncate(tag_cut(field))
!                 if journal =~ /(.*) (\d+):(\d+)-(\d+) \((\d+)\) \[UI:(\d+)\]$/
!                   hash['journal']	= $1
!                   hash['volume']	= $2
!                   hash['pages']		= $3
!                   hash['year']		= $5
!                   hash['medline']	= $6
!                 else
!                   hash['journal'] = journal
!                 end
!               end
              end
-             ary.push(Reference.new(hash))
            end
-           @data['REFERENCE'] = References.new(ary)
          end
!         @data['REFERENCE']
        end
  
!       # CHROMOSOME
!       def chromosomes
!         unless @data['CHROMOSOME']
!           @data['CHROMOSOME'] = []
!           toptag2array(get('CHROMOSOME')).each do |chr|
!             hash = Hash.new('')
!             subtag2array(chr).each do |field|
!               hash[tag_get(field)] = truncate(tag_cut(field))
!             end
!             @data['CHROMOSOME'].push(hash)
!           end
          end
!         @data['CHROMOSOME']
        end
  
!       # PLASMID
!       def plasmids
!         unless @data['PLASMID']
!           @data['PLASMID'] = []
!           toptag2array(get('PLASMID')).each do |chr|
!             hash = Hash.new('')
!             subtag2array(chr).each do |field|
!               hash[tag_get(field)] = truncate(tag_cut(field))
!             end
!             @data['PLASMID'].push(hash)
!           end
          end
!         @data['PLASMID']
        end
  
!       # SCAFFOLD
!       def scaffolds
!         unless @data['SCAFFOLD']
!           @data['SCAFFOLD'] = []
!           toptag2array(get('SCAFFOLD')).each do |chr|
!             hash = Hash.new('')
!             subtag2array(chr).each do |field|
!               hash[tag_get(field)] = truncate(tag_cut(field))
!             end
!             @data['SCAFFOLD'].push(hash)
!           end
          end
!         @data['SCAFFOLD']
        end
  
!       # STATISTICS
!       def statistics
!         unless @data['STATISTICS']
!           hash = Hash.new(0.0)
!           get('STATISTICS').each_line do |line|
!             case line
!             when /nucleotides:\s+(\d+)/
!               hash['nalen'] = $1.to_i
!             when /protein genes:\s+(\d+)/
!               hash['num_gene'] = $1.to_i
!             when /RNA genes:\s+(\d+)/
!               hash['num_rna'] = $1.to_i
!             when /G\+C content:\s+(\d+.\d+)/
!               hash['gc'] = $1.to_f
!             end
!           end
!           @data['STATISTICS'] = hash
          end
-         @data['STATISTICS']
-       end
- 
-       def nalen
-         statistics['nalen']
        end
!       alias length nalen
  
!       def num_gene
!         statistics['num_gene']
!       end
  
!       def num_rna
!         statistics['num_rna']
!       end
  
!       def gc
!         statistics['gc']
!       end
  
!       # GENOMEMAP
!       def genomemap
!         field_fetch('GENOMEMAP')
!       end
  
!     end
!     
    end
  
! end
  
  
--- 11,214 ----
  
  module Bio
+ class KEGG
  
! # == Description
! #
! # Parser for the KEGG GENOME database
! #
! # == References
! #
! # * ftp://ftp.genome.jp/pub/kegg/genomes/genome
! #
! class GENOME < KEGGDB
  
!   DELIMITER	= RS = "\n///\n"
!   TAGSIZE	= 12
  
!   def initialize(entry)
!     super(entry, TAGSIZE)
!   end
  
  
!   # ENTRY -- Returns contents of the ENTRY record as a String.
!   def entry_id
!     field_fetch('ENTRY')
!   end
!   
!   # NAME -- Returns contents of the NAME record as a String.
!   def name
!     field_fetch('NAME')
!   end
  
!   # DEFINITION -- Returns contents of the DEFINITION record as a String.
!   def definition
!     field_fetch('DEFINITION')
!   end
!   alias organism definition
  
!   # TAXONOMY -- Returns contents of the TAXONOMY record as a Hash.
!   def taxonomy
!     unless @data['TAXONOMY']
!       taxid, lineage = subtag2array(get('TAXONOMY'))
!       taxid   = taxid   ? truncate(tag_cut(taxid))   : ''
!       lineage = lineage ? truncate(tag_cut(lineage)) : ''
!       @data['TAXONOMY'] = {
!         'taxid'	=> taxid,
!         'lineage'	=> lineage,
!       }
!       @data['TAXONOMY'].default = ''
!     end
!     @data['TAXONOMY']
!   end
  
!   # Returns NCBI taxonomy ID from the TAXONOMY record as a String.
!   def taxid
!     taxonomy['taxid']
!   end
  
!   # Returns contents of the TAXONOMY/LINEAGE record as a String.
!   def lineage
!     taxonomy['lineage']
!   end
  
!   # COMMENT -- Returns contents of the COMMENT record as a String.
!   def comment
!     field_fetch('COMMENT')
!   end
!   
!   # REFERENCE -- Returns contents of the REFERENCE records as an Array of
!   # Bio::Reference objects.
!   def references
!     unless @data['REFERENCE']
!       ary = []
!       toptag2array(get('REFERENCE')).each do |ref|
!         hash = Hash.new('')
!         subtag2array(ref).each do |field|
!           case tag_get(field)
!           when /AUTHORS/
!             authors = truncate(tag_cut(field))
!             authors = authors.split(', ')
!             authors[-1] = authors[-1].split(/\s+and\s+/)
!             authors = authors.flatten.map { |a| a.sub(',', ', ') }
!             hash['authors']	= authors
!           when /TITLE/
!             hash['title']	= truncate(tag_cut(field))
!           when /JOURNAL/
!             journal = truncate(tag_cut(field))
!             if journal =~ /(.*) (\d+):(\d+)-(\d+) \((\d+)\) \[UI:(\d+)\]$/
!               hash['journal']	= $1
!               hash['volume']	= $2
!               hash['pages']		= $3
!               hash['year']		= $5
!               hash['medline']	= $6
!             else
!               hash['journal'] = journal
              end
            end
          end
!         ary.push(Reference.new(hash))
        end
+       @data['REFERENCE'] = References.new(ary)
+     end
+     @data['REFERENCE']
+   end
  
!   # CHROMOSOME -- Returns contents of the CHROMOSOME records as an Array
!   # of Hash.
!   def chromosomes
!     unless @data['CHROMOSOME']
!       @data['CHROMOSOME'] = []
!       toptag2array(get('CHROMOSOME')).each do |chr|
!         hash = Hash.new('')
!         subtag2array(chr).each do |field|
!           hash[tag_get(field)] = truncate(tag_cut(field))
          end
!         @data['CHROMOSOME'].push(hash)
        end
+     end
+     @data['CHROMOSOME']
+   end
  
!   # PLASMID -- Returns contents of the PLASMID records as an Array of Hash.
!   def plasmids
!     unless @data['PLASMID']
!       @data['PLASMID'] = []
!       toptag2array(get('PLASMID')).each do |chr|
!         hash = Hash.new('')
!         subtag2array(chr).each do |field|
!           hash[tag_get(field)] = truncate(tag_cut(field))
          end
!         @data['PLASMID'].push(hash)
        end
+     end
+     @data['PLASMID']
+   end
  
!   # SCAFFOLD -- Returns contents of the SCAFFOLD records as an Array of Hash.
!   def scaffolds
!     unless @data['SCAFFOLD']
!       @data['SCAFFOLD'] = []
!       toptag2array(get('SCAFFOLD')).each do |chr|
!         hash = Hash.new('')
!         subtag2array(chr).each do |field|
!           hash[tag_get(field)] = truncate(tag_cut(field))
          end
!         @data['SCAFFOLD'].push(hash)
        end
+     end
+     @data['SCAFFOLD']
+   end
  
!   # STATISTICS -- Returns contents of the STATISTICS record as a Hash.
!   def statistics
!     unless @data['STATISTICS']
!       hash = Hash.new(0.0)
!       get('STATISTICS').each_line do |line|
!         case line
!         when /nucleotides:\s+(\d+)/
!           hash['nalen'] = $1.to_i
!         when /protein genes:\s+(\d+)/
!           hash['num_gene'] = $1.to_i
!         when /RNA genes:\s+(\d+)/
!           hash['num_rna'] = $1.to_i
!         when /G\+C content:\s+(\d+.\d+)/
!           hash['gc'] = $1.to_f
          end
        end
!       @data['STATISTICS'] = hash
!     end
!     @data['STATISTICS']
!   end
  
!   # Returns number of nucleotides from the STATISTICS record as a Fixnum.
!   def nalen
!     statistics['nalen']
!   end
!   alias length nalen
  
!   # Returns number of protein genes from the STATISTICS record as a Fixnum.
!   def num_gene
!     statistics['num_gene']
!   end
  
!   # Returns number of rna from the STATISTICS record as a Fixnum.
!   def num_rna
!     statistics['num_rna']
!   end
  
!   # Returns G+C content from the STATISTICS record as a Float.
!   def gc
!     statistics['gc']
!   end
  
!   # GENOMEMAP -- Returns contents of the GENOMEMAP record as a String.
!   def genomemap
!     field_fetch('GENOMEMAP')
    end
  
! end # GENOME
!     
! end # KEGG
! end # Bio
  
  
***************
*** 253,362 ****
  
  
- =begin
- 
- = Bio::KEGG::GENOME
- 
- === Initialize
- 
- --- Bio::KEGG::GENOME.new(entry)
- 
- === ENTRY
- 
- --- Bio::KEGG::GENOME#entry_id -> String
- 
-       Returns contents of the ENTRY record as a String.
- 
- === NAME
- 
- --- Bio::KEGG::GENOME#name -> String
- 
-       Returns contents of the NAME record as a String.
- 
- === DEFINITION
- 
- --- Bio::KEGG::GENOME#definition -> String
- 
-       Returns contents of the DEFINITION record as a String.
- 
- --- Bio::KEGG::GENOME#organism -> String
- 
-       Alias for the 'definition' method.
- 
- === TAXONOMY
- 
- --- Bio::KEGG::GENOME#taxonomy -> Hash
- 
-       Returns contents of the TAXONOMY record as a Hash.
- 
- --- Bio::KEGG::GENOME#taxid -> String
- 
-       Returns NCBI taxonomy ID from the TAXONOMY record as a String.
- 
- --- Bio::KEGG::GENOME#lineage -> String
- 
-       Returns contents of the TAXONOMY/LINEAGE record as a String.
- 
- === COMMENT
- 
- --- Bio::KEGG::GENOME#comment -> String
- 
-       Returns contents of the COMMENT record as a String.
- 
- === REFERENCE
- 
- --- Bio::GenBank#references -> Array
- 
-       Returns contents of the REFERENCE records as an Array of Bio::Reference
-       objects.
- 
- === CHROMOSOME
- 
- --- Bio::KEGG::GENOME#chromosomes -> Array
- 
-       Returns contents of the CHROMOSOME records as an Array of Hash.
- 
- === PLASMID
- 
- --- Bio::KEGG::GENOME#plasmids -> Array
- 
-       Returns contents of the PLASMID records as an Array of Hash.
- 
- === SCAFFOLD
- 
- --- Bio::KEGG::GENOME#scaffolds -> Array
- 
-       Returns contents of the SCAFFOLD records as an Array of Hash.
- 
- === STATISTICS
- 
- --- Bio::KEGG::GENOME#statistics -> Hash
- 
-       Returns contents of the STATISTICS record as a Hash.
- 
- --- Bio::KEGG::GENOME#nalen -> Fixnum
- 
-       Returns number of nucleotides from the STATISTICS record as a Fixnum.
- 
- --- Bio::KEGG::GENOME#num_gene -> Fixnum
- 
-       Returns number of protein genes from the STATISTICS record as a Fixnum.
- 
- --- Bio::KEGG::GENOME#num_rna -> Fixnum
- 
-       Returns number of rna from the STATISTICS record as a Fixnum.
- 
- --- Bio::KEGG::GENOME#gc -> Float
- 
-       Returns G+C content from the STATISTICS record as a Float.
- 
- === GENOMEMAP
- 
- --- Bio::KEGG::GENOME#genomemap -> String
- 
-       Returns contents of the GENOMEMAP record as a String.
- 
- == SEE ALSO
- 
-   ftp://ftp.genome.jp/pub/kegg/genomes/genome
- 
- =end
--- 254,255 ----


From k at dev.open-bio.org  Tue Sep 19 01:53:15 2006
From: k at dev.open-bio.org (Katayama Toshiaki)
Date: Tue, 19 Sep 2006 05:53:15 +0000
Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg glycan.rb,1.2,1.3
Message-ID: <200609190553.k8J5rF4d031858@dev.open-bio.org>

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

Modified Files:
	glycan.rb 
Log Message:
* license is changed from LGPL to Ruby's


Index: glycan.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/glycan.rb,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** glycan.rb	8 Sep 2005 01:22:11 -0000	1.2
--- glycan.rb	19 Sep 2006 05:53:13 -0000	1.3
***************
*** 1,22 ****
  #
! # bio/db/kegg/glycan.rb - KEGG GLYCAN database class
! #
! #   Copyright (C) 2004 KATAYAMA Toshiaki 
! #
! #  This library is free software; you can redistribute it and/or
! #  modify it under the terms of the GNU Lesser General Public
! #  License as published by the Free Software Foundation; either
! #  version 2 of the License, or (at your option) any later version.
! #
! #  This library is distributed in the hope that it will be useful,
! #  but WITHOUT ANY WARRANTY; without even the implied warranty of
! #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
! #  Lesser General Public License for more details.
  #
! #  You should have received a copy of the GNU Lesser General Public
! #  License along with this library; if not, write to the Free Software
! #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  #
! #  $Id$
  #
  
--- 1,9 ----
  #
! # = bio/db/kegg/glycan.rb - KEGG GLYCAN database class
  #
! # Copyright::  Copyright (C) 2004 Toshiaki Katayama 
! # License::    Ruby's
  #
! # $Id$
  #
  
***************
*** 24,193 ****
  
  module Bio
  
!   class KEGG
! 
!     class GLYCAN < KEGGDB
  
!       DELIMITER	= RS = "\n///\n"
!       TAGSIZE	= 12
  
!       def initialize(entry)
!         super(entry, TAGSIZE)
!       end
  
!       # ENTRY
!       def entry_id
!         unless @data['ENTRY']
!           @data['ENTRY'] = fetch('ENTRY').split(/\s+/).first
!         end
!         @data['ENTRY']
!       end
  
!       # NAME
!       def name
!         field_fetch('NAME') 
!       end
  
!       # COMPOSITION
!       def composition
!         unless @data['COMPOSITION']
!           hash = Hash.new(0)
!           fetch('COMPOSITION').scan(/\((\S+)\)(\d+)/).each do |key, val|
!             hash[key] = val.to_i
!           end
!           @data['COMPOSITION'] = hash
!         end
!         @data['COMPOSITION']
        end
  
!       # MASS
!       def mass
!         unless @data['MASS']
!           hash = Hash.new
!           fetch('MASS').scan(/(\S+)\s+\((\S+)\)/).each do |val, key|
!             hash[key] = val.to_f
!           end
!           @data['MASS'] = hash
!         end
!         @data['MASS']
        end
  
!       # CLASS
!       def keggclass
!         field_fetch('CLASS') 
!       end
  
!       # BINDING
!       def bindings
!         unless @data['BINDING']
!           ary = Array.new
!           lines = lines_fetch('BINDING')
!           lines.each do |line|
!             if /^\S/.match(line)
!               ary << line
!             else
!               ary.last << " #{line.strip}"
!             end
!           end
!           @data['BINDING'] = ary
          end
-         @data['BINDING']
        end
  
!       # COMPOUND
!       def compounds
!         unless @data['COMPOUND']
!           @data['COMPOUND'] = fetch('COMPOUND').split(/\s+/)
!         end
!         @data['COMPOUND']
!       end
  
!       # REACTION
!       def reactions
!         unless @data['REACTION']
!           @data['REACTION'] = fetch('REACTION').split(/\s+/)
!         end
!         @data['REACTION']
!       end
  
!       # PATHWAY
!       def pathways
!         lines_fetch('PATHWAY') 
!       end
  
!       # ENZYME
!       def enzymes
!         unless @data['ENZYME']
!           field = fetch('ENZYME')
!           if /\(/.match(field)	# old version
!             @data['ENZYME'] = field.scan(/\S+ \(\S+\)/)
!           else
!             @data['ENZYME'] = field.scan(/\S+/)
!           end
!         end
!         @data['ENZYME']
        end
  
!       # ORTHOLOG
!       def orthologs
!         unless @data['ORTHOLOG']
!           ary = Array.new
!           lines = lines_fetch('ORTHOLOG')
!           lines.each do |line|
!             if /^\S/.match(line)
!               ary << line
!             else
!               ary.last << " #{line.strip}"
!             end
!           end
!           @data['ORTHOLOG'] = ary
          end
-         @data['ORTHOLOG']
        end
  
!       # REFERENCE
!       def references
!         unless @data['REFERENCE']
!           ary = Array.new
!           lines = lines_fetch('REFERENCE')
!           lines.each do |line|
!             if /^\d+\s+\[PMID/.match(line)
!               ary << line
!             else
!               ary.last << " #{line.strip}"
!             end
!           end
!           @data['REFERENCE'] = ary
          end
-         @data['REFERENCE']
        end
  
!       # DBLINKS
!       def dblinks
!         unless @data['DBLINKS']
!           ary = Array.new
!           lines = lines_fetch('DBLINKS')
!           lines.each do |line|
!             if /^\S/.match(line)
!               ary << line
!             else
!               ary.last << " #{line.strip}"
!             end
!           end
!           @data['DBLINKS'] = ary
          end
-         @data['DBLINKS']
        end
! 
!       # ATOM, BOND
!       def kcf
!         return "#{get('NODE')}#{get('EDGE')}"
!       end
! 
      end
  
    end
  
! end
  
  
--- 11,178 ----
  
  module Bio
+ class KEGG
  
! class GLYCAN < KEGGDB
  
!   DELIMITER	= RS = "\n///\n"
!   TAGSIZE	= 12
  
!   def initialize(entry)
!     super(entry, TAGSIZE)
!   end
  
!   # ENTRY
!   def entry_id
!     unless @data['ENTRY']
!       @data['ENTRY'] = fetch('ENTRY').split(/\s+/).first
!     end
!     @data['ENTRY']
!   end
  
!   # NAME
!   def name
!     field_fetch('NAME') 
!   end
  
!   # COMPOSITION
!   def composition
!     unless @data['COMPOSITION']
!       hash = Hash.new(0)
!       fetch('COMPOSITION').scan(/\((\S+)\)(\d+)/).each do |key, val|
!         hash[key] = val.to_i
        end
+       @data['COMPOSITION'] = hash
+     end
+     @data['COMPOSITION']
+   end
  
!   # MASS
!   def mass
!     unless @data['MASS']
!       hash = Hash.new
!       fetch('MASS').scan(/(\S+)\s+\((\S+)\)/).each do |val, key|
!         hash[key] = val.to_f
        end
+       @data['MASS'] = hash
+     end
+     @data['MASS']
+   end
  
!   # CLASS
!   def keggclass
!     field_fetch('CLASS') 
!   end
  
!   # BINDING
!   def bindings
!     unless @data['BINDING']
!       ary = Array.new
!       lines = lines_fetch('BINDING')
!       lines.each do |line|
!         if /^\S/.match(line)
!           ary << line
!         else
!           ary.last << " #{line.strip}"
          end
        end
+       @data['BINDING'] = ary
+     end
+     @data['BINDING']
+   end
  
!   # COMPOUND
!   def compounds
!     unless @data['COMPOUND']
!       @data['COMPOUND'] = fetch('COMPOUND').split(/\s+/)
!     end
!     @data['COMPOUND']
!   end
  
!   # REACTION
!   def reactions
!     unless @data['REACTION']
!       @data['REACTION'] = fetch('REACTION').split(/\s+/)
!     end
!     @data['REACTION']
!   end
  
!   # PATHWAY
!   def pathways
!     lines_fetch('PATHWAY') 
!   end
  
!   # ENZYME
!   def enzymes
!     unless @data['ENZYME']
!       field = fetch('ENZYME')
!       if /\(/.match(field)	# old version
!         @data['ENZYME'] = field.scan(/\S+ \(\S+\)/)
!       else
!         @data['ENZYME'] = field.scan(/\S+/)
        end
+     end
+     @data['ENZYME']
+   end
  
!   # ORTHOLOG
!   def orthologs
!     unless @data['ORTHOLOG']
!       ary = Array.new
!       lines = lines_fetch('ORTHOLOG')
!       lines.each do |line|
!         if /^\S/.match(line)
!           ary << line
!         else
!           ary.last << " #{line.strip}"
          end
        end
+       @data['ORTHOLOG'] = ary
+     end
+     @data['ORTHOLOG']
+   end
  
!   # REFERENCE
!   def references
!     unless @data['REFERENCE']
!       ary = Array.new
!       lines = lines_fetch('REFERENCE')
!       lines.each do |line|
!         if /^\d+\s+\[PMID/.match(line)
!           ary << line
!         else
!           ary.last << " #{line.strip}"
          end
        end
+       @data['REFERENCE'] = ary
+     end
+     @data['REFERENCE']
+   end
  
!   # DBLINKS
!   def dblinks
!     unless @data['DBLINKS']
!       ary = Array.new
!       lines = lines_fetch('DBLINKS')
!       lines.each do |line|
!         if /^\S/.match(line)
!           ary << line
!         else
!           ary.last << " #{line.strip}"
          end
        end
!       @data['DBLINKS'] = ary
      end
+     @data['DBLINKS']
+   end
  
+   # ATOM, BOND
+   def kcf
+     return "#{get('NODE')}#{get('EDGE')}"
    end
  
! end # GLYCAN
! 
! end # KEGG
! end # Bio
  
  


From k at dev.open-bio.org  Tue Sep 19 01:54:32 2006
From: k at dev.open-bio.org (Katayama Toshiaki)
Date: Tue, 19 Sep 2006 05:54:32 +0000
Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg keggtab.rb,1.8,1.9
Message-ID: <200609190554.k8J5sWw4031901@dev.open-bio.org>

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 
! # 		Copyright (C) 2003, 2006 KATAYAMA Toshiaki 
! # License::	Ruby's
  #
  #  $Id$
--- 2,8 ----
  # = bio/db/kegg/keggtab.rb - KEGG keggtab class
  #
! # Copyright::  Copyright (C) 2001 Mitsuteru C. Nakao 
! #              Copyright (C) 2003, 2006 Toshiaki Katayama 
! # 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
  #
! # * (())
  #
  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.c