Skip to content

Commit d643a55

Browse files
Alice FuAlice Fu
authored andcommitted
resolved issue with 0 DPN case of tfRatio differentiation branch, added wt testing for tfRatio daughterStem, replaced lower DPN with less
1 parent 72a408e commit d643a55

4 files changed

Lines changed: 91 additions & 88 deletions

File tree

input/1.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<set prefix="2026-03-06">
2-
<series name="vcv1_noreg_wt_mean0_sg26_vbcv" start="0" end="0"
2+
<series name="vcv1_noreg_wt_mean0_sg26_vbcv" start="0" end="8"
33
ds=".3" margin="0" height="1" length="600" width="600"
44
dt=".01667" ticks="2161" interval="2161">
55
<potts>
66
<potts.term id="volume" />
77
<potts.term id="adhesion" />
88
<potts.term id="surface" />
9-
<potts.parameter term="surface" id="LAMBDA" value=".3" target="fly-stem-wt"/>
10-
<potts.parameter term="surface" id="LAMBDA" value="0.5" target="fly-gmc"/>
9+
<potts.parameter term="surface" id="LAMBDA" value="0.5" target="fly-stem-wt"/>
10+
<potts.parameter term="surface" id="LAMBDA" value="1" target="fly-gmc"/>
1111
<potts.parameter term="surface" id="LAMBDA" value="2" target="fly-neuron"/>
1212
<potts.parameter id="TEMPERATURE" value="18"/>
13-
<potts.parameter term="adhesion" id="ADHESION" value="40" target="fly-stem-wt:*"/>
14-
<potts.parameter term="adhesion" id="ADHESION" value="40" target="fly-gmc:*"/>
15-
<potts.parameter term="adhesion" id="ADHESION" value="40" target="fly-neuron:*"/>
13+
<potts.parameter term="adhesion" id="ADHESION" value="80" target="fly-stem-wt:*"/>
14+
<potts.parameter term="adhesion" id="ADHESION" value="80" target="fly-gmc:*"/>
15+
<potts.parameter term="adhesion" id="ADHESION" value="80" target="fly-neuron:*"/>
1616
</potts>
1717
<agents>
1818
<populations>
@@ -27,9 +27,9 @@
2727
<population.parameter id="proliferation/APICAL_AXIS_RULESET" value="normal" />
2828
<population.parameter id="proliferation/APICAL_AXIS_ROTATION_DISTRIBUTION" value="NORMAL(MU=0,SIGMA=30)" />
2929

30-
<population.parameter id="proliferation/PROSPERO_RATE" value="20" />
31-
<population.parameter id="proliferation/DEADPAN_RATE" value="10" />
32-
<population.parameter id="proliferation/HAS_DETERMINISTIC_DIFFERENTIATION" value="FALSE"/>
30+
<population.parameter id="proliferation/PROSPERO_RATE" value="1" />
31+
<population.parameter id="proliferation/DEADPAN_RATE" value="0" />
32+
<population.parameter id="proliferation/HAS_DETERMINISTIC_DIFFERENTIATION" value="FALSE" />
3333
<population.parameter id="proliferation/DIFFERENTIATION_RULESET" value="tfRatio" />
3434
<population.parameter id="proliferation/TF_RATIO" value="2" />
3535
<population.parameter id="proliferation/APICAL_THRESHOLD" value="0.33" />

