This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Running Bl2Seq In Standaloneblastplus

Getting BlastResult from bl2seq is throwing following message:

Use of uninitialized value in numeric le (<=) at /Library/Perl/5.8.8/Bio/SearchIO/IteratedSearchResultEventBuilder.pm line 315, <GEN6> line 26.

Here is the code:

use strict;
use Bio::Seq;
use Bio::SeqIO;
use Bio::DB::GenBank;
use Bio::Tools::Run::StandAloneBlastPlus;
use Bio::Search::Result::BlastResult;
use Bio::Search::Hit::HitI;

my $fac = Bio::Tools::Run::StandAloneBlastPlus->new();

my $seq_obj = Bio::SeqIO->new(-file => "all_reads.fasta", -format => "fasta", -alphabet => "dna");

my @seq_list;

while(my $seq = $seq_obj->next_seq()){
    push(@seq_list, $seq);
}

my $match = 0;
for(my $i = 0; $i < @seq_list; $i++){
    for(my $j = $i+1; $j < @seq_list; $j++){
        my $result = $fac->bl2seq(-method=>'blastn', -query => $seq_list[$j], -subject => $seq_list[$i], -outfile=>'test.out');
        $fac->rewind_results;
        if($result = $fac->next_result){
            print "# hits found:: ", $result->num_hits,"\n";
            if(my $hit = $result->next_hit){
                $match++;
            }
        }
    }
}
$fac->cleanup();

My question is how to get rid of the message. Also even though the output file shows no hit's, the BlastResult object get's the number of hit's as 1.

Appreciate any help on running bl2seq on Blastplus.

Thanks -Abhi

blast bioperl

1 answer

Looks like you're passing Blast+ sequence handles instead of file names.

This has two errors ;-)

  • you are not running bl2seq at all (as it is a separate executable called, surprisingly bl2seq); see here for a working example
  • when using blastn, be sure to supply file names instead of sequence objects

An easier way to get all pairwise results would also be to blastn your all_reads.fasta as both query and database (no BioPerl required).

Log in to answer this question.