copasi API  0.1
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
CSBMLExporter Class Reference

#include <CSBMLExporter.h>

List of all members.

Public Member Functions

 CSBMLExporter ()
 ~CSBMLExporter ()
SBMLDocument * getSBMLDocument ()
const std::string exportModelToString (CCopasiDataModel &dataModel, unsigned int sbmlLevel, unsigned int sbmlVersion)
bool exportModel (CCopasiDataModel &dataModel, const std::string &filename, unsigned int sbmlLevel=2, unsigned int sbmlVersion=1, bool overwrite=false)
void disownSBMLDocument ()
const std::map< const
CCopasiObject *, SBase * > & 
getCOPASI2SBMLMap () const
bool isSetExportCOPASIMIRIAM () const
void setExportCOPASIMIRIAM (bool exportMIRIAM)

Static Public Member Functions

static const std::vector
< SBMLIncompatibility
isModelSBMLCompatible (const CCopasiDataModel &pDataModel, int sbmlLevel, int sbmlVersion)
static const std::string createUniqueId (const std::map< std::string, const SBase * > &idMap, const std::string &prefix)

Protected Member Functions

void createUnits (const CCopasiDataModel &dataModel)
void createTimeUnit (const CCopasiDataModel &dataModel)
void createLengthUnit (const CCopasiDataModel &dataModel)
void createAreaUnit (const CCopasiDataModel &dataModel)
void createVolumeUnit (const CCopasiDataModel &dataModel)
void createSubstanceUnit (const CCopasiDataModel &dataModel)
void createCompartments (CCopasiDataModel &dataModel)
void createCompartment (CCompartment &compartment)
void createMetabolites (CCopasiDataModel &dataModel)
void createMetabolite (CMetab &metab)
void createParameters (CCopasiDataModel &dataModel)
void createParameter (CModelValue &parameter)
void createReactions (CCopasiDataModel &dataModel)
void createReaction (CReaction &reaction, CCopasiDataModel &dataModel)
void createInitialAssignments (CCopasiDataModel &dataModel)
void createInitialAssignment (const CModelEntity &modelEntity, CCopasiDataModel &dataModel)
void createRules (CCopasiDataModel &dataModel)
void createRule (const CModelEntity &modelEntity, CCopasiDataModel &dataModel, Rule *pOldRule)
void createFunctionDefinitions (CCopasiDataModel &dataModel)
void createFunctionDefinition (CFunction &function, CCopasiDataModel &dataModel)
void checkForUnsupportedObjectReferences (const CCopasiDataModel &dataModel, unsigned int sbmlLevel, unsigned int sbmlVersion, std::vector< SBMLIncompatibility > &result)
void checkForUnsupportedFunctionCalls (const CCopasiDataModel &dataModel, unsigned int sbmlLEvel, unsigned int sbmlVersion, std::vector< SBMLIncompatibility > &result)
const std::map< std::string,
const SBase * > 
createIdMap (const Model &sbmlModel)
KineticLaw * createKineticLaw (CReaction &reaction, CCopasiDataModel &dataModel, unsigned int level, unsigned int version)
CEvaluationNodecreateKineticExpression (CFunction *pFun, const std::vector< std::vector< std::string > > &arguments)
void createSBMLDocument (CCopasiDataModel &dataModel)
std::vector< CModelEntity * > orderRules (const CCopasiDataModel &dataModel)
void updateCOPASI2SBMLMap (const CCopasiDataModel &dataModel)
void createEvents (CCopasiDataModel &dataModel)
void createEvent (CEvent &event, Event *pSBMLEvent, CCopasiDataModel &dataModel)
void exportEventAssignments (const CEvent &event, Event *pSBMLEvent, CCopasiDataModel &dataModel)
void removeUnusedObjects ()
void convertToLevel1 ()
void removeInitialAssignment (const std::string &sbmlId)
void removeRule (const std::string &sbmlId)
CEvaluationNodereplaceSpeciesReferences (const CEvaluationNode *pOrigNode, const CCopasiDataModel &dataModel)
void findAvogadro (const CCopasiDataModel &dataModel)
bool updateMIRIAMAnnotation (const CCopasiObject *pCOPASIObject, SBase *pSBMLObject, std::map< std::string, const SBase * > &metaIds)
XMLNode * replaceChild (const XMLNode *pParent, const XMLNode *pNewChild, unsigned int index)
void collectIds (const CCopasiDataModel &dataModel, std::map< std::string, const SBase * > &idMap)
ASTNode * convertToASTNode (const CEvaluationNode *pOrig, CCopasiDataModel &dataModel)
void setFunctionSBMLIds (const CEvaluationNode *pNode, CCopasiDataModel &dataModel)
void outputIncompatibilities () const
void replace_local_parameters (ASTNode *pOrigNode, const CCopasiDataModel &dataModel)
void restore_local_parameters (ASTNode *pOrigNode, const CCopasiDataModel &dataModel)
void assignSBMLIdsToReactions (CModel *pModel)

