dmcable / spacexr

Spatial-eXpression-R: Cell type identification (including cell type mixtures) and cell type-specific differential expression for spatial transcriptomics
GNU General Public License v3.0
305 stars 73 forks source link

RCTD method's cell type weights doesn't sum to 1 #193

Open Lahiru-lsb opened 8 months ago

Lahiru-lsb commented 8 months ago

Hi,

I'm using the RCTD method for cell type deconvolution. When I apply RCTD in both full and doublet modes, the results, which include the cell type weights for each pixel, don't sum up to 1. I thought these weights represent the cell type proportions for each spot (pixel), and so, shouldn't they add up to 1 for each pixel?

For further clarification, I have attached a screenshot of the output I obtained using the same codes and data provided by the vignette. In the below output, we can see that the proportions don't add to 1. I hope you can help me clarify this matter.

image

dpcook commented 7 months ago

Don't know enough to know exactly how to interpret differences in weight sums, but just note that this is mentioned in their vignette where they run the normalize_weights() function, which just seems to rescale each spot to sum to 1 with weight / sum(weights).