Skip to content

Commit

Permalink
Include vcml file into OMEX archive for VCell-CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarupilla committed Dec 1, 2020
1 parent a866772 commit 49a3c4c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.vcell.util.gui.exporter;

import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Objects;

import cbit.vcell.xml.XmlHelper;
import org.vcell.sedml.SEDMLExporter;
import org.vcell.util.FileUtils;

Expand Down Expand Up @@ -34,6 +36,12 @@ public void writeBioModel(DocumentManager documentManager, BioModel bioModel, Fi
if (bioModel != null) {
sedmlExporter = new SEDMLExporter(bioModel, sedmlLevel, sedmlVersion);
resultString = sedmlExporter.getSEDMLFile(sPath);

// convert biomodel to vcml and save to file.
String vcmlString = XmlHelper.bioModelToXML(bioModel);
String vcmlFileName = Paths.get(sPath, sFile + ".vcml").toString();
File vcmlFile = new File(vcmlFileName);
XmlUtil.writeXMLStringToFile(vcmlString, vcmlFile.getAbsolutePath(), true);
} else {
throw new RuntimeException("unsupported Document Type " + Objects.requireNonNull(bioModel).getClass().getName() + " for SedML export");
}
Expand Down
7 changes: 7 additions & 0 deletions vcell-core/src/main/java/org/vcell/sedml/SEDMLExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,13 @@ public boolean createOmexArchive(String srcFolder, String sFileName) {
);
}

archive.addFile(
Paths.get(srcFolder, sFileName + ".vcml").toString(),
sFileName + ".vcml",
KnownFormats.lookupFormat("vcml"),
false
);


archive.writeToFile(Paths.get(srcFolder, sFileName + ".omex").toString());

Expand Down

0 comments on commit 49a3c4c

Please sign in to comment.