RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
Reaction.h
Go to the documentation of this file.
1//
2// Copyright (c) 2007-2021, Novartis Institutes for BioMedical Research Inc.
3// and other RDKit contributors
4//
5// All rights reserved.
6//
7// Redistribution and use in source and binary forms, with or without
8// modification, are permitted provided that the following conditions are
9// met:
10//
11// * Redistributions of source code must retain the above copyright
12// notice, this list of conditions and the following disclaimer.
13// * Redistributions in binary form must reproduce the above
14// copyright notice, this list of conditions and the following
15// disclaimer in the documentation and/or other materials provided
16// with the distribution.
17// * Neither the name of Novartis Institutes for BioMedical Research Inc.
18// nor the names of its contributors may be used to endorse or promote
19// products derived from this software without specific prior written
20// permission.
21//
22// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33//
34
35#include <RDGeneral/export.h>
36#ifndef RD_REACTION_H_17Aug2006
37#define RD_REACTION_H_17Aug2006
38
39#include <GraphMol/RDKitBase.h>
40#include <RDGeneral/RDProps.h>
42#include <vector>
43
44namespace RDKit {
45class ReactionPickler;
46
47//! used to indicate an error in the chemical reaction engine
49 : public std::exception {
50 public:
51 //! construct with an error message
52 explicit ChemicalReactionException(const char *msg) : _msg(msg) {}
53 //! construct with an error message
54 explicit ChemicalReactionException(const std::string msg) : _msg(msg) {}
55 //! get the error message
56 const char *what() const noexcept override { return _msg.c_str(); }
57 ~ChemicalReactionException() noexcept override = default;
58
59 private:
60 std::string _msg;
61};
62
63//! This is a class for storing and applying general chemical reactions.
64/*!
65 basic usage will be something like:
66
67 \verbatim
68 ChemicalReaction rxn;
69 rxn.addReactantTemplate(r1);
70 rxn.addReactantTemplate(r2);
71 rxn.addProductTemplate(p1);
72 rxn.initReactantMatchers();
73
74 MOL_SPTR_VECT prods;
75 for(MOL_SPTR_VECT::const_iterator r1It=reactantSet1.begin();
76 r1It!=reactantSet1.end();++r1It;){
77 for(MOL_SPTR_VECT::const_iterator r2It=reactantSet2.begin();
78 r2It!=reactantSet2.end();++r2It;){
79 MOL_SPTR_VECT rVect(2);
80 rVect[0] = *r1It;
81 rVect[1] = *r2It;
82
83 std::vector<MOL_SPTR_VECT> lprods;
84 lprods = rxn.runReactants(rVect);
85 for(std::vector<MOL_SPTR_VECT>::const_iterator lpIt=lprods.begin();
86 lpIt!=lprods.end();++lpIt){
87 // we know this is a single-product reaction:
88 prods.push_back((*lpIt)[0]);
89 }
90 }
91 }
92 \endverbatim
93
94 NOTES:
95 - to allow more control over the reaction, it is possible to flag reactant
96 atoms as being protected by setting the common_properties::_protected
97 property on those
98 atoms. Here's an example:
99 \verbatim
100 std::string smi="[O:1]>>[N:1]";
101 ChemicalReaction *rxn = RxnSmartsToChemicalReaction(smi);
102 rxn->initReactantMatchers();
103
104 MOL_SPTR_VECT reacts;
105 reacts.clear();
106 smi = "OCO";
107 ROMol *mol = SmilesToMol(smi);
108 reacts.push_back(ROMOL_SPTR(mol));
109 std::vector<MOL_SPTR_VECT> prods;
110 prods = rxn->runReactants(reacts);
111 // here prods has two entries, because there are two Os in the
112 // reactant.
113
114 reacts[0]->getAtomWithIdx(0)->setProp(common_properties::_protected,1);
115 prods = rxn->runReactants(reacts);
116 // here prods only has one entry, the reaction at atom 0
117 // has been blocked by the _protected property
118 \endverbatim
119
120*/
122 friend class ReactionPickler;
123
124 private:
125 void copy(const ChemicalReaction &other) {
126 RDProps::operator=(other);
127 df_needsInit = other.df_needsInit;
128 df_implicitProperties = other.df_implicitProperties;
129 m_reactantTemplates.clear();
130 m_reactantTemplates.reserve(other.m_reactantTemplates.size());
131 for (ROMOL_SPTR reactant_template : other.m_reactantTemplates) {
132 m_reactantTemplates.emplace_back(new RWMol(*reactant_template));
133 }
134 m_productTemplates.clear();
135 m_productTemplates.reserve(other.m_productTemplates.size());
136 for (ROMOL_SPTR product_template : other.m_productTemplates) {
137 m_productTemplates.emplace_back(new RWMol(*product_template));
138 }
139 m_agentTemplates.clear();
140 m_agentTemplates.reserve(other.m_agentTemplates.size());
141 for (ROMOL_SPTR agent_template : other.m_agentTemplates) {
142 m_agentTemplates.emplace_back(new RWMol(*agent_template));
143 }
144 d_substructParams = other.d_substructParams;
145 }
146
147 public:
149 //! construct a reaction from a pickle string
150 ChemicalReaction(const std::string &binStr);
151 ChemicalReaction(const ChemicalReaction &other) : RDProps() { copy(other); }
153 if (this != &other) {
154 copy(other);
155 }
156 return *this;
157 }
158
159 //! Adds a new reactant template
160 /*!
161 \return the number of reactants
162
163 */
164 unsigned int addReactantTemplate(ROMOL_SPTR mol) {
165 this->df_needsInit = true;
166 this->m_reactantTemplates.push_back(mol);
167 return rdcast<unsigned int>(this->m_reactantTemplates.size());
168 }
169
170 //! Adds a new agent template
171 /*!
172 \return the number of agent
173
174 */
175 unsigned int addAgentTemplate(ROMOL_SPTR mol) {
176 this->m_agentTemplates.push_back(mol);
177 return rdcast<unsigned int>(this->m_agentTemplates.size());
178 }
179
180 //! Adds a new product template
181 /*!
182 \return the number of products
183
184 */
185 unsigned int addProductTemplate(ROMOL_SPTR mol) {
186 this->m_productTemplates.push_back(mol);
187 return rdcast<unsigned int>(this->m_productTemplates.size());
188 }
189
190 //! Removes the reactant templates from a reaction if atom mapping ratio is
191 /// below a given threshold
192 /*! By default the removed reactant templates were attached to the agent
193 templates.
194 An alternative will be to provide a pointer to a molecule vector where
195 these reactants should be saved.
196 */
197 void removeUnmappedReactantTemplates(double thresholdUnmappedAtoms = 0.2,
198 bool moveToAgentTemplates = true,
199 MOL_SPTR_VECT *targetVector = nullptr);
200
201 //! Removes the product templates from a reaction if its atom mapping ratio is
202 /// below a given threshold
203 /*! By default the removed products templates were attached to the agent
204 templates.
205 An alternative will be to provide a pointer to a molecule vector where
206 these products should be saved.
207 */
208 void removeUnmappedProductTemplates(double thresholdUnmappedAtoms = 0.2,
209 bool moveToAgentTemplates = true,
210 MOL_SPTR_VECT *targetVector = nullptr);
211
212 /*! Removes the agent templates from a reaction if a pointer to a
213 molecule vector is provided the agents are stored therein.*/
214 void removeAgentTemplates(MOL_SPTR_VECT *targetVector = nullptr);
215
216 //! Runs the reaction on a set of reactants
217 /*!
218
219 \param reactants the reactants to be used. The length of this must be equal
220 to this->getNumReactantTemplates()
221 \param maxProducts: if non zero, the maximum number of products to generate
222 before stopping. If hit a warning will be generated.
223
224 \return a vector of vectors of products. Each subvector will be
225 this->getNumProductTemplates() long.
226
227 We return a vector of vectors of products because each individual template
228 may map multiple times onto its reactant. This leads to multiple possible
229 result sets.
230 */
231 std::vector<MOL_SPTR_VECT> runReactants(
232 const MOL_SPTR_VECT reactants, unsigned int numProducts = 1000) const;
233
234 //! Runs a single reactant against a single reactant template
235 /*!
236 \param reactant The single reactant to use
237
238 \param reactantTemplateIdx the reactant template to target in the reaction
239 */
240 std::vector<MOL_SPTR_VECT> runReactant(
241 ROMOL_SPTR reactant, unsigned int reactantTemplateIdx) const;
242
243 //! Runs a single reactant in place (the reactant is modified)
244 /*!
245 This is only useable with reactions which have a single reactant and product
246 and where no atoms are added in the product.
247
248 \param reactant The single reactant to use
249
250 \return whether or not the reactant was actually modified
251 */
252 bool runReactant(RWMol &reactant) const;
253
255 return this->m_reactantTemplates;
256 }
257 const MOL_SPTR_VECT &getAgents() const { return this->m_agentTemplates; }
258 const MOL_SPTR_VECT &getProducts() const { return this->m_productTemplates; }
259
260 MOL_SPTR_VECT::const_iterator beginReactantTemplates() const {
261 return this->m_reactantTemplates.begin();
262 }
263 MOL_SPTR_VECT::const_iterator endReactantTemplates() const {
264 return this->m_reactantTemplates.end();
265 }
266
267 MOL_SPTR_VECT::const_iterator beginProductTemplates() const {
268 return this->m_productTemplates.begin();
269 }
270 MOL_SPTR_VECT::const_iterator endProductTemplates() const {
271 return this->m_productTemplates.end();
272 }
273
274 MOL_SPTR_VECT::const_iterator beginAgentTemplates() const {
275 return this->m_agentTemplates.begin();
276 }
277 MOL_SPTR_VECT::const_iterator endAgentTemplates() const {
278 return this->m_agentTemplates.end();
279 }
280
281 MOL_SPTR_VECT::iterator beginReactantTemplates() {
282 return this->m_reactantTemplates.begin();
283 }
284 MOL_SPTR_VECT::iterator endReactantTemplates() {
285 return this->m_reactantTemplates.end();
286 }
287
288 MOL_SPTR_VECT::iterator beginProductTemplates() {
289 return this->m_productTemplates.begin();
290 }
291 MOL_SPTR_VECT::iterator endProductTemplates() {
292 return this->m_productTemplates.end();
293 }
294
295 MOL_SPTR_VECT::iterator beginAgentTemplates() {
296 return this->m_agentTemplates.begin();
297 }
298 MOL_SPTR_VECT::iterator endAgentTemplates() {
299 return this->m_agentTemplates.end();
300 }
301 unsigned int getNumReactantTemplates() const {
302 return rdcast<unsigned int>(this->m_reactantTemplates.size());
303 }
304 unsigned int getNumProductTemplates() const {
305 return rdcast<unsigned int>(this->m_productTemplates.size());
306 }
307 unsigned int getNumAgentTemplates() const {
308 return rdcast<unsigned int>(this->m_agentTemplates.size());
309 }
310
311 //! initializes our internal reactant-matching datastructures.
312 /*!
313 This must be called after adding reactants and before calling
314 runReactants.
315
316 \param silent: If this bool is true, no messages will be logged during the
317 validation. By default, validation problems are reported to the warning
318 and error logs depending on their severity.
319 */
320 void initReactantMatchers(bool silent = false);
321
322 bool isInitialized() const { return !df_needsInit; }
323
324 //! validates the reactants and products to make sure the reaction seems
325 /// "reasonable"
326 /*!
327 \return true if the reaction validates without errors (warnings do not
328 stop validation)
329
330 \param numWarnings used to return the number of validation warnings
331 \param numErrors used to return the number of validation errors
332
333 \param silent: If this bool is true, no messages will be logged during the
334 validation. By default, validation problems are reported to the warning
335 and error logs depending on their severity.
336
337 */
338 bool validate(unsigned int &numWarnings, unsigned int &numErrors,
339 bool silent = false) const;
340
341 //! returns whether or not the reaction uses implicit
342 //! properties on the product atoms
343 /*!
344
345 This toggles whether or not unspecified atomic properties in the
346 products are considered to be implicit and should be copied from
347 the actual reactants. This is necessary due to a semantic difference
348 between the "reaction SMARTS" approach and the MDL RXN
349 approach:
350 In "reaction SMARTS", this reaction:
351 [C:1]-[Br:2].[O-:3]>>[C:1]-[O:3].[Br-:2]
352 applied to [CH4+]Br should yield [CH4+]O
353 Something similar drawn in an rxn file, and applied to
354 [CH4+]Br should yield [CH3]O.
355 In rxn there is no charge on the product C because nothing is
356 specified in the rxn file; in "SMARTS" the charge from the
357 actual reactants is not *removed* because no charge is
358 specified in the reaction.
359
360 */
361 bool getImplicitPropertiesFlag() const { return df_implicitProperties; }
362 //! sets the implicit properties flag. See the documentation for
363 //! getImplicitProertiesFlag() for a discussion of what this means.
364 void setImplicitPropertiesFlag(bool val) { df_implicitProperties = val; }
365
367 return d_substructParams;
368 }
369 SubstructMatchParameters &getSubstructParams() { return d_substructParams; }
370
371 private:
372 bool df_needsInit{true};
373 bool df_implicitProperties{false};
374 MOL_SPTR_VECT m_reactantTemplates, m_productTemplates, m_agentTemplates;
375 SubstructMatchParameters d_substructParams;
376};
377
378//! tests whether or not the molecule has a substructure match
379//! to the reaction's reactants
380//! the \c which argument is used to return which of the reactants
381//! the molecule matches.
383 const ChemicalReaction &rxn, const ROMol &mol,
384 std::vector<unsigned int> &which, bool stopAtFirstMatch = false);
385//! \overload
387 const ChemicalReaction &rxn, const ROMol &mol, unsigned int &which);
388//! \overload
390 const ChemicalReaction &rxn, const ROMol &mol);
391
392//! tests whether or not the molecule has a substructure match
393//! to the reaction's products
394//! the \c which argument is used to return which of the products
395//! the molecule matches.
397 const ChemicalReaction &rxn, const ROMol &mol,
398 std::vector<unsigned int> &which, bool stopAtFirstMatch = false);
399//! \overload
401 const ChemicalReaction &rxn, const ROMol &mol, unsigned int &which);
402//! \overload
404 const ChemicalReaction &rxn, const ROMol &mol);
405
406//! tests whether or not the molecule has a substructure match
407//! to any of the reaction's agents
408//! the \c which argument is used to return which of the agents
409//! the molecule matches. If there's no match, it is equal to the number
410//! of agents on return
412 const ChemicalReaction &rxn, const ROMol &mol, unsigned int &which);
413//! \overload
415 const ChemicalReaction &rxn, const ROMol &mol);
416
417//! returns indices of the atoms in each reactant that are changed
418//! in the reaction
419/*!
420 \param rxn the reaction we are interested in
421
422 \param mappedAtomsOnly if set, atoms that are not mapped will not be included
423 in the list of changed atoms (otherwise they are automatically included)
424
425 How are changed atoms recognized?
426 1) Atoms whose degree changes
427 2) Atoms whose bonding pattern changes
428 3) unmapped atoms (unless the mappedAtomsOnly flag is set)
429 4) Atoms connected to unmapped atoms
430 5) Atoms whose atomic number changes (unless the
431 corresponding product atom is a dummy)
432 6) Atoms with more than one atomic number query (unless the
433 corresponding product atom is a dummy)
434
435 Note that the atomic number of a query atom depends on how it's constructed.
436 When coming from SMARTS: if the first query is an atomic label/number that
437 sets the atomic number, otherwise it's zero.
438 For example [O;$(OC)] is atomic number 8 while [$(OC);O] is atomic
439 number 0.
440 When coming from RXN: the atomic number of the atom in the rxn file sets
441 the value.
442 */
444getReactingAtoms(const ChemicalReaction &rxn, bool mappedAtomsOnly = false);
445
446//! add the recursive queries to the reactants of a reaction
447/*!
448 This does its work using RDKit::addRecursiveQueries()
449
450 \param rxn the reaction we are interested in
451 \param queries - the dictionary of named queries to add
452 \param propName - the atom property to use to get query names
453 optional:
454 \param reactantLabels - to store pairs of (atom index, query string)
455 per reactant
456
457 NOTES:
458 - existing query information, if present, will be supplemented (AND logic)
459 - non-query atoms will be replaced with query atoms using only the query
460 logic
461 - query names can be present as comma separated lists, they will then
462 be combined using OR logic.
463 - throws a KeyErrorException if a particular query name is not present
464 in \c queries
465
466 */
468 ChemicalReaction &rxn, const std::map<std::string, ROMOL_SPTR> &queries,
469 const std::string &propName,
470 std::vector<std::vector<std::pair<unsigned int, std::string>>>
471 *reactantLabels = nullptr);
472
473} // namespace RDKit
474
475namespace RDDepict {
476//! \brief Generate 2D coordinates (a depiction) for a reaction
477/*!
478
479 \param rxn the reaction we are interested in
480
481 \param spacing the spacing between components of the reaction
482
483 \param updateProps if set, properties such as conjugation and
484 hybridization will be calculated for the reactant and product
485 templates before generating coordinates. This should result in
486 better depictions, but can lead to errors in some cases.
487
488 \param canonOrient canonicalize the orientation so that the long
489 axes align with the x-axis etc.
490
491 \param nFlipsPerSample - the number of rotatable bonds that are
492 flipped at random for each sample
493
494 \param nSamples - the number of samples
495
496 \param sampleSeed - seed for the random sampling process
497
498 \param permuteDeg4Nodes - try permuting the drawing order of bonds around
499 atoms with four neighbors in order to improve the depiction
500
501 for the other parameters see the documentation for compute2DCoords()
502
503*/
504RDKIT_CHEMREACTIONS_EXPORT void compute2DCoordsForReaction(
505 RDKit::ChemicalReaction &rxn, double spacing = 2.0, bool updateProps = true,
506 bool canonOrient = false, unsigned int nFlipsPerSample = 0,
507 unsigned int nSamples = 0, int sampleSeed = 0,
508 bool permuteDeg4Nodes = false);
509
510} // namespace RDDepict
511
512#endif
pulls in the core RDKit functionality
used to indicate an error in the chemical reaction engine
Definition Reaction.h:49
const char * what() const noexcept override
get the error message
Definition Reaction.h:56
ChemicalReactionException(const char *msg)
construct with an error message
Definition Reaction.h:52
ChemicalReactionException(const std::string msg)
construct with an error message
Definition Reaction.h:54
~ChemicalReactionException() noexcept override=default
This is a class for storing and applying general chemical reactions.
Definition Reaction.h:121
unsigned int addProductTemplate(ROMOL_SPTR mol)
Adds a new product template.
Definition Reaction.h:185
SubstructMatchParameters & getSubstructParams()
Definition Reaction.h:369
unsigned int addAgentTemplate(ROMOL_SPTR mol)
Adds a new agent template.
Definition Reaction.h:175
unsigned int addReactantTemplate(ROMOL_SPTR mol)
Adds a new reactant template.
Definition Reaction.h:164
unsigned int getNumAgentTemplates() const
Definition Reaction.h:307
const SubstructMatchParameters & getSubstructParams() const
Definition Reaction.h:366
bool getImplicitPropertiesFlag() const
Definition Reaction.h:361
unsigned int getNumReactantTemplates() const
Definition Reaction.h:301
ChemicalReaction & operator=(const ChemicalReaction &other)
Definition Reaction.h:152
ChemicalReaction(const std::string &binStr)
construct a reaction from a pickle string
MOL_SPTR_VECT::iterator beginProductTemplates()
Definition Reaction.h:288
void removeUnmappedReactantTemplates(double thresholdUnmappedAtoms=0.2, bool moveToAgentTemplates=true, MOL_SPTR_VECT *targetVector=nullptr)
MOL_SPTR_VECT::const_iterator beginProductTemplates() const
Definition Reaction.h:267
void initReactantMatchers(bool silent=false)
initializes our internal reactant-matching datastructures.
std::vector< MOL_SPTR_VECT > runReactants(const MOL_SPTR_VECT reactants, unsigned int numProducts=1000) const
Runs the reaction on a set of reactants.
const MOL_SPTR_VECT & getReactants() const
Definition Reaction.h:254
MOL_SPTR_VECT::const_iterator endReactantTemplates() const
Definition Reaction.h:263
void setImplicitPropertiesFlag(bool val)
Definition Reaction.h:364
const MOL_SPTR_VECT & getAgents() const
Definition Reaction.h:257
MOL_SPTR_VECT::iterator endProductTemplates()
Definition Reaction.h:291
bool runReactant(RWMol &reactant) const
Runs a single reactant in place (the reactant is modified)
unsigned int getNumProductTemplates() const
Definition Reaction.h:304
MOL_SPTR_VECT::const_iterator endProductTemplates() const
Definition Reaction.h:270
bool isInitialized() const
Definition Reaction.h:322
ChemicalReaction(const ChemicalReaction &other)
Definition Reaction.h:151
MOL_SPTR_VECT::const_iterator beginAgentTemplates() const
Definition Reaction.h:274
void removeAgentTemplates(MOL_SPTR_VECT *targetVector=nullptr)
std::vector< MOL_SPTR_VECT > runReactant(ROMOL_SPTR reactant, unsigned int reactantTemplateIdx) const
Runs a single reactant against a single reactant template.
MOL_SPTR_VECT::const_iterator beginReactantTemplates() const
Definition Reaction.h:260
const MOL_SPTR_VECT & getProducts() const
Definition Reaction.h:258
MOL_SPTR_VECT::iterator beginReactantTemplates()
Definition Reaction.h:281
MOL_SPTR_VECT::iterator endAgentTemplates()
Definition Reaction.h:298
MOL_SPTR_VECT::iterator beginAgentTemplates()
Definition Reaction.h:295
MOL_SPTR_VECT::iterator endReactantTemplates()
Definition Reaction.h:284
void removeUnmappedProductTemplates(double thresholdUnmappedAtoms=0.2, bool moveToAgentTemplates=true, MOL_SPTR_VECT *targetVector=nullptr)
MOL_SPTR_VECT::const_iterator endAgentTemplates() const
Definition Reaction.h:277
bool validate(unsigned int &numWarnings, unsigned int &numErrors, bool silent=false) const
RWMol is a molecule class that is intended to be edited.
Definition RWMol.h:32
handles pickling (serializing) reactions
#define RDKIT_CHEMREACTIONS_EXPORT
Definition export.h:49
Std stuff.
std::vector< INT_VECT > VECT_INT_VECT
Definition types.h:293
RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeAgentOfReaction(const ChemicalReaction &rxn, const ROMol &mol, unsigned int &which)
RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeReactantOfReaction(const ChemicalReaction &rxn, const ROMol &mol, std::vector< unsigned int > &which, bool stopAtFirstMatch=false)
RDKIT_CHEMREACTIONS_EXPORT VECT_INT_VECT getReactingAtoms(const ChemicalReaction &rxn, bool mappedAtomsOnly=false)
RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeProductOfReaction(const ChemicalReaction &rxn, const ROMol &mol, std::vector< unsigned int > &which, bool stopAtFirstMatch=false)
boost::shared_ptr< ROMol > ROMOL_SPTR
std::vector< boost::shared_ptr< ROMol > > MOL_SPTR_VECT
RDKIT_CHEMREACTIONS_EXPORT void addRecursiveQueriesToReaction(ChemicalReaction &rxn, const std::map< std::string, ROMOL_SPTR > &queries, const std::string &propName, std::vector< std::vector< std::pair< unsigned int, std::string > > > *reactantLabels=nullptr)
add the recursive queries to the reactants of a reaction