Static Protected Member Functions

static void checkForUnsupportedObjectReferences (const CEvaluationTree &expression, const CCopasiDataModel &dataModel, unsigned int sbmlLevel, unsigned int sbmlVersion, std::vector< SBMLIncompatibility > &result, bool initialExpression=false)
static void checkForPiecewiseFunctions (const CCopasiDataModel &dataModel, std::vector< SBMLIncompatibility > &result)
static void checkForPiecewiseFunctions (const CEvaluationNode &node, std::vector< SBMLIncompatibility > &result, const std::string &objectName, const std::string &objectType)
static void isModelSBMLL1Compatible (const CCopasiDataModel &dataModel, std::vector< SBMLIncompatibility > &result)
static void isModelSBMLL2V1Compatible (const CCopasiDataModel &dataModel, std::vector< SBMLIncompatibility > &result)
static void isModelSBMLL2V3Compatible (const CCopasiDataModel &dataModel, std::vector< SBMLIncompatibility > &result)
static void check_for_spatial_size_units (const CCopasiDataModel &dataModel, std::vector< SBMLIncompatibility > &result)
static void checkForODESpeciesInNonfixedCompartment (const CCopasiDataModel &dataModel, std::vector< SBMLIncompatibility > result)
static void isExpressionSBMLCompatible (const CEvaluationTree &expr, const CCopasiDataModel &dataModel, int sbmlLevel, int sbmlVersion, std::vector< SBMLIncompatibility > &result, const std::string &objectDescription, bool initialExression=false)
static void isExpressionSBMLL1Compatible (const CEvaluationTree &expr, const CCopasiDataModel &dataModel, std::vector< SBMLIncompatibility > &result)
static void isExpressionSBMLL2V1Compatible (const CEvaluationTree &expr, const CCopasiDataModel &dataModel, std::vector< SBMLIncompatibility > &result)
static void isExpressionSBMLL2V3Compatible (const CEvaluationTree &expression, const CCopasiDataModel &pDataModel, std::vector< SBMLIncompatibility > &result)
static void checkForUnsupportedFunctionCalls (const CEvaluationNode &node, const std::set< CEvaluationNodeFunction::SubType > &unsupportedFunctions, std::vector< SBMLIncompatibility > &result, const std::string &objectDescription)
static void checkForInitialAssignments (const CCopasiDataModel &dataModel, std::vector< SBMLIncompatibility > &result)
static void findDirectlyUsedFunctions (const CEvaluationNode *pRootNode, std::set< std::string > &result)
static ASTNode * isDividedByVolume (const ASTNode *pRootNode, const std::string &compartmentId)
static void checkForEvents (const CCopasiDataModel &dataModel, std::vector< SBMLIncompatibility > &result)
static void isEventAssignmentSBMLCompatible (std::string &key, const CExpression *pExpression, const CCopasiDataModel &dataModel, unsigned int sbmlLevel, unsigned int sbmlVersion, const std::string &eventName, std::vector< SBMLIncompatibility > &result)
static void isEventSBMLCompatible (const CEvent *pEvent, const CCopasiDataModel &dataModel, unsigned int sbmlLevel, unsigned int sbmlVersion, std::vector< SBMLIncompatibility > &result)
static ASTNode * createTimesTree (const CCopasiVector< CChemEqElement > &vect, unsigned int pos=0)
static const std::vector
< CFunction * > 
findUsedFunctions (std::set< CFunction * > &functions, CFunctionDB *pFunctionDB)
static const std::set
< CFunction * > 
createFunctionSetFromFunctionNames (const std::set< std::string > &names, CFunctionDB *pFunDB)
static const std::set
< CEvaluationNodeFunction::SubType
createUnsupportedFunctionTypeSet (unsigned int sbmlLevel)
static void findModelEntityDependencies (const CEvaluationNode *pNode, const CCopasiDataModel &dataModel, std::set< const CModelEntity * > &dependencies)
static ASTNode * convertASTTreeToLevel1 (const ASTNode *pNode, const ListOfFunctionDefinitions &functions, std::string &message)
static ASTNode * replaceL1IncompatibleNodes (const ASTNode *pNode)
static CEvaluationNodecreateMassActionExpression (const std::vector< std::vector< std::string > > &arguments, bool isReversible)
static bool isValidSId (const std::string &id)

