Class SSSearcher


  • public class SSSearcher
    extends java.lang.Object
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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, cCountModeRigorous
        matchMode - 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, cCountModeRigorous
        matchMode - cDefaultMatchMode or combination of cMatchAtomCharge, cMatchAtomMass, cMatchDBondToDelocalized, cMatchAromDBondToDelocalized
        atomExcluded - 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)