nglviewer / ngl

WebGL protein viewer
http://nglviewer.org/ngl/
MIT License
659 stars 168 forks source link

Hydrogen bond connection #675

Open tonyyzy opened 5 years ago

tonyyzy commented 5 years ago

Hello

I understand that most PDB files do not contain hydrogens hence NGL connects the heavy atoms and labels it as a hydrogen bond. Would it be possible to tell NGL to display correct hydrogen bond connection when the hydrogens are available? (e.g. from molecular dynamics trajectories, some high res crystal structures)

https://github.com/arose/nglview/issues/835

fredludlow commented 5 years ago

It should be doable, though it's not totally trivial.

I think it might be easiest to do it at the contact-refining stage (if there's a hydrogen atom in a suitably close position to a detected H-bond use that atom as one end of it).

One thing that's not clear is how you would label the distance (I tend to think in terms of heavy-atom distance when interpreting interactions so suddenly having an H-bond that's only 1.8 angstroms would seem odd).

If you'd like to have a go I'm very happy to offer what help I can!

tonyyzy commented 5 years ago

@fredludlow Interesting! I always think about H-bond, not necessarily the correct way, in terms of distance from the electronegative element to the hydrogen, as the orientation/angle of the H-bond should be important as well.

Unfortunately, JS/TS is still out of my league despite I have attempted to read NGL's source code several times. Maybe in the future :)

fredludlow commented 5 years ago

Interesting! I always think about H-bond, not necessarily the correct way, in terms of distance from the electronegative element to the hydrogen, as the orientation/angle of the H-bond should be important as well.

I don't think there's a right or wrong way to think about it - it's just that I mostly look at X-ray structures without hydrogens :)

Orientation is certainly important - IIRC the code tries to infer the correct geometry (sp2/sp3) and then allow some deviation from that.

E.g. the maxHbondDonorAngle parameter is far the X-Donor-Acceptor angle is allowed to deviate from ideal. So for arginine acting as donor the ideal angle CZ-NH1-Acceptor is 120 degrees, so as long as abs(angle - 120) < maxHbondDonorAngle the contact is shown.

As an aside: the numbers for these parameters are a bit of a hand-curated fudge, rather than being based on systematic analysis of the CSD/PDB, so reports of awkward test cases are welcome!

Unfortunately, JS/TS is still out of my league despite I have attempted to read NGL's source code several times. Maybe in the future :)