Hatena::Groupbioruby

"aac".translate #=> "N" このページをアンテナに追加 RSSフィード

2006-09-17NCBI WebService E-Utilities on BioRuby

Usege for ncbi_ws.rb

|  Usege for ncbi_ws.rb - "aac".translate #=> "N" を含むブックマーク はてなブックマーク -  Usege for ncbi_ws.rb - "aac".translate #=> "N"  Usege for ncbi_ws.rb - "aac".translate #=> "N" のブックマークコメント

First off,
% bioruby
bioruby> require 'ncbi_ws.rb'
bioruby> ncbi = Bio::NCBI::WebService::E[TAB][TAB]
Bio::NCBI::WebService::EFetch      Bio::NCBI::WebService::EUtils
Bio::NCBI::WebService::EFetchLite  Bio::NCBI::WebService::EUtilsLite
bioruby> ncbi =Bio::NCBI::WebService::EUtils.new
ignored element: {http://www.w3.org/2001/XMLSchema}sequence of WSDL::XMLSchema::Sequence
ignored element: {http://www.w3.org/2001/XMLSchema}choice of WSDL::XMLSchema::Sequence
ignored element: {http://www.w3.org/2001/XMLSchema}choice of WSDL::XMLSchema::Sequence
ignored element: {http://www.w3.org/2001/XMLSchema}sequence of WSDL::XMLSchema::Sequence
ignored element: {http://www.w3.org/2001/XMLSchema}sequence of WSDL::XMLSchema::Sequence
ignored element: {http://www.w3.org/2001/XMLSchema}choice of WSDL::XMLSchema::Sequence
ignored element: {http://www.w3.org/2001/XMLSchema}sequence of WSDL::XMLSchema::Sequence
Show methods defined by the WSDL for NCBI E-Utils. (list_methods method requires CVS HEAD BioRuby)
bioruby> p ncbi.list_methods
["run_eSummary", "run_eInfo", "run_eSpell_MS", "run_eLink_MS", "run_eSearch_MS", "run_eGquery_MS", "run_eSpell", "run_eLink", "run_eSearch", "run_eGquery", "run_eFetch_MS", "run_eSummary_MS", "run_eInfo_MS", "run_eFetch"]

I don't know how to use this. (-_-;
bioruby> p ncbi.run_eFetch("db=pubmed&id=28864546")
SOAP::FaultError: Unspecified internal server error
        from 
Show database names by eInfo.
bioruby> p ncbi.run_eInfo("").dbList.dbName
["pubmed", "protein", "nucleotide", "nuccore", "nucgss", "nucest", "structure", "genome", "books", "cancerchromosomes", "cdd", "domains", "gene", "genomeprj", "gensat", "geo", "gds", "homologene", "journals", "mesh", "ncbisearch", "nlmcatalog", "omia", "omim", "pmc", "popset", "probe", "pcassay", "pccompound", "pcsubstance", "snp", "taxonomy", "unigene", "unists"]
Show PubMed Info.
bioruby> pubmed = ncbi.run_eInfo('db'=> 'pubmed')
bioruby> p pubmed.dbName
"pubmed"
bioruby> p pubmed.dbInfo.description
"PubMed bibliographic record"
bioruby> p pubmed.dbInfo.lastUpdate 
"2006/09/17 13:54"

This return object seems to be same as http://www.ncbi.nlm.nih.gov/entrez/eutils/einfo.fcgi?db=pubmed.

bioruby> p pubmed.dbInfo.fieldList.field.class
Array
bioruby> p pubmed.dbInfo.fieldList.field[0]       
#<SOAP::Mapping::Object:0x14cd12e {http://www.ncbi.nlm.nih.gov/soap/eutils/einfo}Name="ALL" {http://www.ncbi.nlm.nih.gov/soap/eutils/einfo}Description="All terms from all searchable fields" {http://www.ncbi.nlm.nih.gov/soap/eutils/einfo}TermCount="60007812" {http://www.ncbi.nlm.nih.gov/soap/eutils/einfo}IsDate="N" {http://www.ncbi.nlm.nih.gov/soap/eutils/einfo}IsNumerical="N" {http://www.ncbi.nlm.nih.gov/soap/eutils/einfo}SingleToken="N" {http://www.ncbi.nlm.nih.gov/soap/eutils/einfo}Hierarchy="N">

ncbi_ws.rb

|  ncbi_ws.rb - "aac".translate #=> "N" を含むブックマーク はてなブックマーク -  ncbi_ws.rb - "aac".translate #=> "N"  ncbi_ws.rb - "aac".translate #=> "N" のブックマークコメント

require 'bio/io/soapwsdl'

module Bio
class NCBI
  class WebService
    SERVICES = [
      ['EUtils',      'http://www.ncbi.nlm.nih.gov/entrez/eutils/soap/eutils.wsdl'],
      ['EUtilsLite',  'http://www.ncbi.nlm.nih.gov/entrez/eutils/soap/eutils_lite.wsdl'], # no E-Fetch
      ['EFetch',      'http://www.ncbi.nlm.nih.gov/entrez/eutils/soap/efetch.wsdl'],
      ['EFetchLite',  'http://www.ncbi.nlm.nih.gov/entrez/eutils/soap/efetch_lit.wsdl'] # for PubMed and nlmCataloy only
  ]

  SERVICES.each do |service, wsdl|
    class_definition = \
"class #{service.to_s} < Bio::SOAPWSDL
  def initialize
    @wsdl = '#{wsdl}'
    create_driver
  end    
end"
    eval class_definition
  end

end # WebService
end # module NCBI
end # module Bio
トラックバック - http://bioruby.g.hatena.ne.jp/nakao_mitsuteru/20060917