COPASI API  4.40.278
CSEDMLExporter Class Reference

#include <CSEDMLExporter.h>

Classes

struct  KeyComparer
 
struct  PlotItemStyleComparer
 

Public Member Functions

void clearMaps ()
 
void createDataGenerators (std::string &taskId, CCopasiTask *task=NULL)
 
std::string createModel (const std::string &modelRef)
 
std::string createScanTask ()
 
LIBSEDML_CPP_NAMESPACE::SedDocument * createSEDMLDocument (CDataModel &dataModel, std::string modelRef)
 
std::string createSteadyStateTask ()
 
void createTasks ()
 
std::string createTimeCourseTask ()
 
 CSEDMLExporter ()
 
void exportAlgorithm (SedAlgorithm *alg, const CCopasiMethod *pMethod)
 
bool exportModelAndTasks (CDataModel &dataModel, const std::string &sedmlFilename, const std::string &sbmlDocument, unsigned int sedmlLevel=1, unsigned int sedmlVersion=1, bool overwrite=false)
 
std::string exportModelAndTasksToString (CDataModel &dataModel, const std::string &modelLocation, unsigned int sedmlLevel, unsigned int sedmlVersion)
 
void exportNthPlot (const CPlotSpecification *pPlot, size_t n)
 
bool exportNthScanItem (CScanProblem *pProblem, size_t n, SedRepeatedTask *task)
 
void exportPlotItem (const CPlotItem *pPlotItem, size_t i, size_t j)
 
void exportReport (const CReportDefinition *def)
 
std::string exportStyleForItem (const CPlotItem *pPlotItem)
 
void freeSedMLDocument ()
 
CDataModelgetDataModel ()
 
bool getExportActivePlotsOnly () const
 
bool getExportExecutableTasksOnly () const
 
bool getExportSpecificPlots () const
 
const std::string & getModelId () const
 
LIBSEDML_CPP_NAMESPACE::SedDocument * getSEDMLDocument ()
 
void setCurrentTime (std::string &taskId)
 
void setDataModel (CDataModel *pDataModel)
 
void setExportActivePlotsOnly (bool val)
 
void setExportExecutableTasksOnly (bool val)
 
void setExportSpecificPlots (bool val)
 
void setLevelAndVersion (unsigned int sedmlLevel, unsigned int sedmlVersion)
 
void setModelId (const std::string &val)
 
void setSBMLNamespaces (const LIBSBML_CPP_NAMESPACE::XMLNamespaces &sbmlns)
 
void setSBMLNamespaces (int level, int version, const std::string &prefix="sbml")
 
bool writeSedMLToFile (const std::string &filename) const
 
std::string writeSedMLToString () const
 
 ~CSEDMLExporter ()
 

Protected Types

typedef std::pair< std::string, VariableInfoTaskVarKey
 

Protected Member Functions

SedDataGenerator * createDataGenerator (const VariableInfo &info, const std::string &taskId, size_t i, size_t j)
 

Static Protected Member Functions

static std::string getParameterValueAsString (const CCopasiParameter *pParameter)
 

Protected Attributes

std::string mCurrentTaskId
 
std::map< TaskVarKey, SedDataGenerator *, KeyComparermDataGenerators
 
bool mExportActivePlotsOnly
 
bool mExportExecutableTasksOnly
 
bool mExportSpecificPlots
 
std::unordered_set< std::string > mGeneratedIds
 
std::string mModelId
 
SedPlot2D * mpCurrentPlot
 
SedPlot3D * mpCurrentPlot3D
 
const CPlotSpecificationmpCurrentSpec
 
CCopasiTaskmpCurrentTask
 
SedDataGenerator * mpCurrentTime
 
CDataModelmpDataModel
 
LIBSBML_CPP_NAMESPACE::XMLNamespaces * mpSBMLNamespaces
 
SedDocument * mpSEDMLDocument
 
SedUniformTimeCourse * mpTimecourse
 
SedTask * mpTimecourseTask
 
unsigned int mSEDMLLevel
 
unsigned int mSEDMLVersion
 
std::map< const CPlotItem *, std::string, PlotItemStyleComparermStyleMap
 
CCommonName mTimeCN
 

Member Typedef Documentation

◆ TaskVarKey

typedef std::pair< std::string, VariableInfo > CSEDMLExporter::TaskVarKey
protected

Constructor & Destructor Documentation

