[Bioperl-l] quick pairwise alignment

Dave Messina David.Messina at sbc.su.se
Wed Nov 26 05:31:34 EST 2008

Hi Alper,
Please remember to 'reply all' to keep this conversation on the bioperl

It's hard to be sure with just fragments of your code, but it seems to be
working fine for me. Below I've attached a sample script showing how you can
run bl2seq.

If you aren't already, you probably will want to download a nightly build of
bioperl-live and bioperl-run to eliminate any problems stemming from
outdated code.

Also, for future reference, instead of the BioPerl tutorial, I recommend the
HOWTOs on the website; for this question, this one should be helpful:

You tell StandAloneBlast which program to use (blastp, blastn, etc) using
the -program parameter. You'll see it in the example script below.


---------------example code---------------

use strict;
use warnings;
use Bio::Seq;
use Bio::Tools::Run::StandAloneBlast;

# lots of params can be set here, basically anything that you would normally
# be able to pass to blast on the command line. Type
#    perldoc Bio::Tools::Run::StandAloneBlast
# on the command line to see details.
my @params = (program  => 'blastp');

my $factory = Bio::Tools::Run::StandAloneBlast->new(@params);

# make some fake data
my $input1 = Bio::Seq->new(-id  => "testquery1",
                           -seq => "ACTADDEEQQPPTCADEEQQQVVGG");
my $input2 = Bio::Seq->new(-id  => "testquery2",
                           -seq => "ACTADDEMMMMMMMDEEQQQVVGG");

# execute the blast command with this line
my $blast_report = $factory->bl2seq ($input1,  $input2);

# just one result in a bl2seq report
my $result_obj = $blast_report->next_result;

# likewise just one hit
my $hit_obj = $result_obj->next_hit;

# there may be >1 hsp, but I'm only looking at the first one in this example
my $hsp_obj = $hit_obj->next_hsp;

# take a quick look at the alignment
print $hsp_obj->query_string,    "\n",
  $hsp_obj->homology_string, "\n",
  $hsp_obj->hit_string,      "\n";

---------------end example code-------------

On Tue, Nov 25, 2008 at 20:00, Alper Yilmaz <alperyilmaz at gmail.com> wrote:

> Hi Dave,
> bls2seq works okay. I tried the following outside of bioperl and it
> successfully generates the output.
> Btw, how do I tell StandAloneBlast, bl2seq function which program to use
> (blastn, blastp, etc)?
> bl2seq -p blastn -j seq1.fa -i seq2.fa -o bl2seq.out
> thanks,
> alper

More information about the Bioperl-l mailing list