[Chimera-users] Realign sequences
Eric Pettersen
pett at cgl.ucsf.edu
Tue Nov 15 10:51:05 PST 2022
Ah, need to add a call to get the background task callback to occur. After the sleep() call add:
from chimera import tkgui
tkgui.app.update()
--Eric
> On Nov 15, 2022, at 8:46 AM, Hernando J Sosa via Chimera-users <chimera-users at cgl.ucsf.edu> wrote:
>
> Hi Eric,
>
> With these instructions now the program hangs after the computeRealignment() call. I am running the script though idle, Not sure if this would be part of the problem ?? I checked that
> mgr.active_task_count()
> return a value of zero before the computeRealignment() call and 1 after. but the script hangs there
>
> Thanks
>
> Hernando
>
> From: Eric Pettersen <pett at cgl.ucsf.edu <mailto:pett at cgl.ucsf.edu>>
> Sent: Monday, November 14, 2022 6:43 PM
> To: Hernando J Sosa <hernando.sosa at einsteinmed.edu <mailto:hernando.sosa at einsteinmed.edu>>
> Cc: chimera-users at cgl.ucsf.edu <mailto:chimera-users at cgl.ucsf.edu> <chimera-users at cgl.ucsf.edu <mailto:chimera-users at 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.
> Oh yeah, it's even worse that I thought. The problem is that the realignment job executes in the background, so your script continues on while the job is still running, so therefore you are getting the original association info. Unlike ChimeraX, there is no way to tell computeRealignment() to not return until the job finishes.
>
> The only option that occurs to me is for you to monitor the job to see when it finishes. Before you call computeRealignment(), do this:
>
> from chimera.tasks import manager
> mgr = manager()
> num_jobs = mgr.active_task_count() # should be zero unless your script is running other jobs
>
> ...call computeRealignment()
>
> from time import sleep
> while mgr.active_task_count() == num_jobs + 1:
> sleep(1)
>
> ...save association info
>
> --Eric
>
>> On Nov 14, 2022, at 3:16 PM, Hernando J Sosa via Chimera-users <chimera-users at cgl.ucsf.edu <mailto:chimera-users at cgl.ucsf.edu>> wrote:
>>
>> Hi Eric
>>
>> Using the following argument works:
>>
>> mav.computeRealignment("ClustalOmegaService", ("-i", "-o"),'--full')
>>
>> However, saving the corresponding association file using:
>>
>> mav.saveAssocInfo('myassocfile.txt')
>>
>> I get a file different from the one I get using the Multialign Viewer window menu
>> MultialignViewer->File->Save Assoc Info...
>>
>> The saveAssocInfo statement is after the computeRealignment statement but perhaps for some reason I'm getting the association file corresponding to the first alignment ???
>>
>>
>> Thanks for any help on this issue.
>>
>> Best
>>
>> Hernando
>>
>>
>>
>> ___________________________________
>> Hernando Sosa
>> Dept. of Biochemistry
>> Albert Einstein College of Medicine
>> 1300 Morris Park Av.
>> Bronx NY 10461
>> phone (718) 430-3456
>> emai: hernando.sosa at einsteinmed. <mailto:hernando.sosa at einsteinmed.org>edu
>> ___________________________________
>>
>>
>>
>> From: Chimera-users <chimera-users-bounces at cgl.ucsf.edu <mailto:chimera-users-bounces at cgl.ucsf.edu>> on behalf of Hernando J Sosa via Chimera-users <chimera-users at cgl.ucsf.edu <mailto:chimera-users at cgl.ucsf.edu>>
>> Sent: Monday, November 14, 2022 4:25 PM
>> To: chimera-users at cgl.ucsf.edu <mailto:chimera-users at cgl.ucsf.edu> List <chimera-users at cgl.ucsf.edu <mailto:chimera-users at 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.
>> 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 at cgl.ucsf.edu <mailto:pett at cgl.ucsf.edu>>
>> Sent: Monday, November 14, 2022 3:04 PM
>> To: Hernando J Sosa <hernando.sosa at einsteinmed.edu <mailto:hernando.sosa at einsteinmed.edu>>
>> Cc: Chimera <chimera-users at cgl.ucsf.edu <mailto:chimera-users at 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 <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Fchimerax%2Fdocs%2Fuser%2Fcommands%2Fsequence.html%23align&data=05%7C01%7Chernando.sosa%40einsteinmed.edu%7Ca4e9c4da2fbc426ea96508dac699ff47%7C9c01f0fd65e040c089a82dfd51e62025%7C0%7C0%7C638040661992821972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=7D8capYxHlZ02%2B0k9PDxnyQKAZRtYLOxxAxRqjGJGok%3D&reserved=0> 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 at cgl.ucsf.edu <mailto:chimera-users at 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 at cgl.ucsf.edu <mailto:Chimera-users at cgl.ucsf.edu>
>>> Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimera-users <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Fmailman%2Flistinfo%2Fchimera-users&data=05%7C01%7Chernando.sosa%40einsteinmed.edu%7Ca4e9c4da2fbc426ea96508dac699ff47%7C9c01f0fd65e040c089a82dfd51e62025%7C0%7C0%7C638040661992821972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=IfGcSeWPTzdq7YxyWGCPcpo%2BjjemX3z%2BRF5PvWvo7Yg%3D&reserved=0>
>> _______________________________________________
>> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu <mailto:Chimera-users at cgl.ucsf.edu>
>> Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimera-users <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Fmailman%2Flistinfo%2Fchimera-users&data=05%7C01%7Chernando.sosa%40einsteinmed.edu%7Ca4e9c4da2fbc426ea96508dac699ff47%7C9c01f0fd65e040c089a82dfd51e62025%7C0%7C0%7C638040661992821972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=IfGcSeWPTzdq7YxyWGCPcpo%2BjjemX3z%2BRF5PvWvo7Yg%3D&reserved=0>
> _______________________________________________
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu <mailto:Chimera-users at cgl.ucsf.edu>
> Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimera-users <https://www.rbvi.ucsf.edu/mailman/listinfo/chimera-users>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.rbvi.ucsf.edu/pipermail/chimera-users/attachments/20221115/7d72b280/attachment.html>
More information about the Chimera-users
mailing list