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, PDB and ChEMBL

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.

Example of monomer codes in the built-in OpenEye monomer-set

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

The following example shows how to generate a custom monomer set:

const string codeSet = "CUSTOM";
OEMonomerSet monomers;
monomers.AddCodeSet(codeSet);
vector<pair<string, string>> newMonomers = {
    {"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)"},
};

OEGraphMol mol;
for (const auto& [smiles, code] : newMonomers)
{
  OESmilesToMol(mol, smiles);
  if (!OEPerceivePeptideMonomerConnections(mol))
  {
    OEThrow.Warning("Cannot not perceive monomer connection for '%s' ", smiles.c_str());
    continue;
  }
  const unsigned polymerType = OEGetPolymerType(mol);
  const unsigned monomerType = OEGetMonomerType(mol);
  const string monomerSmiles = OEMolToSmiles(mol);
  OEMonomerData monomerData(monomerSmiles, polymerType, monomerType);
  monomerData.AddCode(codeSet, code);

  OEMonomerValidationResult result;
  if (!OEIsValidMonomerData(monomerData))
  {
    OEThrow.Warning("Invalid monomer definition for '%s' [warning=%s]", code.c_str(), result.GetWarning().c_str());
    continue;
  }
  if (!monomers.AddMonomer(monomerData))
    OEThrow.Warning("Problem adding %s monomer to set!", code.c_str());
}
cout << "Generated monomer set with " << monomers.NumMonomers() << " monomers." << endl;

The generated OEMonomerSet object can be saved into a JSON file using OEWriteMonomerSet and later loaded with thee OEReadMonomerSet function.

OpenEye Python Cookbook Code Example

Constructors

OEMonomerSet()

Constructors an empty monomer set.

AddCodeSet

bool AddCodeSet(const std::string& codeSet)

Adds a code-set name.

AddMonomer

bool AddMonomer(const OEMonomerData &)

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

std::vector<std::string> GetCodeSets() const

Returns all the code-sets supported by the monomer set.

GetCodes

std::vector<std::string> GetCodes(const std::string& codeSet) const

Returns all the monomer codes stored in the monomer set for the given code-set.

GetMonomer

const OEMonomer* GetMonomer(const std::string& codeSet,
                            const std::string& code) const

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

OESystem::OEIterBase<const OEMonomer>* GetMonomers() const

Returns an iterator over all OEMonomer objects stored in monomer set.

OESystem::OEIterBase<const OEMonomer>* GetMonomers(const OESystem::OEUnaryPredicate<OEMonomer>& pred) const

Returns an iterator over all OEMonomer objects stored in monomer set that satisfies the given predicate.

GetPrimaryCodeSet

std::string GetPrimaryCodeSet() const

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.

GetVersion

std::string GetVersion() const

Returns the version of the monomer set.

See also

HasCodeInCodeSet

bool HasCodeInCodeSet(const std::string& codeSet,
                      const std::string& code) const

Returns whether the monomer set contains a specific monomer with the given code and code-set.

HasCodeSet

bool HasCodeSet(const std::string& codeSet) const

Returns whether the monomer set contains any monomer for the given code-set.

HasMonomer

bool HasMonomer(const OEMonomerData &) const

Returns whether the monomer (OEMonomerData) already exists in the monomer set. Each monomer in the OEMonomerSet has to have a unique canonical smiles.

IsValid

bool IsValid() const

Returns whether the monomer set stores at least one valid monomer object.

NumCodeSets

unsigned NumCodeSets() const

Returns the number of unique code set the monomers are defined.

NumMonomers

unsigned NumMonomers() const

Returns the number of monomers in the container.

unsigned NumMonomers(const std::string& codeSet) const

Returns the number of monomers in the container that associated wit a code in the given code-set.

unsigned NumMonomers(const OESystem::OEUnaryPredicate<OEMonomer>& pred) const

Returns the number of monomers that satisfy the given predicate.

See also

SetVersion

void SetVersion(const std::string& version)

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)