Package org.openscience.cdk.isomorphism
Class Ullmann
- java.lang.Object
-
- org.openscience.cdk.isomorphism.Pattern
-
- org.openscience.cdk.isomorphism.Ullmann
-
public final class Ullmann extends Pattern
A structure pattern which utilises the Ullmann algorithm [Ullmann J R. Journal of the Association for Computing Machinery. 1976. 23]. Find and count the number molecules which contain the query substructure.
Finding the matching to molecules which contain the query substructure. It is more efficient to obtain theIAtomContainer query = ...; Pattern pattern = Ullmann.findSubstructure(query); int hits = 0; for (IAtomContainer m : ms) if (pattern.matches(m)) hits++;
match(org.openscience.cdk.interfaces.IAtomContainer)
and check it's size rather than test if itPattern.matches(org.openscience.cdk.interfaces.IAtomContainer)
first. These methods automatically verify stereochemistry.IAtomContainer query = ...; Pattern pattern = Ullmann.findSubstructure(query); int hits = 0; for (IAtomContainer m : ms) { int[] match = pattern.match(m); if (match.length > 0) hits++; }
- Author:
- John May
- Belongs to CDK module:
- isomorphism
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Pattern
findSubstructure(IAtomContainer query)
Create a pattern which can be used to find molecules which contain thequery
structure.int[]
match(IAtomContainer target)
Find a matching of this pattern in thetarget
.Mappings
matchAll(IAtomContainer target)
Find all mappings of this pattern in thetarget
.-
Methods inherited from class org.openscience.cdk.isomorphism.Pattern
findIdentical, matchAll, matches, matches
-
-
-
-
Method Detail
-
match
public int[] match(IAtomContainer target)
Description copied from class:Pattern
Find a matching of this pattern in thetarget
. If no such order exist an empty mapping is returned. Depending on the implementation stereochemistry may be checked (recommended).Pattern pattern = ...; // create pattern for (IAtomContainer m : ms) { int[] mapping = pattern.match(m); if (mapping.length > 0) { // found mapping! } }
-
matchAll
public Mappings matchAll(IAtomContainer target)
Description copied from class:Pattern
Find all mappings of this pattern in thetarget
. Stereochemistry should not be checked to allow filtering withMappings.stereochemistry()
.
Using the fluent interface (seePattern pattern = Pattern.findSubstructure(query); for (IAtomContainer m : ms) { for (int[] mapping : pattern.matchAll(m)) { // found mapping } }
Mappings
) we can search and manipulate the mappings. Here's an example of finding the first 5 mappings and creating an array. If the mapper is lazy other states are simply not explored.// find only the first 5 mappings and store them in an array Pattern pattern = Pattern.findSubstructure(query); int[][] mappings = pattern.matchAll(target) .limit(5) .toArray();
-
findSubstructure
public static Pattern findSubstructure(IAtomContainer query)
Create a pattern which can be used to find molecules which contain thequery
structure.- Parameters:
query
- the substructure to find- Returns:
- a pattern for finding the
query
-
-