[BioPython] slow pairwise2 alignment

Jeffrey Chang jeffrey_chang at stanfordalumni.org
Mon Feb 2 09:28:24 EST 2004


Hi Karin,

You can test to see if the C code is available by doing:
 >>> from Bio import cpairwise2

If that succeeds, then the C version is compiled and pairwise2 should 
be using it.  Otherwise, it is not.

One of the reasons it might be taking so long, especially with 
nucleotide sequences, is that it recovers all best alignments with 
equivalent score.  If you want to speed it up, you can:
1) Only recover one best alignment:
     pairwise2.align.localms(..., one_alignment_only=1)
2) Only get the score (no alignments):
     pairwise2.align.localms(..., score_only=1)
In this case, the return value of the function is just the score, which 
should speed things up a bit.

If you are using x86, you may also consider using psyco to speed things 
up a bit.
http://psyco.sourceforge.net/

Good luck!

Jeff



On Feb 2, 2004, at 4:39 AM, Karin Lagesen wrote:

> Hi!
>
> I have a task where I need to do a lot of pairwise alignments. I am
> using pairwise2.align.localms, since that seemed to fit me nicely.
> However, when I try it out with aligning sequences around 350 nts
> long, I end up using about 1 1/2 mins per alignment. This is for my
> use way too slow.
>
> When I look in the source code I see something about a c code thingy
> that can do this. I am assuming that since it takes so long that I am
> not using the c code. Does anybody have any idea of how I can check
> this, and how I if I'm not using the c code can get to use it?
>
> TIA,
>
> Karin
> -- 
> Karin Lagesen, PhD student
> karin.lagesen at labmed.uio.no
> _______________________________________________
> BioPython mailing list  -  BioPython at biopython.org
> http://biopython.org/mailman/listinfo/biopython



More information about the BioPython mailing list