RDKit
Open-source cheminformatics and machine learning.
SubstructMatch.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2001-2015 Greg Landrum and Rational Discovery LLC
3 //
4 // @@ All Rights Reserved @@
5 // This file is part of the RDKit.
6 // The contents are covered by the terms of the BSD license
7 // which is included in the file license.txt, found at the root
8 // of the RDKit source tree.
9 //
10 #ifndef _RD_SUBSTRUCTMATCH_H__
11 #define _RD_SUBSTRUCTMATCH_H__
12 
13 // std bits
14 #include <vector>
15 
16 namespace RDKit{
17  class ROMol;
18  class Atom;
19  class Bond;
20 
21  //! \brief used to return matches from substructure searching,
22  //! The format is (queryAtomIdx, molAtomIdx)
23  typedef std::vector< std::pair<int,int> > MatchVectType;
24 
25  //! Find a substructure match for a query in a molecule
26  /*!
27  \param mol The ROMol to be searched
28  \param query The query ROMol
29  \param matchVect Used to return the match
30  (pre-existing contents will be deleted)
31  \param recursionPossible flags whether or not recursive matches are allowed
32  \param useChirality use atomic CIP codes as part of the comparison
33  \param useQueryQueryMatches if set, the contents of atom and bond queries
34  will be used as part of the matching
35 
36  \return whether or not a match was found
37 
38  */
39  bool SubstructMatch(const ROMol &mol,const ROMol &query,
40  MatchVectType &matchVect,
41  bool recursionPossible=true,
42  bool useChirality=false,
43  bool useQueryQueryMatches=false);
44 
45  //! Find all substructure matches for a query in a molecule
46  /*!
47  \param mol The ROMol to be searched
48  \param query The query ROMol
49  \param matchVect Used to return the matches
50  (pre-existing contents will be deleted)
51  \param uniquify Toggles uniquification (by atom index) of the results
52  \param recursionPossible flags whether or not recursive matches are allowed
53  \param useChirality use atomic CIP codes as part of the comparison
54  \param useQueryQueryMatches if set, the contents of atom and bond queries
55  will be used as part of the matching
56  \param maxMatches The maximum number of matches that will be returned.
57  In high-symmetry cases with medium-sized molecules, it is very
58  easy to end up with a combinatorial explosion in the number of
59  possible matches. This argument prevents that from having
60  unintended consequences
61 
62  \return the number of matches found
63 
64  */
65  unsigned int SubstructMatch(const ROMol &mol,const ROMol &query,
66  std::vector< MatchVectType > &matchVect,
67  bool uniquify=true,bool recursionPossible=true,
68  bool useChirality=false,
69  bool useQueryQueryMatches=false,
70  unsigned int maxMatches = 1000);
71 }
72 
73 #endif
74 
75 
76 
77 
std::vector< std::pair< int, int > > MatchVectType
used to return matches from substructure searching, The format is (queryAtomIdx, molAtomIdx) ...
bool SubstructMatch(const ROMol &mol, const ROMol &query, MatchVectType &matchVect, bool recursionPossible=true, bool useChirality=false, bool useQueryQueryMatches=false)
Find a substructure match for a query in a molecule.
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:28