OELibraryGen¶
class OELibraryGen
This class represents OELibraryGen that is designed to perform library generation.
See also
Reactions chapter
Library generation example
OEUniMolecularRxn class
Constructors¶
OELibraryGen()
Default constructor.
OELibraryGen(const OELibraryGen &rhs)
Copy constructor.
OELibraryGen(const char * smirks, bool strictSmirks=true)
Creates a OELibraryGen object with the given SMIRKS
reaction.
Success of initialization can be tested using the operator
OELibraryGen.operator bool
method.
Passing a value of false
to the second method argument will relax
the strict SMIRKS restrictions.
A mapped reactant atom that does not have a corresponding mapped
product atom is valid, and will be destroyed as part of the
reaction.
Unmapped reactant atoms will be used to match the reactant
pattern, but are not destroyed when the reaction is applied.
The resulting SMIRKS like reactions may therefore be more easily
readable by humans as fewer atoms may be required to be mapped.
Atoms in the provided reaction must have unique mapping numbers, otherwise there is ambiguity as to the correspondence of reactant to product atoms. A duplicate mapping number warning message indicates that the SMIRKS must be corrected prior to use.
- smirks
The string representing the reaction for library generation.
- strictSmirks
The parameter that specifies the interpretation of the SMIRKS semantics.
See also
OELibraryGen.Init
method
operator()¶
bool operator()(OEMolBase &) const
operator bool¶
operator bool() const
Returns true
, if the OELibraryGen
object was initialized with no failures using either the
constructors or one of the
OELibraryGen.Init
methods.
The method will return false
when the
OELibraryGen object has not been properly
initialized as it will be unable to apply transform operations
to molecules.
AddStartingMaterial¶
unsigned int AddStartingMaterial(const OEMolBase &mol, unsigned int reacnum,
bool umatch=true)
unsigned int AddStartingMaterial(OESystem::OEIter<OEMolBase> &,
unsigned int reacnum, bool umatch=true)
unsigned int AddStartingMaterial(OESystem::OEIterBase<OEMolBase> *,
unsigned int reacnum, bool umatch=true)
Initializes the starting materials corresponding to a reaction
component.
An iterator over molecules or a single molecule may be passed as
the first argument to the overloaded methods.
Subsequent calls to the
OELibraryGen.AddStartingMaterial
methods
append to the list of starting materials set in prior calls.
The second argument (reacnum
) specifies the reactant to which
the starting materials correspond. The return value is the number of
starting materials that were successfully added for the specified reaction component.
A copy of the starting material molecules are stored internally with the atom maps from the reactant pattern. This is done for efficiency, as each product molecule requires very little computational work to be done because of the starting material preprocessing.
The final argument (umatch
) is used to control the pattern
matching of the reactant pattern to the starting material.
If the value passed is true
, only matches that contain a
unique set of atoms relative to previously identified matches
are used.
If the value is false
, every possible match including those
related by symmetry will be used. Reactant patterns are unique
matched by default.
See also
Starting Materials section of the :ref:
ClearStartingMaterial¶
void ClearStartingMaterial(unsigned reacnum)
Removes any starting materials previously set by either the
OELibraryGen.AddStartingMaterial
or the
OELibraryGen.SetStartingMaterial
methods
corresponding to the reactant pattern number (‘reacnum’ ) passed
as the argument to the method.
GetAssignMapIdx¶
bool GetAssignMapIdx() const
See also
Corresponding
OELibraryGen.SetAssignMapIdx
setter method
GetClearCoordinates¶
bool GetClearCoordinates() const
See also
Corresponding
OELibraryGen.SetClearCoordinates
setter method
GetExplicitHydrogens¶
bool GetExplicitHydrogens() const
See also
Corresponding
OELibraryGen.SetExplicitHydrogens
setter method
GetProducts¶
OESystem::OEIterBase<OEMolBase> *GetProducts() const
Returns an iterator over all the products generated by the library generation.
GetRemoveUnmappedFragments¶
bool GetRemoveUnmappedFragments() const
See also
Corresponding
OELibraryGen.SetRemoveUnmappedFragments
setter method
GetStartingMaterial¶
OESystem::OEIterBase<OEMolBase> *GetStartingMaterial(unsigned int rnum) const
Returns an iterator over all the starting materials that have been successfully added to the OELibraryGen object.
See also
GetTitleSeparator¶
const std::string& GetTitleSeparator() const
See also
Corresponding
OELibraryGen.SetTitleSeparator
setter method
GetValenceCorrection¶
bool GetValenceCorrection() const
See also
Corresponding
OELibraryGen.SetValenceCorrection
setter method
GetValidateKekule¶
bool GetValidateKekule() const
See also
Corresponding
OELibraryGen.SetValidateKekule
setter method
Init¶
bool Init(const OEQMolBase &mol, bool strictSmirks=true)
bool Init(const char *smirks, bool strictSmirks=true)
The first method initializes an OELibraryGen
object with the OEQMolBase
object.
The second method initializes an OELibraryGen
object with the ‘smirks’ pattern.
By default, the SMIRKS string is interpreted using strict semantics.
Passing a value of false
to the second method argument will relax
the strict SMIRKS restrictions.
A mapped reactant atom that does not have a corresponding mapped
product atom is valid, and will be destroyed as part of the
reaction.
Unmapped reactant atoms will be used to match the reactant
pattern, but are not destroyed when the reaction is applied.
The resulting SMIRKS like reactions may therefore be more easily
readable by humans as fewer atoms may be required to be mapped.
NumReactants¶
unsigned int NumReactants() const
Returns the number of separate reactants that the OELibraryGen object perceived during initialization. The value returned will be equal to the number of graphically disconnected reactants that are not grouped together using the SMIRKS parts primitive.
NumPossibleProducts¶
unsigned int NumPossibleProducts() const
Returns the number of all possible products generated by the library generation. A warning message will be thrown if the number possible combinations exceeds the \(2^{32}\) limit.
SetAssignMapIdx¶
bool SetAssignMapIdx(bool)
Sets whether the atom mapping of the reaction is transferred to the
product.
The default setting is false
i.e. no mapping will be transferred to
the product.
reaction |
product |
---|---|
SetClearCoordinates¶
bool SetClearCoordinates(bool clearcoords)
Sets whether the coordinates of a molecule are cleared when the
molecule is added to the library generation by calling the
OELibraryGen.AddStartingMaterial
or
OELibraryGen.SetStartingMaterial
methods.
The default setting is false
i.e. the coordinates will be kept.
Note
The OELibraryGen modifies the molecular graph of the reactant(s) to generate products. Generating valid 2D or 3D coordinates for the products is beyond the scope of the OELibraryGen class.
It is recommended to either clear the coordinates by
invoking the OELibraryGen.SetClearCoordinates
method or regenerate the coordinates of the products afterwards.
SetExplicitHydrogens¶
bool SetExplicitHydrogens(bool explcitH)
Sets whether to add explicit hydrogens or suppress them when a
starting material is added to the library.
The default setting is true
i.e. explicit hydrogens will be added.
See also
Starting Materials section of the Reactions chapter
SetRemoveUnmappedFragments¶
bool SetRemoveUnmappedFragments(bool remove)
Sets whether unmapped components of the products are removed or kept
prior to returning them by the OELibraryGen.GetProducts
method.
The default setting is false
i.e. unmapped components will be kept.
See also
Atom Mapping section of the Reactions chapter
SetStartingMaterial¶
unsigned int SetStartingMaterial(const OEMolBase &mol, unsigned int reacnum,
bool umatch=true)
unsigned int SetStartingMaterial(OESystem::OEIter<OEMolBase> &,
unsigned int reacnum, bool umatch=true)
unsigned int SetStartingMaterial(OESystem::OEIterBase<OEMolBase> *,
unsigned int reacnum, bool umatch=true)
Initializes the starting materials corresponding to a reaction
component.
An iterator over molecules or a single molecule may be passed as
the first argument to the overloaded methods.
Subsequent calls to the
OELibraryGen.SetStartingMaterial
methods
discard the list of starting materials set in prior calls.
The second argument (‘reacnum’) specifies the reactant to which
the starting materials correspond.
A copy of the starting material molecules are stored internally with the atom maps from the reactant pattern. This is done for efficiency, as each product molecule requires very little computational work to be done because of the starting material preprocessing.
The final argument (‘umatch’) is used to control the pattern
matching of the reactant pattern to the starting material.
If the value passed is true
, only matches that contain a
unique set of atoms relative to previously identified matches
are used.
If the value is false
, every possible match including those
related by symmetry will be used. Reactant patterns are unique
matched by default.
See also
Starting Materials section of the Reactions chapter
SetTitleSeparator¶
bool SetTitleSeparator(const char *c)
Sets the separator or delimiter used by the
OELibraryGen object to compose product molecule
titles.
Product molecule titles are created by concatenating reactant
molecule titles separated by a title separator or delimiter.
The default separator is the underscore character _
.
Note
The title separator must be set prior to calling
OELibraryGen.GetProducts
.
Calling OELibraryGen.SetTitleSeparator
after calling OELibraryGen.GetProducts
will have no affect on the resultant product molecule titles.
See also
Reactant Tracking section of the Reactions chapter
SetValenceCorrection¶
bool SetValenceCorrection(bool)
Sets whether valence correction is applied to the products prior to
returning them by the OELibraryGen.GetProducts
method.
The default setting is false
i.e. no valence correction will be performed.
See also
Valence Correction Modes section of the Reactions chapter
SetValidateKekule¶
bool SetValidateKekule(bool validate)
Sets whether the generated products are simply returned after a
Kekulization attempt, or if the Kekulé form is validated more
rigorously. If the extra validation is enabled and an invalid
Kekulé form is identified, alternatives are tried by adding
and removing implicit hydrogens from aromatic nitrogens to
produce a valid Kekulé form. No further attempt is made to
return the most reasonable or chemically sensible result. By
default, the extra Kekulé validation is enabled.
The default setting is true
i.e. Kekulé form
validation will be performed.
See also
Product Kekulization section of the Reactions chapter