4
$\begingroup$

I have been trying to use the RDKit's reaction substructure matching for some time. I want to match all reactions where a C-H bond is being broken to form a new C-C bond.

This is my code:

from rdkit.Chem import AllChem
from rdkit.Chem import rdChemReactions

c_h_template = AllChem.ReactionFromSmarts('[#6:1]-[#1]>>[#6:1]~[#6]')
x = AllChem.ReactionFromSmarts('C1=[CH:1]C=CC=C1.C[CH:2]=C.[Pd]>>C[C:2](=C)[CH:1]1=CC=CC=C1',useSmiles=True)
result = rdChemReactions.HasReactionSubstructMatch(x,c_h_template)
print(result) # always False

The result is always False, even though the reaction pattern should match.

The template, and the reaction are shown below (in jupyter notebook):

picture of jupyter nptebook

I am not sure what I am doing wrong here. I have read about SMARTS from daylight website, and I think the atom mapping is correct, and it should match. Any help is greatly appreciated.

$\endgroup$
2
  • $\begingroup$ Hey @S R Maiti if my post answer your question, could you please mark it using the tick next to it? $\endgroup$ Mar 12, 2023 at 21:34
  • 1
    $\begingroup$ @VandanRevanur I have discovered after some testing that RDKit's SMARTS implementation seems to be bugged, and gives inconsistent answers so there really is no answer to the question. $\endgroup$
    – S R Maiti
    Mar 13, 2023 at 22:47

1 Answer 1

3
$\begingroup$

I changed the c_h_template to also use smiles and the substructMatch returns True.

I am using rdkit version number: 2022.9.4

Here is the full reproducible code.

from rdkit.Chem import AllChem
from rdkit.Chem import rdChemReactions
c_h_template = AllChem.ReactionFromSmarts('[CH:1]>>[C:1]~[C:2]', useSmiles=True)
rxn = AllChem.ReactionFromSmarts('C1=[CH:1]-C=CC=C1.C[CH:2]=C.[Pd]>>C[C:2](=C)[CH:1]1=CC=CC=C1',useSmiles=True)

result = rdChemReactions.HasReactionSubstructMatch(x,c_h_template)
print(result) # returns True
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .