[chimerax-users] Coordset command not working in nogui mode

Shubham Devesh Ramgoolam sdramgoolam at uwaterloo.ca
Thu May 26 08:17:17 PDT 2022


Hi Eric,

The ‘wait 1’ command is very helpful. Thank you so much!

I have also tried the other method but it is not working for me.
{Some background: My topology file was in prmtop format while my coordinate file was in dcd format. So, I opened both files in chimera and then saved the trajectory as a pdb. I am now using a combination of the pdb file and the dcd coordinate file in chimeraX.}

This is what I got from the Python Shell of ChimeraX:

run(session, 'open '+ r'C:\Users\Shubham\Desktop\SK_Lab\myfile.pdb')
Out[3]: [<chimerax.atomic.structure.AtomicStructure at 0x2ef81670040>]

run(session, 'open ' + r'C:\Users\Shubham\Desktop\mycoord.dcd' + ' structureModel #1')
Out[4]: []

s = session.models

s
Out[6]: <chimerax.core.models.Models at 0x2efc7fece50>

s.coordset_ids
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_9612/1923568490.py in <module>
----> 1 s.coordset_ids

AttributeError: 'Models' object has no attribute 'coordset_ids'


My goal with this is to get a way to obtain the total number of frames available for the trajectory.

My chimeraX version 1.5.dev202205200152 (2022-05-20).

Regards,
Shubham


Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows

From: Eric Pettersen<mailto:pett at cgl.ucsf.edu>
Sent: Tuesday, May 24, 2022 22:15
To: Shubham Devesh Ramgoolam<mailto:sdramgoolam at uwaterloo.ca>
Cc: chimerax-users at cgl.ucsf.edu<mailto:chimerax-users at cgl.ucsf.edu>
Subject: Re: [chimerax-users] Coordset command not working in nogui mode

Hi Shubham,
Since the "coordset" command sets up playback of coordinate frames, it doesn't actually do anything until a frame is drawn, which is why in nogui mode nothing changes, and why you have to "create a delay" in GUI mode.  You can force a frame to get drawn with the "wait 1" command, which will get your script working in both modes.
Alternatively, if you have the structure model in a variable (i.e. from the list of models returned by the 'open' command, or culled from session.models), you can change the coordset directly, e.g.:

# if the structure model is in the 's' variable
for cid in s.coordset_ids:
s.active_coordset_id = cid
# do whatever you need to do with this coordset

--Eric

Eric Pettersen
UCSF Computer Graphics Lab



On May 24, 2022, at 1:22 AM, Shubham Devesh Ramgoolam via ChimeraX-users <chimerax-users at cgl.ucsf.edu<mailto:chimerax-users at cgl.ucsf.edu>> wrote:

Hi all,
I hope you are doing well.

I have a python script for measuring the distance between aromatic rings of specific residues for different frames of a trajectory.
To measure the distance, I am first defining centroids at the center of aromatic rings and then use the command distance. This process is repeated for each frame to be analyzed.
To navigate between frames, I am using the command ‘coordset #1 {desired frame}’.

When executing the script in no gui mode, the centroids are always defined with respect to the residue’s location in frame 1 even though the command coordset has changed the frame.

In gui mode, the script only works if a delay is created between changing the frame and defining the new centroids.
I introduced that delay by asking for a dummy user input (I ran the script from python Shell):
run(session, 'coordset #1 ' + {new_frame})
y = input('dummy')
run (session, 'define centroid /A:8 & aromatic-ring radius 0.3 color yellow mass false name d1’)

My chimeraX version: 1.4rc202205060510 (2022-05-06)

Should I be using a different command for changing frames of trajectories when in nogui mode?

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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.rbvi.ucsf.edu/pipermail/chimerax-users/attachments/20220526/604fc9f7/attachment.html>


More information about the ChimeraX-users mailing list