[Bioperl-l] quick pairwise alignment

Alper Yilmaz alperyilmaz at gmail.com
Wed Nov 26 12:15:44 EST 2008

Hi Dave,

Thank you so much. It works perfect. I was working on
Bio::Tools::Run::Alignment::Clustalw , I succeeded to make clustalw run but
even though I select -quiet option, the output of the program was directed
to my HTML code, instead of being assigned to $aln variable. I was losing
hope but your solution saved the day. StandAloneBlast works very nicely and
I'm glad viewing the alignment is possible.

Out of curiosity, is it possible to see the "original" sequence that is used
for BLAST in the alignment? I tried using $hsp_obj->str_seq('query') or
$hsp_obj->str_seq('sbjct') but they print out the matched sequence only. I
am interested in seeing if the match is at N-terminus or C-terminus
(visually thru alignment, not by numbers). In other words, is it possible to
get the blast alignment look like clustalw alignment?


On Wed, Nov 26, 2008 at 5:31 AM, Dave Messina <David.Messina at sbc.su.se>wrote:

> Hi Alper,
> Please remember to 'reply all' to keep this conversation on the bioperl
> list.
> 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.
> http://www.bioperl.org/DIST/nightly_builds/
> Also, for future reference, instead of the BioPerl tutorial, I recommend
> the HOWTOs on the website; for this question, this one should be helpful:
> http://www.bioperl.org/wiki/HOWTO:Beginners
> You tell StandAloneBlast which program to use (blastp, blastn, etc) using
> the -program parameter. You'll see it in the example script below.
> Dave
> ---------------example code---------------
> #!/usr/bin/perl
> 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