COPASI API  4.40.278
SBMLImporter Class Reference

#include <SBMLImporter.h>

Inheritance diagram for SBMLImporter:
[legend]

Public Member Functions

void applyConversionFactors ()
 
virtual void clearCallBack ()
 
void deleteCopasiModel ()
 
std::string findIdInASTTree (const ASTNode *pMath, const std::map< std::string, double > &reactionIds)
 
std::string findIdInASTTree (const ASTNode *pMath, const std::set< std::string > &reactionIds)
 
bool getImportCOPASIMIRIAM () const
 
const CProcessReportgetProcessReport () const
 
CModelparseSBML (const std::string &sbmlDocumentText, SBMLDocument *&pSBMLDocument, std::map< const CDataObject *, SBase * > &copasi2sbmlmap, CListOfLayouts *&prLol, CDataModel *pDataModel)
 
CModelreadSBML (std::string filename, SBMLDocument *&pSBMLDocument, std::map< const CDataObject *, SBase * > &copasi2sbmlmap, CListOfLayouts *&prLol, CDataModel *pDataModel)
 
void restoreFunctionDB ()
 
 SBMLImporter ()
 
void setImportCOPASIMIRIAM (bool import)
 
void setImportHandler (CProcessReport *pProcessReport)
 
 ~SBMLImporter ()
 
- Public Member Functions inherited from SBMLUnitSupport
void checkElementUnits (const Model *pSBMLModel, CModel *pCopasiModel)
 
bool createUnitExpressionFor (SUnitInfo &unitInfo) const
 
const SUnitInfoimportUnit (const std::string unitId, const Model *pSBMLModel)
 
const SUnitInfoimportUnit (const UnitDefinition *pUnitDefinition, const bool &allocated)
 
void importUnitsFromSBMLDocument (Model *sbmlModel, CModel *pCopasiModel)
 imports the units from the given sbml model More...
 
void setLevelAndVersion (int level, int version)
 
bool validateUnit (SUnitInfo &unitInfo, const std::string &constraint) const
 
 ~SBMLUnitSupport ()
 

Static Public Member Functions

static bool areApproximatelyEqual (const double &x, const double &y, const double &t=1e-9)
 
static bool areEqualFunctions (const CFunction *pFun, const CFunction *pFun2)
 
static bool areEqualSubtrees (const CEvaluationNode *pNode1, const CEvaluationNode *pNode2)
 
static bool checkForUnitsOnNumbers (const ASTNode *pNode)
 
static CEvaluationNodedivideByObject (const CEvaluationNode *pOrigNode, const CDataObject *pObject)
 
static bool importNotes (CAnnotation *pAnno, const SBase *pSBase)
 
static bool isEmptyOrWhiteSpace (const std::string &name)
 
static void updateSBMLSpeciesReferenceIds (Model *pModel, std::map< std::string, double > &ids)
 
- Static Public Member Functions inherited from SBMLUnitSupport
static bool areSBMLUnitDefinitionsIdentical (const SUnitInfo &unitInfo1, const SUnitInfo &unitInfo2)
 
static void checkForSpatialSizeUnits (const CDataModel &dataModel, std::vector< SBMLIncompatibility > &result)
 
static std::string unitKindToString (UnitKind_t kind)
 

Protected Member Functions

void applyStoichiometricExpressions (std::map< const CDataObject *, SBase * > &copasi2sbmlmap, Model *pSBMLModel)
 
void areRulesUnique (const Model *copasiMode)
 
void checkRuleMathConsistency (const Rule *pRule, std::map< const CDataObject *, SBase * > &copasi2sbmlmap)
 
bool checkValidityOfSourceDocument (SBMLDocument *sbmlDoc)
 
bool containsVolume (const ASTNode *pNode, const std::string &compartmentCN)
 
std::map< std::string, ASTNode * > createBVarMap (const ASTNode *uDefFunction, const ASTNode *function)
 
CCompartmentcreateCCompartmentFromCompartment (const Compartment *sbmlComp, CModel *copasiModel, std::map< const CDataObject *, SBase * > &copasi2sbmlmap, const Model *pSBMLModel)
 
CFunctioncreateCFunctionFromFunctionDefinition (const FunctionDefinition *sbmlFunction, Model *pSBMLModel, std::map< const CDataObject *, SBase * > &copasi2sbmlmap)
 
CFunctioncreateCFunctionFromFunctionTree (const FunctionDefinition *pSBMLFunction, Model *pSBMLModel, std::map< const CDataObject *, SBase * > &copasi2sbmlmap)
 
CMetabcreateCMetabFromSpecies (const Species *sbmlSpecies, CModel *copasiModel, CCompartment *copasiCompartment, std::map< const CDataObject *, SBase * > &copasi2sbmlmap, const Model *pSBMLModel)
 
CModelcreateCModelFromSBMLDocument (SBMLDocument *doc, std::map< const CDataObject *, SBase * > &copasi2sbmlmap)
 
CModelValuecreateCModelValueFromParameter (const Parameter *sbmlParameter, CModel *copasiModel, std::map< const CDataObject *, SBase * > &copasi2sbmlmap)
 
CReactioncreateCReactionFromReaction (Reaction *sbmlReaction, Model *sbmlModel, CModel *cmodel, std::map< const CDataObject *, SBase * > &copasi2sbmlmap)
 
void createDelayFunctionDefinition ()
 
CEvaluationTreecreateExpressionFromFunction (const CFunction *pFun, const std::vector< std::vector< std::string > > &functionArgumentCNs)
 
void createHasOnlySubstanceUnitFactor (Model *pSBMLModel, double factor, std::map< const CDataObject *, SBase * > &copasi2sbmlmap)
 
bool createProgressStepOrStop (unsigned C_INT32 globalStep, unsigned C_INT32 currentTotal, const std::string &title)
 
bool divideByVolume (ASTNode *node, const std::string &compartmentSBMLId)
 
void doMapping (CReaction *pCopasiReaction, const CEvaluationNodeCall *pCallNode)
 
void find_local_parameters_in_delay (ASTNode *pNode, Reaction *pSBMLReaction, Model *pModel, std::map< std::string, std::string > &localReplacementMap, const std::set< std::string > &localIds, std::map< const CDataObject *, SBase * > &copasi2sbmlmap)
 
void findAvogadroConstant (Model *pSBMLModel, double factor)
 
CFunctionfindCorrespondingFunction (const CExpression *pExpression, const CReaction *reaction)
 
void findFunctionCalls (const CEvaluationNode *pNode, std::set< std::string > &functionNameSet)
 
void finishCurrentStep ()
 
void finishImport ()
 
const FunctionDefinition * getFunctionDefinitionForName (const std::string &name, const Model *model)
 
void getIdsFromNode (const ASTNode *pNode, std::set< std::string > &idSet)
 
void importEvent (const Event *pEvent, Model *pSBMLModel, CModel *pCopasiModel, std::map< const CDataObject *, SBase * > &copasi2sbmlmap)
 
void importEvents (Model *pSBMLModel, CModel *pCopasiModel, std::map< const CDataObject *, SBase * > &copasi2sbmlmap)
 
void importFunctionDefinitions (Model *pSBMLModel, std::map< const CDataObject *, SBase * > &copasi2sbmlmap)
 
void importInitialAssignments (Model *pSBMLModel, std::map< const CDataObject *, SBase * > &copasi2sbmlMap, const CModel *pCOPASIModel)
 
