saezlab / liana

LIANA: a LIgand-receptor ANalysis frAmework
https://saezlab.github.io/liana/
GNU General Public License v3.0
160 stars 28 forks source link

Multiple comparison, such as 3 or 4 conditions #158

Open mainharryHR opened 3 weeks ago

mainharryHR commented 3 weeks ago

Dear everyone,

I have 3 comparisons in my dataset. It seems the Liana 0.1.12 only support 2 comparisons for now. Should I subset the 2 conditions each time from Seurat or singleCellExperiment object? which might affect the statistical test. But I believe it has minor effects of statistics after subsetting.

It seems people has already discussed this issue before, but the strategies are still not very clear to me. :)

Any comments are welcome.

Thank you all.

Best,

dbdimitrov commented 3 weeks ago

Hi @mainharryHR,

LIANA when combined with Tensor-cell2cell supports any number of conditions. I would refer you to this tutorial where we look at 3 conditions at the same time: https://ccc-protocols.readthedocs.io/en/latest/notebooks/ccc_R/QuickStart.html, along with the detailed vignettes that go over the same process but more in depth.

Essentially, the way this analysis works is that it's agnostic of any condition (comparison) as it is unsupervised. So, technically you are assuming that if your conditions are indeed primary drivers of changes in CCC, then you should capture those in an unbiased (unsupervised) manner.

Then, one could do any statistical comparison (test) on the sample loadings (importances) that Tensor-cell2cell provides.

Hope this helps :)

Daniel

mainharryHR commented 2 weeks ago

Thank you for the suggestions. I tried pipeline based on the tutorial, It seems the multiple comparison only apply to one plot pwc <- pwc %>% add_xy_position(x = "condition") ggboxplot, but not for other plots, such as heatmap, c2c$plotting$ccc_networks_plot, gsea.dotplot,

I have 3 conditions, I want to compare with each other in other plot as well. How should I do that? It seems this tutorial skipped other plots for multiple comparisons.

It seems I still need to subset the conditions. If so, at which step, I should subset without affecting or twisting the statistics.

Many thanks

Best

Screenshot 2024-07-09 at 13 55 13 Screenshot 2024-07-09 at 14 03 41
dbdimitrov commented 1 week ago

Hi @mainharryHR,

See the factors and hence factor loadings that you get are summaries of the signal across all your samples. So, the plots do work across an indefinite number of conditions as long as you have some factor that captures differences according to your conditions :)

mainharryHR commented 1 week ago

Thank you for the information. How should plot the heatmap for 3 different comparisons? for examples (conditions: A, B, C): A vs B, A vs C, B vs C. liana::plot_lr_heatmap(sce = TcellsLiana, n = 8), I can not find the arguments to input the conditions for heatmap or gsea dot plot.

Please help. :)

Best,

dbdimitrov commented 1 week ago

Hi @mainharryHR,

So, I think the point is that this analysis doesn't necessarily do that as the tensor decomposition is an unsupervised process indepedent of the condition labels.

You can think of this as being similar to PCA, except rather than having principle components, you have factors that are linear combinations of the patterns in your data.

If the sample/context loadings separate your conditions in a specific factor, then the loadings in the other dimensions of that factor are also associated to the condition.

I hope this helps a bit :)

mainharryHR commented 1 week ago

Thank you for the fast response and important information.

If the sample/context loadings separate your conditions in a specific factor, then the loadings in the other dimensions of that factor are also associated to the condition.
I feel this strategy might have noises from extra conditions or information.

I guess if I really want to plot the cleaner or less noisy heatmap or dot plot, I need to subset the 2 conditions from seurat object.

Have a nice day and thank you for the nice packages.