SubstructMatch.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (C) 2001-2006 Greg Landrum and Rational Discovery LLC
00003 //
00004 //   @@ All Rights Reserved  @@
00005 //
00006 #ifndef _RD_SUBSTRUCTMATCH_H__
00007 #define _RD_SUBSTRUCTMATCH_H__
00008 
00009 // std bits
00010 #include <vector>
00011 
00012 #ifdef USE_VFLIB
00013 // vflib bits
00014 #include <argraph.h>
00015 #include <vf_mono_state.h>
00016 #include <vf2_mono_state.h>
00017 #endif
00018 
00019 namespace RDKit{
00020   class ROMol;
00021   class Atom;
00022   class Bond;
00023 
00024   //! \brief used to return matches from substructure searching,
00025   //!   The format is (queryAtomIdx, molAtomIdx)
00026   typedef std::vector< std::pair<int,int> > MatchVectType; 
00027 
00028 #ifdef USE_VFLIB
00029   //typedef VFMonoState MatcherState;
00030   typedef VF2MonoState MatcherState;
00031 
00032   typedef ARGraph<const Atom, const Bond> AR_MOLGRAPH;
00033   //! Internal Use Only
00034   AR_MOLGRAPH *getMolGraph(const ROMol &mol,bool registerIt=false);
00035 
00036 #ifdef CACHE_ARMOLGRAPHS
00037 namespace SubstructLocal {
00038   void clearMolGraphCache();
00039 }
00040 #endif  
00041 #endif
00042 
00043   //! Find a substructure match for a query in a molecule
00044   /*!
00045       \param mol       The ROMol to be searched
00046       \param query     The query ROMol
00047       \param matchVect Used to return the match
00048                        (pre-existing contents will be deleted)
00049       \param recursionPossible  flags whether or not recursive matches are allowed
00050       \param useChirality  use atomic CIP codes as part of the comparison
00051       \param registerQuery cache the query (uses more memory but speeds up searches) 
00052 
00053       \return whether or not a match was found
00054     
00055   */
00056   bool SubstructMatch(const ROMol &mol,const ROMol &query,
00057                       MatchVectType &matchVect,
00058                       bool recursionPossible=true,
00059                       bool useChirality=false,
00060                       bool registerQuery=false);
00061 #ifdef USE_VFLIB
00062   //! \overload
00063   bool SubstructMatch(AR_MOLGRAPH *molG,const ROMol &query,
00064                       MatchVectType &matchVect,
00065                       bool recursionPossible=true,
00066                       bool useChirality=false,
00067                       bool registerQuery=false);
00068 #endif
00069 
00070   //! Find all substructure matches for a query in a molecule
00071   /*!
00072       \param mol       The ROMol to be searched
00073       \param query     The query ROMol
00074       \param matchVect Used to return the matches
00075                        (pre-existing contents will be deleted)
00076       \param uniquify  Toggles uniquification (by atom index) of the results
00077       \param recursionPossible  flags whether or not recursive matches are allowed
00078       \param useChirality  use atomic CIP codes as part of the comparison
00079       \param registerQuery cache the query (uses more memory but speeds up searches) 
00080 
00081       \return the number of matches found
00082     
00083   */
00084   unsigned int SubstructMatch(const ROMol &mol,const ROMol &query,
00085                               std::vector< MatchVectType > &matchVect,
00086                               bool uniquify=true,bool recursionPossible=true,
00087                               bool useChirality=false,
00088                               bool registerQuery=false);
00089 #ifdef USE_VFLIB
00090   //! \overload
00091   unsigned int SubstructMatch(AR_MOLGRAPH *molG,const ROMol &query,
00092                               std::vector< MatchVectType > &matchVect,
00093                               bool uniquify=true,bool recursionPossible=true,
00094                               bool useChirality=false,
00095                               bool registerQuery=false);
00096 #endif
00097 }
00098 
00099 #endif
00100 
00101 
00102 
00103 

Generated on Fri Apr 3 06:03:02 2009 for RDCode by  doxygen 1.5.6