29 using namespace SystemsBiologyWorkbench;
75 string tempFile =
"tmp.cps";
78 pDataModel->
saveModel(tempFile, NULL,
true);
79 std::ifstream ifs(tempFile.c_str());
80 std::string str((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
91 istringstream str(copasiString);
100 static string name(
"Copasi2SBML Translator");
101 return DataBlockWriter();
107 return DataBlockWriter() << version;
112 static string author(
"Frank T. Bergmann");
113 return DataBlockWriter() << author;
117 static string description(
"This converter converts a COPASI model to an SBML file");
118 return DataBlockWriter();
122 static string copy(
"(c) 2012 COPASI Team");
123 return DataBlockWriter() << copy;
127 static string url(
"http://copasi.org");
128 return DataBlockWriter() << url;
132 static string extension(
".cps");
133 return DataBlockWriter() << extension;
137 static string fileType(
"COPASI file");
138 return DataBlockWriter() << fileType;
142 std::string fileName; reader >> fileName;
143 return DataBlockWriter() << translateFileToSBML(fileName);
147 std::string model; reader >> model;
148 return DataBlockWriter() << translate(model);
152 std::string model; reader >> model;
153 return DataBlockWriter() << translateToSBML(model);
156 int main(
int argc,
char *argv[])
161 setlocale(LC_ALL,
"C");
162 bool doTranslate =
false;
165 for (
int i = 0; i < argc; i++)
167 string current(argv[i]);
169 if (current ==
"-f" && i + 1 < argc)
172 fileName = argv[i + 1];
184 "org.copasi.copasi2sbml",
185 "Copasi to SBML Translator",
188 modImpl.addServiceObject(
190 "Copasi2SBML Translator",
191 "plugin/sbmlTranslator/bidirectional",
194 modImpl.run(argc, argv);
196 catch (SBWException *e)
198 fprintf(stderr,
"Copasi2SBMLTranslator exception: %s\n", e->getMessage().c_str());
static bool remove(const std::string &path)
std::string exportSBMLToString(CProcessReport *pExportHandler, int sbmlLevel, int sbmlVersion)
static std::string fileName(const std::string &path)
static std::string getPWD(void)
int main(int argc, char *argv[])
SystemsBiologyWorkbench::DataBlockWriter getAuthor(SystemsBiologyWorkbench::Module from, SystemsBiologyWorkbench::DataBlockReader reader)
static std::string translateFileToSBML(const std::string &fileName)
static std::string translateToSBML(const std::string &copasiString)
SystemsBiologyWorkbench::DataBlockWriter getVersion(SystemsBiologyWorkbench::Module from, SystemsBiologyWorkbench::DataBlockReader reader)
SystemsBiologyWorkbench::DataBlockWriter getDescription(SystemsBiologyWorkbench::Module from, SystemsBiologyWorkbench::DataBlockReader reader)
bool loadModel(std::istream &in, const std::string &pwd, CProcessReport *pProcessReport, const bool &deleteOldData=true)
SystemsBiologyWorkbench::DataBlockWriter getURL(SystemsBiologyWorkbench::Module from, SystemsBiologyWorkbench::DataBlockReader reader)
bool saveModel(const std::string &fileName, CProcessReport *pProcessReport, bool overwriteFile=false, const bool &autoSave=false)
static void registerMethods(SystemsBiologyWorkbench::MethodTable< Copasi2SBMLTranslator > &table)
static void getValue(const std::string &name, CType &value)
static CCopasiDataModel * addDatamodel()
static std::string translate(const std::string &sbmlString)
SystemsBiologyWorkbench::DataBlockWriter getFileType(SystemsBiologyWorkbench::Module from, SystemsBiologyWorkbench::DataBlockReader reader)
bool importSBMLFromString(const std::string &sbmlDocumentText, CProcessReport *pImportHandler=NULL, const bool &deleteOldData=true)
SystemsBiologyWorkbench::DataBlockWriter getName(SystemsBiologyWorkbench::Module from, SystemsBiologyWorkbench::DataBlockReader reader)
static void init(int argc, char *argv[], const bool &withGui=false)
static bool makePathAbsolute(std::string &relativePath, const std::string &absoluteTo)
SystemsBiologyWorkbench::DataBlockWriter getCopyright(SystemsBiologyWorkbench::Module from, SystemsBiologyWorkbench::DataBlockReader reader)
SystemsBiologyWorkbench::DataBlockWriter getFileExtension(SystemsBiologyWorkbench::Module from, SystemsBiologyWorkbench::DataBlockReader reader)
virtual ~Copasi2SBMLTranslator()
static const CVersion VERSION