Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PDBQT parser for wrong H elements interpolation #957

Merged
merged 2 commits into from
Jan 24, 2023

Conversation

papillot
Copy link
Contributor

@papillot papillot commented Jan 8, 2023

PDBQT files (used by the Autodock programs) are derived from PDB files notably by the addition of partial charges (Q) and specific atom types (T).
The atom types are defined in the last columns of the PDBQT file, instead of the element symbol when applicable.
To allow element detection while circumventing this, the previous code was inferring the element symbol from the first letter(s) of the atom name.
This works well but, at least on some files found on the Webina project, some H atoms have names beginning with a digit.
This leads to an unrecognized element name, which is given a default radius larger than the one expected from an hydrogen which in turn causes wrong bond detection as can be seen in the following screenshot.
pdbqt-connectivity-bug

This PR fixes this bug by using mappings from PDBQT atom types to element (derived from the meeko library).
A PDBQT file excerpt has been added to the test dataset to check the fix. It can also be tested using the PDB file from the webina project link cited previously.

Some protonated PDBQT files have H atom names starting with numbers.
e.g. in Arginines `2HH2`.
Previous code was infering element name from the first 2 letters of
the atom name in PDBQT files. This resulted in having these atoms default
to unknown elements, with a default vdw radius far greater than H's value
and buggy connectivity after autobonding.
This trick was probably used as a workaround due to special atom
types being written in the elements columns.
In this commit , the atom types are used instead
with a mapping to element names taken from Meeko, a utility
library for conversions to PDBQT.
Copy link
Collaborator

@fredludlow fredludlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small comments you might want to look at before merging but otherwise LGTM!

src/structure/structure-constants.ts Show resolved Hide resolved
src/parser/pdb-parser.ts Show resolved Hide resolved
@fredludlow fredludlow merged commit fee15d5 into nglviewer:master Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants