-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathPatchModuleCytotoxicity.java
More file actions
95 lines (81 loc) · 3.32 KB
/
Copy pathPatchModuleCytotoxicity.java
File metadata and controls
95 lines (81 loc) · 3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package arcade.patch.agent.module;
import ec.util.MersenneTwisterFast;
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.agent.cell.PatchCellTissue;
import arcade.patch.agent.process.PatchProcessInflammation;
import arcade.patch.env.location.PatchLocation;
import arcade.patch.sim.PatchSimulation;
import arcade.patch.util.LysisEventLog;
import arcade.patch.util.PatchEnums.Domain;
import arcade.patch.util.PatchEnums.State;
/**
* Implementation of {@link Module} for killing tissue agents.
*
* <p>{@code PatchModuleCytotoxicity} is stepped once after a CD8 CAR T-cell binds to a target
* tissue cell. The {@code PatchModuleCytotoxicity} determines if cell has enough granzyme to kill.
* If so, it kills cell and calls the reset to neutral helper to return to neutral state. If not, it
* waits until it has enough granzyme to kill cell.
*/
public class PatchModuleCytotoxicity extends PatchModule {
/** Target cell cytotoxic CAR T-cell is bound to. */
PatchCellTissue target;
/** CAR T-cell inflammation module. */
PatchProcessInflammation inflammation;
/** Amount of granzyme inside CAR T-cell. */
double granzyme;
/** Average time that T cell is bound to target [min]. */
private final int timeDelay;
/** Ticker to keep track of the time delay [min]. */
private int ticker;
/**
* Creates a {@code PatchActionKill} for the given {@link PatchCellCART}.
*
* @param cell the {@link PatchCell} the helper is associated with
*/
public PatchModuleCytotoxicity(PatchCell cell) {
super(cell);
this.target = (PatchCellTissue) ((PatchCellCART) cell).getBoundTarget();
this.inflammation = (PatchProcessInflammation) cell.getProcess(Domain.INFLAMMATION);
this.granzyme = inflammation.getInternal("granzyme");
Parameters parameters = cell.getParameters();
this.timeDelay = parameters.getInt("BOUND_TIME");
this.ticker = 0;
}
@Override
public void step(MersenneTwisterFast random, Simulation sim) {
if (cell.isStopped()) {
return;
}
if (target.isStopped()) {
((PatchCellCART) cell).unbind();
cell.setState(State.UNDEFINED);
return;
}
if (ticker == 0) {
if (granzyme >= 1) {
PatchCellTissue tissueCell = (PatchCellTissue) target;
tissueCell.setState(State.APOPTOTIC);
granzyme--;
inflammation.setInternal("granzyme", granzyme);
// Log cytotoxicity event
PatchSimulation patchSim = (PatchSimulation) sim;
LysisEventLog eventLog =
new LysisEventLog(
(int) sim.getSchedule().getTime(),
cell.getID(),
target.getID(),
target.getPop(),
((PatchLocation) target.getLocation()).getCoordinate());
patchSim.logEvent(eventLog.eventDetails());
}
}
if (ticker >= timeDelay) {
((PatchCellCART) cell).unbind();
cell.setState(State.UNDEFINED);
}
ticker++;
}
}