This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Biopython pairwise2 alignment: is one_alignment the best alignment?

I started using pairwise2.align function from Biopyton with the one_alignment set to True. I was wondering if that single alignment returned is the best one. With Smith-Waterman it should be but I'm not sure if that's what's been implemented.

biopython alignment

1 answer

There may be multiple pairwise alignments that have the same optimal score with respect to gap penalty and match scoring. The function just returns the first it finds during the traceback of the dynamic programming matrix rather than returning all of them.

From the following link, several paragraphs down, you will find this quote:

"Our variable alignments now contains a list of alignments (at least one) which have the same optimal score for the given conditions."

http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc86

More concretely, you can check the source code. The function you are interested in is _recover_alignments, where the parameter one_alignment_only is put to use.

http://biopython.org/DIST/docs/api/Bio.pairwise2-pysrc.html

Log in to answer this question.