public class CDKMCS
extends java.lang.Object
Structure comparison may be associated to bondA constraints (mandatory bonds, e.graphContainer. scaffolds, reaction cores,...) on each source graph. The constraint flexibility allows atom number of interesting queries. The substructure analysis relies on the CDKRGraph generic class (see: CDKRGraph) This class implements the link between the CDKRGraph model and the the CDK model in this way the CDKRGraph remains independent and may be used in other contexts.
This algorithm derives from the algorithm described in {
Modifier and Type | Field and Description |
---|---|
protected static int |
ID1 |
protected static int |
ID2 |
protected static boolean |
timeout |
Modifier and Type | Method and Description |
---|---|
static CDKRGraph |
buildRGraph(org.openscience.cdk.interfaces.IAtomContainer g1,
org.openscience.cdk.interfaces.IAtomContainer g2,
boolean shouldMatchBonds,
boolean shouldMatchRings,
boolean matchAtomType)
Builds the
CDKRGraph ( resolution graph ), from two atomContainer
(description of the two molecules to compare) This is the interface point
between the CDK model and the generic MCSS algorithm based on the RGRaph. |
static java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap> |
checkSingleAtomCases(org.openscience.cdk.interfaces.IAtomContainer g1,
org.openscience.cdk.interfaces.IAtomContainer g2)
Checks for single atom cases before doing subgraph/isomorphism search.
|
static java.util.BitSet |
getBitSet(org.openscience.cdk.interfaces.IAtomContainer ac)
Transforms an GraphAtomContainer into a
BitSet (which's size =
number of bondA in the atomContainer, all the bit are set to true). |
static java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap> |
getIsomorphAtomsMap(org.openscience.cdk.interfaces.IAtomContainer g1,
org.openscience.cdk.interfaces.IAtomContainer g2,
boolean shouldMatchBonds,
boolean shouldMatchRings,
boolean matchAtomType)
Returns the first isomorph 'atom mapping' found for g2 in g1.
|
static java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap> |
getIsomorphMap(org.openscience.cdk.interfaces.IAtomContainer g1,
org.openscience.cdk.interfaces.IAtomContainer g2,
boolean shouldMatchBonds,
boolean shouldMatchRings,
boolean matchAtomType)
Returns the first isomorph mapping found or null.
|
static java.util.List<java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap>> |
getIsomorphMaps(org.openscience.cdk.interfaces.IAtomContainer g1,
org.openscience.cdk.interfaces.IAtomContainer g2,
boolean shouldMatchBonds,
boolean shouldMatchRings,
boolean matchAtomType)
Returns all the isomorph 'mappings' found between two atom containers.
|
protected static IterationManager |
getIterationManager() |
static java.util.List<org.openscience.cdk.interfaces.IAtomContainer> |
getOverlaps(org.openscience.cdk.interfaces.IAtomContainer g1,
org.openscience.cdk.interfaces.IAtomContainer g2,
boolean shouldMatchBonds,
boolean shouldMatchRings,
boolean matchAtomType)
Returns all the maximal common substructure between twp atom containers.
|
static java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap> |
getSubgraphAtomsMap(org.openscience.cdk.interfaces.IAtomContainer g1,
org.openscience.cdk.interfaces.IAtomContainer g2,
boolean shouldMatchBonds,
boolean shouldMatchRings,
boolean matchAtomType)
Returns the first subgraph 'atom mapping' found for g2 in g1, where g2
must be a substructure of g1.
|
static java.util.List<java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap>> |
getSubgraphAtomsMaps(org.openscience.cdk.interfaces.IAtomContainer g1,
org.openscience.cdk.interfaces.IAtomContainer g2,
boolean shouldMatchBonds,
boolean shouldMatchRings,
boolean matchAtomType)
Returns all subgraph 'atom mappings' found for g2 in g1, where g2 must be
a substructure of g1.
|
static java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap> |
getSubgraphMap(org.openscience.cdk.interfaces.IAtomContainer g1,
org.openscience.cdk.interfaces.IAtomContainer g2,
boolean shouldMatchBonds,
boolean shouldMatchRings,
boolean matchAtomType)
Returns the first subgraph 'bondA mapping' found for g2 in g1.
|
static java.util.List<java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap>> |
getSubgraphMaps(org.openscience.cdk.interfaces.IAtomContainer g1,
org.openscience.cdk.interfaces.IAtomContainer g2,
boolean shouldMatchBonds,
boolean shouldMatchRings,
boolean matchAtomType)
Returns all the subgraph 'bondA mappings' found for g2 in g1.
|
static boolean |
isIsomorph(org.openscience.cdk.interfaces.IAtomContainer g1,
org.openscience.cdk.interfaces.IAtomContainer g2,
boolean shouldMatchBonds,
boolean shouldMatchRings,
boolean matchAtomType)
Tests if g1 and g2 are isomorph.
|
protected static boolean |
isMatchFeasible(org.openscience.cdk.interfaces.IBond bondA1,
org.openscience.cdk.interfaces.IBond bondA2,
boolean shouldMatchBonds,
boolean shouldMatchRings,
boolean matchAtomType) |
static boolean |
isSubgraph(org.openscience.cdk.interfaces.IAtomContainer g1,
org.openscience.cdk.interfaces.IAtomContainer g2,
boolean shouldMatchBonds,
boolean shouldMatchRings,
boolean matchAtomType)
Tests if g2 a subgraph of g1.
|
static boolean |
isTimeout() |
static java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap> |
makeAtomsMapOfBondsMap(java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap> l,
org.openscience.cdk.interfaces.IAtomContainer g1,
org.openscience.cdk.interfaces.IAtomContainer g2)
This makes a map of matching atoms out of a map of matching bonds as
produced by the get(Subgraph|Ismorphism)Map methods.
|
static java.util.List<java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap>> |
makeAtomsMapsOfBondsMaps(java.util.List<java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap>> l,
org.openscience.cdk.interfaces.IAtomContainer g1,
org.openscience.cdk.interfaces.IAtomContainer g2)
This makes maps of matching atoms out of a maps of matching bonds as
produced by the get(Subgraph|Ismorphism)Maps methods.
|
static org.openscience.cdk.interfaces.IAtomContainer |
project(java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap> rMapList,
org.openscience.cdk.interfaces.IAtomContainer g,
int id)
Projects a list of
CDKRMap on a molecule. |
static java.util.List<org.openscience.cdk.interfaces.IAtomContainer> |
projectList(java.util.List<java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap>> rMapsList,
org.openscience.cdk.interfaces.IAtomContainer g,
int id)
Projects a list of RMapsList on a molecule.
|
static java.util.List<java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap>> |
search(org.openscience.cdk.interfaces.IAtomContainer g1,
org.openscience.cdk.interfaces.IAtomContainer g2,
java.util.BitSet c1,
java.util.BitSet c2,
boolean findAllStructure,
boolean findAllMap,
boolean shouldMatchBonds,
boolean shouldMatchRings,
boolean matchAtomType)
General
CDKRGraph parsing method (usually not used directly) This
method is the entry point for the recursive search adapted to the atom
container input. |
protected static boolean timeout
protected static final int ID1
protected static final int ID2
public static boolean isIsomorph(org.openscience.cdk.interfaces.IAtomContainer g1, org.openscience.cdk.interfaces.IAtomContainer g2, boolean shouldMatchBonds, boolean shouldMatchRings, boolean matchAtomType) throws org.openscience.cdk.exception.CDKException
g1
- first molecule. Must not be an IQueryAtomContainer
.g2
- second molecule. May be an IQueryAtomContainer
.shouldMatchBonds
- shouldMatchRings
- matchAtomType
- org.openscience.cdk.exception.CDKException
- if the first molecule is an instance of
IQueryAtomContainerpublic static java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap> getIsomorphMap(org.openscience.cdk.interfaces.IAtomContainer g1, org.openscience.cdk.interfaces.IAtomContainer g2, boolean shouldMatchBonds, boolean shouldMatchRings, boolean matchAtomType) throws org.openscience.cdk.exception.CDKException
g1
- first molecule. Must not be an IQueryAtomContainer
.g2
- second molecule. May be an IQueryAtomContainer
.shouldMatchBonds
- shouldMatchRings
- matchAtomType
- org.openscience.cdk.exception.CDKException
public static java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap> getIsomorphAtomsMap(org.openscience.cdk.interfaces.IAtomContainer g1, org.openscience.cdk.interfaces.IAtomContainer g2, boolean shouldMatchBonds, boolean shouldMatchRings, boolean matchAtomType) throws org.openscience.cdk.exception.CDKException
g1
- first molecule. Must not be an IQueryAtomContainer
.g2
- second molecule. May be an IQueryAtomContainer
.shouldMatchBonds
- shouldMatchRings
- matchAtomType
- org.openscience.cdk.exception.CDKException
- if the first molecules is not an instance of
IQueryAtomContainer
public static java.util.List<java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap>> getIsomorphMaps(org.openscience.cdk.interfaces.IAtomContainer g1, org.openscience.cdk.interfaces.IAtomContainer g2, boolean shouldMatchBonds, boolean shouldMatchRings, boolean matchAtomType) throws org.openscience.cdk.exception.CDKException
g1
- first molecule. Must not be an IQueryAtomContainer
.g2
- second molecule. May be an IQueryAtomContainer
.shouldMatchBonds
- shouldMatchRings
- matchAtomType
- org.openscience.cdk.exception.CDKException
public static java.util.List<java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap>> getSubgraphMaps(org.openscience.cdk.interfaces.IAtomContainer g1, org.openscience.cdk.interfaces.IAtomContainer g2, boolean shouldMatchBonds, boolean shouldMatchRings, boolean matchAtomType) throws org.openscience.cdk.exception.CDKException
List
of List
s of CDKRMap
objects.
Note that if the query molecule is a single atom, then bondA mappings
cannot be defined. In such a case, the CDKRMap
object refers
directly to atom - atom mappings. Thus CDKRMap.id1 is the index of the
target atom and CDKRMap.id2 is the index of the matching query atom (in
this case, it will always be 0). Note that in such a case, there is no
need to call
makeAtomsMapsOfBondsMaps(List, IAtomContainer, IAtomContainer)
,
though if it is called, then the return value is simply the same as the
return value of this method.g1
- first molecule. Must not be an IQueryAtomContainer
.g2
- second molecule. May be an IQueryAtomContainer
.shouldMatchBonds
- shouldMatchRings
- matchAtomType
- org.openscience.cdk.exception.CDKException
makeAtomsMapsOfBondsMaps(List, IAtomContainer, IAtomContainer)
public static java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap> getSubgraphMap(org.openscience.cdk.interfaces.IAtomContainer g1, org.openscience.cdk.interfaces.IAtomContainer g2, boolean shouldMatchBonds, boolean shouldMatchRings, boolean matchAtomType) throws org.openscience.cdk.exception.CDKException
g1
- first molecule. Must not be an IQueryAtomContainer
.g2
- second molecule. May be an IQueryAtomContainer
.shouldMatchBonds
- shouldMatchRings
- matchAtomType
- List
of CDKRMap
objects containing Ids of matching bonds.org.openscience.cdk.exception.CDKException
public static java.util.List<java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap>> getSubgraphAtomsMaps(org.openscience.cdk.interfaces.IAtomContainer g1, org.openscience.cdk.interfaces.IAtomContainer g2, boolean shouldMatchBonds, boolean shouldMatchRings, boolean matchAtomType) throws org.openscience.cdk.exception.CDKException
List
of List
s of CDKRMap
objects.g1
- first molecule. Must not be an IQueryAtomContainer
.g2
- substructure to be mapped. May be an
IQueryAtomContainer
.shouldMatchBonds
- shouldMatchRings
- matchAtomType
- List
of CDKRMap
objects containing Ids of matching atoms.org.openscience.cdk.exception.CDKException
public static java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap> getSubgraphAtomsMap(org.openscience.cdk.interfaces.IAtomContainer g1, org.openscience.cdk.interfaces.IAtomContainer g2, boolean shouldMatchBonds, boolean shouldMatchRings, boolean matchAtomType) throws org.openscience.cdk.exception.CDKException
g1
- first molecule. Must not be an IQueryAtomContainer
.g2
- substructure to be mapped. May be an
IQueryAtomContainer
.shouldMatchBonds
- shouldMatchRings
- matchAtomType
- List
of CDKRMap
objects containing Ids of matching atoms.org.openscience.cdk.exception.CDKException
public static boolean isSubgraph(org.openscience.cdk.interfaces.IAtomContainer g1, org.openscience.cdk.interfaces.IAtomContainer g2, boolean shouldMatchBonds, boolean shouldMatchRings, boolean matchAtomType) throws org.openscience.cdk.exception.CDKException
g1
- first molecule. Must not be an IQueryAtomContainer
.g2
- second molecule. May be an IQueryAtomContainer
.shouldMatchBonds
- shouldMatchRings
- matchAtomType
- org.openscience.cdk.exception.CDKException
public static java.util.List<org.openscience.cdk.interfaces.IAtomContainer> getOverlaps(org.openscience.cdk.interfaces.IAtomContainer g1, org.openscience.cdk.interfaces.IAtomContainer g2, boolean shouldMatchBonds, boolean shouldMatchRings, boolean matchAtomType) throws org.openscience.cdk.exception.CDKException
g1
- first molecule. Must not be an IQueryAtomContainer
.g2
- second molecule. May be an IQueryAtomContainer
.shouldMatchBonds
- shouldMatchRings
- matchAtomType
- org.openscience.cdk.exception.CDKException
public static java.util.BitSet getBitSet(org.openscience.cdk.interfaces.IAtomContainer ac)
BitSet
(which's size =
number of bondA in the atomContainer, all the bit are set to true).ac
- IAtomContainer
to transformpublic static CDKRGraph buildRGraph(org.openscience.cdk.interfaces.IAtomContainer g1, org.openscience.cdk.interfaces.IAtomContainer g2, boolean shouldMatchBonds, boolean shouldMatchRings, boolean matchAtomType) throws org.openscience.cdk.exception.CDKException
CDKRGraph
( resolution graph ), from two atomContainer
(description of the two molecules to compare) This is the interface point
between the CDK model and the generic MCSS algorithm based on the RGRaph.g1
- Description of the first moleculeg2
- Description of the second moleculeshouldMatchBonds
- shouldMatchRings
- matchAtomType
- org.openscience.cdk.exception.CDKException
public static java.util.List<java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap>> search(org.openscience.cdk.interfaces.IAtomContainer g1, org.openscience.cdk.interfaces.IAtomContainer g2, java.util.BitSet c1, java.util.BitSet c2, boolean findAllStructure, boolean findAllMap, boolean shouldMatchBonds, boolean shouldMatchRings, boolean matchAtomType) throws org.openscience.cdk.exception.CDKException
CDKRGraph
parsing method (usually not used directly) This
method is the entry point for the recursive search adapted to the atom
container input.g1
- first molecule. Must not be an IQueryAtomContainer
.g2
- second molecule. May be an IQueryAtomContainer
.c1
- initial condition ( bonds from g1 that must be contains in the
solution )c2
- initial condition ( bonds from g2 that must be contains in the
solution )findAllStructure
- if false stop at the first structure foundfindAllMap
- if true search all the 'mappings' for one same
structureshouldMatchBonds
- shouldMatchRings
- matchAtomType
- CDKRMap
objects that represent the
search solutionsorg.openscience.cdk.exception.CDKException
public static org.openscience.cdk.interfaces.IAtomContainer project(java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap> rMapList, org.openscience.cdk.interfaces.IAtomContainer g, int id)
CDKRMap
on a molecule.rMapList
- the list to projectg
- the molecule on which projectid
- the id in the CDKRMap
of the molecule gpublic static java.util.List<org.openscience.cdk.interfaces.IAtomContainer> projectList(java.util.List<java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap>> rMapsList, org.openscience.cdk.interfaces.IAtomContainer g, int id)
rMapsList
- list of RMapsList to projectg
- the molecule on which projectid
- the id in the CDKRMap of the molecule gpublic static java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap> checkSingleAtomCases(org.openscience.cdk.interfaces.IAtomContainer g1, org.openscience.cdk.interfaces.IAtomContainer g2) throws org.openscience.cdk.exception.CDKException
g1
- GraphAtomContainer to match on. Must not be an
IQueryAtomContainer
.g2
- GraphAtomContainer as query. May be an
IQueryAtomContainer
.List
of List
of CDKRMap
objects for the
Atoms (not Bonds!), null if no single atom caseorg.openscience.cdk.exception.CDKException
- if the first molecule is an instance of
IQueryAtomContainerpublic static java.util.List<java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap>> makeAtomsMapsOfBondsMaps(java.util.List<java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap>> l, org.openscience.cdk.interfaces.IAtomContainer g1, org.openscience.cdk.interfaces.IAtomContainer g2)
l
- The list produced by the getMap method.g1
- The first atom container. Must not be a
IQueryAtomContainer
.g2
- The second one (first and second as in getMap). May be an
QueryAtomContainer
.List
s of CDKRMap
objects of matching
Atoms.public static java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap> makeAtomsMapOfBondsMap(java.util.List<org.openscience.smsd.algorithm.rgraph.CDKRMap> l, org.openscience.cdk.interfaces.IAtomContainer g1, org.openscience.cdk.interfaces.IAtomContainer g2)
l
- The list produced by the getMap method.g1
- first molecule. Must not be an IQueryAtomContainer
.g2
- second molecule. May be an IQueryAtomContainer
.List
of
CDKRMap
objects containing Ids of matching atoms.protected static boolean isMatchFeasible(org.openscience.cdk.interfaces.IBond bondA1, org.openscience.cdk.interfaces.IBond bondA2, boolean shouldMatchBonds, boolean shouldMatchRings, boolean matchAtomType)
bondA1
- bondA2
- shouldMatchBonds
- shouldMatchRings
- matchAtomType
- public static boolean isTimeout()
protected static IterationManager getIterationManager()