Skip to content

biomed-AI/MAPE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codes for MAPE: Accurately Predicting Cellular Response to Novel Perturbations through Meta Learning

Overview.

Predicting transcriptional responses in single cells upon chemical or genetic perturbations is crucial for understanding cellular mechanisms and accelerating therapeutic discovery. Here, we present MAPE, a meta-learning-based framework for accurate single-cell response prediction, particularly for unseen perturbations. MAPE formulates individual perturbation contexts as meta-learning tasks and learns a global optimal transport mapping to model the transition from unperturbed to perturbed cell states across diverse conditions. This architecture enables MAPE to effectively generalize to unseen perturbations under both zero- and few-shot settings.

Installation

To setup the corresponding conda environment run:

conda create --name MAPE python=3.9.5
conda activate MAPE

conda update -n base -c defaults conda
pip install --upgrade pip

Install requirements and dependencies via:

pip install -r requirements.txt

Datasets

Datasets are provided in https://drive.google.com/drive/folders/1V4Jt6CVWNhf0VHboPFkZ0zbR240b7Laa?usp=drive_link. Download and unzip all the files and place them in ./datasets.

Predict with trained models

1. Download model weights

Download the model weights from https://drive.google.com/drive/folders/1V4Jt6CVWNhf0VHboPFkZ0zbR240b7Laa?usp=drive_link and place them in ./save

2. Predict

See eval_norman.ipynb and eval_sciplex.ipynb

Train

Train a new model from scatch:

Genetic perturbation

python ./scripts/meta_train.py --outdir <output_dir> --config ./configs/tasks/norman-meta.yaml --config ./configs/models/mape_norman.yaml --config.training.meta_list ./datasets/norman/splits/train_sample_<n>.txt --config.training.test_list ./datasets/norman/splits/test_sample_<n>.txt 

where train_sample_<n>.txt and train_sample_<n>.txt is the train and test perturbation genes of fold n (n=0,1,2,3,4).

Chemical perturbation

  • zero-shot
python meta_train.py --outdir <output_dir> --config ./configs/tasks/sciplex3-meta.yaml --config ./configs/models/mape_sciplex.yaml --config.training.meta_list ./datasets/scrna-sciplex3/splits/train_sample_<n>.txt --config.training.test_list ./datasets/scrna-sciplex3/splits/test_sample_<n>.txt 
  • few-shot
python meta_train.py --outdir <output_dir> --config ./configs/tasks/sciplex3-fewshot.yaml --config ./configs/models/mape_finetune.yaml --config.data.target <drug> --config.datasplit.train_size <n> --config.model.load <pretrained_mape_path> 

where <pretrained_mape_path> is the weight path of the model trained in the zero-shot setting. By runnin this command, MAPE will be fine-tuned using perturbation data from <drug> in a <n>-shot setting.

Unseen patients

python ./scripts/meta_train.py --outdir <output_dir> --config ./configs/tasks/gbm-ood.yaml --config ./configs/models/mape_gbm.yaml  --config.datasplit.holdout <patient_id>

where where <patient_id> is the patient in the holdout set. You can choose PW030,PW032,PW034,PW036,PW040,PW051,PW053.

Unseen speices

python ./scripts/meta_train.py --outdir <output_dir> --config ./configs/tasks/crossspecies-ood.yaml --config ./configs/models/mape_crossspecies.yaml --config.datasplit.holdout <species>

where <species> is the species in the holdout set. You can choose pig, mouse, rat, rabbit.

Acknowledgement

The codes of this paper are partially based on the codes of CellOT. We thank the authors for their contributions.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published