Protected Attributes

SBMLDocument * mpSBMLDocument
unsigned int mSBMLLevel
unsigned int mSBMLVersion
std::vector< CModelEntity * > mAssignmentVector
std::vector< CModelEntity * > mODEVector
std::vector< CModelEntity * > mInitialAssignmentVector
std::map< const CCopasiObject
*, SBase * > 
mCOPASI2SBMLMap
std::set< SBase * > mHandledSBMLObjects
std::set< CFunction * > mUsedFunctions
std::map< std::string, const
SBase * > 
mIdMap
std::vector< SBMLIncompatibilitymIncompatibilities
bool mIncompleteExport
bool mVariableVolumes
const CModelValuempAvogadro
bool mAvogadroCreated
std::map< std::string, const
SBase * > 
mMetaIdMap
bool mMIRIAMWarning
std::map< std::string, const
CEvaluationTree * > 
mFunctionIdMap
bool mDocumentDisowned
bool mExportCOPASIMIRIAM
std::map< std::string,
Parameter * > 
mParameterReplacementMap
std::set< std::string > mSpatialSizeUnitsSpecies
ListOfFunctionDefinitions mExportedFunctions
std::map< const
FunctionDefinition *, const
CCopasiObject * > 
mFunctionMap

Constructor & Destructor Documentation

CSBMLExporter::CSBMLExporter ( )

Default Konstruktor

CSBMLExporter::~CSBMLExporter ( )

Destruktor


Member Function Documentation

void CSBMLExporter::assignSBMLIdsToReactions ( CModel pModel) [protected]

Since we want to replace local reaction parameters by global parameters if they are used in an assignment, we have to create the reactions after creating the rules and events. On the other hand, a reaction flux might also be referenced in an assignment or an event and the creation of this rule or event only works if the reactions already have SBML ids. To solve this problem, the reactions have to be assigned SBML ids prior to creating rules and events. This is what this method does.

void CSBMLExporter::check_for_spatial_size_units ( const CCopasiDataModel dataModel,
std::vector< SBMLIncompatibility > &  result 
) [static, protected]

Go through all species in the model and check if the corresponding species in the SBML model has the spatialSizeUnits attribute set. This attribute is not supported in SBML L2V3 and above, so we have to get rid of this attribute when we export to a level equal to or higher than L2V3. If the attribute has the same value as the compartments units, we can just delete it without changing the model, otherwise we have to give a corresponding warning.

void CSBMLExporter::checkForEvents ( const CCopasiDataModel dataModel,
std::vector< SBMLIncompatibility > &  result 
) [static, protected]

Checks if the given datamodel contains events. This is called if SBML Level 1 is to be exported.

void CSBMLExporter::checkForInitialAssignments ( const CCopasiDataModel dataModel,
std::vector< SBMLIncompatibility > &  result 
) [static, protected]

This method checks wether the given model contains any initial assignments.

This method checks whether the given model contains any initial assignments.

void CSBMLExporter::checkForODESpeciesInNonfixedCompartment ( const CCopasiDataModel dataModel,
std::vector< SBMLIncompatibility result 
) [static, protected]

Checks wether the model contains a metabolite that is defined by an ODE expression and that is located in a variable volume. Since COPASI interprets the expression differntly from SBML, we can not correctly export this yet. See Bug 903.

Checks whether the model contains a metabolite that is defined by an ODE expression and that is located in a variable volume. Since COPASI interprets the expression differently from SBML, we can not correctly export this yet. See Bug 903.

void CSBMLExporter::checkForPiecewiseFunctions ( const CCopasiDataModel dataModel,
std::vector< SBMLIncompatibility > &  result 
) [static, protected]

