RDKit
Open-source cheminformatics and machine learning.
ReactionRunner.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2014-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_RUNNER_H
37 #define RD_REACTION_RUNNER_H
38 
40 #include <GraphMol/ROMol.h>
41 
42 namespace RDKit {
43 //! Runs the reaction on a set of reactants
44 /*!
45  \param rxn: the template reaction we are interested
46  \param reactants: the reactants to be used. The length of this must be equal
47  to
48  rxn->getNumReactantTemplates()
49  Caution: The order of the reactant templates determines the
50  order of the reactants!
51  \param maxProducts: if non zero, the maximum number of products to generate
52  before stopping. If hit a warning will be generated.
53  \return a vector of vectors of products. Each subvector will be
54  rxn->getNumProductTemplates() long.
55 
56  We return a vector of vectors of products because each individual template may
57  map multiple times onto its reactant. This leads to multiple possible result
58  sets.
59 */
60 RDKIT_CHEMREACTIONS_EXPORT std::vector<MOL_SPTR_VECT> run_Reactants(
61  const ChemicalReaction& rxn, const MOL_SPTR_VECT& reactants,
62  unsigned int maxProducts = 1000);
63 
64 //! Runs a single reactant against a single reactant template
65 /*!
66  \param reactant The single reactant to use
67 
68  \param reactantTemplateIdx the reactant template to target in the reaction
69 
70  \return a vector of vectors of products. Each subvector will be
71  rxn->getNumProductTemplates() long.
72 
73  We return a vector of vectors of products because each individual template may
74  map multiple times onto its reactant. This leads to multiple possible result
75  sets.
76 
77 */
78 
79 RDKIT_CHEMREACTIONS_EXPORT std::vector<MOL_SPTR_VECT> run_Reactant(
80  const ChemicalReaction& rxn, const ROMOL_SPTR& reactant,
81  unsigned int reactantIdx);
82 
84  RWMol& reactant);
85 
86 //! Reduce the product generated by run_Reactants or run_Reactant to
87 /// the sidechains that come from the reagents
88 //
89 // n.b. molecules that might be a product of the given reaction
90 // but were not generated by run_Reactant(s) currently
91 // produce no sidechains.
92 /*!
93  \param addDummyAtoms If true, add dummy atoms to the sidechains for the
94  non-reagent parts of the sidechain. Dummy atoms are annotated with
95  the atom maps from the reaction.
96  If False, then any sidechain atom where a bond was cleaved is annotated
97  with: _rgroupAtomMaps property which indicates the scaffold atommaps that
98  where bonded _rgroupBonds property which indicates the bondtype for each
99  atommap bonded
100 */
101 
103  const ROMOL_SPTR& product, bool addDummyAtoms = true);
104 
105 namespace ReactionRunnerUtils {
107  const ChemicalReaction& rxn, const MOL_SPTR_VECT& reactants,
108  const std::vector<MatchVectType>& reactantsMatch);
109 
111 convertTemplateToMol(const ROMOL_SPTR prodTemplateSptr);
112 } // namespace ReactionRunnerUtils
113 
114 } // namespace RDKit
115 
116 #endif
Defines the primary molecule class ROMol as well as associated typedefs.
This is a class for storing and applying general chemical reactions.
Definition: Reaction.h:121
RWMol is a molecule class that is intended to be edited.
Definition: RWMol.h:32
#define RDKIT_CHEMREACTIONS_EXPORT
Definition: export.h:49
RDKIT_CHEMREACTIONS_EXPORT MOL_SPTR_VECT generateOneProductSet(const ChemicalReaction &rxn, const MOL_SPTR_VECT &reactants, const std::vector< MatchVectType > &reactantsMatch)
RDKIT_CHEMREACTIONS_EXPORT RWMOL_SPTR convertTemplateToMol(const ROMOL_SPTR prodTemplateSptr)
Std stuff.
Definition: Abbreviations.h:19
RDKIT_CHEMREACTIONS_EXPORT ROMol * reduceProductToSideChains(const ROMOL_SPTR &product, bool addDummyAtoms=true)
boost::shared_ptr< ROMol > ROMOL_SPTR
RDKIT_CHEMREACTIONS_EXPORT std::vector< MOL_SPTR_VECT > run_Reactants(const ChemicalReaction &rxn, const MOL_SPTR_VECT &reactants, unsigned int maxProducts=1000)
Runs the reaction on a set of reactants.
RDKIT_CHEMREACTIONS_EXPORT std::vector< MOL_SPTR_VECT > run_Reactant(const ChemicalReaction &rxn, const ROMOL_SPTR &reactant, unsigned int reactantIdx)
Runs a single reactant against a single reactant template.
std::vector< boost::shared_ptr< ROMol > > MOL_SPTR_VECT
Definition: FragCatParams.h:20
boost::shared_ptr< RWMol > RWMOL_SPTR
Definition: RWMol.h:217