viva-tumor-tcell
A process-bigraph port of
tumor-tcell — the multiscale
agent-based model of the tumor microenvironment from Hickey, Agmon et al.,
Cell Systems (2024) — as a viva- workspace. The tumor, T-cell, and
dendritic-cell biology, the diffusing IFNg / tumor-debris fields, and the cell–cell
neighbor exchange are ported faithfully from the original vivarium-1.0 processes;
cell–cell collisions and neighbor detection are delegated to
viva-munk's pymunk engine.
🔬 Explore the interactive read-only dashboard →
Every composite, study, and result — browsable in your browser, no install required. Published from
mainby thepublish-dashboardworkflow (allow a few minutes after the first push).
The science
The paper's central, counter-intuitive finding is that therapeutic T-cell efficacy is
governed by the rate of IFNg-driven tumor phenotype conversion — proliferative
PDL1n / MHC-I-low tumor cells converting to an arrested, inflammatory PDL1p /
MHC-I-high state (G0, non-dividing) — and not by the raw number of T-cell kills.
T cells that start more active (25% PD1+, from ex-vivo memory-skewing) drive that
conversion earlier and more strongly than exhausted ones (75% PD1+): in the paper's
model the tumor is held to ~1,000 cells vs ~3,000 (75% PD1+) vs ~5,000 (no T) at 60 h,
even though the two T-cell conditions produce a nearly identical kill count
(~1,300 vs ~1,200 deaths). Repeated TCR stimulation exhausts the T cells (PD1- → PD1+),
lowering their cytokine output, and spatial reprogramming can preserve the active
phenotype for continual conversion.
Hickey, Agmon, Horowitz, Tan, Lamore, Sunwoo, Covert, Nolan. Integrating multiplexed imaging and multiscale modeling identifies tumor phenotype conversion as a critical component of therapeutic T cell efficacy. Cell Systems 15, 322–338 (2024). doi:10.1016/j.cels.2024.03.004
What it reproduces
The tumor-tcell-showcase investigation
reconstructs the paper's mechanism and reports every study across replicate seeds
(mean ± std). Each study emits the original's analysis figures — population-by-state,
cumulative divisions (via phylogeny), deaths-by-type, an 8-panel spatial snapshot
montage, an animation + GIF, and cytotoxicity — using the paper's cell-state colors
(PDL1n=indianred, PDL1p=skyblue, PD1n=darkorange, PD1p=limegreen) over the YlOrBr
IFNg field.
| Study | Paper analogue | Result |
|---|---|---|
| tumor-microenvironment | Fig 3 headline experiment | Full figure suite for the 3 CODEX conditions (no-T / 25% / 75% PD1+) |
| efficacy-at-scale | Fig 3E | 25% PD1+ suppresses growth more than 75% PD1+ in 3/3 seeds (285±15 vs 335±11 vs 315±24 no-T) |
| phenotype-conversion | Fig 3G | Active T cells secrete a measurable IFNg field in 6/6 seeds (0/6 without) |
| tcell-exhaustion | Fig 3H | Exhausted (PD1+) fraction tracks the starting fraction: 63±22% (75% start) vs 16±11% (25% start), 6/6 |
| killing-assay-cytotoxicity | Fig 2C/2G | cytotoxicity ~11±8% vs matched no-T control (positive in 5/6 seeds) |
Effects are directional at tractable scale; the population-level efficacy claim resolves
when scaled up (see efficacy-at-scale), and the paper's full 1,200-cell / 3-day run is a
follow-on (scripts/scale_efficacy.py).
Installation
Requires the sibling viva-munk
checkout. uv is recommended.
uv venv .venv && source .venv/bin/activate
uv pip install -e . # + the sibling viva-munk / viva-superpowers checkouts
pytest # 17 tests
Processes register automatically via bigraph_schema.package.discover once installed;
viva_tumor_tcell.core.build_core() also registers viva-munk's pymunk_agent types,
the set_float type, and this workspace's own processes.
Quick start
from viva_tumor_tcell.core import build_core
from viva_tumor_tcell.composites.microenvironment import tumor_microenvironment_document
from viva_tumor_tcell.run import analysis_run
from process_bigraph import Composite
core = build_core()
doc = tumor_microenvironment_document(n_tumors=60, n_tcells=12, pd1_positive_frac=0.25)
sim = Composite({'state': doc}, core=core)
a = analysis_run(sim, 300) # per-state populations, deaths-by-type, divisions, snapshots
print(a['populations'][-1])
Run a showcase study (prints its verdict, writes figures to viz/ and reports/figures/):
python studies/tumor-microenvironment/sims/run.py
| Composite | What it is |
|---|---|
killing_assay |
Well-mixed in-vitro cytotoxicity assay: tumor cells at a chosen PDL1+ fraction, with or without T cells (matched no-T control). |
lymph_node |
Tumor microenvironment plus dendritic cells and a diffusing tumor_debris field — DCs take up debris and activate. |
tumor_microenvironment |
CODEX layout: a central tumor mass ringed by T cells over a diffusing IFNg field. pd1_positive_frac + n_tcells select the no-T / 25% PD1+ / 75% PD1+ headline conditions. |
tumor_tcell_basic |
Small well-mixed chamber of tumor + T cells sharing a diffusing IFNg field; collisions via viva-munk (M1 core-seam demo). |
| Investigation | Research question |
|---|---|
| Tumor–T-cell Microenvironment (Vivarium 1.0 → 2.0 migration) (running) | Does migrating the tumor-tcell agent-based model from Vivarium 1.0 to process-bigraph (Vivarium 2.0) reproduce the paper's mechanism, and which parts of that mechanism hold robustly at a tractable sc… |
Architecture
tumor-tcell's Neighbors process did two jobs — pymunk collisions and the biological
neighbor exchange. viva-munk's PymunkProcess covers only the collisions, so those are
split: TumorTcellPhysics wraps a real viva_munk PymunkProcess as its collision engine
(walls, jitter, substeps, circle–circle collisions) and also performs the ported ligand /
cytotoxic-packet exchange (T-cell picks nearest tumor; tumor collects all T-cells).
Processes (viva_tumor_tcell/processes/)
TumorCellProcess— PDL1n ↔ PDL1p; IFNg internalization drives the switch; death by apoptosis or accumulated cytotoxic packets (releases tumor_debris).TCellProcess— PD1n ↔ PD1p; TCR timer / refractory cycling; IFNg + cytotoxic-packet secretion in contact; persistent-random-walk migration.DendriticCellProcess— takes up tumor_debris, activates, presents MHCI/PDL1.DiffusionField— tumor-tcell'sFields+LocalFieldconsolidated: deposit exchange → diffuse → decay → sample local, with the original diffusion/decay constants.TumorTcellPhysics— viva-munk collisions + neighbor exchange.
The tumor_tcell_agent type (types.py)
Each cell is a flat agent pinned to an explicit per-field schema: float accumulators
(timers, counts, internalized IFNg) and viva-munk's set_float for membrane ligands
(present/accept) and migration speed; map[float]/map[set_float] for exchange/local.
Per-cell behavior processes are embedded and realized after _add/_remove division.
Visualizations (viz.py)
Interactive Plotly (population/division/death/cytotoxicity, animated spatial view) plus a matplotlib GIF, all in the paper's TAG_COLORS over the YlOrBr field.
See PORT_PLAN.md for the full architecture, decisions, and the pbg gotchas hit.
Testing
pytest -q # 17 tests: process mechanics, neighbor exchange, IFNg switch, killing,
# field, dendritic activation, all-generator build/step, integration
Dependencies
process-bigraph, bigraph-schema, viva-munk (physics + pymunk_agent), numpy,
scipy, plotly, matplotlib. The workbench (studies + read-only dashboard) additionally
uses vivarium-workbench and viva-superpowers.
Citation
If you use this workspace, please cite the original paper
(doi:10.1016/j.cels.2024.03.004); see
references/papers.bib.
License
MIT — see LICENSE.
Metadata
Release files for viva-tumor-tcell 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| viva_tumor_tcell-0.1.3.tar.gz | 15.3 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| viva_tumor_tcell-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.2 MB
Release files / viva_tumor_tcell-0.1.3.tar.gz
| Download URL | viva_tumor_tcell-0.1.3.tar.gz |
|---|---|
| Size | 15.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2bc0aaf3b9671044df204b9af411a0201a6b4fa46e72bef148c5826b7ea4ff47
|
|
BLAKE2b-256 checksum How to use checksums |
ca9c8dcf373b88129ce291c684ef7bd87efaee72b4270c26c816c253504c61f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.
Transparency logRelease files / viva_tumor_tcell-0.1.3-py3-none-any.whl
| Download URL | viva_tumor_tcell-0.1.3-py3-none-any.whl |
|---|---|
| Size | 6.9 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
28e48dfcda189104e943d4f8745956e5747e9963bb547598f940cfc7b34eb4b9
|
|
BLAKE2b-256 checksum How to use checksums |
0c969646d70d4cd394f5b588f0ffbc410b7f85eb0d753c1048659d60dfdbfb02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.
Transparency log