Gossamer Forum
Home : General : Perl Programming :

Running RemoteBlast

Quote Reply
Running RemoteBlast
Hi,

I am trying to run a remote blast on a fasta file that is provided to me. Here is my code:


use Bio::SeqIO;
use Bio::Tools::Run::RemoteBlast;
my $Seq_in = Bio::SeqIO->new (-file => 'protein.fa',-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" ;
$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->outfile('blast.out');
}
# retrieve_blast returns 0 on ’job not finished’
sleep 5*$trial;
}else {
#---- Blast done ----
$factory->outfile('blast.out');
my $blast_report = $factory->blastall($query);
my $result = $blast_report->next_result;
while( my $hit = $result->next_hit ()){
print "\thit name is: ", $hit->name(),
" significance: ", $hit->significance(), "\n";}
}
}
}


However I get and error that says,

Can't locate object method "outfile" via package Bio::Tools::Run::RemoteBlast at line 30;


I want a outfile in txt format. I tried changing blast.txt but doesn't work. Any suggestions of how to run this remote blast and get the file in text format?
Subject Author Views Date
Post Running RemoteBlast masteringperl 3415 Dec 8, 2010, 4:08 PM