<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body>
<div>Thank you Tom. </div>
<div>I appreciate it,</div>
<div>Shubham.</div>
<br>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Tom Goddard <goddard@sonic.net><br>
<b>Sent:</b> August 2, 2022 4:15 PM<br>
<b>To:</b> Shubham Devesh Ramgoolam <sdramgoolam@uwaterloo.ca><br>
<b>Cc:</b> ChimeraX Users Help <chimerax-users@cgl.ucsf.edu><br>
<b>Subject:</b> Re: [chimerax-users] Time-efficient python code for obtaining coordinates of atoms</font>
<div> </div>
</div>
<div class="" style="word-wrap:break-word; line-break:after-white-space">Hi Shubham,
<div class=""><br class="">
</div>
<div class="">  Here is example Python code to lookup residues by chain identifier and residue numbers.</div>
<div class=""><br class="">
</div>
<div class=""><span class="x_Apple-tab-span" style="white-space:pre"></span><a href="https://rbvi.github.io/chimerax-recipes/residues/residues.html" class="">https://rbvi.github.io/chimerax-recipes/residues/residues.html</a></div>
<div class=""><br class="">
</div>
<div class="">  Tom</div>
<div class=""><br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Aug 1, 2022, at 10:39 PM, Shubham Devesh Ramgoolam via ChimeraX-users <<a href="mailto:chimerax-users@cgl.ucsf.edu" class="">chimerax-users@cgl.ucsf.edu</a>> wrote:</div>
<br class="x_Apple-interchange-newline">
<div class="">
<div class="x_WordSection1" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
Ok. Thank you, Eric.</div>
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
I appreciate it,</div>
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
Shubham</div>
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
Sent from<span class="x_Apple-converted-space"> </span><a href="https://go.microsoft.com/fwlink/?LinkId=550986" class="" style="color:blue; text-decoration:underline">Mail</a><span class="x_Apple-converted-space"> </span>for Windows</div>
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
<div class="" style="border-style:solid none none; border-top-width:1pt; border-top-color:rgb(225,225,225); padding:3pt 0in 0in">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif; border:none; padding:0in">
<b class="">From:<span class="x_Apple-converted-space"> </span></b><a href="mailto:pett@cgl.ucsf.edu" class="" style="color:blue; text-decoration:underline">Eric Pettersen</a><br class="">
<b class="">Sent:<span class="x_Apple-converted-space"> </span></b>Tuesday, August 2, 2022 5:34<br class="">
<b class="">To:<span class="x_Apple-converted-space"> </span></b><a href="mailto:sdramgoolam@uwaterloo.ca" class="" style="color:blue; text-decoration:underline">Shubham Devesh Ramgoolam</a><br class="">
<b class="">Cc:<span class="x_Apple-converted-space"> </span></b><a href="mailto:chimerax-users@cgl.ucsf.edu" class="" style="color:blue; text-decoration:underline">chimerax-users@cgl.ucsf.edu</a><br class="">
<b class="">Subject:<span class="x_Apple-converted-space"> </span></b>Re: [chimerax-users] Time-efficient python code for obtaining coordinates of atoms</div>
</div>
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
Hi Shubham,</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
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.</div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
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.</div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
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.</div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
</div>
<div class="">
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
--Eric</div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
Eric Pettersen</div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
UCSF Computer Graphics Lab</div>
</div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
<br class="">
<br class="">
</div>
<blockquote class="" style="margin-top:5pt; margin-bottom:5pt">
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
On Aug 1, 2022, at 2:32 AM, Shubham Devesh Ramgoolam via ChimeraX-users <<a href="mailto:chimerax-users@cgl.ucsf.edu" class="" style="color:blue; text-decoration:underline">chimerax-users@cgl.ucsf.edu</a>> wrote:</div>
</div>
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
<div class="">
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
Hi all,</div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
I hope you are doing well.</div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
I am looking for a time-efficient way of obtaining the coordinates of specified residues.</div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
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).</div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
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.</div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
The issue here is that run(session, ‘sel ...’) slows down if there are lots of specified residues.</div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
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.</div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
Regards,</div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
Shubham</div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
Sent from<span class="x_apple-converted-space"> </span><a href="https://go.microsoft.com/fwlink/?LinkId=550986" class="" style="color:blue; text-decoration:underline">Mail</a><span class="x_apple-converted-space"> </span>for Windows</div>
</div>
<div class="">
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
</div>
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
<span class="" style="font-size:9pt; font-family:Helvetica,sans-serif">_______________________________________________<br class="">
ChimeraX-users mailing list<br class="">
</span><a href="mailto:ChimeraX-users@cgl.ucsf.edu" class="" style="color:blue; text-decoration:underline"><span class="" style="font-size:9pt; font-family:Helvetica,sans-serif">ChimeraX-users@cgl.ucsf.edu</span></a><span class="" style="font-size:9pt; font-family:Helvetica,sans-serif"><br class="">
Manage subscription:<br class="">
</span><a href="https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users" class="" style="color:blue; text-decoration:underline"><span class="" style="font-size:9pt; font-family:Helvetica,sans-serif">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users</span></a></div>
</div>
</blockquote>
</div>
</div>
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
<div class="" style="margin:0in; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
</div>
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">_______________________________________________</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">ChimeraX-users
 mailing list</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important"><a href="mailto:ChimeraX-users@cgl.ucsf.edu" class="">ChimeraX-users@cgl.ucsf.edu</a></span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">Manage
 subscription:</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important"><a href="https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users" class="">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users</a></span></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</body>
</html>