Perfect! Thank you very much Eric.

All the best,

Isabel

From: Eric Pettersen <pett@cgl.ucsf.edu>
Sent: Monday, May 30, 2022 23:58
To: Moya Clark, I.O. de (Isabel) <i.o.demoyaclark@students.uu.nl>
Cc: ChimeraX Users Help <chimerax-users@cgl.ucsf.edu>
Subject: Re: [chimerax-users] ChimeraX - XMAS pluggin modification questions
 
You don't often get email from pett@cgl.ucsf.edu. Learn why this is important
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@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@students.uu.nl>
Sent: Tuesday, April 26, 2022 10:23
To: ChimeraX Users Help <chimerax-users@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@cgl.ucsf.edu>
Sent: Monday, April 25, 2022 18:23
To: Moya Clark, I.O. de (Isabel) <i.o.demoyaclark@students.uu.nl>
Cc: chimerax-users@cgl.ucsf.edu <chimerax-users@cgl.ucsf.edu>
Subject: Re: [chimerax-users] ChimeraX - XMAS pluggin modification questions
 
You don't often get email from pett@cgl.ucsf.edu. Learn why this is important
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@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@cgl.ucsf.edu
Manage subscription:
https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users

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