public abstract class Pattern extends Object
| Constructor and Description |
|---|
Pattern() |
| Modifier and Type | Method and Description |
|---|---|
static Pattern |
findIdentical(IAtomContainer query)
Create a pattern which can be used to find molecules which are the same
as the
query structure. |
static Pattern |
findSubstructure(IAtomContainer query)
Create a pattern which can be used to find molecules which contain the
query structure. |
abstract int[] |
match(IAtomContainer target)
Find a matching of this pattern in the
target. |
abstract Mappings |
matchAll(IAtomContainer target)
Find all mappings of this pattern in the
target. |
Mappings |
matchAll(IReaction target)
Find all mappings of this pattern in the
target reaction. |
boolean |
matches(IAtomContainer target)
Determine if there is a mapping of this pattern in the
target. |
boolean |
matches(IReaction target)
Determine if there is a mapping of this pattern in the
target
reaction. |
public abstract int[] match(IAtomContainer target)
target. 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! } }
target - the container to search for the pattern inpublic final boolean matches(IAtomContainer target)
target.
Depending on the implementation stereochemistry may be checked
(recommended).
Pattern pattern = ...; // create pattern
for (IAtomContainer m : ms) {
if (pattern.matches(m)) {
// found mapping!
}
}
target - the container to search for the pattern inpublic final boolean matches(IReaction target)
target
reaction.
Pattern pattern = ...; // create pattern
for (IReaction r : rs) {
if (pattern.matches(r)) {
// found mapping!
}
}
target - the reaction to search for the pattern inpublic abstract Mappings matchAll(IAtomContainer target)
target. Stereochemistry
should not be checked to allow filtering with Mappings.stereochemistry().
Pattern pattern = Pattern.findSubstructure(query);
for (IAtomContainer m : ms) {
for (int[] mapping : pattern.matchAll(m)) {
// found mapping
}
}
Using the fluent interface (see 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();
target - the container to search for the pattern inMappingspublic final Mappings matchAll(IReaction target)
target reaction.
Pattern pattern = Pattern.findSubstructure(query);
for (IReaction r : rs) {
for (int[] mapping : pattern.matchAll(r)) {
// found mapping
}
}
The reaction is inlined into a molecule and vs mapped id's correspond
to the absolute atom index in the reaction when considered as reactants, agents,
products ReactionManipulator.toMolecule(org.openscience.cdk.interfaces.IReaction).target - the reaction to search for the pattern inMappings,
ReactionManipulator.toMolecule(IReaction)public static Pattern findSubstructure(IAtomContainer query)
query structure. The default structure search implementation is
VentoFoggia.query - the substructure to findqueryVentoFoggiapublic static Pattern findIdentical(IAtomContainer query)
query structure. The default structure search
implementation is VentoFoggia.query - the substructure to findqueryVentoFoggiaCopyright © 2017. All rights reserved.