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

Issue with inversion/retention of stereochemistry #2891

Closed
mc-robinson opened this issue Jan 21, 2020 · 3 comments · Fixed by #3412
Closed

Issue with inversion/retention of stereochemistry #2891

mc-robinson opened this issue Jan 21, 2020 · 3 comments · Fixed by #3412
Labels
Milestone

Comments

@mc-robinson
Copy link

  • RDKit Version: 2019.09.3.0
  • OS: Mac
  • Are you using conda? Yes
  • If you are using conda, which channel did you install the rdkit from? rdkit

Description:

Ran into a few strange behaviors (at least relative to what I would expect) when trying to code up a substitution reaction. Minimal examples reproduced below:

For all examples the reactant of interest is Chem.MolFromSmiles('C[C@H](Br)c1ccccc1')
image

We begin by testing the simple bimolecular substitution reaction, with inversion of stereochemistry at the reaction center:

reactant = Chem.MolFromSmiles('C[C@H](Br)c1ccccc1')
rxn = AllChem.ReactionFromSmarts('[C@:1][Br:2].[S:3][C:4]>>[C@@:1][*:3][*:4]')
prod = rxn.RunReactants(
    (
        reactant,Chem.MolFromSmiles('CCS')    
    )
)
print(len(prod))
print(Chem.MolToSmiles(prod[0][0]))

The result is 'CCS[C@@H](C)c1ccccc1' (shown below)
image

However, this is actually not the expected inverted product. The reason for this I believe is due to the change of the order of the SMILES. The carbon indeed changes from [C@] to [C@@]; however, since the canonicalization changes the bond we look down to define clockwise/counter-clockwise, no true inversion occurs. Ultimately, I did not see an easy way to fix this problem (though I welcome suggestions!), so started testing a unimolecular transformation, as shown below.

reactant = Chem.MolFromSmiles('C[C@H](Br)c1ccccc1')
rxn = AllChem.ReactionFromSmarts('[C@:2]([#6:1])[Br:3]>>[C@@:2]([#6:1])[S:3]CC')
prod = rxn.RunReactants(
    (
        reactant,   
    )
)
print(len(prod))
print([Chem.MolToSmiles(x[0]) for x in prod])

This example, produces both stereoisomers:
image
and
image

I understand that my RXN SMARTS is likely overly general, since '[C@:2]([#6:1])[Br:3]' may be matched in two different ways to the reactant. However, either way it matches, shouldn't the product simply invert the stereochemistry of the original match? It is a bit unclear to me why the configuration of the reactant is retained.

Investigating this behavior, I tried the less general rxn below

reactant = Chem.MolFromSmiles('C[C@H](Br)c1ccccc1')
rxn = AllChem.ReactionFromSmarts('[C@:2]([C:1])[Br:3]>>[C@@:2]([C:1])[S:3]CC')
prod = rxn.RunReactants(
    (
        reactant,   
    )
)
print(len(prod))
print([Chem.MolToSmiles(x[0]) for x in prod])

This actually only produces the expected product with inversion of stereochemistry:
image

Lastly, I tried to isolate the behavior of the aromatic carbon causing troubles:

reactant = Chem.MolFromSmiles('C[C@H](Br)c1ccccc1')
rxn = AllChem.ReactionFromSmarts('[C@:2]([c:1])[Br:3]>>[C@@:2]([c:1])[S:3]CC')
prod = rxn.RunReactants(
    (
        reactant,   
    )
)
print(len(prod))
print([Chem.MolToSmiles(x[0]) for x in prod])

This reaction only produces the unexpected product with retention.

image

I expect that an issue may arise because the original SMILES of the reactant, ''C[C@H](Br)c1ccccc1' is defining counter-clockwise with respect to looking down the non-aromatic CC bond, and not the cC bond.

However, I am pretty confused in general, so would really appreciate any clarification. I apologize for the lengthy issue, but hopefully the reproducible examples are of help.

@greglandrum
Copy link
Member

Thanks for that detailed and well described bug report!

There's definitely something odd/unexpected going on here that I'm going to have to dig into (it's not a trivial topic) in order to understand/explain.

greglandrum added a commit to greglandrum/rdkit that referenced this issue Sep 17, 2020
Try to be more robust w.r.t. atom reordering in input SMILES
greglandrum added a commit that referenced this issue Sep 18, 2020
* add tests for the problem

* more testing (still no fix)

* Fixes #2891

Try to be more robust w.r.t. atom reordering in input SMILES

* better handling of differing numbers of bonds between reactants and products

all tests now passing

* update the rdkit book with more details about chirality in reactions

* changes in response to review
@greglandrum greglandrum added this to the 2020_09_1 milestone Sep 18, 2020
@greglandrum
Copy link
Member

@mc-robinson : I believe we have this fixed on master now. It'll be in the 2020.09.1 release (coming in mid-October).
Here are the new results for a couple of your examples:
image

There's a gist with more here:
https://gist.github.com/greglandrum/6f5912c1ab5b29610c8c49ca62bf75a2

@mwcvitkovic
Copy link

Thanks @greglandrum!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants