[Bioperl-l] RemoteBlast not handling NCBI Error message

Jason Walker jwalker at watson.wustl.edu
Tue Aug 21 15:20:46 UTC 2007

I've noticed RemoteBlast does not handle a specific error message from 
NCBI correctly.  retrieve_blast() should return 0 if waiting, -1 on 
error, or the results when completed.  It looks like the method relies 
on a specific tag in the NCBI return,  'QBlastInfoBegin'.  The error 
message I'm getting does not have this tag or a value of 
'Status=ERROR'.  After contacting NCBI 'Blast-help', they stated that 
QBlastInfoBegin should not be expected from all GET requests.  The error 
can be reproduced by using RID CM2YJJW501R, until it expires tomorrow.

my $rid = 'CM2YJJW501R';
my $factory = Bio::Tools::Run::RemoteBlast->new( -verbose => 1,);
my $rc = $factory->retrieve_blast($rid);
print $rc ."\n";

The content returned from NCBI looks like:
<hr><font color="red">ERROR: An error has occurred on the server, Too 
many HSPs to save all
 Contact Blast-help at ncbi.nlm.nih.gov and include your RID: 

I added a conditional statement as seen below to correct my local copy.  
I'm not sure this is the best fix, but it works.
sub retrieve_blast {
    if( /QBlastInfoBegin/i ) {
        $s = 1;
    } elsif( $s ) {
        if( /Status=(WAITING|ERROR|READY)/i ) {
    } elsif( /^(?:#\s)?[\w-]*?BLAST\w+/ ) {
        $waiting = 0;
    } elsif ( /ERROR/i ) {
        open(my $ERR, "<$tempfile") or $self->throw("cannot open file 
        $self->warn(join("", <$ERR>));
        close $ERR;
        return -1;

Jason Walker

More information about the Bioperl-l mailing list