Clique detection is a bounded common structure search. It is a useful search method in cases where common substructure(s) other than the maximum common substructure(s) need to be identified. The following example demonstrates clique search.
#include "oechem.h" #include <iostream> using namespace std; using namespace OEChem; using namespace OESystem; int main() { OEGraphMol m1,m2; OEParseSmiles(m1, "c1cc(O)c(O)cc1CCN"); OEParseSmiles(m2, "c1c(O)c(O)c(Cl)cc1CCCBr"); OECliqueSearch cs(m1,OEExprOpts::DefaultAtoms,OEExprOpts::DefaultBonds); cs.SetSaveRange(5); unsigned int count; OEIter<OEMatchBase> match; for (count=1,match = cs.Match(m2);match;++match,count++) { OEIter<OEMatchPair<OEAtomBase> > apr; cout << "Match " << count << ':' << endl; cout << "pattern atoms: "; for (apr = match->GetAtoms();apr;++apr) cout << apr->pattern->GetIdx() << ' '; cout << endl; cout << "target atoms: "; for (apr = match->GetAtoms();apr;++apr) cout << apr->target->GetIdx() << ' '; cout << endl; } return 0; }
The same molecules and expression options as the prior example are
used, however, an iterator over all identified cliques is returned by
the OECliqueSearch::Match
method. The
OECliqueSearch::SetSaveRange
method bounds the search. In this
case, cliques returned will only differ by five nodes relative to the
maximum common substructure. The atom correspondences for each of the
returned cliques are printed in the example program.