Skip to content

Commit 1117dbd

Browse files
vasilescuvasilescu
authored andcommitted
Adding Reports to sed-ml exporting.
1 parent b61219c commit 1117dbd

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

vcell-core/src/main/java/org/vcell/sedml/SEDMLExporter.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@
3434
import org.jlibsedml.ComputeChange;
3535
import org.jlibsedml.Curve;
3636
import org.jlibsedml.DataGenerator;
37+
import org.jlibsedml.DataSet;
3738
import org.jlibsedml.Libsedml;
3839
import org.jlibsedml.Model;
3940
import org.jlibsedml.Notes;
4041
import org.jlibsedml.Parameter;
4142
import org.jlibsedml.Plot2D;
4243
import org.jlibsedml.Range;
4344
import org.jlibsedml.RepeatedTask;
45+
import org.jlibsedml.Report;
4446
import org.jlibsedml.SEDMLDocument;
4547
import org.jlibsedml.SEDMLTags;
4648
import org.jlibsedml.SedML;
@@ -739,22 +741,35 @@ private void translateBioModelToSedML(String savePath) {
739741

740742
if (!bSimHasHistogram) {
741743
String plot2dId = "plot2d_" + TokenMangler.mangleToSName(vcSimulation.getName());
744+
String reportId = "report_" + TokenMangler.mangleToSName(vcSimulation.getName());
742745
Plot2D sedmlPlot2d = new Plot2D(plot2dId, simContext.getName() + "plots");
746+
Report sedmlReport = new Report(reportId, simContext.getName() + "report");
747+
743748
sedmlPlot2d.addNote(createNotesElement("Plot of all variables and output functions from application '" + simContext.getName() + "' ; simulation '" + vcSimulation.getName() + "' in VCell model"));
744-
List<DataGenerator> dataGenerators = sedmlModel.getDataGenerators();
749+
sedmlReport.addNote(createNotesElement("Report of all variables and output functions from application '" + simContext.getName() + "' ; simulation '" + vcSimulation.getName() + "' in VCell model"));
750+
// List<DataGenerator> dataGenerators = sedmlModel.getDataGenerators();
745751
String xDataRef = sedmlModel.getDataGeneratorWithId(DATAGENERATOR_TIME_NAME + "_" + taskRef).getId();
752+
String xDatasetXId = "datasetX_" + DATAGENERATOR_TIME_NAME;
753+
DataSet dataSet = new DataSet(xDatasetXId, xDatasetXId, xDataRef, xDataRef);
754+
sedmlReport.addDataSet(dataSet);
755+
746756
// add a curve for each dataGenerator in SEDML model
747757
int curveCnt = 0;
748758
for (DataGenerator dataGenerator : dataGeneratorsOfSim) {
749759
// no curve for time, since time is xDateReference
750760
if (dataGenerator.getId().equals(xDataRef)) {
751761
continue;
752762
}
753-
String curveId = "curve_" + curveCnt++;
763+
String curveId = "curve_" + curveCnt;
764+
String datasetYId = "datasetY_" + curveCnt;
754765
Curve curve = new Curve(curveId, curveId, false, false, xDataRef, dataGenerator.getId());
755766
sedmlPlot2d.addCurve(curve);
767+
DataSet yDataSet = new DataSet(datasetYId, datasetYId, dataGenerator.getId(), dataGenerator.getId());
768+
sedmlReport.addDataSet(yDataSet);
769+
curveCnt++;
756770
}
757771
sedmlModel.addOutput(sedmlPlot2d);
772+
sedmlModel.addOutput(sedmlReport);
758773
}
759774
}
760775
} // end - for 'sims'

0 commit comments

Comments
 (0)