Is it possible to remove hydrogens using ReactionFromSmarts, for example 
changing Cc1ccccc1 to [CH2]c1ccccc1?

I can do it using ReplaceSubstructs but I am trying to write more general code 
that also does other transformations that are better done with 
ReactionFromSmarts.  I can also create [CH2+]c1ccccc1? and then remove the + 
from the SMILES string but that is a hack

Here's sample code that, unfortunately, produces Cc1ccccc1

from rdkit import Chem
from rdkit.Chem import AllChem

m = Chem.MolFromSmiles("Cc1ccccc1")
rxn_smarts = '[CX4;H3:1]>>[CX4;H2:1]'

rxn = AllChem.ReactionFromSmarts(rxn_smarts)
newmol = rxn.RunReactants((m,))
print Chem.MolToSmiles(newmol[0][0],canonical=False)

Check out the vibrant tech community on one of the world's most
engaging tech sites,!
Rdkit-discuss mailing list

Reply via email to