[chimerax-users] ChimeraX Bundle
Tom Goddard
goddard at sonic.net
Wed Aug 25 11:01:25 PDT 2021
Hi Mirko,
I don't totally understand the details of what you need, but here's some info. If you rotate a selected model using the "Rotate model" mouse mode then its position matrix changes. First Python to get the list of selected models is
session.selection.models()
If it is a volume (ie map) model that got rotated then I could find the selected volumes like this
from chimerax.map import Volume
volumes = [v for v in session.selection.models() if isinstance(v, Volume)]
And if I wanted to print their 3x4 position matrices (first 3 columns are the rotation, 4th column is a translation done after rotation)
for v in volumes:
print (v.position.matrix)
Now I don't know what you mean by "update the rotation angles". Are you trying to record Euler angles? If so you could get the Euler angles in z-x-z convention like this
from chimerax.geometry.matrix import euler_angles
for v in volumes:
alpha, beta, gamma = euler_angles(v.position.matrix) # Angles in degrees
print ('Volume %s Euler angles %.2f %.2f %.2f degrees (z-x-z convention)' % (v.name_with_id(), alpha, beta, gamma)
In Chimera the openModels object holds the list of models. In ChimeraX this is session.models. For example to show the names of all models:
for m in session.models.list():
print ('#' + m.id_string + ' ' + m.name)
The programmer documentation
https://www.cgl.ucsf.edu/chimerax/docs/devel/index.html <https://www.cgl.ucsf.edu/chimerax/docs/devel/index.html>
has info about the various ChimeraX functions, for instance for models
https://www.cgl.ucsf.edu/chimerax/docs/devel/core/models.html <https://www.cgl.ucsf.edu/chimerax/docs/devel/core/models.html>
There is some example Python code at the ChimeraX recipes web site that can be useful.
https://rbvi.github.io/chimerax-recipes/
Back in March 2021 I was talking with Matthias Vorlander to place a subtomogram average at positions in a tomogram given by a Relion STAR file.
https://www.rbvi.ucsf.edu/pipermail/chimerax-users/2021-March/002093.html
I've attached the code we came up with. Maybe that will be useful to you.
I am happy to answer more programming questions. Keep sending them to this list unless you want to send private data in which case you can send directly to me.
Tom
> On Aug 24, 2021, at 11:35 PM, Mirko Plößer via ChimeraX-users <chimerax-users at cgl.ucsf.edu> wrote:
>
>
> Dear ChimeraX Team,
>
> my name is Mirko Ploesser, I am a Phd student in the Frankgakis group at the BMLS (Buchmann Institue for Molecular Life Sciences) in Frankfurt (Germany) and currently working on a ChimeraX bundle. Thanks to your detailed tutorial on how to develop bundles, I have already made a good progeress in doing so. Currently, however, I am stuck with a problem that I hanve't found a solution to yet. I would be very thankful if you could give me advice on how to progress.
>
> The problem is described as follows:
> I click a set of markers in a volume (tomogram as an EM file) and save the corresponding positions. At those positions I want to load different and smaller volumes (also EM Files). The information about those smaller volumes - position and rotation - I have saved in a different file (a motivelist in also an EM format). Now I am stuck with the problem on how to update the rotation angles when I use the tool "Rotate model" using the right mouse. I know that the corresponding rotation matrix is printed in the log. Is there any way that I can use the information given to the log in my bundle code?
>
> Also, since we already have a working version of the bundle in Chimera, I found the module "openModel" very useful. Unfortunately I haven't been able to find an equivalent module in ChimeraX. So I guess there is a different approach to this used in ChimeraX. I would be very happy if you could also help me out in this regard.
>
> Thank you very much in advance for your time and effort.
> I am looking forward to hearing from you soon.
>
> Best,
> Mirko Ploesser
> _______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimerax-users/attachments/20210825/8dced117/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: relioncopies.py
Type: text/x-python-script
Size: 4383 bytes
Desc: not available
URL: <http://plato.cgl.ucsf.edu/pipermail/chimerax-users/attachments/20210825/8dced117/attachment.bin>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimerax-users/attachments/20210825/8dced117/attachment-0001.html>
More information about the ChimeraX-users
mailing list