[Bioperl-l] Having the Blast output of StandAloneBlast in a single file

omid gulban gulban at sickkids.ca
Fri Apr 30 15:31:41 EDT 2004


Hello Everyone,

I have a file which contains multiple sequences in FASTA format. I have installed Blast executables 
on Windows XP along with bioperl. I wrote the following code:

It works fine except that I get the results of the last sequence in the output file and not for 
all the sequences in the input file:


#!/usr/bin/perl
use strict;
use Bio::SeqIO;
use Bio::Tools::Run::StandAloneBlast;

my $time = time;

#input file
my $input_sequence_file = 'nucleotide.fa';

#output file
my $output_file = "blast_output_on_" . $time;

my $program = 'blastn';
my $database = 'Ensembl\cdna_known\Mus_musculus.NCBIM30.cdna_known.fa';
my $expectionvalue = 10.0;

my $Sequence_from_input_file = Bio::SeqIO ->
                               new (-file => $input_sequence_file,
              -format => 'fasta');


while (my $query_sequence = $Sequence_from_input_file -> next_seq()) {

 my $factory = Bio::Tools::Run::StandAloneBlast ->
      new ('program'  => $program,
        'database' => $database,
        'outfile'  => $output_file
       );


 my $blast_report = $factory -> blastall ($query_sequence);

 my $result = $blast_report -> next_result;

 while (my $hit = $result -> next_hit()) {
  print "The hit name is: " , $hit -> name() , "\t" ,
     "Significance   : " , $hit -> significance() ,
     "\n";
  #sleep 1;
 }
 print "\n";
 sleep 2;
}#while



Any help you can provide is greatly appreciated

Thanks
Omid


More information about the Bioperl-l mailing list