A tool for semi-automatic cell type annotation
Project description
Celltypist
Automated cell type annotation for scRNA-seq datasets
Install
pip install celltypist-dev
Usage
Python package
Sample data and default model
import celltypist sample_input = celltypist.samples.get_sample_csv() result = celltypist.annotate(sample_input) result.predicted_labels_as_df().to_csv("labels.csv")
Using your own data
import celltypist input_data = "/path/to/cell_by_gene_matrix.csv" result = celltypist.annotate(input_data) result.write_excel("annotation_result.xlsx")
Using included models
Included models are downloaded automatically inside a inscript when the defualt model tries to be loaded or by using celltypist --update-models
from the command line.
List models included in with the package
import celltypist for m in celltypist.models.get_all_models(): print(f"model = '{m}'")
Use the default model by name
import celltypist input_data = "/path/to/cell_by_gene_matrix.csv" default_model = celltypist.models.get_default_model() result = celltypist.annotate(input_data, model=default_model) result.write_excel("annotation_result.xlsx")
Use a custom model name from the model list
import celltypist input_data = "/path/to/cell_by_gene_matrix.csv" result = celltypist.annotate(input_data, model="Immune_v5_allData_lowest_all.pkl") result.write_excel("annotation_result.xlsx")
Use custom models
import celltypist indata = "/path/to/cell_by_gene_matrix.csv" custom_model = "/path/to/custom_model.pkl" result = celltypist.annotate(input_data, model=custom_model) result.write_excel("annotation_result.xlsx")
Full example
import celltypist indata = "/path/to/cell_by_gene_matrix.csv" custom_model = "/path/to/custom_model.pkl" result = celltypist.annotate(input_data, model=custom_model) result.write_excel("annotation_result.xlsx") print(result.summary_as_df()) result.predicted_labels_as_df().to_csv("labels.csv") result.probability_matrix_as_df().to_csv("prob_matrix.csv")
Command Line
Basic usage
celltypist --indata=/path/to/dataset.csv
Advance usage
celltypist --indata /path/to/dataset.csv \ # input dataset --model /path/to/model.pkl \ # path to model --outpref Dataset1_ \ # add a prefix to the output files --outdir /path/to/output \ # set an output directory for the files
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size celltypist_dev-0.1.10-py3-none-any.whl (2.2 MB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size celltypist-dev-0.1.10.tar.gz (1.9 MB) | File type Source | Python version None | Upload date | Hashes View |
Close
Hashes for celltypist_dev-0.1.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6debcbd7ba75e88b40935ba631812aa08cbc5d3fd3c3254016400b7f761d7a9 |
|
MD5 | 15498c8f03349ff87b01256ae6a92b92 |
|
BLAKE2-256 | ac614e55c8fa773a69db1b70298bc2944395aa0c126b0e0664f7532dde313687 |