<html><head></head><body><div class="ydpfc7427deyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:10px;"><div></div>
<div dir="ltr" data-setdir="false">All alignments returned by the PairwiseAligner have the same score, and they are all equally good. Same is true for the alignments returned by pairwise2.</div><div dir="ltr" data-setdir="false">So you just pick one of the alignments randomly, e.g. the first one:<br></div><div dir="ltr" data-setdir="false">alignment = alignments[0]</div><div dir="ltr" data-setdir="false">and then get whatever information you want from that alignment. This is essentially the same as what you would get from pairwise2.<br></div><div dir="ltr" data-setdir="false">Note that the alignments, although they all have the same score, can have different number of gaps, matches, mismatches, so your problem may not be well-defined.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Best,</div><div dir="ltr" data-setdir="false">-Michiel<br></div><div><br></div>
</div><div id="yahoo_quoted_4216137685" class="yahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Wednesday, August 14, 2024 at 08:36:39 PM GMT+9, Peter Cock <p.j.a.cock@googlemail.com> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div id="yiv7283132551"><div><div dir="ltr"><div>Hello Slowat,</div><div><br clear="none"></div><div>Are you clear that there can be multiple equally scoring "best" alignments?</div><div>This means the details of how you sort or rank pairwise alignments is</div><div>important (i.e. how to tie-break alignments of the same score) and the</div><div>"best" alignment may differ with usage context.<br clear="none"></div><div><br clear="none"></div><div>Looking at the code in the old pairwise2 module, using one_alignment_only</div><div>simply returns the first alignment - it wasn't immediately obvious to me if</div><div>that would automatically be one of the top scoring alignments or not.<br clear="none"></div><div><br clear="none"></div><div>As far as I could see, the new PairwiseAligner docstring doesn't explicitly</div><div>comment on how the alignments returned are sorted either:<br clear="none"></div><div><br clear="none"></div><div><a rel="nofollow noopener noreferrer" shape="rect" target="_blank" href="https://github.com/biopython/biopython/blob/biopython-184/Bio/Align/__init__.py#L3759">https://github.com/biopython/biopython/blob/biopython-184/Bio/Align/__init__.py#L3759</a></div><div><br clear="none"></div><div>This does need clarification, hopefully Markus or Michiel can comment.<br clear="none"></div><br clear="none"><div>Peter<br clear="none"></div></div><br clear="none"><div class="yiv7283132551gmail_quote"><div id="yiv7283132551yqt76453" class="yiv7283132551yqt1714083257"><div dir="ltr" class="yiv7283132551gmail_attr">On Wed, Aug 14, 2024 at 11:46 AM Slowat <<a rel="nofollow noopener noreferrer" shape="rect" ymailto="mailto:slowat0kela@gmail.com" target="_blank" href="mailto:slowat0kela@gmail.com">slowat0kela@gmail.com</a>> wrote:<br clear="none"></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;" class="yiv7283132551gmail_quote"><div dir="ltr">Hello - <div><br clear="none"></div><div>May I ask. I want to align two sequences, and return, for the optimal alignment only, the score, number of identities, mismatches, gaps etc.</div><div><br clear="none"></div><div>I can see that this is possible by using the 'one_alignment_only=True' parameter in the pairwise2 module, however when I load the pairwise2 module, I get the message that this module is deprecated.</div><div><br clear="none"></div><div>Using Bio.Align, I can see how you can obtain the .score for the best alignment, but not how to obtain the other information I require about the best alignment.</div><div><br clear="none"></div><div>I don't want to loop through all the possible alignments, as this would be prohibitively time-consuming for me. Also, since the .score of the best alignment can be returned, it makes me think that the best alignment should be saved somewhere and I should be able to see it (even to calculate the gaps, identities and mismatches myself).</div><div><br clear="none"></div><div>Could someone explain how to go about this, without using the deprecated pairwise2 module?</div><div><br clear="none"></div><div>Thanks</div><div>Slowat</div></div>
_______________________________________________<br clear="none">
Biopython mailing list - <a rel="nofollow noopener noreferrer" shape="rect" ymailto="mailto:Biopython@biopython.org" target="_blank" href="mailto:Biopython@biopython.org">Biopython@biopython.org</a><br clear="none">
<a rel="nofollow noopener noreferrer" shape="rect" target="_blank" href="https://mailman.open-bio.org/mailman/listinfo/biopython">https://mailman.open-bio.org/mailman/listinfo/biopython</a><br clear="none">
</blockquote></div></div>
</div></div><div class="yqt1714083257" id="yqt10873">_______________________________________________<br clear="none">Biopython mailing list - <a shape="rect" ymailto="mailto:Biopython@biopython.org" href="mailto:Biopython@biopython.org">Biopython@biopython.org</a><br clear="none"><a shape="rect" href="https://mailman.open-bio.org/mailman/listinfo/biopython" target="_blank">https://mailman.open-bio.org/mailman/listinfo/biopython</a><br clear="none"></div></div>
</div>
</div></body></html>