◆ CSEDMLExporter()

CSEDMLExporter::CSEDMLExporter ( )

constructs a new exporter element

◆ ~CSEDMLExporter()

CSEDMLExporter::~CSEDMLExporter ( )

destructor

References mpSBMLNamespaces, and pdelete.

Member Function Documentation

◆ clearMaps()

void CSEDMLExporter::clearMaps ( )

resets the internal map of created elements (will be called automatically by createSEDMLDocument())

References mCurrentTaskId, mDataGenerators, mGeneratedIds, mpCurrentPlot, mpCurrentTask, mpCurrentTime, and mStyleMap.

Referenced by createSEDMLDocument(), and freeSedMLDocument().

◆ createDataGenerator()

SedDataGenerator * CSEDMLExporter::createDataGenerator ( const VariableInfo info,
const std::string &  taskId,
size_t  i,
size_t  j 
)
protected

Helper function for creating data generators. They will just reference the element with given SBML id, and target xpath expression.

References VariableInfo::addToDataGenerator(), VariableInfo::getName(), VariableInfo::getSbmlId(), mDataGenerators, mpSEDMLDocument, and SEDML_SET_ID.

Referenced by exportPlotItem(), and exportReport().

◆ createDataGenerators()

◆ createModel()

std::string CSEDMLExporter::createModel ( const std::string &  modelRef)

Creates a SED-ML model for the given model reference. This function is supposed to be executed before exporting tasks, as it will generate the model id that will be used for further exports.

Returns
the model id created

Creates the models for SEDML.

References CDirEntry::baseName(), mpSEDMLDocument, SEDML_SET_ID, and setModelId().

Referenced by createSEDMLDocument().

◆ createScanTask()

std::string CSEDMLExporter::createScanTask ( )

Creates a scan task if the dataModel contains a number of scan items and returns its id.

Returns
the id of the task, if created, otherwise an empty string.

Creates the simulations for SEDML.

References createSteadyStateTask(), exportNthScanItem(), CScanProblem::getContinueFromCurrentState(), SEDMLUtils::getNextId(), CScanProblem::getNumberOfScanItems(), CCopasiTask::getProblem(), CScanProblem::getSubtask(), CDataModel::getTaskList(), mpDataModel, mpSEDMLDocument, mpTimecourseTask, SEDML_SET_ID, CTaskEnum::steadyState, CTaskEnum::timeCourse, and CCopasiMessage::WARNING.

Referenced by createTasks().

◆ createSEDMLDocument()

LIBSEDML_CPP_NAMESPACE::SedDocument * CSEDMLExporter::createSEDMLDocument ( CDataModel dataModel,
std::string  modelRef 
)

Creates an SED-ML document from the given data model. It assumes that the SBML model has been exported to the given model location

Parameters
dataModelthe data model to export
modelRefthe location of the SBML model
Returns
the created SED-ML document

References clearMaps(), createModel(), createTasks(), mpSBMLNamespaces, mpSEDMLDocument, mSEDMLLevel, mSEDMLVersion, and setDataModel().

Referenced by exportModelAndTasksToString().

◆ createSteadyStateTask()

std::string CSEDMLExporter::createSteadyStateTask ( )

Creates the steady state task and returns its id.

Creates the simulations for SEDML.

References SEDMLUtils::getNextId(), CCopasiTask::getProblem(), CDataModel::getTaskList(), mModelId, mpDataModel, mpSEDMLDocument, and SEDML_SET_ID.

Referenced by createScanTask().

◆ createTasks()

void CSEDMLExporter::createTasks ( )

Creates the SED-ML Tasks for the data model, assuming the model has already been created.

Before executing this method the model should have been created using createModel, or the model id should have been set with setModelId.

Creates the Tasks for SEDML. This will always create a task running a time course simulation. If the parameter scan has been specified, it will be exported as well.

References createDataGenerators(), createScanTask(), createTimeCourseTask(), CDataModel::getTaskList(), CCopasiTask::isScheduled(), mExportExecutableTasksOnly, and mpDataModel.

Referenced by createSEDMLDocument().

◆ createTimeCourseTask()

◆ exportAlgorithm()

◆ exportModelAndTasks()

bool CSEDMLExporter::exportModelAndTasks ( CDataModel dataModel,
const std::string &  filename,
const std::string &  sbmlDocument,
unsigned int  sedmlLevel = 1,
unsigned int  sedmlVersion = 1,
bool  overwrite = false 
)

