UnixJunkie / molenc

MolEnc: a molecular encoder using rdkit and OCaml.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

molenc_std.py: add -p|--preserve-stereo

UnixJunkie opened this issue · comments

keep stereo chemistry info if present; currently I think any of it is discarded

and really test it compared to the previous version

    def super_parent(self, mol, skip_standardize=False):
        """Return the super parent of a given molecule.
        THe super parent is fragment, charge, isotope, stereochemistry and tautomer insensitive. From the input
        molecule, the largest fragment is taken. This is uncharged and then isotope and stereochemistry information is
        discarded. Finally, the canonical tautomer is determined and returned.
        :param mol: The input molecule.
        :type mol: :rdkit:`Mol <Chem.rdchem.Mol-class.html>`
        :param bool skip_standardize: Set to True if mol has already been standardized.
        :returns: The super parent molecule.
        :rtype: :rdkit:`Mol <Chem.rdchem.Mol-class.html>`
        """
        if not skip_standardize:
            mol = self.standardize(mol)
        # We don't need to get fragment parent, because the charge parent is the largest fragment
        mol = self.charge_parent(mol, skip_standardize=True)
        mol = self.isotope_parent(mol, skip_standardize=True)
        mol = self.stereo_parent(mol, skip_standardize=True)
        mol = self.tautomer_parent(mol, skip_standardize=True)
        mol = self.standardize(mol)
        return mol

included in v16.14.2