JackieHanLab / TOSICA

Transformer for One-Stop Interpretable Cell-type Annotation
MIT License
121 stars 23 forks source link

TOSICA: Transformer for One-Stop Interpretable Cell-type Annotation

Workflow

Package: TOSICA

We created the python package called TOSICA that uses scanpy ans torch to explainablely annotate cell type on single-cell RNA-seq data.

Requirements

Create environment

conda create -n TOSICA python=3.8 scanpy
conda activate TOSICA
conda install pytorch=1.7.1 torchvision=0.8.2 torchaudio=0.7.2 cudatoolkit=10.1 -c pytorch

Installation

The TOSICA python package is in the folder TOSICA. You can simply install it from the root of this repository using

pip install .

Alternatively, you can also install the package directly from GitHub via

pip install git+https://github.com/JackieHanLab/TOSICA.git

Environment has been tested

TOSICA.yaml

Usage

Step 1: Training the model

TOSICA.train(ref_adata, gmt_path,project=<my_project>,label_name=<label_key>)

Input:

Pre-prepared mask:

Output:

Step 2: Prediect by the model

new_adata = TOSICA.pre(query_adata, model_weight_path = <path to optional weight>,project=<my_project>)

Input:

Output:

Warning: the var_names (genes) of the ref_adata and query_adata must be consistent and in the same order.

query_adata = query_adata[:,ref_adata.var_names]

Please run the code to make sure they are the same.

Example Demo:

Guided Tutorial

Cite TOSICA:

Chen, J., Xu, H., Tao, W. et al. Transformer for one stop interpretable cell type annotation. Nat Commun 14, 223 (2023).