Package CHEM :: Package CombiCDB :: Module ReactionModel
[hide private]
[frames] | no frames]

Module ReactionModel



Common objects / base classes used to support reaction processing.

Primarily revolves around Reagent object models to predict products from input reactants. The example code below illustrates how to load existing reagents from the database using the ReagentSearchModel and SMIRKSReagent.loadDBInstances method. Once these are ready, and any settings are made (such as the removal of inherent products), the reagent as a functor which can take in a list of reactant molecule objects and generated predicted product molecule objects.
>>> from CHEM.Common.Util import molBySmiles;
>>> from CHEM.CombiCDB.ReactionModel import SMIRKSReagent, ReagentSearchModel, reactionStepStr;
>>> from CHEM.CombiCDB.test.ReagentIdentifiers import HYDROBROMINATION;
>>> reagentQuery = ReagentSearchModel();
>>> reagentQuery.reagentIDs = [HYDROBROMINATION];
>>> reagents = SMIRKSReagent.loadDBInstances( reagentQuery );
>>> reagent = reagents[0];  # Expect only the one hydrobromination reagent
>>> reagent.removeInherentProducts = True;  # Not interested in inherent products
>>> print reagent["reagent_id"], reagent["description"];    # Reagent works as a dictionary
1 Hydrobromination
>>> reactants = [molBySmiles("CC=C")];  # List of molecule objects as reactant input
>>> products = reagent( reactants );    # Use reagent as function to generate products
>>> reactionStep = ( reactants, reagent, products );    # Combined elements of a complete reaction
>>> print reactionStepStr( reactionStep ).replace("\t"," ");   # Tab characters mess up doctest
CC=C>>CC(C)Br Hydrobromination


Classes [hide private]
  BaseReagent
Generic object class to model reaction reagents.
  SMIRKSReagent
Specific implementation of BaseReagent that uses SMIRKS string processing to execute the transformations.
  TrackingDataModel
Simple struct to store tracking variables while processing reagents.
  SupplementalDataModel
Simple struct to store supplemental data that can be returned after reagent processing if the caller is interested.
  ReagentSearchModel
Simple struct containing query parameters indicating which reagents to pull out of the database.
  ReactionStep
Class to represent a single step in a reaction synthesis pathway.
Functions [hide private]
 
countAtomCharges(molList, chargeValue)
Go through every atom of every molecule in the list.
 
clearSentinelCharges(mol, chargeValue)
Look for atoms in the molecule with the specified sentinel charge value and clear them out to normal values.
 
reactionStepStr(reactionStep)
Convenience function for converting a reaction step into a comprehensible string.
Variables [hide private]
  REACTANTS = 0
  REAGENT = 1
  PRODUCTS = 2
Function Details [hide private]

countAtomCharges(molList, chargeValue)

 
Go through every atom of every molecule in the list. Count up the number of them whose formal charge is equal to the specified chargeValue

clearSentinelCharges(mol, chargeValue)

 
Look for atoms in the molecule with the specified sentinel charge value and clear them out to normal values. Returns whether any such changes were made.

reactionStepStr(reactionStep)

 
Convenience function for converting a reaction step into a comprehensible string. Reaction step model is currently just a 3-ple consisting of
  • List of reactant SMILES strings (or molecule objects)
  • Reagent object
  • List of product SMILES strings (or molecule objects)