[Bioperl-l] How to get Remote BLAST results in a single out
José Luis Lavín
joluito at gmail.com
Mon Nov 14 09:21:31 UTC 2011
Hello everybody,
I've been using "Bio::Tools::Run::RemoteBlast" for a time and it has
worked fine for me. Now I need to perform a multiple BLAST search, but this
time I'd just like to get all the BLAST results in a single out file
instead of having each sequence's report written individually. I've read
the documentation of the module, but due to my short
experience/understanding on complex modules as this one seems to be I can't
figure out where to change the script to achieve my previously mentioned
aim.
Here I post the script I've been using (it's basically the one posted on
the module cookbook).
#!/c:/Perl -w
use Bio::Tools::Run::RemoteBlast;
use Bio::SearchIO;
use Data::Dumper;
#Here i set the parameters for blast
print "Enter your BLAST choice (blastn, blastp, blastx, tblastn,
tblastx):\n";
my $blst = <STDIN>;
my $prog = "$blst";
print "Enter a database to search (nr, refseq_protein, swissprot, pat, pdb,
env_nr):\n";
my $dtb = <STDIN>;
$db = "$dtb";
print "Enter your cutt off score (1e-n):\n";
my $cut = <STDIN>;
my $e_val = "$cut";
my @params = ( '-prog' => $prog,
'-data' => $db,
'-expect' => $e_val,
'-readmethod' => 'SearchIO' );
my $remoteBlast = Bio::Tools::Run::RemoteBlast->new(@params);
#Select the file and make the blast.
print "Enter your FASTA file:\n";
chomp(my $infile = <STDIN>);
my $r = $remoteBlast->submit_blast($infile);
my $v = 1;
print STDERR "waiting..." if( $v > 0 ); ######## WAIT FOR THE RESULTS
TO RETURN!!!!!
while ( my @rids = $remoteBlast->each_rid ) {
foreach my $rid ( @rids ) {
my $rc = $remoteBlast->retrieve_blast($rid);
if( !ref($rc) ) {
if( $rc < 0 ) {
$remoteBlast->remove_rid($rid);
}
print STDERR "." if ( $v > 0 );
sleep 5;
} else {
my $result = $rc->next_result();
#save the output
my $filename =
$result->query_name()."\.out";##################open SALIDA,
'>>'."$^T"."Report"."\.out";
$remoteBlast->save_output($filename);#############
$remoteBlast->remove_rid($rid);
print "\nQuery Name: ", $result->query_name(), "\n";
while ( my $hit = $result->next_hit ) {
next unless ( $v > 0);
print "\thit name is ", $hit->name, "\n";
while( my $hsp = $hit->next_hsp ) {
print "\t\tscore is ", $hsp->score, "\n";
}
}
}
}
}
May any of you please explain me how to solve my question?
Thanks in advence
With best wishes
--
--
Dr. José Luis Lavín Trueba
Dpto. de Producción Agraria
Grupo de Genética y Microbiología
Universidad Pública de Navarra
31006 Pamplona
Navarra
SPAIN
More information about the Bioperl-l
mailing list