COPASI API
4.40.278
|
#include <SEDMLImporter.h>
Public Member Functions | |
void | addCurveToCopasiPlot (LIBSEDML_CPP_NAMESPACE_QUALIFIER SedAbstractCurve *pCurve, CPlotSpecification *pPlot) |
void | addSurfaceToCopasiPlot (LIBSEDML_CPP_NAMESPACE_QUALIFIER SedSurface *pSurface, CPlotSpecification *pPlot) |
void | applyAlgorithm (CTrajectoryTask *tTask, const SedAlgorithm *alg) |
void | applyStyleToCopasiItem (LIBSEDML_CPP_NAMESPACE_QUALIFIER SedStyle *pStyle, CPlotItem *plItem) |
void | assignReportDefinitions (CDataVectorN< CCopasiTask > *pTaskList=NULL) |
virtual void | clearCallBack () |
void | clearDocument () |
void | deleteCopasiModel () |
const std::string | getArchiveFileName () |
CDataModel * | getDataModel () |
const CProcessReport * | getProcessReport () const |
SedDocument * | getSEDMLDocument () |
CModel * | importFirstSBMLModel () |
CModel * | importModel (const std::string &modelId) |
void | importOutputs () |
void | importReport (LIBSEDML_CPP_NAMESPACE_QUALIFIER SedReport *report) |
void | importTask (LIBSEDML_CPP_NAMESPACE_QUALIFIER SedAbstractTask *task, bool importModel=false, CDataVectorN< CCopasiTask > *pTaskList=NULL) |
void | importTasks (CDataVectorN< CCopasiTask > *pTaskList=NULL) |
void | initializeContent () |
CModel * | parseSEDML (const std::string &sedmlDocumentText, CDataModel *pDataModel, const SedmlImportOptions *pOptions=NULL) |
CModel * | readSEDML (std::string filename, CDataModel *pDataModel, const SedmlImportOptions *pOptions=NULL) |
std::string | resolveModelFile (const std::string &modelSource) |
void | restoreFunctionDB () |
SEDMLImporter () | |
void | setCopasiModel (CModel *pModel) |
void | setDataModel (CDataModel *pDataModel) |
void | setImportHandler (CProcessReport *pProcessReport) |
void | setSEDMLDocument (SedDocument *pDocument) |
void | updateContent (CDataModel::CContent &data, CDataModel &dm) |
void | updateCopasiTaskForSimulation (SedSimulation *sedmlsim, CDataVectorN< CCopasiTask > *pTaskList=NULL) |
~SEDMLImporter () | |
Static Public Member Functions | |
static LIBSEDML_CPP_NAMESPACE_QUALIFIER SedVectorRange * | convertSimpleFunctionalRange (LIBSEDML_CPP_NAMESPACE_QUALIFIER SedFunctionalRange *frange, LIBSEDML_CPP_NAMESPACE_QUALIFIER SedRepeatedTask *repeat) |
Static Protected Member Functions | |
static C_FLOAT64 | round (const C_FLOAT64 &x) |
Protected Attributes | |
std::string | mArchiveFileName |
CDataModel::CContent | mContent |
size_t | mhImportStep |
std::set< unsigned int > | mIgnoredSEDMLMessages |
std::string | mImportedModel |
unsigned C_INT32 | mImportStep |
bool | mIncompleteModel |
unsigned int | mLevel |
unsigned int | mOriginalLevel |
CModel * | mpCopasiModel |
CDataModel * | mpDataModel |
const SedmlImportOptions * | mpOptions |
CProcessReport * | mpProcessReport |
SedDocument * | mpSEDMLDocument |
std::map< CReportDefinition *, std::pair< std::string, std::string > > | mReportMap |
unsigned C_INT32 | mTotalSteps |
std::set< std::string > | mUsedSEDMLIds |
bool | mUsedSEDMLIdsPopulated |
unsigned int | mVersion |
Private Member Functions | |
void | mergeNestedSubtasks () |
SEDMLImporter::SEDMLImporter | ( | ) |
Constructor that initializes speciesMap and the FunctionDB object
References mIgnoredSEDMLMessages.
SEDMLImporter::~SEDMLImporter | ( | ) |
Destructor that does nothing.
References mReportMap.
void SEDMLImporter::addCurveToCopasiPlot | ( | LIBSEDML_CPP_NAMESPACE_QUALIFIER SedAbstractCurve * | pCurve, |
CPlotSpecification * | pPlot | ||
) |
adds the given SED-ML curve to the COPASI plot, if supported
prior to calling this function, please ensure to have the the document and model set already.
pCurve | the SED-ML curve, that may include a style |
pPlot | the COPASI plot specification to add the curve to |
References CPlotItem::addChannel(), applyStyleToCopasiItem(), CPlotItem::bandedGraph, CPlotSpecification::createItem(), CPlotItem::curve2d, CDataObject::getCN(), CDataObject::getObjectDisplayName(), CPlotSpecification::hasItem(), mpCopasiModel, mpSEDMLDocument, SEDMLUtils::resolveDatagenerator(), CPlotSpecification::setLogX(), CPlotSpecification::setLogY(), CCopasiParameterGroup::setValue(), and CCopasiMessage::WARNING.
Referenced by importOutputs().
void SEDMLImporter::addSurfaceToCopasiPlot | ( | LIBSEDML_CPP_NAMESPACE_QUALIFIER SedSurface * | pSurface, |
CPlotSpecification * | pPlot | ||
) |
adds the given SED-ML surface to the COPASI plot, if supported
prior to calling this function, please ensure to have the the document and model set already.
pSurface | the SED-ML surface, that may include a style |
pPlot | the COPASI plot specification to add the curve to |
References CPlotItem::addChannel(), applyStyleToCopasiItem(), CPlotSpecification::createItem(), CDataObject::getCN(), CDataObject::getObjectDisplayName(), CPlotSpecification::hasItem(), mpCopasiModel, mpSEDMLDocument, SEDMLUtils::resolveDatagenerator(), CPlotSpecification::setLogX(), CPlotSpecification::setLogY(), CCopasiParameterGroup::setValue(), CPlotItem::spectogram, and CCopasiMessage::WARNING.
Referenced by importOutputs().
void SEDMLImporter::applyAlgorithm | ( | CTrajectoryTask * | tTask, |
const SedAlgorithm * | alg | ||
) |
Updates the task / method settings from algorithm
tTask,the | time course task to update |
alg | the algorithm including algorithm parameters |
References CCopasiParameter::BOOL, C_FLOAT64, C_INT32, CCopasiParameter::CN, CCopasiParameter::DOUBLE, CCopasiTask::getMethod(), getMethodType(), CCopasiParameterGroup::getParameter(), CCopasiParameter::getType(), CCopasiParameter::getValue(), CCopasiParameter::INT, SEDMLUtils::PARAMETER_KISAO_MAP, CCopasiTask::setMethodType(), CCopasiParameter::setValue(), CCopasiParameter::STRING, CCopasiParameter::UDOUBLE, and CCopasiParameter::UINT.
Referenced by updateCopasiTaskForSimulation().
void SEDMLImporter::applyStyleToCopasiItem | ( | LIBSEDML_CPP_NAMESPACE_QUALIFIER SedStyle * | pStyle, |
CPlotItem * | plItem | ||
) |
applies the given style to a plot item
prior to calling this function, please ensure to have the the document and model set already.
pStyle | the SED-ML Style to apply |
plItem | the copasi plot item |
References CCopasiParameterGroup::assertParameter(), C_FLOAT64, C_INT32, SEDMLUtils::getAlphaFromRgba(), CCopasiParameter::INT, CPlotItem::Lines, CPlotItem::LinesAndSymbols, SEDMLUtils::lineTypeFromSed(), mpSEDMLDocument, SEDMLUtils::rgbaToArgb(), CCopasiParameterGroup::setValue(), SEDMLUtils::symbolFromSed(), and CPlotItem::Symbols.
Referenced by addCurveToCopasiPlot(), and addSurfaceToCopasiPlot().
void SEDMLImporter::assignReportDefinitions | ( | CDataVectorN< CCopasiTask > * | pTaskList = NULL | ) |
References CDataVectorN< CType >::add(), C_INVALID_INDEX, CDataVector< CType >::empty(), CDataVectorN< CType >::getIndex(), mContent, mReportMap, CDataModel::CContent::pReportDefinitionList, CDataModel::CContent::pTaskList, CReport::setAppend(), CReport::setConfirmOverwrite(), CReport::setReportDefinition(), and CReport::setTarget().
Referenced by parseSEDML().
|
virtual |
clears the currently set progress handler
References setImportHandler().
void SEDMLImporter::clearDocument | ( | ) |
frees the current SED-ML document
References mpSEDMLDocument, and pdelete.
|
static |
Utility function trying to convert the given Functional Range into a Vector Range
Only functional ranges that are simple transformation of another vector range are currently supported.
frange | the functional range to convert |
repeat | the repeated task worked on |
References pdelete, and CCopasiMessage::WARNING.
Referenced by importTask().
void SEDMLImporter::deleteCopasiModel | ( | ) |
This call deletes an existing COPASI model. The method can e.g. be called to clean up if an import fails.
References mpCopasiModel, and pdelete.
Referenced by CDataModel::importSEDML(), and CDataModel::importSEDMLFromString().
const std::string SEDMLImporter::getArchiveFileName | ( | ) |
References mArchiveFileName.
CDataModel * SEDMLImporter::getDataModel | ( | ) |
References mpDataModel.
const CProcessReport * SEDMLImporter::getProcessReport | ( | ) | const |
References mpProcessReport.
SedDocument * SEDMLImporter::getSEDMLDocument | ( | ) |
References mpSEDMLDocument.
CModel * SEDMLImporter::importFirstSBMLModel | ( | ) |
Imports the first viable SBML model
References CCopasiMessage::EXCEPTION, importModel(), MCSEDML, mpSEDMLDocument, and CCopasiMessage::WARNING.
Referenced by parseSEDML().
CModel * SEDMLImporter::importModel | ( | const std::string & | modelId | ) |
Imports the SBML model for the given model id
References applyAttributeChange(), SBMLImporter::deleteCopasiModel(), CCopasiMessage::EXCEPTION, CDirEntry::exist(), CModel::getActiveModelParameterSet(), mContent, CDataModel::CContent::mCopasi2SBMLMap, MCSEDML, mImportedModel, mpCopasiModel, mpDataModel, mpProcessReport, mpSEDMLDocument, CDataModel::CContent::pCurrentSBMLDocument, CDataModel::CContent::pListOfLayouts, SBMLImporter::readSBML(), resolveModelFile(), SBMLImporter::restoreFunctionDB(), SBMLImporter::setImportCOPASIMIRIAM(), SBMLImporter::setImportHandler(), CDataModel::setSBMLFileName(), CModelParameterSet::updateModel(), and CCopasiMessage::WARNING.
Referenced by importFirstSBMLModel(), and parseSEDML().
void SEDMLImporter::importOutputs | ( | ) |
References addCurveToCopasiPlot(), addSurfaceToCopasiPlot(), COutputDefinitionVector::createPlotSpec(), CDataModel::getCopasi2SBMLMap(), SEDMLUtils::getNextId(), CDataObject::getObjectDataModel(), CDataModel::getReportDefinitionList(), SedmlImportOptions::ignoreOutput(), importReport(), mContent, mpCopasiModel, mpDataModel, mpOptions, mpSEDMLDocument, CPlotItem::plot2d, CDataModel::CContent::pPlotDefinitionList, CPlotSpecification::setLogX(), CPlotSpecification::setLogY(), and CCopasiMessage::WARNING.
Referenced by parseSEDML().
void SEDMLImporter::importReport | ( | LIBSEDML_CPP_NAMESPACE_QUALIFIER SedReport * | report | ) |
imports the given report
prior to calling this function, please ensure to have the the document and model set already.
report | the SED-ML report to import |
References CReportDefinition::getBodyAddr(), CDataObject::getCN(), CReportDefinition::getHeaderAddr(), SEDMLUtils::getNextId(), SedmlImportOptions::getReportFile(), CReportDefinition::getSeparator(), isScan(), isTC(), mpCopasiModel, mpOptions, mpSEDMLDocument, mReportMap, SEDMLUtils::resolveDatagenerator(), CReportDefinition::setComment(), CReportDefinition::setIsTable(), and CReportDefinition::setSeparator().
Referenced by importOutputs().
void SEDMLImporter::importTask | ( | LIBSEDML_CPP_NAMESPACE_QUALIFIER SedAbstractTask * | task, |
bool | importModel = false , |
||
CDataVectorN< CCopasiTask > * | pTaskList = NULL |
||
) |
Imports the specified SED-ML task
task | the task to import |
importModel | if true, the model referenced from the task will be imported |
pTaskList | optional task list to import into |
References CScanProblem::addScanItem(), C_FLOAT64, C_INVALID_INDEX, CScanProblem::clearScanItems(), convertSimpleFunctionalRange(), CTaskFactory::create(), CDataVectorN< CType >::getIndex(), CCopasiTask::getProblem(), mContent, mImportedModel, mpCopasiModel, mpSEDMLDocument, CDataModel::CContent::pTaskList, SEDMLUtils::resolveXPath(), CTaskEnum::scan, CScanProblem::SCAN_LINEAR, CScanProblem::SCAN_REPEAT, CScanProblem::setContinueFromCurrentState(), CCopasiTask::setMathContainer(), CScanProblem::setOutputInSubtask(), CCopasiTask::setScheduled(), CScanProblem::setSubtask(), CCopasiParameterGroup::setValue(), CTaskEnum::steadyState, CTaskEnum::timeCourse, updateCopasiTaskForSimulation(), and CCopasiMessage::WARNING.
Referenced by importTasks(), and parseSEDML().
void SEDMLImporter::importTasks | ( | CDataVectorN< CCopasiTask > * | pTaskList = NULL | ) |
Import all tasks for the imported SBML model
References importTask(), mContent, mpSEDMLDocument, and CDataModel::CContent::pTaskList.
Referenced by parseSEDML().
void SEDMLImporter::initializeContent | ( | ) |
Initializes the content element from the currently set DataModel
References mContent, CDataModel::CContent::mCopasi2SBMLMap, CDataModel::CContent::mCopasi2SEDMLMap, NO_PARENT, CDataModel::CContent::pPlotDefinitionList, CDataModel::CContent::pReportDefinitionList, and CDataModel::CContent::pTaskList.
Referenced by parseSEDML().
|
private |
merge nested subtasks if needed (as that is really the only way COPASI can handle them. So if we have
repeatedTask1: subtask simulationTask1 repeatedTask2: subtask repeatedTask1 repeatedTask3: subtask repeatedTask2 repeatedTask4: subtask repeatedTask3
we move all the ranges changes from 3 to 4, then from 2 to 4, then 1 to 4 that way we preserve the order of scan items.
References mpSEDMLDocument.
Referenced by parseSEDML().
CModel * SEDMLImporter::parseSEDML | ( | const std::string & | sedmlDocumentText, |
CDataModel * | pDataModel, | ||
const SedmlImportOptions * | pOptions = NULL |
||
) |
Function parses an SEDML document with libsedml and converts it to a COPASI CModel object which is returned. Deletion of the returned pointer is up to the caller.
References CProcessReport::addItem(), assignReportDefinitions(), C_INT32, C_INVALID_INDEX, CCopasiMessage::ERROR, CCopasiMessage::ERROR_FILTERED, CCopasiMessage::EXCEPTION, CProcessReport::finishItem(), CDataModel::getModel(), SedmlImportOptions::getModelId(), SedmlImportOptions::getTaskId(), importFirstSBMLModel(), importModel(), importOutputs(), importTask(), importTasks(), initializeContent(), MCSEDML, mergeNestedSubtasks(), mhImportStep, mIgnoredSEDMLMessages, mImportStep, mpCopasiModel, mpDataModel, mpOptions, mpProcessReport, mpSEDMLDocument, mReportMap, mTotalSteps, mUsedSEDMLIdsPopulated, pdelete, CCopasiMessage::RAW, CProcessReport::setName(), setSEDMLDocument(), SedmlImportOptions::skipModelImport(), CCopasiMessage::WARNING, and CCopasiMessage::WARNING_FILTERED.
Referenced by CDataModel::importSEDMLFromString(), and readSEDML().
CModel * SEDMLImporter::readSEDML | ( | std::string | filename, |
CDataModel * | pDataModel, | ||
const SedmlImportOptions * | pOptions = NULL |
||
) |
Function reads an SEDML file with libsedml and converts it to a Copasi CModel
References CCopasiMessage::EXCEPTION, CLocaleString::fromUtf8(), MCSEDML, parseSEDML(), and CDataModel::setSEDMLFileName().
Referenced by CDataModel::importSEDML().
std::string SEDMLImporter::resolveModelFile | ( | const std::string & | modelSource | ) |
References CDirEntry::dirName(), CDirEntry::exist(), CDataModel::getReferenceDirectory(), CDataModel::getSEDMLFileName(), mpDataModel, and CDirEntry::Separator.
Referenced by importModel().
void SEDMLImporter::restoreFunctionDB | ( | ) |
not implemented
Referenced by CDataModel::importSEDML(), and CDataModel::importSEDMLFromString().
SEDMLImporter.cpp $Rev: $: Revision of last commit
: Author of last commit
: Date of last commit $HeadURL: $
void SEDMLImporter::setCopasiModel | ( | CModel * | pModel | ) |
Sets the copasi model to use (for time and object references)
pModel | the model |
References mpCopasiModel.
void SEDMLImporter::setDataModel | ( | CDataModel * | pDataModel | ) |
sets the data model to be used by the importer
References mpDataModel.
void SEDMLImporter::setImportHandler | ( | CProcessReport * | pProcessReport | ) |
sets a progress handler to inform about updates
References mpProcessReport.
Referenced by clearCallBack(), CDataModel::importSEDML(), and CDataModel::importSEDMLFromString().
void SEDMLImporter::setSEDMLDocument | ( | SedDocument * | pDocument | ) |
sets the sed-ml document that will be used by the importer
(the document will not be automatically deleted) manually call clearDocument to delete the existing document
References mLevel, mOriginalLevel, mpSEDMLDocument, and mVersion.
Referenced by parseSEDML().
void SEDMLImporter::updateContent | ( | CDataModel::CContent & | data, |
CDataModel & | dm | ||
) |
updates the provided content element with imported tasks / output elements
This is an internal function to be called before commonAfterLoad.
data | the content element to update |
dm | the data model to add elements to |
References CDataContainer::add(), mContent, CDataModel::CContent::mContentType, CDataModel::CContent::mCopasi2SBMLMap, CDataModel::CContent::mCopasi2SEDMLMap, mpCopasiModel, mpSEDMLDocument, CDataModel::CContent::pCurrentSBMLDocument, CDataModel::CContent::pCurrentSEDMLDocument, CDataModel::CContent::pListOfLayouts, CDataModel::CContent::pModel, CDataModel::CContent::pPlotDefinitionList, CDataModel::CContent::pReportDefinitionList, CDataModel::CContent::pTaskList, and CDataModel::SEDML.
Referenced by CDataModel::importSEDML(), and CDataModel::importSEDMLFromString().
void SEDMLImporter::updateCopasiTaskForSimulation | ( | SedSimulation * | sedmlsim, |
CDataVectorN< CCopasiTask > * | pTaskList = NULL |
||
) |
Updates COPASI tasks for a given SedML Simulation
Creates and returns a COPASI CTrajectoryTask from the SEDML simulation given as argument.
References applyAlgorithm(), C_INVALID_INDEX, CTaskFactory::create(), CCopasiMessage::EXCEPTION, CDataVectorN< CType >::getIndex(), CModelEntity::getInitialValueReference(), CModel::getMathContainer(), CTrajectoryProblem::getOutputStartTime(), CCopasiTask::getProblem(), mContent, mpCopasiModel, CDataModel::CContent::pTaskList, CTrajectoryProblem::setDuration(), CModel::setInitialTime(), CCopasiTask::setMathContainer(), CTrajectoryProblem::setOutputStartTime(), CCopasiTask::setScheduled(), CTrajectoryProblem::setStepNumber(), CTaskEnum::steadyState, CTaskEnum::timeCourse, and CModel::updateInitialValues().
Referenced by importTask().
|
protected |
Referenced by getArchiveFileName().
|
protected |
|
protected |
Referenced by parseSEDML().
|
protected |
Referenced by parseSEDML(), and SEDMLImporter().
|
protected |
Referenced by importModel(), and importTask().
|
protected |
Referenced by parseSEDML().
|
protected |
|
protected |
Referenced by setSEDMLDocument().
|
protected |
Referenced by setSEDMLDocument().
|
protected |
|
protected |
Referenced by getDataModel(), importModel(), importOutputs(), parseSEDML(), resolveModelFile(), and setDataModel().
|
protected |
Referenced by importOutputs(), importReport(), and parseSEDML().
|
protected |
Referenced by getProcessReport(), importModel(), parseSEDML(), and setImportHandler().
|
protected |
Referenced by addCurveToCopasiPlot(), addSurfaceToCopasiPlot(), applyStyleToCopasiItem(), clearDocument(), getSEDMLDocument(), importFirstSBMLModel(), importModel(), importOutputs(), importReport(), importTask(), importTasks(), mergeNestedSubtasks(), parseSEDML(), setSEDMLDocument(), and updateContent().
|
protected |
Referenced by assignReportDefinitions(), importReport(), parseSEDML(), and ~SEDMLImporter().
|
protected |
Referenced by parseSEDML().
|
protected |
|
protected |
Referenced by parseSEDML().
|
protected |
Referenced by setSEDMLDocument().