Hi everyone,

I have molecules from a SDfile to store in Pickle format.

So I read the SDfile and with mol.GetProp() function, I can access to a property of the molecule included in the SDfile. Unfortunately, when I convert the molecule in Pickle and come back to the rdkit mol format, the property is lost.

What I am doing wrong?

Here is my script. I am using RDKit 2015_03_1 on Windows 10, 64bit.


from __future__ import print_function
from rdkit import Chem
import cPickle as pickle

SDfile = "sdfile.sdf"

suppl = Chem.SDMolSupplier(SDfile, sanitize=True)

ms = [x for x in suppl if x is not None]

## Convert in Pickle
pklsuppl = []
for mol in suppl:
    if mol is None: continue
    if mol.HasProp('Code'):
        print('Prop ok in Mol')
        print('No Prop in Mol')
    pkl = pickle.dumps(mol, protocol=pickle.HIGHEST_PROTOCOL)
    newmol = pickle.loads(pkl)
    if newmol.HasProp('Code'):
        print('Prop ok in NewMol')
        print('No Prop in NewMol')

I obtain "Prop ok in Mol" and "No Prop in NewMol".

Thanks for your help,


Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Rdkit-discuss mailing list

Reply via email to