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

Refactor the codebase to use the OpenFF toolkit #68

Merged
merged 35 commits into from
Apr 21, 2021
Merged

Conversation

SimonBoothroyd
Copy link
Collaborator

@SimonBoothroyd SimonBoothroyd commented Mar 29, 2021

Description

This is the main PR which tracks the conversion of the codebase to use the OpenFF toolkit, rather than OE directly. The conversion will happen over several PRs so that the changes being made can be tracked more cleanly.

The discussed way forward for this is to identify which parts of the codebase are necessary to downstream dependencies and only convert those portions over. All other parts of the codebase will then be removed. Currently it seems like the WBOFragmenter and PfizerFragmenter classes and all of the methods they call are the ones to retrain.

Possible Behaviour Changes

Questions

  • RDKit does not currently treat pyramidal nitrogens as stereogenic while OE does which will lead to to the two toolkits expecting / generating different stereoisomers. Will this cause issues when fragmenting? (see also Refactor stereo enumeration to use the OFF toolkit #76)

Notes

  • While care has been taken to ensure that the code which builds a fragment molecule from a parent molecule and a set of atom and bond subset indices it is possible that the RDKit and OE approaches (Move fragment from indices to chemi and add RDKit variant #89) may yield different fragment molecules depending on how they perceive atom valences. This has not yet been observed in the small set of unit tests, but may manifest itself when moving to the regression molecule set.

Status

  • Ready to go

@openforcefield openforcefield deleted a comment from lgtm-com bot Mar 29, 2021
@openforcefield openforcefield deleted a comment from lgtm-com bot Mar 30, 2021
@openforcefield openforcefield deleted a comment from lgtm-com bot Mar 30, 2021
@openforcefield openforcefield deleted a comment from lgtm-com bot Mar 30, 2021
@openforcefield openforcefield deleted a comment from lgtm-com bot Mar 31, 2021
@openforcefield openforcefield deleted a comment from lgtm-com bot Mar 31, 2021
@openforcefield openforcefield deleted a comment from lgtm-com bot Apr 5, 2021
Copy link
Contributor

@jthorton jthorton left a comment

Choose a reason for hiding this comment

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

Thanks for tackling this @SimonBoothroyd, the changes seem easy to follow and look good. I am available to regression test these changes against the JACS set of ligands which I have fragmented using both options before just let me know when you are ready for me to test it.

I also just wanted to check how I would extract the results of the fragmentation now, before in QCSubmit and Bespoke-fit I used the to_torsiondrive_json of the fragmentation class to get the dihedral that should be scanned in the fragment, but now it looks like you are using atom maps. Does this mean that the bond tuple in Fragmenter.fragments is also the indices of the target bond in the fragment?

@SimonBoothroyd SimonBoothroyd linked an issue Apr 13, 2021 that may be closed by this pull request

fragment_smiles = Chem.MolFragmentToSmiles(rd_molecule, atoms_to_use, bonds_to_use)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for introducing me to this method, this seems really useful. WRT atom maps I see by default in the docs this method will attempt to put the molecule in canonical order, I was thinking this could affect the atom map should this be set to false? As far as the openeye equivalent goes it does not mention changing the ordering which made me think this might not be what we want.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was thinking this could affect the atom map should this be set to false? As far as the openeye equivalent goes it does not mention changing the ordering which made me think this might not be what we want.

Hmm thanks for pointing that out! I think because the map is explicitly included in the produced SMILES pattern it shouldn't be affected by a canonical re-ordering, although there doesn't seem to be a downside to disabling the canonical ordering so I will try this out.

@SimonBoothroyd SimonBoothroyd marked this pull request as ready for review April 14, 2021 15:03
@SimonBoothroyd
Copy link
Collaborator Author

Ok I have finished making the changes that I would like to make and this PR is now ready for regression testing (cc @jthorton)

@j-wags, @mattwthompson, and @lilyminium if you would like to review this then could you please provide any further feedback before the end of this week?

Copy link

@lilyminium lilyminium left a comment

Choose a reason for hiding this comment

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

Thank you @SimonBoothroyd, going through this was very helpful in understanding how fragmenter works :-) I just had a some small questions about Python decisions you made.

fragmenter/states.py Outdated Show resolved Hide resolved
fragmenter/states.py Outdated Show resolved Hide resolved
fragmenter/utils.py Show resolved Hide resolved
fragmenter/chemi.py Outdated Show resolved Hide resolved
fragmenter/fragment.py Outdated Show resolved Hide resolved
fragmenter/fragment.py Outdated Show resolved Hide resolved
fragmenter/fragment.py Outdated Show resolved Hide resolved
fragmenter/chemi.py Show resolved Hide resolved
fragmenter/chemi.py Outdated Show resolved Hide resolved
fragmenter/chemi.py Outdated Show resolved Hide resolved
@mattwthompson
Copy link
Member

Sorry, it looks like I won't have time to give this a useful review by the deadline.

@j-wags
Copy link
Member

j-wags commented Apr 16, 2021

Same. Thanks @SimonBoothroyd for looping me in on the timeline, and to @lilyminium for combing through and doing a great review! Looking forward to trying this out after the release.

fragmenter/fragment.py Outdated Show resolved Hide resolved
fragmenter/fragment.py Outdated Show resolved Hide resolved
fragmenter/fragment.py Outdated Show resolved Hide resolved
SimonBoothroyd and others added 2 commits April 20, 2021 15:51
Co-authored-by: Lily Wang <31115101+lilyminium@users.noreply.github.com>
@SimonBoothroyd
Copy link
Collaborator Author

Thank you @lilyminium for the thorough and thoughtful review - I think I've made most of the changes you recommended!

@SimonBoothroyd
Copy link
Collaborator Author

Unless either @j-wags or @ChayaSt have any objections I will merge this into master first thing tomorrow morning (GMT) to save this PR from growing even larger.

@j-wags
Copy link
Member

j-wags commented Apr 20, 2021

No objections from me. Thanks for spearheading this!

@SimonBoothroyd SimonBoothroyd merged commit add6eba into master Apr 21, 2021
@SimonBoothroyd SimonBoothroyd deleted the refactor-main branch April 21, 2021 09:14
@SimonBoothroyd SimonBoothroyd mentioned this pull request Apr 21, 2021
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants