[Bioperl-l] More on EUtilities problem
Warren Gallin
wgallin at ualberta.ca
Tue Oct 23 00:28:55 UTC 2007
I seem to be missing something here.
I took the code from the HOWTO as a template and wrote the following
code snippet (@gisearch_number is an array of gi numbers, prints out
as expected and can be used to successfully download the relevant
records using Batch Entrez):
______________________________________________________________
#Create new EUTILS history object for submitting a large array of gi
numbers
my $gpeptfactory = Bio::DB::EUtilities->new(
-eutil => 'epost',
-db => 'protein',
-id => \@ginumber_search,
-keep_histories => 1
);
my $count = @ginumber_search;
my $history;
if ($history = $gpeptfactory -> next_History){
print "Posted successfully\n";
#Prints as expected for successful history
print "WebEnv : ", $history -> get_webenv,"\n";
print "Query_key : ",$history->get_query_key,"\n";
}
$file = 'temp_hold.gb';
$gpeptfactory->set_parameters (-eutil => 'efetch',
-rettype => 'genbank',
-history => $history,
);
my ($retmax, $retstart) = (300,0);
my $retry = 0;
RETRIEVE_SEQS: while ($retstart < $count) {
$gpeptfactory->set_parameters(
-retmax => $retmax,
-retstart => $retstart,
);
eval{
$gpeptfactory->get_Response(-file => $file);
print "Output file is $file.\n";
};
if ($@) {
die "Server error: $@. Try again later" if $retry == 5;
print STDERR "$@\n";
print STDERR "Server error, redo #$retry\n";
$retry++ && goto RETRIEVE_SEQS;
}
else{
my $retend = $retstart + $ retmax;
print "Loaded entries $retstart through $retend on retry #
$retry.\n";
$retstart += $retmax;
$retry = 0;
}
}
$retr_seq = Bio::SeqIO->new(
-file => $file,
-format => 'genbank'
);
________________________________________________
At this point the program fails because there is no file written.
It appears that the get_Response method is not doing its thing.
Also, on each iteration of the loop enclosing the eval the first pass
fails with the following error message:
------------- EXCEPTION: Bio::Root::Exception -------------
MSG: Response Error
Request-URI Too Large
STACK: Error::throw
STACK: Bio::Root::Root::throw /Library/Perl/5.8.1/Bio/Root/Root.pm:357
STACK: Bio::DB::GenericWebAgent::get_Response /Library/Perl/5.8.1/Bio/
DB/GenericWebAgent.pm:184
STACK: Stable_gb_update.pl:177
-----------------------------------------------------------
and then the second pass evaluates as correct - but the output file
is never opened or written to.
I've tried to pass $file, "$file" , ">>$file" and a literal string
of a file name, with and without the >>, but to no avail.
So I think that I must be missing something basic here, but I am
unable to see what.
Any advice would be most welcome.
Warren Gallin
More information about the Bioperl-l
mailing list