[chimerax-users] Select ring atoms of ligand using python in chimerax

Dr. Vijay Masand vijaymasand at gmail.com
Wed Jan 25 22:22:27 PST 2023


Dear Eric,
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.


On Thu, 26 Jan, 2023, 00:30 Eric Pettersen, <pett at cgl.ucsf.edu> wrote:

> Hi Vijay,
> 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'.
>
> --Eric
>
> On Jan 25, 2023, at 6:48 AM, Dr. Vijay Masand via ChimeraX-users <
> chimerax-users at cgl.ucsf.edu> wrote:
>
> Thank you, Eric. The above commands are very helpful.
> Using following command, I am getting sasa for all Carbon atoms:
> from chimerax.core.commands import run as rc
> from chimerax.atomic import all_atoms
> atoms = all_atoms(session)
>         ring_atoms = [a for a in atoms if a.rings()]
>         ringC = [a for a in ring_atoms if a.element.name == "C"]
>        for a in ringC:
>         SASA = rc(session, 'measure sasa all sum %s'%a)
>         print(SASA)
> 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.
> Thanks in advance for the help.
>
> With Warm Regards
> *Dr. Vijay H. Masand*
> Department of Chemistry,
> Vidya Bharati College, Amravati, 444 602
> Maharashtra, India.
> Phone number- +91-9403312628
> https://sites.google.com/site/vijaymasand/
>
>
>
> On Thu, Jan 19, 2023 at 12:39 AM Eric Pettersen <pett at cgl.ucsf.edu> wrote:
>
>> Hi Vijay,
>> Atom objects have an 'element' attribute which in turn has 'name' and
>> 'number' attributes.  The 'name' attribute is actually the atomic symbol,
>> *e.g.* H for hydrogen.
>> 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()]
>>
>> --Eric
>>
>> On Jan 17, 2023, at 6:26 PM, Dr. Vijay Masand via ChimeraX-users <
>> chimerax-users at cgl.ucsf.edu> wrote:
>>
>> Thank you for the details and nice solution, Eric.
>> How can I extend the above code to select ring nitrogen and oxygen atoms
>> and to sum charges on different atoms (ring/non-ring)?
>> Thanks in advance.
>>
>> With Warm Regards
>> *Dr. Vijay H. Masand*
>> Department of Chemistry,
>> Vidya Bharati College, Amravati, 444 602
>> Maharashtra, India.
>> Phone number- +91-9403312628
>> https://sites.google.com/site/vijaymasand/
>>
>>
>>
>> On Wed, Jan 18, 2023 at 1:36 AM Eric Pettersen <pett at cgl.ucsf.edu> wrote:
>>
>>> Hi Vijay,
>>> I don't know exactly how efficient you need things to be, but here is
>>> some info...
>>>
>>> *Get all atoms*:
>>> from chimerax.atomic import all_atoms
>>> atoms = all_atoms(session)
>>>
>>> *Filter down to just ligand atoms*:
>>> ligand_atoms = atoms.filter(atoms.structure_categories == "ligand")
>>>
>>> *Ligand ring atoms*:
>>> ring_atoms = [a for a in ligand_atoms if a.rings()]
>>>
>>> *Assign charges to ligand residues*:
>>> from chimerax.add_charge import add_charges
>>> add_charges(session, ligand_atoms.unique_residues)
>>>
>>> *Sum the charges*:
>>> charge_sum = sum([a.charge for a in ligand_atoms])
>>>
>>> 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 (
>>> https://www.rbvi.ucsf.edu/chimerax/docs/devel/index.html, also included
>>> in the app under Help), particularly the "API Reference" link.
>>> 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:
>>>
>>> session.selection.clear()
>>> for a in ring_atoms:
>>> a.selected = True
>>>
>>> --Eric
>>>
>>> Eric Pettersen
>>> UCSF Computer Graphics Lab
>>>
>>>
>>> On Jan 16, 2023, at 11:03 PM, Dr. Vijay Masand via ChimeraX-users <
>>> chimerax-users at cgl.ucsf.edu> wrote:
>>>
>>> Dear all
>>> 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?
>>> Thanks in advance.
>>> From
>>> Vijay
>>>
>>> With Warm Regards
>>> *Dr. Vijay H. Masand*
>>> Department of Chemistry,
>>> Vidya Bharati College, Amravati, 444 602
>>> Maharashtra, India.
>>> Phone number- +91-9403312628
>>> https://sites.google.com/site/vijaymasand/
>>>
>>> _______________________________________________
>>> ChimeraX-users mailing list
>>> ChimeraX-users at cgl.ucsf.edu
>>> Manage subscription:
>>> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
>>>
>>>
>>> _______________________________________________
>> ChimeraX-users mailing list
>> ChimeraX-users at cgl.ucsf.edu
>> Manage subscription:
>> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
>>
>>
>> _______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.rbvi.ucsf.edu/pipermail/chimerax-users/attachments/20230126/2ee61437/attachment.html>


More information about the ChimeraX-users mailing list