|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchemaxon.sss.search.Search
public abstract class Search
Parent of all structural search classes
| Field Summary | |
|---|---|
protected static java.util.logging.Level |
MRV_OUTPUT_LEVEL
Mrv format of the query and target is logged at this level. |
protected int |
preMatchLength
The number of used items in preMatchTargetAtoms and preMatchQueryAtoms arrays. |
protected int[] |
preMatchQueryAtoms
Array to store query atoms of pairs set by addMatch(). |
protected int[] |
preMatchTargetAtoms
Array to store target atoms of pairs set by addMatch(). |
protected MolSearchOptions |
searchOptions
Object to store all search parameters. |
| Fields inherited from interface chemaxon.struc.StereoConstants |
|---|
ANTI, ATOMSTEREO_EITHER, ATOMSTEREO_MASK, ATOMSTEREO_NONE, ATOMSTEREO_SPECIFIC, CHIRALITY_M, CHIRALITY_MASK, CHIRALITY_P, CHIRALITY_r, CHIRALITY_R, CHIRALITY_s, CHIRALITY_S, CHIRALITYSUPPORT_ALL, CHIRALITYSUPPORT_NONE, CHIRALITYSUPPORT_SELECTED, CIS, CTUMASK, CTUNKNOWN, CTUNSPEC, DBS_ALL, DBS_MARKED, DBS_NONE, ENDO, EXO, PARITY_ALLENE, PARITY_EITHER, PARITY_EVEN, PARITY_MASK, PARITY_ODD, PARITY_TETRAHEDRAL, PARITY_UNSPEC, STGRP_ABS, STGRP_AND, STGRP_NONE, STGRP_OR, SYN, TRANS |
| Constructor Summary | |
|---|---|
Search()
|
|
| Method Summary | |
|---|---|
void |
addMatch(int[] queryAtoms,
int[] targetAtoms,
int length)
Specifies extra prerequisites of the structure search that queryAtoms[0] must match to targetAtoms[0] only AND queryAtoms[1] must match to targetAtoms[1], etc. |
void |
addMatch(int queryAtom,
int targetAtom)
Specifies an extra prerequisite of the structure search that queryAtom must match to targetAtom only. |
static boolean |
areMatchingBondTypes(int q,
int t)
Tests if a query bond matches the target. |
protected static boolean |
areMatchingBondTypes(int q,
int t,
boolean exactMatch)
Tests if a query bond matches the target. |
void |
clearMatch()
Clears the extra prerequisites of the structure search specified using addMatch calls. |
int[][] |
findAll()
Looks for all matching patterns in the molecule. |
int[][][] |
findAllGroups()
Returns the group hits corresponding to all hits. |
protected SearchHit[] |
findAllHits()
Looks for all matching patterns in the molecule. |
int[] |
findFirst()
Looks for the first matching pattern in the target molecule. |
int[][] |
findFirstGroup()
Returns the group hit corresponding to the first hit. |
protected abstract SearchHit |
findFirstHit()
Looks for the first matching pattern in the target molecule. |
int[] |
findNext()
Looks for the next matching pattern in the target molecule. |
int[][] |
findNextGroup()
Returns the group hit corresponding to the next hit. |
protected abstract SearchHit |
findNextHit()
Looks for the next matching pattern in the target molecule. |
protected static int |
getAtomStereo(MolAtom atom,
int parity)
Determine the stereo type of an atom |
int |
getMatchCount()
The number of times the query molecule appears in the target molecule. |
Molecule |
getMatchingQuery()
Returns the query which produced the hit vector of the last findNext(), findFirst() or findAll() result. |
abstract Molecule |
getQuery()
Retrieves the query structure stored in the MolSearch object. |
protected java.lang.String |
getQueryAsString()
For internal purposes only. |
protected Molecule |
getQueryToPrint()
For internal purposes only. |
MolSearchOptions |
getSearchOptions()
Returns the SearchOptions object associated with this Search object. |
abstract Molecule |
getTarget()
Retrieves the target molecule |
protected java.lang.String |
getTargetAsString()
For internal purposes only. |
protected Molecule |
getTargetToPrint()
For internal purposes only. |
boolean |
isMatchCountBetween(int hitLimitLow,
boolean isLowerLimitIncluded,
int hitLimitHigh,
boolean isHigherLimitIncluded)
Decides questions like "does the query match the target between 2 and 5 times (inclusively)" Makes this efficiently, which means it only searches for the number of hits necessary to decide the question. |
boolean |
isMatchCountInRelation(java.lang.String relation,
int hitLimit)
Decides questions like "does the query match the target at least 3 times", "[] up to 5 times", "[] exactly once". |
abstract boolean |
isMatching()
Checks if the query structure matches a substructure in the molecule. |
boolean |
isVerbose()
For debugging purposes only. |
protected void |
logException(java.util.logging.Logger logger,
java.lang.String message)
Writes on the logger output the shown message together with a representation of the query and the target. |
abstract void |
setQuery(Molecule mol)
Specifies the query structure. |
abstract void |
setQuery(Molecule mol,
int[] exclude)
Specifies the query structure to be tested. |
void |
setSearchOptions(SearchOptions options)
Copies all search parameters from options to the current
search object. |
abstract void |
setTarget(Molecule mol)
Specifies the target molecule to be tested. |
abstract void |
setTarget(Molecule mol,
int[] exclude)
Specifies the target molecule to be tested. |
void |
setVerbose(boolean verbose)
For debugging purposes only. |
abstract void |
stop()
Tries to stop the running search as fast as possible. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final MolSearchOptions searchOptions
protected int[] preMatchQueryAtoms
protected int[] preMatchTargetAtoms
protected int preMatchLength
protected static final java.util.logging.Level MRV_OUTPUT_LEVEL
| Constructor Detail |
|---|
public Search()
| Method Detail |
|---|
public abstract void setTarget(Molecule mol)
setTarget in interface chemaxon.util.search.MolSearchermol - the target molecule.
public abstract void setTarget(Molecule mol,
int[] exclude)
mol - the target molecule.exclude - index of atoms to excludepublic abstract Molecule getTarget()
public abstract void setQuery(Molecule mol)
setQuery in interface chemaxon.util.search.MolSearchermol - the query structure.
public abstract void setQuery(Molecule mol,
int[] exclude)
mol - the query molecule.exclude - index of atoms to excludepublic abstract Molecule getQuery()
public abstract boolean isMatching()
throws chemaxon.sss.search.SearchException
chemaxon.sss.search.SearchException
public final int[] findFirst()
throws chemaxon.sss.search.SearchException
null if there are no hits.
Special atom indexes: see description in findNext().
chemaxon.sss.search.SearchExceptionfindNext(),
findAll(),
isMatching(),
getMatchingQuery()
public final int[] findNext()
throws chemaxon.sss.search.SearchException
findFirst() call is not necessary prior to a findNext() call.)
findNext in interface chemaxon.util.search.MolSearchernull if there are no more hits.
Special atom indexes:
Integer.MIN_VALUE in case of 0
heavy atom index.
Integer.MIN_VALUE
for 0 index. SearchConstants.HIT_LP is set
for isolated lone pairs (in which case there is no such target heavy atom).
SearchConstants.HIT_MULTICENTER
for these atoms.
SearchConstants.HIT_R
for these atoms. If the "hitIncludesRNodes" parameter is NOT set then only the
scaffold atoms are included in the match array. See
MolSearchOptions.setHitIncludesRNodes(boolean).
SearchOptions.setUndefinedRAtom(int).
In case of undefined R-atom matching a group of atoms
(see SearchOptions.isUndefinedRAtomMatchingGroup()),
only one matching atom is set in the match array, or
SearchConstants.HIT_R_EMPTY_MATCH denoting the empty group.
SearchConstants.HIT_UNMAPABLE in the match array.
setTarget(chemaxon.struc.Molecule,int[])) will not
appear in the match array at all (their appropriate indexes are
left out).
getMatchingQuery() can be
used to get the most specific matching form of the query.
chemaxon.sss.search.SearchExceptionfindFirst(),
findAll(),
isMatching(),
getMatchingQuery()
public final int[][] findAll()
throws chemaxon.sss.search.SearchException
null if there are no hits.
The match arrays contain the atom indexes of the target atoms
that match the query atoms (in the order of the appropriate query atoms).
Special atom indexes: see description in findNext().
chemaxon.sss.search.SearchExceptionisMatching(),
findFirst(),
findNext()
public final int[][] findFirstGroup()
throws chemaxon.sss.search.SearchException
SearchOptions.setUndefinedRAtom(int)).
If the SearchConstants.UNDEF_R_MATCHING_GROUP_H_EMPTY
option is set then empty match is denoted by an empty int[] array.
For special matching atom indexes, refer to the description in findNext().
chemaxon.sss.search.SearchExceptionfindNextGroup(),
findAllGroups(),
isMatching(),
getMatchingQuery(),
findFirst(),
findNext(),
findAll()
public final int[][] findNextGroup()
throws chemaxon.sss.search.SearchException
SearchOptions.setUndefinedRAtom(int)).
If the SearchConstants.UNDEF_R_MATCHING_GROUP_H_EMPTY
option is set then empty match is denoted by an empty int[] array.
For special matching atom indexes, refer to the description in findNext().
chemaxon.sss.search.SearchExceptionfindFirstGroup(),
findAllGroups(),
isMatching(),
getMatchingQuery(),
findFirst(),
findNext(),
findAll()
public final int[][][] findAllGroups()
throws chemaxon.sss.search.SearchException
SearchOptions.setUndefinedRAtom(int)).
If the SearchConstants.UNDEF_R_MATCHING_GROUP_H_EMPTY
option is set then empty match is denoted by an empty int[] array.
For special matching atom indexes, refer to the description in findNext().
chemaxon.sss.search.SearchExceptionfindFirstGroup(),
findNextGroup(),
isMatching(),
findFirst(),
findNext(),
findAll()
protected abstract SearchHit findFirstHit()
throws chemaxon.sss.search.SearchException
null if there is no hit
chemaxon.sss.search.SearchExceptionisMatching(),
findNextHit(),
findAllHits()
protected abstract SearchHit findNextHit()
throws chemaxon.sss.search.SearchException
findFirstHit() call is not necessary prior to a findNextHit() call.)
null if there are no more hits
chemaxon.sss.search.SearchExceptionisMatching(),
findFirstHit(),
findAllHits()
protected SearchHit[] findAllHits()
throws chemaxon.sss.search.SearchException
null if there are no hits
chemaxon.sss.search.SearchExceptionisMatching(),
findFirstHit(),
findNextHit()
public static boolean areMatchingBondTypes(int q,
int t)
t - type of target bondq - type of query bond
protected static boolean areMatchingBondTypes(int q,
int t,
boolean exactMatch)
t - type of target bondq - type of query bondexactMatch - if true, query bonds are matching the same query bond
only
protected static int getAtomStereo(MolAtom atom,
int parity)
atom - atom to determine its stereo typeparity - parityof the atom
public void addMatch(int queryAtom,
int targetAtom)
Several addMatch() calls represent conditions connected by boolean operator AND.
The effect of all addMatch() calls can be canceled by clearMatch().
public void addMatch(int[] queryAtoms,
int[] targetAtoms,
int length)
Several addMatch() calls represent conditions connected by boolean operator AND.
The effect of all addMatch() calls can be canceled by clearMatch().
public void clearMatch()
public boolean isMatchCountInRelation(java.lang.String relation,
int hitLimit)
throws chemaxon.sss.search.SearchException
Example:
isMatchCountInRelation("<", 2) - true if the query can be found in the target less than two times.
relation - The relational operation of the question. This
operation will be used to compare the number of hits to
hitLimit. Available values:
hitLimit.
hitLimit.
hitLimit - The limit for the number of hits.
relation> hitLimit
chemaxon.sss.search.SearchException - if encountered during the search.getMatchCount()
public boolean isMatchCountBetween(int hitLimitLow,
boolean isLowerLimitIncluded,
int hitLimitHigh,
boolean isHigherLimitIncluded)
throws chemaxon.sss.search.SearchException
Example:
isMatchCountBetween(2, true, 4, true) - true if the query can be found in the target exactly 2, 3 or 4 times.
isMatchCountBetween(2, false, 4, false) - true if the query can be found in the target exactly 3 times.
hitLimitLow - The lower limit for the number of hits.isLowerLimitIncluded - If true, equality is allowed with hitLimitLow.hitLimitHigh - The upper limit for the number of hits.
If you pass Integer.MAX_VALUE, it will be treated as infinity.
(I.e. only the lower limit is applied.)isHigherLimitIncluded - If true, equality is allowed with hitLimitHigh.
hitLimitLow and hitLimitHigh, inclusively.
chemaxon.sss.search.SearchException - if encountered during the search.getMatchCount()
public int getMatchCount()
throws chemaxon.sss.search.SearchException
If you would like to decide a simple relation regarding this number, you should consider method isMatchCountInRelation( String, int), because it is more efficient than this method.
chemaxon.sss.search.SearchException - If encountered during the search.isMatchCountInRelation(java.lang.String, int)public boolean isVerbose()
public void setVerbose(boolean verbose)
public abstract void stop()
public Molecule getMatchingQuery()
public MolSearchOptions getSearchOptions()
setSearchOptions(SearchOptions)public void setSearchOptions(SearchOptions options)
options to the current
search object.
options - search options to copy.getSearchOptions()protected Molecule getQueryToPrint()
protected Molecule getTargetToPrint()
protected java.lang.String getTargetAsString()
protected java.lang.String getQueryAsString()
protected void logException(java.util.logging.Logger logger,
java.lang.String message)
logger - logger to use for loggingmessage - message to write out with the query and target.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||