[Bioperl-l] error while remote blast against swissprot db

DeeGee gdorjee at hotmail.com
Sat Apr 14 17:39:50 EDT 2007


hi all, 
can anyone please tell me why and how can i fix the following script, which
gives me an error like:
waiting... 5 units of time
Can't call method "database_name" on an undefined value at
test1_remote_swissblast.pl line 41, <GEN4> line 31.
cheers!

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

my $Seq_in = Bio::SeqIO->new (-file => $ARGV[0], 
                              -format => 'fasta');
my $query = $Seq_in->next_seq(); 

my $factory = Bio::Tools::Run::RemoteBlast->new(
                                '-prog'  => 'blastp',
                                '-data' => 'swissprot',
                                 _READMETHOD => "Blast"
                         );
my $blast_report = $factory->submit_blast($query);
my $max_number = 100;
my $trial = 0;


while ( my @rids = $factory->each_rid ) {

    print STDERR "\nSorry, maximum number of retries $max_number exceeded\n"
if $trial >= $max_number;
    last if $trial >= $max_number;
    $trial++;

    print STDERR "waiting... ".(5*$trial)." units of time\n" ;

    # RID = Remote Blast ID (e.g: 1017772174-16400-6638)
    foreach my $rid ( @rids ) {
        my $rc = $factory->retrieve_blast($rid);
       if( !ref($rc) ) {
           if( $rc < 0 ) {
                # retrieve_blast returns -1 on error
               $factory->remove_rid($rid);
            }
            # retrieve_blast returns 0 on 'job not finished'
           sleep 5*$trial;
        } else {

            #---- Blast done ----
            $factory->remove_rid($rid);
            my $result = $rc->next_result;
            print "database: ", $result->database_name(), "\n";
            while( my $hit = $result->next_hit ) {
                print "hit name is: ", $hit->name, "\n";
                while( my $hsp = $hit->next_hsp ) {
                    print "score is: ", $hsp->score, "\n";
                }          }
        }
    }
} 
-- 
View this message in context: http://www.nabble.com/error-while-remote-blast-against-swissprot-db-tf3577674.html#a9997343
Sent from the Perl - Bioperl-L mailing list archive at Nabble.com.



More information about the Bioperl-l mailing list