<div dir="ltr"><div>Oh good. We can probably add a line to the new pairwise aligner docstring</div><div>saying that then - e.g.</div><div><br></div><div>"All the alignments returned will have the same score, but differ in the number</div><div>of gaps, matches and mismatches, and are listed in an unspecified order."<br></div><div><br></div><div>Peter<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 14, 2024 at 1:48 PM Michiel de Hoon <<a href="mailto:mjldehoon@yahoo.com">mjldehoon@yahoo.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:10px"><div></div>
<div dir="ltr">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">So you just pick one of the alignments randomly, e.g. the first one:<br></div><div dir="ltr">alignment = alignments[0]</div><div dir="ltr">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">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"><br></div><div dir="ltr">Best,</div><div dir="ltr">-Michiel<br></div><div><br></div>
</div><div id="m_1025144524552420169yahoo_quoted_4216137685">
<div style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;color:rgb(38,40,42)">
<div>
On Wednesday, August 14, 2024 at 08:36:39 PM GMT+9, Peter Cock <<a href="mailto:p.j.a.cock@googlemail.com" target="_blank">p.j.a.cock@googlemail.com</a>> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div id="m_1025144524552420169yiv7283132551"><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" href="https://github.com/biopython/biopython/blob/biopython-184/Bio/Align/__init__.py#L3759" target="_blank">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><div id="m_1025144524552420169yiv7283132551yqt76453"><div dir="ltr">On Wed, Aug 14, 2024 at 11:46 AM Slowat <<a rel="nofollow noopener noreferrer" shape="rect" href="mailto:slowat0kela@gmail.com" target="_blank">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"><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" href="mailto:Biopython@biopython.org" target="_blank">Biopython@biopython.org</a><br clear="none">
<a rel="nofollow noopener noreferrer" 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">
</blockquote></div></div>
</div></div><div id="m_1025144524552420169yqt10873">_______________________________________________<br clear="none">Biopython mailing list - <a shape="rect" href="mailto:Biopython@biopython.org" target="_blank">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></div></blockquote></div>