Thanks Eric,

I will try first with the computeRealignment() method.  Both alignments algorithms seem to work so I'll try Crustal-Omega first. Most likely will have more questions coming.

Eventually we'll try chimera-X which indeed seems like an easier route. However, the problem is that this script is part of a library of scripts and functions that we have built over the years for Chimera (in python 2.7).  Translating all to python 3.0 and the different environment of ChimeraX may be more difficult and time consuming at this time.

Thanks again,

Hernando


From: Eric Pettersen <pett@cgl.ucsf.edu>
Sent: Monday, November 14, 2022 3:04 PM
To: Hernando J Sosa <hernando.sosa@einsteinmed.edu>
Cc: Chimera <chimera-users@cgl.ucsf.edu>
Subject: Re: [Chimera-users] Realign sequences
 
CAUTION: This email comes from an external source; the attachments and/or links may compromise our secure environment. Do not open or click on suspicious emails. Please click on the “Phish Alert” button on the top right of the Outlook dashboard to report any suspicious emails.
Hi Hernando,
So the first thing I want to say is that this is about a thousand times easier in ChimeraX, because the "seq align" command in ChimeraX does this directly.
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 serviceName, inOutFlags, and options arguments of the computeRealignment() method.  You will need to look at the lines above the return statement to find the strings that compose the options value.  Lastly, if you are use Muscle realignment you will have to specify "reordersSequence=True" to the computeRealignment() call.
Good luck! :-)

--Eric

Eric Pettersen
UCSF Computer Graphics Lab

On Nov 12, 2022, at 4:01 PM, Hernando J Sosa via Chimera-users <chimera-users@cgl.ucsf.edu> wrote:


Is there a way to realign sequences already in a multialign window within a python script?  
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. 

I have code that creates the alignment window and then retrieves the instance:

from chimera.extension import manager
from MultAlignViewer.MAViewer import MAViewer

runCommand('mm #0 #1 show true')
mavs = [inst for inst in manager.instances if isinstance(inst, MAViewer)]
mymav = mavs[-1]

I tried then to do something like
mymav.realign()

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.

Any help would be appreciated

Thanks

Hernando


_______________________________________________
Chimera-users mailing list: Chimera-users@cgl.ucsf.edu
Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimera-users