Checks all expressions in the given datamodel for piecewise defined functions.

void CSBMLExporter::checkForPiecewiseFunctions ( const CEvaluationNode node,
std::vector< SBMLIncompatibility > &  result,
const std::string &  objectName,
const std::string &  objectType 
) [static, protected]

Checks the given node and all it's children for the occurence of piecewise functions.

void CSBMLExporter::checkForUnsupportedFunctionCalls ( const CCopasiDataModel dataModel,
unsigned int  sbmlLevel,
unsigned int  sbmlVersion,
std::vector< SBMLIncompatibility > &  result 
) [protected]

This static methods checks, wether the model uses any function calls that can not be expressed in SBML like the random distribution functions.

This static methods checks, whether the model uses any function calls that can not be expressed in SBML like the random distribution functions.

void CSBMLExporter::checkForUnsupportedFunctionCalls ( const CEvaluationNode node,
const std::set< CEvaluationNodeFunction::SubType > &  unsupportedFunctions,
std::vector< SBMLIncompatibility > &  result,
const std::string &  objectDescription 
) [static, protected]

This static methods checks recursively, whether the given CEvaluationNode constains any function calls that can not be expressed in SBML like the random distribution functions.

void CSBMLExporter::checkForUnsupportedObjectReferences ( const CCopasiDataModel dataModel,
unsigned int  sbmlLevel,
unsigned int  sbmlVersion,
std::vector< SBMLIncompatibility > &  result 
) [protected]

Checks all assignments (initial and transient) for references to objects that can not be exported to SBML.

void CSBMLExporter::checkForUnsupportedObjectReferences ( const CEvaluationTree expression,
const CCopasiDataModel dataModel,
unsigned int  sbmlLevel,
unsigned int  sbmlVersion,
std::vector< SBMLIncompatibility > &  result,
bool  initialExpression = false 
) [static, protected]

Checks the given expression for references to objects that can not be exported to SBML.

void CSBMLExporter::collectIds ( const CCopasiDataModel dataModel,
std::map< std::string, const SBase * > &  idMap 
) [protected]

This method goes through the given datamodel and collects all SBML ids.

ASTNode * CSBMLExporter::convertASTTreeToLevel1 ( const ASTNode *  pNode,
const ListOfFunctionDefinitions &  functions,
std::string &  message 
) [static, protected]

Creates an ASTNode based tree where all occurences of nodes that are not supported in SBML Level 1 are replaced by supported constructs. On error an exception is created. The caller is responsible for freeing the memory of the returned object.

ASTNode * CSBMLExporter::convertToASTNode ( const CEvaluationNode pOrig,
CCopasiDataModel dataModel 
) [protected]

This converts an CEvaluationNode based tree to an ASTNode tree. It makes sure that all functions used in function calls already have a unique SBML id.

void CSBMLExporter::convertToLevel1 ( ) [protected]

This method takes care of expanding all function calls in all expressions and converting functions that are not supported in Level 1 as well as constants that were not supported in Level 1

void CSBMLExporter::createAreaUnit ( const CCopasiDataModel dataModel) [protected]

Creates the volume unit for the SBML model.

Creates the area unit for the SBML model.

void CSBMLExporter::createCompartment ( CCompartment compartment) [protected]

Creates the compartment for the given COPASI compartment.

void CSBMLExporter::createCompartments ( CCopasiDataModel dataModel) [protected]

Creates the compartments for the model.

void CSBMLExporter::createEvent ( CEvent event,
Event *  pSBMLEvent,
CCopasiDataModel dataModel 
) [protected]

Creates an SBML Event for the given COPASI event.

void CSBMLExporter::createEvents ( CCopasiDataModel dataModel) [protected]

Creates the events for the given data model.

void CSBMLExporter::createFunctionDefinition ( CFunction function,
CCopasiDataModel dataModel 
) [protected]

Create the SBML function definition from the given COPASI function.

void CSBMLExporter::createFunctionDefinitions ( CCopasiDataModel dataModel) [protected]

Create all function definitions.

const std::set< CFunction * > CSBMLExporter::createFunctionSetFromFunctionNames ( const std::set< std::string > &  names,
CFunctionDB pFunDB 
) [static, protected]
const std::map< std::string, const SBase * > CSBMLExporter::createIdMap ( const Model &  sbmlModel) [protected]

