Tumor/T-cell model

We will walk through the creation of the multi-scale agent based model of T cell-tumor model. First we will describe and demonstrate testing of individual components called "processes" and then gradually introduce more complexity by connecting individually components together.

Import important packages for testing out the models throughout this jupyter notebook

Processes

The model is composed of two major cell types (T cells & Tumor cells), each with two separate phenotpyes. Each cell has an associated process. The process for each cell type contains the fundamental rules that govern its behavior in interacting with the other cell types and with the inputs it receives from the environment.

Testing the processes individually enables understanding if underlying parameters derived from literature values or primary data accurately represent behavior expected based on such research.

Tumor

The tumor process is focused on two states of a tumor: proliferative with low levels of immune molecules (MHCI and PDL1) and quiescent with high levels of immune molecules (MHCI and PDL1). Its transition from the proliferative state is dependent on the level of interferon gamma it is exposed to coming from the T cells. Both tumor types can be killed by recieving cytotoxic packets from the T cells.

In this next cell, we use the function to test out an individual tumor process.

The experiment ID is recorded for each experiment and parameters that are set to emit from the process are plotted. We can see that the cell is receiving increasing numbers of cytotoxic packets, it is sensing the IFNg, and made a change in phenotype once it has past the threshold for IFNg.

Tcell

The T cell process is focused on two states of a T cell: PD1- with increased secretion of immune molecules (IFNg and cytotoxic packets) and PD1+ with decreased secretion of immune molecules (IFNg and cytotoxic packets). These immune molecules have impact of the state and death of tumor cells. Its transition from the PD1- state is dependent on the length of time it is engaged with tumor cells.

In this next cell, we use the function to test out an individual t cell process.

The experiment ID is recorded for each experiment and parameters that are set to emit from the process are plotted. We can see that the cell is secreting increasing numbers of cytotoxic packets, some express PD1 depending on phenotype, it downregulates TCR in response to being exposed to MHCI for extended times, and tracks the number of refractory counts (influences cell state transition).

Composites

Composites are integrated models with multiple initialized processes, and whose inter-connections are specified by a topology. The T-cell and Tumor processes shown individually above are here combined with additional processes to create T-cell and Tumor agents. These include a division process, which waits for the division flag and then carries out division; a death process, which waits for a death flag and then removes the agent; and a local field, which interfaces the external environment to support uptake and secretion for each individual agent.

T cell agent

We present how individual processes are connected visually using the plot_topology function below:

plot tcell agent topology

In this next cell, we use the function to test out an individual T cell agent.

The experiment ID is recorded for each experiment and the number of divisions for each cell type are plotted. Each color represents a new cell, and cells that start after time=0 are daughter cells of mother cells that have undergone division. Cells with lines that stop before the end of the timeline have died and have been removed.

Tumor agent

We present how individual processes are connected visually using the plot_topology function below:

plot tumor agent topology

In this next cell, we use the function to test out an individual Tumor cell agent.

The experiment ID is recorded for each experiment and the number of divisions for each cell type are plotted. Each color represents a new cell, and cells that start after time=0 are daughter cells of mother cells that have undergone division. Cells with lines that stop before the end of the timeline have died and have been removed.

Tumor Microenvironment

TumorMicroEnvironment is a composite model that simulates a 2D environment with agents that can move around in space, exchange molecules with their neighbors, and exchange molecules with a molecular field. This composite includes a neighbors process, which tracks the locations of individual agents and handles their exchanges, and a diffusion process, which operates on the molecular fields. We present how individual processes are connected visually using the plot_topology function below:

In this next cell, we use the function to test out the environment. This requires specifying:

The experiment ID is recorded for each experiment. We can see that only 1 agent is loaded into the enviornment with IFNg defined at a high local concentration that slowly diffuses over the bin space throughout the experiment.

Experiments

Now that we have validated all individual processes are behaving as we would expect, we can connect all together and provide additional behaviors like migration to individual elements.

In our Multi-scale agent based model, the T cells can interact with tumor cells in the following ways:

In this next cell, we use the function to test out an experiment that allows us to change variables such as:

Analysis

With the saved data we can now use it to look both at outputs from the simulation at both a single-cell and population level stage.

Single Cell

For single cell analysis, plots and analysis can be directly used from plots_suite

We can see a number of important single-cell behavior from this small-scale experiment that is completed within about 3 minutes.

For T cell single cell plots:

For Tumor cell single cell plots:

For the snapshot environment plots:

Population Dynamics

For population statistics and visual output we reformat the data from nested dictionaries to pandas dataframes using a variety of functions from tumor_tcell.

This plot shows the cumulative number of divisions amongst the T cells within the simulation

This plot shows the cumulative number of divisions amongst the Tumor cells within the simulation

This plot shows how the total number (blue) and PDL1n (orange) and PDL1p (green) of Tumors changes over time

This plot shows how the total number (blue) and PD1n (orange) and PD1p (green) of T cells changes over time

This plot shows how the total death count, T cell induced death, and apoptosis of Tumors changes over time

This plot shows how the total death count, PDL1 induced death, and apoptosis of T cells changes over time