Class Isomorphism
- java.lang.Object
-
- org.openscience.cdk.smsd.interfaces.AbstractMCS
-
- org.openscience.cdk.smsd.Isomorphism
-
- All Implemented Interfaces:
Serializable
@Deprecated public final class Isomorphism extends AbstractMCS implements Serializable
Deprecated.A more recent version of SMSD is available at http://github.com/asad/smsdThis 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:
- Serialized Form
- Source code:
- main
- Belongs to CDK module:
- smsd
- Requires:
- java1.5+
-
-
Constructor Summary
Constructors Constructor Description Isomorphism(Algorithm algorithmType, boolean bondTypeFlag)
Deprecated.This is the algorithm factory and entry port for all the MCS algorithm in the Isomorphism supported algorithmAlgorithm
types: 0: Default, 1: MCSPlus, 2: VFLibMCS, 3: CDKMCS, 4: SubStructure
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description List<Map<IAtom,IAtom>>
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.List<Map<IBond,IBond>>
getAllBondMaps()
Deprecated.List<Map<Integer,Integer>>
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.double
getBondInSensitiveTimeOut()
Deprecated.get timeout in mins for bond insensitive searchesdouble
getBondSensitiveTimeOut()
Deprecated.get timeout in mins for bond sensitive searchesDouble
getEnergyScore(int key)
Deprecated.Returns summation energy score of the disorder if the MCS is removed from the target and query graph.double
getEuclideanDistance()
Deprecated.Returns Euclidean Distance between query and target molecule.Map<IAtom,IAtom>
getFirstAtomMapping()
Deprecated.Returns one of the best matches with atoms mapped.Map<IBond,IBond>
getFirstBondMap()
Deprecated.Map<Integer,Integer>
getFirstMapping()
Deprecated.Returns one of the best matches with atom indexes mapped.Integer
getFragmentSize(int key)
Deprecated.Returns number of fragment generated in the solution space, if the MCS is removed from the target and query graph.IAtomContainer
getProductMolecule()
Deprecated.Returns modified target molecule on which mapping was performed.IAtomContainer
getReactantMolecule()
Deprecated.Returns modified query molecule on which mapping was performed.Integer
getStereoScore(int key)
Deprecated.Returns a number which denotes the quality of the mcs.double
getTanimotoAtomSimilarity()
Deprecated.double
getTanimotoBondSimilarity()
Deprecated.double
getTanimotoSimilarity()
Deprecated.Returns Tanimoto similarity between query and target molecules (Score is between 0-min and 1-max).void
init(String sourceMolFileName, String targetMolFileName, boolean removeHydrogen, boolean cleanAndConfigureMolecule)
Deprecated.Initialize the query and targetAtomCount mol via mol filesvoid
init(IAtomContainer reactant, IAtomContainer product, boolean removeHydrogen, boolean cleanAndConfigureMolecule)
Deprecated.initialize query and target molecules.void
init(IQueryAtomContainer reactant, IAtomContainer product)
Deprecated.initialize query and target molecules.boolean
isMatchBonds()
Deprecated.boolean
isStereoMisMatch()
Deprecated.Returns true if mols have different stereo chemistry else false if no stereo mismatch.boolean
isSubgraph()
Deprecated.Checks if query is a subgraph of the target.boolean
isTimeOut()
Deprecated.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 atomsstatic 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 atomsvoid
resetTimeOut()
Deprecated.void
setBondInSensitiveTimeOut(double bondInSensitiveTimeOut)
Deprecated.set timeout in mins (default 1.00 min) for bond insensitive searchesvoid
setBondSensitiveTimeOut(double bondSensitiveTimeOut)
Deprecated.set timeout in mins (default 0.10 min) for bond sensitive searchesvoid
setChemFilters(boolean stereoFilter, boolean fragmentFilter, boolean energyFilter)
Deprecated.initialize query and target molecules.void
setMatchBonds(boolean matchBonds)
Deprecated.
-
-
-
Constructor Detail
-
Isomorphism
public Isomorphism(Algorithm algorithmType, boolean bondTypeFlag)
Deprecated.This is the algorithm factory and entry port for all the MCS algorithm in the Isomorphism supported algorithmAlgorithm
types:- 0: Default,
- 1: MCSPlus,
- 2: VFLibMCS,
- 3: CDKMCS,
- 4: SubStructure
- Parameters:
algorithmType
-Algorithm
bondTypeFlag
-
-
-
Method Detail
-
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
public void init(IQueryAtomContainer reactant, IAtomContainer product) throws CDKException
Deprecated.Description copied from class:AbstractMCS
initialize 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:
init
in 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:
init
in 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:
setChemFilters
in 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
public Integer getFragmentSize(int key)
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:
getFragmentSize
in classAbstractMCS
- Parameters:
key
- Index of the mapping solution- Returns:
- Fragment count(s) generated after removing the mapped parts
-
getStereoScore
public Integer getStereoScore(int key)
Deprecated.Returns a number which denotes the quality of the mcs. A solution with highest stereo score is preferred over other scores.- Specified by:
getStereoScore
in classAbstractMCS
- Parameters:
key
- Index of the mapping solution- Returns:
- true if no stereo mismatch occurs else false if stereo mismatch occurs
-
getEnergyScore
public Double getEnergyScore(int key)
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:
getEnergyScore
in classAbstractMCS
- Parameters:
key
- Index of the mapping solution- Returns:
- Total bond breaking energy required to remove the mapped part
-
getFirstMapping
public Map<Integer,Integer> getFirstMapping()
Deprecated.Returns one of the best matches with atom indexes mapped.- Specified by:
getFirstMapping
in classAbstractMCS
- Returns:
- Best Mapping Index
-
getAllMapping
public List<Map<Integer,Integer>> 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:
getAllMapping
in classAbstractMCS
- Returns:
- All possible MCS Mapping Index
-
getFirstAtomMapping
public Map<IAtom,IAtom> getFirstAtomMapping()
Deprecated.Returns one of the best matches with atoms mapped.- Specified by:
getFirstAtomMapping
in classAbstractMCS
- Returns:
- Best Atom Mapping
-
getAllAtomMapping
public List<Map<IAtom,IAtom>> 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:
getAllAtomMapping
in classAbstractMCS
- Returns:
- All possible MCS atom Mappings
-
getReactantMolecule
public IAtomContainer getReactantMolecule()
Deprecated.Returns modified query molecule on which mapping was performed.- Specified by:
getReactantMolecule
in classAbstractMCS
- Returns:
- return modified reactant Molecule
-
getProductMolecule
public IAtomContainer getProductMolecule()
Deprecated.Returns modified target molecule on which mapping was performed.- Specified by:
getProductMolecule
in classAbstractMCS
- Returns:
- return modified product Molecule
-
getTanimotoSimilarity
public double getTanimotoSimilarity() throws IOException
Deprecated.Returns Tanimoto similarity between query and target molecules (Score is between 0-min and 1-max).- Specified by:
getTanimotoSimilarity
in classAbstractMCS
- Returns:
- Tanimoto Similarity between 0 and 1
- Throws:
IOException
-
getTanimotoAtomSimilarity
public double getTanimotoAtomSimilarity() throws IOException
Deprecated.- Throws:
IOException
-
getTanimotoBondSimilarity
public double getTanimotoBondSimilarity() throws IOException
Deprecated.- Throws:
IOException
-
isStereoMisMatch
public boolean isStereoMisMatch()
Deprecated.Returns true if mols have different stereo chemistry else false if no stereo mismatch.- Specified by:
isStereoMisMatch
in 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:
isSubgraph
in classAbstractMCS
- Returns:
- true if query molecule is a subgraph of the target molecule
-
getEuclideanDistance
public double getEuclideanDistance() throws IOException
Deprecated.Returns Euclidean Distance between query and target molecule.- Specified by:
getEuclideanDistance
in 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:
getBondSensitiveTimeOut
in 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:
setBondSensitiveTimeOut
in 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:
getBondInSensitiveTimeOut
in 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:
setBondInSensitiveTimeOut
in 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
-
-