Goes through the given SBML model and puts all ids with the corresponding object into a map.

void CSBMLExporter::createInitialAssignment ( const CModelEntity modelEntity,
CCopasiDataModel dataModel 
) [protected]

Creates the initial assignment for the given COPASI model entity.

void CSBMLExporter::createInitialAssignments ( CCopasiDataModel dataModel) [protected]

Creates the initial assignments for the model.

CEvaluationNode * CSBMLExporter::createKineticExpression ( CFunction pFun,
const std::vector< std::vector< std::string > > &  arguments 
) [protected]

Creates an expression from a given node and a set of parameter mappings by replacing the function arguments with the parameters. static CEvaluationNode* createExpressionTree(const CEvaluationNode* const pNode, const std::map<std::string, std::string>& parameterMap, const CCopasiDataModel& dataModel); Creates an expression from a given function and a set of parameters by replacing the function arguments with the parameters. static CEvaluationNode* createExpressionTree(const CFunction* const pFun, const std::vector<std::vector<std::string> >& arguments, const CCopasiDataModel& dataModel); Create an expression that corresponds to a kinetic law. If the kinetic law was mass action, the expression is a mass action term , otherwise it is a function call.

KineticLaw * CSBMLExporter::createKineticLaw ( CReaction reaction,
CCopasiDataModel dataModel,
unsigned int  level,
unsigned int  version 
) [protected]

Create the kinetic law for the given reaction. On failure NULL is returned.

void CSBMLExporter::createLengthUnit ( const CCopasiDataModel dataModel) [protected]

Creates the volume unit for the SBML model.

Creates the length unit for the SBML model.

CEvaluationNode * CSBMLExporter::createMassActionExpression ( const std::vector< std::vector< std::string > > &  arguments,
bool  isReversible 
) [static, protected]

This method creates the CEvaluationNode based tree for a reversible or irreversible Mass Action call. The first parameter contains the arguments from the COPASI reaction. The second argument determines whether it is reversible or irreversible mass action.

void CSBMLExporter::createMetabolite ( CMetab metab) [protected]

Creates the species for the given COPASI metabolite.

void CSBMLExporter::createMetabolites ( CCopasiDataModel dataModel) [protected]

Creates the compartments for the model.

void CSBMLExporter::createParameter ( CModelValue modelValue) [protected]

Creates the parameter for the given COPASI parameter.

void CSBMLExporter::createParameters ( CCopasiDataModel dataModel) [protected]

Creates the parameters for the model.

void CSBMLExporter::createReaction ( CReaction reaction,
CCopasiDataModel dataModel 
) [protected]

Creates the reaction for the given COPASI reaction.

void CSBMLExporter::createReactions ( CCopasiDataModel dataModel) [protected]

Creates the reactions for the model.

void CSBMLExporter::createRule ( const CModelEntity modelEntity,
CCopasiDataModel dataModel,
Rule *  pOldRule 
) [protected]

Creates the rule for the given COPASI model entity.

void CSBMLExporter::createRules ( CCopasiDataModel dataModel) [protected]

Creates the rules for the model.

void CSBMLExporter::createSBMLDocument ( CCopasiDataModel dataModel) [protected]

Creates an SBMLDocument from the given CCopasiDataModelObject. It checks if an SBMLDocument already exists from an import and if this is the case, the old document is copied. If none exists a new one is created. Copying the old one makes sure that if something goes wrong during export, the original model is still consistent.

void CSBMLExporter::createSubstanceUnit ( const CCopasiDataModel dataModel) [protected]

Creates the substance unit for the SBML model.

ASTNode * CSBMLExporter::createTimesTree ( const CCopasiVector< CChemEqElement > &  vect,
unsigned int  pos = 0 
) [static, protected]

This method creates an ASTNode tree where all the species specified in the given vector are multiplied. This is used to create the mass action kinetic law.

void CSBMLExporter::createTimeUnit ( const CCopasiDataModel dataModel) [protected]

Creates the time unit for the SBML model.

const std::string CSBMLExporter::createUniqueId ( const std::map< std::string, const SBase * > &  idMap,
const std::string &  prefix 
) [static]

Create a unique id for an SBML object. I can't just take the Copasi key of the object since this might conflict with an already existing sbml id which came from the sbmlid attribute in a copasi file or directly by importing an SBML file.

