Package com.actelion.research.chem
Class SSSearcher
- java.lang.Object
-
- com.actelion.research.chem.SSSearcher
-
public class SSSearcher extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static int
cCountModeExistance
static int
cCountModeFirstMatch
static int
cCountModeOverlapping
static int
cCountModeRigorous
static int
cCountModeSeparated
static int
cCountModeUnique
static int
cDefaultMatchMode
static int
cIndexMatchMode
static int
cMatchAromDBondToDelocalized
static int
cMatchAtomCharge
static int
cMatchAtomMass
static int
cMatchDBondToDelocalized
protected StereoMolecule
mFragment
protected StereoMolecule
mMolecule
-
Constructor Summary
Constructors Constructor Description SSSearcher()
Instantiates a SSSearcher object for running sub-structure searches with one or more sub-structure fragments on one or more molecules.SSSearcher(int matchMode)
Instantiates a SSSearcher object for running sub-structure searches with one or more sub-structure fragments on one or more molecules.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
areAtomsSimilar(int moleculeAtom, int fragmentAtom)
boolean
areBondsSimilar(int moleculeBond, int fragmentBond)
int
findFragmentInMolecule()
Locates all matches of the fragment in the molecule that result in distinguishable sets of molecule atoms.int
findFragmentInMolecule(int countMode, int matchMode)
Locates all matches of the fragment in the molecule that result in distinguishable sets of molecule atoms.int
findFragmentInMolecule(int countMode, int matchMode, boolean[] atomExcluded)
Locates all matches of the fragment in the molecule that result in distinguishable sets of molecule atoms that are not flagged to be excluded from matching.java.util.ArrayList<int[]>
getMatchList()
If the match count mode is one of cCountModeFirstMatch, cCountModeOverlapping, cCountModeRigorous then this method returns an arraylist of all counted matches, i.e.boolean
isFragmentInMolecule()
Fastest check, whether the molecule contains the fragment.boolean
isFragmentInMolecule(int matchMode)
Fastest check, whether the molecule contains the fragment.void
setFragment(StereoMolecule fragment)
Defines the fragment to be used in isFragmentInMolecule(...) or findFragmentInMolecule(...).void
setFragmentSymmetryConstraints(int[] fragmentContextRank)
If countMode is cCountModeUnique, then matches are considered distinct, if
- either the list of matching molecule atoms to the query fragment is a different one
- or if the mutual combination of fragment and molecule atom's symmetry rank is different (when the list of matched molecule atoms is the same)
For certain situations fragment atoms must be considered different, even if their symmetry rank is equal, e.g.void
setMol(StereoMolecule fragment, StereoMolecule molecule)
Defines fragment and molecule before calling isFragmentInMolecule(...) or findFragmentInMolecule(...).void
setMolecule(StereoMolecule molecule)
Defines the molecule to be used in isFragmentInMolecule(...) or findFragmentInMolecule(...).void
setupAtomAndBondFeatures(int matchMode)
void
stop()
Asks the substructure search to stop without completing as soon as possible.
-
-
-
Field Detail
-
cMatchAtomCharge
public static final int cMatchAtomCharge
- See Also:
- Constant Field Values
-
cMatchAtomMass
public static final int cMatchAtomMass
- See Also:
- Constant Field Values
-
cMatchDBondToDelocalized
public static final int cMatchDBondToDelocalized
- See Also:
- Constant Field Values
-
cMatchAromDBondToDelocalized
public static final int cMatchAromDBondToDelocalized
- See Also:
- Constant Field Values
-
cIndexMatchMode
public static final int cIndexMatchMode
- See Also:
- Constant Field Values
-
cDefaultMatchMode
public static final int cDefaultMatchMode
- See Also:
- Constant Field Values
-
cCountModeExistance
public static final int cCountModeExistance
- See Also:
- Constant Field Values
-
cCountModeFirstMatch
public static final int cCountModeFirstMatch
- See Also:
- Constant Field Values
-
cCountModeSeparated
public static final int cCountModeSeparated
- See Also:
- Constant Field Values
-
cCountModeOverlapping
public static final int cCountModeOverlapping
- See Also:
- Constant Field Values
-
cCountModeRigorous
public static final int cCountModeRigorous
- See Also:
- Constant Field Values
-
cCountModeUnique
public static final int cCountModeUnique
- See Also:
- Constant Field Values
-
mMolecule
protected StereoMolecule mMolecule
-
mFragment
protected StereoMolecule mFragment
-
-
Constructor Detail
-
SSSearcher
public SSSearcher()
Instantiates a SSSearcher object for running sub-structure searches with one or more sub-structure fragments on one or more molecules. The search is a pure graph matching algorithm. For fast sub-structure searches involving an index based pre-screening use the class SSSearcherWithIndex. For a more high-level structure search supporting multiple cores, sub-structure-, similarity-, exact-, or tautomer-search use class StructureSearch and related classes.
-
SSSearcher
public SSSearcher(int matchMode)
Instantiates a SSSearcher object for running sub-structure searches with one or more sub-structure fragments on one or more molecules. The search is a pure graph matching algorithm. For fast sub-structure searches involving an index based pre-screening use the class SSSearcherWithIndex. For a more high-level structure search supporting multiple cores, sub-structure-, similarity-, exact-, or tautomer-search use class StructureSearch and related classes.- Parameters:
matchMode
- combination of cMatchAtomCharge, cMatchAtomMass, cMatchDBondToDelocalized, cMatchAromDBondToDelocalized
-
-
Method Detail
-
setMol
public void setMol(StereoMolecule fragment, StereoMolecule molecule)
Defines fragment and molecule before calling isFragmentInMolecule(...) or findFragmentInMolecule(...).- Parameters:
fragment
-molecule
-
-
setMolecule
public void setMolecule(StereoMolecule molecule)
Defines the molecule to be used in isFragmentInMolecule(...) or findFragmentInMolecule(...).- Parameters:
molecule
-
-
stop
public void stop()
Asks the substructure search to stop without completing as soon as possible.
-
setFragment
public void setFragment(StereoMolecule fragment)
Defines the fragment to be used in isFragmentInMolecule(...) or findFragmentInMolecule(...).- Parameters:
fragment
-
-
setFragmentSymmetryConstraints
public void setFragmentSymmetryConstraints(int[] fragmentContextRank)
If countMode is cCountModeUnique, then matches are considered distinct, if
- either the list of matching molecule atoms to the query fragment is a different one
- or if the mutual combination of fragment and molecule atom's symmetry rank is different (when the list of matched molecule atoms is the same)
For certain situations fragment atoms must be considered different, even if their symmetry rank is equal, e.g. in the context of a reaction where equivalent reactant atoms end up in different product environments. This method allows to specify an additional criterion for the uniqueness comparison to be considered. In case of reactions, these might be the symmetry ranks of the products atoms mapped to the reactant atoms. Note: The current implementation only uses the 8 least significant bits of the context rank.
-
getMatchList
public java.util.ArrayList<int[]> getMatchList()
If the match count mode is one of cCountModeFirstMatch, cCountModeOverlapping, cCountModeRigorous then this method returns an arraylist of all counted matches, i.e. int arrays mapping fragment atoms to molecule atoms. Atoms being part of a matched bridge bond are naturally not covered by the mapping.
Note: If some query fragment atoms are marked as exclude group, then the respective matchlist values are -1.- Returns:
- list of distinct counted matches.
-
isFragmentInMolecule
public boolean isFragmentInMolecule()
Fastest check, whether the molecule contains the fragment. This method uses cCountModeExistance and therefore does not create any retrievable match list, i.e. mapping from fragment atoms to molecule atoms. The match mode used is cDefaultMatchMode, unless defined otherwise when instantiating the SSSearcher.- Returns:
- whether fragment was found as sub-structure in molecule
-
isFragmentInMolecule
public boolean isFragmentInMolecule(int matchMode)
Fastest check, whether the molecule contains the fragment. This method uses cCountModeExistance and therefore does not create any retrievable match list, i.e. mapping from fragment atoms to molecule atoms.- Parameters:
matchMode
- cDefaultMatchMode or combination of cMatchAtomCharge, cMatchAtomMass, cMatchDBondToDelocalized, cMatchAromDBondToDelocalized- Returns:
- whether fragment was found as sub-structure in molecule
-
findFragmentInMolecule
public int findFragmentInMolecule()
Locates all matches of the fragment in the molecule that result in distinguishable sets of molecule atoms. Multiple matches involving the same atoms, e.g. with a benzene ring, are counted and listed only once. Atom mapping from fragment to molecule is collected and can be retrieved with getMatchList().- Returns:
- count of sub-structure matches of fragment in molecule
-
findFragmentInMolecule
public int findFragmentInMolecule(int countMode, int matchMode)
Locates all matches of the fragment in the molecule that result in distinguishable sets of molecule atoms. Multiple matches involving the same atoms, e.g. with a benzene ring, are counted and listed only once. If count mode is different from cCountModeExistance, then an atom mapping from fragment to molecule is collected and can be retrieved with getMatchList().- Parameters:
countMode
- one of cCountModeExistance, cCountModeFirstMatch, cCountModeOverlapping, cCountModeRigorousmatchMode
- cDefaultMatchMode or combination of cMatchAtomCharge, cMatchAtomMass, cMatchDBondToDelocalized, cMatchAromDBondToDelocalized- Returns:
- count of sub-structure matches of fragment in molecule
-
findFragmentInMolecule
public int findFragmentInMolecule(int countMode, int matchMode, boolean[] atomExcluded)
Locates all matches of the fragment in the molecule that result in distinguishable sets of molecule atoms that are not flagged to be excluded from matching. Multiple matches involving the same atoms, e.g. with a benzene ring, are counted and listed only once. If count mode is different from cCountModeExistance, then an atom mapping from fragment to molecule is collected and can be retrieved with getMatchList(). If the query fragment does not contain atoms other than exclude group atoms, then no match is returned.- Parameters:
countMode
- one of cCountModeExistance, cCountModeFirstMatch, cCountModeSeparated, cCountModeOverlapping, cCountModeUnique, cCountModeRigorousmatchMode
- cDefaultMatchMode or combination of cMatchAtomCharge, cMatchAtomMass, cMatchDBondToDelocalized, cMatchAromDBondToDelocalizedatomExcluded
- defines atoms of molecule to be excluded from sub-structure matching- Returns:
- count of sub-structure matches of fragment in molecule
-
areAtomsSimilar
public boolean areAtomsSimilar(int moleculeAtom, int fragmentAtom)
-
areBondsSimilar
public boolean areBondsSimilar(int moleculeBond, int fragmentBond)
- Parameters:
moleculeBond
- flag list of fragment bond features (features present)fragmentBond
- flag list of molecule bond features (features allowed)- Returns:
- true if all molecule bond features are present in fragment bond
-
setupAtomAndBondFeatures
public void setupAtomAndBondFeatures(int matchMode)
-
-