Class Isomorphism
- All Implemented Interfaces:
Serializable
This class implements the Isomorphism- a multipurpose structure comparison tool. It allows users to, i) find the maximal common substructure(s) (MCS); ii) perform the mapping of a substructure in another structure, and; iii) map two isomorphic structures.
It also comes with various published algorithms. The user is free to choose his favorite algorithm to perform MCS or substructure search. For example 0: Isomorphism algorithm, 1: MCSPlus, 2: VFLibMCS, 3: CDKMCS, 4: Substructure
It also has a set of robust chemical filters (i.e. bond energy, fragment count, stereo & bond match) to sort the reported MCS solutions in a chemically relevant manner. Each comparison can be made with or without using the bond sensitive mode and with implicit or explicit hydrogens.
If you are using Isomorphism, please cite Rahman et.al. 2009 [Rahman, S.A. et. al.. Journal of Cheminformatics. 2009. 1]. The Isomorphism algorithm is described in this paper.
An example for Substructure search:
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
// Benzene
IAtomContainer A1 = sp.parseSmiles("C1=CC=CC=C1");
// Napthalene
IAtomContainer A2 = sp.parseSmiles("C1=CC2=C(C=C1)C=CC=C2");
//Turbo mode search
//Bond Sensitive is set true
Isomorphism comparison = new Isomorphism(Algorithm.SubStructure, true);
// set molecules, remove hydrogens, clean and configure molecule
comparison.init(A1, A2, true, true);
// set chemical filter true
comparison.setChemFilters(false, false, false);
if (comparison.isSubgraph()) {
//Get similarity score
System.out.println("Tanimoto coefficient: " + comparison.getTanimotoSimilarity());
System.out.println("A1 is a subgraph of A2: " + comparison.isSubgraph());
//Get Modified AtomContainer
IAtomContainer Mol1 = comparison.getReactantMolecule();
IAtomContainer Mol2 = comparison.getProductMolecule();
// Print the mapping between molecules
System.out.println(" Mappings: ");
for (Map.Entry <Integer, Integer> mapping : comparison.getFirstMapping().entrySet()) {
System.out.println((mapping.getKey() + 1) + " " + (mapping.getValue() + 1));
IAtom eAtom = Mol1.getAtom(mapping.getKey());
IAtom pAtom = Mol2.getAtom(mapping.getValue());
System.out.println(eAtom.getSymbol() + " " + pAtom.getSymbol());
}
System.out.println("");
}
An example for MCS search:
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
// Benzene
IAtomContainer A1 = sp.parseSmiles("C1=CC=CC=C1");
// Napthalene
IAtomContainer A2 = sp.parseSmiles("C1=CC2=C(C=C1)C=CC=C2");
//{ 0: Default Isomorphism Algorithm, 1: MCSPlus Algorithm, 2: VFLibMCS Algorithm, 3: CDKMCS Algorithm}
//Bond Sensitive is set true
Isomorphism comparison = new Isomorphism(Algorithm.DEFAULT, true);
// set molecules, remove hydrogens, clean and configure molecule
comparison.init(A1, A2, true, true);
// set chemical filter true
comparison.setChemFilters(true, true, true);
//Get similarity score
System.out.println("Tanimoto coefficient: " + comparison.getTanimotoSimilarity());
System.out.println("A1 is a subgraph of A2: " + comparison.isSubgraph());
//Get Modified AtomContainer
IAtomContainer Mol1 = comparison.getReactantMolecule();
IAtomContainer Mol2 = comparison.getProductMolecule();
// Print the mapping between molecules
System.out.println(" Mappings: ");
for (Map.Entry <Integer, Integer> mapping : comparison.getFirstMapping().entrySet()) {
System.out.println((mapping.getKey() + 1) + " " + (mapping.getValue() + 1));
IAtom eAtom = Mol1.getAtom(mapping.getKey());
IAtom pAtom = Mol2.getAtom(mapping.getValue());
System.out.println(eAtom.getSymbol() + " " + pAtom.getSymbol());
}
System.out.println("");
- Author:
- Syed Asad Rahman <asad@ebi.ac.uk>
- See Also:
- Requires:
- java1.5+
-
Constructor Summary
ConstructorsConstructorDescriptionIsomorphism(Algorithm algorithmType, boolean bondTypeFlag) Deprecated.This is the algorithm factory and entry port for all the MCS algorithm in the Isomorphism supported algorithmAlgorithmtypes: 0: Default, 1: MCSPlus, 2: VFLibMCS, 3: CDKMCS, 4: SubStructure -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Returns all plausible mappings between query and target molecules Each map in the list has atom-atom equivalence of the mappings between query and target molecule i.e. map.getKey() for the query and map.getValue() for the target molecule.Deprecated.Deprecated.Returns all plausible mappings between query and target molecules Each map in the list has atom-atom equivalence index of the mappings between query and target molecule i.e. map.getKey() for the query and map.getValue() for the target molecule.doubleDeprecated.get timeout in mins for bond insensitive searchesdoubleDeprecated.get timeout in mins for bond sensitive searchesgetEnergyScore(int key) Deprecated.Returns summation energy score of the disorder if the MCS is removed from the target and query graph.doubleDeprecated.Returns Euclidean Distance between query and target molecule.Deprecated.Returns one of the best matches with atoms mapped.Deprecated.Deprecated.Returns one of the best matches with atom indexes mapped.getFragmentSize(int key) Deprecated.Returns number of fragment generated in the solution space, if the MCS is removed from the target and query graph.Deprecated.Returns modified target molecule on which mapping was performed.Deprecated.Returns modified query molecule on which mapping was performed.getStereoScore(int key) Deprecated.Returns a number which denotes the quality of the mcs.doubleDeprecated.doubleDeprecated.doubleDeprecated.Returns Tanimoto similarity between query and target molecules (Score is between 0-min and 1-max).voidinit(String sourceMolFileName, String targetMolFileName, boolean removeHydrogen, boolean cleanAndConfigureMolecule) Deprecated.Initialize the query and targetAtomCount mol via mol filesvoidinit(IAtomContainer reactant, IAtomContainer product, boolean removeHydrogen, boolean cleanAndConfigureMolecule) Deprecated.initialize query and target molecules.voidinit(IQueryAtomContainer reactant, IAtomContainer product) Deprecated.initialize query and target molecules.booleanDeprecated.booleanDeprecated.Returns true if mols have different stereo chemistry else false if no stereo mismatch.booleanDeprecated.Checks if query is a subgraph of the target.booleanDeprecated.makeBondMapOfAtomMap(IAtomContainer ac1, IAtomContainer ac2, Map<IAtom, IAtom> mapping) Deprecated.Returns bond map between source and target molecules based on the atomsmakeBondMapsOfAtomMaps(IAtomContainer ac1, IAtomContainer ac2, List<Map<IAtom, IAtom>> mappings) Deprecated.Returns bond maps between source and target molecules based on the atomsvoidDeprecated.voidsetBondInSensitiveTimeOut(double bondInSensitiveTimeOut) Deprecated.set timeout in mins (default 1.00 min) for bond insensitive searchesvoidsetBondSensitiveTimeOut(double bondSensitiveTimeOut) Deprecated.set timeout in mins (default 0.10 min) for bond sensitive searchesvoidsetChemFilters(boolean stereoFilter, boolean fragmentFilter, boolean energyFilter) Deprecated.initialize query and target molecules.voidsetMatchBonds(boolean matchBonds) Deprecated.
-
Constructor Details
-
Method Details
-
makeBondMapsOfAtomMaps
public static List<Map<IBond,IBond>> makeBondMapsOfAtomMaps(IAtomContainer ac1, IAtomContainer ac2, List<Map<IAtom, IAtom>> mappings) Deprecated.Returns bond maps between source and target molecules based on the atoms- Parameters:
ac1- source moleculeac2- target moleculemappings- mappings between source and target molecule atoms- Returns:
- bond maps between source and target molecules based on the atoms
-
makeBondMapOfAtomMap
public static Map<IBond,IBond> makeBondMapOfAtomMap(IAtomContainer ac1, IAtomContainer ac2, Map<IAtom, IAtom> mapping) Deprecated.Returns bond map between source and target molecules based on the atoms- Parameters:
ac1- source moleculeac2- target moleculemapping- mappings between source and target molecule atoms- Returns:
- bond map between source and target molecules based on the atoms
-
isTimeOut
public boolean isTimeOut()Deprecated. -
resetTimeOut
public void resetTimeOut()Deprecated. -
init
Deprecated.Description copied from class:AbstractMCSinitialize query and target molecules. Note: Here its assumed that hydrogens are implicit and user has called these two methods percieveAtomTypesAndConfigureAtoms and CDKAromicityDetector before initializing calling this method.- Specified by:
initin classAbstractMCS- Parameters:
reactant-product-- Throws:
CDKException
-
init
public void init(IAtomContainer reactant, IAtomContainer product, boolean removeHydrogen, boolean cleanAndConfigureMolecule) throws CDKException Deprecated.initialize query and target molecules.- Specified by:
initin classAbstractMCS- Parameters:
reactant-product-removeHydrogen- true if remove H (implicit) before mappingcleanAndConfigureMolecule- eg: percieveAtomTypesAndConfigureAtoms, detect aromaticity etc- Throws:
CDKException
-
init
public void init(String sourceMolFileName, String targetMolFileName, boolean removeHydrogen, boolean cleanAndConfigureMolecule) throws CDKException Deprecated.Initialize the query and targetAtomCount mol via mol files- Parameters:
sourceMolFileName- source mol file nametargetMolFileName- target mol file nameremoveHydrogen- set true to make hydrogens implicit before searchcleanAndConfigureMolecule- eg: percieveAtomTypesAndConfigureAtoms, detect aromaticity etc- Throws:
CDKException
-
setChemFilters
public void setChemFilters(boolean stereoFilter, boolean fragmentFilter, boolean energyFilter) Deprecated.initialize query and target molecules.- Specified by:
setChemFiltersin classAbstractMCS- Parameters:
stereoFilter- set true to rank the solutions as per stereo matchesfragmentFilter- set true to return matches with minimum fragmentsenergyFilter- set true to return matches with minimum bond changes based on the bond breaking energy
-
getFragmentSize
Deprecated.Returns number of fragment generated in the solution space, if the MCS is removed from the target and query graph. Amongst the solutions, a solution with lowest fragment size is preferred.- Specified by:
getFragmentSizein classAbstractMCS- Parameters:
key- Index of the mapping solution- Returns:
- Fragment count(s) generated after removing the mapped parts
-
getStereoScore
Deprecated.Returns a number which denotes the quality of the mcs. A solution with highest stereo score is preferred over other scores.- Specified by:
getStereoScorein classAbstractMCS- Parameters:
key- Index of the mapping solution- Returns:
- true if no stereo mismatch occurs else false if stereo mismatch occurs
-
getEnergyScore
Deprecated.Returns summation energy score of the disorder if the MCS is removed from the target and query graph. Amongst the solutions, a solution with lowest energy score is preferred.- Specified by:
getEnergyScorein classAbstractMCS- Parameters:
key- Index of the mapping solution- Returns:
- Total bond breaking energy required to remove the mapped part
-
getFirstMapping
Deprecated.Returns one of the best matches with atom indexes mapped.- Specified by:
getFirstMappingin classAbstractMCS- Returns:
- Best Mapping Index
-
getAllMapping
Deprecated.Returns all plausible mappings between query and target molecules Each map in the list has atom-atom equivalence index of the mappings between query and target molecule i.e. map.getKey() for the query and map.getValue() for the target molecule.- Specified by:
getAllMappingin classAbstractMCS- Returns:
- All possible MCS Mapping Index
-
getFirstAtomMapping
Deprecated.Returns one of the best matches with atoms mapped.- Specified by:
getFirstAtomMappingin classAbstractMCS- Returns:
- Best Atom Mapping
-
getAllAtomMapping
Deprecated.Returns all plausible mappings between query and target molecules Each map in the list has atom-atom equivalence of the mappings between query and target molecule i.e. map.getKey() for the query and map.getValue() for the target molecule.- Specified by:
getAllAtomMappingin classAbstractMCS- Returns:
- All possible MCS atom Mappings
-
getReactantMolecule
Deprecated.Returns modified query molecule on which mapping was performed.- Specified by:
getReactantMoleculein classAbstractMCS- Returns:
- return modified reactant Molecule
-
getProductMolecule
Deprecated.Returns modified target molecule on which mapping was performed.- Specified by:
getProductMoleculein classAbstractMCS- Returns:
- return modified product Molecule
-
getTanimotoSimilarity
Deprecated.Returns Tanimoto similarity between query and target molecules (Score is between 0-min and 1-max).- Specified by:
getTanimotoSimilarityin classAbstractMCS- Returns:
- Tanimoto Similarity between 0 and 1
- Throws:
IOException
-
getTanimotoAtomSimilarity
Deprecated.- Throws:
IOException
-
getTanimotoBondSimilarity
Deprecated.- Throws:
IOException
-
isStereoMisMatch
public boolean isStereoMisMatch()Deprecated.Returns true if mols have different stereo chemistry else false if no stereo mismatch.- Specified by:
isStereoMisMatchin classAbstractMCS- Returns:
- true if mols have different stereo chemistry else false if no stereo mismatch. true if stereo mismatch occurs else true if stereo mismatch occurs.
-
isSubgraph
public boolean isSubgraph()Deprecated.Checks if query is a subgraph of the target. Returns true if query is a subgraph of target else false- Specified by:
isSubgraphin classAbstractMCS- Returns:
- true if query molecule is a subgraph of the target molecule
-
getEuclideanDistance
Deprecated.Returns Euclidean Distance between query and target molecule.- Specified by:
getEuclideanDistancein classAbstractMCS- Returns:
- Euclidean Distance (lower the score, better the match)
- Throws:
IOException
-
getBondSensitiveTimeOut
public double getBondSensitiveTimeOut()Deprecated.get timeout in mins for bond sensitive searches- Specified by:
getBondSensitiveTimeOutin classAbstractMCS- Returns:
- the bondSensitiveTimeOut
-
setBondSensitiveTimeOut
public void setBondSensitiveTimeOut(double bondSensitiveTimeOut) Deprecated.set timeout in mins (default 0.10 min) for bond sensitive searches- Specified by:
setBondSensitiveTimeOutin classAbstractMCS- Parameters:
bondSensitiveTimeOut- the bond Sensitive Timeout in mins (default 0.10 min)
-
getBondInSensitiveTimeOut
public double getBondInSensitiveTimeOut()Deprecated.get timeout in mins for bond insensitive searches- Specified by:
getBondInSensitiveTimeOutin classAbstractMCS- Returns:
- the bondInSensitiveTimeOut
-
setBondInSensitiveTimeOut
public void setBondInSensitiveTimeOut(double bondInSensitiveTimeOut) Deprecated.set timeout in mins (default 1.00 min) for bond insensitive searches- Specified by:
setBondInSensitiveTimeOutin classAbstractMCS- Parameters:
bondInSensitiveTimeOut- the bond insensitive Timeout in mins (default 0.15 min)
-
isMatchBonds
public boolean isMatchBonds()Deprecated.- Returns:
- the matchBonds
-
setMatchBonds
public void setMatchBonds(boolean matchBonds) Deprecated.- Parameters:
matchBonds- the matchBonds to set
-
getAllBondMaps
Deprecated.- Returns:
- the allBondMCS
-
getFirstBondMap
Deprecated.- Returns:
- the firstBondMCS
-