<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Hernando,<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>So the first thing I want to say is that this is about a thousand times easier in ChimeraX, because the <a href="https://www.rbvi.ucsf.edu/chimerax/docs/user/commands/sequence.html#align" class="">"seq align" command</a> in ChimeraX does this directly.</div><div class=""><div><span class="Apple-tab-span" style="white-space:pre"> </span>At any rate, you would use the computeRealignment() method rather than the realign() method (the latter is for when you already have the realigned sequence in hand). Getting the right argument values will be somewhat challenging. Depending on what realignment method you want to use, you will need to look at either Muscle.py or ClustalOmega.py in the MultAlignViewer folder to find the appropriate values. In particular, look at the return value of the get() method in those files. It returns a (service name, in/out flag strings, option strings) tuple. Those correspond directly to the <i class="">serviceName</i><span style="font-style: normal;" class="">, </span><i class="">inOutFlags</i><span style="font-style: normal;" class="">, and </span><i class="">options</i><span style="font-style: normal;" class=""> arguments of the computeRealignment() method. You will need to look at the lines above the return statement to find the strings that compose the </span><i class="">options</i> value. Lastly, if you are use Muscle realignment you will have to specify "reordersSequence=True" to the computeRealignment() call.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Good luck! :-)</div><div><br class=""></div><div><div>--Eric</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Eric Pettersen</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>UCSF Computer Graphics Lab</div><div><br class=""></div><blockquote type="cite" class=""><div class="">On Nov 12, 2022, at 4:01 PM, Hernando J Sosa via Chimera-users <<a href="mailto:chimera-users@cgl.ucsf.edu" class="">chimera-users@cgl.ucsf.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);"><br class="Apple-interchange-newline">Is there a way to realign sequences already in a multialign window within a python script? <span class="Apple-converted-space"> </span><br class=""></div><div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);">I want to do this because the first alignment dome using matchmaker in many cases contains mismatches to the aligned structures. Using the realign option in the menu fixes the problem but I want to do this within a script. <br class=""></div><div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);"><br class=""></div><div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);">I have code that creates the alignment window and then retrieves the instance:</div><div class="ContentPasted3 elementToProof ContentPasted0" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);"><br class=""></div><div class="ContentPasted3 elementToProof ContentPasted0" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);">from chimera.extension import manager<div class="ContentPasted3">from MultAlignViewer.MAViewer import MAViewer</div><div class="ContentPasted3"><br class=""></div><div class="ContentPasted4 ContentPasted3">runCommand('mm #0 #1 show true')<br class=""></div><div class="ContentPasted3">mavs = [inst for inst in manager.instances if isinstance(inst, MAViewer)]</div><div class="ContentPasted5 ContentPasted3">mymav = mavs[-1]</div><div class="ContentPasted5 ContentPasted3"><br class=""></div><div class="ContentPasted5 ContentPasted3">I tried then to do something like</div><div class="ContentPasted5 ContentPasted3">mymav.realign()</div><div class="ContentPasted5 ContentPasted3"><br class=""></div><div class="ContentPasted5 ContentPasted3">However, I don't know what parameters to put in the realign function, or whether this is the right function to use or whether there is a better way to do this.</div><div class="ContentPasted5 ContentPasted3"><br class=""></div><div class="ContentPasted5 ContentPasted3">Any help would be appreciated<br class=""></div><div class="ContentPasted5 ContentPasted3"><br class=""></div><div class="ContentPasted5 ContentPasted3">Thanks</div><div class="ContentPasted5 ContentPasted3"><br class=""></div><div class="ContentPasted5 ContentPasted3">Hernando<br class=""></div><br class=""></div><div class="ContentPasted2 elementToProof ContentPasted0" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);"></div><div class="elementToProof ContentPasted1 ContentPasted0" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);"><br class=""></div><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Chimera-users mailing list:<span class="Apple-converted-space"> </span></span><a href="mailto:Chimera-users@cgl.ucsf.edu" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">Chimera-users@cgl.ucsf.edu</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Manage subscription:<span class="Apple-converted-space"> </span></span><a href="https://www.rbvi.ucsf.edu/mailman/listinfo/chimera-users" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://www.rbvi.ucsf.edu/mailman/listinfo/chimera-users</a></div></blockquote></div><br class=""></div></body></html>