34 #ifndef RD_REACTION_H_17Aug2006 35 #define RD_REACTION_H_17Aug2006 43 class ReactionPickler;
53 const char *
message()
const {
return _msg.c_str(); };
123 :
RDProps(), df_needsInit(true), df_implicitProperties(false){};
125 df_needsInit = other.df_needsInit;
126 df_implicitProperties = other.df_implicitProperties;
130 m_reactantTemplates.push_back(
ROMOL_SPTR(reactant));
135 m_productTemplates.push_back(
ROMOL_SPTR(product));
140 m_agentTemplates.push_back(
ROMOL_SPTR(agent));
153 this->df_needsInit =
true;
154 this->m_reactantTemplates.push_back(mol);
155 return rdcast<unsigned int>(this->m_reactantTemplates.size());
164 this->m_agentTemplates.push_back(mol);
165 return rdcast<unsigned int>(this->m_agentTemplates.size());
174 this->m_productTemplates.push_back(mol);
175 return rdcast<unsigned int>(this->m_productTemplates.size());
185 void removeUnmappedReactantTemplates(
double thresholdUnmappedAtoms = 0.2,
186 bool moveToAgentTemplates =
true,
196 void removeUnmappedProductTemplates(
double thresholdUnmappedAtoms = 0.2,
197 bool moveToAgentTemplates =
true,
202 void removeAgentTemplates(
MOL_SPTR_VECT *targetVector = NULL);
221 std::vector<MOL_SPTR_VECT> runReactants(
const MOL_SPTR_VECT reactants,
222 unsigned int numProducts=1000)
const;
230 std::vector<MOL_SPTR_VECT> runReactant(
231 ROMOL_SPTR reactant,
unsigned int reactantTemplateIdx)
const;
234 return this->m_reactantTemplates;
240 return this->m_reactantTemplates.begin();
243 return this->m_reactantTemplates.end();
247 return this->m_productTemplates.begin();
250 return this->m_productTemplates.end();
254 return this->m_agentTemplates.begin();
257 return this->m_agentTemplates.end();
261 return this->m_reactantTemplates.begin();
264 return this->m_reactantTemplates.end();
268 return this->m_productTemplates.begin();
271 return this->m_productTemplates.end();
275 return this->m_agentTemplates.begin();
278 return this->m_agentTemplates.end();
281 return rdcast<unsigned int>(this->m_reactantTemplates.size());
284 return rdcast<unsigned int>(this->m_productTemplates.size());
287 return rdcast<unsigned int>(this->m_agentTemplates.size());
295 void initReactantMatchers();
316 bool validate(
unsigned int &numWarnings,
unsigned int &numErrors,
317 bool silent =
false)
const;
346 bool df_implicitProperties;
347 MOL_SPTR_VECT m_reactantTemplates, m_productTemplates, m_agentTemplates;
357 unsigned int &which);
368 unsigned int &which);
378 unsigned int &which);
410 bool mappedAtomsOnly =
false);
435 const std::string &propName,
436 std::vector<std::vector<std::pair<unsigned int, std::string>>>
437 *reactantLabels = NULL);
471 double spacing = 2.0,
bool updateProps =
true,
472 bool canonOrient =
false,
473 unsigned int nFlipsPerSample = 0,
474 unsigned int nSamples = 0,
int sampleSeed = 0,
475 bool permuteDeg4Nodes =
false);
MOL_SPTR_VECT::iterator beginProductTemplates()
const MOL_SPTR_VECT & getAgents() const
MOL_SPTR_VECT::const_iterator endReactantTemplates() const
bool getImplicitPropertiesFlag() const
const MOL_SPTR_VECT & getReactants() const
ChemicalReaction(const ChemicalReaction &other)
void setImplicitPropertiesFlag(bool val)
RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeAgentOfReaction(const ChemicalReaction &rxn, const ROMol &mol, unsigned int &which)
unsigned int addAgentTemplate(ROMOL_SPTR mol)
Adds a new agent template.
This is a class for storing and applying general chemical reactions.
pulls in the core RDKit functionality
std::vector< boost::shared_ptr< ROMol > > MOL_SPTR_VECT
MOL_SPTR_VECT::iterator endProductTemplates()
std::vector< INT_VECT > VECT_INT_VECT
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.
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
MOL_SPTR_VECT::iterator beginReactantTemplates()
MOL_SPTR_VECT::const_iterator endProductTemplates() const
MOL_SPTR_VECT::const_iterator beginProductTemplates() const
const char * message() const
get the error message
unsigned int getNumProductTemplates() const
const MOL_SPTR_VECT & getProducts() const
boost::shared_ptr< ROMol > ROMOL_SPTR
used to indicate an error in the chemical reaction engine
MOL_SPTR_VECT::const_iterator beginReactantTemplates() const
unsigned int addProductTemplate(ROMOL_SPTR mol)
Adds a new product template.
unsigned int addReactantTemplate(ROMOL_SPTR mol)
Adds a new reactant template.
RDKIT_CHEMREACTIONS_EXPORT VECT_INT_VECT getReactingAtoms(const ChemicalReaction &rxn, bool mappedAtomsOnly=false)
bool isInitialized() const
MOL_SPTR_VECT::const_iterator beginAgentTemplates() const
ChemicalReactionException(const std::string msg)
construct with an error message
#define RDKIT_CHEMREACTIONS_EXPORT
RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeReactantOfReaction(const ChemicalReaction &rxn, const ROMol &mol, unsigned int &which)
MOL_SPTR_VECT::iterator endReactantTemplates()
handles pickling (serializing) reactions
MOL_SPTR_VECT::iterator beginAgentTemplates()
unsigned int getNumAgentTemplates() const
RDKIT_CHEMREACTIONS_EXPORT bool isMoleculeProductOfReaction(const ChemicalReaction &rxn, const ROMol &mol, unsigned int &which)
MOL_SPTR_VECT::iterator endAgentTemplates()
ChemicalReactionException(const char *msg)
construct with an error message
~ChemicalReactionException()
MOL_SPTR_VECT::const_iterator endAgentTemplates() const
unsigned int getNumReactantTemplates() const