Opened 3 years ago

Closed 3 years ago

#6947 closed enhancement (fixed)

Make coordset act immediately if a single frame specified

Reported by: sdramgoolam@… Owned by: Tom Goddard
Priority: moderate Milestone:
Component: MD/Ensemble Analysis Version:
Keywords: Cc: Elaine Meng, pett
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description (last modified by Tom Goddard)

Using the coordset in a script to jump to a specific coordinate set does not take effect until a frame is drawn with a wait command. This is confusing. Better if jumping to a single coordinate set happens immediately.

Begin forwarded message:

From: Eric Pettersen via ChimeraX-users <chimerax-users@…>
Subject: Re: [chimerax-users] Coordset command not working in nogui mode
Date: May 24, 2022 at 11:15:06 AM PDT
To: Shubham Devesh Ramgoolam
Cc: "chimerax-users@…" <chimerax-users@…>

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@…> 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

Change History (2)

comment:1 by Tom Goddard, 3 years ago

Description: modified (diff)

comment:2 by Tom Goddard, 3 years ago

Resolution: fixed
Status: assignedclosed

Done.

In the rare case where you want coordset to jump to a single coordinate set id but wait for graphics, specify start,end,step for example coordset #1 3,3,1.

Note: See TracTickets for help on using tickets.