OEHelmToMol
Attention
This is a preliminary API and may be improved based on user feedback. It is currently available in C++ and Python.
OEHelmToMol(mol: Union[OEGraphMol,OEMol,OEQMol], helm: str,
monomers: OEMonomerSet) -> bool
OEHelmToMol(mol: Union[OEGraphMol,OEMol,OEQMol], helm: str,
monomers: OEMonomerSet, result: OEHelmParsingResult) -> bool
Converts a HELM string into a molecule. The function will return true if the HELM string can be parsed and interpreted successfully, otherwise the function will return false and a given molecule will be cleared.
- mol
The constructed molecule (
OEMolBase).- helm
The HELM string that is parsed into the molecule.
- monomers
The monomer set (
OEMonomerSet) that stores the monomers that are used to interpret the HELM string.If the given monomer set supports multiple code sets,
OEHelmToMolautomatically selects the code set that contains all monomer codes needed to parse the HELM string.- result
Is specified, the
OEHelmParsingResultobject will store additional parsing information.
After constructing the molecule the following properties are perceived:
Rings are perceived by calling the
OEFindRingAtomsAndBondsfunction.The aromaticity is assigned by calling the
OEAssignAromaticFlagsfunction using theOEAroModel_OpenEyearomaticity model.The chirality is perceived by calling the
OEPerceiveChiralfunction.
Warning
The current implementation of HELM parsing algorithm does not support RNA polymers.
Example
from openeye import oechem
# read monomer set
monomers = oechem.OEMonomerSet()
oechem.OELoadOpenEyeMonomerSet(monomers)
# parse HELM
mol = oechem.OEGraphMol()
helm = "PEPTIDE1{C.Y.I.Q.N.C.P.L.G.[am]}$PEPTIDE1,PEPTIDE1,1:R3-6:R3$$$"
result = oechem.OEHelmParsingResult()
if oechem.OEHelmToMol(mol, helm, monomers, result):
# successful parsing
print(f"Peptide SMILES: {oechem.OEMolToSmiles(mol)}")
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
)
code = monomer_data.GetCode("OpenEye")
atoms_str = " ".join(
f"{a.GetIdx():2d}{oechem.OEGetAtomicSymbol(a.GetAtomicNum())}"
for a in group.GetAtoms()
)
print(f"{code=:6s} atoms={atoms_str}")
else:
# failed parsing
print(f"Warning: {result.GetWarning()}")
print(helm)
print("-" * result.GetErrorPosition(), "^")
OEHelmToMol can parse HELM strings with embedded SMILES in various styles.
The examples below illustrate valid representations of eledoisin:
1PEPTIDE1{[N1[C@@H](CCC1=O)C([R2])=O].P.S.K.D.A.F.I.G.L.M.[am]}$$$$
2PEPTIDE1{[N1[C@@H](CCC1=O)C([*:2])=O].P.S.K.D.A.F.I.G.L.M.[am]}$$$$
3PEPTIDE1{[N1[C@@H](CCC1=O)C(*)=O |$;;;;;;;_R2;$|].P.S.K.D.A.F.I.G.L.M.[am]}$$$$
In case when the OEHelmToMol function successfully parses a HELM string
the atoms that are generated for a specific monomer are added to a molecule
as a group (OEGroupBase)
See also
[Zhang-2012] publications
OEGetHelmMonomerCodesfunctionOEGetHelmChainNamesfunctionOEMolToHelmfunction
OpenEye Python Cookbook Code Example