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 issue #287 #290

Merged
merged 7 commits into from
Feb 12, 2025
Merged

Fix issue #287 #290

merged 7 commits into from
Feb 12, 2025

Conversation

lohedges
Copy link
Contributor

@lohedges lohedges commented Feb 11, 2025

This PR closes #287 by adding a map option to force the fresh inference of stereochemistry when converting to RDKit format. Previously there was a bug which meant that the code always took this pathway, meaning that it didn't always preserve what was in the original SDF file. This new approach allows the user to take both approaches, then compare the result in RDKit, i.e. they can see if the information in the file agrees with what the inference suggests.

The PR also closes #289 where the formal_charge property of an atom was set incorrectly for certain positive charges. This is because the value in the SDF file isn't the actual charge, e.g:

Formal charge SDF value
-3 7
-2 6
-1 5
0 0
1 3
2 2
3 1

For example, a value of 3 in the file meant that an atom had +3 charge, not +1. This was ultimately the source of several BioSimSpace parameterisation issues, e.g. like the one posted here. While I had correctly fixed the conversion of the formal charge property back to the SDF field, I hadn't noticed the same bug was present when setting the property in the first place. This means that all parameterisation starting from SDF since BioSimSpace 2024.3.0 will have been incorrect if there was an atom with +1 charge (SDF value 3). As such, it might be worth testing some know systems to see if anything has changed.

The fix to the formal charge has meant that we can re-enable an XFAILED RDKIt SMARTS inference test that was disabled following the previous edits. Those meant that it no longer passed, but the formal charge was the underlying culprit.

  • I confirm that I have merged the latest version of devel into this branch before issuing this pull request (e.g. by running git pull origin devel): [y]
  • I confirm that I have added a changelog entry to the changelog (we will add a link to this PR as part of the review): [y]
  • I confirm that I have permission to release this code under the GPL3 license: [y]

Copy link
Contributor

@mb2055 mb2055 left a comment

Choose a reason for hiding this comment

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

All good 👍

@lohedges lohedges merged commit 750cada into devel Feb 12, 2025
4 of 5 checks passed
@lohedges lohedges deleted the fix_287 branch February 12, 2025 14:00
lohedges added a commit that referenced this pull request Feb 12, 2025
lohedges added a commit that referenced this pull request Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working exscientia Related to work with Exscientia
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] SDF reader sets incorrect formal charge [BUG] Allow user to force RDKit stereo inference
2 participants