Teichlab / celltypist

A tool for semi-automatic cell type classification
https://www.celltypist.org/
MIT License
278 stars 44 forks source link

Predition error #24

Closed Yuxin-Cui closed 2 years ago

Yuxin-Cui commented 2 years ago

When I ran the prediction porcedure below, there was an error message.

predictions = celltypist.annotate(adata, model = 'Immune_All_Low.pkl', majority_voting = True) ValueError: 🛑 Invalid expression matrix, expect log1p normalized expression to 10000 counts per cell

I then tried to normalized the adata, it showed:

adata.raw = sc.pp.log1p(adata, copy=True) WARNING: adata.X seems to be already log-transformed.

Is there any way to fix it?

ChuanXu1 commented 2 years ago

@Yuxin-Cui, what is the format of your adata.X or adata.raw.X? You can start from the raw count, and do sc.pp.normalize_total(adata, target_sum = 1e4) followed by sc.pp.log1p(adata). The resulting expression matrix is the expected input for CellTypist.

Yuxin-Cui commented 2 years ago

Thanks for your suggestion. It worked.