Create a unique id for an SBML object. I can't just take the COPASI key of the object since this might conflict with an already existing SBML id which came from the sbmlid attribute in a COPASI file or directly by importing an SBML file.

void CSBMLExporter::createUnits ( const CCopasiDataModel dataModel) [protected]

Creates the units for the SBML model.

const std::set< CEvaluationNodeFunction::SubType > CSBMLExporter::createUnsupportedFunctionTypeSet ( unsigned int  sbmlLevel) [static, protected]

Creates a set of all function subtypes that can not be exported for a certain SBML level.

void CSBMLExporter::createVolumeUnit ( const CCopasiDataModel dataModel) [protected]

Creates the volume unit for the SBML model.

void CSBMLExporter::disownSBMLDocument ( )

This method assures that the SBMLDocument is not deleted by the destructor of the exporter. This allows us to get the SBMLDocument from the exporter and store it in the data model without having to copy it.

void CSBMLExporter::exportEventAssignments ( const CEvent event,
Event *  pSBMLEvent,
CCopasiDataModel dataModel 
) [protected]

This method creates the individual event assignments for the given event.

bool CSBMLExporter::exportModel ( CCopasiDataModel dataModel,
const std::string &  filename,
unsigned int  sbmlLevel = 2,
unsigned int  sbmlVersion = 1,
bool  overwrite = false 
)

Export the model to SBML. The model is written to the file given by filename. If the export fails, false is returned.

const std::string CSBMLExporter::exportModelToString ( CCopasiDataModel dataModel,
unsigned int  sbmlLevel,
unsigned int  sbmlVersion 
)

Export the model to SBML. The SBML model is returned as a string. In case of an error, an empty string is returned.

void CSBMLExporter::findAvogadro ( const CCopasiDataModel dataModel) [protected]

Try to find a global parameter that represents avogadros number.

void CSBMLExporter::findDirectlyUsedFunctions ( const CEvaluationNode pRootNode,
std::set< std::string > &  result 
) [static, protected]

Go through a CEvaluationNode base tree and add the names of all functions directly called in this tree to the set.

void CSBMLExporter::findModelEntityDependencies ( const CEvaluationNode pNode,
const CCopasiDataModel dataModel,
std::set< const CModelEntity * > &  dependencies 
) [static, protected]

Find all ModelEntities for which the given node and its children contains references.

const std::vector< CFunction * > CSBMLExporter::findUsedFunctions ( std::set< CFunction * > &  functions,
CFunctionDB pFunctionDB 
) [static, protected]

Takes a set of functions and recursively finds functions used by those functions

const std::map< const CCopasiObject *, SBase * > & CSBMLExporter::getCOPASI2SBMLMap ( ) const

Returns a const pointer to the COPASI2SBMLMap.

SBMLDocument* CSBMLExporter::getSBMLDocument ( ) [inline]
ASTNode * CSBMLExporter::isDividedByVolume ( const ASTNode *  pRootNode,
const std::string &  compartmentId 
) [static, protected]

checks if the given ASTNode based tree is divided by the volume of the compartment identified by the given id string.

void CSBMLExporter::isEventAssignmentSBMLCompatible ( std::string &  key,
const CExpression pExpression,
const CCopasiDataModel dataModel,
unsigned int  sbmlLevel,
unsigned int  sbmlVersion,
const std::string &  eventName,
std::vector< SBMLIncompatibility > &  result 
) [static, protected]

This method checks if the given event assignment object is SBML compatible.

void CSBMLExporter::isEventSBMLCompatible ( const CEvent pEvent,
const CCopasiDataModel dataModel,
unsigned int  sbmlLevel,
unsigned int  sbmlVersion,
std::vector< SBMLIncompatibility > &  result 
) [static, protected]

This method checks if the given event object is SBML compatible.

void CSBMLExporter::isExpressionSBMLCompatible ( const CEvaluationTree expr,
const CCopasiDataModel dataModel,
int  sbmlLevel,
int  sbmlVersion,
std::vector< SBMLIncompatibility > &  result,
const std::string &  objectDescription,
bool  initialExpression = false 
) [static, protected]

Checks wether the rule in the given model entity can be exported to the specified version of SBML. If it can be exported, the result vector will be empty, otherwise it will contain a number of messages that specify why it can't be exported.

