Deep learning-based analysis reveals patient-level cancer therapy trajectories using single-cell PBMC chromatin images
This repository contains code for the paper "Deep learning-based analysis reveals patient-level cancer therapy trajectories using single-cell PBMC chromatin images" which analyzes PBMC chromatin images from 5 timepoints from patients undergoing proton radiation therapy and healthy volunteers to create patient trajectories and associate these with therapy outcomes.
The dataset used in this project can be downloaded at TODO.
notebookscontains jupyter notebooks for segmenting and pre-processing the dataset and training models used in the paper's results. Seenotebooks/README.mdfor further details.figure_notebookscontains jupyter notebooks to reproduce the paper's main and supplementary figures. Seefigure_notebooks/README.mdfor further details.scriptscontains scripts for randomizing the plate layouts and extracting chrometric features from the pre-processed images. Seescripts/README.mdfor further details.metacontains select metadata needed for the figures and plate layout generation.foundation_modelscontains loaders and vendored model code for the frozen foundation-model feature extractors (DinoBloom, SubCell) used in one supplementary figure.
The .py files at the top level are the shared modules the notebooks import, not runnable scripts:
data.pyloads and merges the pre-bundled per-plate images, metadata, and optional features.models.pycontains the cell-level classifiers and the multiple instance learning models.training.pycontains the training loops.eval.pycontains evaluation and clustering helpers.util.pycontains small shared helpers.
notebooks/segmentation.ipynbto segment the 3D microscopy images.notebooks/preprocessing.ipynbto apply quality control, extract cell crops, and bundle the data.scripts/extract_chrometric.pyif you want the chrometric features.- The cell-level model and MIL notebooks to train the models.
notebooks/trajectory_scores.ipynbto compute the trajectories from the healthy vs. cancer classifiers. This has to be run before the MIL trajectory notebooks, which use the trajectory groups as labels.figure_notebooksto reproduce the figures.
Python:
This repository was developed using Python 3.9. You can use Conda to create a virtual environment for a specific Python version. Additional required packages are listed in requirements.txt and can be installed using the following command:
pip install -r requirements.txt
Installing dependencies can take a few minutes or up to an hour dependending on how many packages need to be downloaded rather than reusing cached versions.
A few steps need additional packages that we installed in separate environments, as they conflict with the requirements above:
- Segmentation and pre-processing (
notebooks/segmentation.ipynb,notebooks/preprocessing.ipynb) additionally neednd2to read the raw images, and segmentation needspyclesperanto-prototypefor the voronoi-otsu labeling. From version0.24.5on the latter requiresnumpybelow version 2. - Chrometric feature extraction (
scripts/extract_chrometric.py) needsnmcofrom the chrometrics repository, which is not on PyPI. Clone it and point thesys.path.appendat the top of the script at your copy. - The frozen foundation-model features
(
notebooks/cell_level_models_pretrained_foundation.ipynb) needtransformers==4.45.1, the version SubCell requires.
Operating system and hardware:
We developed this code on a machine running Rocky Linux 8.8 (Green Obsidian) and equipped with an NVIDIA RTX A6000 GPU.
If you use this code or data, please cite:
Schlüter, H. M., Sornapudi, T. R., Leiser, D., Koller, S., Karavelioglu, Z., Uhler, C., & Shivashankar, G. V. Deep learning-based analysis reveals patient-level cancer therapy trajectories using single-cell PBMC chromatin images. Scientific Reports (2026). https://doi.org/10.1038/s41598-026-74792-x
@article{schluter2026deep,
title = {Deep learning-based analysis reveals patient-level cancer therapy trajectories using single-cell {PBMC} chromatin images},
author = {Schl{\"u}ter, Hannah M. and Sornapudi, Trinadha Rao and Leiser, Dominic and Koller, Sandra and Karavelioglu, Zeynep and Uhler, Caroline and Shivashankar, G. V.},
journal = {Scientific Reports},
year = {2026},
doi = {10.1038/s41598-026-74792-x},
url = {https://www.nature.com/articles/s41598-026-74792-x}
}Claude Code assisted with the analysis code for the revisions to this work.