Skip to main content

COMPASS: Generalizable AI predicts immunotherapy outcomes across cancers and treatments.

Project description

COMPASS Reproducibility (Pretraining from Scratch & Downstream Fine-Tuning)

Repro pypi version

This branch provides a fully reproducible pipeline for the COMPASS model, including pretraining from scratch and fine-tuning on downstream immunotherapy response datasets.


🧩 Step 1: Download Pretraining Datasets

TCGA Dataset

TCGA DOI

This dataset contains preprocessed TCGA transcriptomic data used for COMPASS pretraining.
Both 2,475-gene (immune-focused) and 15,672-gene (whole-transcriptome) versions are provided.

After downloading, place the files under the data/ directory as follows:

data/
└── TCGA/
    ├── 2475/
    │   ├── GENE.TABLE
    │   ├── TCGA.PATIENT.PROCESSED.TABLE
    │   ├── TCGA.PATIENT.TABLE
    │   └── TCGA.TPM.TABLE
    └── 15672/
        ├── GENE.TABLE
        ├── TCGA.PATIENT.PROCESSED.TABLE
        ├── TCGA.PATIENT.TABLE
        └── TCGA.TPM.TABLE

ITRP Dataset (Alternative / Downstream Fine-Tuning)

ITRP DOI

The ITRP.zip archive contains two serialized pandas tables:

  • ITRP.TPM.TABLE — gene-level RNA-seq TPM matrix
  • ITRP.PATIENT.TABLE — patient metadata (cancer type, therapy, response labels)

This dataset integrates 1,133 patients from 16 immunotherapy cohorts, all standardized using the COMPASS preprocessing pipeline.


Reproducing Datasets from Raw Data (Optional)

If you prefer to regenerate the datasets from raw sources, please refer to:


🧠 Step 2: Install COMPASS

# IMPORTANT:
# If you are pretraining COMPASS from scratch,
# you MUST use this specific version
pip install immuno-compass==2.0.1

⚙️ Step 3: Run Pretraining from Scratch

Go to the run_scripts folder, Open and execute the following notebook:

01_pretraining.ipynb

Note The example notebook uses the TCGA-2475 gene subset for faster execution and reduced GPU memory usage.


🔬 Step 4: Run Downstream Fine-Tuning

You can either run the notebooks interactively or execute them sequentially via scripts.

Below is an example using nbconvert (tested on V100 GPU):

jupyter nbconvert --to notebook --execute 01_loco_nft.ipynb --output 01_loco_nft.ipynb
jupyter nbconvert --to notebook --execute 02_loco_lft.ipynb --output 02_loco_lft.ipynb
jupyter nbconvert --to notebook --execute 03_loco_pft.ipynb --output 03_loco_pft.ipynb
jupyter nbconvert --to notebook --execute 04_loco_fft.ipynb --output 04_loco_fft.ipynb
jupyter nbconvert --to notebook --execute 05_loco_lgr.ipynb --output 05_loco_lgr.ipynb
jupyter nbconvert --to notebook --execute 06_analysis_loco.ipynb --output 06_analysis_loco.ipynb

📌 Notes

  • This repository is intended for methodological reproducibility, not for matching a single reported checkpoint.
  • Minor numerical differences may occur due to hardware, CUDA versions, or random seeds.
  • For best reproducibility, fix random seeds and document GPU / PyTorch versions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

immuno_compass-2.0.3.tar.gz (404.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

immuno_compass-2.0.3-py3-none-any.whl (423.2 kB view details)

Uploaded Python 3

File details

Details for the file immuno_compass-2.0.3.tar.gz.

File metadata

  • Download URL: immuno_compass-2.0.3.tar.gz
  • Upload date:
  • Size: 404.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for immuno_compass-2.0.3.tar.gz
Algorithm Hash digest
SHA256 fb1f55958a4c146a253eb8e12960d488a931329d311850e59e086294bc7d27a4
MD5 81c058e88ff60311cc1e39ae96b0c76e
BLAKE2b-256 8db44fc4d035a125528543d8d2f59e92f47882269ff92b587aca436402025ce3

See more details on using hashes here.

File details

Details for the file immuno_compass-2.0.3-py3-none-any.whl.

File metadata

  • Download URL: immuno_compass-2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 423.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for immuno_compass-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a319e65a8eebc21c9ac01e3a2e59820f610592516e61c1cc40c8e223460ca849
MD5 c08ad948252af998238e4ff78319588c
BLAKE2b-256 01d4be5d9034e9291c11f9b9087990b2c5fba0372e056217bf82dc37e43528d8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page