Apologies for repeated posting.

Using RDKit 2011.12.1.

I can read an SDF file (attached: test.sdf) using ForwardSDMolSupplier
(with sanitization explicitly turned on) - but I cannot write the molecule
back to a second SD file using SDWriter.
Interestingly, upon writing it fails with a sanitization error (ValueError:
"Sanitization error: Can't kekulize mol").  Note that the molecule is not
null and I am not doing anything with the molecule.

My question is: how did the molecule pass the initial sanitization test
(when it is read) but not the second (when it is written) ?

Code attached for ease of reproducibility.

-
Jean-Paul Ebejer
Early Stage Researcher
#!/usr/bin/env python

from rdkit import Chem

# let us make sure sanitization is explicitely on
suppl = Chem.ForwardSDMolSupplier('test.sdf', sanitize=True)

wr = Chem.SDWriter('out.sdf')
for m in suppl:
    # we have a mol instance
    print "Here is your read mol:", m
    # but we cannot write it
    wr.write(m)

wr.flush()
wr.close()
suppl.close()

Attachment: test.sdf
Description: application/extension-sdf

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to