<html 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)">
<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;}
/* 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;}
span.apple-converted-space
{mso-style-name: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 Eric,</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The ‘wait 1’ command is very helpful. Thank you so much!</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I have also tried the other method but it is not working for me.</p>
<p class="MsoNormal"></p>
<p class="MsoNormal">{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="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">This is what I got from the Python Shell of ChimeraX:</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">run(session, 'open '+ r'C:\Users\Shubham\Desktop\SK_Lab\myfile.pdb')</p>
<p class="MsoNormal">Out[3]: [<chimerax.atomic.structure.AtomicStructure at 0x2ef81670040>]</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">run(session, 'open ' + r'C:\Users\Shubham\Desktop\mycoord.dcd' + ' structureModel #1')</p>
<p class="MsoNormal">Out[4]: []</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">s = session.models</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">s</p>
<p class="MsoNormal">Out[6]: <chimerax.core.models.Models at 0x2efc7fece50></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">s.coordset_ids</p>
<p class="MsoNormal">---------------------------------------------------------------------------</p>
<p class="MsoNormal">AttributeError Traceback (most recent call last)</p>
<p class="MsoNormal">~\AppData\Local\Temp/ipykernel_9612/1923568490.py in <module></p>
<p class="MsoNormal">----> 1 s.coordset_ids</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">AttributeError: 'Models' object has no attribute 'coordset_ids'</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">My goal with this is to get a way to obtain the total number of frames available for the trajectory.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">My chimeraX version 1.5.dev202205200152 (2022-05-20).</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,</p>
<p class="MsoNormal">Shubham</p>
<p class="MsoNormal"><o:p> </o:p></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: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="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi Shubham,<o:p></o:p></p>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">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>:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"># if the structure model is in the 's' variable<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">for cid in s.coordset_ids:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">s.active_coordset_id = cid<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"># do whatever you need to do with this coordset<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">--Eric<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Eric Pettersen<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">UCSF Computer Graphics Lab<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">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:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Hi all,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I hope you are doing well.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I have a python script for measuring the distance between aromatic rings of specific residues for different frames of a trajectory.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">To navigate between frames, I am using the command ‘coordset #1 {desired frame}’.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">In gui mode, the script only works if a delay is created between changing the frame and defining the new centroids.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I introduced that delay by asking for a dummy user input (I ran the script from python Shell):<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="text-indent:.5in">run(session, 'coordset #1 ' + {new_frame})<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="text-indent:.5in">y = input('dummy')<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="text-indent:.5in">run (session, 'define centroid /A:8 & aromatic-ring radius 0.3 color yellow mass false name d1’)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">My chimeraX version: 1.4rc202205060510 (2022-05-06)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Should I be using a different command for changing frames of trajectories when in nogui mode?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Shubham<o:p></o:p></p>
</div>
<p class="MsoNormal"> <span class="apple-converted-space"> </span><o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Sent from<span class="apple-converted-space"> </span><a href="https://go.microsoft.com/fwlink/?LinkId=550986">Mail</a><span class="apple-converted-space"> </span>for Windows<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<p class="MsoNormal"><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><o:p></o:p></p>
</div>
</blockquote>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>