bool importMIRIAM (const SBase *pSBMLObject, CDataObject *pCOPASIObject)
 
void importRule (const Rule *rule, CModelEntity::Status ruleType, std::map< const CDataObject *, SBase * > &copasi2sbmlmap, Model *pSBMLModel)
 
void importRuleForModelEntity (const Rule *rule, const CModelEntity *pMV, CModelEntity::Status ruleType, std::map< const CDataObject *, SBase * > &copasi2sbmlmap, Model *pSBMLModel)
 
void importSBMLRule (const Rule *sbmlRule, std::map< const CDataObject *, SBase * > &copasi2sbmlmap, Model *pSBMLModel)
 
const CDataObjectisConstantFlux (const CEvaluationNode *pRoot, CModel *pModel)
 
bool isDelayFunctionUsed (ConverterASTNode *pNode)
 
std::vector< CEvaluationNodeObject * > * isMassAction (const CEvaluationTree *pTree, const CChemEq &chemicalEquation, const CEvaluationNodeCall *pCallNode=NULL)
 
std::vector< CEvaluationNodeObject * > * isMassActionExpression (const CEvaluationNode *pRootNode, const CChemEq &chemicalEquation)
 
std::vector< CEvaluationNodeObject * > * isMassActionFunction (const CFunction *pFun, const CChemEq &chemicalEquation, const std::vector< std::vector< std::string > > &functionArgumentCNs)
 
bool isSimpleFunctionCall (const CEvaluationNode *pRootNode)
 
bool isStochasticModel (const Model *pSBMLModel)
 
void multiplySubstanceOnlySpeciesByVolume (ConverterASTNode *pNode)
 
void preprocessNode (ConverterASTNode *pNode, Model *pSBMLModel, std::map< const CDataObject *, SBase * > &copasi2sbmlmap, Reaction *pSBMLReaction=NULL)
 
bool removeUnusedFunctions (std::map< const CDataObject *, SBase * > &copasi2sbmlmap)
 
void renameMassActionParameters (CEvaluationNodeCall *pCallNode)
 
void replace_delay_nodes (ConverterASTNode *pNode, Model *pModel, std::map< const CDataObject *, SBase * > &copasi2sbmlmap, Reaction *pSBMLReaction, std::map< std::string, std::string > &localReplacementMap)
 
void replace_name_nodes (ASTNode *pNode, const std::map< std::string, std::string > &replacementMap)
 
void replace_time_with_initial_time (ASTNode *pNode, const CModel *pCOPASIModel)
 
void replaceAmountReferences (ConverterASTNode *pNode, Model *pSBMLModel, double factor, std::map< const CDataObject *, SBase * > &copasi2sbmlmap)
 
void replaceCallNodeNames (ASTNode *pNode)
 
void replaceLog (ConverterASTNode *sourceNode)
 
void replaceObjectNames (ASTNode *pNode, const std::map< const CDataObject *, SBase * > &copasi2sbmlmap, bool initialExpression=false)
 
void replacePowerFunctionNodes (ASTNode *node)
 
void replaceRoot (ConverterASTNode *sourceNode)
 
void replaceTimeAndAvogadroNodeNames (ASTNode *pNode)
 
void replaceTimeDependentFunctionCalls (ASTNode *root)
 
bool replaceTimeNodesInFunctionDefinition (ASTNode *root, std::string newNodeName)
 
bool reportCurrentProgressOrStop ()
 
bool sbmlId2CopasiCN (ASTNode *pNode, std::map< const CDataObject *, SBase * > &copasi2sbmlmap, CCopasiParameterGroup &pParamGroup, SBase *pParentObject=NULL)
 
void separateProductArguments (const CEvaluationNode *pRootNode, std::vector< const CEvaluationNode * > &arguments)
 
void setCorrectUsage (CReaction *pCopasiReaction, const CEvaluationNodeCall *pCallNode)
 
bool setInitialValues (CModel *pModel, const std::map< const CDataObject *, SBase * > &copasi2sbmlmap)
 
CEvaluationNodevariables2objects (const CEvaluationNode *pOrigNode, const std::map< std::string, std::string > &replacementMap)
 

Static Protected Member Functions

static void findDirectDependencies (const ASTNode *pNode, std::set< std::string > &dependencies)
 
static void findDirectDependencies (const FunctionDefinition *pFunDef, std::map< const FunctionDefinition *, std::set< std::string > > &dependencies)
 
static C_FLOAT64 round (const C_FLOAT64 &x)
 

Protected Attributes

bool mAssignmentToSpeciesReferenceFound
 
bool mAvogadroCreated
 
std::set< const CDataObject * > mChangedObjects
 
std::map< const CChemEqElement *, std::pair< std::string, CChemEq::MetaboliteRole > > mChemEqElementSpeciesIdMap
 
std::map< std::string, CCompartment * > mCompartmentMap
 
bool mConversionFactorFound
 
std::set< std::string > mCreatedFunctions
 
unsigned C_INT32 mCurrentStepCounter
 
size_t mCurrentStepHandle
 
unsigned C_INT32 mCurrentStepTotal
 
bool mDelayFound
 
std::map< std::string, std::string > mDelayNodeMap
 
std::set< std::string > mDivisionByCompartmentReactions
 
bool mEventAssignmentForSpeciesReferenceIgnored
 
std::set< std::string > mExplicitelyTimeDependentFunctionDefinitions
 
std::set< std::string > mFastReactions
 
std::map< std::string, std::string > mFunctionNameMapping
 
unsigned C_INT32 mGlobalStepCounter
 
size_t mGlobalStepHandle
 
unsigned C_INT32 mGlobalStepTotal
 
std::vector< std::string > mIgnoredParameterUnits
 
std::set< unsigned int > mIgnoredSBMLMessages
 
bool mImportCOPASIMIRIAM
 
bool mIncompleteModel
 
std::map< std::string, std::string > mKnownCustomUserDefinedFunctions
 
std::map< std::string, std::string > mKnownInitalValues
 
unsigned int mOriginalLevel
 
std::map< std::string, CModelValue * > mParameterFluxMap
 
CModelmpCopasiModel
 
CDataModelmpDataModel
 
const CModelValuempModelConversionFactor
 
std::set< const Parameter * > mPotentialAvogadroNumbers
 
CProcessReportmpProcessReport
 
SbmlProgressCallbackmpSbmlCallback
 
bool mRateRuleForSpeciesReferenceIgnored
 
std::set< std::string > mReactions
 
std::set< std::string > mReactionsWithReplacedLocalParameters
 
std::map< std::string, const CModelValue * > mSBMLIdModelValueMap
 
std::map< std::string, double > mSBMLSpeciesReferenceIds
 
std::map< std::string, const CModelValue * > mSpeciesConversionParameterMap
 
std::map< const ASTNode *, const CChemEqElement * > mStoichiometricExpressionMap
 
std::map< Species *, Compartment * > mSubstanceOnlySpecies
 
bool mUnitOnNumberFound
 
bool mUnsupportedAssignmentRuleFound
 
bool mUnsupportedRateRuleFound
 
bool mUnsupportedRuleFound
 
std::set< std::string > mUsedSBMLIds
 
bool mUsedSBMLIdsPopulated
 
std::map< CFunction *, std::string > sbmlIdMap
 
std::map< std::string, CMetab * > speciesMap
 
