Let's say I have a compound shown above (SMILES: CCC(F)(F)F
), and I want to exclude the trifluoromethyl group with SMARTS, how would I do that? I have tried [CX4;!$(C(F)(F)F)]
but it does not exclude C(F)(F)F
according to RDKit:
molecule = Chem.MolFromSmiles('CCC(F)(F)F')
pattern = Chem.MolFromSmarts('[CX4;!$(C(F)(F)F)]')
molecule.HasSubstructMatch(pattern) --> expected False, but returns True
I think the recursive portion is written incorrectly but I'm not sure how to correct it.
[CX4;!$(C(F)(F)F)]
with;
not&
I don't have time to investigate, but SMARTS viewer is usually helpful for these: smarts.plus $\endgroup$[CX4;!$(C(F)(F)F)]
looks correct, but clearly I'm missing something $\endgroup$