rdkit: MolPickler doesn't preserve atom properties
from rdkit import Chem
mol = Chem.RWMol(Chem.MolFromSmiles('CCC'))
mol.GetAtomWithIdx(0).SetProp('label', 'X')
atom = mol.GetAtomWithIdx(0)
print(atom.HasProp('label'), atom.GetProp('label'))
mol = Chem.Mol(mol.ToBinary())
atom = mol.GetAtomWithIdx(0)
print(atom.HasProp('label'))
gives
1 X
0
It could be that there is a flag to preserve the atom properties. If that is the case, an improvement of the docs would be required. PropertyMol also doesn’t preserve the atom properties.
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 16 (16 by maintainers)
This was resolved by #1277 : it’s now possible to configure the RDKit to pickle molecular, atomic, and bond properties:
Note that the default behavior is the same as before, you do need to set the option in order to have properties pickled with the molecule.