diff --git a/src/arcade/patch/agent/action/PatchActionTreat.java b/src/arcade/patch/agent/action/PatchActionTreat.java index fc418a77c..636f0e933 100644 --- a/src/arcade/patch/agent/action/PatchActionTreat.java +++ b/src/arcade/patch/agent/action/PatchActionTreat.java @@ -141,6 +141,7 @@ public void step(SimState simstate) { } maxConfluency = population.getInt("MAX_DENSITY"); + maxConfluency = (maxConfluency >= 0 ? maxConfluency : Integer.MAX_VALUE); int pop = population.getInt("CODE"); @@ -360,9 +361,7 @@ protected boolean checkLocationSpace(Location loc, PatchGrid grid) { for (Object cellObj : bag) { PatchCell cell = (PatchCell) cellObj; if (cell instanceof PatchCellCART) { - totalVol = - PatchCell.calculateTotalVolume(bag) - + parameters.getDouble("T_CELL_VOL_AVG"); + totalVol = PatchCell.calculateTotalVolume(bag) + cell.getVolume(); currentHeight = totalVol / locArea; } if (cell instanceof PatchCellTissue) { diff --git a/src/arcade/patch/agent/cell/PatchCellCART.java b/src/arcade/patch/agent/cell/PatchCellCART.java index 25cc71835..ac23e6a53 100644 --- a/src/arcade/patch/agent/cell/PatchCellCART.java +++ b/src/arcade/patch/agent/cell/PatchCellCART.java @@ -56,16 +56,16 @@ public abstract class PatchCellCART extends PatchCell { protected boolean activated; /** number of current PDL-1 receptors on CART cell. */ - protected int selfReceptors; + public int selfReceptors; /** initial number of PDL-1 receptors on CART cell. */ protected int selfReceptorsStart; /** number of bound CAR antigens. */ - protected int boundCARAntigensCount; + public int boundCARAntigensCount; /** number of bound PDL-1 antigens. */ - protected int boundSelfAntigensCount; + public int boundSelfAntigensCount; /** number of neighbors that T cell is able to search through. */ protected final double searchAbility; @@ -160,8 +160,8 @@ public PatchCellCART( // initialized non-loaded parameters boundCARAntigensCount = 0; boundSelfAntigensCount = 0; - lastActiveTicker = 0; - activated = true; + // lastActiveTicker = 0; + activated = false; boundTarget = null; // Set loaded parameters. @@ -259,6 +259,15 @@ public boolean getActivationStatus() { return this.activated; } + /** + * Sets the cell activation status. + * + * @param activated the activation status to set + */ + public void setActivationStatus(boolean activated) { + this.activated = activated; + } + /** * Adds only tissue cells to the provided bag. * diff --git a/src/arcade/patch/agent/cell/PatchCellFactory.java b/src/arcade/patch/agent/cell/PatchCellFactory.java index 0492e0801..8c0387950 100644 --- a/src/arcade/patch/agent/cell/PatchCellFactory.java +++ b/src/arcade/patch/agent/cell/PatchCellFactory.java @@ -153,7 +153,10 @@ public PatchCellContainer createCellForPopulation(int id, int pop) { MiniBox population = popToParameters.get(pop); Parameters parameters = new Parameters(population, null, random); - double compression = parameters.getDouble("COMPRESSION_TOLERANCE"); + double compression = + parameters.getDouble("COMPRESSION_TOLERANCE") >= 0 + ? parameters.getDouble("COMPRESSION_TOLERANCE") + : Double.MAX_VALUE; double volume = parameters.getDouble("CELL_VOLUME"); double height = parameters.getDouble("CELL_HEIGHT"); diff --git a/src/arcade/patch/agent/module/PatchModuleApoptosis.java b/src/arcade/patch/agent/module/PatchModuleApoptosis.java index 34518d0c8..3c46bf578 100644 --- a/src/arcade/patch/agent/module/PatchModuleApoptosis.java +++ b/src/arcade/patch/agent/module/PatchModuleApoptosis.java @@ -8,6 +8,7 @@ import arcade.core.sim.Simulation; import arcade.core.util.Parameters; import arcade.patch.agent.cell.PatchCell; +import arcade.patch.agent.cell.PatchCellCART; import arcade.patch.env.grid.PatchGrid; import static arcade.patch.util.PatchEnums.State; @@ -47,17 +48,20 @@ public PatchModuleApoptosis(PatchCell cell) { @Override public void step(MersenneTwisterFast random, Simulation sim) { if (ticker > deathDuration) { - // Induce one neighboring quiescent cell to proliferate. - ArrayList neighborhood = location.getNeighbors(); - neighborhood.add(location); - Bag bag = ((PatchGrid) sim.getGrid()).getObjectsAtLocations(neighborhood); + // CART cells do not induce neighboring tissue cells to proliferate. + if (!(cell instanceof PatchCellCART)) { + // Induce one neighboring quiescent cell to proliferate. + ArrayList neighborhood = location.getNeighbors(); + neighborhood.add(location); + Bag bag = ((PatchGrid) sim.getGrid()).getObjectsAtLocations(neighborhood); - bag.shuffle(random); - for (Object obj : bag) { - Cell neighbor = (Cell) obj; - if (neighbor.getState() == State.QUIESCENT) { - neighbor.setState(State.PROLIFERATIVE); - break; + bag.shuffle(random); + for (Object obj : bag) { + Cell neighbor = (Cell) obj; + if (neighbor.getState() == State.QUIESCENT) { + neighbor.setState(State.PROLIFERATIVE); + break; + } } } diff --git a/src/arcade/patch/agent/module/PatchModuleProliferation.java b/src/arcade/patch/agent/module/PatchModuleProliferation.java index e5134bf8b..99d13f8a6 100644 --- a/src/arcade/patch/agent/module/PatchModuleProliferation.java +++ b/src/arcade/patch/agent/module/PatchModuleProliferation.java @@ -59,7 +59,7 @@ public PatchModuleProliferation(PatchCell cell) { duration = 0; // Load parameters. Parameters parameters = cell.getParameters(); - synthesisDuration = parameters.getInt("proliferation/SYNTHESIS_DURATION"); + synthesisDuration = parameters.getInt("SYNTHESIS_DURATION"); } @Override @@ -106,6 +106,18 @@ public void step(MersenneTwisterFast random, Simulation sim) { newLocation, random, newParameters); + + if (cell instanceof PatchCellCART) { + ((PatchCellCART) newCell) + .setActivationStatus(((PatchCellCART) cell).getActivationStatus()); + ((PatchCellCART) newCell).boundSelfAntigensCount = + ((PatchCellCART) cell).boundSelfAntigensCount; + ((PatchCellCART) newCell).selfReceptors = + ((PatchCellCART) cell).selfReceptors; + ((PatchCellCART) newCell).boundCARAntigensCount = + ((PatchCellCART) cell).boundCARAntigensCount; + } + sim.getGrid().addObject(newCell, newLocation); newCell.schedule(sim.getSchedule()); diff --git a/src/arcade/patch/parameter.patch.xml b/src/arcade/patch/parameter.patch.xml index 2b0ef1bd3..6ca545c0b 100644 --- a/src/arcade/patch/parameter.patch.xml +++ b/src/arcade/patch/parameter.patch.xml @@ -25,6 +25,8 @@ + + @@ -44,8 +46,6 @@ - - diff --git a/test/arcade/patch/agent/cell/PatchCellTest.java b/test/arcade/patch/agent/cell/PatchCellTest.java index 63ccb0367..5c68f15ff 100644 --- a/test/arcade/patch/agent/cell/PatchCellTest.java +++ b/test/arcade/patch/agent/cell/PatchCellTest.java @@ -251,7 +251,7 @@ public void setState_proliferation_createsCell() { Schedule scheduleMock = mock(Schedule.class); doReturn(0.0).when(parametersMock).getDouble(any(String.class)); doReturn(0).when(parametersMock).getInt(any(String.class)); - doReturn(1).when(parametersMock).getInt("proliferation/SYNTHESIS_DURATION"); + doReturn(1).when(parametersMock).getInt("SYNTHESIS_DURATION"); doReturn(cellID + 1).when(simMock).getID(); doReturn(scheduleMock).when(simMock).getSchedule(); doReturn(null).when(scheduleMock).scheduleRepeating(anyInt(), anyInt(), any());