Class SmartsPattern
java.lang.Object
org.openscience.cdk.isomorphism.Pattern
org.openscience.cdk.smiles.smarts.SmartsPattern
Deprecated.
A
Pattern for matching a single SMARTS query against multiple target
compounds. The class should not be used for matching many queries
against a single target as in substructure keyed fingerprints. The SMARTSQueryTool is currently a better option as less target initialistion is
performed.
Simple usage:
Pattern ptrn = SmartsPattern.create("O[C@?H](C)CC");
for (IAtomContainer ac : acs) {
if (ptrn.matches(ac)) {
// 'ac' contains the pattern
}
}
Obtaining a Mappings instance and determine the number of unique
matches.
Pattern ptrn = SmartsPattern.create("O[C@?H](C)CC");
for (IAtomContainer ac : acs) {
nUniqueHits += ptrn.matchAll(ac)
.countUnique();
}
- Author:
- John May
-
Field Summary
Fields inherited from class Pattern
hasVarAttach -
Method Summary
Modifier and TypeMethodDescriptionstatic SmartsPatternDeprecated.Default SMARTS pattern constructor, passes in a null chem object builder.static SmartsPatterncreate(String smarts, IChemObjectBuilder builder) Deprecated.Create aPatternthat will match the givensmartsquery.int[]match(IAtomContainer container) Deprecated.Find a matching of this pattern in thetarget.matchAll(IAtomContainer target) Deprecated.Obtain the mappings of the query pattern against the target compound.voidsetPrepare(boolean doPrep) Deprecated.Sets whether the molecule should be "prepared" for a SMARTS match, including set ring flags and perceiving aromaticity.Methods inherited from class Pattern
findIdentical, findSubstructure, matchAll, matches, matchesModifier and TypeMethodDescriptionstatic PatternfindIdentical(IAtomContainer query) Create a pattern which can be used to find molecules which are the same as thequerystructure.static PatternfindSubstructure(IAtomContainer query) Create a pattern which can be used to find molecules which contain thequerystructure.final MappingsFind all mappings of this pattern in thetargetreaction.booleanmatches(IAtomContainer target) Determine if there is a mapping of this pattern in thetarget.final booleanDetermine if there is a mapping of this pattern in thetargetreaction.
-
Method Details
-
setPrepare
public void setPrepare(boolean doPrep) Deprecated.Sets whether the molecule should be "prepared" for a SMARTS match, including set ring flags and perceiving aromaticity. The main reason to skip preparation (viaprepare(IAtomContainer)) is if it has already been done, for example when matching multiple SMARTS patterns.- Parameters:
doPrep- whether preparation should be done
-
match
Deprecated.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
Deprecated.Obtain the mappings of the query pattern against the target compound. Any initialisations required for the SMARTS match are automatically performed. The Daylight aromaticity model is applied clearing existing aromaticity. Do not use this for matching multiple SMARTS againsts the same container.
SeePattern ptrn = SmartsPattern.create("O[C@?H](C)CC"); int nUniqueHits = 0; for (IAtomContainer ac : acs) { nUniqueHits += ptrn.matchAll(ac) .countUnique(); }Mappingsfor available methods. -
create
Deprecated.Create aPatternthat will match the givensmartsquery.- Parameters:
smarts- SMARTS pattern stringbuilder- chem object builder used to create objects- Returns:
- a new pattern
- Throws:
IOException- the smarts could not be parsed
-
create
Deprecated.Default SMARTS pattern constructor, passes in a null chem object builder.- Parameters:
smarts- SMARTS pattern string- Returns:
- a SMARTS pattern
- Throws:
IOException- problem with SMARTS string syntax/semantics
-