Question: Running Bl2Seq In Standaloneblastplus
gravatar for Abhi
9.2 years ago by
Abhi50 wrote:

Getting BlastResult from bl2seq is throwing following message:

Use of uninitialized value in numeric le (<=) at /Library/Perl/5.8.8/Bio/SearchIO/ 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');
        if($result = $fac->next_result){
            print "# hits found:: ", $result->num_hits,"\n";
            if(my $hit = $result->next_hit){

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

bioperl blast • 3.1k views
ADD COMMENTlink modified 9.2 years ago by Michael Schubert7.0k • written 9.2 years ago by Abhi50
gravatar for Michael Schubert
9.2 years ago by
Cambridge, UK
Michael Schubert7.0k wrote:

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

ADD COMMENTlink modified 9.2 years ago • written 9.2 years ago by Michael Schubert7.0k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1202 users visited in the last hour