saezlab / liana-py

LIANA+: an all-in-one framework for cell-cell communication
http://liana-py.readthedocs.io/
GNU General Public License v3.0
156 stars 21 forks source link

Option to aggregate individual MistyData objects from multiple samples #141

Open whitneyt1 opened 2 weeks ago

whitneyt1 commented 2 weeks ago

Hello!

Thank you for this package. I'm looking to run this pipeline on 36 Visium reactions and mistyR has the option to run MISTy on multiple individual samples and aggregate results (via collect_results) to plot the differences (plot_contrast_heatmap), as recommended in my MISTy question.

Am I able to replicate this in the python package?

Thanks!

dbdimitrov commented 2 weeks ago

Hi @whitneyt1,

You could indeed aggregate the results by passing e.g. mean as a function to aggregate_fun of the visualizations for misty. You would need to pass a concatenated dataframe of misty results across samples. Though, plotting contrasts with these functions is not available yet (which seems to be the use case that you describe in the issue that you've linked).

I hope this helps. Daniel

whitneyt1 commented 1 week ago

Great thank you. So, if I use the RandomForestModel on each individual sample, I can combine these reactions using the aggregate_fun argument within plotting functions, i can manually compare. Thank you!!!

dbdimitrov commented 1 week ago

Hi @whitneyt1,

Yes, exactly. You could also see matplotlib versions of these plots with a condition here: https://github.com/saezlab/lianaplus_manuscript/blob/main/notebooks/sma/sma_plot.ipynb

Hope this helps.

whitneyt1 commented 1 week ago

Thank you! I appreciate it!