Ok. Thank you, Eric.

I appreciate it,

Shubham

 

Sent from Mail for Windows

 

From: Eric Pettersen
Sent: Tuesday, August 2, 2022 5:34
To: Shubham Devesh Ramgoolam
Cc: chimerax-users@cgl.ucsf.edu
Subject: Re: [chimerax-users] Time-efficient python code for obtaining coordinates of atoms

 

Hi Shubham,

First off, 'getcrd' really should return the coordinates in addition to logging them, so I have fixed that and the fix will be in tonight's daily build.

But I don't think that really helps you because atom-spec parsing in ChimeraX is relatively slow, and I assume you would need to provide the same (long) atom spec to getcrd that you were using with "sel".  We want to improve the speed and reliability of atom-spec parsing, but achieving that is quite aways off at this point and so won't help with your current situation.

I assume that which residues you need coordinates from are changing frequently, otherwise the cost of selecting them once wouldn't be that big a deal.  Depending on what criteria you are using to choose the residues, maybe you could loop through chimerax.atomic.all_structures(session).residues and get the coordinates of the residues that meet your criteria.

 

--Eric

 

Eric Pettersen

UCSF Computer Graphics Lab

 



On Aug 1, 2022, at 2:32 AM, Shubham Devesh Ramgoolam via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:

 

Hi all,

I hope you are doing well.

I am looking for a time-efficient way of obtaining the coordinates of specified residues.

I cannot use the command getcrd as I need these coordinates in a python script for defining geometric objects (getcrd prints the output to the log).

 

My attempt at this consisted of selecting all of the specified residues via run(session, ‘sel ...’), accessing that selection using selected_residues(session), and then, extracting the coordinates using .atoms.coords.

The issue here is that run(session, ‘sel ...’) slows down if there are lots of specified residues.

 

I tried bypassing the command ‘sel’ by first importing AtomSpecArg from chimerax.core.commands.atomspec and then using AtomSpecArg.parse('my residue_ID', session)[0].evaluate(session).atoms[0]. However, this is even slower.

 

Regards,

Shubham

 

 

Sent from Mail for Windows

 

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