Skip to content

Commit 1b68083

Browse files
Merge pull request #1627 from virtualcell/bsiosim_visual_results_fixes
Partial upgrade of libsedml, fixed cli plot bugs
2 parents 3331960 + bc21233 commit 1b68083

200 files changed

Lines changed: 15392 additions & 9665 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci_cd.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ jobs:
184184
mvn --batch-mode clean install dependency:copy-dependencies -Dgroups="${{ matrix.test-group }}"
185185
fi
186186
187-
# - name: Setup tmate session
188-
# uses: mxschmitt/action-tmate@v3
189-
# if: ${{ failure() }}
187+
- name: Setup tmate session
188+
uses: mxschmitt/action-tmate@v3
189+
if: ${{ failure() }}
190190

191191
CD:
192192
name: CD

vcell-cli/src/main/java/org/vcell/cli/run/ExecutionJob.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ public void executeArchive(boolean isBioSimSedml) throws BiosimulationsHdfWriter
141141

142142
private void executeSedmlDocument(String sedmlLocation, HDF5ExecutionResults cumulativeHdf5Results) throws IOException, PreProcessingException, ExecutionException {
143143
BiosimulationLog.instance().updateSedmlDocStatusYml(sedmlLocation, BiosimulationLog.Status.QUEUED);
144-
SedmlJob job = new SedmlJob(sedmlLocation, this.omexHandler, this.inputFile, this.outputDir, this.sedmlPath2d3d.toString(), this.cliRecorder, this.bKeepTempFiles, this.bExactMatchOnly, this.bSmallMeshOverride, this.logOmexMessage);
144+
SedMLJob job = new SedMLJob(sedmlLocation, this.omexHandler, this.inputFile, this.outputDir, this.sedmlPath2d3d.toString(), this.cliRecorder, this.bKeepTempFiles, this.bExactMatchOnly, this.bSmallMeshOverride);
145+
this.logOmexMessage.append("Processing ").append(job.SEDML_NAME).append(". ");
145146
SedmlStatistics stats = job.preProcessDoc();
146147
boolean hasSucceeded = job.simulateSedml(cumulativeHdf5Results);
147148
this.anySedmlDocumentHasSucceeded |= hasSucceeded;

vcell-cli/src/main/java/org/vcell/cli/run/RunUtils.java

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,15 @@
1414
import org.apache.commons.lang.StringUtils;
1515
import org.apache.logging.log4j.LogManager;
1616
import org.apache.logging.log4j.Logger;
17-
import org.jlibsedml.DataSet;
17+
import org.jlibsedml.components.SId;
18+
import org.jlibsedml.components.SedBase;
19+
import org.jlibsedml.components.SedML;
20+
import org.jlibsedml.components.dataGenerator.DataGenerator;
21+
import org.jlibsedml.components.output.DataSet;
1822
import org.jlibsedml.*;
23+
import org.jlibsedml.components.output.Output;
24+
import org.jlibsedml.components.output.Report;
25+
import org.jlibsedml.components.simulation.UniformTimeCourse;
1926
import org.vcell.cli.run.results.ValueHolder;
2027
import org.vcell.sbml.vcell.lazy.LazySBMLNonSpatialDataAccessor;
2128
import org.vcell.util.DataAccessException;
@@ -146,10 +153,11 @@ public static double[] interpLinear(double[] x, double[] y, double[] xi) throws
146153
return yi;
147154
}
148155

