[chimerax-users] ChimeraX - XMAS pluggin modification questions

Moya Clark, I.O. de (Isabel) i.o.demoyaclark at students.uu.nl
Tue May 31 02:56:45 PDT 2022


Perfect! Thank you very much Eric.

All the best,

Isabel
________________________________
From: Eric Pettersen <pett at cgl.ucsf.edu>
Sent: Monday, May 30, 2022 23:58
To: Moya Clark, I.O. de (Isabel) <i.o.demoyaclark at students.uu.nl>
Cc: ChimeraX Users Help <chimerax-users at cgl.ucsf.edu>
Subject: Re: [chimerax-users] ChimeraX - XMAS pluggin modification questions

You don't often get email from pett at cgl.ucsf.edu. Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>
Hi Isabel,
You add attributes to pseudobonds simply by setting an attribute on the pseudobonds.  For example, if you have a pseudobond group named 'pbg' and wanted to set a "likelihood" attribute on each of them to 1:

for pb in pbg.pseudobonds:
pb.likelihood = 1

The session-saving mechanism does not know about attributes created this way, but you can alert it about the attribute by "registering" it.  Each atomic class has a register_attr(session, attr_name, registerer) method.  The attr_name should be a string containing the attribute name, The registerer argument should identify the source of the registration, usually the bundle the registration comes from, which is used to compose reasonably informative error messages when there is a registration conflict for the same attribute.  So in your case the registration might be:

from chimerax.atomic import PseudoBond
PseudoBond.register_attr(session, "likelihood", "XMAS")

register_attr() accepts two optional keyword arguments.  'attr_type' can be provided with an argument of a built-in type (e.g. int, float, str) that values of the attribute should all be.  'can_return_none' should be set to True if None is also a valid value for the attribute (defaults to False).

--Eric

On May 30, 2022, at 6:12 AM, Moya Clark, I.O. de (Isabel) via ChimeraX-users <chimerax-users at cgl.ucsf.edu<mailto:chimerax-users at cgl.ucsf.edu>> wrote:

Dear Eric,

I had a question regarding Pseudobonds in ChimeraX. I was wondering if there is a way to add an attribute to pseudobond. Let’s say you have a group of pseudobonds for a model, how can I add an attribute to each individual pseudobond (for example the likelihood of each pseudobond)? Also, how can I do it in a way that this attribute stays saved in the session?

I hope you are having a good day,

Kind regards,

Isabel de Moya Clark

________________________________
From: Moya Clark, I.O. de (Isabel) <i.o.demoyaclark at students.uu.nl<mailto:i.o.demoyaclark at students.uu.nl>>
Sent: Tuesday, April 26, 2022 10:23
To: ChimeraX Users Help <chimerax-users at cgl.ucsf.edu<mailto:chimerax-users at cgl.ucsf.edu>>
Subject: Re: [chimerax-users] ChimeraX - XMAS pluggin modification questions

Good morning Eric,

Thank you very much for the information. I'll take a look at it and see if I can make it work.

I hope you have a good week,

Kind regards,

Isabel de Moya Clark
________________________________
From: Eric Pettersen <pett at cgl.ucsf.edu<mailto:pett at cgl.ucsf.edu>>
Sent: Monday, April 25, 2022 18:23
To: Moya Clark, I.O. de (Isabel) <i.o.demoyaclark at students.uu.nl<mailto:i.o.demoyaclark at students.uu.nl>>
Cc: chimerax-users at cgl.ucsf.edu<mailto:chimerax-users at cgl.ucsf.edu> <chimerax-users at cgl.ucsf.edu<mailto:chimerax-users at cgl.ucsf.edu>>
Subject: Re: [chimerax-users] ChimeraX - XMAS pluggin modification questions

You don't often get email from pett at cgl.ucsf.edu<mailto:pett at cgl.ucsf.edu>. Learn why this is important<http://aka.ms/LearnAboutSenderIdentification>
Hi Isabel,
Yes, CoordSets are the way to go.  Assuming you want to extract these distances without necessarily playing through the trajectory/morph, the plan would be:

(1) Get the coordinate set IDs from the structure
(2) Loop through IDs to get coordinate sets
(3) For each set, compute the distance

If your structure was in a variable named 's' and the atoms you wanted to measure the distance between were 'a1' and 'a2' then the code would be:

a1_index = a1.coord_index
a2_index = a2.coord_index
from chimerax.geometry import distance
for cid in s.coordset_ids:
cs = s.coordset(cid)
d = distance(cs[a1_index], cs[a2_index])
do something with the 'd' you just computed

Glad to hear you are going to continue improving the already excellent XMAS bundle!

--Eric

Eric Pettersen
UCSF Computer Graphics Lab


On Apr 25, 2022, at 3:12 AM, Moya Clark, I.O. de (Isabel) via ChimeraX-users <chimerax-users at cgl.ucsf.edu<mailto:chimerax-users at cgl.ucsf.edu>> wrote:

Good morning,

I am a student intern at the Richard Scheltema Laboratory, and I am going to be continuing with the modification of the XMAS bundle submitted to ChimeraX recently.

Right now, we are trying to extend the bundle to be able to extract specific distances between specific amino acids for two different proteins but for a molecular dynamics simulation. Either by loading a trajectory coordinates + topology files or by using the “morph” command and then “coordset slider”.

So, the idea would be to extract the distances between the alpha carbons, of a set of pre-selected amino acids, in each frame of the simulation. Do you have any suggestions about any modules or methods that I should look into to extract this information in each frame? I saw there is a CooordSets class but I do not know if this would be the right way to go about it.

Kind regards,

Isabel de Moya Clark

_______________________________________________
ChimeraX-users mailing list
ChimeraX-users at cgl.ucsf.edu<mailto:ChimeraX-users at cgl.ucsf.edu>
Manage subscription:
https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users

_______________________________________________
ChimeraX-users mailing list
ChimeraX-users at cgl.ucsf.edu<mailto: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://www.rbvi.ucsf.edu/pipermail/chimerax-users/attachments/20220531/c51236ea/attachment-0001.html>


More information about the ChimeraX-users mailing list