The HALModeling2024Graphs repository contains Python scripts to generate and analyze graphs for the HALModeling2024 project, found at https://github.com/hannahgsimon/HALModeling2024. This code graphs cell population changes in response to radiotherapy, as well as the immune response.
- Python: Version 3.6 or higher.
- Required Python packages: You can install them using
pip
:pip install pandas matplotlib
- Clone the repository:
- Navigate to the project directory with the cd command.
- Import the project into your preferred Python IDE.
- Build the project.
- Plot Trial Cell Populations: Plots cell counts at each timestep for the last trial.
- Plot Trial Immune Response: Plots the total immune response, primary immune response, and secondary immune response at each timestep.
- Plot Scenario Cell Populations with Confidence Intervals: For the indicated scenario, plots the average cell counts with confidence intervals (±1 SD) at each timestep across all trials. For scenarios C, D, and E, will only plot trials with initial escape & radiation.
- Plot Tumor Cells at Equilibrium: For trials in which bifurcation to escape occurred, plots a box and whisker plot of the number of tumor cells at equilibrium across each scenario.
- Plot Timesteps to Equilibrium: For trials in which bifurcation to escape occurred, plots a box and whisker plot of the number of timesteps to equilibrium across each scenario.
Before running the code, you will need to update the file paths.
In HALModeling2024Graphs.py
:
file_path = r'C:\Users\Hannah\Documents\HALModeling2024Outs\TrialRunCounts.csv'
folder_path = fr'C:\Users\Hannah\Documents\HALModeling2024Outs\Scenario{scenario}\*.csv'
file_path = fr'C:\Users\Hannah\Documents\HALModeling2024Outs\Scenario{scenario}\*.csv'
save_path = fr'C:\Users\Hannah\Documents\HALModeling2024Outs\TrialRunGraphScenario{scenario}.png'
save_path = r'C:\Users\Hannah\Documents\HALModeling2024Outs\TrialRunGraphImmuneResponse.png'
In HALModeling2024Plots.py
:
file_path = r'C:\Users\Hannah\Documents\HALModeling2024Outs\AvgTimestepstoEscape.csv'
timesteps_save_path = fr'C:\Users\Hannah\Documents\HALModeling2024Outs\BoxplotTimesteps.png'
tumorcells_save_path = fr'C:\Users\Hannah\Documents\HALModeling2024Outs\BoxplotTumorCells.png'
- Input 1:
TrialRunCounts.csv
— Contains data from the final trial (non-scenario-specific), generated whenprintCounts = true
andscenarioActive = false
inOnLattice2DGrid.java
. - Input 2: A folder containing trials for a specific scenario, generated when
printCounts = true
andscenarioActive = true
inOnLattice2DGrid.java
.
The simulation starts with the below initial conditions (modifiable in the code). You can update these parameters in the indicated lines of code to fit your specific simulation requirements.
- Plot with Confidence Intervals: Disabled. For the indicated scenario, plots the average cell counts with confidence intervals (±1 SD) at each timestep across all trials. For scenarios C, D, and E, will only plot trials with initial escape & radiation.
plot_with_CIs = False
- Scenario Analysis: Disabled. For the last trial of the indicated scenario, plots the cell counts at each timestep.
scenarioAnalysis = False
- Scenario: A. The indicated scenario that will be graphed for
plot_with_CIs = True
orscenarioAnalysis = True
.scenario = 'A'
- Timesteps 500: Enabled. For
plot_with_CIs = True
, only the first 500 timesteps are plotted. In the originalOnLattice2DGrid.java
code, this corresponds to the time by which the triggering cell population typically reaches 0. This occurs because there are initially 500 triggering cells, with 1 removed per timestep; however, the population may reach 0 sooner if cells are killed by radiation.timesteps500 = True
- Plot Immune Response: Enabled. Plots the total immune response, primary immune response, and secondary immune response at each timestep. If
scenarioAnalysis = True
, plots the data for the last trial of the indicated scenario. IfscenarioAnalysis = False
, plots the data for the last trial (titledTrialRunCounts.csv
, not a specific scenario).graph_immune = True
- Note: When both
plot_with_CIs = False
andscenarioAnalysis = False
, plots cell counts at each timestep for the last trial (TrialRunCounts.csv
, not tied to a specific scenario).
- Input: A CSV file with 5 columns: "Scenario", "Trial" number, "Bifurcation to Escape" (Y/N), "Timesteps to Equilibrium", and "Tumor Cells at Equilibrium". The last 2 columns are blank for non-escape trials.
- Output 1: For trials in which bifurcation to escape occurred, plots a box and whisker plot of the number of tumor cells at equilibrium across each scenario.
- Output 2: For trials in which bifurcation to escape occurred, plots a box and whisker plot of the number of timesteps to equilibrium across each scenario.
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch for your feature or bug fix:
- git checkout -b feature-name
- Commit your changes and push the branch:
- git commit -m "Add new feature"
- git push origin feature-name
- Open a pull request and describe your changes in detail.
This project is licensed under the MIT License. See the LICENSE file for details.
For questions or feedback, please contact Hannah G. Simon at [email protected].