COPASI API
4.16.103
|
#include <CReactionInterface.h>
Public Member Functions | |
CReactionInterface (CModel *pModel) | |
bool | createMetabolites () |
bool | createOtherObjects () const |
const CChemEqInterface & | getChemEqInterface () const |
std::string | getChemEqString () const |
std::set< const CCopasiObject * > | getDeletedParameters () const |
const CFunction * | getFunction () const |
const std::string & | getFunctionDescription () const |
const std::string & | getFunctionName () const |
const std::vector< std::string > & | getListOfMetabs (CFunctionParameter::Role role) const |
std::vector< std::string > | getListOfPossibleFunctions () const |
const C_FLOAT64 & | getLocalValue (size_t index) const |
const std::string & | getMapping (size_t index) const |
const std::vector< std::string > & | getMappings (size_t index) const |
std::string | getParameterName (size_t index) const |
CFunctionParameter::Role | getUsage (size_t index) const |
void | initFromReaction (const std::string &key) |
void | initFromReaction (const C_INT32 index) |
void | initFromReaction (const CReaction *rea) |
bool | isLocalValue (size_t index) const |
bool | isLocked (size_t index) const |
bool | isLocked (CFunctionParameter::Role usage) const |
bool | isMulticompartment () const |
bool | isReversible () const |
bool | isValid () const |
bool | isVector (size_t index) const |
void | removeMapping (size_t index, std::string mn) |
void | reverse (bool rev, const std::string &newFunction) |
void | setChemEqString (const std::string &eq, const std::string &newFunction) |
void | setFunctionAndDoMapping (const std::string &fn) |
void | setFunctionWithEmptyMapping (const std::string &fn) |
void | setLocal (size_t index) |
void | setLocalValue (size_t index, C_FLOAT64 value) |
void | setMapping (size_t index, std::string mn) |
void | setReversibility (bool rev, const std::string &newFunction) |
size_t | size () const |
bool | writeBackToReaction (CReaction *rea) |
~CReactionInterface () | |
Private Member Functions | |
void | clearFunction () |
void | connectFromScratch (CFunctionParameter::Role role) |
void | connectNonMetabolites () |
void | copyMapping () |
CReactionInterface () | |
void | findAndSetFunction (const std::string &newFunction) |
std::vector< std::string > | getExpandedMetabList (CFunctionParameter::Role role) const |
void | initMapping () |
bool | loadMappingAndValues (const CReaction &rea) |
void | updateModifiersInChemEq () |
Private Attributes | |
std::string | emptyString |
CChemEqInterface | mChemEqI |
std::vector< bool > | mIsLocal |
std::vector< std::vector < std::string > > | mNameMap |
const CFunction * | mpFunction |
CModel * | mpModel |
CFunctionParameters * | mpParameters |
std::string | mReactionReferenceKey |
std::vector< C_FLOAT64 > | mValues |
This class provides an interface for dealing with reactions. For representing the parameter mappings it uses object names. A CReactionInterface allows editing a reaction while trying to keep everything consistent.
Note: Many of the methods need to be provided with a model. While handling of the metabolites is completely independent of the model (they are handled by name, and they don't need to exist), the mapping of Compartments and global parameters is done with the entities that exist in the model. This may seem inconsistent, but the idea is that metabolites can be created from the gui by entering them into the reaction equation. Compartments and global parameters can only be chosen from the list of existing objects.
Definition at line 52 of file CReactionInterface.h.
|
private |
CReactionInterface::CReactionInterface | ( | CModel * | pModel | ) |
Definition at line 27 of file CReactionInterface.cpp.
References emptyString, and mpModel.
CReactionInterface::~CReactionInterface | ( | ) |
Definition at line 37 of file CReactionInterface.cpp.
References mpParameters, and pdelete.
|
private |
Definition at line 315 of file CReactionInterface.cpp.
References mNameMap, mpFunction, mpParameters, mValues, and pdelete.
Referenced by setFunctionAndDoMapping(), and setFunctionWithEmptyMapping().
|
private |
guesses how to connect metabs with parameters for a specific usage
Definition at line 444 of file CReactionInterface.cpp.
References fatalError, CFunctionParameter::FLOAT64, getExpandedMetabList(), CFunctionParameters::getNumberOfParametersByUsage(), CFunctionParameters::getParameterByUsage(), CFunctionParameter::getType(), mNameMap, mpParameters, and CFunctionParameter::VFLOAT64.
Referenced by setFunctionAndDoMapping().
|
private |
tries to determine the mapping for PARAMETER, VOLUME, TIME only if the current mapping is "unknown". Is typically called after initMapping() and copyMapping()
Definition at line 682 of file CReactionInterface.cpp.
References CChemEqInterface::getCompartment(), CModel::getModelValues(), CCopasiObject::getObjectName(), getUsage(), isLocalValue(), mChemEqI, mNameMap, CFunctionParameter::MODIFIER, mpModel, CFunctionParameter::PARAMETER, CFunctionParameter::PRODUCT, size(), CCopasiVector< T >::size(), CFunctionParameter::SUBSTRATE, CFunctionParameter::TIME, and CFunctionParameter::VOLUME.
Referenced by setFunctionAndDoMapping().
|
private |
create new mapping, try to keep as much information from the current mapping. Calls initMapping().
Definition at line 614 of file CReactionInterface.cpp.
References getParameterName(), getUsage(), initMapping(), isVector(), mIsLocal, mNameMap, CFunctionParameter::MODIFIER, mpParameters, mValues, CFunctionParameter::PARAMETER, pdelete, CFunctionParameter::PRODUCT, CFunctionParameters::size(), size(), CFunctionParameter::SUBSTRATE, CFunctionParameter::TIME, CFunctionParameter::VFLOAT64, and CFunctionParameter::VOLUME.
Referenced by setFunctionAndDoMapping().
bool CReactionInterface::createMetabolites | ( | ) |
create all metabolites that are needed by the reaction but do not exist in the model yet.
Definition at line 877 of file CReactionInterface.cpp.
References CChemEqInterface::createNonExistingMetabs(), getFunctionName(), mChemEqI, and setFunctionAndDoMapping().
Referenced by ReactionsWidget1::saveToReaction(), and CQReactionDM::setEquation().
bool CReactionInterface::createOtherObjects | ( | ) | const |
create all other objects that are needed by the reaction but do not exist in the model yet.
Definition at line 888 of file CReactionInterface.cpp.
References CModel::createCompartment(), CModel::createModelValue(), getUsage(), isLocalValue(), mNameMap, mpModel, CFunctionParameter::PARAMETER, size(), and CFunctionParameter::VOLUME.
Referenced by ReactionsWidget1::saveToReaction(), and CQReactionDM::setEquation().
|
private |
checks if newFunction is an valid function for the reaction. If it is not or if newFunction="" another function is chosen.
Definition at line 344 of file CReactionInterface.cpp.
References C_FLOAT64, fl(), getFunctionName(), CChemEqInterface::getListOfDisplayNames(), getListOfPossibleFunctions(), getLocalValue(), CChemEqInterface::getReversibility(), mChemEqI, CFunctionParameter::PRODUCT, setFunctionAndDoMapping(), and setLocalValue().
Referenced by reverse(), setChemEqString(), and setReversibility().
|
inline |
Definition at line 110 of file CReactionInterface.h.
References mChemEqI.
Referenced by CQCompartment::copy(), and ParameterTable::updateTable().
|
inline |
Definition at line 108 of file CReactionInterface.h.
References CChemEqInterface::getChemEqString(), and mChemEqI.
Referenced by ReactionsWidget1::FillWidgetFromRI(), and CQReactionDM::setEquation().
std::set< const CCopasiObject * > CReactionInterface::getDeletedParameters | ( | ) | const |
Retrieve the list of parameters which will be deleted
Definition at line 539 of file CReactionInterface.cpp.
References CKeyFactory::get(), CReaction::getFunction(), CCopasiRootContainer::getKeyFactory(), CCopasiObject::getObjectName(), CCopasiParameterGroup::getParameter(), getParameterName(), CReaction::getParameters(), CFunctionParameter::getUsage(), CFunction::getVariables(), CReaction::isLocalParameter(), mIsLocal, mReactionReferenceKey, CFunctionParameter::PARAMETER, CFunctionParameters::size(), and size().
Referenced by ReactionsWidget1::saveToReaction(), and CQReactionDM::setEquation().
|
private |
returns a list of metabolites (from the chemical equation). Species can occur several times according to theit multiplicity
Definition at line 838 of file CReactionInterface.cpp.
References C_FLOAT64, CChemEqInterface::getListOfDisplayNames(), CChemEqInterface::getListOfMultiplicities(), mChemEqI, and CFunctionParameter::MODIFIER.
Referenced by connectFromScratch().
|
inline |
Definition at line 159 of file CReactionInterface.h.
References mpFunction.
Referenced by ParameterTable::updateTable().
|
inline |
Definition at line 156 of file CReactionInterface.h.
References emptyString, CEvaluationTree::getInfix(), and mpFunction.
Referenced by ReactionsWidget1::FillWidgetFromRI().
|
inline |
Definition at line 153 of file CReactionInterface.h.
References emptyString, CCopasiObject::getObjectName(), and mpFunction.
Referenced by createMetabolites(), ReactionsWidget1::FillWidgetFromRI(), and findAndSetFunction().
const std::vector< std::string > & CReactionInterface::getListOfMetabs | ( | CFunctionParameter::Role | role | ) | const |
This produces a list of metab names (from the chem eq) for use in the combo boxes. The role must be given like a usage, e.g. "SUBSTRATE".
Definition at line 43 of file CReactionInterface.cpp.
References CChemEqInterface::getListOfDisplayNames(), and mChemEqI.
Referenced by ParameterTable::getListOfAllMetabNames(), setMapping(), and ParameterTable::updateTable().
std::vector< std::string > CReactionInterface::getListOfPossibleFunctions | ( | ) | const |
Definition at line 48 of file CReactionInterface.cpp.
References CCopasiRootContainer::getFunctionList(), CChemEqInterface::getMolecularity(), isReversible(), mChemEqI, CFunctionParameter::PRODUCT, CFunctionParameter::SUBSTRATE, CFunctionDB::suitableFunctions(), TriFalse, and TriTrue.
Referenced by ReactionsWidget1::FillWidgetFromRI(), and findAndSetFunction().
|
inline |
Definition at line 213 of file CReactionInterface.h.
References mValues.
Referenced by findAndSetFunction(), and ParameterTable::updateTable().
|
inline |
Definition at line 196 of file CReactionInterface.h.
References isVector(), and mNameMap.
Referenced by updateModifiersInChemEq(), and ParameterTable::updateTable().
|
inline |
Definition at line 193 of file CReactionInterface.h.
References mNameMap.
Referenced by ParameterTable::updateTable().
|
inline |
Definition at line 181 of file CReactionInterface.h.
References emptyString, mpFunction, and mpParameters.
Referenced by copyMapping(), getDeletedParameters(), loadMappingAndValues(), ParameterTable::updateTable(), and writeBackToReaction().
|
inline |
Definition at line 175 of file CReactionInterface.h.
References mpFunction, mpParameters, and CFunctionParameter::VARIABLE.
Referenced by connectNonMetabolites(), copyMapping(), createOtherObjects(), initMapping(), isLocked(), loadMappingAndValues(), setMapping(), ReactionsWidget1::slotTableChanged(), updateModifiersInChemEq(), ParameterTable::updateTable(), and writeBackToReaction().
void CReactionInterface::initFromReaction | ( | const std::string & | key | ) |
associate the function parameter referenced by "index" with the global parameter named pn. Only valid if the role for this function parameter is "PARAMETER". returns success
Definition at line 72 of file CReactionInterface.cpp.
References CKeyFactory::get(), CCopasiRootContainer::getKeyFactory(), and mReactionReferenceKey.
Referenced by CQCompartment::copy(), initFromReaction(), ReactionsWidget1::loadFromReaction(), and CQReactionDM::setEquation().
Definition at line 82 of file CReactionInterface.cpp.
References CReaction::getKey(), CModel::getReactions(), initFromReaction(), mpModel, and mReactionReferenceKey.
Definition at line 91 of file CReactionInterface.cpp.
References CReaction::getChemEq(), CReaction::getFunction(), CCopasiRootContainer::getUndefinedFunction(), CFunction::getVariables(), CChemEqInterface::loadFromChemEq(), loadMappingAndValues(), mChemEqI, mpFunction, mpParameters, pdelete, and setFunctionWithEmptyMapping().
|
private |
initialize mapping (resize vectors and set names to "unknown"). Also initializes mpParameters but doesn't delete the old mpParameters.
Definition at line 586 of file CReactionInterface.cpp.
References getUsage(), CFunction::getVariables(), isVector(), mIsLocal, mNameMap, mpFunction, mpParameters, mValues, CFunctionParameter::PARAMETER, and size().
Referenced by copyMapping(), and setFunctionWithEmptyMapping().
|
inline |
Definition at line 215 of file CReactionInterface.h.
References mIsLocal.
Referenced by connectNonMetabolites(), createOtherObjects(), ReactionsWidget1::slotTableChanged(), and ParameterTable::updateTable().
bool CReactionInterface::isLocked | ( | size_t | index | ) | const |
Is the mapping of this parameter locked? The bahaviour of this method is different for different roles: SUBSTRATE, PRODUCT: according to the chemical equation MODIFIER: always unlocked TIME: always locked VOLUME, PARAMETER: according to the model
The idea is that in the reaction GUI new species can be entered in the chemical equation that are then created automatically. Compartments and global parameters can only be chosen from those existing in the model.
Definition at line 484 of file CReactionInterface.cpp.
References getUsage().
Referenced by ParameterTable::updateTable().
bool CReactionInterface::isLocked | ( | CFunctionParameter::Role | usage | ) | const |
Definition at line 487 of file CReactionInterface.cpp.
References CModel::getCompartments(), CChemEqInterface::getListOfDisplayNames(), CModel::getModelValues(), CFunctionParameters::getNumberOfParametersByUsage(), CFunctionParameters::getParameterByUsage(), isVector(), mChemEqI, CFunctionParameter::MODIFIER, mpModel, mpParameters, CFunctionParameter::PARAMETER, CFunctionParameter::PRODUCT, CCopasiVector< T >::size(), CFunctionParameter::SUBSTRATE, CFunctionParameter::TIME, and CFunctionParameter::VOLUME.
bool CReactionInterface::isMulticompartment | ( | ) | const |
this method tries to find out if the REACTION involves several compartments It only takes into account the metabs that actually exist in the model. A non existing metabolite is assumed not to be in a different compartment
Definition at line 925 of file CReactionInterface.cpp.
References CChemEqInterface::isMulticompartment(), and mChemEqI.
Referenced by CQCompartment::copy(), ReactionsWidget1::FillWidgetFromRI(), and ParameterTable::updateTable().
|
inline |
Definition at line 112 of file CReactionInterface.h.
References CChemEqInterface::getReversibility(), and mChemEqI.
Referenced by ReactionsWidget1::FillWidgetFromRI(), and getListOfPossibleFunctions().
bool CReactionInterface::isValid | ( | ) | const |
Definition at line 930 of file CReactionInterface.cpp.
References mIsLocal, mNameMap, and size().
Referenced by ReactionsWidget1::saveToReaction(), ReactionsWidget1::slotTableChanged(), and writeBackToReaction().
|
inline |
Definition at line 169 of file CReactionInterface.h.
References mpFunction, mpParameters, and CFunctionParameter::VFLOAT64.
Referenced by copyMapping(), getMapping(), initMapping(), isLocked(), loadMappingAndValues(), setMapping(), ParameterTable::updateTable(), and writeBackToReaction().
|
private |
Definition at line 112 of file CReactionInterface.cpp.
References CKeyFactory::get(), CMetabNameInterface::getDisplayName(), CModelEntity::getInitialValue(), CCopasiRootContainer::getKeyFactory(), CCopasiObject::getObjectName(), CCopasiParameterGroup::getParameter(), CReaction::getParameterMappings(), getParameterName(), CReaction::getParameters(), getUsage(), CCopasiParameter::getValue(), CReaction::isLocalParameter(), isVector(), mIsLocal, mNameMap, CFunctionParameter::MODIFIER, mpModel, mValues, CFunctionParameter::PARAMETER, CCopasiParameter::Value::pDOUBLE, CFunctionParameter::PRODUCT, size(), CFunctionParameter::SUBSTRATE, CFunctionParameter::TIME, and CFunctionParameter::VOLUME.
Referenced by initFromReaction().
void CReactionInterface::removeMapping | ( | size_t | index, |
std::string | mn | ||
) |
void CReactionInterface::reverse | ( | bool | rev, |
const std::string & | newFunction | ||
) |
reverse the reaction and set the reversibility. newFunction suggests a new kinetic function which is only used if adequate.
Definition at line 337 of file CReactionInterface.cpp.
References findAndSetFunction(), mChemEqI, CChemEqInterface::reverse(), and CChemEqInterface::setReversibility().
void CReactionInterface::setChemEqString | ( | const std::string & | eq, |
const std::string & | newFunction | ||
) |
set a new chemical equation. newFunction suggests a new kinetic function which is only used if adequate.
Definition at line 325 of file CReactionInterface.cpp.
References findAndSetFunction(), mChemEqI, and CChemEqInterface::setChemEqString().
Referenced by CQReactionDM::setEquation(), and ReactionsWidget1::slotLineEditChanged().
void CReactionInterface::setFunctionAndDoMapping | ( | const std::string & | fn | ) |
set the function. a new mapping is created that tries to preserve as much information as possible from the old mapping. Then a default mapping is set from the chemical equation and the model (if possible).
Definition at line 746 of file CReactionInterface.cpp.
References clearFunction(), connectFromScratch(), connectNonMetabolites(), copyMapping(), fatalError, CFunctionDB::findLoadFunction(), CCopasiRootContainer::getFunctionList(), CFunctionParameter::MODIFIER, mpFunction, CFunctionParameter::PRODUCT, and CFunctionParameter::SUBSTRATE.
Referenced by createMetabolites(), findAndSetFunction(), and ReactionsWidget1::slotComboBoxSelectionChanged().
void CReactionInterface::setFunctionWithEmptyMapping | ( | const std::string & | fn | ) |
set the function. an empty mapping is created
Definition at line 731 of file CReactionInterface.cpp.
References clearFunction(), fatalError, CFunctionDB::findLoadFunction(), CCopasiRootContainer::getFunctionList(), initMapping(), mpFunction, mpParameters, and pdelete.
Referenced by initFromReaction(), ReactionsWidget1::saveToReaction(), CQReactionDM::setEquation(), and ReactionsWidget1::slotBtnDelete().
|
inline |
Definition at line 208 of file CReactionInterface.h.
References mIsLocal.
Referenced by ReactionsWidget1::slotParameterStatusChanged().
Definition at line 202 of file CReactionInterface.h.
References mIsLocal, and mValues.
Referenced by findAndSetFunction(), and ReactionsWidget1::slotTableChanged().
void CReactionInterface::setMapping | ( | size_t | index, |
std::string | mn | ||
) |
Definition at line 779 of file CReactionInterface.cpp.
References CChemEqInterface::getListOfDisplayNames(), getListOfMetabs(), CFunctionParameters::getNumberOfParametersByUsage(), CFunctionParameters::getParameterByUsage(), getUsage(), isVector(), mChemEqI, mIsLocal, mNameMap, CFunctionParameter::MODIFIER, mpParameters, CFunctionParameter::PARAMETER, CFunctionParameter::PRODUCT, CFunctionParameter::SUBSTRATE, CFunctionParameter::TIME, updateModifiersInChemEq(), and CFunctionParameter::VOLUME.
Referenced by ReactionsWidget1::slotParameterStatusChanged(), and ReactionsWidget1::slotTableChanged().
void CReactionInterface::setReversibility | ( | bool | rev, |
const std::string & | newFunction | ||
) |
set the reversibility. newFunction suggests a new kinetic function which is only used if adequate.
Definition at line 331 of file CReactionInterface.cpp.
References findAndSetFunction(), mChemEqI, and CChemEqInterface::setReversibility().
Referenced by ReactionsWidget1::slotCheckBoxClicked().
|
inline |
Definition at line 166 of file CReactionInterface.h.
References mpFunction, mpParameters, and CFunctionParameters::size().
Referenced by connectNonMetabolites(), copyMapping(), createOtherObjects(), getDeletedParameters(), initMapping(), isValid(), loadMappingAndValues(), updateModifiersInChemEq(), ParameterTable::updateTable(), and writeBackToReaction().
|
private |
updates the modifiers in the chemical equation according to the parameter mapping
Definition at line 768 of file CReactionInterface.cpp.
References CChemEqInterface::addModifier(), CChemEqInterface::clearModifiers(), getMapping(), getUsage(), mChemEqI, CFunctionParameter::MODIFIER, and size().
Referenced by setMapping().
bool CReactionInterface::writeBackToReaction | ( | CReaction * | rea | ) |
writes the information back to a CReaction. createMetabolites() and createOtherObjects() should be called before.
Definition at line 226 of file CReactionInterface.cpp.
References CReaction::addParameterMapping(), CReaction::clearParameterMapping(), CReaction::compile(), CKeyFactory::get(), CReaction::getChemEq(), CModel::getCompartments(), CModel::getKey(), CCopasiObject::getKey(), CCopasiRootContainer::getKeyFactory(), CMetabNameInterface::getMetaboliteKey(), CModel::getModelValues(), CCopasiObject::getObjectName(), getParameterName(), getUsage(), CFunction::getVariables(), isValid(), isVector(), mChemEqI, mIsLocal, mNameMap, CFunctionParameter::MODIFIER, mpFunction, mpModel, mpParameters, mReactionReferenceKey, mValues, CFunctionParameter::PARAMETER, CFunctionParameter::PRODUCT, CModel::setCompileFlag(), CReaction::setFunction(), CReaction::setParameterMapping(), CReaction::setParameterValue(), size(), CMetabNameInterface::splitDisplayName(), CFunctionParameter::SUBSTRATE, CFunctionParameter::TIME, CFunctionParameter::VOLUME, and CChemEqInterface::writeToChemEq().
Referenced by ReactionsWidget1::saveToReaction(), and CQReactionDM::setEquation().
|
private |
Definition at line 57 of file CReactionInterface.h.
Referenced by CReactionInterface(), getFunctionDescription(), getFunctionName(), and getParameterName().
|
private |
A copy of the chemical equation of the reaction
Definition at line 67 of file CReactionInterface.h.
Referenced by connectNonMetabolites(), createMetabolites(), findAndSetFunction(), getChemEqInterface(), getChemEqString(), getExpandedMetabList(), getListOfMetabs(), getListOfPossibleFunctions(), initFromReaction(), isLocked(), isMulticompartment(), isReversible(), reverse(), setChemEqString(), setMapping(), setReversibility(), updateModifiersInChemEq(), and writeBackToReaction().
|
private |
values of the kinetic parameters
Definition at line 92 of file CReactionInterface.h.
Referenced by copyMapping(), getDeletedParameters(), initMapping(), isLocalValue(), isValid(), loadMappingAndValues(), setLocal(), setLocalValue(), setMapping(), and writeBackToReaction().
|
private |
what metabolite for what function parameter
Definition at line 82 of file CReactionInterface.h.
Referenced by clearFunction(), connectFromScratch(), connectNonMetabolites(), copyMapping(), createOtherObjects(), getMapping(), getMappings(), initMapping(), isValid(), loadMappingAndValues(), setMapping(), and writeBackToReaction().
|
private |
A pointer to the kinetic function of the reaction
Definition at line 72 of file CReactionInterface.h.
Referenced by clearFunction(), getFunction(), getFunctionDescription(), getFunctionName(), getParameterName(), getUsage(), initFromReaction(), initMapping(), isVector(), setFunctionAndDoMapping(), setFunctionWithEmptyMapping(), size(), and writeBackToReaction().
|
private |
Definition at line 55 of file CReactionInterface.h.
Referenced by connectNonMetabolites(), CReactionInterface(), createOtherObjects(), initFromReaction(), isLocked(), loadMappingAndValues(), and writeBackToReaction().
|
private |
A copy of the function parameters
Definition at line 77 of file CReactionInterface.h.
Referenced by clearFunction(), connectFromScratch(), copyMapping(), getParameterName(), getUsage(), initFromReaction(), initMapping(), isLocked(), isVector(), setFunctionWithEmptyMapping(), setMapping(), size(), writeBackToReaction(), and ~CReactionInterface().
|
private |
This is the key that identifies the Reaction that is beeing edited
Definition at line 62 of file CReactionInterface.h.
Referenced by getDeletedParameters(), initFromReaction(), and writeBackToReaction().
|
private |
values of the kinetic parameters
Definition at line 87 of file CReactionInterface.h.
Referenced by clearFunction(), copyMapping(), getLocalValue(), initMapping(), loadMappingAndValues(), setLocalValue(), and writeBackToReaction().