- Protected Attributes inherited from SBMLUnitSupport
bool mAvogadroSet = false
 
unsigned int mLevel = 0
 
unsigned int mVersion = 0
 

Additional Inherited Members

- Public Types inherited from SBMLUnitSupport
enum class  UnitType {
  dimensionless , substance , time , volume ,
  area , length , other , __SIZE
}
 

Constructor & Destructor Documentation

◆ SBMLImporter()

◆ ~SBMLImporter()

SBMLImporter::~SBMLImporter ( )

Destructor that does nothing.

References mpSbmlCallback, and pdelete.

Member Function Documentation

◆ applyConversionFactors()

void SBMLImporter::applyConversionFactors ( )

This method checks if there are conversion factors that need to be applied to ChemicalEquationElements and applies them.

References CCopasiMessage::EXCEPTION, CModelEntity::getInitialValue(), mChemEqElementSpeciesIdMap, mpModelConversionFactor, mSpeciesConversionParameterMap, and CChemEq::setMultiplicity().

Referenced by createCModelFromSBMLDocument().

◆ applyStoichiometricExpressions()

◆ areApproximatelyEqual()

bool SBMLImporter::areApproximatelyEqual ( const double &  x,
const double &  y,
const double &  t = 1e-9 
)
static

◆ areEqualFunctions()

◆ areEqualSubtrees()

bool SBMLImporter::areEqualSubtrees ( const CEvaluationNode pNode1,
const CEvaluationNode pNode2 
)
static

◆ areRulesUnique()

void SBMLImporter::areRulesUnique ( const Model *  copasiMode)
protected

Checks if no id is used in more than one Assignment and RateRule.

References CCopasiMessage::EXCEPTION, and MCSBML.

Referenced by createCModelFromSBMLDocument().

◆ checkForUnitsOnNumbers()

bool SBMLImporter::checkForUnitsOnNumbers ( const ASTNode *  pASTNode)
static

This method check if a unit has been set on a number node. If such a node is found in the tree, true is returned.

References CNodeContextIterator< Node, Context >::end(), and CNodeContextIterator< Node, Context >::next().

Referenced by preprocessNode().

◆ checkRuleMathConsistency()

void SBMLImporter::checkRuleMathConsistency ( const Rule *  pRule,
std::map< const CDataObject *, SBase * > &  copasi2sbmlmap 
)
protected

Checks the expression for a give rate or assignment rule for consistency. This basically means it checks that no id present in the expression is the target for one of the following rate or assignment rules.

References CCopasiMessage::EXCEPTION, fatalError, findIdInASTTree(), getIdsFromNode(), MCSBML, SBMLUnitSupport::mLevel, mpCopasiModel, mReactions, and SBMLUnitSupport::mVersion.

Referenced by importRuleForModelEntity().

◆ checkValidityOfSourceDocument()

bool SBMLImporter::checkValidityOfSourceDocument ( SBMLDocument *  sbmlDoc)
protected

checks the given document, and if not valid stops

Parameters
sbmlDocthe document to be checked
Returns
true if serious errors were encountered and importing stopped

References CCopasiMessage::ERROR, CCopasiMessage::ERROR_FILTERED, CCopasiMessage::EXCEPTION, finishCurrentStep(), finishImport(), CRootContainer::getConfiguration(), CDataModel::getReferenceDirectory(), MCSBML, MCXML, mIgnoredSBMLMessages, mpDataModel, CCopasiMessage::RAW, CCopasiMessage::WARNING, and CCopasiMessage::WARNING_FILTERED.

Referenced by parseSBML().

◆ clearCallBack()

void SBMLImporter::clearCallBack ( )
virtual

clears the currently set progress handler

References setImportHandler().

◆ containsVolume()

bool SBMLImporter::containsVolume ( const ASTNode *  pNode,
const std::string &  compartmentCN 
)
protected

Checks if the volume with the given CN is one of the parameters to the given call node.

◆ createBVarMap()

std::map< std::string, ASTNode * > SBMLImporter::createBVarMap ( const ASTNode *  uDefFunction,
const ASTNode *  function 
)
protected

Creates a map of each parameter of the function definition and its corresponding parameter in the function call.

References fatalError.

◆ createCCompartmentFromCompartment()

CCompartment * SBMLImporter::createCCompartmentFromCompartment ( const Compartment *  sbmlCompartment,
CModel copasiModel,
std::map< const CDataObject *, SBase * > &  copasi2sbmlmap,
const Model *  pSBMLModel 
)
protected

◆ createCFunctionFromFunctionDefinition()

◆ createCFunctionFromFunctionTree()

◆ createCMetabFromSpecies()

CMetab * SBMLImporter::createCMetabFromSpecies ( const Species *  sbmlSpecies,
CModel copasiModel,
CCompartment copasiCompartment,
std::map< const CDataObject *, SBase * > &  copasi2sbmlmap,
const Model *  pSBMLModel 
)
protected

◆ createCModelFromSBMLDocument()

CModel * SBMLImporter::createCModelFromSBMLDocument ( SBMLDocument *  doc,
std::map< const CDataObject *, SBase * > &  copasi2sbmlmap 
)
protected

Creates and returns a COPASI CModel from the SBMLDocument given as argument.

References CModel::appendAllDependents(), applyConversionFactors(), applyStoichiometricExpressions(), areRulesUnique(), CDataVector< CType >::begin(), C_INT32, C_INVALID_INDEX, CModel::compileIfNecessary(), CCore::Concentration, createCCompartmentFromCompartment(), createCMetabFromSpecies(), createCModelValueFromParameter(), createCReactionFromReaction(), createProgressStepOrStop(), CModel::deterministic, CDataVector< CType >::end(), CCopasiMessage::ERROR, CCopasiMessage::EXCEPTION, fatalError, findAvogadroConstant(), CDataObject::getCN(), CReaction::getFluxReference(), CRootContainer::getFunctionList(), getInitialCNForSBase(), CModelEntity::getModel(), CModel::getModelValues(), CDataContainer::getObject(), getOriginalSBMLId(), CModel::getQuantity2NumberFactor(), CModel::getReactions(), CFunction::getSBMLId(), CReaction::getSBMLId(), CCopasiMessage::getText(), importEvents(), importFunctionDefinitions(), importInitialAssignments(), importMIRIAM(), importNotes(), importSBMLRule(), SBMLUnitSupport::importUnitsFromSBMLDocument(), isEmptyOrWhiteSpace(), isStochasticModel(), CFunctionDB::loadedFunctions(), mAvogadroCreated, mCompartmentMap, mConversionFactorFound, MCSBML, mCurrentStepCounter, mCurrentStepHandle, mCurrentStepTotal, mDelayFound, mDivisionByCompartmentReactions, mEventAssignmentForSpeciesReferenceIgnored, mFastReactions, mIgnoredParameterUnits, mKnownInitalValues, SBMLUnitSupport::mLevel, mParameterFluxMap, mpCopasiModel, mpDataModel, mpModelConversionFactor, mPotentialAvogadroNumbers, mpProcessReport, mRateRuleForSpeciesReferenceIgnored, mReactions, mReactionsWithReplacedLocalParameters, mSBMLIdModelValueMap, mSBMLSpeciesReferenceIds, mSpeciesConversionParameterMap, mSubstanceOnlySpecies, mUnitOnNumberFound, mUnsupportedRuleFound, CCopasiMessage::peekLastMessage(), CModel::removeModelValue(), removeUnusedFunctions(), reportCurrentProgressOrStop(), sbmlIdMap, CModel::setAreaUnit(), setInitialValues(), CModel::setLengthUnit(), CModel::setModelType(), CDataObject::setObjectName(), CModel::setQuantityUnit(), CFunction::setSBMLId(), CModelEntity::setSBMLId(), CModel::setTimeUnit(), CModel::setVolumeUnit(), CDataVector< CType >::size(), speciesMap, CModel::stochastic, updateSBMLSpeciesReferenceIds(), and CCopasiMessage::WARNING.

