<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="">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="Apple-tab-span" style="white-space:pre"> </span><i class="">from chimera import runCommand</i></div><div class=""><i class=""><span class="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="Apple-tab-span" style="white-space:pre"> </span><i class="">from chimerax.core.commands import run</i></div><div class=""><i class=""><span class="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="Apple-tab-span" style="white-space:pre"> </span><i class="">from chimera import replyobj</i></div><div class=""><i class=""><span class="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="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="Apple-tab-span" style="white-space:pre"> </span>Eric Pettersen</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>UCSF Computer Graphics Lab</div></div><div class=""><br class=""><div><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="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. <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="">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users<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="">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users<br class=""></div></div></blockquote></div><br class=""></div></body></html>