[Bioperl-l] Eutilities Batch

Chris Fields cjfields at uiuc.edu
Thu Oct 5 14:11:25 EDT 2006


On Oct 5, 2006, at 9:09 AM, Bernd Web wrote:

> Hi,
>
> I am using the new EUtilities. It looks great.
> I was trying to use epost followed by elink but i get an error. The
> same error is actually given with the example on
> http://doc.bioperl.org/bioperl-live/Bio/DB/EUtilities/elink.html:
> Can't call method "get_databases" on an undefined value at EU.pl  
> line 25.
>
> For completeness, the code is shown below too.
>
> Any suggestions what is going wrong?
>
> Regards,
> Bernd

Grr...that's my error, sorry Bernd.  The POD wasn't updated to match  
the change I made and has a few errors.  The elink object, for  
starters, doesn't fetch the response using get_response().  Also, the  
ElinkData method has changed slightly but accomplishes the same  
thing.  Odd, since I copied and pasted that from working code...

Just a note: these are considered highly experimental at the moment,  
though they should be ready for general use and toying around.  I  
would like any suggestions on methods and so on you may have (Sendu  
has made some very helpful ones off-list which I plan on implementing).

Feel free to let me know if something doesn't work.  Note that,  
because of their experimental nature, you will want to take note of  
any methods changes in particular as I try to solidify the API and  
clean up the POD, so expect some momentary 'outages'.  I plan on  
setting up a remedial interface for all the container objects (like  
ElinkData) which will help clarify things and solidify the API in the  
next few weeks, at least to a point where the class methods have a  
consistent naming scheme.  I plan on using this as a backend web  
agent for a general Entrez interface at some point to get data into  
Bio* objects.

In the meantime, try this:

use Bio::DB::EUtilities;

my $esearch = Bio::DB::EUtilities->new(-eutil      => 'esearch',
                                        -db         => 'pubmed',
                                        -term       => 'hutP',
                                        -usehistory => 'y');

$esearch->get_response; # parse the response, fetch a cookie

my $elink = Bio::DB::EUtilities->new(-eutil        => 'elink',
                                      -db           =>  
'protein,taxonomy',
                                      -dbfrom       => 'pubmed',
                                      -cookie       => $esearch- 
 >next_cookie,
                                      -cmd          => 'neighbor');

$elink->get_response;

# this retrieves the Bio::DB::EUtilities::ElinkData object

my $linkset = $elink->next_linkset;
my @ids;

# step through IDs for each linked database in the ElinkData object

for my $db ($linkset->get_all_linkdbs) {
   @ids = $linkset->get_LinkIds_by_db($db); #returns primary ID's
   print join q(,), @ids;
   # do something here
}


Christopher Fields
Postdoctoral Researcher
Lab of Dr. Robert Switzer
Dept of Biochemistry
University of Illinois Urbana-Champaign





More information about the Bioperl-l mailing list