Referenced by parseSBML().

◆ createCModelValueFromParameter()

◆ createCReactionFromReaction()

CReaction * SBMLImporter::createCReactionFromReaction ( Reaction *  sbmlReaction,
Model *  pSBMLModel,
CModel copasiModel,
std::map< const CDataObject *, SBase * > &  copasi2sbmlmap 
)
protected

Creates and returns a COPASI CReaction object from the given SBML Reaction object.

References CEvaluationNodeCall::addChild(), CReaction::addModifier(), CCopasiParameterGroup::addParameter(), CReaction::addProduct(), CReaction::addSubstrate(), CModelEntity::ASSIGNMENT, CDataVector< CType >::begin(), C_FLOAT64, C_INVALID_INDEX, CEvaluationNode::copyBranch(), CModel::createModelValue(), CModel::createReaction(), divideByVolume(), doMapping(), CCopasiParameter::DOUBLE, CDataVector< CType >::end(), CCopasiMessage::EXCEPTION, CEvaluationNode::EXPRESSION, fatalError, findCorrespondingFunction(), CFunctionDB::findFunction(), findIdInASTTree(), CEvaluationTree::fromAST(), CReaction::getChemEq(), CCopasiNode< _Data >::getChild(), CDataObject::getCN(), CCopasiNode< _Data >::getData(), CCompartment::getDimensionality(), CRootContainer::getFunctionList(), CDataVectorN< CType >::getIndex(), CDataObject::getKey(), CChemEq::getModifiers(), CDataObject::getObjectName(), CDataObject::getObjectType(), CReaction::getParameters(), CChemEq::getProducts(), CModel::getReactions(), CEvaluationTree::getRoot(), CModelEntity::getSBMLId(), CCopasiNode< _Data >::getSibling(), CChemEq::getSubstrates(), CEvaluationTree::getType(), CFunction::getVariables(), importMIRIAM(), importNotes(), isConstantFlux(), isEmptyOrWhiteSpace(), isMassAction(), CReaction::isReversible(), isSimpleFunctionCall(), CFunction::isSuitable(), CFunctionDB::loadedFunctions(), CEvaluationNode::mainType(), mChemEqElementSpeciesIdMap, mCreatedFunctions, MCSBML, mDivisionByCompartmentReactions, mFastReactions, mIncompleteModel, SBMLUnitSupport::mLevel, mParameterFluxMap, mpCopasiModel, mpModelConversionFactor, mReactions, mSBMLSpeciesReferenceIds, mSpeciesConversionParameterMap, mStoichiometricExpressionMap, CEvaluationNode::OBJECT, pdelete, preprocessNode(), CChemEq::PRODUCT, renameMassActionParameters(), renameShadowingFluxReferences(), replace_name_nodes(), sbmlId2CopasiCN(), CReaction::setFunction(), CReaction::setFunctionFromExpressionTree(), CModelEntity::setInitialExpression(), CDataObject::setObjectName(), CReaction::setReversible(), CFunction::setReversible(), CEvaluationTree::setRoot(), CModelEntity::setSBMLId(), CReaction::setSBMLId(), CModelEntity::setStatus(), CDataVector< CType >::size(), CFunctionParameters::size(), speciesMap, CChemEq::SUBSTRATE, TriFalse, TriTrue, TriUnspecified, CEvaluationTree::UserDefined, variables2objects(), and CCopasiMessage::WARNING.

Referenced by createCModelFromSBMLDocument().

◆ createDelayFunctionDefinition()

void SBMLImporter::createDelayFunctionDefinition ( )
protected

Creates a function definition for the delay function.

◆ createExpressionFromFunction()

CEvaluationTree * SBMLImporter::createExpressionFromFunction ( const CFunction pFun,
const std::vector< std::vector< std::string > > &  functionArgumentCNs 
)
protected

◆ createHasOnlySubstanceUnitFactor()

void SBMLImporter::createHasOnlySubstanceUnitFactor ( Model *  pSBMLModel,
double  factor,
std::map< const CDataObject *, SBase * > &  copasi2sbmlmap 
)
protected

This method creates a global parameter the represents the factor that is used to convert a particle number into the amount units set on the model. The parameter is only created if it is needed and after exporting the model, the parameter is deleted from the COPASI model again.

References createCModelValueFromParameter(), mAvogadroCreated, mpCopasiModel, mPotentialAvogadroNumbers, and CModelEntity::setInitialValue().

Referenced by replaceAmountReferences().

◆ createProgressStepOrStop()

bool SBMLImporter::createProgressStepOrStop ( unsigned C_INT32  globalStep,
unsigned C_INT32  currentTotal,
const std::string &  title 
)
protected

This utility functions adds a new step to the progress dialog (if present)

Parameters
globalStepthe global steps that have been completed
currentTotalthe total for current task
titlethe title of the current task
Returns
a boolean indicating whether processing should be stopped

References CProcessReport::addItem(), C_INVALID_INDEX, CProcessReport::finishItem(), mCurrentStepCounter, mCurrentStepHandle, mCurrentStepTotal, mGlobalStepCounter, mGlobalStepHandle, mpProcessReport, and CProcessReport::progressItem().

Referenced by createCModelFromSBMLDocument(), parseSBML(), and removeUnusedFunctions().

◆ deleteCopasiModel()

void SBMLImporter::deleteCopasiModel ( )

This call deletes an existing COPASI model. The method can e.g. be called to clean up if an import fails.

References mpCopasiModel.

Referenced by SEDMLImporter::importModel(), CDataModel::importSBML(), and CDataModel::importSBMLFromString().

◆ divideByObject()

CEvaluationNode * SBMLImporter::divideByObject ( const CEvaluationNode pOrigNode,
const CDataObject pObject 
)
static

◆ divideByVolume()

bool SBMLImporter::divideByVolume ( ASTNode *  node,
const std::string &  compartmentSBMLId 
)
protected

Checks if a compartment size node occurs multiplicatively in the tree. If so, it is removed from the tree. If it returns false, the tree was not changed

Referenced by createCReactionFromReaction().

◆ doMapping()

◆ find_local_parameters_in_delay()

void SBMLImporter::find_local_parameters_in_delay ( ASTNode *  pASTNode,
Reaction *  pSBMLReaction,
Model *  pModel,
std::map< std::string, std::string > &  localReplacementMap,
const std::set< std::string > &  localIds,
std::map< const CDataObject *, SBase * > &  copasi2sbmlmap 
)
protected

If we replace delay nodes within kineitc laws, we have to make sure that there is no reference to a local parameter within the replaced delay node because that would mean that we end up with a reference to a local parameter in the rule for the delay replacement which is not allowed in SBML. Therefore we have to convert all local parameters which occur within a delay call into global parameters. This method finds all local parameters that have to be converted to global parameters and it already creates the necessary global parameters. The localReplacementMap returns a mapping between the is of the original parameter and the id of the new parameter it will be replaced with. This map is used in a second step to actually replace the nodes in the expression.

