COPASI API  4.16.103
SEDMLImporter.h
Go to the documentation of this file.
1 // Copyright (C) 2013 - 2014 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 /**
7  * SEDMLImporter.h
8  * $Rev: $: Revision of last commit
9  * $Author: $: Author of last commit
10  * $Date: $: Date of last commit
11  * $HeadURL: $
12  * $Id:: $
13  */
14 
15 #ifndef SEDMLIMPORTER_H_
16 #define SEDMLIMPORTER_H_
17 
18 #include <string>
19 #include <map>
20 #include <set>
21 #include <utility>
22 
24 //#include "copasi/sbml/StdException.h"
25 #include "copasi/model/CModel.h"
26 
27 #include <sedml/common/sedmlfwd.h>
28 
29 class CTrajectoryTask;
30 class CCompartment;
31 class CMetab;
32 class Model;
33 class CProcessReport;
34 class CPlotSpecification;
35 class CReportDefinition;
36 
38 {
39 
40 protected:
41  static
42  C_FLOAT64 round(const C_FLOAT64 & x);
43 
44  static
45  bool areApproximatelyEqual(const double & x, const double & y, const double & t = 1e-9);
46 
47 protected:
48  std::string mArchiveFileName;
49  std::set<unsigned int> mIgnoredSEDMLMessages;
51  unsigned int mLevel;
52  unsigned int mOriginalLevel;
53  unsigned int mVersion;
54 
57 
58  SedDocument* mpSEDMLDocument;
59 
61  unsigned C_INT32 mImportStep;
62  size_t mhImportStep;
63  unsigned C_INT32 mTotalSteps;
64 
65  std::set<std::string> mUsedSEDMLIds;
67 
68  std::string mImportedModel;
69 
70  std::map<CReportDefinition*, std::string> mReportMap;
71 
72 public:
73  SEDMLImporter();
75 
76  const std::string getArchiveFileName();
77 
79  COutputDefinitionVector *pPlotList, CModel* pModel,
80  SedDocument *pSedDocument,
81  std::map<CCopasiObject*, SedBase*>& copasi2sedmlmap);
82 
83  /**
84  * Updates COPASI tasks for a given SedML Simulation
85  */
86  void updateCopasiTaskForSimulation(SedSimulation* sedmlsim,
87  std::map<CCopasiObject*, SedBase*>& copasi2sedmlmap);
88 
89  /**
90  * Imports the first viable SBML model
91  */
93  SBMLDocument *& pSBMLDocument,
94  std::map<CCopasiObject*, SBase*>& copasi2sbmlmap,
95  CListOfLayouts *& prLol,
96  CCopasiDataModel* pDataModel);
97 
98  /**
99  * Import all tasks for the imported SBML model
100  */
101  void importTasks(std::map<CCopasiObject*, SedBase*>& copasi2sedmlmap);
102 
103  CModel* readSEDML(std::string filename, CProcessReport* pImportHandler,
104  SBMLDocument *& pSBMLDocument, SedDocument*& pSedDocument,
105  std::map<CCopasiObject*, SedBase*>& copasi2sedmlmap,
106  std::map<CCopasiObject*, SBase*>& copasi2sbmlmap,
107  CListOfLayouts *& prLol,
108  COutputDefinitionVector * & plotList,
109  CCopasiDataModel* pDataModel);
110 
111  CModel* parseSEDML(const std::string& sedmlDocumentText, CProcessReport* pImportHandler,
112  SBMLDocument *& pSBMLDocument, SedDocument *& pSEDMLDocument,
113  std::map<CCopasiObject*, SedBase*>& copasi2sedmlmap,
114  std::map<CCopasiObject*, SBase*>& copasi2sbmlmap,
115  CListOfLayouts *& prLol,
116  COutputDefinitionVector *& plotList,
117  CCopasiDataModel* pDataModel);
118 
119  /**
120  * This call deletes an existing COPASI model.
121  * The method can e.g. be called to clean up if an import fails.
122  */
123  void deleteCopasiModel();
124 
125  void setImportHandler(CProcessReport* pHandler);
126 
128 
129  void restoreFunctionDB();
130 };
131 
132 #endif /* SEDMLIMPORTER_H_ */
std::set< unsigned int > mIgnoredSEDMLMessages
Definition: SEDMLImporter.h:49
std::set< std::string > mUsedSEDMLIds
Definition: SEDMLImporter.h:65
std::string mArchiveFileName
Definition: SEDMLImporter.h:48
bool mUsedSEDMLIdsPopulated
Definition: SEDMLImporter.h:66
void readListOfPlotsFromSedMLOutput(COutputDefinitionVector *pPlotList, CModel *pModel, SedDocument *pSedDocument, std::map< CCopasiObject *, SedBase * > &copasi2sedmlmap)
CModel * readSEDML(std::string filename, CProcessReport *pImportHandler, SBMLDocument *&pSBMLDocument, SedDocument *&pSedDocument, std::map< CCopasiObject *, SedBase * > &copasi2sedmlmap, std::map< CCopasiObject *, SBase * > &copasi2sbmlmap, CListOfLayouts *&prLol, COutputDefinitionVector *&plotList, CCopasiDataModel *pDataModel)
void deleteCopasiModel()
void updateCopasiTaskForSimulation(SedSimulation *sedmlsim, std::map< CCopasiObject *, SedBase * > &copasi2sedmlmap)
CModel * importFirstSBMLModel(CProcessReport *pImportHandler, SBMLDocument *&pSBMLDocument, std::map< CCopasiObject *, SBase * > &copasi2sbmlmap, CListOfLayouts *&prLol, CCopasiDataModel *pDataModel)
static bool areApproximatelyEqual(const double &x, const double &y, const double &t=1e-9)
const std::string getArchiveFileName()
CModel * parseSEDML(const std::string &sedmlDocumentText, CProcessReport *pImportHandler, SBMLDocument *&pSBMLDocument, SedDocument *&pSEDMLDocument, std::map< CCopasiObject *, SedBase * > &copasi2sedmlmap, std::map< CCopasiObject *, SBase * > &copasi2sbmlmap, CListOfLayouts *&prLol, COutputDefinitionVector *&plotList, CCopasiDataModel *pDataModel)
#define C_INT32
Definition: copasi.h:90
Definition: CMetab.h:178
unsigned int mLevel
Definition: SEDMLImporter.h:51
CProcessReport * mpImportHandler
Definition: SEDMLImporter.h:60
std::map< CReportDefinition *, std::string > mReportMap
Definition: SEDMLImporter.h:70
unsigned int mVersion
Definition: SEDMLImporter.h:53
CModel * mpCopasiModel
Definition: SEDMLImporter.h:56
static C_FLOAT64 round(const C_FLOAT64 &x)
void setImportHandler(CProcessReport *pHandler)
std::string mImportedModel
Definition: SEDMLImporter.h:68
SedDocument * mpSEDMLDocument
Definition: SEDMLImporter.h:58
unsigned int mOriginalLevel
Definition: SEDMLImporter.h:52
#define C_FLOAT64
Definition: copasi.h:92
unsigned C_INT32 mTotalSteps
Definition: SEDMLImporter.h:63
CProcessReport * getImportHandlerAddr()
size_t mhImportStep
Definition: SEDMLImporter.h:62
Definition: CModel.h:50
bool mIncompleteModel
Definition: SEDMLImporter.h:50
unsigned C_INT32 mImportStep
Definition: SEDMLImporter.h:61
CCopasiDataModel * mpDataModel
Definition: SEDMLImporter.h:55
void importTasks(std::map< CCopasiObject *, SedBase * > &copasi2sedmlmap)
void restoreFunctionDB()