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 #ifndef RD_REACTION_RUNNER_H
34 #define RD_REACTION_RUNNER_H
35 
37 #include <GraphMol/ROMol.h>
38 
39 namespace RDKit {
40 //! Runs the reaction on a set of reactants
41 /*!
42  \param rxn: the template reaction we are interested
43  \param reactants: the reactants to be used. The length of this must be equal
44  to
45  rxn->getNumReactantTemplates()
46  Caution: The order of the reactant templates determines the
47  order of the reactants!
48 
49  \return a vector of vectors of products. Each subvector will be
50  rxn->getNumProductTemplates() long.
51 
52  We return a vector of vectors of products because each individual template may
53  map multiple times onto its reactant. This leads to multiple possible result
54  sets.
55 */
56 std::vector<MOL_SPTR_VECT> run_Reactants(const ChemicalReaction& rxn,
57  const MOL_SPTR_VECT& reactants);
58 
59 //! Runs a single reactant against a single reactant template
60 /*!
61  \param reactant The single reactant to use
62 
63  \param reactantTemplateIdx the reactant template to target in the reaction
64 
65  \return a vector of vectors of products. Each subvector will be
66  rxn->getNumProductTemplates() long.
67 
68  We return a vector of vectors of products because each individual template may
69  map multiple times onto its reactant. This leads to multiple possible result
70  sets.
71 
72 */
73 
74 std::vector<MOL_SPTR_VECT> run_Reactant(const ChemicalReaction& rxn,
75  const ROMOL_SPTR& reactant,
76  unsigned int reactantIdx);
77 
78 //! Reduce the product generated by run_Reactants or run_Reactant to
79 // the sidechains that come from the reagents
80 //
81 // n.b. molecules that might be a product of the given reaction
82 // but were not generated by run_Reactant(s) currently
83 // produce no sidechains.
84 /*!
85  \param addDummyAtoms If true, add dummy atoms to the sidechains for the
86  non-reagent parts of the sidechain. Dummy atoms are annotated with
87  the atom maps from the reaction.
88  If False, then any sidechain atom where a bond was cleaved is annotated with:
89  _rgroupAtomMaps property which indicates the scaffold atommaps that where bonded
90  _rgroupBonds property which indicates the bondtype for each atommap bonded
91 */
92 
93 ROMol* reduceProductToSideChains(const ROMOL_SPTR& product,
94  bool addDummyAtoms = true);
95 
96 namespace ReactionRunnerUtils {
98  const ChemicalReaction &rxn, const MOL_SPTR_VECT &reactants,
99  const std::vector<MatchVectType> &reactantsMatch);
100 
101 RWMOL_SPTR convertTemplateToMol(const ROMOL_SPTR prodTemplateSptr);
102 }
103 
104 } // end of RDKit namespace
105 
106 #endif
RWMOL_SPTR convertTemplateToMol(const ROMOL_SPTR prodTemplateSptr)
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:116
std::vector< boost::shared_ptr< ROMol > > MOL_SPTR_VECT
Definition: FragCatParams.h:19
ROMol * reduceProductToSideChains(const ROMOL_SPTR &product, bool addDummyAtoms=true)
Reduce the product generated by run_Reactants or run_Reactant to.
boost::shared_ptr< ROMol > ROMOL_SPTR
Std stuff.
Definition: Atom.h:29
std::vector< MOL_SPTR_VECT > run_Reactants(const ChemicalReaction &rxn, const MOL_SPTR_VECT &reactants)
Runs the reaction on a set of reactants.
boost::shared_ptr< RWMol > RWMOL_SPTR
Definition: RWMol.h:241
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.
MOL_SPTR_VECT generateOneProductSet(const ChemicalReaction &rxn, const MOL_SPTR_VECT &reactants, const std::vector< MatchVectType > &reactantsMatch)