Perhaps an easier example...

Replacing a substructure by itself also gives fragments (!?).  I don't
understand why.

#!/usr/bin/env python

from rdkit import Chem
from rdkit.Chem import AllChem

mol = Chem.MolFromSmiles("c1cc2c(cc1)C(O)=C(NC)C(=N)C2=O")

for a in mol.GetAtoms():
    print a.GetIdx(), " -> ", a.GetSmarts()

q = Chem.MolFromSmiles("[OH]C=CC=N")
r = Chem.MolFromSmiles("[OH]C=CC=N")

print mol.GetSubstructMatches(q) # we have a match
modified = AllChem.ReplaceSubstructs(mol, q, r)
for m in modified:
    print Chem.MolToSmiles(m) # fragmented ?! WHY ?!

-
Jean-Paul Ebejer
Early Stage Researcher


On 15 June 2012 11:06, JP <[email protected]> wrote:
> Hi there,
>
> I have a list of molecules of which I want all to be in the same
> tautomeric (does this word even exist?) form.
>
> This "cheat" works fine using ReplaceSubstructs on my 100+ molecule
> with the exception of one case, where the resulting molecule is being
> fragmented.  Can someone explain why this is the case?
>
> Now to code:
>
> #!/usr/bin/env python
>
> from rdkit import Chem
> from rdkit.Chem import AllChem
>
> mol = 
> Chem.MolFromSmiles("COc1c(/N=C2\C(=O)c3c(cccc3)C(O)=C2n2nnc3ccccc23)cccc1")
> q = Chem.MolFromSmarts("OC1=CC(=N)C(=O)c2ccccc12")
> r = Chem.MolFromSmiles("NC1=CC(=O)c2ccccc2C1=O", sanitize=False)
>
> modified = AllChem.ReplaceSubstructs(mol, q, r, replaceAll=True)[0]
>
> # the following gives COc1ccccc1.NC1=CC(=O)c2ccccc2C1=O.n1nc2ccccc2n1
> # fragmented ?! WHY ?!
> print Chem.MolToSmiles(modified)
>
>
> -
> Jean-Paul Ebejer
> Early Stage Researcher

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to