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

Remo Sanges rsanges at tigem.it
Mon May 3 12:08:49 EDT 2004


On Apr 30, 2004, at 9:31 PM, omid gulban wrote:

> 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);
>

If you pass to the blastall call the entire fasta file  
blastall($input_sequence_file)
it should work

>  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

Remo



More information about the Bioperl-l mailing list