If we replace delay nodes within kinetic laws, we have to make sure that there is no reference to a local parameter within the replaced delay node because that would mean that we end up with a reference to a local parameter in the rule for the delay replacement which is not allowed in SBML. Therefore we have to convert all local parameters which occur within a delay call into global parameters.

References createCModelValueFromParameter(), CNodeContextIterator< Node, Context >::end(), CCopasiMessage::EXCEPTION, fatalError, mpCopasiModel, mUsedSBMLIds, and CNodeContextIterator< Node, Context >::next().

Referenced by replace_delay_nodes().

◆ findAvogadroConstant()

void SBMLImporter::findAvogadroConstant ( Model *  pSBMLModel,
double  factor 
)
protected

This method goes through the list of global parameters and tries to find a parameter that could correspond to avogadros number.

References areApproximatelyEqual(), and mPotentialAvogadroNumbers.

Referenced by createCModelFromSBMLDocument().

◆ findCorrespondingFunction()

CFunction * SBMLImporter::findCorrespondingFunction ( const CExpression pExpression,
const CReaction pCopasiReaction 
)
protected

The methods gets a function where all the parameters have a usage of "PARAMETER". In addition it get the root node of a call to that function which is an expression and contains the actual objects with which the function is called in a certain reaction. From this expression we can determine if there already is a function in the database that does the same. Or we can find out if this function is a Mass Action kinetic.

References areEqualFunctions(), C_INVALID_INDEX, CFunctionDB::findFunction(), CReaction::getChemEq(), CCopasiNode< _Data >::getData(), CRootContainer::getFunctionList(), CDataObject::getObjectName(), CReaction::getParameterIndex(), CChemEq::getProducts(), CEvaluationTree::getRoot(), CChemEq::getSubstrates(), CFunction::getVariables(), CReaction::isReversible(), CDataVector< CType >::size(), CEvaluationTree::size(), CFunctionParameters::size(), TriFalse, and TriTrue.

Referenced by createCReactionFromReaction().

◆ findDirectDependencies() [1/2]

void SBMLImporter::findDirectDependencies ( const ASTNode *  pNode,
std::set< std::string > &  dependencies 
)
staticprotected

static method that recursively finds all direct function dependencies of the expression rooted at the given node.

References findDirectDependencies().

◆ findDirectDependencies() [2/2]

void SBMLImporter::findDirectDependencies ( const FunctionDefinition *  pFunDef,
std::map< const FunctionDefinition *, std::set< std::string > > &  dependencies 
)
staticprotected

static method that finds all direct function dependencies of a given function definition.

Referenced by findDirectDependencies(), and importFunctionDefinitions().

◆ findFunctionCalls()

void SBMLImporter::findFunctionCalls ( const CEvaluationNode pNode,
std::set< std::string > &  functionNameSet 
)
protected

◆ findIdInASTTree() [1/2]

std::string SBMLImporter::findIdInASTTree ( const ASTNode *  pASTNode,
const std::map< std::string, double > &  reactionIds 
)

This method takes an AST node and a set of ids and returns the first id from the set it finds in the AST tree. This is e.g. used to check if expression in L2V1 contain references to reaction ids.

References CNodeContextIterator< Node, Context >::end(), and CNodeContextIterator< Node, Context >::next().

◆ findIdInASTTree() [2/2]

std::string SBMLImporter::findIdInASTTree ( const ASTNode *  pMath,
const std::set< std::string > &  reactionIds 
)

This method takes an AST node and a set of ids and returns the first id from the set it finds in the AST tree. This is e.g. used to check if expression in L2V1 contain references to reaction ids.

References CNodeContextIterator< Node, Context >::end(), and CNodeContextIterator< Node, Context >::next().

Referenced by checkRuleMathConsistency(), createCReactionFromReaction(), importEvent(), and importRuleForModelEntity().

◆ finishCurrentStep()

void SBMLImporter::finishCurrentStep ( )
protected

◆ finishImport()

void SBMLImporter::finishImport ( )
protected

Notifies the progress dialog that all importing is complete

References finishCurrentStep(), CProcessReport::finishItem(), mGlobalStepHandle, and mpProcessReport.

Referenced by checkValidityOfSourceDocument(), and parseSBML().

◆ getFunctionDefinitionForName()

const FunctionDefinition * SBMLImporter::getFunctionDefinitionForName ( const std::string &  name,
const Model *  sbmlModel 
)
protected

Returns the user defined SBML function definition that belongs to the given name, or NULL if none can be found.

◆ getIdsFromNode()

void SBMLImporter::getIdsFromNode ( const ASTNode *  pNode,
std::set< std::string > &  idSet 
)
protected

Recurses an ASTNode tree and gets all SBML Ids in the tree. The ids are stored in the given set.

References CNodeContextIterator< Node, Context >::end(), and CNodeContextIterator< Node, Context >::next().

Referenced by checkRuleMathConsistency().

◆ getImportCOPASIMIRIAM()

bool SBMLImporter::getImportCOPASIMIRIAM ( ) const

Returns the flag that determines whether COPASI MIRIAM annotation is imported if it is present.

References mImportCOPASIMIRIAM.

◆ getProcessReport()

const CProcessReport * SBMLImporter::getProcessReport ( ) const
Returns
the progress handler set

References mpProcessReport.

◆ importEvent()

◆ importEvents()

void SBMLImporter::importEvents ( Model *  pSBMLModel,
CModel pCopasiModel,
std::map< const CDataObject *, SBase * > &  copasi2sbmlmap 
)
protected

◆ importFunctionDefinitions()

void SBMLImporter::importFunctionDefinitions ( Model *  pSBMLModel,
std::map< const CDataObject *, SBase * > &  copasi2sbmlmap 
)
protected

Starting with SBML Level 2 Version 4, function definitions no longer need to be ordered, i.e. a function definition may refer to another function definition that is defined somewhere further down in the file. So we have to import the function definitions in the correct order.

References CEvaluationTree::compile(), createCFunctionFromFunctionDefinition(), CCopasiMessage::EXCEPTION, findDirectDependencies(), CDataObject::getObjectName(), CCopasiMessage::getText(), MCSBML, mFunctionNameMapping, mKnownCustomUserDefinedFunctions, CCopasiMessage::peekLastMessage(), and CFunction::setInfix().

Referenced by createCModelFromSBMLDocument().

◆ importInitialAssignments()

◆ importMIRIAM()

◆ importNotes()

bool SBMLImporter::importNotes ( CAnnotation pAnno,
const SBase *  pSBase 
)
static

◆ importRule()

void SBMLImporter::importRule ( const Rule *  rule,
CModelEntity::Status  ruleType,
std::map< const CDataObject *, SBase * > &  copasi2sbmlmap,
Model *  pSBMLModel 
)
protected

◆ importRuleForModelEntity()

◆ importSBMLRule()

void SBMLImporter::importSBMLRule ( const Rule *  sbmlRule,
std::map< const CDataObject *, SBase * > &  copasi2sbmlmap,
Model *  pSBMLModel 
)
protected

Imports the given Rule if COPASI supports this kind of Rule, otherwise a warning is created.

References CModelEntity::ASSIGNMENT, fatalError, importRule(), mUnsupportedRuleFound, and CModelEntity::ODE.

