RDKit::ChemicalReaction Class Reference

This is a class for storing and applying general chemical reactions. More...

#include <Reaction.h>

List of all members.

Public Member Functions

 ChemicalReaction ()
 ChemicalReaction (const ChemicalReaction &other)
unsigned int addReactantTemplate (ROMOL_SPTR mol)
 Adds a new reactant template.
unsigned int addProductTemplate (ROMOL_SPTR mol)
 Adds a new product template.
std::vector
< MOL_SPTR_VECT
runReactants (const MOL_SPTR_VECT reactants) const
 Runs the reaction on a set of reactants.
MOL_SPTR_VECT::const_iterator beginReactantTemplates () const
MOL_SPTR_VECT::const_iterator endReactantTemplates () const
MOL_SPTR_VECT::const_iterator beginProductTemplates () const
MOL_SPTR_VECT::const_iterator endProductTemplates () const
unsigned int getNumReactantTemplates () const
unsigned int getNumProductTemplates () const
void initReactantMatchers ()
 initializes our internal reactant-matching datastructures.
bool validate (unsigned int &numWarnings, unsigned int &numErrors, bool silent=false) const
 validates the reactants and products to make sure the reaction seems "reasonable"
bool getImplicitPropertiesFlag () const
void setImplicitPropertiesFlag (bool val)


Detailed Description

This is a class for storing and applying general chemical reactions.

basic usage will be something like:

     ChemicalReaction rxn;
     rxn.addReactantTemplate(r1);
     rxn.addReactantTemplate(r2);
     rxn.addProductTemplate(p1);
     rxn.initReactantMatchers();
     
     MOL_SPTR_VECT prods;
     for(MOL_SPTR_VECT::const_iterator r1It=reactantSet1.begin();
         r1It!=reactantSet1.end();++r1It;){
       for(MOL_SPTR_VECT::const_iterator r2It=reactantSet2.begin();
	   r2It!=reactantSet2.end();++r2It;){
	 MOL_SPTR_VECT rVect(2);
         rVect[0] = *r1It;
         rVect[1] = *r2It;
             
         std::vector<MOL_SPTR_VECT> lprods;
         lprods = rxn.runReactants(rVect);
         for(std::vector<MOL_SPTR_VECT>::const_iterator lpIt=lprods.begin();
            lpIt!=lprods.end();++lpIt){
            // we know this is a single-product reaction:
            prods.push_back((*lpIt)[0]);
         }
       }     
     }
     

Definition at line 87 of file Reaction.h.


Constructor & Destructor Documentation

RDKit::ChemicalReaction::ChemicalReaction (  )  [inline]

Definition at line 89 of file Reaction.h.

RDKit::ChemicalReaction::ChemicalReaction ( const ChemicalReaction other  )  [inline]

Definition at line 90 of file Reaction.h.

References df_implicitProperties, m_productTemplates, and m_reactantTemplates.


Member Function Documentation

unsigned int RDKit::ChemicalReaction::addReactantTemplate ( ROMOL_SPTR  mol  )  [inline]

Adds a new reactant template.

Returns:
the number of reactants

Definition at line 101 of file Reaction.h.

unsigned int RDKit::ChemicalReaction::addProductTemplate ( ROMOL_SPTR  mol  )  [inline]

Adds a new product template.

Returns:
the number of products

Definition at line 112 of file Reaction.h.

std::vector<MOL_SPTR_VECT> RDKit::ChemicalReaction::runReactants ( const MOL_SPTR_VECT  reactants  )  const

Runs the reaction on a set of reactants.

Parameters:
reactants,: the reactants to be used. The length of this must be equal to this->getNumReactantTemplates()
Returns:
a vector of vectors of products. Each subvector will be this->getNumProductTemplates() long.
We return a vector of vectors of products because each individual template may map multiple times onto its reactant. This leads to multiple possible result sets.

MOL_SPTR_VECT::const_iterator RDKit::ChemicalReaction::beginReactantTemplates (  )  const [inline]

Definition at line 132 of file Reaction.h.

MOL_SPTR_VECT::const_iterator RDKit::ChemicalReaction::endReactantTemplates (  )  const [inline]

Definition at line 135 of file Reaction.h.

MOL_SPTR_VECT::const_iterator RDKit::ChemicalReaction::beginProductTemplates (  )  const [inline]

Definition at line 139 of file Reaction.h.

MOL_SPTR_VECT::const_iterator RDKit::ChemicalReaction::endProductTemplates (  )  const [inline]

Definition at line 142 of file Reaction.h.

unsigned int RDKit::ChemicalReaction::getNumReactantTemplates (  )  const [inline]

Definition at line 145 of file Reaction.h.

unsigned int RDKit::ChemicalReaction::getNumProductTemplates (  )  const [inline]

Definition at line 146 of file Reaction.h.

void RDKit::ChemicalReaction::initReactantMatchers (  ) 

initializes our internal reactant-matching datastructures.

This must be called after adding reactants and before calling runReactants.

bool RDKit::ChemicalReaction::validate ( unsigned int &  numWarnings,
unsigned int &  numErrors,
bool  silent = false 
) const

validates the reactants and products to make sure the reaction seems "reasonable"

Returns:
true if the reaction validates without errors (warnings do not stop validation)
Parameters:
numWarnings,: used to return the number of validation warnings
numErrors,: used to return the number of validation errors
silent,: If this bool is true, no messages will be logged during the validation. By default, validation problems are reported to the warning and error logs depending on their severity.

bool RDKit::ChemicalReaction::getImplicitPropertiesFlag (  )  const [inline]

returns whether or not the reaction uses implicit properties on the product atoms

This toggles whether or not unspecified atomic properties in the products are considered to be implicit and should be copied from the actual reactants. This is necessary due to a semantic difference between the "reaction SMARTS" approach and the MDL RXN approach: In "reaction SMARTS", this reaction: [C:1]-[Br:2].[O-:3]>>[C:1]-[O:3].[Br-:2] applied to [CH4+]Br should yield [CH4+]O Something similar drawn in an rxn file, and applied to [CH4+]Br should yield [CH3]O. In rxn there is no charge on the product C because nothing is specified in the rxn file; in "SMARTS" the charge from the actual reactants is not *removed* because no charge is specified in the reaction.

Definition at line 190 of file Reaction.h.

void RDKit::ChemicalReaction::setImplicitPropertiesFlag ( bool  val  )  [inline]

sets the implicit properties flag. See the documentation for getImplicitProertiesFlag() for a discussion of what this means.

Definition at line 193 of file Reaction.h.


The documentation for this class was generated from the following file:
Generated on Sat May 24 08:36:34 2008 for RDCode by  doxygen 1.5.3