superimpose models from inside a python script and access the transformation matrix

Hi there, I'm trying to superimpose two models from inside a python script and get back the transformation matrix. I know I can do something like chimera.runCommand("match #1 #0 showMatrix true") but then the matrix is written to the ReplyLog. (Of course I could save the ReplyLog and then read it in from my script to access the matrix, but that seems quite cumbersome.) Is there a better way to do this? Cheers, Maik

Hi Maik, I don't know of a non-cumbersome way. If you are adept at Python programming, the function that the match command calls is Midas.match(), defined in that module's __init__.py file, and you could lift the code that does the match and computes the matrix from there. The Midas module is found in <your Chimera installation>/share/Midas on Windows/Linux and in Chimera.app/Contents/Resources/share/Midas on Mac. --Eric Eric Pettersen UCSF Computer Graphics Lab
On Oct 5, 2021, at 6:35 AM, Engeholm, Maik via Chimera-users <chimera-users@cgl.ucsf.edu> wrote:
Hi there,
I'm trying to superimpose two models from inside a python script and get back the transformation matrix. I know I can do something like
chimera.runCommand("match #1 #0 showMatrix true")
but then the matrix is written to the ReplyLog. (Of course I could save the ReplyLog and then read it in from my script to access the matrix, but that seems quite cumbersome.) Is there a better way to do this?
Cheers,
Maik
_______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu <mailto:Chimera-users@cgl.ucsf.edu> Manage subscription: https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users <https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users>

ChimeraX is much better than Chimera at giving you results from commands in Python. For instance, in ChimeraX open 1a0m open 1a0m Then using ChimeraX Python shell (menu Tools / General / Shell): from chimerax.core.commands import run results = run(session, 'match #1/A to #2/B') t = results[0]['transformation matrix'] t.matrix -> array([[ -0.31727375, -0.30378517, -0.8983607 , 27.04037902], [ -0.31084291, 0.92828353, -0.20412344, 2.9200737 ], [ 0.89594311, 0.21448605, -0.38894946, -10.81923792]]) Tom
On Oct 6, 2021, at 9:18 AM, Eric Pettersen via Chimera-users <chimera-users@cgl.ucsf.edu> wrote:
Hi Maik, I don't know of a non-cumbersome way. If you are adept at Python programming, the function that the match command calls is Midas.match(), defined in that module's __init__.py file, and you could lift the code that does the match and computes the matrix from there. The Midas module is found in <your Chimera installation>/share/Midas on Windows/Linux and in Chimera.app/Contents/Resources/share/Midas on Mac.
--Eric
Eric Pettersen UCSF Computer Graphics Lab
On Oct 5, 2021, at 6:35 AM, Engeholm, Maik via Chimera-users <chimera-users@cgl.ucsf.edu <mailto:chimera-users@cgl.ucsf.edu>> wrote:
Hi there,
I'm trying to superimpose two models from inside a python script and get back the transformation matrix. I know I can do something like
chimera.runCommand("match #1 #0 showMatrix true")
but then the matrix is written to the ReplyLog. (Of course I could save the ReplyLog and then read it in from my script to access the matrix, but that seems quite cumbersome.) Is there a better way to do this?
Cheers,
Maik
_______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu <mailto:Chimera-users@cgl.ucsf.edu> Manage subscription: https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users <https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users>
Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
participants (3)
-
Engeholm, Maik
-
Eric Pettersen
-
Tom Goddard