<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I see.  “measure sasa” is only reporting the value in the log and not returning it to Python.  I have opened a ticket in our bug-tracking database about this with you cc’ed.  Hopefully it will be fixed soon.<div class=""><br class=""></div><div class="">—Eric<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jan 25, 2023, at 10:22 PM, Dr. Vijay Masand 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 dir="ltr" class="">Dear Eric,<div class="">I agree with you, but for a specific purpose, I need to know sasa for ring atoms only of a ligand. I hope I will get a pythonic way as I have to repeat the task for multiple ligands simultaneously. Thanks in advance.</div><div class=""><br class=""></div></div><div dir="auto" class=""></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 26 Jan, 2023, 00:30 Eric Pettersen, <<a href="mailto:pett@cgl.ucsf.edu" target="_blank" class="">pett@cgl.ucsf.edu</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;" class="">Hi Vijay,<div class=""><span style="white-space:pre-wrap" class="">     </span>Do you really mean to use 'all' as the first atom spec for "measure sasa"?  If the ligand is buried in a receptor pocket, the surface will enclose the entire system and the SASA of many of the ring atoms will probably be zero.  I would think you would want to use 'ligand' instead of 'all'.</div><div class=""><br class=""></div><div class="">--Eric<br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Jan 25, 2023, at 6:48 AM, Dr. Vijay Masand via ChimeraX-users <<a href="mailto:chimerax-users@cgl.ucsf.edu" rel="noreferrer" target="_blank" class="">chimerax-users@cgl.ucsf.edu</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Thank you, Eric. The above commands are very helpful.<br class="">Using following command, I am getting sasa for all Carbon atoms:<div class=""><div class="">from chimerax.core.commands import run as rc</div><div class="">from chimerax.atomic import all_atoms</div><div class=""><span style="white-space:pre-wrap" class="">    </span>atoms = all_atoms(session)</div><div class="">        ring_atoms = [a for a in atoms if a.rings()]<br class=""></div><div class="">        ringC = [a for a in ring_atoms if <a href="http://a.element.name/" rel="noreferrer" target="_blank" class="">a.element.name</a> == "C"]</div><div class="">       for a in ringC:</div><div class="">        SASA = rc(session, 'measure sasa all sum %s'%a)<br class=""></div><div class="">        print(SASA)</div><div class="">But I am not getting the expected result. I am now looking for a better pythonic way to calculate sasa for ring carbon atoms of ligand only. </div><div class="">Thanks in advance for the help.</div><div class=""><br class=""></div><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class="">With Warm Regards</div><div class=""><b class="">Dr. Vijay H. Masand</b></div><div class="">Department of Chemistry,<br class="">Vidya Bharati College, Amravati, 444 602<br class="">Maharashtra, India.<br class="">Phone number- +91-9403312628<br class=""><a href="https://sites.google.com/site/vijaymasand/" rel="noreferrer" target="_blank" class="">https://sites.google.com/site/vijaymasand/</a><br class=""><br class=""></div></div></div></div><br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 19, 2023 at 12:39 AM Eric Pettersen <<a href="mailto:pett@cgl.ucsf.edu" rel="noreferrer" target="_blank" class="">pett@cgl.ucsf.edu</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="">Hi Vijay,<div class=""><span style="white-space:pre-wrap" class=""> </span>Atom objects have an 'element' attribute which in turn has 'name' and 'number' attributes.  The 'name' attribute is actually the atomic symbol, <i class="">e.g.</i><span style="font-style:normal" class=""> H for hydrogen.</span></div><div class=""><span style="white-space:pre-wrap" class="">       </span>You can use normal Python operations, such as 'not', to find these things, so the non-ring ligand atoms are: [a for a in ligand_atoms if not a.rings()]</div><div class=""><br class=""></div><div class="">--Eric<br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Jan 17, 2023, at 6:26 PM, Dr. Vijay Masand via ChimeraX-users <<a href="mailto:chimerax-users@cgl.ucsf.edu" rel="noreferrer" target="_blank" class="">chimerax-users@cgl.ucsf.edu</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Thank you for the details and nice solution, Eric. <div class="">How can I extend the above code to select ring nitrogen and oxygen atoms and to sum charges on different atoms (ring/non-ring)?<div class="">Thanks in advance.</div><div class=""> <br clear="all" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class="">With Warm Regards</div><div class=""><b class="">Dr. Vijay H. Masand</b></div><div class="">Department of Chemistry,<br class="">Vidya Bharati College, Amravati, 444 602<br class="">Maharashtra, India.<br class="">Phone number- +91-9403312628<br class=""><a href="https://sites.google.com/site/vijaymasand/" rel="noreferrer" target="_blank" class="">https://sites.google.com/site/vijaymasand/</a><br class=""><br class=""></div></div></div></div><br class=""></div></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 18, 2023 at 1:36 AM Eric Pettersen <<a href="mailto:pett@cgl.ucsf.edu" rel="noreferrer" target="_blank" class="">pett@cgl.ucsf.edu</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="">Hi Vijay,<div class=""><span style="white-space:pre-wrap" class="">       </span>I don't know exactly how efficient you need things to be, but here is some info...</div><div class=""><br class=""></div><div class=""><i class="">Get all atoms</i><span style="font-style:normal" class="">:</span></div><div class=""><span style="white-space:pre-wrap" class="">    </span>from chimerax.atomic import all_atoms</div><div class=""><span style="white-space:pre-wrap" class="">      </span>atoms = all_atoms(session)</div><div class=""><br class=""></div><div class=""><i class="">Filter down to just ligand atoms</i><span style="font-style:normal" class="">:</span></div><div class=""><span style="white-space:pre-wrap" class=""> </span>ligand_atoms = atoms.filter(atoms.structure_categories == "ligand")</div><div class=""><br class=""></div><div class=""><i class="">Ligand ring atoms</i><span style="font-style:normal" class="">:</span></div><div class=""><span style="white-space:pre-wrap" class="">     </span>ring_atoms = [a for a in ligand_atoms if a.rings()]</div><div class=""><br class=""></div><div class=""><i class="">Assign charges to ligand residues</i><span style="font-style:normal" class="">:</span></div><div class=""><span style="white-space:pre-wrap" class="">       </span>from chimerax.add_charge import add_charges</div><div class=""><span style="white-space:pre-wrap" class="">        </span>add_charges(session, ligand_atoms.unique_residues)</div><div class=""><br class=""></div><div class=""><i class="">Sum the charges</i><span style="font-style:normal" class="">:</span></div><div class=""><span style="white-space:pre-wrap" class="">  </span>charge_sum = sum([a.charge for a in ligand_atoms])</div><div class=""><br class=""></div><div class=""><span style="white-space:pre-wrap" class="">  </span>This all assumes the structure has hydrogens.  In particular, the charge sum will be massively negative if hydrogens are missing!  Some of the calls above are covered in the ChimeraX programmer's guide (<a href="https://www.rbvi.ucsf.edu/chimerax/docs/devel/index.html" rel="noreferrer" target="_blank" class="">https://www.rbvi.ucsf.edu/chimerax/docs/devel/index.html</a>, also included in the app under Help), particularly the "API Reference" link.</div><div class=""><span style="white-space:pre-wrap" class=""> </span>When you said "select ring atoms" I don't know if you meant just find them (which the above does) or actually select them in the graphics window.  This would do that:</div><div class=""><br class=""></div><div class=""><span style="white-space:pre-wrap" class="">       </span>session.selection.clear()</div><div class=""><span style="white-space:pre-wrap" class="">  </span>for a in ring_atoms:</div><div class=""><span style="white-space:pre-wrap" class="">               </span>a.selected = True</div><div class=""><br class=""></div><div class=""><div class="">--Eric</div><div class=""><br class=""></div><div class=""><span style="white-space:pre-wrap" class="">      </span>Eric Pettersen</div><div class=""><span style="white-space:pre-wrap" class="">     </span>UCSF Computer Graphics Lab</div></div><div class=""><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Jan 16, 2023, at 11:03 PM, Dr. Vijay Masand via ChimeraX-users <<a href="mailto:chimerax-users@cgl.ucsf.edu" rel="noreferrer" target="_blank" class="">chimerax-users@cgl.ucsf.edu</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class="">Dear all<div class="">I am looking for an efficient method to select ring atoms of ligands using python in chimeraX. Also, is there any python code/method to get the sum of charges on ligand atoms only?</div><div class="">Thanks in advance.</div><div class="">From</div><div class="">Vijay</div><div class=""><br clear="all" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class="">With Warm Regards</div><div class=""><b class="">Dr. Vijay H. Masand</b></div><div class="">Department of Chemistry,<br class="">Vidya Bharati College, Amravati, 444 602<br class="">Maharashtra, India.<br class="">Phone number- +91-9403312628<br class=""><a href="https://sites.google.com/site/vijaymasand/" rel="noreferrer" target="_blank" class="">https://sites.google.com/site/vijaymasand/</a><br class=""><br class=""></div></div></div></div></div></div></div>
_______________________________________________<br class="">ChimeraX-users mailing list<br class=""><a href="mailto:ChimeraX-users@cgl.ucsf.edu" rel="noreferrer" target="_blank" class="">ChimeraX-users@cgl.ucsf.edu</a><br class="">Manage subscription:<br class=""><a href="https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users" rel="noreferrer" target="_blank" class="">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div>
_______________________________________________<br class="">ChimeraX-users mailing list<br class=""><a href="mailto:ChimeraX-users@cgl.ucsf.edu" rel="noreferrer" target="_blank" class="">ChimeraX-users@cgl.ucsf.edu</a><br class="">Manage subscription:<br class=""><a href="https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users" rel="noreferrer" target="_blank" class="">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div>
_______________________________________________<br class="">ChimeraX-users mailing list<br class=""><a href="mailto:ChimeraX-users@cgl.ucsf.edu" rel="noreferrer" target="_blank" class="">ChimeraX-users@cgl.ucsf.edu</a><br class="">Manage subscription:<br class=""><a href="https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users" rel="noreferrer" target="_blank" class="">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div>
_______________________________________________<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></blockquote></div><br class=""></div></body></html>