Export the model and Task to SEDML. This legacy version requires that the SBML document is passed as string and is kept only for compatibility reasons.

Parameters
dataModelthe copasi model to export
sedmlFilenamethe filename to write the SED-ML document to
sbmlDocumentthe sbml document as string
sedmlLevelthe the SED-ML level (defaults to 1)
sedmlVersionthe SED-ML version (defaults to 2)
overwriteboolean indicating whether the file should be overwritten (defaults to false)
Returns
success / failure. If the export fails, false is returned.

Export the model and Task to SEDML. The SEDML document is written to the file given by SEDMLFilename and reference SBML model is written to SBMLFilename . If the export fails, false is returned.

References createUniqueModelFileName(), CDirEntry::dirName(), CCopasiMessage::ERROR, exportModelAndTasksToString(), CLocaleString::fromUtf8(), MCDirEntry, and CDirEntry::Separator.

Referenced by CDataModel::exportSEDML().

◆ exportModelAndTasksToString()

std::string CSEDMLExporter::exportModelAndTasksToString ( CDataModel dataModel,
const std::string &  modelLocation,
unsigned int  sedmlLevel,
unsigned int  sedmlVersion 
)

Export the model and Task to SEDML. The SEDML document is returned as a string the model is not exported, instead the provided modelLocation will be referenced.

Parameters
dataModelthe copasi model to export
modelLocationthe location where the SBML file was exported to
sedmlLevelthe SED-ML Level
sedmlVersionthe SED-ML version
Returns
the SED-ML document as string

References createSEDMLDocument(), setLevelAndVersion(), and writeSedMLToString().

Referenced by exportModelAndTasks(), and CDataModel::exportSEDMLToString().

◆ exportNthPlot()

◆ exportNthScanItem()

◆ exportPlotItem()

◆ exportReport()

◆ exportStyleForItem()

◆ freeSedMLDocument()

void CSEDMLExporter::freeSedMLDocument ( )

frees the SED-ML document, and resets maps

References clearMaps(), mpSEDMLDocument, and pdelete.

◆ getDataModel()

CDataModel * CSEDMLExporter::getDataModel ( )

References mpDataModel.

◆ getExportActivePlotsOnly()

bool CSEDMLExporter::getExportActivePlotsOnly ( ) const
Returns
whether only active plots should be exported

References mExportActivePlotsOnly.

◆ getExportExecutableTasksOnly()

bool CSEDMLExporter::getExportExecutableTasksOnly ( ) const
Returns
whether only executable tasks should be exported

References mExportExecutableTasksOnly.

◆ getExportSpecificPlots()

bool CSEDMLExporter::getExportSpecificPlots ( ) const
Returns
whether only plots should be exported that apply to the specific task

References mExportSpecificPlots.

◆ getModelId()

const std::string & CSEDMLExporter::getModelId ( ) const
Returns
the SBML model id used

References mModelId.

◆ getParameterValueAsString()

std::string CSEDMLExporter::getParameterValueAsString ( const CCopasiParameter pParameter)
staticprotected

◆ getSEDMLDocument()

LIBSEDML_CPP_NAMESPACE::SedDocument * CSEDMLExporter::getSEDMLDocument ( )
Returns
the currently constructed SED-ML document

References mpSEDMLDocument.

◆ setCurrentTime()

void CSEDMLExporter::setCurrentTime ( std::string &  taskId)

◆ setDataModel()

void CSEDMLExporter::setDataModel ( CDataModel pDataModel)

References mpDataModel.

Referenced by createSEDMLDocument().

◆ setExportActivePlotsOnly()

void CSEDMLExporter::setExportActivePlotsOnly ( bool  val)

Specify whether only active plots should be exported

References mExportActivePlotsOnly.

◆ setExportExecutableTasksOnly()

void CSEDMLExporter::setExportExecutableTasksOnly ( bool  val)

Specify whether only executable tasks should be exported

References mExportExecutableTasksOnly.

◆ setExportSpecificPlots()

void CSEDMLExporter::setExportSpecificPlots ( bool  val)

Specify whether plots should be exported only if they apply to the specific task

References mExportSpecificPlots.

◆ setLevelAndVersion()

void CSEDMLExporter::setLevelAndVersion ( unsigned int  sedmlLevel,
unsigned int  sedmlVersion 
)