src/arcade/potts/agent/module/PottsModuleFlyStemProliferation.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public void addCell(MersenneTwisterFast random, Simulation sim) {
244244
boolean isDaughterStem =
245245
daughterStem(
246246
parentLoc, daughterLoc, divisionPlane, daughterProspero, daughterDeadpan);
247-
247+
System.out.println("daughterProspero=" + daughterProspero + ", daughterDeadpan=" + daughterDeadpan + ", basalFrac=" + basalFrac + ", daughterStem=" + isDaughterStem);
248248
if (isDaughterStem) {
249249
makeDaughterStemCell(
250250
daughterLoc, sim, potts, random, daughterProspero, daughterDeadpan);
@@ -463,7 +463,7 @@ private boolean daughterStemRuleBasedDifferentiation(
463463
} else if (differentiationRuleset.equals("tfRatio")) {
464464
System.out.println("WOO: Prospero comparison branch reached");
465465
if (daughterDeadpan <= 0) {
466-
return daughterProspero <= 0;
466+
return daughterProspero < 0;
467467
}
468468
return (daughterProspero / daughterDeadpan) <= tfRatio;
469469
}
@@ -763,7 +763,7 @@ private Location determineGMCLocation(
763763
case "location":
764764
return getBasalLocation(parentLoc, daughterLoc, divisionPlaneNormal);
765765
case "tfRatio":
766-
return getLowerDeadpanLocation(
766+
return getLessDeadpanLocation(
767767
parentLoc, parentDeadpan, daughterLoc, daughterDeadpan);
768768
default:
769769
throw new IllegalArgumentException(
@@ -827,16 +827,17 @@ public static PottsLocation getBasalLocation(
827827
}
828828

829829
/**
830-
* Gets the location with lower Deadpan and returns it.
830+
* Gets the location with less Deadpan and returns it.
831831
*
832832
* @param loc1 the {@link PottsLocation} to compare.
833833
* @param deadpan1 the amount of deadpan in loc1.
834834
* @param loc2 {@link PottsLocation} to compare.
835835
* @param deadpan2 the amount of deadpan in loc2.
836836
* @return the smaller location.
837837
*/
838-
public static Location getLowerDeadpanLocation(
838+
public static Location getLessDeadpanLocation(
839839
Location loc1, double deadpan1, Location loc2, double deadpan2) {
840+
System.out.println("getting less deadpan location");
840841
return (deadpan2 - deadpan1 <= EPSILON) ? loc2 : loc1;
841842
}
842843

test/arcade/potts/PottsARCADETest.java

Lines changed: 52 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -141,60 +141,58 @@ private void removeKey(JsonElement element, String key) {
141141
}
142142
}
143143
}
144-
145-
//
146-
//
147-
// @Test
148-
// public void main_noVis_fileComparison(@TempDir Path path) throws Exception {
149-
// // Expects an input file at input/[name].xml and expected output files in
150-
// // expected/[name]-expected
151-
// String[] names = {"1"};
152-
//
153-
// for (String name : names) {
154-
// String inputFile = name + ".xml";
155-
// File expectedDir = new File("output/" + name + "-expected");
156-
//
157-
// Path source = Path.of("input", inputFile);
158-
// Path setupFile = path.resolve(name + ".xml");
159-
//
160-
// Files.copy(source, setupFile);
161-
//
162-
// String[] args =
163-
// new String[] {
164-
// "potts",
165-
// setupFile.toString(),
166-
// path.toAbsolutePath().toString(),
167-
// "--loadpath",
168-
// "input/",
169-
// "--locations"
170-
// };
171-
// ARCADE.main(args);
172-
//
173-
// File[] expectedFiles = expectedDir.listFiles();
174-
// assertNotNull(expectedFiles, "Expected directory not found or empty: " +
175-
// expectedDir);
176-
//
177-
// for (File expectedFile : expectedFiles) {
178-
// File actualFile = new File(path.toFile(), expectedFile.getName());
179-
//
180-
// assertTrue(actualFile.exists());
181-
//
182-
// JsonElement expectedJson =
183-
// JsonParser.parseString(Files.readString(expectedFile.toPath()));
184-
// JsonElement actualJson =
185-
// JsonParser.parseString(Files.readString(actualFile.toPath()));
186-
//
187-
// // Remove version field because executable name is nondeterministic
188-
// removeKey(expectedJson, "version");
189-
// removeKey(actualJson, "version");
190-
//
191-
// removeKey(expectedJson, "proliferation/DIFFERENTIATION_RULESET");
192-
// removeKey(actualJson, "proliferation/DIFFERENTIATION_RULESET");
193-
//
194-
// assertJsonEquals(expectedJson, actualJson, expectedFile.getName());
195-
// }
196-
// }
197-
// }
144+
//
145+
// @Test
146+
// public void main_noVis_fileComparison(@TempDir Path path) throws Exception {
147+
// // Expects an input file at input/[name].xml and expected output files in
148+
// // expected/[name]-expected
149+
// String[] names = {"1"};
150+
//
151+
// for (String name : names) {
152+
// String inputFile = name + ".xml";
153+
// File expectedDir = new File("output/" + name + "-expected");
154+
//
155+
// Path source = Path.of("input", inputFile);
156+
// Path setupFile = path.resolve(name + ".xml");
157+
//
158+
// Files.copy(source, setupFile);
159+
//
160+
// String[] args =
161+
// new String[] {
162+
// "potts",
163+
// setupFile.toString(),
164+
// path.toAbsolutePath().toString(),
165+
// "--loadpath",
166+
// "input/",
167+
// "--locations"
168+
// };
169+
// ARCADE.main(args);
170+
//
171+
// File[] expectedFiles = expectedDir.listFiles();
172+
// assertNotNull(expectedFiles, "Expected directory not found or empty: " +
173+
// expectedDir);
174+
//
175+
// for (File expectedFile : expectedFiles) {
176+
// File actualFile = new File(path.toFile(), expectedFile.getName());
177+
//
178+
// assertTrue(actualFile.exists());
179+
//
180+
// JsonElement expectedJson =
181+
// JsonParser.parseString(Files.readString(expectedFile.toPath()));
182+
// JsonElement actualJson =
183+
// JsonParser.parseString(Files.readString(actualFile.toPath()));
184+
//
185+
// // Remove version field because executable name is nondeterministic
186+
// removeKey(expectedJson, "version");
187+
// removeKey(actualJson, "version");
188+
//
189+
// removeKey(expectedJson, "proliferation/DIFFERENTIATION_RULESET");
190+
// removeKey(actualJson, "proliferation/DIFFERENTIATION_RULESET");
191+
//
192+
// assertJsonEquals(expectedJson, actualJson, expectedFile.getName());
193+
// }
194+
// }
195+
// }
198196

199197
@Test
200198
public void getResource_requiredFiles_returnsResource() {

test/arcade/potts/agent/module/PottsModuleFlyStemProliferationTest.java

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -245,38 +245,38 @@ public void getBasalLocation_centroidsSame_returnsFirstLocation() {
245245
}
246246

247247
@Test
248-
public void getLowerDeadpanLocation_loc1HasLessDeadpan_returnsLoc1() {
248+
public void getLessDeadpanLocation_loc1HasLessDeadpan_returnsLoc1() {
249249
PottsLocation loc1 = mock(PottsLocation.class);
250250
PottsLocation loc2 = mock(PottsLocation.class);
251251
Location gmc =
252-
PottsModuleFlyStemProliferation.getLowerDeadpanLocation(loc1, 1.0, loc2, 5.0);
252+
PottsModuleFlyStemProliferation.getLessDeadpanLocation(loc1, 1.0, loc2, 5.0);
253253
assertEquals(loc1, gmc);
254254
}
255255

256256
@Test
257-
public void getLowerDeadpanLocation_loc2HasLessDeadpan_returnsLoc2() {
257+
public void getLessDeadpanLocation_loc2HasLessDeadpan_returnsLoc2() {
258258
PottsLocation loc1 = mock(PottsLocation.class);
259259
PottsLocation loc2 = mock(PottsLocation.class);
260260
Location gmc =
261-
PottsModuleFlyStemProliferation.getLowerDeadpanLocation(loc1, 5.0, loc2, 1.0);
261+
PottsModuleFlyStemProliferation.getLessDeadpanLocation(loc1, 5.0, loc2, 1.0);
262262
assertEquals(loc2, gmc);
263263
}
264264

265265
@Test
266-
public void getLowerDeadpanLocation_equalDeadpan_returnsSecondLocation() {
266+
public void getLessDeadpanLocation_equalDeadpan_returnsSecondLocation() {
267267
PottsLocation loc1 = mock(PottsLocation.class);
268268
PottsLocation loc2 = mock(PottsLocation.class);
269269
Location gmc =
270-
PottsModuleFlyStemProliferation.getLowerDeadpanLocation(loc1, 2.5, loc2, 2.5);
270+
PottsModuleFlyStemProliferation.getLessDeadpanLocation(loc1, 2.5, loc2, 2.5);
271271
assertEquals(loc2, gmc);
272272
}
273273

274274
@Test
275-
public void getLowerDeadpanLocation_bothZero_returnsSecondLocation() {
275+
public void getLessDeadpanLocation_bothZero_returnsSecondLocation() {
276276
PottsLocation loc1 = mock(PottsLocation.class);
277277
PottsLocation loc2 = mock(PottsLocation.class);
278278
Location gmc =
279-
PottsModuleFlyStemProliferation.getLowerDeadpanLocation(loc1, 0.0, loc2, 0.0);
279+
PottsModuleFlyStemProliferation.getLessDeadpanLocation(loc1, 0.0, loc2, 0.0);
280280
assertEquals(loc2, gmc);
281281
}
282282

@@ -1377,13 +1377,15 @@ void testDaughterStem_RuleBased_TfRatioTrue() {
13771377
when(parameters.getString("proliferation/DIFFERENTIATION_RULESET")).thenReturn("tfRatio");
13781378
when(parameters.getDouble("proliferation/TF_RATIO")).thenReturn(2.0);
13791379

1380-
when(stemCell.getStemType()).thenReturn(PottsCellFlyStem.StemType.MUDMUT);
1381-
1380+
when(stemCell.getStemType()).thenReturn(PottsCellFlyStem.StemType.WT);
13821381
PottsModuleFlyStemProliferation module = new PottsModuleFlyStemProliferation(stemCell);
1382+
boolean wtResult = module.daughterStem(stemLoc, daughterLoc, mock(Plane.class), 1.0, 4.0);
1383+
assertTrue(wtResult, "WT: Expected true since prospero/deadpan (0.25) <= tfRatio (2.0)");
13831384

1384-
boolean result = module.daughterStem(stemLoc, daughterLoc, mock(Plane.class), 1.0, 4.0);
1385-
1386-
assertTrue(result, "Expected true since prospero/deadpan (0.25) <= tfRatio (2.0)");
1385+
when(stemCell.getStemType()).thenReturn(PottsCellFlyStem.StemType.MUDMUT);
1386+
module = new PottsModuleFlyStemProliferation(stemCell);
1387+
boolean mudResult = module.daughterStem(stemLoc, daughterLoc, mock(Plane.class), 1.0, 4.0);
1388+
assertTrue(mudResult, "Mud: Expected true since prospero/deadpan (0.25) <= tfRatio (2.0)");
13871389
}
13881390

13891391
@Test
@@ -1393,13 +1395,15 @@ void testDaughterStem_RuleBased_TfRatioFalse() {
13931395
when(parameters.getString("proliferation/DIFFERENTIATION_RULESET")).thenReturn("tfRatio");
13941396
when(parameters.getDouble("proliferation/TF_RATIO")).thenReturn(2.0);
13951397

1396-
when(stemCell.getStemType()).thenReturn(PottsCellFlyStem.StemType.MUDMUT);
1397-
1398+
when(stemCell.getStemType()).thenReturn(PottsCellFlyStem.StemType.WT);
13981399
PottsModuleFlyStemProliferation module = new PottsModuleFlyStemProliferation(stemCell);
1400+
boolean wtResult = module.daughterStem(stemLoc, daughterLoc, mock(Plane.class), 4.0, 1.0);
1401+
assertFalse(wtResult, "WT: Expected false since prospero/deadpan (4.0) > tfRatio (2.0)");
13991402

1400-
boolean result = module.daughterStem(stemLoc, daughterLoc, mock(Plane.class), 4.0, 1.0);
1401-
1402-
assertFalse(result, "Expected false since prospero/deadpan (4.0) > tfRatio (2.0)");
1403+
when(stemCell.getStemType()).thenReturn(PottsCellFlyStem.StemType.MUDMUT);
1404+
module = new PottsModuleFlyStemProliferation(stemCell);
1405+
boolean mudResult = module.daughterStem(stemLoc, daughterLoc, mock(Plane.class), 4.0, 1.0);
1406+
assertFalse(mudResult, "Mud: Expected false since prospero/deadpan (4.0) > tfRatio (2.0)");
14031407
}
14041408

14051409
@Test
@@ -1413,8 +1417,8 @@ void testDaughterStem_TfRatioZeroDeadpanZeroProspero_returnsTrue() {
14131417

14141418
PottsModuleFlyStemProliferation module = new PottsModuleFlyStemProliferation(stemCell);
14151419

1416-
boolean result = module.daughterStem(stemLoc, daughterLoc, mock(Plane.class), 0.0, 0.0);
1420+
boolean result = !module.daughterStem(stemLoc, daughterLoc, mock(Plane.class), 0.0, 0.0);
14171421

1418-
assertTrue(result, "Expected true when both prospero and deadpan are zero");
1422+
assertTrue(result, "Expected false when both prospero and deadpan are zero");
14191423
}
14201424
}

0 commit comments

Comments
 (0)