<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:Helvetica;
panose-1:2 11 5 4 2 2 2 2 2 4;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
p.xmsonormal, li.xmsonormal, div.xmsonormal
{mso-style-name:x_msonormal;
margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.xapple-converted-space
{mso-style-name:x_apple-converted-space;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi Anthony,</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I understand it now.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thank you so much for the help,</p>
<p class="MsoNormal">Shubham</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986">
Mail</a> for Windows</p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="border:none;padding:0in"><b>From: </b><a href="mailto:tony.schaefer@uga.edu">Anthony James Schaefer</a><br>
<b>Sent: </b>Thursday, May 26, 2022 19:48<br>
<b>To: </b><a href="mailto:sdramgoolam@uwaterloo.ca">Shubham Devesh Ramgoolam</a><br>
<b>Cc: </b><a href="mailto:chimerax-users@cgl.ucsf.edu">ChimeraX Users Help</a><br>
<b>Subject: </b>Re: [chimerax-users] Coordset command not working in nogui mode</p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Shubham,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">session.models is a manager that keeps track of all the models in your session. You'll want to get a specific atomic structure from session.models. There's a couple ways to do this, but here's
two:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas;color:black"># list all models that are atomic structures</span><span style="font-size:12.0pt;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas;color:black">from chimerax.atomic import AtomicStructure</span><span style="font-size:12.0pt;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas;color:black">session.models.list(type=AtomicStructure)</span><span style="font-size:12.0pt;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas;color:black"># iterate through all models</span><span style="font-size:12.0pt;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas;color:black">for m in session.models:</span><span style="font-size:12.0pt;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas;color:black"> print(m.name, m.atomspec)</span><span style="font-size:12.0pt;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">With either of these, you'll have to pick out which model you want.
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">You should also be able to use the AtomicStructures list that was returned from your first 'open' command. As far as I know, the extra coordinate sets should be added to that structure after you
open the trajectory file.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Best,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Tony<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><img border="0" width="555" height="2" style="width:5.7833in;height:.025in" id="Horizontal_x0020_Line_x0020_1" src="cid:image001.png@01D8713D.484BF1B0"><o:p></o:p></p>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> ChimeraX-users <chimerax-users-bounces@cgl.ucsf.edu> on behalf of Shubham Devesh Ramgoolam via ChimeraX-users <chimerax-users@cgl.ucsf.edu><br>
<b>Sent:</b> Thursday, May 26, 2022 11:17 AM<br>
<b>To:</b> ChimeraX Users Help <chimerax-users@cgl.ucsf.edu><br>
<b>Subject:</b> Re: [chimerax-users] Coordset command not working in nogui mode</span>
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="color:#BA0C2F">[EXTERNAL SENDER - PROCEED CAUTIOUSLY]</span><o:p></o:p></p>
<div>
<div>
<p class="xmsonormal">Hi Eric,</p>
<p class="xmsonormal"> </p>
<p class="xmsonormal">The ‘wait 1’ command is very helpful. Thank you so much!</p>
<p class="xmsonormal"> </p>
<p class="xmsonormal">I have also tried the other method but it is not working for me.</p>
<p class="xmsonormal">{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.}</p>
<p class="xmsonormal"> </p>
<p class="xmsonormal">This is what I got from the Python Shell of ChimeraX:</p>
<p class="xmsonormal"> </p>
<p class="xmsonormal">run(session, 'open '+ r'C:\Users\Shubham\Desktop\SK_Lab\myfile.pdb')</p>
<p class="xmsonormal">Out[3]: [<chimerax.atomic.structure.AtomicStructure at 0x2ef81670040>]</p>
<p class="xmsonormal"> </p>
<p class="xmsonormal">run(session, 'open ' + r'C:\Users\Shubham\Desktop\mycoord.dcd' + ' structureModel #1')</p>
<p class="xmsonormal">Out[4]: []</p>
<p class="xmsonormal"> </p>
<p class="xmsonormal">s = session.models</p>
<p class="xmsonormal"> </p>
<p class="xmsonormal">s</p>
<p class="xmsonormal">Out[6]: <chimerax.core.models.Models at 0x2efc7fece50></p>
<p class="xmsonormal"> </p>
<p class="xmsonormal">s.coordset_ids</p>
<p class="xmsonormal">---------------------------------------------------------------------------</p>
<p class="xmsonormal">AttributeError Traceback (most recent call last)</p>
<p class="xmsonormal">~\AppData\Local\Temp/ipykernel_9612/1923568490.py in <module></p>
<p class="xmsonormal">----> 1 s.coordset_ids</p>
<p class="xmsonormal"> </p>
<p class="xmsonormal">AttributeError: 'Models' object has no attribute 'coordset_ids'</p>
<p class="xmsonormal"> </p>
<p class="xmsonormal"> </p>
<p class="xmsonormal">My goal with this is to get a way to obtain the total number of frames available for the trajectory.</p>
<p class="xmsonormal"> </p>
<p class="xmsonormal">My chimeraX version 1.5.dev202205200152 (2022-05-20).</p>
<p class="xmsonormal"> </p>
<p class="xmsonormal">Regards,</p>
<p class="xmsonormal">Shubham</p>
<p class="xmsonormal"> </p>
<p class="xmsonormal"> </p>
<p class="xmsonormal">Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986">
Mail</a> for Windows</p>
<p class="xmsonormal"> </p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="xmsonormal"><b>From: </b><a href="mailto:pett@cgl.ucsf.edu">Eric Pettersen</a><br>
<b>Sent: </b>Tuesday, May 24, 2022 22:15<br>
<b>To: </b><a href="mailto:sdramgoolam@uwaterloo.ca">Shubham Devesh Ramgoolam</a><br>
<b>Cc: </b><a href="mailto:chimerax-users@cgl.ucsf.edu">chimerax-users@cgl.ucsf.edu</a><br>
<b>Subject: </b>Re: [chimerax-users] Coordset command not working in nogui mode</p>
</div>
<p class="xmsonormal"> </p>
<p class="xmsonormal">Hi Shubham,</p>
<div>
<p class="xmsonormal">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.</p>
</div>
<div>
<p class="xmsonormal">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,
<i>e.g.</i>:</p>
</div>
<div>
<p class="xmsonormal"> </p>
</div>
<div>
<p class="xmsonormal"># if the structure model is in the 's' variable</p>
</div>
<div>
<p class="xmsonormal">for cid in s.coordset_ids:</p>
</div>
<div>
<p class="xmsonormal">s.active_coordset_id = cid</p>
</div>
<div>
<p class="xmsonormal"># do whatever you need to do with this coordset</p>
</div>
<div>
<p class="xmsonormal"> </p>
</div>
<div>
<div>
<p class="xmsonormal">--Eric</p>
</div>
<div>
<p class="xmsonormal"> </p>
</div>
<div>
<p class="xmsonormal">Eric Pettersen</p>
</div>
<div>
<p class="xmsonormal">UCSF Computer Graphics Lab</p>
</div>
</div>
<div>
<p class="xmsonormal"> </p>
<div>
<p class="xmsonormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="xmsonormal">On May 24, 2022, at 1:22 AM, Shubham Devesh Ramgoolam via ChimeraX-users <<a href="mailto:chimerax-users@cgl.ucsf.edu">chimerax-users@cgl.ucsf.edu</a>> wrote:</p>
</div>
<p class="xmsonormal"> </p>
<div>
<div>
<p class="xmsonormal">Hi all,</p>
</div>
<div>
<p class="xmsonormal">I hope you are doing well.</p>
</div>
<div>
<p class="xmsonormal"> </p>
</div>
<div>
<p class="xmsonormal">I have a python script for measuring the distance between aromatic rings of specific residues for different frames of a trajectory.</p>
</div>
<div>
<p class="xmsonormal">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.</p>
</div>
<div>
<p class="xmsonormal">To navigate between frames, I am using the command ‘coordset #1 {desired frame}’.</p>
</div>
<div>
<p class="xmsonormal"> </p>
</div>
<div>
<p class="xmsonormal">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.</p>
</div>
<div>
<p class="xmsonormal"> </p>
</div>
<div>
<p class="xmsonormal">In gui mode, the script only works if a delay is created between changing the frame and defining the new centroids.</p>
</div>
<div>
<p class="xmsonormal">I introduced that delay by asking for a dummy user input (I ran the script from python Shell):</p>
</div>
<div>
<p class="xmsonormal" style="text-indent:.5in">run(session, 'coordset #1 ' + {new_frame})</p>
</div>
<div>
<p class="xmsonormal" style="text-indent:.5in">y = input('dummy')</p>
</div>
<div>
<p class="xmsonormal" style="text-indent:.5in">run (session, 'define centroid /A:8 & aromatic-ring radius 0.3 color yellow mass false name d1’)</p>
</div>
<div>
<p class="xmsonormal"> </p>
</div>
<div>
<p class="xmsonormal">My chimeraX version: 1.4rc202205060510 (2022-05-06)</p>
</div>
<div>
<p class="xmsonormal"> </p>
</div>
<div>
<p class="xmsonormal">Should I be using a different command for changing frames of trajectories when in nogui mode?</p>
</div>
<div>
<p class="xmsonormal"> </p>
</div>
<div>
<p class="xmsonormal">Regards,</p>
</div>
<div>
<p class="xmsonormal">Shubham</p>
</div>
<p class="xmsonormal"> <span class="xapple-converted-space"> </span></p>
<div>
<p class="xmsonormal"> </p>
</div>
<div>
<p class="xmsonormal">Sent from<span class="xapple-converted-space"> </span><a href="https://go.microsoft.com/fwlink/?LinkId=550986">Mail</a><span class="xapple-converted-space"> </span>for Windows</p>
</div>
<div>
<p class="xmsonormal"> </p>
</div>
<p class="xmsonormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">_______________________________________________<br>
ChimeraX-users mailing list<br>
</span><a href="mailto:ChimeraX-users@cgl.ucsf.edu"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">ChimeraX-users@cgl.ucsf.edu</span></a><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><br>
Manage subscription:<br>
</span><a href="https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users</span></a></p>
</div>
</blockquote>
</div>
</div>
<p class="xmsonormal"> </p>
</div>
</div>
</div>
<p class="xmsonormal"> </p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>