<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><span style="font-size: 14px;" class="">Hi Amith,</span><div class=""><span style="font-size: 14px;" class=""><br class=""></span></div><div class=""><span style="font-size: 14px;" class="">It is also possible to run a ChimeraX command script (.cxc) file once on each PDB file in a directory.</span><div class=""><span style="font-size: 14px;" class=""><br class=""></span></div><div class=""><span style="font-size: 14px;" class=""><b style="font-family: -webkit-standard;" class=""><span class="Apple-tab-span" style="white-space:pre">       </span>open myscript.cxc foreach ~/data/*.cif</b><br class=""></span><div><span style="font-size: 14px;" class=""><br class=""></span></div><div><span style="font-size: 14px;" class="">as described in the docs</span></div><div><span style="font-size: 14px;" class=""><br class=""></span></div><div><span style="font-size: 14px;" class=""><span class="Apple-tab-span" style="white-space:pre"> </span><a href="https://www.rbvi.ucsf.edu/chimerax/docs/user/commands/open.html#forEachFile" class="">https://www.rbvi.ucsf.edu/chimerax/docs/user/commands/open.html#forEachFile</a></span></div><div><span style="font-size: 14px;" class=""><br class=""></span></div><div><span style="font-size: 14px;" class="">That was added after the ChimeraX 1.2 release so would need the ChimeraX daily build to use it.</span></div><div><span style="font-size: 14px;" class=""><br class=""></span></div><div><span style="font-size: 14px;" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>Tom</span></div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">On Jul 20, 2021, at 5:42 PM, Rangarajan, Amith via ChimeraX-users <<a href="mailto:chimerax-users@cgl.ucsf.edu" class="">chimerax-users@cgl.ucsf.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);" class=""><span style="margin: 0px; font-size: 12pt; background-color: rgb(255, 255, 255);" class="">Dear Elaine  & Eric</span><div style="margin: 0px; font-size: 12pt; background-color: rgb(255, 255, 255);" class=""><br class=""></div><span style="margin: 0px; font-size: 12pt; background-color: rgb(255, 255, 255);" class="">Thanks a lot !. i now have a better sense of how to approach this . I will update this thread soon with the results.</span><br class=""></div><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);" class=""><span style="margin: 0px; font-size: 12pt; background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);" class=""><span style="margin: 0px; font-size: 12pt; background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);" class="">best</div><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);" class="">Amith</div><div id="appendonsend" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""></div><hr tabindex="-1" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; display: inline-block; width: 775.171875px;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""></span><div id="divRplyFwdMsg" dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><font face="Calibri, sans-serif" style="font-size: 11pt;" class=""><b class="">From:</b><span class="Apple-converted-space"> </span>Eric Pettersen <<a href="mailto:pett@cgl.ucsf.edu" class="">pett@cgl.ucsf.edu</a>><br class=""><b class="">Sent:</b><span class="Apple-converted-space"> </span>Tuesday, July 20, 2021 3:50 PM<br class=""><b class="">To:</b><span class="Apple-converted-space"> </span>ChimeraX Users Help <<a href="mailto:ChimeraX-users@cgl.ucsf.edu" class="">ChimeraX-users@cgl.ucsf.edu</a>><br class=""><b class="">Cc:</b><span class="Apple-converted-space"> </span>Rangarajan, Amith <<a href="mailto:Amith.Rangarajan@ucsf.edu" class="">Amith.Rangarajan@ucsf.edu</a>><br class=""><b class="">Subject:</b><span class="Apple-converted-space"> </span>Re: [chimerax-users] python loop with ChimeraX</font><div class=""> </div></div><div class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; line-break: after-white-space;"><div class="x_pfptBanner" style="margin: 16px 0px; padding: 8px 16px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; min-width: 200px; background-color: rgb(208, 216, 220); border-top-width: 4px; border-top-style: solid; border-top-color: rgb(144, 164, 174);"><div class="x_pfptMessageContainer" style="display: inline-block; margin: 0px 0px 1px; max-width: 600px;"><div class="x_pfptBannerTitle" style="line-height: 18px; display: block; font-family: Arial, sans-serif !important; font-size: 14px !important; font-weight: bold !important;">This Message Is From an External Sender<span class="Apple-converted-space"> </span></div><div class="x_pfptBannerSubtitle" style="line-height: 18px; margin-top: 2px; display: block; font-weight: normal !important; font-family: Arial, sans-serif !important; font-size: 12px !important;">This message came from outside your organization.<span class="Apple-converted-space"> </span></div></div></div>To supplement Elaine's answer, looping through a set of data files and applying commands to them is done in a fashion very similar to the way it is done in Chimera, and therefore the documentation for how to do it in Chimera is still pretty useful:  <a href="https://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/basicPrimer.html" class="">Very Basic Chimera Programming Primer</a><div class=""><br class=""></div><div class="">The differences are:</div><div class=""><br class=""></div><div class="">1) ChimeraX is Python 3 whereas Chimera is Python 2.  That doesn't actually make any difference to the code shown in the example except for the import statements, which would have to change anyway.</div><div class=""><br class=""></div><div class="">2) To run a command, instead of:</div><div class=""><br class=""></div><div class=""><span class="x_Apple-tab-span" style="white-space: pre;"></span><i class="">from chimera import runCommand</i></div><div class=""><i class=""><span class="x_Apple-tab-span" style="white-space: pre;"></span>runCommand("color red")</i></div><div class=""><br class=""></div><div class="">it's:</div><div class=""><br class=""></div><div class=""><span class="x_Apple-tab-span" style="white-space: pre;"></span><i class="">from chimerax.core.commands import run</i></div><div class=""><i class=""><span class="x_Apple-tab-span" style="white-space: pre;"></span>run(session, "color red")</i></div><div class=""><br class=""></div><div class="">3) To issue status messages, instead of:</div><div class=""><br class=""></div><div class=""><span class="x_Apple-tab-span" style="white-space: pre;"></span><i class="">from chimera import replyobj</i></div><div class=""><i class=""><span class="x_Apple-tab-span" style="white-space: pre;"></span>replyobj.status("Processing file")</i></div><div class=""><br class=""></div><div class="">it's just:</div><div class=""><br class=""></div><div class=""><span class="x_Apple-tab-span" style="white-space: pre;"></span><i class="">session.logger.status("Processing file")</i></div><div class=""><br class=""></div><div class=""><div class="">--Eric</div><div class=""><br class=""></div><div class=""><span class="x_Apple-tab-span" style="white-space: pre;"></span>Eric Pettersen</div><div class=""><span class="x_Apple-tab-span" style="white-space: pre;"></span>UCSF Computer Graphics Lab</div></div><div class=""><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Jul 20, 2021, at 11:28 AM, Elaine Meng 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="">One correction, the saved attribute file should have "defattr" filename extension instead of "txt", so my examples should instead be:<br class=""><br class="">save /location/myfile.defattr  attrName r:area<br class="">save /location/myfile.defattr attrName r:area selectedOnly true<br class=""><br class="">Sorry about that.<br class="">Elaine<br class=""><br class=""><blockquote type="cite" class="">On Jul 20, 2021, at 11:23 AM, Elaine Meng via ChimeraX-users <<a href="mailto:chimerax-users@cgl.ucsf.edu" class="">chimerax-users@cgl.ucsf.edu</a>> wrote:<br class=""><br class="">Hi Amith,<br class="">Seems like two parts to this question:<br class="">(A) what are the ChimeraX commands (which could be put into a .cxc file)?<br class="">(B) how to loop over multiple inputs?  ...alluded to by "python loop" in your subject line... .cxc files only contain ChimeraX commands, not python.<br class=""><br class="">I don't know python, so somebody else would need to address part B, but I can give some hints on part A.  However, depending on the solution to part B, you might instead choose to just make a python script instead of using ChimeraX commands directly.  The usual procedure is to figure out the commands first, often with some trial and error of simply typing them in to the command line.<br class=""><br class="">Relevant ChimeraX commands are "measure sasa" to assign residue SASA values as an attribute and then "save" to write the file of attribute values.<span class="Apple-converted-space"> </span><br class=""><br class=""><<a href="https://rbvi.ucsf.edu/chimerax/docs/user/commands/measure.html#sasa" class="">https://rbvi.ucsf.edu/chimerax/docs/user/commands/measure.html#sasa</a>><br class=""><<a href="https://rbvi.ucsf.edu/chimerax/docs/user/commands/save.html#attributes" class="">https://rbvi.ucsf.edu/chimerax/docs/user/commands/save.html#attributes</a>><br class=""><br class="">I'm guessing you want the SASA of the residues but in the context of the complex, i.e. if they are completely buried in the interface between two proteins even though they would be on the surface of one protein by itself, you would still expect SASA zero.  In that case, you'd want the surface to enclose all the proteins in one blob, and then get the SASA of individual residues, and the command would be something like<br class=""><br class="">measure sasa protein setAttribute true<br class="">save /location/myfile.txt  attrName r:area<br class=""><br class="">However, if you only want to specify certain residues instead of writing a file for all residues, you would need to use "select" command to select them and then save with the selectedOnly option, e.g. something like<br class=""><br class="">select /A:24-53 /B:258<br class="">save /location/myfile.txt  attrName r:area selectedOnly true<br class=""><br class="">For part B you may need to embed these in some python script where it keeps closing the previous structure, opening a new structure, and substituting a different name for each save file.<br class=""><br class="">I hope this helps,<br class="">Elaine<br class="">-----<br class="">Elaine C. Meng, Ph.D.                       <br class="">UCSF Chimera(X) team<br class="">Department of Pharmaceutical Chemistry<br class="">University of California, San Francisco<br class=""><br class=""><blockquote type="cite" class="">On Jul 20, 2021, at 10:12 AM, Rangarajan, Amith via ChimeraX-users <<a href="mailto:chimerax-users@cgl.ucsf.edu" class="">chimerax-users@cgl.ucsf.edu</a>> wrote:<br class=""><br class="">Hi,<br class="">I am new to chimeraX , i want to loop through a set of biological assemblies  measuring SASA of  selecting residues and write them to a file. I need some help with starting on this .How to include this into the .cxc script? is there a example somewhere?<br class="">please share your tips and suggestions,<br class="">thanks everyone !<br class="">warm regards,<br class="">Amith<br class=""></blockquote><br class=""><br class="">_______________________________________________<br class="">ChimeraX-users mailing list<br class=""><a href="mailto:ChimeraX-users@cgl.ucsf.edu" class="">ChimeraX-users@cgl.ucsf.edu</a><br class="">Manage subscription:<br class=""><a href="https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users" class="">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users</a><br class=""></blockquote><br class=""><br class="">_______________________________________________<br class="">ChimeraX-users mailing list<br class=""><a href="mailto:ChimeraX-users@cgl.ucsf.edu" class="">ChimeraX-users@cgl.ucsf.edu</a><br class="">Manage subscription:<br class=""><a href="https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users" class="">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users</a><br class=""></div></div></blockquote></div><br class=""></div></div><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">ChimeraX-users mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""><a href="mailto:ChimeraX-users@cgl.ucsf.edu" class="">ChimeraX-users@cgl.ucsf.edu</a></span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Manage subscription:</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""><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>