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
321 stars 58 forks source link

matrix factorisation (NMF) heatmap #227

Open wangjiawen2013 opened 1 year ago

wangjiawen2013 commented 1 year ago

Hi, I am running run_colocation to identifying cellular compartments / tissue zones using matrix factorisation (NMF). For the plots generated by plot_cell_type_loadings(), It is said that "Shown are relative weights, normalized across components for every cell type" according to cell2location tutorial https://cell2location.readthedocs.io/en/latest/notebooks/cell2location_tutorial.html. However, it seems that the dot are not normalized and different from that in cell2location nature methods paper. The tutorial: image Nature method paper: image Besids, what's the relationship between the NMF weights and cell abundance ?

vitkl commented 1 year ago

In the paper, the values are normalised by maximum value per cell type. In the package, the values are normalised by sum. You can load the outputs and normalise them in the same way.

NMF is used to factorise cell abundance. You can interpret the weights normalised by sum as the % of cells of a given cell type that is contributed by each of the NMF factors. Normalising by maximum can be interpreted as the relative contribution of each NMF factor to the spatial distribution of each cell type (very similar, but it's no longer %).