[BioRuby] how to retrieve a genbank record by GI
Toshiaki Katayama
ktym at hgc.jp
Thu Dec 20 08:29:48 UTC 2007
Hi Gujja,
On 2007/12/20, at 5:46, Robert Citek wrote:
> On Dec 19, 2007 1:47 PM, Sharvari Gujja <sgujja at broad.mit.edu> wrote:
>> Robert Citek wrote:
>>> Can you give an example of what you've tried? Also, on what system
>>> are you running bioruby on, e.g. Windows XP, Cygwin in Windows, Ubuntu
>>> Linux, Mac OS X, Solaris? What version of bioruby?
>>
>> I have tried:
>>
>> reg = Bio::Registry.new
>> serv = reg.get_database('genbank')
>> puts serv.get_by_id('J00231')
Did you setup your "seqdatabase.ini" file as described in the README file?
http://code.open-bio.org/cgi-bin/viewcvs/viewcvs.cgi/bioruby/README?rev=1.17&cvsroot=bioruby
Otherwise, 'genbank' database is not supported by OBDA (Bio::Registry) by defalut.
However, there is another problem.
In the BioRuby's default configuration file, 'genbank' refers to the BioFetch server at bioruby.org
and as I wrote in the separate mail, current BioFetch server won't continue to support GenBank database.
[genbank]
protocol=biofetch
location=http://bioruby.org/cgi-bin/biofetch.rb
dbname=genbank
Thus, the above configuration is not valid already...
>> puts Bio::Fetch.query('genbank','185041')
>>
>> server = Bio::Fetch.new()
>> #server = Bio::Fetch.new('http://www.ebi.ac.uk/cgi-bin/dbfetch')
>> puts server.fetch('genbank','J00231','html')
Besides, as you can find at another BioFetch server provided by EBI (Dbfetch),
http://www.ebi.ac.uk/cgi-bin/dbfetch
they doesn't provide GenBank database also (because they have EMBL instead).
As a conclusion, if you need to fetch a GenBank entry from remote server,
using NCBI with E-Utils is the best way for now.
Unfortunately, we don't have the Bio::NCBI::Eutils class yet,
it seems that you can temporally divert the Bio::PubMed class to do that.
Bio::PubMed.efetch("185041", {"db"=>"nuccore", "rettype"=>"gb"})
Bio::PubMed.efetch("J00231", {"db"=>"nuccore", "rettype"=>"gb"})
ESOAP can be alternative but it takes quite long time to read the current
version of the WSDL file and returned value is not easy to handle.
Regards,
Toshiaki Katayama
>> entry = Bio::DBGET.bget("AF139016")
>>
>> gb = Bio::GenBank.new(Bio::Fetch.query('gb', 'J00231'))
>> puts gb.read
>>
>> And running on Windows XP. Ruby 1.8.6
>
> I also get errors:
>
> $ ruby -rbio -e 'reg = Bio::Registry.new'
> /usr/lib/ruby/1.8/net/http.rb:560:in `initialize': No route to host -
> connect(2) (Errno::EHOSTUNREACH)
> from /usr/lib/ruby/1.8/net/http.rb:560:in `open'
> from /usr/lib/ruby/1.8/net/http.rb:560:in `connect'
> from /usr/lib/ruby/1.8/timeout.rb:48:in `timeout'
> from /usr/lib/ruby/1.8/timeout.rb:76:in `timeout'
> from /usr/lib/ruby/1.8/net/http.rb:560:in `connect'
> from /usr/lib/ruby/1.8/net/http.rb:553:in `do_start'
> from /usr/lib/ruby/1.8/net/http.rb:542:in `start'
> from /usr/lib/ruby/1.8/net/http.rb:440:in `start'
> from /usr/lib/ruby/1.8/bio/io/registry.rb:190:in `read_remote'
> from /usr/lib/ruby/1.8/bio/io/registry.rb:126:in `initialize'
> from -e:1:in `new'
> from -e:1
>
> $ ruby -v
> ruby 1.8.6 (2007-06-07 patchlevel 36) [i486-linux]
>
> $ lsb_release -a
> No LSB modules are available.
> Distributor ID: Ubuntu
> Description: Ubuntu 7.10
> Release: 7.10
> Codename: gutsy
>
> Unfortunately, I don't know how to display what version of bioruby I'm
> using. I guess I'm too new to ruby, let alone bioruby, to be of any
> help. Anyone have a working example? Unfortunately, my connection to
> bioruby.org doesn't work (I suspect our 'Net connection is snafu'ed).
>
> Regards,
> - Robert
> _______________________________________________
> BioRuby mailing list
> BioRuby at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioruby
More information about the BioRuby
mailing list