 |
RDKit
Open-source cheminformatics and machine learning.
|
Go to the documentation of this file.
34 #ifndef RD_REACTION_H_17Aug2006
35 #define RD_REACTION_H_17Aug2006
43 class ReactionPickler;
47 :
public std::exception {
54 const char *
what() const noexcept
override {
return _msg.c_str(); };
55 const char *
message() const noexcept {
return what(); };
125 :
RDProps(), df_needsInit(true), df_implicitProperties(false){};
127 df_needsInit = other.df_needsInit;
128 df_implicitProperties = other.df_implicitProperties;
132 m_reactantTemplates.push_back(
ROMOL_SPTR(reactant));
137 m_productTemplates.push_back(
ROMOL_SPTR(product));
142 m_agentTemplates.push_back(
ROMOL_SPTR(agent));
155 this->df_needsInit =
true;
156 this->m_reactantTemplates.push_back(mol);
157 return rdcast<unsigned int>(this->m_reactantTemplates.size());
166 this->m_agentTemplates.push_back(mol);
167 return rdcast<unsigned int>(this->m_agentTemplates.size());
176 this->m_productTemplates.push_back(mol);
177 return rdcast<unsigned int>(this->m_productTemplates.size());
188 bool moveToAgentTemplates =
true,
199 bool moveToAgentTemplates =
true,
224 const MOL_SPTR_VECT reactants,
unsigned int numProducts = 1000)
const;
233 ROMOL_SPTR reactant,
unsigned int reactantTemplateIdx)
const;
236 return this->m_reactantTemplates;
242 return this->m_reactantTemplates.begin();
245 return this->m_reactantTemplates.end();
249 return this->m_productTemplates.begin();
252 return this->m_productTemplates.end();
256 return this->m_agentTemplates.begin();
259 return this->m_agentTemplates.end();
263 return this->m_reactantTemplates.begin();
266 return this->m_reactantTemplates.end();
270 return this->m_productTemplates.begin();
273 return this->m_productTemplates.end();
277 return this->m_agentTemplates.begin();
280 return this->m_agentTemplates.end();
283 return rdcast<unsigned int>(this->m_reactantTemplates.size());
286 return rdcast<unsigned int>(this->m_productTemplates.size());
289 return rdcast<unsigned int>(this->m_agentTemplates.size());
318 bool validate(
unsigned int &numWarnings,
unsigned int &numErrors,
319 bool silent =
false)
const;
348 bool df_implicitProperties;
349 MOL_SPTR_VECT m_reactantTemplates, m_productTemplates, m_agentTemplates;
439 const std::string &propName,
440 std::vector<std::vector<std::pair<unsigned int, std::string>>>
441 *reactantLabels = NULL);
476 bool canonOrient =
false,
unsigned int nFlipsPerSample = 0,
477 unsigned int nSamples = 0,
int sampleSeed = 0,
478 bool permuteDeg4Nodes =
false);
RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeAgentOfReaction(const ChemicalReaction &rxn, const ROMol &mol, unsigned int &which)
MOL_SPTR_VECT::const_iterator endProductTemplates() const
ChemicalReaction(const std::string &binStr)
construct a reaction from a pickle string
const MOL_SPTR_VECT & getReactants() const
std::vector< INT_VECT > VECT_INT_VECT
MOL_SPTR_VECT::iterator beginReactantTemplates()
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 beginAgentTemplates() const
bool validate(unsigned int &numWarnings, unsigned int &numErrors, bool silent=false) const
validates the reactants and products to make sure the reaction seems
const char * what() const noexcept override
get the error message
used to indicate an error in the chemical reaction engine
const MOL_SPTR_VECT & getProducts() const
bool getImplicitPropertiesFlag() const
void removeAgentTemplates(MOL_SPTR_VECT *targetVector=NULL)
std::vector< MOL_SPTR_VECT > runReactants(const MOL_SPTR_VECT reactants, unsigned int numProducts=1000) const
Runs the reaction on a set of reactants.
RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeReactantOfReaction(const ChemicalReaction &rxn, const ROMol &mol, unsigned int &which)
pulls in the core RDKit functionality
std::vector< boost::shared_ptr< ROMol > > MOL_SPTR_VECT
ChemicalReactionException(const std::string msg)
construct with an error message
ChemicalReaction(const ChemicalReaction &other)
MOL_SPTR_VECT::const_iterator beginReactantTemplates() const
void removeUnmappedReactantTemplates(double thresholdUnmappedAtoms=0.2, bool moveToAgentTemplates=true, MOL_SPTR_VECT *targetVector=NULL)
Removes the reactant templates from a reaction if atom mapping ratio is.
unsigned int addAgentTemplate(ROMOL_SPTR mol)
Adds a new agent template.
ChemicalReactionException(const char *msg)
construct with an error message
MOL_SPTR_VECT::const_iterator endReactantTemplates() const
~ChemicalReactionException() noexcept
MOL_SPTR_VECT::const_iterator beginProductTemplates() const
This is a class for storing and applying general chemical reactions.
unsigned int getNumAgentTemplates() const
unsigned int addReactantTemplate(ROMOL_SPTR mol)
Adds a new reactant template.
MOL_SPTR_VECT::iterator endReactantTemplates()
unsigned int addProductTemplate(ROMOL_SPTR mol)
Adds a new product template.
void setImplicitPropertiesFlag(bool val)
const MOL_SPTR_VECT & getAgents() const
unsigned int getNumProductTemplates() const
unsigned int getNumReactantTemplates() const
RDKIT_CHEMREACTIONS_EXPORT VECT_INT_VECT getReactingAtoms(const ChemicalReaction &rxn, bool mappedAtomsOnly=false)
#define RDKIT_CHEMREACTIONS_EXPORT
MOL_SPTR_VECT::iterator beginProductTemplates()
handles pickling (serializing) reactions
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=NULL)
add the recursive queries to the reactants of a reaction
void initReactantMatchers()
initializes our internal reactant-matching datastructures.
RDKIT_CHEMREACTIONS_EXPORT void compute2DCoordsForReaction(RDKit::ChemicalReaction &rxn, double spacing=2.0, bool updateProps=true, bool canonOrient=false, unsigned int nFlipsPerSample=0, unsigned int nSamples=0, int sampleSeed=0, bool permuteDeg4Nodes=false)
Generate 2D coordinates (a depiction) for a reaction.
bool isInitialized() const
MOL_SPTR_VECT::iterator endAgentTemplates()
void removeUnmappedProductTemplates(double thresholdUnmappedAtoms=0.2, bool moveToAgentTemplates=true, MOL_SPTR_VECT *targetVector=NULL)
Removes the product templates from a reaction if its atom mapping ratio is.
MOL_SPTR_VECT::const_iterator endAgentTemplates() const
boost::shared_ptr< ROMol > ROMOL_SPTR
MOL_SPTR_VECT::iterator beginAgentTemplates()
RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeProductOfReaction(const ChemicalReaction &rxn, const ROMol &mol, unsigned int &which)
MOL_SPTR_VECT::iterator endProductTemplates()
const char * message() const noexcept