saezlab / liana-py

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

circle_plot function for visualizing cell-cell communication #139

Open WeipengMO opened 2 months ago

WeipengMO commented 2 months ago

Hi Daniel,

Thank you for developing such an excellent tool! This PR introduces updates to the circle_plot function in the plotting module, which visualizes cell-cell communication networks using a circular layout.

Basic Usage

The circle_plot function can be used to visualize the interactions between all cell types:

li.plotting.circle_plot(
    adata,
    liana_res
)

image

To focus on the interactions of a specific cell type, you can specify the source_cell_type and/or target_cell_type parameter:

li.plotting.circle_plot(
    adata,
    liana_res,
    source_cell_type = 'CD4 T cells'
)

image

I also added a jupyter notebook (circle_plot.zip) to introduce the examples and provide context. Let me know if you'd like me to make any further changes!

Best, Weipeng

dbdimitrov commented 2 months ago

Hi @WeipengMO,

I made some changes to align the function a bit more to the rest in liana, would you like to have a look and let me know what you think?

Thanks a lot for the PR :pray:

PS. We still need to list it in the API docs and add a test - let me know I you prefer that I do it.

dbdimitrov commented 2 months ago

Hi @WeipengMO,

The only thing I'm not 100% convinced of is the groupby parameter and saving the colours to the anndata object. It makes the function specific to the ligand-receptor/single-cell methods of liana only, while it could be a bit more general (e.g. for spatial data or tensor/mofa results).

Would there be any issues if we omit these lines and have the function be a bit more broadly applicable? How strongly do you feel about this?

WeipengMO commented 2 months ago

Hi @dbdimitrov ,

I agree with your perspective. Since my current work primarily focuses on single-cell sequencing, so I focus on these aspects for now. However, I understand the value of making the function more generalizable to accommodate other types of results. This would make it more versatile for broad applications, including spatial data, which I plan to work with. 🫡