OECliqueSearch¶
class OECliqueSearch
This class represents OECliqueSearch.
The OECliqueSearch class performs bounded common substructure searches. It is a useful search method in cases where common substructures other than the maximum common substructure (OEMCSSearch) need to be identified.
See also
Clique Search section
Example program cliquealign.cpp
Constructors¶
OECliqueSearch(unsigned int type=OEMCSType::Default)
Default constructor.
OECliqueSearch(const OECliqueSearch &)
Copy constructor.
OECliqueSearch(const char *smarts, unsigned int type=OEMCSType::Default)
Constructs an OECliqueSearch object using a ‘smarts’ pattern.
The SMARTS pattern is parsed into a query molecule
(OEQMolBase).
The valid types of the OECliqueSearch are defined
in the OEMCSType
namespace.
OECliqueSearch(const OEQMolBase &, bool perception=true,
unsigned int type=OEMCSType::Default)
Constructs an OECliqueSearch object using a query molecule (OEQMolBase).
- qmol
The query molecule of the MCS search.
- type
The type of the OECliqueSearch from the
OEMCSType
namespace.- perception
If
true
, then ring perception is performed on the query molecule.
OECliqueSearch(const OEMolBase &, unsigned int atomexpr, unsigned int bondexpr,
unsigned int type=OEMCSType::Default)
Constructs an OECliqueSearch object using a molecule and expression options.
The atom and bond expression options passed as the second and
third arguments to the method are defined in the
OEExprOpts
namespace.
The expression options are used to convert the atom and bond
data into expression trees which are used during the common
subgraph search.
operator=¶
OECliqueSearch &operator=(const OECliqueSearch &rhs)
Assignment operator that copies the data of the ‘rhs’ OECliqueSearch object into the right-hand side OECliqueSearch object.
operator bool¶
operator bool() const
Test for successful initialization of an
OECliqueSearch object.
If initialization was attempted with an invalid SMARTS
pattern or query molecule (OEQMolBase) then
this method will return false
.
If initialization was completed successfully this method will
return true
.
An OECliqueSearch object is considered to be
uninitialized when constructed with the default constructor.
AddConstraint¶
bool AddConstraint(const OEMatchPair<OEAtomBase> &)
bool AddConstraint(const OEMatchPair<OEBondBase> &)
The search space of a common subgraph determination can be restricted by constraining pairs of nodes or edges (atoms or bonds) to be mapped onto one another in all subgraph solutions. Failure to satisfy atom or bond pairwise constraints will prevent any subgraph solutions from being identified. Constraints are considered satisfied in subgraphs which do not contain any constrained atoms or bonds in either the pattern or target molecules.
Both OECliqueSearch::AddConstraint
methods return
true
if a constraint is added successfully.
If the pattern atom or bond in the OEMatchPair
does not exist as part of the query molecule created in the
initialization of the OECliqueSearch object then
OECliqueSearch::AddConstraint
will return
false
.
Multiple calls to OECliqueSearch::AddConstraint
using the same pattern atom or bond will cause previously stored
constraints to be overwritten as constraints are mutually
exclusive.
It is impossible to satisfy multiple simultaneous constraints
for a single pattern atom or bond, hence the exclusivity.
ClearConstraints¶
void ClearConstraints()
Clears all prior match constraints set with the
OECliqueSearch::AddConstraint
methods.
GetMaxMatches¶
unsigned int GetMaxMatches() const
Returns the maximum number of subgraphs
that the OECliqueSearch will identify
before terminating the search.
A value of zero indicates that no arbitrary limit has been set
on the total number of subgraphs to be identified.
By default, the maximum number of matches is set to 1024
This value can be set using the
OECliqueSearch::SetMaxMatches
method.
GetMinAtoms¶
unsigned int GetMinAtoms() const
Returns the minimum number of atoms of a subgraph that
can be returned as a common subgraph.
This value can be set using the
OECliqueSearch::SetMinAtoms
method.
GetPattern¶
const OEQMolBase &GetPattern() const
Returns a read-only reference to the query molecule (OEQMolBase) of OECliqueSearch. Const OEQMolBase methods can be used on the returned OEQMolBase reference. If the OECliqueSearch object has not been initialized, a reference to an empty molecule will be returned.
GetSaveRange¶
unsigned int GetSaveRange() const
This value can be set using the OECliqueSearch::SetSaveRange
method.
Any subgraphs found by the MCS function used by the search are discarded that have a smaller scoring value than
the maximum score minus this ‘range’. See OEMCSSearch for more details.
Init¶
bool Init(const char *smarts)
(Re)initializes an OECliqueSearch object using a
‘smarts’ pattern.
The SMARTS pattern is parsed to create a query molecule
available for subgraph matching.
The method will return true
if initialization completes
successfully, and false
upon failure.
Note
Prior state information is cleared before initialization, and is lost even if the method fails to initialize properly.
bool Init(const OEQMolBase &qmol, bool perception=true)
(Re)initializes an OECliqueSearch object using a
query molecule (OEQMolBase) reference.
The method will return true
if initialization completes
successfully, and false
upon failure.
- qmol
The query molecule of the MCS search.
- perception
If
true
, then ring perception is performed on the query molecule.
Note
Prior state information is cleared before initialization, and is lost even if the method fails to initialize properly.
bool Init(const OEMolBase &mol, unsigned int atomexpr, unsigned int bondexpr)
(Re)initializes an OECliqueSearch
object using a molecule (OEMolBase) and
expression options used to convert the molecule into a query
molecule (OEQMolBase).
The atom and bond expression options passed as the second and
third arguments to the method are defined in the
OEExprOpts
namespace.
Expression options are used to convert the atom and bond data
into expression trees which are used during the common subgraph
search.
The method will return true
if initialization completes
successfully, and false
upon failure.
Note
Prior state information is cleared before initialization, and is lost even if the method fails to initialize properly.
Match¶
OESystem::OEIterBase<OEMatchBase> *Match(const OEMolBase &)
Performs search in order to identify common subgraphs (cliques) shared between the passed OEMolBase and the query molecule which the OECliqueSearch object was initialized. It returns an iterator pointer (OEIterBase) over graph matches (OEMatchBase), and should be assigned to an OEIter < OEMatchBase > in order to prevent memory leaks.
If the ‘uniquematch’ argument passed to the methods is true
then
only the unique matches will be returned in the iterator over the matches.
By definition, a match or subgraph is considered unique if it differs
from all other subgraphs found previously by at least one atom or
bond.
Additionally, it is also considered unique if the query subgraph
is mapped to a different part of the target
(See example in the Maximum Common Substructure Search section)
SetMCSFunc¶
bool SetMCSFunc(const OEMCSFunc &)
Stores a copy of the passed OEMCSFunc functor in the OECliqueSearch object. The functor is then used to evaluate and order subgraphs found during a common subgraph search.
SetMaxMatches¶
bool SetMaxMatches(unsigned int)
Sets the maximum number of common subgraph (clique) matches that
will be returned by the OECliqueSearch::Match
method.
The default limit set upon construction of an
OECliqueSearch object is 1024
matches.
This value can be retrieved
using the OECliqueSearch::GetMaxMatches
method.
SetMinAtoms¶
bool SetMinAtoms(unsigned int)
Sets the minimum number of atoms required of a subgraph match to
be returned a solution by a clique search.
A single atom can be a perfectly valid common subgraph,
however, for many applications such a small subgraph may not be
considered useful.
Setting the minimum number of atoms to an appropriate size
prevents unproductive subgraph matches from being returned by
the OECliqueSearch::Match
method.
The default value for the minimum number of atoms in a subgraph
match is set to 1
upon construction of an
OECliqueSearch object.
This value can be retrieved using the
OECliqueSearch::GetMinAtoms
method.
SetSaveRange¶
bool SetSaveRange(unsigned int)
Sets the range of the clique search.
This value can be retrieved using the
OECliqueSearch::GetSaveRange
method.