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

bugfix stereochemistry of conjugated bonds #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hesther
Copy link

@hesther hesther commented Feb 2, 2023

Hi, this is the promised bugfix for #39. The problem was that depending on the atom numbering the direction (up/down) of a double bond system might change for the whole molecule. If that happens, and the template specifies the beginning of a conjugated system but not all of it, one needs to reverse all directions that were copied from the reactants and not set by the template. Jiannan's test script in #39 should be sufficient to test, and I also ran this on a database of 15k reactions to check whether I introduced any unwanted problems. Ran fine, but I saw that there are other cases also for tetrahedral chirality where a similar problem occurs (wrong outcome or wrong template depending on atom numbering). Might work on that soon if I find some spare time. Anyways, this PR fixes all problems concerning wrong cis/trans reaction outcomes, and should be ready to merge.

@connorcoley
Copy link
Owner

Thanks! @ljn917 are you able to review or should I?

@ljn917
Copy link
Contributor

ljn917 commented Feb 4, 2023

@connorcoley Sure, I will do it.

@ljn917
Copy link
Contributor

ljn917 commented Aug 24, 2023

@hesther @connorcoley Sincere apologies for my very late response. I did a simple refactor to remove the is_conjugated_to function, because the counter in the loop made me a little uncomfortable. In addition, a testcase was also added. Otherwise, there should be no significant changes to Esther's original fix.

My code is below because I don't have write access to Esther's branch.
https://github.com/ljn917/rdchiral/tree/pr40-conj-bond

@hesther
Copy link
Author

hesther commented Aug 24, 2023

Just ran a few tests and seems fine to me! Thanks! I can either overwrite the commit here, or you can make a new PR from your fork, whatever works best for you!

@ljn917
Copy link
Contributor

ljn917 commented Aug 24, 2023 via email

@hesther
Copy link
Author

hesther commented Aug 24, 2023

Okay I copy/pasted the three changed files (bonds.py, main.py and test_rdchiral_cases.json), squashed the two commits and force-pushed to have a single commit

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.

3 participants