LPDI-EPFL / masif

MaSIF- Molecular surface interaction fingerprints. Geometric deep learning to decipher patterns in molecular surfaces.
Apache License 2.0
572 stars 151 forks source link

Error handling: missing atoms when calculating hydrogen-bonding potential #28

Closed jomimc closed 3 years ago

jomimc commented 3 years ago

Sometimes I've found that when looking for hydrogen bond acceptors, the code will break if the acceptor atom is there but coordinates are missing for its bonded, neighbouring atom. I.e. in "triangulation.computeCharges" line 82, res[acceptorAngleAtom[atom_name]].get_coord() will throw a KeyError exception. I found this on PDB entries 2avn and 1vdn.

My suggested fix was already implemented for acceptorPlaneAtom in the same function:

try:
    a = res[acceptor_atom.get_coord()
except KeyError:
    return 0.0
pablogainza commented 3 years ago

Thank you !!! I've fixed this, as suggested.