LUA command(s) to count/identify hydrogen bonds

Case number:845813-2007744
Topic:Game: Tools
Opened by:jeff101
Opened on:Thursday, May 2, 2019 - 18:08
Last modified:Thursday, December 16, 2021 - 18:38

Often in Design Puzzles, I want certain hydrogen bonds to form.
While manually I can view and count how many hydrogen bonds
come off a certain segment and what segments & atoms they
connect, it would be nice to make recipes do this for me.
This leads me to ask for LUA commands that do as below:

(1) Make a LUA command that will give the total number of
hydrogen bonds formed by a given segment.

(2) Make LUA commands to read information about each
hydrogen bond on a particular segment. Manually we can
determine which segments atoms & monomers each hydrogen
bond connects and whether the hydrogen bond is for sheet
helix loop sidechain or non-protein (see the View Menu).
Why not let LUA commands access the same information?

(3) If possible, also make LUA commands that tell each
hydrogen bond's strength or energy contribution and
how long it is (N to O distances are more helpful to
me in many cases than are distances involving H's).

(Thu, 05/02/2019 - 18:08  |  8 comments)

jeff101's picture
User offline. Last seen 10 hours 21 min ago. Offline
Joined: 04/20/2012
Groups: Go Science

(4) Make LUA commands like in (1-3) above but for
disulfide bonds instead of hydrogen bonds. In the
disulfide analog of (3), sulfur to sulfur distances
could be reported. Perhaps one set of LUA commands
could be used for both disulfide and hydrogen bonds.

Joined: 03/28/2020
Groups: Go Science

Is there any news on this topic? I think it would be a very nice thing to have some way to detect in LUA if hydrogen bonds formed especially between sidechains. This could be beneficial especially for metrics in binder designs. Something must be present already in the internals of Foldit since for H-bond-network puzzles the bonus is derived from this. Would it be possible to make this H-bond detection function available especially for binder puzzles? I would really like to try something in LUA but as it is at the moment the forming of Hbonds can only be detected in score and this is unreliable because collisions due to manual setting of sidechain/rotamer interfere there. Or am I missing something?

joshmiller's picture
User offline. Last seen 16 hours 39 min ago. Offline
Joined: 09/08/2017
Groups: Foldit Staff

Additional details from Discord:

jeff101: on the aflatoxin puzzles, I find myself counting them manually, which takes a lot of time

jeff101: Foldit must know which ones are connected since it can render them with the right View options (although it should render them as coming from H's to acceptor atoms when the H's are shown ... I think it always renders them from donor to acceptor atoms, which can be confusing when a single donor like N in NH2 forms 2 H-bonds with nearby acceptors)

jeff101: it would also help to have LUA commands to read which segments and atoms are connected by h-bonds (and perhaps the bonding subscore contribution of each of these h-bonds). Such commands would not be so different from the LUA commands Foldit already has to report which segments and atoms are connected by bands

Enzyme2: I can't speak for anyone else, but anything which will help scripts determine the location of bonds will allow scripts to more actively create bonds. Currently all it knows is if the bonding score increases. Being able to detect the number of bonds(and possibly the 2 atoms participating in that bond) could eventually lead to more intelligent recipes

Enzyme2: maybe even the quality of each bond also

jeff101: h-bond networks are apparently important in Foldit

jeff101: are there any LUA commands that can assess how complete a network is or which segments and atoms need to form h-bonds to make the network more complete?

Enzyme2: as it is, scripts can't even tell if it is the backbone, or the sidechaon bonded

jeff101: some amino acids have C=O and NH grps on the backbone that can h-bond as well as C=O, -OH, =N-, and NH grps on the sidechain that can h-bond ... consider arginine, asparagine, and glutamine for example
jeff101: for sidechains with multiple h-bonds, it would help to know how much each h-bond contributes to the bonding subscore. odds are each h-bond contributes a different amount based on its bond length and orientation

Enzyme2: Basically, bonds are one of the most important aspects of the game and scripts have almost no access to information about them.

jeff101: if it is hard for the FOldit team to fish out these things, imagine how hard it is for us as players to do so

HuubR: For what it is worth: I fully agree to all of the above (last 25 minutes or so). Thank you, jeff101 and Enzyme :-)

jeff101: some O atoms can be acceptors for 2 H-bonds. I think it is possible for an N in NH2 to form 2 h-bonds with a single O atom. If you render the h-bonds as coming from the H atoms to the acceptor atoms (here a single O atom), you would see 2 h-bonds between the N and O.

jeff101: The way FOldit renders them now, the above case would look like a single H-bond between the N on NH2 and the O atom. Visually, you would't know if it was a single h-bond or 2 h-bonds. This might matter in a H-bond network. Forming just 1 of the 2 possible h-bonds would make an incomplete network. If it were in the protein interior, it would also make a BUNS.

Joined: 03/28/2020
Groups: Go Science

I was happy to find out that this is now implemented. The function "structure.GetHBonds()" does exactly that. I managed to detect newly created HBonds with it and react to it. Thanks a lot for implementing this! That offers some new possibilities to experiment with.
Since when does this function exist? I do not remember seeing it in the release notes.

joshmiller's picture
User offline. Last seen 16 hours 39 min ago. Offline
Joined: 09/08/2017
Groups: Foldit Staff

Hey ich! Good question! I can't find it in the release notes either. But according to the codebase, it started making its way toward devprev around December, so it's been around for maybe 2 months.

Joined: 03/28/2020
Groups: Go Science

Hello Josh,
thanks for the info! It would be good in my opinion to advertise such nice new features a bit more in the future. I only stumbled over it because I am acquainting myself more and more with Foldit-lua. But not everyone may have noticed yet that this is available. Anyway, I will keep my eyes open and regularly check the lua-function list in the future to see if something new is available :)

LociOiling's picture
User offline. Last seen 22 min 41 sec ago. Offline
Joined: 12/27/2012
Groups: Beta Folders

I thought structure.GetHBonds was broken, but it turns out that it depends on the view options selected.

So if only "show bonds (sheet)" is selected, you'll only get bonds between sheets. If no "show bonds" options are checked, you won't get any bonds.

A little unusual, but I guess it's better that no information at all. Maybe the bonds actually have to be drawn to be counted. I would have preferred passing the desired bond types as an argument.

LociOiling's picture
User offline. Last seen 22 min 41 sec ago. Offline
Joined: 12/27/2012
Groups: Beta Folders

The release notes mentioned the interaction with the view options, nearly a year ago (18 December 2020):

Added Lua function structure.GetHBonds() which returns a table of visible hydrogen bonds (Note that that the results of this function are dependent on the current view options).


Developed by: UW Center for Game Science, UW Institute for Protein Design, Northeastern University, Vanderbilt University Meiler Lab, UC Davis
Supported by: DARPA, NSF, NIH, HHMI, Amazon, Microsoft, Adobe, Boehringer Ingelheim, RosettaCommons