Home

Awesome

scFoundation: Large Scale Foundation Model on Single-cell Transcriptomics

Our article is now published in Nature Methods.

We developed a large-scale pretrained model scFoundation with 100M parameters. scFoundation was based on the xTrimoGene architecture and trained on over 50 million human single-cell transcriptomics data, which contain high-throughput observations on the complex molecular features in all known types of cells. scFoundation is a large-scale model in terms of the size of trainable parameters, dimensionality of genes and the number of cells used in the pre-training. Experiments showed that scFoundation can serve as a foundation model for single-cell transcriptomics and achieve state-of-the-art performances in a diverse array of downstream tasks.

API

Update: Please note that the old platform was officially discontinued on April 30th, 2024. We kindly request you to migrate to our new platform at https://aigp.biomap.com/. You can follow the tutorial on the platform now. This upgrade aims to provide you with both online inference service and command-line interface(CLI) tools.

For any API issues, please get in touch with aigp-support@biomap.com

Model weight and code

We now provide model pretrained weight and code with documentation of obtaining the cell embeddings and fine-tuning/integrating our model with other models. Please find the further instructions in the model folder.

For downstream task

This repository provides the source code necessary to use the scFoundation generated cell and gene embeddings for several downstream tasks such as gene expression enhancement, drug response prediction and perturbation prediction. The source codes for the downstream tasks are in the following repositories:

Read depth enhancement

The results of SAVER, scImpute, MAGIC were obtained from the SAVER repository (https://github.com/mohuangx/SAVER-paper). The results of scFoundation were obtained by running the bash run.sh in the enhancement folder. You can find details in the enhancement/README.md.

DeepCDR

The baseline code is from https://github.com/kimmo1019/DeepCDR

Please follow the commands in DeepCDR/prog/run.sh. The scFoundation embeddings of Bulk data are at DeepCDR/data/50M-0.1B-res_embedding.npy. You can find details in the DeepCDR/README.md.

SCAD

The baseline code is from https://github.com/CompBioT/SCAD

Please follow the steps detailed in SCAD/README.md. The scFoundation embeddings of Bulk and single cell data are in the SCAD/data/split_norm/ folder.

GEARS

The baseline code is from https://github.com/snap-stanford/GEARS.

The commands required for running the code can be found in GEARS/run_sh. The gene embedding of each cell is 19264*512 which is too large to be saved. We generated the gene embedding during the training process. You can find details in the GEARS/README.md.

Gene module inference

In the genemodule directory, you can find the code for inferring gene modules from gene context embeddings.

Cell mapping

The mapping directory contains the demo usage code and scripts to reproduce figures related to the cell mapping task.

Cell type annotation

You can find the code to reproduce results for the cell type annotation task in the annotation folder.

Pre-training data pre-process

We provide the code for downloading and processing the data used for pre-training. The code and demo usage are in the preprocessing folder.

Summary

Task and FunctionsDescriptionCode pathData path
AblationAblation study on different modelĀ  and loss settingsablation folderFigshare: data_ablation.zip
AnnotationCell type annotation task on Pancreatic and PBMC dataannotation folderGitHub (embeddings): annotation/annotation_data.zip & Figshare (raw data): cell_type_rawdata.zip
APIInstruction for using APIapiexample folderGitHub: apiexample/data/ folder
DeepCDRCancer Drug Response (IC50) predictionDeepCDR folderGitHub: DeepCDR/data/ folder
Read Depth EnhancementEnhancing cells' read depth for clusteringenhancement folderGitHub: enhancement folder
GEARSperturbation predictionGEARS folderGitHub (demo data): GEARS/demo/data/ folder & Figshare (Experiment data): all h5ad files
Gene ModuleInferring gene modules and regulation networksgenemodule folderFigshare: data_genemodule.zip
Data MappingMapping organoid data into in vivo datamapping folderFigshare: data_mapping.zip
Model CodeUsing pretrained model for embedding inference/ for integrating/finetuning with other modelsmodel folderFigshare: model_example.zip
Pretraining Data Processingsingle cell RNA-seq data collection workflowpreprocessing folderDataSupplement1.xlsx and DataSupplement2.xlsx
SCADsingle cell level drug sensitivity predictionSCAD folderGitHub (embeddings): SCAD/data/split_norm Figshare (raw exp. Data): data_SCAD_split_norm.zip

Copyright Notice

Code License

This source code repository is licensed under the Apache-2.0 License; provided, however, that notwithstanding the foregoing, any use or exploitation of any Model Weights is subject to the Model License.

Third-party Software License

Use of the third-party software, libraries or code referred to in the Acknowledgements section may be governed by separate terms and conditions or license provisions.

Your use of the third-party software, libraries or code is subject to any such terms and you should check that you can comply with any applicable restrictions or terms and conditions before use.

Reference

Acknowledgements

scFoundation uses and/or references the following separate libraries and packages (ordered alphabetically):

Thanks for all their contributors and maintainers!