ODFormer introduces a virtual organoid framework that integrates bulk and organoid transcriptomes with drug context to predict patient-specific therapeutic responses in pancreatic cancer. The repository provides the core model definition, pretrained checkpoints, and training/evaluation scripts used in the manuscript “ODFormer: a Virtual Organoid for Predicting Personalized Therapeutic Responses in Pancreatic Cancer.”
- Multi-modal transformer backbone that jointly encodes bulk tumor, organoid, and drug representations.
- Pretrained scPDACGPT encoders for transcriptomic embedding initialization.
- End-to-end response prediction via a transformer regressor head.
- Reproducible seeds and deterministic settings for consistent experiments.
ODFormer.py # Model definition (ODFormer, transformer regressor, encoders)
Pretrained_models.py # scPDACGPT/GPT backbone configs and load utilities
Training_Evaluating.py # Training & evaluation pipeline
untils.py # Data and helper utilities
python -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install torch numpyAdditional dependencies may be required depending on your CUDA setup and local environment.
Place pretrained scPDACGPT checkpoints in the paths referenced by ODFormer.py:
../../100_Bulk_scPDACGPT.pth../../100_funetuning_noMask_scPDACGPT.pth
You can modify these paths directly in ODFormer.py to match your storage layout.
Run the training and evaluation pipeline:
python Training_Evaluating.pyKey components:
- Model:
ODFormer.py(TransformerRegressor, positional encoding, encoder loading) - Utilities:
untils.py(data loading and preprocessing)
- Global seed is set to 2024 inside
ODFormer.py. - CUDA deterministic flags are enabled when available.
If you use this code in your research, please cite:
ODFormer: a Virtual Organoid for Predicting Personalized Therapeutic Responses in Pancreatic Cancer
This repository is released for academic research use. Please contact the authors for commercial licensing.
For questions, please open an issue or contact the corresponding authors of the manuscript.