Referenced by createCModelFromSBMLDocument(), and replace_delay_nodes().

◆ isConstantFlux()

const CDataObject * SBMLImporter::isConstantFlux ( const CEvaluationNode pRoot,
CModel pModel 
)
protected

◆ isDelayFunctionUsed()

bool SBMLImporter::isDelayFunctionUsed ( ConverterASTNode pNode)
protected

COPASI can not handle the delay function yet, so if it is used in some expression, we have to abort reading the file.

References CNodeContextIterator< Node, Context >::end(), and CNodeContextIterator< Node, Context >::next().

Referenced by createCFunctionFromFunctionTree(), and preprocessNode().

◆ isEmptyOrWhiteSpace()

◆ isMassAction()

◆ isMassActionExpression()

◆ isMassActionFunction()

std::vector< CEvaluationNodeObject * > * SBMLImporter::isMassActionFunction ( const CFunction pFun,
const CChemEq chemicalEquation,
const std::vector< std::vector< std::string > > &  functionArgumentCNs 
)
protected

◆ isSimpleFunctionCall()

bool SBMLImporter::isSimpleFunctionCall ( const CEvaluationNode pRootNode)
protected

◆ isStochasticModel()

bool SBMLImporter::isStochasticModel ( const Model *  pSBMLModel)
protected

Heuristically checks whether a model was meant to be simulated stochastically. If the substance units are set to items and all reaction are irreversible this function will return true;

Referenced by createCModelFromSBMLDocument().

◆ multiplySubstanceOnlySpeciesByVolume()

void SBMLImporter::multiplySubstanceOnlySpeciesByVolume ( ConverterASTNode pNode)
protected

Multiplies all species nodes that belong to species with the hasSubstanceOnlyUnits flag set with the volume of the compartment that the species belongs to. This is only done for kineticLaw, all other mathematical expressions import those references as particle number nodes divided by the quantity2unit factor.

References CNodeIteratorMode::Before, CNodeContextIterator< Node, Context >::end(), mSubstanceOnlySpecies, CNodeContextIterator< Node, Context >::next(), pdelete, CNodeContextIterator< Node, Context >::setProcessingModes(), and CNodeContextIterator< Node, Context >::skipChildren().

Referenced by preprocessNode().

◆ parseSBML()

CModel * SBMLImporter::parseSBML ( const std::string &  sbmlDocumentText,
SBMLDocument *&  pSBMLDocument,
std::map< const CDataObject *, SBase * > &  copasi2sbmlmap,
CListOfLayouts *&  prLol,
CDataModel pDataModel 
)

◆ preprocessNode()

void SBMLImporter::preprocessNode ( ConverterASTNode pNode,
Model *  pSBMLModel,
std::map< const CDataObject *, SBase * > &  copasi2sbmlmap,
Reaction *  pSBMLReaction = NULL 
)
protected

◆ readSBML()

CModel * SBMLImporter::readSBML ( std::string  filename,
SBMLDocument *&  pSBMLDocument,
std::map< const CDataObject *, SBase * > &  copasi2sbmlmap,
CListOfLayouts *&  prLol,
CDataModel pDataModel 
)

This functions replaces all species nodes for species that are in the substanceOnlySpeciesVector. With the node multiplied by the volume of the species compartment. void SBMLImporter::replaceSubstanceOnlySpeciesNodes(ConverterASTNode* node, const std::map<Species*, Compartment*>& substanceOnlySpecies) { if (node != NULL) { if (node->getType() == AST_NAME) { std::map<Species*, Compartment*>::const_iterator it = substanceOnlySpecies.begin(); std::map<Species*, Compartment*>::const_iterator endIt = substanceOnlySpecies.end(); while (it != endIt) { if (it->first->getId() == node->getName()) { replace node List* l = new List(); ConverterASTNode* child1 = new ConverterASTNode(AST_NAME); child1->setName(node->getName()); ConverterASTNode* child2 = new ConverterASTNode(AST_NAME); child2->setName(it->second->getId().c_str()); l->add(child1); l->add(child2); node->setChildren(l); node->setType(AST_TIMES); break; } ++it; } } else { unsigned int counter; for (counter = 0;counter < node->getNumChildren();counter++) { this->replaceSubstanceOnlySpeciesNodes((ConverterASTNode*)node->getChild(counter), substanceOnlySpecies); } } } } Function reads an SBML file with libsbml and converts it to a Copasi CModel

References CCopasiMessage::EXCEPTION, CLocaleString::fromUtf8(), MCSBML, and parseSBML().

Referenced by SEDMLImporter::importModel(), and CDataModel::importSBML().

◆ removeUnusedFunctions()

◆ renameMassActionParameters()

◆ replace_delay_nodes()

void SBMLImporter::replace_delay_nodes ( ConverterASTNode pASTNode,
Model *  pModel,
std::map< const CDataObject *, SBase * > &  copasi2sbmlmap,
Reaction *  pSBMLReaction,
std::map< std::string, std::string > &  localReplacementMap 
)
protected

This function replaces calls to the delay function in an ASTNode tree by a node that references a new global parameter which the function creates. The global parameter gets an expression which corresponds to the delay call. This is necessary because all knetic laws in COPASI are function calls and function definitions should not contain a call to delay.

This function replaces calls to the delay function in an ASTNode tree by a node that references a new global parameter which the function creates. The global parameter gets an expression which corresponds to the delay call. This is necessary because all kinetic laws in COPASI are function calls and function definitions should not contain a call to delay.

References createCModelValueFromParameter(), CNodeContextIterator< Node, Context >::end(), CCopasiMessage::EXCEPTION, fatalError, find_local_parameters_in_delay(), importSBMLRule(), mDelayNodeMap, SBMLUnitSupport::mLevel, mpCopasiModel, mUsedSBMLIds, CNodeContextIterator< Node, Context >::next(), and replace_name_nodes().

Referenced by preprocessNode().

◆ replace_name_nodes()

void SBMLImporter::replace_name_nodes ( ASTNode *  pASTNode,
const std::map< std::string, std::string > &  replacementMap 
)
protected

This method gets an ASTNode and a map between old node names and new node names. All AST_NAME nodes with an "old" name are replaced by a node with the "new" name.

References CNodeContextIterator< Node, Context >::end(), and CNodeContextIterator< Node, Context >::next().

Referenced by createCReactionFromReaction(), preprocessNode(), and replace_delay_nodes().

◆ replace_time_with_initial_time()

void SBMLImporter::replace_time_with_initial_time ( ASTNode *  pASTNode,
const CModel pCopasiModel 
)
protected

If an initial expression uses time, we have to import it as initial time instead. This method takes an AST node and converts all time nodes to object nodes that have the common name of the time as the name.

References CNodeContextIterator< Node, Context >::end(), CDataObject::getCN(), CModelEntity::getInitialValueReference(), and CNodeContextIterator< Node, Context >::next().

Referenced by importInitialAssignments().

◆ replaceAmountReferences()

void SBMLImporter::replaceAmountReferences ( ConverterASTNode pASTNode,
Model *  pSBMLModel,
double  factor,
std::map< const CDataObject *, SBase * > &  copasi2sbmlmap 
)
protected

This method replaces references to the id of species which have the hasOnlySubstanceUnits flag set with the reference divided by avogadros number. The method tries to determine if there already is a multiplication with avogadros number and removes this multiplication rather than adding a new division.

