|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchemaxon.sss.search.MCES
public class MCES
This class finds the largest common substructure of two molecules. More precisely, it finds the maximum common edge subgraph (MCES) of the molecular structures.
There are various options for specifying when the atoms and bonds of the two molecules are matched with each other: the algorithm can either ignore or take atom type, bond type, charge, hybridization, and isotopes (atomic mass) into account. By default, only atom and bond types are matched. The algorithm can search for disconnected MCES as well, that is the common substurctures could consist of more than one components (fragments). A minimum required size can be specified for these components, moreover, there is an option to keep only the largest component.
The query and target structures basically play the same role in MCES search with the
only exception that the query molecule may contain special query atoms, namely,
LIST, NOTLIST, HETERO,
ANY.
This class applies a powerful heuristic algorithm, which typically finds large common
substructures in a short time. However, it does not always provide the exact optimal
result due to the size and complexity of the input structures.
There are different search modes, which control the running time and
the accuracy of the algorithm.
Although this is a randomized search, its behavior is deterministic and reproducible
(unless setTimeLimit() is used).
However, note that the found MCES could depend on the atom numbering of the query and
target molecules, that is, different results could be obtained for equivalent molecule
representations.
Typical usage:
MCES mces = new MCES();
mces.setMolecules(queryMol, targetMol);
... // search options using set*() methods
mces.search();
... // obtain results using get*() methods
// e.g. System.out.println(MolExporter.exportToFormat(mces.getAsMolecule(), "smiles"));
| Nested Class Summary | |
|---|---|
static class |
MCES.SearchMode
Enum type for search modes of the MCES algorithm. |
static class |
MCES.TerminationCause
Enum type for causes of MCES search termination. |
| Field Summary | |
|---|---|
static int |
DEFAULT_MIN_COMPONENT_SIZE
Default minimum size of MCES components (number of bonds). |
| Constructor Summary | |
|---|---|
MCES()
Creates a new object for MCES search. |
|
| Method Summary | |
|---|---|
void |
disableAromatization()
Disables aromatization for the input molecules. |
void |
enableAromatization()
Enables general aromatization for the input molecules. |
void |
enableAromatization(int method)
Enables the given aromatization method for the input molecules. |
int |
getAromatizationMethod()
Gets the aromatization method. |
Molecule |
getAsMolecule()
Gets the found MCES as a Molecule object. |
int |
getAtomCount()
Gets the number of atoms in the found MCES. |
boolean |
getAtomMapMatch()
Gets the matching mode for atom map numbers. |
int[] |
getAtomMapping()
Gets the atom mapping of the found MCES. |
int[] |
getAtomReverseMapping()
Gets the reverse atom mapping of the found MCES. |
boolean |
getAtomTypeMatch()
Gets the matching mode for atom types. |
int |
getBondCount()
Gets the number of bonds in the found MCES. |
int[] |
getBondMapping()
Gets the bond mapping of the found MCES. |
int[] |
getBondReverseMapping()
Gets the reverse bond mapping of the found MCES. |
boolean |
getBondTypeMatch()
Gets the matching mode for bond types. |
boolean |
getChargeMatch()
Gets the matching mode for atom formal charges. |
int |
getComponentCount()
Gets the number of components in the found MCES. |
boolean |
getHybridizationMatch()
Gets the matching mode for atom hybridization. |
boolean |
getIsotopeMatch()
Gets the matching mode for isotopes. |
boolean |
getKeepLargestComponent()
Gets which components of the found MCES should be kept. |
MolAtom[] |
getMatchedQueryAtoms()
Gets the query atoms that are part of the found MCES. |
MolBond[] |
getMatchedQueryBonds()
Gets the query bonds that are part of the found MCES. |
MolAtom[] |
getMatchedTargetAtoms()
Gets the target atoms that are part of the found MCES. |
MolBond[] |
getMatchedTargetBonds()
Gets the target bonds that are part of the found MCES. |
int |
getMinComponentSize()
Gets the minimum required size of the components of MCES. |
Molecule |
getQueryMolecule()
Gets the query molecular structure. |
MCES.SearchMode |
getSearchMode()
Gets the current search mode. |
int |
getStepCountLimit()
Gets the maximum allowed number of elementary search steps. |
Molecule |
getTargetMolecule()
Gets the target molecular structure. |
MCES.TerminationCause |
getTerminationCause()
Gets the termination cause of the last search. |
long |
getTimeLimit()
Gets the maximum allowed search time. |
MolAtom[] |
getUnmatchedQueryAtoms()
Gets the query atoms that are not part of the found MCES. |
MolBond[] |
getUnmatchedQueryBonds()
Gets the query bonds that are not part of the found MCES. |
MolAtom[] |
getUnmatchedTargetAtoms()
Gets the target atoms that are not part of the found MCES. |
MolBond[] |
getUnmatchedTargetBonds()
Gets the target bonds that are not part of the found MCES. |
boolean |
isLicensed()
Returns information about the licensing of the product. |
static void |
main(java.lang.String[] args)
Simple command line interface mainly for testing purposes. |
boolean |
search()
Performs MCES search according to the specified search options. |
void |
setAtomMapMatch(boolean match)
Sets the matching mode for atom map numbers. |
void |
setAtomTypeMatch(boolean match)
Sets the matching mode for atom types. |
void |
setBondTypeMatch(boolean match)
Sets the matching mode for bond types. |
void |
setChargeMatch(boolean match)
Sets the matching mode for atom formal charges. |
void |
setHybridizationMatch(boolean match)
Sets the matching mode for atom hybridization. |
void |
setIsotopeMatch(boolean match)
Sets the matching mode for isotopes. |
void |
setKeepLargestComponent(boolean keepLargest)
Sets which components of the found MCES should be kept. |
void |
setLicenseEnvironment(java.lang.String env)
Sets the license environment. |
void |
setMinComponentSize(int bondCount)
Sets the minimum required size of the components of MCES. |
void |
setMolecules(Molecule query,
Molecule target)
Sets the two molecular structures to be matched. |
void |
setQueryMolecule(Molecule query)
Sets the query molecular structure. |
void |
setSearchMode(MCES.SearchMode mode)
Sets search mode. |
void |
setStepCountLimit(int maxStepCount)
Sets the maximum allowed number of elementary search steps. |
void |
setTargetMolecule(Molecule target)
Sets the target molecular structure. |
void |
setTimeLimit(long maxMilliseconds)
Sets the maximum allowed search time. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_MIN_COMPONENT_SIZE
| Constructor Detail |
|---|
public MCES()
| Method Detail |
|---|
public boolean isLicensed()
isLicensed in interface chemaxon.license.Licensablepublic void setLicenseEnvironment(java.lang.String env)
setLicenseEnvironment in interface chemaxon.license.Licensable
public void setMolecules(Molecule query,
Molecule target)
query - query moleculetarget - target moleculepublic void setQueryMolecule(Molecule query)
query - query moleculepublic void setTargetMolecule(Molecule target)
target - target moleculepublic Molecule getQueryMolecule()
public Molecule getTargetMolecule()
public void enableAromatization()
enableAromatization(int) and
aromatization can be disabled using disableAromatization().
Molecule.aromatize(int)public void enableAromatization(int method)
disableAromatization().
Molecule.aromatize(int)public void disableAromatization()
public int getAromatizationMethod()
Molecule.aromatize(int)public void setSearchMode(MCES.SearchMode mode)
MCES.SearchMode.
mode - search modepublic MCES.SearchMode getSearchMode()
MCES.SearchMode.
public void setAtomTypeMatch(boolean match)
match - specifies if atom types are considered (true) or ignored (false)public void setBondTypeMatch(boolean match)
match - specifies if bond types are considered (true) or ignored (false)public void setChargeMatch(boolean match)
match - specifies if charges are considered (true) or ignored (false)public void setHybridizationMatch(boolean match)
match - specifies if hybridization states are considered (true) or ignored (false)public void setIsotopeMatch(boolean match)
match - specifies if mass numbers are considered (true) or ignored (false)public void setAtomMapMatch(boolean match)
match - specifies if atom map numbers are considered (true) or ignored (false)public boolean getAtomTypeMatch()
public boolean getBondTypeMatch()
public boolean getChargeMatch()
public boolean getHybridizationMatch()
public boolean getIsotopeMatch()
public boolean getAtomMapMatch()
public void setMinComponentSize(int bondCount)
DEFAULT_MIN_COMPONENT_SIZE.
bondCount - minimum required bond count in componentspublic int getMinComponentSize()
public void setKeepLargestComponent(boolean keepLargest)
size limit
are kept. If you use this function with true parameter, then only the largest component
of the found MCES is kept (the one that has the most bonds).
This search option results in a connected common substructure.
keepLargest - keep only the largest component (true) or all sufficiently large
components (false)public boolean getKeepLargestComponent()
public void setStepCountLimit(int maxStepCount)
search mode are applied.
You can use a negative parameter value to disable a previously specified
step count limit.
This method complements setTimeLimit(), though with the
guarantee of a deterministic, reproducible behavior. This is better for testing,
validation and batch usage purposes.
maxStepCount - maximum number of elementary search stepsgetTerminationCause()public int getStepCountLimit()
setStepCountLimit().
public void setTimeLimit(long maxMilliseconds)
search mode are applied.
You can use a negative parameter value to disable a previously specified
time limit.
This method complements setStepCountLimit(),
though with no guarantee of a deterministic, reproducible behavior but with
an easy and evident control of maximum running time.
This could be better for interactive use cases.
maxMilliseconds - maximum running time in millisecondsgetTerminationCause()public long getTimeLimit()
setTimeLimit().
public boolean search()
Before executing the search process, this function makes copies of the input molecules and performs the specified aromatization method on them (unless aromatization is disabled). Furthermore, it also calculates the hybridization states if they are considered in atom matching.
public int getAtomCount()
public int getBondCount()
public int getComponentCount()
public int[] getAtomMapping()
public int[] getAtomReverseMapping()
public int[] getBondMapping()
public int[] getBondReverseMapping()
public MolAtom[] getMatchedQueryAtoms()
public MolBond[] getMatchedQueryBonds()
public MolAtom[] getMatchedTargetAtoms()
public MolBond[] getMatchedTargetBonds()
public MolAtom[] getUnmatchedQueryAtoms()
public MolBond[] getUnmatchedQueryBonds()
public MolAtom[] getUnmatchedTargetAtoms()
public MolBond[] getUnmatchedTargetBonds()
public Molecule getAsMolecule()
Molecule object.
The returned substructure is originated from the target molecule, since the query
could contain special non-specific atoms.
As a result, the returned molecule has exactly the same properties (atom types,
bond types, charges, isotopes, etc.) as the corresponding substructure of the
target molecule, but those properties that are not considered during the search
could differ from the corresponding substructure of the query molecule.
This function builds a new Molecule object each time it is called.
You should store its result instead of multiple calls.
Moleculepublic MCES.TerminationCause getTerminationCause()
MCES.TerminationCause.
public static void main(java.lang.String[] args)
args - command line arguments (filenames, flags, options)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||