Skip to content

Commit b3183a8

Browse files
authored
Merge pull request #1630 from virtualcell/dan-ss-results5
Dan ss results5
2 parents 9b9b383 + c212311 commit b3183a8

7 files changed

Lines changed: 63 additions & 98 deletions

File tree

vcell-core/src/main/java/cbit/vcell/simdata/DataSetControllerImpl.java

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2406,13 +2406,11 @@ public LangevinBatchResultSet getLangevinBatchResultSet(VCDataIdentifier vcdID)
24062406
ODEDataInfo odeDataInfo = new ODEDataInfo(vcdID.getOwner(), vcdID.getID(),
24072407
simData.getDataBlockTimeStamp(ODE_DATA, 0));
24082408
int keepAtMost = 10000;
2409-
File functionsFile = null;
2409+
File functionsFile = simData.getJobFunctionsFile();
24102410
LangevinBatchResultSet lbrs = new LangevinBatchResultSet(odeDataInfo);
24112411

24122412
File avg_file = simData.getLangevinFile(LangevinBatchResultSet.LangevinFileType.Avg);
24132413
if (avg_file != null && avg_file.exists()) {
2414-
// want to keep all results, so pass 0 for keepAtMost
2415-
// don't care about functions, so pass null for functionsFile
24162414
ODESimData odeSimData_avg = ODESimData.readIDADataFile(vcdID, avg_file, keepAtMost, functionsFile);
24172415
lbrs.setOdeSimDataAvg(odeSimData_avg);
24182416
}
@@ -2432,21 +2430,21 @@ public LangevinBatchResultSet getLangevinBatchResultSet(VCDataIdentifier vcdID)
24322430
lbrs.setOdeSimDataStd(odeSimData_std);
24332431
}
24342432

2435-
// TODO: call ODESimData readCSVDataFile(VCDataIdentifier vcdId, File csvFile) to read cluster analysis results
2436-
// File counts = simData.getLangevinFile(LangevinFileType.ClusterCounts);
2437-
// if (counts != null && counts.exists()) {
2438-
// lbrs.setClusterCounts(readCSVDataFile(vcdID, counts));
2439-
// }
2440-
//
2441-
// File mean = simData.getLangevinFile(LangevinFileType.ClusterMean);
2442-
// if (mean != null && mean.exists()) {
2443-
// lbrs.setClusterMeans(readCSVDataFile(vcdID, mean));
2444-
// }
2445-
//
2446-
// File overall = simData.getLangevinFile(LangevinFileType.ClusterOverall);
2447-
// if (overall != null && overall.exists()) {
2448-
// lbrs.setClusterOverall(readCSVDataFile(vcdID, overall));
2449-
// }
2433+
File counts = simData.getLangevinFile(LangevinBatchResultSet.LangevinFileType.ClusterCounts);
2434+
if (counts != null && counts.exists()) {
2435+
ODESimData odeSimData_clusterCounts = ODESimData.readCSVDataFile(vcdID, counts);
2436+
lbrs.setOdeSimDataClusterCounts(odeSimData_clusterCounts);
2437+
}
2438+
File mean = simData.getLangevinFile(LangevinBatchResultSet.LangevinFileType.ClusterMean);
2439+
if (mean != null && mean.exists()) {
2440+
ODESimData odeSimData_clusterMean = ODESimData.readCSVDataFile(vcdID, mean);
2441+
lbrs.setOdeSimDataClusterMean(odeSimData_clusterMean);
2442+
}
2443+
File overall = simData.getLangevinFile(LangevinBatchResultSet.LangevinFileType.ClusterOverall);
2444+
if (overall != null && overall.exists()) {
2445+
ODESimData odeSimData_clusterOverall = ODESimData.readCSVDataFile(vcdID, overall);
2446+
lbrs.setOdeSimDataClusterOverall(odeSimData_clusterOverall);
2447+
}
24502448