Checks whether the rule in the given model entity can be exported to the specified version of SBML. If it can be exported, the result vector will be empty, otherwise it will contain a number of messages that specify why it can't be exported.

static void CSBMLExporter::isExpressionSBMLL1Compatible ( const CEvaluationTree expr,
const CCopasiDataModel dataModel,
std::vector< SBMLIncompatibility > &  result 
) [static, protected]

Checks wether the rule in the given model entity can be exported to SBML Level2 Version1. If it can be exported, the result vector will be empty, otherwise it will contain a number of messages that specify why it can't be exported.

static void CSBMLExporter::isExpressionSBMLL2V1Compatible ( const CEvaluationTree expr,
const CCopasiDataModel dataModel,
std::vector< SBMLIncompatibility > &  result 
) [static, protected]

Checks wether the rule in the given model entity can be exported to SBML Level2 Version1. If it can be exported, the result vector will be empty, otherwise it will contain a number of messages that specify why it can't be exported.

static void CSBMLExporter::isExpressionSBMLL2V3Compatible ( const CEvaluationTree expression,
const CCopasiDataModel pDataModel,
std::vector< SBMLIncompatibility > &  result 
) [static, protected]

Checks wether the rule in the given model entity can be exported to SBML Level2 Version3. If it can be exported, the result vector will be empty, otherwise it will contain a number of messages that specify why it can't be exported.

const std::vector< SBMLIncompatibility > CSBMLExporter::isModelSBMLCompatible ( const CCopasiDataModel dataModel,
int  sbmlLevel,
int  sbmlVersion 
) [static]

Checks wether the given data model can be exported to a certain version of SBML. If it can be exported, the result vector will be empty, otherwise it will contain a number of messages that specify why it can't be exported.

Checks whether the given data model can be exported to a certain version of SBML. If it can be exported, the result vector will be empty, otherwise it will contain a number of messages that specify why it can't be exported.

void CSBMLExporter::isModelSBMLL1Compatible ( const CCopasiDataModel dataModel,
std::vector< SBMLIncompatibility > &  result 
) [static, protected]

Checks wether the given data model can be exported to SBML Level1 If it can be exported, the result vector will be empty, otherwise it will contain a number of messages that specify why it can't be exported.

Checks whether the given data model can be exported to SBML Level1 If it can be exported, the result vector will be empty, otherwise it will contain a number of messages that specify why it can't be exported.

void CSBMLExporter::isModelSBMLL2V1Compatible ( const CCopasiDataModel dataModel,
std::vector< SBMLIncompatibility > &  result 
) [static, protected]

Checks wether the given data model can be exported to SBML Level2 Version1. If it can be exported, the result vector will be empty, otherwise it will contain a number of messages that specify why it can't be exported.

Checks whether the given data model can be exported to SBML Level2 Version1. If it can be exported, the result vector will be empty, otherwise it will contain a number of messages that specify why it can't be exported.

void CSBMLExporter::isModelSBMLL2V3Compatible ( const CCopasiDataModel dataModel,
std::vector< SBMLIncompatibility > &  result 
) [static, protected]

Checks wether the given data model can be exported to SBML Level2 Version3. If it can be exported, the result vector will be empty, otherwise it will contain a number of messages that specify why it can't be exported.

Checks whether the given data model can be exported to SBML Level2 Version3. If it can be exported, the result vector will be empty, otherwise it will contain a number of messages that specify why it can't be exported.

bool CSBMLExporter::isSetExportCOPASIMIRIAM ( ) const

Returns whether the exporter is supposed to export COPASIs MIRIAM annotation in addition to SBML MIRIAM.

bool CSBMLExporter::isValidSId ( const std::string &  id) [static, protected]

Checks if the given string is a valid SId

std::vector< CModelEntity * > CSBMLExporter::orderRules ( const CCopasiDataModel dataModel) [protected]

Sorts the rules.

void CSBMLExporter::outputIncompatibilities ( ) const [protected]

Creates error messages from the list of incompatibilities and thows an exception.

void CSBMLExporter::removeInitialAssignment ( const std::string &  sbmlId) [protected]

Remove the initial assignment for the entity with the given id if there is any.

void CSBMLExporter::removeRule ( const std::string &  sbmlId) [protected]

Remove the rule for the entity with the given id if there is any.

void CSBMLExporter::removeUnusedObjects ( ) [protected]

