@Deprecated public final class SmartsPattern extends Pattern
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:
Obtaining aPattern ptrn = SmartsPattern.create("O[C@?H](C)CC"); for (IAtomContainer ac : acs) { if (ptrn.matches(ac)) { // 'ac' contains the pattern } }
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(); }
Modifier and Type | Method and Description |
---|---|
static SmartsPattern |
create(String smarts)
Deprecated.
Default SMARTS pattern constructor, passes in a null chem object builder.
|
static SmartsPattern |
create(String smarts,
IChemObjectBuilder builder)
Deprecated.
Create a
Pattern that will match the given smarts query. |
int[] |
match(IAtomContainer container)
Deprecated.
Find a matching of this pattern in the
target . |
Mappings |
matchAll(IAtomContainer target)
Deprecated.
Obtain the mappings of the query pattern against the target compound.
|
void |
setPrepare(boolean doPrep)
Deprecated.
Sets whether the molecule should be "prepared" for a SMARTS match,
including set ring flags and perceiving aromaticity.
|
findIdentical, findSubstructure, matchAll, matches, matches
public void setPrepare(boolean doPrep)
prepare(IAtomContainer)
) is if it has
already been done, for example when matching multiple SMARTS patterns.doPrep
- whether preparation should be donepublic int[] match(IAtomContainer container)
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! } }
public Mappings matchAll(IAtomContainer target)
SeePattern ptrn = SmartsPattern.create("O[C@?H](C)CC"); int nUniqueHits = 0; for (IAtomContainer ac : acs) { nUniqueHits += ptrn.matchAll(ac) .countUnique(); }
Mappings
for available methods.public static SmartsPattern create(String smarts, IChemObjectBuilder builder) throws IOException
Pattern
that will match the given smarts
query.smarts
- SMARTS pattern stringbuilder
- chem object builder used to create objectsIOException
- the smarts could not be parsedpublic static SmartsPattern create(String smarts) throws IOException
smarts
- SMARTS pattern stringIOException
- problem with SMARTS string syntax/semanticsCopyright © 2021. All rights reserved.