Hello,

Recently, I updated some Python code using

from rdkit.Chem.MolStandardize import Standardizer # rdkit <= '2023.09.3'

to

from rdkit.Chem.MolStandardize import rdMolStandardize # rdkit >= '2024.03.5'

Because after an rdkit fresh install, rdkit was updated and my former code
stopped working.

My old code was this:
---
standardizer = Standardizer()
def standardize(preserve_stereo, preserve_taut, mol):
    if preserve_stereo or preserve_taut:
        s_mol = standardizer.standardize(mol)
# We don't need to get fragment parent, because the charge parent is the largest fragment
        s_mol = standardizer.charge_parent(s_mol, skip_standardize=True)
s_mol = standardizer.isotope_parent(s_mol, skip_standardize=True)
        if not preserve_stereo:
s_mol = standardizer.stereo_parent(s_mol, skip_standardize=True)
        if not preserve_taut:
s_mol = standardizer.tautomer_parent(s_mol, skip_standardize=True)
        return standardizer.standardize(s_mol)
    else:
# standardizer.super_parent(mol): _NOT_ standardizer.standardize(mol)
        # which doesn't even unsalt the molecule...
        return standardizer.super_parent(mol)
---

And the new code is:
---
def standardize(preserve_stereo, preserve_taut, mol):
    if preserve_stereo or preserve_taut:
# We don't need to get fragment parent, because the charge parent is the largest fragment s_mol = rdMolStandardize.ChargeParent(mol, skipStandardize=False) s_mol = rdMolStandardize.IsotopeParent(s_mol, skipStandardize=True)
        if not preserve_stereo:
s_mol = rdMolStandardize.StereoParent(s_mol, skipStandardize=False)
        if not preserve_taut:
s_mol = rdMolStandardize.TautomerParent(s_mol, skipStandardize=False)
        return s_mol
    else:
        return rdMolStandardize.SuperParent(mol, skipStandardize=False)
---

Which I hope is isofunctional.

The old Standardizer module had a "standardize" method.

Is this method also present in rdMolStandardize?

Has it changed name (e.g. to rdMolStandardize.Cleanup)?

Regards,
Francois.


_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to