[Bioperl-l] Problem in getting sbjctseq using remote Blast

Chris Fields cjfields at uiuc.edu
Fri Apr 7 15:48:56 UTC 2006


I only sporadically got the error you stated ("502 Bad Gateway"), which can
happen if the remote BLAST server is extremely busy.  The main error I saw
was an message saying it did not find method 'sbjctseq':

Can't locate object method "sbjctseq" via package
"Bio::Search::HSP::GenericHSP" at C:\Perl\Scripts\blast test\test.pl line
41, <GEN7> line 1336.

The reason you can't find it is b/c there is no 'sbjctseq' method for
GenericHSP objects.  This is left over from when Bio::Tools::BPLite was used
for parsing remote BLAST reports; BPLite is now deprecated in favour of
Bio::SearchIO.  We would like to know where you found this in the
documentation so it can be changed.

Try this instead:

$hsp->hit_string;

You do have a few more problems here.  Although this script works, using
Bio::Perl in combination with Bio::Tools::Run::RemoteBlast and Bio::SearchIO
is a bit redundant; Bio::Perl 'uses' methods from
Bio::Tools::Run::RemoteBlast, which 'uses' methods from Bio::SearchIO.  

For your example you should probably not use Bio::Perl to retrieve your
sequence since you're parsing remote BLAST output.  Bio::SeqIO is more
direct; use it instead.  Try this:

use Bio::Tools::Run::RemoteBlast;
use Bio::SeqIO;

my ( @params, $remote_blast_object, $blast_file, $r, $rc, $database);
my $sleep_time = 2;
open (fh, ">result.txt");
@params = (-verbose=>1, -prog=>'blastp', -data=>'swissprot',
-expect=>'1e-10');
$remote_blast_object = Bio::Tools::Run::RemoteBlast->new(@params);
$blast_file = Bio::SeqIO->new(-file    => '< roa1.fasta',
                              -format  => 'fasta');
$r = $remote_blast_object->submit_blast($blast_file->next_seq);
while ( my  @rids = $remote_blast_object->each_rid ) {
......


One final thing: remote BLAST output breaks bioperl v 1.5.1 text parsing.
You may need to upgrade your Bio::SearchIO::blast to the latest in CVS.


Chris


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

> -----Original Message-----
> From: bioperl-l-bounces at lists.open-bio.org [mailto:bioperl-l-
> bounces at lists.open-bio.org] On Behalf Of Sonmitra Mondal
> Sent: Friday, April 07, 2006 3:04 AM
> To: bioperl-l at lists.open-bio.org
> Subject: [Bioperl-l] Problem in getting sbjctseq using remote Blast
> 
> I am having problem while running Remote blast program for getting
> hsp->sbjctseq . Rest of the program is running properly , but when we
> want to fetch that sequence following error is generating
> .-------------------- WARNING ---------------------
> MSG: <HTML>
> <HEAD><TITLE>An Error Occurred</TITLE></HEAD>
> <BODY>
> <H1>An Error Occurred</H1>
> 502 Bad Gateway
> </BODY>
> </HTML>
> 
> ---------------------------------------------------
> Error return code for BlastID code 1144396008-25960-52288961349.BLASTQ4
> ...
> 
> 
> I am using the following code :
> use Bio::Perl;
> use Bio::Tools::Run::RemoteBlast;
> 
> use Bio::SearchIO;
> 
> open (fh,">result.txt");
> my (@params, $remote_blast_object, $blast_file, $r, $rc, $database);
> my $sleep_time = 2;
> $database = 'swissprot';
> @params = (-prog=>'blastp', -data=>'swissprot', -expect=>'1e-10');
> $remote_blast_object = Bio::Tools::Run::RemoteBlast->new(@params);
> $blast_file = Bio::Root::IO->catfile("roa1.fasta");
> $r = $remote_blast_object->submit_blast( $blast_file);
> while ( my @rids = $remote_blast_object->each_rid ) {
> foreach my $rid ( @rids ) {
> my$rc = $remote_blast_object->retrieve_blast($rid);
> if(!ref($rc) ) { # $rc not a reference => error or job not yet finished
> if( $rc < 0 ) { $remote_blast_object->remove_rid($rid);
> print "Error return code for BlastID code $rid ... \n";}
> sleep $sleep_time; if ($sleep_time < 120) {$sleep_time *= 2;}
> } else {
> $sleep_time = 2;
> $remote_blast_object->remove_rid($rid);
> my $count = 0;
> my $index=1;
> while( my $res = $rc->next_result ) {
> $count++;
> #print "result db is ", $res->database_name(), "\n";
> 
> 
> while( my $hit = $res->next_hit()) {
> 
> 
> print fh $hit->name();
> #print $hit->name(),"\t",$hit->description()," \t";
> while( my $hsp = $hit->next_hsp ) {
> #print "\t",$hsp->bits,
> print  $hsp->evalue, "\t",$hsp->score;
> print  "\n",$hsp->sbjctseq;
> #print fh "\n", $hsp->match;
> #print fh "\n", $hsp->positive;
> }
> print fh "\n";
> }
> close(fh);
> }
> }
> }
> }
> --------------------------------------------------------------------------
> ---------------------------------------
> 
> I am facing also another problem . When i am changing the parameter -
> program as 'tblastn' , there's no output .
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l




More information about the Bioperl-l mailing list