OERoleSet

class OERoleSet

This class represents OERoleSet, a parent class for objects that need to store OERole objects.

An OERole is an object that helps define a classification (naming) scheme to represent a category or functional role.

role = oechem.OERole("my:analysis:active-site")
print(role.GetName())

Objects derived from OERoleSet can have OERole objects added to them as a way of marking them for particular uses.

frag = oechem.OEAtomBondSet()  # isa OERoleSet
frag.AddRole(role)
The following classes derive from this class:

It is possible to test if an OERole has been added using the HasRole method, or with the OEHasRole predicate.

AddRole

bool AddRole(const OERole &role)

Add the specified OERole to this OERoleSet. Returns true if successful.

bool AddRole(const std::string &name)

Convenience method for adding a OERole by name.

frag.AddRole("my:analysis:low-energy")

ClearRoles

void ClearRoles()

Delete all the OERole objects from this OERoleSet.

DeleteRole

bool DeleteRole(const OERole &role)
bool DeleteRole(const std::string &name)

Delete the specified OERole from this OERoleSet. Returns true if successful.

frag.DeleteRole(role)
frag.DeleteRole("my:analysis:some-role")

GetRoles

OEIterBase<const OERole> *GetRoles() const

Returns an iterator of every OERole object in this OERoleSet.

print([r.GetName() for r in frag.GetRoles()])

HasRole

bool HasRole(const OERole &role) const

Returns true if the OERoleSet contains the specified role.

role2 = oechem.OERole("my:analysis:low-energy")
print(frag.HasRole(role2))
bool HasRole(const std::string &name) const

Convenience method for testing membership with a string.

print(frag.HasRole("my:analysis:small"))

NumRoles

unsigned int NumRoles() const

Returns the current number of OERole objects in this OERoleSet.