24512449
return lbrs;
24522450
} catch (IOException e) {

vcell-core/src/main/java/cbit/vcell/simdata/LangevinBatchResultSet.java

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77

88
public class LangevinBatchResultSet implements Serializable {
99

10-
private ODEDataInfo odeDataInfo;
11-
private ODESimData odeSimDataAvg;
12-
private ODESimData odeSimDataMax;
13-
private ODESimData odeSimDataMin;
14-
private ODESimData odeSimDataStd;
10+
private ODEDataInfo odeDataInfo = null;
11+
private ODESimData odeSimDataAvg = null;
12+
private ODESimData odeSimDataMax = null;
13+
private ODESimData odeSimDataMin = null;
14+
private ODESimData odeSimDataStd = null;
15+
private ODESimData odeSimDataClusterCounts = null;
16+
private ODESimData odeSimDataClusterMean = null;
17+
private ODESimData odeSimDataClusterOverall = null;
1518

1619
public enum LangevinFileType {
1720

@@ -41,22 +44,9 @@ public String buildFilename(String baseName) {
4144
}
4245
}
4346

44-
public LangevinBatchResultSet(
45-
ODEDataInfo odeDataInfo,
46-
ODESimData odeSimDataAvg,
47-
ODESimData odeSimDataMax,
48-
ODESimData odeSimDataMin,
49-
ODESimData odeSimDataStd) {
47+
public LangevinBatchResultSet(ODEDataInfo odeDataInfo) {
5048

5149
this.odeDataInfo = odeDataInfo;
52-
this.odeSimDataAvg = odeSimDataAvg;
53-
this.odeSimDataMax = odeSimDataMax;
54-
this.odeSimDataMin = odeSimDataMin;
55-
this.odeSimDataStd = odeSimDataStd;
56-
}
57-
58-
public LangevinBatchResultSet(ODEDataInfo odeDataInfo) {
59-
this(odeDataInfo, null, null, null, null);
6050
}
6151

6252
public ODEDataInfo getOdeDataInfo() {
@@ -90,5 +80,20 @@ public ODESimData getOdeSimDataStd() {
9080
public void setOdeSimDataStd(ODESimData odeSimDataStd) {
9181
this.odeSimDataStd = odeSimDataStd;
9282
}
83+
84+
public ODESimData getOdeSimDataClusterCounts() { return odeSimDataClusterCounts; }
85+
public void setOdeSimDataClusterCounts(ODESimData odeSimDataClusterCounts) {
86+
this.odeSimDataClusterCounts = odeSimDataClusterCounts;
87+
}
88+
89+
public ODESimData getOdeSimDataClusterMean() { return odeSimDataClusterMean; }
90+
public void setOdeSimDataClusterMean(ODESimData odeSimDataClusterMean) {
91+
this.odeSimDataClusterMean = odeSimDataClusterMean;
92+
}
93+
94+
public ODESimData getOdeSimDataClusterOverall() { return odeSimDataClusterOverall; }
95+
public void setOdeSimDataClusterOverall(ODESimData odeSimDataClusterOverall) {
96+
this.odeSimDataClusterOverall = odeSimDataClusterOverall;
97+
}
9398
}
9499

vcell-core/src/main/java/cbit/vcell/simdata/MergedData.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,5 +1160,10 @@ public ComsolSimFiles getComsolSimFiles() throws FileNotFoundException, DataAcce
11601160
throw new RuntimeException("MergedData.getComsolSimFiles() not yet implemented");
11611161
}
11621162

1163+
@Override
1164+
public File getJobFunctionsFile() throws FileNotFoundException {
1165+
throw new RuntimeException("MergedData.getJobFunctionsFile() not yet implemented");
1166+
}
1167+
11631168

11641169
}

vcell-core/src/main/java/cbit/vcell/simdata/SimulationData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,8 @@ private synchronized File getFirstJobFunctionsFile() throws FileNotFoundExceptio
626626
}
627627
}
628628