Sets the SED-ML Level and Version used to export

References mSEDMLLevel, and mSEDMLVersion.

Referenced by exportModelAndTasksToString().

◆ setModelId()

void CSEDMLExporter::setModelId ( const std::string &  val)

specifies the SBML model id to be used by the task export.

References mModelId.

Referenced by createModel().

◆ setSBMLNamespaces() [1/2]

void CSEDMLExporter::setSBMLNamespaces ( const LIBSBML_CPP_NAMESPACE::XMLNamespaces &  sbmlns)

sets the sbml namespaces

If set, the sbml namespaces specified will be written into the declaration of the sedml document

Parameters
thenamespace to write out

◆ setSBMLNamespaces() [2/2]

void CSEDMLExporter::setSBMLNamespaces ( int  level,
int  version,
const std::string &  prefix = "sbml" 
)

sets the sbml namespaces

If set, the sbml namespaces specified will be written into the declaration of the sedml document

Parameters
levelthe level of the sbml document
versionthe version of the sbml document @prefix the prefix of the namespace to use (defaults to sbml)

References mpSBMLNamespaces, and pdelete.

Referenced by CDataModel::exportSEDML(), and CDataModel::exportSEDMLToString().

◆ writeSedMLToFile()

bool CSEDMLExporter::writeSedMLToFile ( const std::string &  filename) const

writes the current SED-ML document to the given filename

Parameters
filenamethe file name to write to
Returns
boolean indicating success / failure

References mpSEDMLDocument, and CVersion::VERSION.

◆ writeSedMLToString()

std::string CSEDMLExporter::writeSedMLToString ( ) const
Returns
the current SED-ML document as string

References mpSEDMLDocument, and CVersion::VERSION.

Referenced by exportModelAndTasksToString().

Member Data Documentation

◆ mCurrentTaskId

std::string CSEDMLExporter::mCurrentTaskId
protected

◆ mDataGenerators

std::map< TaskVarKey, SedDataGenerator *, KeyComparer > CSEDMLExporter::mDataGenerators
protected

◆ mExportActivePlotsOnly

bool CSEDMLExporter::mExportActivePlotsOnly
protected

◆ mExportExecutableTasksOnly

bool CSEDMLExporter::mExportExecutableTasksOnly
protected

◆ mExportSpecificPlots

bool CSEDMLExporter::mExportSpecificPlots
protected

◆ mGeneratedIds

std::unordered_set< std::string > CSEDMLExporter::mGeneratedIds
protected

Referenced by clearMaps(), and exportPlotItem().

◆ mModelId

std::string CSEDMLExporter::mModelId
protected

◆ mpCurrentPlot

SedPlot2D* CSEDMLExporter::mpCurrentPlot
protected

◆ mpCurrentPlot3D

SedPlot3D* CSEDMLExporter::mpCurrentPlot3D
protected

Referenced by exportNthPlot(), and exportPlotItem().

◆ mpCurrentSpec

const CPlotSpecification* CSEDMLExporter::mpCurrentSpec
protected

Referenced by exportNthPlot(), and exportPlotItem().

◆ mpCurrentTask

CCopasiTask* CSEDMLExporter::mpCurrentTask
protected

◆ mpCurrentTime

SedDataGenerator* CSEDMLExporter::mpCurrentTime
protected

◆ mpDataModel

◆ mpSBMLNamespaces

LIBSBML_CPP_NAMESPACE::XMLNamespaces* CSEDMLExporter::mpSBMLNamespaces
protected

◆ mpSEDMLDocument

◆ mpTimecourse

SedUniformTimeCourse* CSEDMLExporter::mpTimecourse
protected

Referenced by createTimeCourseTask().

◆ mpTimecourseTask

SedTask* CSEDMLExporter::mpTimecourseTask
protected

◆ mSEDMLLevel

unsigned int CSEDMLExporter::mSEDMLLevel
protected

◆ mSEDMLVersion

unsigned int CSEDMLExporter::mSEDMLVersion
protected

◆ mStyleMap

std::map< const CPlotItem*, std::string, PlotItemStyleComparer > CSEDMLExporter::mStyleMap
protected

Referenced by clearMaps(), and exportStyleForItem().

◆ mTimeCN

CCommonName CSEDMLExporter::mTimeCN
protected

Referenced by exportReport(), and setCurrentTime().


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