class OELibraryGen
OELibraryGen()
OELibraryGen(const char *smirks, bool strictSmirks=true)
Initialize an OELibraryGen instance with a SMIRKS pattern.
Success of initialization can be tested using the operator bool
method. The second constructor argument is used to specify whether
the SMIRKS string should be interpreted using strict SMIRKS semantics.
Here strict means in full compliance with the SMIRKS language defined
by its originator, Daylight CIS, Inc.
If the default value of true is used, the SMIRKS string must have
corresponding reaction mapped reactant and product atoms. Mapped
product atoms that do not have corresponding mapped reactant atoms are
considered invalid SMIRKS and will result in a failure to initialize
the OELibraryGen instance. Strict SMIRKS also requires
unmapped reactant atoms to be destroyed in the reaction. Passing a
boolean value of false to the second method argument will relax both
of the strict SMIRKS restrictions.
OELibraryGen(const OELibraryGen &rhs)
Copy constructor. Constructs a copy of the OELibraryGen
instance given as the argument to the constructor.
unsigned int AddStartingMaterial(OESystem::OEIter<OEMolBase>&,
unsigned int reacnum,
bool umatch=true)
unsigned int AddStartingMaterial(OESystem::OEIterBase<OEMolBase>*,
unsigned int reacnum,
bool umatch=true)
unsigned int AddStartingMaterial(const OEMolBase &mol,
unsigned int reacnum,
bool umatch = true)
The AddStartingMaterial methods are used to initialize the
starting materials corresponding to a reaction component (reactant).
An iterator over molecules or a single molecule may be passed as the
first argument to the overloaded methods. Subsequent calls to the
AddStartingMaterial methods append to the list of starting
materials set in prior calls. The second argument specifies the
reactant to which the starting materials correspond. A copy of the
staring 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 is
used to control the pattern matching of the reactant pattern to the
staring 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.
bool operator()(OEMolBase &mol) const
This method applies the set of transformations stored in the
OELibraryGen instance to the molecule passed as the only
argument to the method. The passed molecule must be composed of one
reactant molecule per reactant specified in the reaction with which
the OELibraryGen instance was initialized. The passed molecule
should be constructed by taking molecules retrieved using the
GetReactants method and concatenating them together using
either the OEAddMols function or the
OEMolBase::operator+= method. Although this interface may be
useful, it is not intended to be the primary interface for molecule
construction using the OELibraryGen method. The GetProducts
method provides a more natural means for iterating or randomly
accessing product molecules.
operator bool() const
This method returns boolean true if the OELibraryGen instance
has been initialized correctly. If the OELibraryGen instance
has not been initialized properly this method will return boolean
false.
void ClearStartingMaterial(unsigned reacnum)
This methods removes any starting materials previously set by either
the AddStartingMaterial and SetStartingMaterial methods
corresponding to the reactant pattern number passed as the argument to
the method.
bool GetExplicitHydrogens() const
This method returns current state of the variable that controls the
behavior of the OELibraryGen instance with respect to handling
hydrogens during application of reaction transforms. See
SetExplicitHydrogens for a more complete explanation of
possible hydrogen handling modes.
OESystem::OEIterBase<OEMolBase> *GetProducts() const
This method is the primary interface for generating a library of products from a reaction and a set of reactants. The pointer to an iterator base class over molecules must be assigned to an iterator over molecules. The following is an example assignment:
OEIter<OEMolBase> iter = libgen.GetProducts();
The returned iterator may be used to generate reaction products in
sequence, or by random access using the
OEIter<OEMolBase>::operator+= and
OEIter<OEMolBase>::operator-= methods.
OESystem::OEIterBase<OEMolBase> *GetReactants(unsigned int rnum) const
The GetReactants method takes an integer corresponding to the
reactant component number as specified in the reaction with which the
OELibraryGen instance was initialized. Reactants are numbered
starting from zero, and incremented by one when a reactant atom is
found that is disconnected from the first component. For example, in
a SMIRKS string the reactants are numbered starting from zero for the
leftmost reactant, and increasing by one for every dot disconnection
that isn't grouped with a previous part using parentheses.
bool GetTitleSeparator(const char *cptr) const
The GetTitleSeparator method retrieves the string used to
separate molecule titles in product molecules generated by the
OELibraryGen class. The titles of product molecules are
created by concatenating reactant molecule titles with a delimiter or
separator inserted between the reactant molecule titles. The default
separator is the underscore character ``_''. The title separator
string may be changed by calling the SetTitleSeparator method.
The method always returns true.
bool GetValenceCorrection() const
The GetValenceCorrection method returns the current valence
correction state of the parent OELibraryGen instance. See
SetValenceCorrection for a description of possible valence
correction modes.
bool Init(const char *smirks, bool strictSmirks=true)
This method is used to initialize an OELibraryGen instance with
a SMIRKS pattern passed as a pointer to a constant character string
given as the first argument to the method. If the OELibraryGen
instance is initialized successfully the method will return boolean
true. If the SMIRKS string is invalid or initialization fails the
method will return boolean false. The second argument to the method
is used to specify whether the SMIRKS string should be interpreted
using strict SMIRKS semantics. By default, the SMIRKS string is
interpreted using strict semantics. Here strict means in full
compliance with the SMIRKS language defined by its originator,
Daylight CIS, Inc. SMIRKS requires that reactant atoms that are
mapped must appear and have corresponding mapped atoms on the product
side. In addition, unmapped reactant atoms are destroyed as part of
the reaction. Passing a boolean value of false to the second method
argument relaxes both of these 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.
bool Init(const OEQMolBase &qmol, bool strictSmirks=true)
This method initializes an OELibraryGen instance with a
query molecule. If query molecule is created using the
OEParseSmirks function, and if the reaction is desired to be
interpreted using strict SMIRKS semantics (see Init(const
char*, bool strictSmirks for explanation of strict SMIRKS) then the
default value for the second argument to the method should be used.
Passing a boolean value of false to the second argument will relax the
restrictions imposed by strict SMIRKS semantics.
unsigned int NumReactants() const
The NumReactants method returns the number of separate
reactants that the OELibraryGen instance 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.
bool SetExplicitHydrogens(bool)
This variable sets the hydrogen handling mode for the
OELibraryGen instance. OELibraryGen instance are
constructed by default with the explicit hydrogen mode set to true.
Reactions may be executed using either implicit or explicit hydrogens
represented in the starting materials for a reaction. If the value is
true, the OELibraryGen instance will add explicit hydrogens to
reactant molecules when they are initialized using either of the
SetStartingMaterial methods. If the value is false, then both of the
SetStartingMaterial methods will suppress any explict hydrogens in the
reactant molecules, and simply retain the implicit hydrogen counts for
remaining non-hydrogen atoms. The hydrogen handling mode must be
assigned prior to calling SetStartingMaterial. Calling
SetExplicitHydrogens after SetStartingMaterial will have not
effect. Note that the explicit hydrogen setting in effect modifies
the semantics of smirks. If the programmer wishes to implement strict
SMIRKS according to the Daylight standard, in full, explicit hydrogens
should be set on.
unsigned int SetStartingMaterial(OESystem::OEIter<OEMolBase> &moliter,
unsigned int reacnum,
bool umatch=true)
unsigned int SetStartingMaterial(OESystem::OEIterBase<OEMolBase> *moliter,
unsigned int reacnum,
bool umatch=true)
unsigned int SetStartingMaterial(const OEMolBase &mol,
unsigned int reacnum,
bool umatch = true)
The SetStartingMaterial methods are used to initialize the
starting materials corresponding to a reaction component (reactant).
An iterator over molecules or a single molecule may be passed as the
first argument to the overloaded methods. Subsequent calls to the
SetStartingMaterial methods discard starting materials set in
prior calls. The second argument specifies the reactant to which the
starting materials correspond. A copy of the staring 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 is used to
control the pattern matching of the reactant pattern to the staring
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.
bool SetTitleSeparator(const char *cptr)
The SetTitleSeparator method is used to alter the separator or
delimiter used by the OELibraryGen class 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 ``_''. This method
allows the title separator to be modified. The method will store the
new title separator passed to the method, and return true for any
valid C style string. The method will return false if a null pointer
is passed as the calling argument. The title separator must be set
prior to calling GetProducts. Calling SetTitleSeparator
after calling GetProducts will have no affect on the resultant
product molecule titles.
bool SetValenceCorrection(bool)
The SetValenceCorrection method controls the valence correction
mode setting of an OELibraryGen instance. OELibraryGen
instances are constructed by default with the valence correction mode
set to false. Valence correction mode can be turned on by passing a
boolean true value to an OELibraryGen instance using this
method. When valence correction mode is enabled, the
OELibraryGen instance will attempt to adjust the
hydrogen count on atoms in the product molecule that are involved in
the reaction to match the original valence state of the reactant. For
product atoms that do not undergo a nuclear reaction (atomic number is
retained) the hydrogen count is either increased or decreased to match
the initial valence state of the corresponding reactant atom. Formal
charge is taken into account during the hydrogen count adjustment.
Note that valence correction in effect modifies the semantics of
smirks. Thus, if the programmer wishes to implement strict SMIRKS
according to the Daylight standard, in full, valence correction
should be set off.