629-
630-
private synchronized File getJobFunctionsFile() throws FileNotFoundException {
629+
@Override
630+
public synchronized File getJobFunctionsFile() throws FileNotFoundException {
631631
File functionsFile = null;
632632
functionsFile = amplistorHelper.getFunctionsFile(false);
633633
if (functionsFile.exists()){

vcell-core/src/main/java/cbit/vcell/simdata/VCData.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,6 @@ public final double[][][] getSimDataTimeSeries(
226226

227227
public abstract boolean isComsol() throws DataAccessException, IOException;
228228

229+
public abstract File getJobFunctionsFile() throws FileNotFoundException;
230+
229231
}

vcell-core/src/main/java/cbit/vcell/solver/ode/ODESimData.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,6 @@ public void writeOut(DataOutputStream output) throws IOException {
408408
}
409409
}
410410

411-
// TODO: work in progress, untested
412411
public static ODESimData readCSVDataFile(VCDataIdentifier vcdId, File csvFile)
413412
throws DataAccessException {
414413

@@ -512,16 +511,6 @@ public static ODESimData readIDADataFile(VCDataIdentifier vcdId, File dataFile,
512511
}
513512

514513
// read functions file
515-
if(functionsFile == null) {
516-
// functionFile is being initialized in SimulationData.getJobFunctionsFile() which already
517-
// throws is the file doesn't exist, so we call explicitly with null here to skip functions loading
518-
// for langevin batch simulation results (where functionFile is meaningless)
519-
if (keepMost > 0) {
520-
odeSimData.trimRows(keepMost);
521-
}
522-
return odeSimData;
523-
}
524-
525514
if (!odeSimData.getColumnDescriptions(0).getName().equals(SimDataConstants.HISTOGRAM_INDEX_NAME)) {
526515
Vector<AnnotatedFunction> funcList;
527516
try {

vcell-core/src/test/java/cbit/vcell/simdata/LangevinResultsReadTest.java

Lines changed: 14 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -87,25 +87,18 @@ public static void setUp() throws IOException {
8787
ida_min_file = copyToPrimaryDir("SimID_303404574_0__Min.ida");
8888
ida_std_file = copyToPrimaryDir("SimID_303404574_0__Std.ida");
8989

90-
91-
92-
93-
// ida_0_File = File.createTempFile("SimID_284673710_0_", ".ida");
90+
// ida_1_File = File.createTempFile("SimID_284673710_0_", ".ida");
9491
// Resources.asByteSource(Resources.getResource("cbit/vcell/simdata/SimID_284673710_0_.ida"))
95-
// .copyTo(com.google.common.io.Files.asByteSink(ida_0_File));
92+
// .copyTo(com.google.common.io.Files.asByteSink(ida_1_File));
9693

9794
}
9895

9996
@AfterAll
10097
public static void tearDown() {
10198

10299
deleteRecursively(primaryDir);
103-
// ida_0_File.delete();
104100
// ida_1_File.delete();
105-
// ida_2_File.delete();
106-
// if (inputStream != null) {
107-
// inputStream.close();
108-
}
101+
}
109102

110103

111104
@Test
@@ -136,55 +129,28 @@ public void testReadData() throws IOException, DataAccessException, CacheExcepti
136129
ODESimData odeSimDataAvg = lbrs.getOdeSimDataAvg();
137130
assertNotNull(odeSimDataAvg, "Avg ODE data should be loaded");
138131
assertTrue(odeSimDataAvg.getMathName().contains(simID), "Avg ODE data mathName should contain the simulation ID");
139-
140132
// --- Minimal structural checks ---
141133
assertTrue(odeSimDataAvg.getDataColumnCount() > 0, "Avg ODE data should have at least one column");
142134
assertTrue(odeSimDataAvg.getRowCount() > 0, "Avg ODE data should have at least one row");
143135

136+
// Cluster Counts data loaded
137+
ODESimData odeSimDataClusterCounts = lbrs.getOdeSimDataClusterCounts();
138+
assertNotNull(odeSimDataClusterCounts, "Cluster Counts ODE data should be loaded");
139+
assertTrue(odeSimDataClusterCounts.getMathName().contains(simID), "Cluster Counts ODE data mathName should contain the simulation ID");
140+
// --- Minimal structural checks ---
141+
assertTrue(odeSimDataClusterCounts.getDataColumnCount() > 0, "Cluster Counts ODE data should have at least one column");
142+
assertTrue(odeSimDataClusterCounts.getRowCount() > 0, "Cluster Counts ODE data should have at least one row");
143+
144144
}
145145

146146
// @Test
147-
// @Disabled("Deprecated: postprocessing moved to solver")
148147
// public void testRead() throws IOException {
149148
//
150-
// // read the input data (3 .IDA files)
151-
// ODESolverResultSet osrs_0 = getOdeSolverResultSet(ida_0_File);
149+
// // read the input data
152150
// ODESolverResultSet osrs_1 = getOdeSolverResultSet(ida_1_File);
153-
// ODESolverResultSet osrs_2 = getOdeSolverResultSet(ida_2_File);
154-
//
155-
// Map<Integer, ODESolverResultSet> odeSolverResultSetMap = new LinkedHashMap<>();
156-
// odeSolverResultSetMap.put(0, osrs_0);
157-
// odeSolverResultSetMap.put(1, osrs_1);
158-
// odeSolverResultSetMap.put(2, osrs_2);
159-
//
160-
// LangevinPostProcessorInput lppInput = new LangevinPostProcessorInput(null, null);
161-
// lppInput.setFailed(false);
162-
// lppInput.setOdeSolverResultSetMap(odeSolverResultSetMap);
163-
//
164-
// // compute primary statistics
165-
// // note: LangevinPostProcessor is deprecated, but this test is kept for it contains some reusable code
166-
// LangevinPostProcessor lpp = new LangevinPostProcessor();
167-
// LangevinPostProcessorOutput lppOutput = lpp.postProcessLangevinResults(lppInput);
168-
//
169-
// assertFalse(lppOutput.isFailed(), "expected to not fail");
170-
// assertTrue(lppOutput.isMultiTrial(), "expected to be multi-trial");
171-
//
172-
// // get some timepoint for some variable
173-
// String name = osrs_0.getColumnDescriptions()[7].getName();
174-
// double anAverage = lppOutput.getAveragesResultSet().getRow(10)[7]; // TOTAL_MT0__Site1__state0
175-
// double aStd = lppOutput.getStdResultSet().getRow(10)[7];
176-
// double aMin = lppOutput.getMinResultSet().getRow(10)[7];
177-
// double aMax = lppOutput.getMaxResultSet().getRow(10)[7];
178-
//
179-
// // compare to what's expected
180-
// assertTrue("TOTAL_MT0__Site1__state0".contentEquals(name), "expecting column name 'TOTAL_MT0__Site1__state0', found: '" + name + "'");
181-
// assertTrue(anAverage == 21.0 ? true : false, "expecting 21.0, found " + anAverage);
182-
// assertTrue(aStd == 0.816496580927726 ? true : false, "expecting 0.816496580927726, found " + aStd);
183-
// assertTrue(aMin == 20.0 ? true : false, "expecting 20.0, found " + aMin);
184-
// assertTrue(aMax == 22.0 ? true : false, "expecting 22.0, found " + aMax);
151+
// assertNotNull(osrs_1, "Failed to read IDA file: " + ida_1_File.getAbsolutePath());
185152
// }
186153

187-
188154
private static void deleteRecursively(File file) {
189155
if (file == null || !file.exists()) {
190156
return;
@@ -206,7 +172,7 @@ private static File copyToPrimaryDir(String resourceName) throws IOException {
206172
return out;
207173
}
208174

209-
175+
// also see ODESimData.readIDADataFile()
210176
private static ODESolverResultSet getOdeSolverResultSet(File idaFile) throws IOException {
211177
ODESolverResultSet odeSolverResultSet = new ODESolverResultSet();
212178
FileInputStream inputStream = null;

0 commit comments

Comments
 (0)