COPASI API
4.40.278
|
#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 () |
CDataModel * | getDataModel () |
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, VariableInfo > | TaskVarKey |
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 *, KeyComparer > | mDataGenerators |
bool | mExportActivePlotsOnly |
bool | mExportExecutableTasksOnly |
bool | mExportSpecificPlots |
std::unordered_set< std::string > | mGeneratedIds |
std::string | mModelId |
SedPlot2D * | mpCurrentPlot |
SedPlot3D * | mpCurrentPlot3D |
const CPlotSpecification * | mpCurrentSpec |
CCopasiTask * | mpCurrentTask |
SedDataGenerator * | mpCurrentTime |
CDataModel * | mpDataModel |
LIBSBML_CPP_NAMESPACE::XMLNamespaces * | mpSBMLNamespaces |
SedDocument * | mpSEDMLDocument |
SedUniformTimeCourse * | mpTimecourse |
SedTask * | mpTimecourseTask |
unsigned int | mSEDMLLevel |
unsigned int | mSEDMLVersion |
std::map< const CPlotItem *, std::string, PlotItemStyleComparer > | mStyleMap |
CCommonName | mTimeCN |
|
protected |
CSEDMLExporter::CSEDMLExporter | ( | ) |
constructs a new exporter element
CSEDMLExporter::~CSEDMLExporter | ( | ) |
destructor
References mpSBMLNamespaces, and pdelete.
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().
|
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().
void CSEDMLExporter::createDataGenerators | ( | std::string & | taskId, |
CCopasiTask * | task = NULL |
||
) |
Creates the data generators for SEDML.
References CCopasiMessage::ERROR, exportNthPlot(), exportReport(), CDataModel::getModel(), CDataModel::getPlotDefinitionList(), CCopasiTask::getReport(), CReport::getReportDefinition(), CReport::getTarget(), mCurrentTaskId, mpCurrentTask, mpDataModel, setCurrentTime(), CDataVector< CType >::size(), and CCopasiMessage::WARNING.
Referenced by createTasks().
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.
Creates the models for SEDML.
References CDirEntry::baseName(), mpSEDMLDocument, SEDML_SET_ID, and setModelId().
Referenced by createSEDMLDocument().
std::string CSEDMLExporter::createScanTask | ( | ) |
Creates a scan task if the dataModel contains a number of scan items and returns its id.
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().
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
dataModel | the data model to export |
modelRef | the location of the SBML model |
References clearMaps(), createModel(), createTasks(), mpSBMLNamespaces, mpSEDMLDocument, mSEDMLLevel, mSEDMLVersion, and setDataModel().
Referenced by exportModelAndTasksToString().
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().
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().
std::string CSEDMLExporter::createTimeCourseTask | ( | ) |
Creates the time course task and returns its id.
Creates the simulations for SEDML.
References exportAlgorithm(), CTrajectoryProblem::getDuration(), CModel::getInitialTime(), CCopasiTask::getMethod(), CDataModel::getModel(), SEDMLUtils::getNextId(), CTrajectoryProblem::getOutputStartTime(), CCopasiTask::getProblem(), CTrajectoryProblem::getStepNumber(), CTrajectoryProblem::getStepSize(), CDataModel::getTaskList(), min, mModelId, mpDataModel, mpSEDMLDocument, mpTimecourse, mpTimecourseTask, and SEDML_SET_ID.
Referenced by createTasks().
void CSEDMLExporter::exportAlgorithm | ( | SedAlgorithm * | alg, |
const CCopasiMethod * | pMethod | ||
) |
specifies the most specific KISAO terms for the given method
References CTaskEnum::adaptiveSA, CTaskEnum::deterministic, CTaskEnum::directMethod, CDataObject::getObjectName(), CCopasiParameterGroup::getParameter(), getParameterValueAsString(), CCopasiMethod::getSubType(), CTaskEnum::hybrid, CTaskEnum::hybridLSODA, CTaskEnum::hybridODE45, CTaskEnum::LSODA2, SEDMLUtils::PARAMETER_KISAO_MAP, CTaskEnum::RADAU5, CTaskEnum::stochastic, CTaskEnum::stochasticRunkeKuttaRI5, CTaskEnum::tauLeap, and CCopasiMessage::WARNING.
Referenced by createTimeCourseTask().
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.
dataModel | the copasi model to export |
sedmlFilename | the filename to write the SED-ML document to |
sbmlDocument | the sbml document as string |
sedmlLevel | the the SED-ML level (defaults to 1) |
sedmlVersion | the SED-ML version (defaults to 2) |
overwrite | boolean indicating whether the file should be overwritten (defaults to false) |
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().
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.
dataModel | the copasi model to export |
modelLocation | the location where the SBML file was exported to |
sedmlLevel | the SED-ML Level |
sedmlVersion | the SED-ML version |
References createSEDMLDocument(), setLevelAndVersion(), and writeSedMLToString().
Referenced by exportModelAndTasks(), and CDataModel::exportSEDMLToString().
void CSEDMLExporter::exportNthPlot | ( | const CPlotSpecification * | pPlot, |
size_t | n | ||
) |
References CPlotSpecification::appliesTo(), exportPlotItem(), CPlotSpecification::getItems(), CDataObject::getObjectName(), CPlotSpecification::isActive(), mCurrentTaskId, mExportActivePlotsOnly, mExportSpecificPlots, mpCurrentPlot, mpCurrentPlot3D, mpCurrentSpec, mpCurrentTask, mpDataModel, mpSEDMLDocument, SEDMLUtils::removeCharactersFromString(), SEDML_SET_ID, and CDataVector< CType >::size().
Referenced by createDataGenerators().
bool CSEDMLExporter::exportNthScanItem | ( | CScanProblem * | pProblem, |
size_t | n, | ||
SedRepeatedTask * | task | ||
) |
exports the nth scan item, to the given task.
References C_FLOAT64, C_INT32, SEDMLUtils::getNextId(), CDataContainer::getObject(), CCopasiParameterGroup::getParameter(), CScanProblem::getScanItem(), CCopasiParameter::getValue(), SEDMLUtils::getXPathForObject(), max, min, mModelId, mpDataModel, ResultParser::saveToDouble(), CScanProblem::SCAN_LINEAR, CScanProblem::SCAN_RANDOM, CScanProblem::SCAN_REPEAT, SEDML_SET_ID, SEDML_TIME_URN, ResultParser::split(), and CCopasiMessage::WARNING.
Referenced by createScanTask().
void CSEDMLExporter::exportPlotItem | ( | const CPlotItem * | pPlotItem, |
size_t | i, | ||
size_t | j | ||
) |
References CPlotItem::bandedGraph, createDataGenerator(), CPlotItem::curve2d, CObjectInterface::DataObject(), exportStyleForItem(), CPlotItem::getChannels(), CDataObject::getObjectFromCN(), CDataObject::getObjectName(), CPlotItem::getType(), CPlotSpecification::isLogX(), CPlotSpecification::isLogY(), mCurrentTaskId, mGeneratedIds, mpCurrentPlot, mpCurrentPlot3D, mpCurrentSpec, mpDataModel, mpSEDMLDocument, SEDML_SET_ID, CPlotItem::spectogram, and CCopasiMessage::WARNING.
Referenced by exportNthPlot().
void CSEDMLExporter::exportReport | ( | const CReportDefinition * | def | ) |
Exports the report for the given report definition
References createDataGenerator(), CObjectInterface::DataObject(), CReportDefinition::getBodyAddr(), CDataObject::getCN(), CReportDefinition::getHeaderAddr(), CDataObject::getObjectDisplayName(), CDataObject::getObjectFromCN(), CDataObject::getObjectName(), CReportDefinition::getSeparator(), CReportDefinition::getTableAddr(), CReportDefinition::isTable(), mCurrentTaskId, mpCurrentTime, mpDataModel, mpSEDMLDocument, mTimeCN, SEDMLUtils::removeCharactersFromString(), SEDML_SET_ID, and CCopasiMessage::WARNING.
Referenced by createDataGenerators().
std::string CSEDMLExporter::exportStyleForItem | ( | const CPlotItem * | pPlotItem | ) |
References SEDMLUtils::argbToRgba(), CPlotItem::bandedGraph, C_FLOAT64, C_INT32, SEDMLUtils::getNextId(), CPlotItem::getType(), CCopasiParameterGroup::getValue(), CPlotItem::LinesAndSymbols, SEDMLUtils::lineTypeToSed(), mpSEDMLDocument, mSEDMLVersion, mStyleMap, CPlotItem::Points, SEDML_SET_ID, CPlotItem::spectogram, CPlotItem::Symbols, and SEDMLUtils::symbolToSed().
Referenced by exportPlotItem().
void CSEDMLExporter::freeSedMLDocument | ( | ) |
frees the SED-ML document, and resets maps
References clearMaps(), mpSEDMLDocument, and pdelete.
CDataModel * CSEDMLExporter::getDataModel | ( | ) |
References mpDataModel.
bool CSEDMLExporter::getExportActivePlotsOnly | ( | ) | const |
References mExportActivePlotsOnly.
bool CSEDMLExporter::getExportExecutableTasksOnly | ( | ) | const |
References mExportExecutableTasksOnly.
bool CSEDMLExporter::getExportSpecificPlots | ( | ) | const |
References mExportSpecificPlots.
const std::string & CSEDMLExporter::getModelId | ( | ) | const |
References mModelId.
|
staticprotected |
A utility function returning the value of the copasi parameter as a std::string.
References CCopasiParameter::BOOL, C_FLOAT64, C_INT32, CCopasiParameter::CN, CCopasiParameter::DOUBLE, CCopasiParameter::getType(), CCopasiParameter::getValue(), CCopasiParameter::INT, CCopasiParameter::STRING, CCopasiParameter::UDOUBLE, and CCopasiParameter::UINT.
Referenced by exportAlgorithm().
LIBSEDML_CPP_NAMESPACE::SedDocument * CSEDMLExporter::getSEDMLDocument | ( | ) |
References mpSEDMLDocument.
void CSEDMLExporter::setCurrentTime | ( | std::string & | taskId | ) |
Initializes the data generator for model time and task
References CDataObject::getCN(), CDataModel::getModel(), CDataContainer::getObject(), CDataObject::getObjectName(), mDataGenerators, mpCurrentTime, mpDataModel, mTimeCN, SEDML_SET_ID, and SEDML_TIME_URN.
Referenced by createDataGenerators().
void CSEDMLExporter::setDataModel | ( | CDataModel * | pDataModel | ) |
References mpDataModel.
Referenced by createSEDMLDocument().
void CSEDMLExporter::setExportActivePlotsOnly | ( | bool | val | ) |
Specify whether only active plots should be exported
References mExportActivePlotsOnly.
void CSEDMLExporter::setExportExecutableTasksOnly | ( | bool | val | ) |
Specify whether only executable tasks should be exported
References mExportExecutableTasksOnly.
void CSEDMLExporter::setExportSpecificPlots | ( | bool | val | ) |
Specify whether plots should be exported only if they apply to the specific task
References mExportSpecificPlots.
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().
void CSEDMLExporter::setModelId | ( | const std::string & | val | ) |
specifies the SBML model id to be used by the task export.
References mModelId.
Referenced by createModel().
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
the | namespace to write out |
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
level | the level of the sbml document |
version | the 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().
bool CSEDMLExporter::writeSedMLToFile | ( | const std::string & | filename | ) | const |
writes the current SED-ML document to the given filename
filename | the file name to write to |
References mpSEDMLDocument, and CVersion::VERSION.
std::string CSEDMLExporter::writeSedMLToString | ( | ) | const |
References mpSEDMLDocument, and CVersion::VERSION.
Referenced by exportModelAndTasksToString().
|
protected |
Referenced by clearMaps(), createDataGenerators(), exportNthPlot(), exportPlotItem(), and exportReport().
|
protected |
Referenced by clearMaps(), createDataGenerator(), and setCurrentTime().
|
protected |
Referenced by exportNthPlot(), getExportActivePlotsOnly(), and setExportActivePlotsOnly().
|
protected |
Referenced by createTasks(), getExportExecutableTasksOnly(), and setExportExecutableTasksOnly().
|
protected |
Referenced by exportNthPlot(), getExportSpecificPlots(), and setExportSpecificPlots().
|
protected |
Referenced by clearMaps(), and exportPlotItem().
|
protected |
Referenced by createSteadyStateTask(), createTimeCourseTask(), exportNthScanItem(), getModelId(), and setModelId().
|
protected |
Referenced by clearMaps(), exportNthPlot(), and exportPlotItem().
|
protected |
Referenced by exportNthPlot(), and exportPlotItem().
|
protected |
Referenced by exportNthPlot(), and exportPlotItem().
|
protected |
Referenced by clearMaps(), createDataGenerators(), and exportNthPlot().
|
protected |
Referenced by clearMaps(), exportReport(), and setCurrentTime().
|
protected |
|
protected |
Referenced by createSEDMLDocument(), setSBMLNamespaces(), and ~CSEDMLExporter().
|
protected |
Referenced by createDataGenerator(), createModel(), createScanTask(), createSEDMLDocument(), createSteadyStateTask(), createTimeCourseTask(), exportNthPlot(), exportPlotItem(), exportReport(), exportStyleForItem(), freeSedMLDocument(), getSEDMLDocument(), writeSedMLToFile(), and writeSedMLToString().
|
protected |
Referenced by createTimeCourseTask().
|
protected |
Referenced by createScanTask(), and createTimeCourseTask().
|
protected |
Referenced by createSEDMLDocument(), and setLevelAndVersion().
|
protected |
Referenced by createSEDMLDocument(), exportStyleForItem(), and setLevelAndVersion().
|
protected |
Referenced by clearMaps(), and exportStyleForItem().
|
protected |
Referenced by exportReport(), and setCurrentTime().