Skip to content

Commit

Permalink
chemotherapy scheduling
Browse files Browse the repository at this point in the history
  • Loading branch information
EC2 Default User committed Nov 12, 2024
1 parent 137f99e commit fb122da
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public abstract class PatchProcessChemotherapy extends PatchProcess {
private void updateExternal(Simulation sim) {
extAmt = sim.getLattice("DRUG").getAverageValue(location) * location.getVolume();
extAmt *= (1.0 - drugDecayRate);
System.out.println("extAmt: " + extAmt);
}

@Override
Expand Down
41 changes: 21 additions & 20 deletions src/arcade/patch/env/component/PatchComponentDose.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ public class PatchComponentDose implements Component {
private final double mediaVolume;

Check failure on line 24 in src/arcade/patch/env/component/PatchComponentDose.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/patch/env/component/PatchComponentDose.java#L24 <com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/patch/env/component/PatchComponentDose.java:24:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck)

Check failure on line 24 in src/arcade/patch/env/component/PatchComponentDose.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/patch/env/component/PatchComponentDose.java#L24 <com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck>

'VARIABLE_DEF' should be separated from previous line.
Raw output
/github/workspace/./src/arcade/patch/env/component/PatchComponentDose.java:24:5: error: 'VARIABLE_DEF' should be separated from previous line. (com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck)
private final double latticePatchVolume;

Check failure on line 25 in src/arcade/patch/env/component/PatchComponentDose.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/patch/env/component/PatchComponentDose.java#L25 <com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/patch/env/component/PatchComponentDose.java:25:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck)

Check failure on line 25 in src/arcade/patch/env/component/PatchComponentDose.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/patch/env/component/PatchComponentDose.java#L25 <com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck>

'VARIABLE_DEF' should be separated from previous line.
Raw output
/github/workspace/./src/arcade/patch/env/component/PatchComponentDose.java:25:5: error: 'VARIABLE_DEF' should be separated from previous line. (com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck)
private final double latticePatchArea;

Check failure on line 26 in src/arcade/patch/env/component/PatchComponentDose.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/patch/env/component/PatchComponentDose.java#L26 <com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/patch/env/component/PatchComponentDose.java:26:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck)

Check failure on line 26 in src/arcade/patch/env/component/PatchComponentDose.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/patch/env/component/PatchComponentDose.java#L26 <com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck>

'VARIABLE_DEF' should be separated from previous line.
Raw output
/github/workspace/./src/arcade/patch/env/component/PatchComponentDose.java:26:5: error: 'VARIABLE_DEF' should be separated from previous line. (com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck)
private final double doseDelay;
private final double doseStart;

Check failure on line 27 in src/arcade/patch/env/component/PatchComponentDose.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/patch/env/component/PatchComponentDose.java#L27 <com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/patch/env/component/PatchComponentDose.java:27:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck)

Check failure on line 27 in src/arcade/patch/env/component/PatchComponentDose.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/patch/env/component/PatchComponentDose.java#L27 <com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck>

'VARIABLE_DEF' should be separated from previous line.
Raw output
/github/workspace/./src/arcade/patch/env/component/PatchComponentDose.java:27:5: error: 'VARIABLE_DEF' should be separated from previous line. (com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck)
private final double doseDuration;

Check failure on line 28 in src/arcade/patch/env/component/PatchComponentDose.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/patch/env/component/PatchComponentDose.java#L28 <com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/patch/env/component/PatchComponentDose.java:28:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck)

Check failure on line 28 in src/arcade/patch/env/component/PatchComponentDose.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/patch/env/component/PatchComponentDose.java#L28 <com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck>

'VARIABLE_DEF' should be separated from previous line.
Raw output
/github/workspace/./src/arcade/patch/env/component/PatchComponentDose.java:28:5: error: 'VARIABLE_DEF' should be separated from previous line. (com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck)
private final double doseInterval;

Check failure on line 29 in src/arcade/patch/env/component/PatchComponentDose.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/patch/env/component/PatchComponentDose.java#L29 <com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/patch/env/component/PatchComponentDose.java:29:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck)

Check failure on line 29 in src/arcade/patch/env/component/PatchComponentDose.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/patch/env/component/PatchComponentDose.java#L29 <com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck>

'VARIABLE_DEF' should be separated from previous line.
Raw output
/github/workspace/./src/arcade/patch/env/component/PatchComponentDose.java:29:5: error: 'VARIABLE_DEF' should be separated from previous line. (com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck)
private final double doseEnd;

Check failure on line 30 in src/arcade/patch/env/component/PatchComponentDose.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/patch/env/component/PatchComponentDose.java#L30 <com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/patch/env/component/PatchComponentDose.java:30:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck)

Check failure on line 30 in src/arcade/patch/env/component/PatchComponentDose.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/patch/env/component/PatchComponentDose.java#L30 <com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck>

'VARIABLE_DEF' should be separated from previous line.
Raw output
/github/workspace/./src/arcade/patch/env/component/PatchComponentDose.java:30:5: error: 'VARIABLE_DEF' should be separated from previous line. (com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck)

public PatchComponentDose(Series series, MiniBox parameters) {

Check failure on line 32 in src/arcade/patch/env/component/PatchComponentDose.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/patch/env/component/PatchComponentDose.java#L32 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/arcade/patch/env/component/PatchComponentDose.java:32:5: error: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
layers = new ArrayList<>();
Expand All @@ -36,8 +38,10 @@ public PatchComponentDose(Series series, MiniBox parameters) {

// Set loaded parameters.
mediaAmount = parameters.getDouble("MEDIA_AMOUNT");
doseDelay = parameters.getDouble("DOSE_DELAY");
doseStart = parameters.getDouble("DOSE_START");
doseDuration = parameters.getDouble("DOSE_DURATION");
doseInterval = parameters.getDouble("DOSE_INTERVAL");
doseEnd = parameters.getDouble("DOSE_END");

// Set patch parameters.
MiniBox patch = ((PatchSeries) series).patch;
Expand Down Expand Up @@ -65,7 +69,7 @@ protected static class DoseLayer {

@Override
public void schedule(Schedule schedule) {
schedule.scheduleOnce(doseDelay, Ordering.FIRST_COMPONENT.ordinal() - 1, this);
schedule.scheduleRepeating(doseStart, Ordering.FIRST_COMPONENT.ordinal(), this);
}

@Override
Expand Down Expand Up @@ -95,27 +99,24 @@ public void register(Simulation sim, String layer) {

@Override
public void step(SimState simstate) {
double tick = simstate.schedule.getTime();

double doseAmount = 400000;
for (DoseLayer layer : layers) {
double delta = 0;
for (int k = 0; k < latticeHeight; k++) {
for (int i = 0; i < latticeLength; i++) {
for (int j = 0; j < latticeWidth; j++) {
delta +=
latticePatchVolume
* (layer.current[k][i][j] - layer.siteLayer.concentration);
}
}
if (tick > doseEnd) {
layer.currentAmount = 0;
layer.siteLayer.concentration = 0;
return;
}

if (tick >= doseStart && (tick - doseStart) % doseInterval < doseDuration) {
layer.currentAmount += doseAmount;
} else {
layer.currentAmount = 0;
}
layer.currentAmount = Math.max(0, layer.currentAmount - delta);

layer.siteLayer.concentration = layer.currentAmount / mediaVolume;

// System.out.print(simstate.schedule.getTime());
// System.out.print((doseDelay + doseDuration));
// if (simstate.schedule.getTime() >= (doseDelay + doseDuration)) {
// System.out.println("Dose Ends");
// layer.currentAmount = layer.initialConcentration * mediaVolume;
// layer.siteLayer.concentration = layer.initialConcentration;
// }
}
}
}
7 changes: 6 additions & 1 deletion src/arcade/patch/env/component/PatchComponentPulse.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,15 @@ public void step(SimState simstate) {
}
}

System.out.println(delta);
System.out.println(layer.currentAmount);
// Update available concentrations.
layer.currentAmount = Math.max(0, layer.currentAmount - delta);
layer.siteLayer.concentration = layer.currentAmount / mediaVolume;
System.out.println(layer.currentAmount);

System.out.println(layer.siteLayer.concentration);
layer.siteLayer.concentration = layer.currentAmount / mediaVolume;
System.out.println(layer.siteLayer.concentration);
// Pulse returns concentration to initial value.
if (tick % pulseInterval == 0) {
layer.currentAmount = layer.initialConcentration * mediaVolume;
Expand Down
9 changes: 6 additions & 3 deletions src/arcade/patch/parameter.patch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<!-- chemotherapy process parameters -->
<population.process process="chemotherapy" id="CHEMOTHERAPY_THRESHOLD" value="1.5" unit="fmol" description="chemotherapy threshold before apoptosis" />
<population.process process="chemotherapy" id="CONSTANT_DRUG_UPTAKE_RATE" value="1" unit="fmol drug/um^2 cell/min/M drug" />
<population.process process="chemotherapy" id="DRUG_REMOVAL_RATE" value="0.001" unit="/min" description="removal rate of drug in cell" />
<population.process process="chemotherapy" id="DRUG_REMOVAL_RATE" value="0.1" unit="/min" description="removal rate of drug in cell" />
<population.process process="chemotherapy" id="DRUG_DECAY_RATE" value="0.1" unit="/min" description="degradation rate of drug in environment" />


Expand Down Expand Up @@ -114,8 +114,11 @@
<component class="pulse" id="MEDIA_AMOUNT" value="2000" unit="um^3/um^2" description="media volume per area" />

<!-- dose component parameters -->
<component class="dose" id="DOSE_DELAY" value="20" unit="min" description="Amount of simulation time before does is introduced" />
<component class="dose" id="DOSE_DURATION" value="60" unit="min" description="Length of drug exposure" />
<component class="dose" id="DOSE_START" value="10080" unit="min" description="Amount of simulation time before does is introduced" />
<component class="dose" id="DOSE_END" value="20160" unit="min" description="Simulation time where drug treatments end" />
<component class="dose" id="DOSE_DURATION" value="120" unit="min" description="Length of drug exposure" />
<component class="dose" id="DOSE_INTERVAL" value="1440" unit="min" description="Time between drug doses" />
<component class="dose" id="MEDIA_AMOUNT" value="2000" unit="um^3/um^2" description="media volume per area" />

<!-- degrade component parameters -->
<component class="degrade" id="DEGRADATION_INTERVAL" value="1" units="min" description="interval between degradation steps" />
Expand Down

0 comments on commit fb122da

Please sign in to comment.