Remove all compartments, species, parameters and reactions that did not end up in mHandledSBMLObjects during an export.

Remove all compartments, species, parameters and reactions and initial assignments that did not end up in mHandledSBMLObjects during an export.

void CSBMLExporter::replace_local_parameters ( ASTNode *  pOrigNode,
const CCopasiDataModel dataModel 
) [protected]

Goes through the expression tree and tries to find occurences of local parameters. If one is found, a global parameter is created and all references to the local parameters are substituted.

XMLNode * CSBMLExporter::replaceChild ( const XMLNode *  pParent,
const XMLNode *  pNewChild,
unsigned int  index 
) [protected]

This method creates a copy of parent where the child with the given index is replaced by the new child given as the second argument. If index is greater than the number of children - 1, NULL is returned.

This method creates a copy of parent where the child with the given index is replaced by the new child given as the second argument. If index is greater than the number of children - 1, NULL is returned. If the new child is a null pointer, this method deleted the old node at the given index.

ASTNode * CSBMLExporter::replaceL1IncompatibleNodes ( const ASTNode *  pNode) [static, protected]

This method goes through the ASTNode based tree rooted at pNode and replaces all unsupported nodes with constructs supported by SBML Level 1 The caller is responsible for freeing the memory of the returned object.

CEvaluationNode * CSBMLExporter::replaceSpeciesReferences ( const CEvaluationNode pOrigNode,
const CCopasiDataModel dataModel 
) [protected]

Replaces references to species with reference to species divided by volume if it is a reference to a concentration or by a reference to the species times avogadros number if it is a reference to the amount. The method also takes into consideration the substance units of the model.

void CSBMLExporter::restore_local_parameters ( ASTNode *  pOrigNode,
const CCopasiDataModel dataModel 
) [protected]

This method goes through the expression tree and tries to find node names that correspond to common names of local parameters. If the common name also occurs in the replacement map, the node name has to be set to the id of the corresponding global parameter, otherwise the name has to be set to the object name of the parameter.

void CSBMLExporter::setExportCOPASIMIRIAM ( bool  exportMIRIAM)

Sets whether the exporter is supposed to export COPASIs MIRIAM annotation in addition to SBML MIRIAM.

void CSBMLExporter::setFunctionSBMLIds ( const CEvaluationNode pNode,
CCopasiDataModel dataModel 
) [protected]

This method traverse a CEvaluationTree and set the SBML id on all functions that are used in function calls in the tree.

void CSBMLExporter::updateCOPASI2SBMLMap ( const CCopasiDataModel dataModel) [protected]

Creates a new COPASI2SBMLMap baed on the old map and the copied SBMLDocument.

bool CSBMLExporter::updateMIRIAMAnnotation ( const CCopasiObject pCOPASIObject,
SBase *  pSBMLObject,
std::map< std::string, const SBase * > &  metaIds 
) [protected]

This method gets the MIRIAM annotation from the given COPASI object and sets it on the given SBML object.

This method updates the MIRIAM annotation on different model entities like the model itself, compartments, species, reactions, functions and global parameters


Member Data Documentation

std::map<const CCopasiObject*, SBase*> CSBMLExporter::mCOPASI2SBMLMap [protected]
ListOfFunctionDefinitions CSBMLExporter::mExportedFunctions [protected]
std::map<std::string, const CEvaluationTree*> CSBMLExporter::mFunctionIdMap [protected]
std::map<const FunctionDefinition*, const CCopasiObject*> CSBMLExporter::mFunctionMap [protected]
std::set<SBase*> CSBMLExporter::mHandledSBMLObjects [protected]
std::map<std::string, const SBase*> CSBMLExporter::mIdMap [protected]
std::map<std::string, const SBase*> CSBMLExporter::mMetaIdMap [protected]
std::vector<CModelEntity*> CSBMLExporter::mODEVector [protected]
std::map<std::string, Parameter*> CSBMLExporter::mParameterReplacementMap [protected]
SBMLDocument* CSBMLExporter::mpSBMLDocument [protected]
unsigned int CSBMLExporter::mSBMLLevel [protected]
unsigned int CSBMLExporter::mSBMLVersion [protected]
std::set<std::string> CSBMLExporter::mSpatialSizeUnitsSpecies [protected]
std::set<CFunction*> CSBMLExporter::mUsedFunctions [protected]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines