[BioRuby-cvs] bioruby/lib/bio/io ebisoap.rb, NONE, 1.1 ncbisoap.rb, NONE, 1.1

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


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 <k at bioruby.org>
# 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 <k at bioruby.org>
# 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







More information about the bioruby-cvs mailing list