Hi JP,
On Mon, Nov 12, 2012 at 1:40 PM, JP <[email protected]> wrote:
> Hi there RDkitters,
>
> I have a molecule defined in aromatic form ("c1n[nH]nn1") and I am
> trying to do a replace substructs on it using the equivalent kekule
> form as a query ("'C1=N[NH1]N=N1"). However the substitution does not
> happen. As shown by the following code:
>
> from rdkit import Chem
> from rdkit.Chem import AllChem
>
> mol = Chem.MolFromSmiles('c1n[nH]nn1')
> r = Chem.MolFromSmiles('c1[n-]nnn1', sanitize=False) # some arbitrary tautomer
> q = Chem.MolFromSmarts('C1=N[NH1]N=N1')
> replaced = AllChem.ReplaceSubstructs(mol, q, r, replaceAll=True)[0]
> print Chem.MolToSmiles(replaced)
>
> Any ideas why this is the case/what I am doing wrong?
It's doing what you asked, but what you asked isn't actually what you want. :-S
This particular example is nicely covered by section 4.7 ("SMARTS
versus SMILES") of this page:
http://www.daylight.com/dayhtml/doc/theory/theory.smarts.html
-greg
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss