RDKit
Open-source cheminformatics and machine learning.
ReactionRunner.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2014, Novartis Institutes for BioMedical Research Inc.
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following
13 // disclaimer in the documentation and/or other materials provided
14 // with the distribution.
15 // * Neither the name of Novartis Institutes for BioMedical Research Inc.
16 // nor the names of its contributors may be used to endorse or promote
17 // products derived from this software without specific prior written
18 // permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 //
32 
33 #include <RDGeneral/export.h>
34 #ifndef RD_REACTION_RUNNER_H
35 #define RD_REACTION_RUNNER_H
36 
38 #include <GraphMol/ROMol.h>
39 
40 namespace RDKit {
41 //! Runs the reaction on a set of reactants
42 /*!
43  \param rxn: the template reaction we are interested
44  \param reactants: the reactants to be used. The length of this must be equal
45  to
46  rxn->getNumReactantTemplates()
47  Caution: The order of the reactant templates determines the
48  order of the reactants!
49  \param maxProducts: if non zero, the maximum number of products to generate
50  before stopping. If hit a warning will be generated.
51  \return a vector of vectors of products. Each subvector will be
52  rxn->getNumProductTemplates() long.
53 
54  We return a vector of vectors of products because each individual template may
55  map multiple times onto its reactant. This leads to multiple possible result
56  sets.
57 */
58 RDKIT_CHEMREACTIONS_EXPORT std::vector<MOL_SPTR_VECT> run_Reactants(
59  const ChemicalReaction& rxn, const MOL_SPTR_VECT& reactants,
60  unsigned int maxProducts=1000);
61 
62 //! Runs a single reactant against a single reactant template
63 /*!
64  \param reactant The single reactant to use
65 
66  \param reactantTemplateIdx the reactant template to target in the reaction
67 
68  \return a vector of vectors of products. Each subvector will be
69  rxn->getNumProductTemplates() long.
70 
71  We return a vector of vectors of products because each individual template may
72  map multiple times onto its reactant. This leads to multiple possible result
73  sets.
74 
75 */
76 
77 RDKIT_CHEMREACTIONS_EXPORT std::vector<MOL_SPTR_VECT> run_Reactant(const ChemicalReaction& rxn,
78  const ROMOL_SPTR& reactant,
79  unsigned int reactantIdx);
80 
81 //! Reduce the product generated by run_Reactants or run_Reactant to
82 // the sidechains that come from the reagents
83 //
84 // n.b. molecules that might be a product of the given reaction
85 // but were not generated by run_Reactant(s) currently
86 // produce no sidechains.
87 /*!
88  \param addDummyAtoms If true, add dummy atoms to the sidechains for the
89  non-reagent parts of the sidechain. Dummy atoms are annotated with
90  the atom maps from the reaction.
91  If False, then any sidechain atom where a bond was cleaved is annotated with:
92  _rgroupAtomMaps property which indicates the scaffold atommaps that where bonded
93  _rgroupBonds property which indicates the bondtype for each atommap bonded
94 */
95 
97  bool addDummyAtoms = true);
98 
99 namespace ReactionRunnerUtils {
101  const ChemicalReaction &rxn, const MOL_SPTR_VECT &reactants,
102  const std::vector<MatchVectType> &reactantsMatch);
103 
105 }
106 
107 } // end of RDKit namespace
108 
109 #endif
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 ROMol * reduceProductToSideChains(const ROMOL_SPTR &product, bool addDummyAtoms=true)
Reduce the product generated by run_Reactants or run_Reactant to.
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.
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:118
std::vector< boost::shared_ptr< ROMol > > MOL_SPTR_VECT
Definition: FragCatParams.h:20
boost::shared_ptr< ROMol > ROMOL_SPTR
Std stuff.
Definition: Atom.h:30
boost::shared_ptr< RWMol > RWMOL_SPTR
Definition: RWMol.h:218
#define RDKIT_CHEMREACTIONS_EXPORT
Definition: export.h:60
RDKIT_CHEMREACTIONS_EXPORT RWMOL_SPTR convertTemplateToMol(const ROMOL_SPTR prodTemplateSptr)
RDKIT_CHEMREACTIONS_EXPORT MOL_SPTR_VECT generateOneProductSet(const ChemicalReaction &rxn, const MOL_SPTR_VECT &reactants, const std::vector< MatchVectType > &reactantsMatch)