149-
public static HashMap<String, File> generateReportsAsCSV(SedML sedml, Map<DataGenerator, ValueHolder<LazySBMLNonSpatialDataAccessor>> organizedNonSpatialResults, File outDirForCurrentSedml) {
156+
public static HashMap<SId, File> generateReportsAsCSV(SedMLDataContainer sedmlContainer, Map<DataGenerator, ValueHolder<LazySBMLNonSpatialDataAccessor>> organizedNonSpatialResults, File outDirForCurrentSedml) {
150157
// finally, the real work
151-
HashMap<String, File> reportsHash = new HashMap<>();
152-
for (Output sedmlOutput : sedml.getOutputs()) {
158+
SedML sedML = sedmlContainer.getSedML();
159+
HashMap<SId, File> reportsHash = new HashMap<>();
160+
for (Output sedmlOutput : sedML.getOutputs()) {
153161
// We only want Reports
154162
if (!(sedmlOutput instanceof Report sedmlReport)) {
155163
if (logger.isDebugEnabled()) logger.info("Ignoring unsupported output `" + sedmlOutput.getId() + "` while CSV generation.");
@@ -168,11 +176,11 @@ public static HashMap<String, File> generateReportsAsCSV(SedML sedml, Map<DataGe
168176
* * we search the sbml model to find the vcell variable name associated with the urn
169177
*/
170178
try {
171-
List<DataSet> datasets = sedmlReport.getListOfDataSets();
179+
List<DataSet> datasets = sedmlReport.getDataSets();
172180
Map<DataSet, DataGenerator> dataGeneratorMapping = new LinkedHashMap<>();
173181
for (DataSet dataset : datasets) {
174-
DataGenerator referencedGenerator = sedml.getDataGeneratorWithId(dataset.getDataReference());
175-
if (referencedGenerator == null) throw new NullPointerException("SedML DataGenerator referenced by report is missing!");
182+
DataGenerator referencedGenerator = sedmlContainer.findDataGeneratorById(dataset.getDataReference());
183+
if (null == referencedGenerator) throw new IllegalArgumentException("Unable to find data generator referenced in dataset: " + dataset.getDataReference());
176184
if (!organizedNonSpatialResults.containsKey(referencedGenerator)) break;
177185
dataGeneratorMapping.put(dataset, referencedGenerator);
178186
}
@@ -184,22 +192,22 @@ public static HashMap<String, File> generateReportsAsCSV(SedML sedml, Map<DataGe
184192

185193
for (DataSet validDataSet: dataGeneratorMapping.keySet()) {
186194
DataGenerator referencedGenerator = dataGeneratorMapping.get(validDataSet);
187-
boolean isReservedVCellPrefix = validDataSet.getId().startsWith("__vcell_reserved_data_set_prefix__");
195+
boolean isReservedVCellPrefix = validDataSet.getId().string().startsWith("__vcell_reserved_data_set_prefix__");
188196
ValueHolder<LazySBMLNonSpatialDataAccessor> dataHolder = organizedNonSpatialResults.get(referencedGenerator);
189197

190198

191199
boolean timeAlreadyIncluded = false;
192200
int numTrials = dataHolder.listOfResultSets.size();
193201
for(int i = 0; i < numTrials; i++) {
194202
if (timeAlreadyIncluded) break;
195-
if (validDataSet.getId().contains("time_")) timeAlreadyIncluded = true;
203+
if (validDataSet.getId().string().contains("time_")) timeAlreadyIncluded = true;
196204
LazySBMLNonSpatialDataAccessor data = dataHolder.listOfResultSets.get(i);
197205

198-
String formattedId = isReservedVCellPrefix ? "VCell::" + validDataSet.getId().substring(34) : validDataSet.getId();
206+
String formattedId = isReservedVCellPrefix ? "VCell::" + validDataSet.getId().string().substring(34) : validDataSet.getId().string();
199207
sb.append(RunUtils.generateCsvItem(formattedId, ',', false, i, numTrials));
200208
sb.append(RunUtils.generateCsvItem(validDataSet.getLabel(), ',', true, i, numTrials));
201209
String referencedGeneratorName = referencedGenerator.getName() == null ? "" : referencedGenerator.getName();
202-
sb.append(RunUtils.generateCsvItem(referencedGeneratorName.isEmpty() ? referencedGenerator.getId() : referencedGenerator.getName(), ',', true, i, numTrials));
210+
sb.append(RunUtils.generateCsvItem(referencedGeneratorName.isEmpty() ? referencedGenerator.getId().string() : referencedGenerator.getName(), ',', true, i, numTrials));
203211
String[] dataStrings = Arrays.stream(data.getData().data()).boxed().map(String::valueOf).toArray(String[]::new);
204212
sb.append(String.join(",", dataStrings)).append('\n');
205213
} // end of trials loop
@@ -240,9 +248,9 @@ public static void zipResFiles(File dirFile) throws IOException {
240248

241249
// TODO: Add SED-ML name as base dirFile to avoid zipping all available CSV, PDF
242250
// Map for naming to extension
243-
Map<String, String> extensionListMap = new HashMap<String, String>() {{
244-
put("csv", "reports.zip");
245-
put("pdf", "plots.zip");
251+
Map<String, String> extensionListMap = new HashMap<>() {{
252+
this.put("csv", "reports.zip");
253+
this.put("pdf", "plots.zip");
246254
}};
247255

248256
for (String ext : extensionListMap.keySet()) {

0 commit comments

Comments
 (0)