This method replaces references to the id of species which have the hasOnlySubstanceUnits flag set with the reference divided by avogadros number.

References areApproximatelyEqual(), CNodeIteratorMode::Before, createHasOnlySubstanceUnitFactor(), CNodeContextIterator< Node, Context >::end(), mPotentialAvogadroNumbers, mSubstanceOnlySpecies, CNodeContextIterator< Node, Context >::next(), pdelete, CNodeContextIterator< Node, Context >::setProcessingModes(), and CNodeContextIterator< Node, Context >::skipChildren().

Referenced by preprocessNode().

◆ replaceCallNodeNames()

void SBMLImporter::replaceCallNodeNames ( ASTNode *  pNode)
protected

Upon import a function object might change its name due to naming conflicts in the function database. So each ASTNode tree has its call node names replaced before it will be processed further.

References CNodeContextIterator< Node, Context >::end(), CCopasiMessage::EXCEPTION, mCreatedFunctions, MCSBML, mFunctionNameMapping, mKnownCustomUserDefinedFunctions, and CNodeContextIterator< Node, Context >::next().

Referenced by preprocessNode().

◆ replaceLog()

void SBMLImporter::replaceLog ( ConverterASTNode sourceNode)
protected

This functions replaces all species nodes for species that are in the substanceOnlySpeciesVector. With the node multiplied by the volume of the species compartment. void replaceSubstanceOnlySpeciesNodes(ConverterASTNode* node, const std::map<Species*, Compartment*>& substanceOnlySpecies); Replaces all occurrences of the log function with two arguments by a division of two separate calls to log.

◆ replaceObjectNames()

◆ replacePowerFunctionNodes()

void SBMLImporter::replacePowerFunctionNodes ( ASTNode *  node)
protected

Replaces the variables in a function definition with the actual function parameters that were used when the function was called. The function returns a pointer to the ConverterAST node with the replaced variables. This function replaces the AST_FUNCTION_POWER ASTNodes in a ASTNode tree with the AST_POWER node.

◆ replaceRoot()

void SBMLImporter::replaceRoot ( ConverterASTNode sourceNode)
protected

Replaces all occurrences of the root function with two arguments by a call to the power function with the inverse of the first argument.

◆ replaceTimeAndAvogadroNodeNames()

void SBMLImporter::replaceTimeAndAvogadroNodeNames ( ASTNode *  pNode)
protected

The data for a CEvaluationNodeObject needs to have the common name of the model it refers to as its data. Since this model is only known via a pointer in the SBMLImporter at the time of import, all AST_NAME_TIME nodes that are imported need to have their name replaced by the common name of this model. Starting with SBML Level 3 this also applies to the avogadro number.

References CNodeContextIterator< Node, Context >::end(), CDataContainer::getObject(), mpCopasiModel, and CNodeContextIterator< Node, Context >::next().

Referenced by preprocessNode().

◆ replaceTimeDependentFunctionCalls()

void SBMLImporter::replaceTimeDependentFunctionCalls ( ASTNode *  root)
protected

This function replaces function calls to all functions listed in mExplicitelyTimeDependentFunctionDefinitions with the same call but an additional parameter which is the time. This replacement includes all model entities that have a mathematical expression, so depending on the version of SBML, this would include: initial assignments, rules, constraints, kinetic laws and events. The corresponding replacement for the function definitions is done in replaceTimeNodesInFunctionDefinition.

References CNodeContextIterator< Node, Context >::end(), mExplicitelyTimeDependentFunctionDefinitions, and CNodeContextIterator< Node, Context >::next().

Referenced by preprocessNode().

◆ replaceTimeNodesInFunctionDefinition()

bool SBMLImporter::replaceTimeNodesInFunctionDefinition ( ASTNode *  pASTNode,
std::string  newNodeName 
)
protected

For function definitions that use the time symbol we have to make this a variable that is passed to the function instead. The function recursively goes through the AST tree rooted in root and changes all time nodes to variable nodes with name newNodeName. If a time node has been found, the function return true, otherwise false is returned.

For function definitions that use the time symbol we have to make this a variable that is passed to the function instead. The function recursively goes through the AST tree rooted in root and changes all time nodes to variable nodes with name newNodeName. Additionally all function calls to functions in mExplicitelyTimeDependentFunctionDefinitions have to be changed to contain the added parameter. If a time node has been found, the function returns true, otherwise false is returned.

References CNodeContextIterator< Node, Context >::end(), mExplicitelyTimeDependentFunctionDefinitions, and CNodeContextIterator< Node, Context >::next().

Referenced by createCFunctionFromFunctionTree().

◆ reportCurrentProgressOrStop()

bool SBMLImporter::reportCurrentProgressOrStop ( )
protected

Notifies the progress dialog of local progress

Returns
a boolean indicating whether processing should be stopped

Creates and returns a Copasi CModel from the SBMLDocument given as argument.

References mCurrentStepHandle, mpProcessReport, and CProcessReport::progressItem().

Referenced by createCModelFromSBMLDocument(), importEvents(), importInitialAssignments(), and removeUnusedFunctions().

◆ restoreFunctionDB()

◆ round()

C_FLOAT64 SBMLImporter::round ( const C_FLOAT64 x)
staticprotected

◆ sbmlId2CopasiCN()

bool SBMLImporter::sbmlId2CopasiCN ( ASTNode *  pNode,
std::map< const CDataObject *, SBase * > &  copasi2sbmlmap,
CCopasiParameterGroup pParamGroup,
SBase *  pParentObject = NULL 
)
protected

◆ separateProductArguments()

void SBMLImporter::separateProductArguments ( const CEvaluationNode pRootNode,
std::vector< const CEvaluationNode * > &  arguments 
)
protected

This function takes a node and tries to find out whether the tree under this node consists only of multiply operators and object nodes. The arguments to the multiply operators are returned.

References CCopasiNode< _Data >::getChild(), CCopasiNode< _Data >::getSibling(), CEvaluationNode::MULTIPLY, CEvaluationNode::POWER, and CEvaluationNode::subType().

Referenced by isMassActionExpression().

◆ setCorrectUsage()

◆ setImportCOPASIMIRIAM()

void SBMLImporter::setImportCOPASIMIRIAM ( bool  import)

Sets the flag that determines whether COPASI MIRIAM annotation is imported if it is present.

References mImportCOPASIMIRIAM.

Referenced by SEDMLImporter::importModel(), CDataModel::importSBML(), and CDataModel::importSBMLFromString().

◆ setImportHandler()

void SBMLImporter::setImportHandler ( CProcessReport pProcessReport)

sets a progress handler to inform about updates

References mpProcessReport, mpSbmlCallback, and pdelete.

Referenced by clearCallBack(), SEDMLImporter::importModel(), CDataModel::importSBML(), and CDataModel::importSBMLFromString().

◆ setInitialValues()

bool SBMLImporter::setInitialValues ( CModel pModel,
const std::map< const CDataObject *, SBase * > &  copasi2sbmlmap 
)
protected

Sets the initial values on compartments, metabolites and model values if those initial values have been set in the SBML model. Otherwise the routine checks if a rule or an initial assignment has been set for the entity. If the entity has not been set in any way, an error message is created.

