OEMonomerSet
Attention
This is a preliminary API and may be improved based on user feedback. It is currently available in C++ and Python.
class OEMonomerSet
A container class that stores monomer definitions.
There are two built in monomer set supported by OEChem
“Standard” - contains 20 standard amino acid in the code-set named Standard
“OpenEye” - contains more than 200 diverse monomers in defined in four code-sets named:
OpenEye,Standard,PDBandChEMBL
A monomer has to be defined in at least one code-set. In a code-set each monomer has to have a unique name, built different code set can a monomer cna be named differently.
Monomer Name |
Code in OpenEye [1] |
Code in Standard |
Code in PDB |
Code in ChEMBL |
|---|---|---|---|---|
Alanine |
A |
A |
ALA |
A |
Cysteine |
C |
C |
CYS |
c |
D-Alanine |
dAla |
DAL |
dA |
|
(2S)-2-amino-3-(3-pyridyl)propanoic acid |
3Pal |
1MH |
3-Pal |
Download JSON file of built-in Standard and OpenEye monomer-set
monomers-standard.jsonand seeOELoadStandardMonomerSetfunctionmonomers-openeye.jsonand seeOELoadOpenEyeMonomerSetfunction
The following example shows how to generate a custom monomer set:
from openeye import oechem
code_set = "CUSTOM"
monomers = oechem.OEMonomerSet()
monomers.AddCodeSet(code_set)
new_monomers = [
("c1ccc(cc1)C[C@@H](C(=O)O)N", "Phe"),
("c1ccc(cc1)C[C@H](C(=O)O)N", "D-Phe"),
("CN[C@@H](Cc1ccccc1)C(=O)O", "mePhe"),
("CN[C@H](Cc1ccccc1)C(=O)O", "D-mePhe"),
("c1cc(ccc1C[C@@H](C(=O)O)N)F", "Phe(4-F)"),
]
mol = oechem.OEGraphMol()
for smiles, code in new_monomers:
oechem.OESmilesToMol(mol, smiles)
if not oechem.OEPerceivePeptideMonomerConnections(mol):
oechem.OEThrow.Warning(
"Cannot not perceive monomer connection for '{0}' ".format(smiles)
)
continue
polymer_type = oechem.OEGetPolymerType(mol)
monomer_type = oechem.OEGetMonomerType(mol)
monomer_smiles = oechem.OEMolToSmiles(mol)
monomer_data = oechem.OEMonomerData(monomer_smiles, polymer_type, monomer_type)
monomer_data.AddCode(code_set, code)
result = oechem.OEMonomerValidationResult()
if not oechem.OEIsValidMonomerData(monomer_data, result):
oechem.OEThrow.Error(
"Invalid monomer definition for '{0}' [warning={1}]".format(
monomer_data.GetName(), result.GetWarning()
)
)
continue
if not monomers.AddMonomer(monomer_data):
oechem.OEThrow.Warning("Problem adding {0} monomer to set!".format(code))
print(f"Generated monomer set with {monomers.NumMonomers()} monomers.")
The generated OEMonomerSet object can be saved into a JSON file using
OEWriteMonomerSet and later loaded with thee OEReadMonomerSet function.
See also
OEPerceivePeptideMonomerConnectionsfunctionOEGetPolymerTypeandOEGetMonomerTypefunctionsOEMonomerDataclass andOEIsValidMonomerDatafunction
OpenEye Python Cookbook Code Example
Generating Custom Monomer Set OpenEye Python Cookbook recipe
Constructors
OEMonomerSet() -> OEMonomerSet
Constructors an empty monomer set.
AddCodeSet
AddCodeSet(codeSet: str) -> bool
Adds a code-set name.
AddMonomer
AddMonomer(arg2: OEMonomerData) -> bool
Adds a monomer (defined by in a OEMonomerData object) to the monomer set.
The monomer is validated with the OEIsValidMonomerData function.
The method will returns if the monomer was valid and it was successfully added to the set,
otherwise it will return false.
Adding a valid monomer (OEMonomerData) can fail if:
the monomer is already present in the set (using canonical isomeric smiles for equivalency check)
the monomer has a code that is already used in the specific code-set stored in the set
GetCodeSets
GetCodeSets() -> OEStringVector
Returns all the code-sets supported by the monomer set.
See also
GetCodes
GetCodes(codeSet: str) -> OEStringVector
Returns all the monomer codes stored in the monomer set for the given code-set.
GetMonomer
GetMonomer(codeSet: str, code: str) -> OEMonomer
Returns a monomer pointer with the given code in the specified code-set. NULL pointer will be return if no such monomer exists in the set.
GetMonomers
GetMonomers() -> Iterable[OEMonomer]
Returns an iterator over all OEMonomer objects
stored in monomer set.
GetMonomers(pred: OEUnaryMonomerPred) -> Iterable[OEMonomer]
Returns an iterator over all OEMonomer objects
stored in monomer set that satisfies the given predicate.
GetPrimaryCodeSet
GetPrimaryCodeSet() -> str
Returns the name of the primary code-set of the monomer set. The primary code-set is the set that has the largest number of monomers defined with a unique code.
See also
OEMonomerSet.GetCodeSetsmethodOEMonomerSet.NumMonomersmethod
GetVersion
GetVersion() -> str
Returns the version of the monomer set.
See also
OEMonomerSet.SetVersionmethod
HasCodeInCodeSet
HasCodeInCodeSet(codeSet: str, code: str) -> bool
Returns whether the monomer set contains a specific monomer with the given code and code-set.
HasCodeSet
HasCodeSet(codeSet: str) -> bool
Returns whether the monomer set contains any monomer for the given code-set.
HasMonomer
HasMonomer(arg2: OEMonomerData) -> bool
Returns whether the monomer (OEMonomerData) already exists in the monomer set.
Each monomer in the OEMonomerSet has to have a unique canonical smiles.
IsValid
IsValid() -> bool
Returns whether the monomer set stores at least one valid monomer object.
NumCodeSets
NumCodeSets() -> int
Returns the number of unique code set the monomers are defined.
NumMonomers
NumMonomers() -> int
Returns the number of monomers in the container.
NumMonomers(codeSet: str) -> int
Returns the number of monomers in the container that associated wit a code in the given code-set.
See also
NumMonomers(pred: OEUnaryMonomerPred) -> int
Returns the number of monomers that satisfy the given predicate.
See also
OEHasAminoAcidTypepredicateOEHasMonomerTypepredicateOEHasPolymerTypepredicateOEIsInMonomerCodeSetpredicate
SetVersion
SetVersion(version: str) -> None
Sets the version of the monomer set. The function does not validate the format of the given string. However OpenEye’s built-in monomer sets are using the following conventions:
The version format is A.B.C (The first is version is “1.0.0”)
A: incremented for major changes in monomer set that has effect of parsing already generated HELMS with the given code set.
monomer is removed
monomer smiles has been corrected (for example correcting stereo configuration)
monomer code is modified
B: incremented for minor changes in monomer set that has effect on generating new HELMs but will not effect paring of HELMs generated with previous versions (backwards-compatibility)
new monomer is added
new R-group is added to already existing monomer
C: incremented for micro changes hat does not effect either HELM parsing or generation (backwards-compatibility)
monomer name change
adding additional monomer properties (such as associating colors with monomers for depiction)