BayraktarLab / cell2location

Comprehensive mapping of tissue cell architecture via integrated single cell and spatial transcriptomics (cell2location model)
https://cell2location.readthedocs.io/en/latest/
Apache License 2.0
324 stars 58 forks source link

How to identify cell type of each cell (or spot)? #309

Open wang-qf opened 1 year ago

wang-qf commented 1 year ago

hi, i used cell2loc to analysis spatial dataset,

i have trained a model and predicted the spatial dataset, (got q05_cell_abundance_w_sf in obsm)

i noticed the info of q05_cell_abundance_w_sf is the abundance of the cell type like: q05cell_abundance_w_sf_A_cell 2.034185 q05cell_abundance_w_sf_B_cell 2.153311 q05cell_abundance_w_sf_C_cell 1.666796

but i want to define the cell type of each cell (or spot), how should I define cell type?

(i try to use the max value of q05cell_abundance_w_sf_A_cell to define cell type, but it doesn't look as expected)

thanks for your attention and reply!

kuang-da commented 1 year ago

I'm not the author of the paper, but based on my understanding, cell2location is not designed to define or assign cell types to specific spots.

Users are expected to provide cell type information as prior knowledge before utilizing cell2location. This pre-defined cell type information is essential for estimating reference cell type signatures.

vitkl commented 1 year ago

Hi @wang-qf

Spatial sequencing data such as Visium and even Slide-seq/Stereo-seq don't measure single cells. It extracts RNA from adjacent cells - many cells for Visium (3-50 depending on the tissue) and overlapping cells for higher resolution technologies. Based on how these technologies work it is not correct to assign cell-type labels to Visium spots and to locations in high-res technologies. You can talk about locations with the highest abundance of selected cell types - where each location can be high in the abundance of several cell types (eg q05_cell_abundance_w_sf > np.quantile(q05_cell_abundance_w_sf, q=0.99, axis=0).reshape([q05_cell_abundance_w_sf.shape[0], 1])). You should not be labelling Visium spots with cell type labels because that's scientifically incorrect - however, you can binarise the estimated abundance if this is necessary for downstream analysis (as above).