On Fri, Jul 8, 2011 at 8:34 PM, JP <[email protected]> wrote:
> Can anyone explain why the following seemingingly simple protonation won't
> work?
Yes.
> Why is it illegal? Do you have a workaround?
Also yes. ;-)
> #!/usr/bin/python
> from rdkit import Chem
> from rdkit.Chem import AllChem
> # Tetrazole ionization (Tautomer 1)
> mol = Chem.MolFromSmiles('CCc1nnn[nH]1')
> Chem.SanitizeMol(mol)
> repl = Chem.MolFromSmarts('[n-]')
> patt = Chem.MolFromSmarts('[$([nH]1nnnc1)]')
> rms = AllChem.ReplaceSubstructs(mol,patt,repl,replaceAll=True)
> print "Input: " , Chem.MolToSmiles(mol), " Output: ",
> Chem.MolToSmiles(rms[0])
> Chem.SanitizeMol(rms[0])
Your replacement molecule is constructed using MolFromSmarts, not
MolFromSmiles. This means that the negative charge is a query feature,
not a property of the atom. So when you try to sanitize your product
molecule the code doesn't see your charge and it can't kekulize the
molecule. The fix is:
repl = Chem.MolFromSmiles('[n-]',False)
-greg
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss