[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

Substructure matching problem using smirks notation #6994

Open
albertogilf opened this issue Dec 15, 2023 · 3 comments
Open

Substructure matching problem using smirks notation #6994

albertogilf opened this issue Dec 15, 2023 · 3 comments

Comments

@albertogilf
Copy link

I need to transform some molecules within a specific pattern defined by the next smirks reaction:
[CX4,CX3,NX2,NX3,NX4+:1]-,=[#6;A;X4H2,X3H1:2]#6;A;X4:3([H:5])[#8;A;X2:4][H]>>[CX4,CX3,NX2,NX3,NX4+:1]-,=[#6;A;X4H2,X3H1:2]#6;A;X3:3=[#8;A;X1:4]
This transformation is defined by the next graph:
DEHYDROGENATION_OF_PRIMARY_ALCOHOL_PATTERN1_test

There is a molecule to test this issue defined by the next SMILES CC1=CC=2CC(C)(C)CC2C(CO)=C1CCO that has 2 substructures matching.
DEHYDROGENATION_OF_PRIMARY_ALCOHOL_PATTERN1_CC1=CC=2CC(C)(C)CC2C(CO)=C1CCO_input

However, the pattern does not find any substructure as well and, as a consequence, it does not run the reaction on the input SMILES.

To Reproduce
source_mol = Chem.MolFromSmiles('CC1=CC=2CC(C)(C)CC2C(CO)=C1CCO')
reaction = rdChemReactions.ReactionFromSmarts('[CX4,CX3,NX2,NX3,NX4+:1]-,=[#6;A;X4H2,X3H1:2]#6;A;X4:3([H:5])[#8;A;X2:4][H]>>[CX4,CX3,NX2,NX3,NX4+:1]-,=[#6;A;X4H2,X3H1:2]#6;A;X3:3=[#8;A;X1:4]')
reacts = (source_mol,)
products_src = reaction.RunReactants(reacts)

And the results of products_src should return the molecule transformed, but it is empty.
The issue does not look to happen when the matching happens in the full structure or when there is no * in the left side of the smirks reaction definition.

Expected behavior
The substructure should be matched and it should return it using the
GetSubstructMatch(Mol) method from mol class or the RunReactants((ChemicalReaction)self, (tuple)reactants[, (int)maxProducts=1000]) method from the reaction class

Screenshots

Configuration (please complete the following information):

  • RDKit version: 2023.09.3
  • OS: Ubuntu 22.04
  • Python version (if relevant): 3.11.6
  • Are you using conda? Yes
  • If you are using conda, which channel did you install the rdkit from? rdkit

Additional context

@greglandrum
Copy link
Member

This is almost definitely happening because the reaction smarts includes explicit H atoms and you haven't added Hs to the molecule before calling runReactants

@albertogilf
Copy link
Author
albertogilf commented Dec 19, 2023

Is not the Chem.AddHs() mol.UpdatePropertyCache calculating them?

In the issue from 4 years ago someone wanted to do the same thing and they commented:
#2512
"rdkit.Mol from SMARTS assigns incorrect aromaticity flags for some atoms and bonds (GetIsAromatic), which may be the cause of the problem"

Do you know if there is some update?

Thanks Greg :-)

Copy link
Contributor

This issue was marked as stale because it has been open for 90 days with no activity.

@github-actions github-actions bot added the stale label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants