[BioRuby] Bio::NCBI:REST:EFetch

Naohisa GOTO ngoto at gen-info.osaka-u.ac.jp
Tue Jun 30 12:19:25 UTC 2009


Hi,

On Tue, 30 Jun 2009 10:12:50 +1000
Ben Woodcroft <donttrustben at gmail.com> wrote:

> Hi,
> 
> I was just googling how to download a genbank sequence using bioruby, and
> somehow got pointed to this example code:
> 
>       # == Usage
>       #
>       # Bio::NCBI::REST::EFetch.sequence("123,U12345,U12345.1,gb|U12345|")
> 
> But this doesn't seem to work in irb:
> 
> $ gem list bio
> 
> *** LOCAL GEMS ***
> 
> bio (1.3.0)
> $ irb -rubygems
> irb(main):001:0> require 'bio'
> => true
> irb(main):002:0>
> Bio::NCBI::REST::EFetch.sequence("123,U12345,U12345.1,gb|U12345|")
> NameError: uninitialized constant Bio::NCBI::REST::EFetch
>     from (irb):2

In my machine, it works correctly.

$ ruby --version
ruby 1.8.7 (2009-04-08 patchlevel 160) [i686-linux]
lng[ngoto<3>]$ gem --version
1.3.4
$ gem install bio
Successfully installed bio-1.3.0
1 gem installed
Installing ri documentation for bio-1.3.0...
Installing RDoc documentation for bio-1.3.0...
$ irb -r rubygems
irb(main):001:0> require 'bio'
=> true
irb(main):002:0> Bio::BIORUBY_VERSION
=> [1, 3, 0]
irb(main):003:0> Bio::BIORUBY_VERSION_ID
=> "1.3.0"
irb(main):004:0> Bio::NCBI::REST::EFetch.sequence("123,U12345,U12345.1,gb|U12345|")
=> "LOCUS       X63139                   854 bp    DNA     linear   MAM 17-DEC-1991\nDEFINITION  B.taurus beta-lactoglobulin gene 5'-region and partial exon 1.\
(snip)

The NameError may be caused by old version of BioRuby which
may exist somewhere in the $LOAD_PATH.

Please check the following version identifiers of BioRuby.
  p Bio::BIORUBY_VERSION
  p Bio::BIORUBY_VERSION_ID
  p Bio::BIORUBY_EXTRA_VERSION


> Then I noticed by looking at the code I could just do
> 
> Bio::NCBI::REST::efetch("EF489424", {:rettype => 'fasta', :db =>
> 'sequences'})
> 

This also works.

> So it seems there is some redundancy. What is going on? Should there be a
> pointer to Bio::NCBI::REST::efetch from Bio::NCBI::REST::EFetch in the rdoc?
> That would have made me understand a lot quicker, and I wouldn't have had to
> look at the code to figure it out.

Both should work, and I think redundancy is not severe problem.
Methods about EFetch is defined in Bio::NCBI::REST::EFetch::Methods
and documents for the methods are also available.

http://bioruby.org/rdoc/classes/Bio/NCBI/REST/EFetch/Methods.html

But, the hierarchy of the documentation may be difficult to know
for most users. Contributions and suggestions for documentation
are welcome.

Naohisa Goto
ngoto at gen-info.osaka-u.ac.jp / ng at bioruby.org

> 
> Thanks,
> ben
> --
> FYI: My email addresses at unimelb, uq and gmail all redirect to the same
> place.
> _______________________________________________
> BioRuby mailing list
> BioRuby at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioruby




More information about the BioRuby mailing list