References CModelEntity::ASSIGNMENT, CDataVector< CType >::begin(), CObjectInterface::DataObject(), CDataVector< CType >::empty(), CDataVector< CType >::end(), CModelEntity::FIXED, CModel::getCompartments(), CModel::getMetabolites(), CModel::getModelValues(), CDataContainer::getObject(), CModel::getQuantity2NumberFactor(), mChangedObjects, MCSBML, mIncompleteModel, SBMLUnitSupport::mLevel, CModelEntity::ODE, CModelEntity::REACTIONS, CModel::updateInitialValues(), and CCopasiMessage::WARNING.

Referenced by createCModelFromSBMLDocument().

◆ updateSBMLSpeciesReferenceIds()

void SBMLImporter::updateSBMLSpeciesReferenceIds ( Model *  pModel,
std::map< std::string, double > &  ids 
)
static

Goes through all SBML reactions and collects the ids of all species references.

Referenced by createCModelFromSBMLDocument().

◆ variables2objects()

Member Data Documentation

◆ mAssignmentToSpeciesReferenceFound

bool SBMLImporter::mAssignmentToSpeciesReferenceFound
protected

Referenced by SBMLImporter().

◆ mAvogadroCreated

bool SBMLImporter::mAvogadroCreated
protected

◆ mChangedObjects

std::set<const CDataObject*> SBMLImporter::mChangedObjects
protected

Referenced by setInitialValues().

◆ mChemEqElementSpeciesIdMap

std::map<const CChemEqElement*, std::pair<std::string, CChemEq::MetaboliteRole> > SBMLImporter::mChemEqElementSpeciesIdMap
protected

◆ mCompartmentMap

std::map<std::string, CCompartment*> SBMLImporter::mCompartmentMap
protected

◆ mConversionFactorFound

bool SBMLImporter::mConversionFactorFound
protected

◆ mCreatedFunctions

std::set<std::string> SBMLImporter::mCreatedFunctions
protected

◆ mCurrentStepCounter

unsigned C_INT32 SBMLImporter::mCurrentStepCounter
protected

current step counter for current import

Referenced by createCModelFromSBMLDocument(), createProgressStepOrStop(), parseSBML(), and removeUnusedFunctions().

◆ mCurrentStepHandle

size_t SBMLImporter::mCurrentStepHandle
protected

◆ mCurrentStepTotal

unsigned C_INT32 SBMLImporter::mCurrentStepTotal
protected

total steps of current import task

Referenced by createCModelFromSBMLDocument(), createProgressStepOrStop(), and parseSBML().

◆ mDelayFound

bool SBMLImporter::mDelayFound
protected

◆ mDelayNodeMap

std::map<std::string, std::string> SBMLImporter::mDelayNodeMap
protected

Referenced by replace_delay_nodes().

◆ mDivisionByCompartmentReactions

std::set<std::string> SBMLImporter::mDivisionByCompartmentReactions
protected

◆ mEventAssignmentForSpeciesReferenceIgnored

bool SBMLImporter::mEventAssignmentForSpeciesReferenceIgnored
protected

◆ mExplicitelyTimeDependentFunctionDefinitions

std::set<std::string> SBMLImporter::mExplicitelyTimeDependentFunctionDefinitions
protected

◆ mFastReactions

std::set<std::string> SBMLImporter::mFastReactions
protected

◆ mFunctionNameMapping

std::map<std::string, std::string> SBMLImporter::mFunctionNameMapping
protected

◆ mGlobalStepCounter

unsigned C_INT32 SBMLImporter::mGlobalStepCounter
protected

global step counter

Referenced by createProgressStepOrStop(), and parseSBML().

◆ mGlobalStepHandle

size_t SBMLImporter::mGlobalStepHandle
protected

the global import step handle

Referenced by createProgressStepOrStop(), finishImport(), and parseSBML().

◆ mGlobalStepTotal

unsigned C_INT32 SBMLImporter::mGlobalStepTotal
protected

total step counter for global import

Referenced by parseSBML().

◆ mIgnoredParameterUnits

std::vector<std::string> SBMLImporter::mIgnoredParameterUnits
protected

◆ mIgnoredSBMLMessages

std::set<unsigned int> SBMLImporter::mIgnoredSBMLMessages
protected

◆ mImportCOPASIMIRIAM

bool SBMLImporter::mImportCOPASIMIRIAM
protected

◆ mIncompleteModel

bool SBMLImporter::mIncompleteModel
protected

◆ mKnownCustomUserDefinedFunctions

std::map<std::string, std::string> SBMLImporter::mKnownCustomUserDefinedFunctions
protected

◆ mKnownInitalValues

std::map<std::string, std::string> SBMLImporter::mKnownInitalValues
protected

◆ mOriginalLevel

unsigned int SBMLImporter::mOriginalLevel
protected

Referenced by importRule(), and parseSBML().

◆ mParameterFluxMap

std::map<std::string, CModelValue*> SBMLImporter::mParameterFluxMap
protected

◆ mpCopasiModel

◆ mpDataModel

◆ mpModelConversionFactor

const CModelValue* SBMLImporter::mpModelConversionFactor
protected

◆ mPotentialAvogadroNumbers

std::set<const Parameter*> SBMLImporter::mPotentialAvogadroNumbers
protected

◆ mpProcessReport

◆ mpSbmlCallback

SbmlProgressCallback* SBMLImporter::mpSbmlCallback
protected

Referenced by setImportHandler(), and ~SBMLImporter().

◆ mRateRuleForSpeciesReferenceIgnored

bool SBMLImporter::mRateRuleForSpeciesReferenceIgnored
protected

◆ mReactions

std::set<std::string> SBMLImporter::mReactions
protected

◆ mReactionsWithReplacedLocalParameters

std::set<std::string> SBMLImporter::mReactionsWithReplacedLocalParameters
protected

◆ mSBMLIdModelValueMap

std::map<std::string, const CModelValue*> SBMLImporter::mSBMLIdModelValueMap
protected

◆ mSBMLSpeciesReferenceIds

std::map<std::string, double> SBMLImporter::mSBMLSpeciesReferenceIds
protected

◆ mSpeciesConversionParameterMap

std::map<std::string, const CModelValue*> SBMLImporter::mSpeciesConversionParameterMap
protected

◆ mStoichiometricExpressionMap

std::map<const ASTNode*, const CChemEqElement* > SBMLImporter::mStoichiometricExpressionMap
protected

◆ mSubstanceOnlySpecies

std::map<Species*, Compartment*> SBMLImporter::mSubstanceOnlySpecies
protected

◆ mUnitOnNumberFound

bool SBMLImporter::mUnitOnNumberFound
protected

◆ mUnsupportedAssignmentRuleFound

bool SBMLImporter::mUnsupportedAssignmentRuleFound
protected

Referenced by SBMLImporter().

◆ mUnsupportedRateRuleFound

bool SBMLImporter::mUnsupportedRateRuleFound
protected

Referenced by SBMLImporter().

◆ mUnsupportedRuleFound

bool SBMLImporter::mUnsupportedRuleFound
protected

◆ mUsedSBMLIds

std::set<std::string> SBMLImporter::mUsedSBMLIds
protected

◆ mUsedSBMLIdsPopulated

bool SBMLImporter::mUsedSBMLIdsPopulated
protected

Referenced by parseSBML(), and preprocessNode().

◆ sbmlIdMap

std::map<CFunction*, std::string> SBMLImporter::sbmlIdMap
protected

◆ speciesMap

std::map<std::string, CMetab*> SBMLImporter::speciesMap
protected

The documentation for this class was generated from the following files: