OEDetectMonomers

Attention

This is a preliminary API and may be improved based on user feedback. It is currently available in C++ and Python.

OEDetectMonomers(mol: Union[OEGraphMol,OEMol,OEQMol],
                 monomers: OEMonomerSet) -> bool
OEDetectMonomers(mol: Union[OEGraphMol,OEMol,OEQMol],
                 monomers: OEMonomerSet, codeSet: str) -> bool

Detects the monomers defined in the specified monomer set in the given molecule. The function returns true if all atoms in the molecule are part of the defined monomers and false otherwise.

mol

The molecule (OEMolBase) to be searched for monomers.

monomers

The monomer set (OEMonomerSet) that stores the monomers that are being detected.

code-set

The code set to use for detecting monomers, if not specified the primary code-set of the monomer set will be used.

The detected monomers are stored on the molecule as groups (OEGroupBase).

Example

from openeye import oechem

# read monomer set
monomers = oechem.OEMonomerSet()
oechem.OELoadOpenEyeMonomerSet(monomers)

# generate HELM
mol = oechem.OEGraphMol()
smiles = (
    "CC[C@H](C)[C@H]1C(=O)N[C@H](C(=O)N[C@H](C(=O)N[C@@H](CSSC[C@@H](C(=O)N[C@H]"
    "(C(=O)N1)Cc2ccc(cc2)O)N)C(=O)N3CCC[C@H]3C(=O)N[C@@H](CC(C)C)C(=O)NCC(=O)N)CC(=O)N)CCC(=O)N"
)
oechem.OESmilesToMol(mol, smiles)
oechem.OEDetectMonomers(mol, monomers)

print(
    f"Number of monomers detected: {oechem.OECount(mol, oechem.OEHasGroupType(oechem.OEGroupType_Monomer))}"
)

monomer_codes = []
for group in mol.GetGroups(oechem.OEHasGroupType(oechem.OEGroupType_Monomer)):
    if group.HasData(oechem.OEProperty_Monomer):
        monomer_data: oechem.OEMonomerData = group.GetData(oechem.OEProperty_Monomer)
        monomer_codes.append(monomer_data.GetCode("OpenEye"))
print(sorted(monomer_codes))

See also