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 class ResonanceMolSupplier;
21 
22 //! \brief used to return matches from substructure searching,
23 //! The format is (queryAtomIdx, molAtomIdx)
24 typedef std::vector<std::pair<int, int> > MatchVectType;
25 
26 //! Find a substructure match for a query in a molecule
27 /*!
28  \param mol The ROMol to be searched
29  \param query The query ROMol
30  \param matchVect Used to return the match
31  (pre-existing contents will be deleted)
32  \param recursionPossible flags whether or not recursive matches are allowed
33  \param useChirality use atomic CIP codes as part of the comparison
34  \param useQueryQueryMatches if set, the contents of atom and bond queries
35  will be used as part of the matching
36 
37  \return whether or not a match was found
38 
39 */
40 bool SubstructMatch(const ROMol &mol, const ROMol &query,
41  MatchVectType &matchVect, bool recursionPossible = true,
42  bool useChirality = false,
43  bool useQueryQueryMatches = false);
44 
45 //! Find a substructure match for a query in a ResonanceMolSupplier object
46 /*!
47  \param resMolSuppl The ResonanceMolSupplier object to be searched
48  \param query The query ROMol
49  \param matchVect Used to return the match
50  (pre-existing contents will be deleted)
51  \param recursionPossible flags whether or not recursive matches are allowed
52  \param useChirality use atomic CIP codes as part of the comparison
53  \param useQueryQueryMatches if set, the contents of atom and bond queries
54  will be used as part of the matching
55 
56  \return whether or not a match was found
57 
58 */
59 bool SubstructMatch(ResonanceMolSupplier &resMolSuppl, const ROMol &query,
60  MatchVectType &matchVect, bool recursionPossible = true,
61  bool useChirality = false,
62  bool useQueryQueryMatches = false);
63 
64 //! Find all substructure matches for a query in a molecule
65 /*!
66  \param mol The ROMol to be searched
67  \param query The query ROMol
68  \param matchVect Used to return the matches
69  (pre-existing contents will be deleted)
70  \param uniquify Toggles uniquification (by atom index) of the results
71  \param recursionPossible flags whether or not recursive matches are allowed
72  \param useChirality use atomic CIP codes as part of the comparison
73  \param useQueryQueryMatches if set, the contents of atom and bond queries
74  will be used as part of the matching
75  \param maxMatches The maximum number of matches that will be returned.
76  In high-symmetry cases with medium-sized molecules, it is
77  very
78  easy to end up with a combinatorial explosion in the
79  number of
80  possible matches. This argument prevents that from having
81  unintended consequences
82 
83  \return the number of matches found
84 
85 */
86 unsigned int SubstructMatch(const ROMol &mol, const ROMol &query,
87  std::vector<MatchVectType> &matchVect,
88  bool uniquify = true, bool recursionPossible = true,
89  bool useChirality = false,
90  bool useQueryQueryMatches = false,
91  unsigned int maxMatches = 1000);
92 
93 //! Find all substructure matches for a query in a ResonanceMolSupplier object
94 /*!
95  \param resMolSuppl The ResonanceMolSupplier object to be searched
96  \param query The query ROMol
97  \param matchVect Used to return the matches
98  (pre-existing contents will be deleted)
99  \param uniquify Toggles uniquification (by atom index) of the results
100  \param recursionPossible flags whether or not recursive matches are allowed
101  \param useChirality use atomic CIP codes as part of the comparison
102  \param useQueryQueryMatches if set, the contents of atom and bond queries
103  will be used as part of the matching
104  \param maxMatches The maximum number of matches that will be returned.
105  In high-symmetry cases with medium-sized molecules, it is
106  very
107  easy to end up with a combinatorial explosion in the
108  number of
109  possible matches. This argument prevents that from having
110  unintended consequences
111  \param numThreads The number of threads used during the search
112  (defaults to 1; 0 selects the number of
113  concurrent threads supported by the hardware;
114  negative values are added to the number of
115  concurrent threads supported by the
116  hardware)
117 
118  \return the number of matches found
119 
120 */
121 unsigned int SubstructMatch(ResonanceMolSupplier &resMolSuppl,
122  const ROMol &query,
123  std::vector<MatchVectType> &matchVect,
124  bool uniquify = false,
125  bool recursionPossible = true,
126  bool useChirality = false,
127  bool useQueryQueryMatches = false,
128  unsigned int maxMatches = 1000, int numThreads = 1);
129 }
130 
131 #endif
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:29