34 #ifndef RD_REACTION_H_17Aug2006 35 #define RD_REACTION_H_17Aug2006 43 class ReactionPickler;
47 :
public std::exception {
54 const char *
message()
const {
return _msg.c_str(); };
124 :
RDProps(), df_needsInit(true), df_implicitProperties(false){};
126 df_needsInit = other.df_needsInit;
127 df_implicitProperties = other.df_implicitProperties;
131 m_reactantTemplates.push_back(
ROMOL_SPTR(reactant));
136 m_productTemplates.push_back(
ROMOL_SPTR(product));
141 m_agentTemplates.push_back(
ROMOL_SPTR(agent));
154 this->df_needsInit =
true;
155 this->m_reactantTemplates.push_back(mol);
156 return rdcast<unsigned int>(this->m_reactantTemplates.size());
165 this->m_agentTemplates.push_back(mol);
166 return rdcast<unsigned int>(this->m_agentTemplates.size());
175 this->m_productTemplates.push_back(mol);
176 return rdcast<unsigned int>(this->m_productTemplates.size());
186 void removeUnmappedReactantTemplates(
double thresholdUnmappedAtoms = 0.2,
187 bool moveToAgentTemplates =
true,
197 void removeUnmappedProductTemplates(
double thresholdUnmappedAtoms = 0.2,
198 bool moveToAgentTemplates =
true,
203 void removeAgentTemplates(
MOL_SPTR_VECT *targetVector = NULL);
222 std::vector<MOL_SPTR_VECT> runReactants(
223 const MOL_SPTR_VECT reactants,
unsigned int numProducts = 1000)
const;
231 std::vector<MOL_SPTR_VECT> runReactant(
232 ROMOL_SPTR reactant,
unsigned int reactantTemplateIdx)
const;
235 return this->m_reactantTemplates;
241 return this->m_reactantTemplates.begin();
244 return this->m_reactantTemplates.end();
248 return this->m_productTemplates.begin();
251 return this->m_productTemplates.end();
255 return this->m_agentTemplates.begin();
258 return this->m_agentTemplates.end();
262 return this->m_reactantTemplates.begin();
265 return this->m_reactantTemplates.end();
269 return this->m_productTemplates.begin();
272 return this->m_productTemplates.end();
276 return this->m_agentTemplates.begin();
279 return this->m_agentTemplates.end();
282 return rdcast<unsigned int>(this->m_reactantTemplates.size());
285 return rdcast<unsigned int>(this->m_productTemplates.size());
288 return rdcast<unsigned int>(this->m_agentTemplates.size());
296 void initReactantMatchers();
317 bool validate(
unsigned int &numWarnings,
unsigned int &numErrors,
318 bool silent =
false)
const;
347 bool df_implicitProperties;
348 MOL_SPTR_VECT m_reactantTemplates, m_productTemplates, m_agentTemplates;
438 const std::string &propName,
439 std::vector<std::vector<std::pair<unsigned int, std::string>>>
440 *reactantLabels = NULL);
475 bool canonOrient =
false,
unsigned int nFlipsPerSample = 0,
476 unsigned int nSamples = 0,
int sampleSeed = 0,
477 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