[chimerax-users] Time-efficient python code for obtaining coordinates of atoms
Eric Pettersen
pett at cgl.ucsf.edu
Mon Aug 1 18:34:43 PDT 2022
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 at 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 <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows
>
> _______________________________________________
> 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 <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/20220801/ba61b2d7/attachment.html>
More information about the ChimeraX-users
mailing list