I'm trying to get a reaction SMARTS pattern to ignore chiral atoms and it
doesn't appear straightforward. First, it appears RDKit doesn't support
'!@' to indicate a non-chiral specified atom. I have to wrap this in a
recursive SMARTS to get it to work. For example:

In [2]: mol = Chem.MolFromSmiles('[*]C1=C([*])[C@H]2CC[C@@H]1C2')
In [4]: mol.HasSubstructMatch(Chem.MolFromSmarts('[#6;!@]-[#6;!@]'))
Out[4]: False
In [5]: mol.HasSubstructMatch(Chem.MolFromSmarts('[#6;!@]-[#6;!@]'),
useChirality=True)
Out[5]: False
In [6]:
mol.HasSubstructMatch(Chem.MolFromSmarts('[#6;!$([@])]-[#6;!$([@])]'))
Out[6]: False
In [7]:
mol.HasSubstructMatch(Chem.MolFromSmarts('[#6;!$([@])]-[#6;!$([@])]'),
useChirality=True)
Out[7]: True

Odd, but fair enough. At least I can get the SMARTS part of the reaction to
match the single bond in this fragment that does not have a chiral atom
neighbor.

[image: image.png]

(Meant to give Greg a shout out for his interactive SMARTS jupyter notebook
seen above at the UGM, it's great for interactively playing with SMARTS
patterns and then reaction SMARTS :-)

Anyway, I would like to then take that SMARTS and create a reaction SMARTS
that converts that single bond to a double bond. However, the '!$([@])'
seems to cause the SMARTS to not match when using reactions. For example:

In [23]: rxn =
AllChem.ReactionFromSmarts('[#6X4;!$([@]):1]-[#6X4;!$([@]):2]>>[#6:1]=[#6:2]')

In [24]: list(Chem.MolToSmiles(m[0]) for m in rxn.RunReactants((mol,)))
Out[24]: []

Removing the '!$([@])' makes the reaction at least work, but the hydrogens
on the chiral atoms get mucked up.

In [25]: rxn =
AllChem.ReactionFromSmarts('[#6X4:1]-[#6X4:2]>>[#6:1]=[#6:2]')

In [26]: list(Chem.MolToSmiles(m[0]) for m in rxn.RunReactants((mol,)))
Out[26]:
['[*]C1=C([*])[CH]2=CCC1C2',
 '[*]C1=C([*])[CH]2=CC1CC2',
 '[*]C1=C([*])[CH]2=CCC1C2',
 '[*]C1=C([*])C2C=CC1C2',
 '[*]C1=C([*])C2C=CC1C2',
 '[*]C1=C([*])[CH]2=CCC1C2',
 '[*]C1=C([*])[CH]2=CCC1C2',
 '[*]C1=C([*])[CH]2=CC1CC2',
 '[*]C1=C([*])[CH]2=CC1CC2',
 '[*]C1=C([*])[CH]2=CC1CC2']

The HasSubstructMatch and GetSubstructMatches methods have a 'useChirality'
flag that is necessary to get '!$([@])' to even work. Do I need to dig
through the C++ and expose such a flag to the reaction APIs? Or is there an
easier way to accomplish what I'm doing?

Thanks,
Brian
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to