GEARS: Predicting transcriptional outcomes of novel multi-gene perturbations
This repository hosts the official implementation of GEARS, a method that can predict transcriptional response to both single and multi-gene perturbations using single-cell RNA-sequencing data from perturbational screens.
Installation
Install PyG, and then do pip install cell-gears.
Core API Interface
Using the API, you can (1) reproduce the result in our paper and (2) train your own GEARS model on your perturbation screen using a few lines of code.
from gears import PertData, GEARS
# get data
pert_data = PertData('./data')
# load dataset in paper: norman, adamson, dixit.
pert_data.load(dataset = 'norman')
# specify data split
pert_data.prepare_split(split = 'simulation', seed = 1)
# get dataloader with batch size
pert_data.get_dataloader(batch_size = 32, test_batch_size = 128)
# set up and train a model
gears_model = GEARS(pert_data, device = 'cuda:8')
gears_model.model_initialize(hidden_size = 64)
gears_model.train(epochs = 20)
# save/load model
gears_model.save_model('gears')
gears_model.load_pretrained('gears')
# predict
gears_model.predict([['FOX1A', 'AHR'], ['FEV']])
gears_model.GI_predict([['FOX1A', 'AHR'], ['FEV', 'AHR']])
To use your own dataset, create a scanpy adata variable with a gene_name column in adata.var, and two columns condition, cell_type in adata.obs. Then run:
pert_data.new_data_process(dataset_name = 'XXX', adata = adata)
# to load the processed data
pert_data.load(data_path = './data/XXX')
Demos
| Name | Description |
|---|---|
| Dataset Tutorial | Tutorial on how to use the dataset loader and read customized data |
| Model Tutorial | Tutorial on how to use the GEARS model to train a predictor |
| Plot top 20 DE genes | Tutorial on how to plot the top 20 DE genes |
| Uncertainty | Tutorial on how to train an uncertainty-aware GEARS model |
Cite Us
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file cell-gears-0.0.1.tar.gz.
File metadata
- Download URL: cell-gears-0.0.1.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.2.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b764b04d46c412f4aa9cfe950e8f18fd0c0a67f7dafb1de6b009a6be216a381
|
|
| MD5 |
bb1753aaca0226170b605b38f75cea60
|
|
| BLAKE2b-256 |
cc7c6a42c01243b998fb1f02ccdf73df27b8b0bca706430c8d7e846a59a72506
|