[chimerax-users] scripting to check H-bonds in multiple structures
Eric Pettersen
pett at cgl.ucsf.edu
Fri Jul 1 15:20:18 PDT 2022
Also, if you want to call the Python function for finding H-bonds, it’s find_hbonds() in chimerax.hbonds. I’ve appended the function’s doc string. Note that with default parameters it is going to use strict angle/distance criteria, i.e. no additional “slop” added. You can get the recommended slop values from chimerax.hbonds as rec_dist_slop and rec_angle_slop.
--Eric
Eric Pettersen
UCSF Computer Graphics Lab
def find_hbonds(session, structures, *, inter_model=True, intra_model=True, donors=None, acceptors=None,
dist_slop=0.0, angle_slop=0.0, inter_submodel=False, cache_da=False, status=True):
"""Hydrogen bond detection based on criteria in "Three-dimensional
hydrogen-bond geometry and probability information from a
crystal survey", J. Computer-Aided Molecular Design, 10 (1996),
607-622
If donors and/or acceptors are specified (as :py:class:`~chimerax.atomic.Atoms` collections
or anything an Atoms collection can be constructued from), then H-bond donors/acceptors
are restricted to being from those atoms.
Dist/angle slop are the amount that distances/angles are allowed to exceed
the values given in the above reference and still be considered hydrogen bonds.
'cache_da' allows donors/acceptors in molecules to be cached if it is anticipated that
the same structures will be examined for H-bonds repeatedly (e.g. a dynamics trajectory).
If 'per_coordset' is True and 'structures' contains a single structure with multiple coordinate
sets, then hydrogen bonds will be computed for each coordset.
If 'status' is True, progress will be logged to the status line.
Returns a list of donor/acceptor pairs, unless the conditions for 'per_coordset' are
satisfied, in which case a list of such lists will be returned, one per coordset.
"""
> On Jul 1, 2022, at 7:40 AM, Smith, Harper E. via ChimeraX-users <chimerax-users at cgl.ucsf.edu> wrote:
>
> Hi Shivam,
>
> Just building on Elaine's suggestion, another easy way to loop through the pdb structures is using glob. Something like
>
> import glob
> from chimerax.core.commands import run
> for pdb in glob.glob("your_path/*.pdb"):
> run(session, "open " + pdb)
> # whatever ChimeraX commands
>
> Best,
> Harper
>
> From: ChimeraX-users <chimerax-users-bounces at cgl.ucsf.edu <mailto:chimerax-users-bounces at cgl.ucsf.edu>> on behalf of Elaine Meng via ChimeraX-users <chimerax-users at cgl.ucsf.edu <mailto:chimerax-users at cgl.ucsf.edu>>
> Sent: Friday, July 1, 2022 10:30 AM
> To: Shivam Gupta <shivam-gupta at pharmafoods.co.jp <mailto:shivam-gupta at pharmafoods.co.jp>>
> Cc: ChimeraX Users Help <chimerax-users at cgl.ucsf.edu <mailto:chimerax-users at cgl.ucsf.edu>>
> Subject: [chimerax-users] scripting to check H-bonds in multiple structures
>
>
>
> Hi Shivam,
> I don't know Python so I can't answer about that part. However, you might be able to do without python, at least if each docked structure is a separate input file.
>
> (1) first figure out what ChimeraX command(s) you want to run on each structure. You would do this by interactively using ChimeraX on one or two example structures, before you try to put commands into a script. Either you can try using the "hbonds" command directly by typing it into the command line, or you can use the H-Bonds GUI interface to choose the options that you want, and then click Apply -- this will show the resulting command in the Log. See:
> < <applewebdata://E8F8D6B9-E1D5-4087-9F9F-0136B6FB9CD4>https://urldefense.com/v3/__https://rbvi.ucsf.edu/chimerax/docs/user/commands/hbonds.html__;!!KGKeukY!ywCOj9rScLmdHukt6hZ8NdcEHGq2DWt26v4lvUU-IKf0-0ytADpXYHQiDWrFYuwWlphfimVRCLAgdSQLxB7KhfANTosO49j8cpQ$ <https://urldefense.com/v3/__https://rbvi.ucsf.edu/chimerax/docs/user/commands/hbonds.html__;!!KGKeukY!ywCOj9rScLmdHukt6hZ8NdcEHGq2DWt26v4lvUU-IKf0-0ytADpXYHQiDWrFYuwWlphfimVRCLAgdSQLxB7KhfANTosO49j8cpQ$> >
> < <applewebdata://E8F8D6B9-E1D5-4087-9F9F-0136B6FB9CD4>https://urldefense.com/v3/__https://rbvi.ucsf.edu/chimerax/docs/user/tools/hbonds.html__;!!KGKeukY!ywCOj9rScLmdHukt6hZ8NdcEHGq2DWt26v4lvUU-IKf0-0ytADpXYHQiDWrFYuwWlphfimVRCLAgdSQLxB7KhfANTosO_wz-gV4$ <https://urldefense.com/v3/__https://rbvi.ucsf.edu/chimerax/docs/user/tools/hbonds.html__;!!KGKeukY!ywCOj9rScLmdHukt6hZ8NdcEHGq2DWt26v4lvUU-IKf0-0ytADpXYHQiDWrFYuwWlphfimVRCLAgdSQLxB7KhfANTosO_wz-gV4$> >
>
> If each docked structure is a separate input file (e.g. each one is a separate PDB file) then you can try the following two additional steps:
>
> (2) put the ChimeraX command(s) from step (1) above into a plain text file named something.cxc
> < <applewebdata://E8F8D6B9-E1D5-4087-9F9F-0136B6FB9CD4>https://urldefense.com/v3/__https://rbvi.ucsf.edu/chimerax/docs/user/commands/usageconventions.html*cxc-files__;Iw!!KGKeukY!ywCOj9rScLmdHukt6hZ8NdcEHGq2DWt26v4lvUU-IKf0-0ytADpXYHQiDWrFYuwWlphfimVRCLAgdSQLxB7KhfANTosOYOFuYC0$ <https://urldefense.com/v3/__https://rbvi.ucsf.edu/chimerax/docs/user/commands/usageconventions.html*cxc-files__;Iw!!KGKeukY!ywCOj9rScLmdHukt6hZ8NdcEHGq2DWt26v4lvUU-IKf0-0ytADpXYHQiDWrFYuwWlphfimVRCLAgdSQLxB7KhfANTosOYOFuYC0$> >
>
> (3) use the "open" command to run the .cxc file and its "forEachFile" option to specify looping through all the PDB files. For an example, see:
> < <applewebdata://E8F8D6B9-E1D5-4087-9F9F-0136B6FB9CD4>https://urldefense.com/v3/__https://rbvi.ucsf.edu/chimerax/docs/user/commands/open.html*forEachFile__;Iw!!KGKeukY!ywCOj9rScLmdHukt6hZ8NdcEHGq2DWt26v4lvUU-IKf0-0ytADpXYHQiDWrFYuwWlphfimVRCLAgdSQLxB7KhfANTosO3bQNjp4$ <https://urldefense.com/v3/__https://rbvi.ucsf.edu/chimerax/docs/user/commands/open.html*forEachFile__;Iw!!KGKeukY!ywCOj9rScLmdHukt6hZ8NdcEHGq2DWt26v4lvUU-IKf0-0ytADpXYHQiDWrFYuwWlphfimVRCLAgdSQLxB7KhfANTosO3bQNjp4$> >
>
> However, if all the dockings are together in a single big file you may instead need to use python to loop through them as models (e.g. #2.1, 2.2, 2.3, etc.) and run the command(s) from step (1) above. Somebody else would have to advise on that.
>
> I hope this helps,
> Elaine
> -----
> Elaine C. Meng, Ph.D.
> UCSF Chimera(X) team
> Department of Pharmaceutical Chemistry
> University of California, San Francisco
>
>
> > On Jun 30, 2022, at 10:31 PM, Shivam Gupta via ChimeraX-users <chimerax-users at cgl.ucsf.edu <mailto:chimerax-users at cgl.ucsf.edu>> wrote:
> >
> > Hello Chimera Team,
> >
> > I want to explore the possibility of checking the protein-protein interaction (hydrogen bond) in the docked structure using python script.
> >
> > Is it possible to check hydrogen bonds for high throughput data (docked protein structures) using Python?
> >
> > Please guide me over this.
> >
> > Thanks
> >
>
>
> _______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu <mailto:ChimeraX-users at cgl.ucsf.edu>
> Manage subscription:
> https://urldefense.com/v3/__https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users__;!!KGKeukY!ywCOj9rScLmdHukt6hZ8NdcEHGq2DWt26v4lvUU-IKf0-0ytADpXYHQiDWrFYuwWlphfimVRCLAgdSQLxB7KhfANTosO2347UwE$ <https://urldefense.com/v3/__https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users__;!!KGKeukY!ywCOj9rScLmdHukt6hZ8NdcEHGq2DWt26v4lvUU-IKf0-0ytADpXYHQiDWrFYuwWlphfimVRCLAgdSQLxB7KhfANTosO2347UwE$>
> _______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu <mailto:ChimeraX-users at cgl.ucsf.edu>
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users <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/20220701/fa052f7c/attachment.html>
More information about the ChimeraX-users
mailing list