MarcElosua / SPOTlight

Spatial Transcriptomics Capture Location Deconvolution
https://marcelosua.github.io/SPOTlight
GNU General Public License v3.0
164 stars 25 forks source link

plotInteractions #87

Closed wang0430 closed 10 months ago

wang0430 commented 1 year ago

Hello dear author, Thank you very much for developing such an excellent tool, which is of great help to spatial transcriptome. When I performed colocalization analysis on the data, I used the plotInteractions function to plot the correlation. But I want to know what the specific data for plotting colocalization looks like, so I read your source code and don't know what these two functions are (df = .count_interactions(x, min_prop), df = .statistics_interaction(x , df)), can you demonstrate what the table that plots this graph looks like?

HelenaLC commented 1 year ago
cf98 commented 1 year ago
  • As with any ggplot, the data underlying the plot can be retrieved via gg <- plotInteractions(...); gg@data.
  • Functions proceeded by a . are internals only / not exported. You can view their code here or from R via ::: (e.g., SPOTLIGHT:::.count_interactions).

Hi Helena,

Can I ask a question based on this? It seems that the interaction calculation is not based on spatial distance information, but just the cell type composition of each spot, correct?

Thanks!

HelenaLC commented 1 year ago

Yes. I can see how the term "interactions" might be misleading here. plotInteractions does not per se inspect cell-cell interaction in terms of physical (Euclidean) distances. But simply "how subpopulation proportions cooccur within spots".

I think the motivation of the name might stem from the fact that in Visium, each spot capture a couple cells already. The spots are then separated by some center-center distance. So it's hard (perhaps biologically not possible?) to capture cell-cell interaction/communication in the classical sense, because we do not have single cells. Hence, checking which subpopulations are captured by the same spot is a proxy of "interaction".

(All that is just my interpretation, but maybe Marc had something else in mind when he implemented this back then ;)

Also to note that, in newer higher-resolution spot-based such as STEREO-seq and HDST, "classical" cell-cell interaction that incorporates expression, cellular distances, and ligand-receptor pairs etc. might be applicable (especially when sub-cellular spots can be segmented). But for Visium, I am not that sure.

MarcElosua commented 1 year ago

I agree with Helena that the function's name is misleading, apologies for that. I will update the description of the function in the updated version!

Helena is spot on with her explanation. Ultimately, this function checks how many times each cell type is co-localized with another using the proportion of co-localizing or the Jaccard index.

A useful tool to carry out Spatially aware Ligand-Receptor analysis is CellChat. Be aware of the assumptions of it makes, but it is a very good starting point.

cf98 commented 1 year ago

Yes. I can see how the term "interactions" might be misleading here. plotInteractions does not per se inspect cell-cell interaction in terms of physical (Euclidean) distances. But simply "how subpopulation proportions cooccur within spots".

I think the motivation of the name might stem from the fact that in Visium, each spot capture a couple cells already. The spots are then separated by some center-center distance. So it's hard (perhaps biologically not possible?) to capture cell-cell interaction/communication in the classical sense, because we do not have single cells. Hence, checking which subpopulations are captured by the same spot is a proxy of "interaction".

(All that is just my interpretation, but maybe Marc had something else in mind when he implemented this back then ;)

Also to note that, in newer higher-resolution spot-based such as STEREO-seq and HDST, "classical" cell-cell interaction that incorporates expression, cellular distances, and ligand-receptor pairs etc. might be applicable (especially when sub-cellular spots can be segmented). But for Visium, I am not that sure.

Thank you Helena!

cf98 commented 1 year ago

I agree with Helena that the function's name is misleading, apologies for that. I will update the description of the function in the updated version!

Helena is spot on with her explanation. Ultimately, this function checks how many times each cell type is co-localized with another using the proportion of co-localizing or the Jaccard index.

A useful tool to carry out Spatially aware Ligand-Receptor analysis is CellChat. Be aware of the assumptions of it makes, but it is a very good starting point.

Thank you! I think co-localization is also very helpful. Can I ask a follow-up question? I thought about using this function to visualize deconvolution results from multiple tools, but it seems many other tools won't give absolute 0 values to a specific cell type fraction, but very small values (it seems Spotlight is not this case?), that way using this function might not be appropriate. Would it allow us to set min_frac to different values, or is 0 the most optimal for Spotlight output?

Thanks!

MarcElosua commented 1 year ago

Hi @cf98

In SPOTlight I usually use a threshold that if a cell type is predicted to contribute less than 3% to a spot it is fitting noise. Maybe you can do something similar. Something else that you can use is to measure the proportionality between them using the propr package.

cf98 commented 1 year ago

Thank you! Just realized it's an option. I will check out the propr package.