Variable grouping to `squidpy.pl.ligrec`
Description
(This is a suggestion/request; love the software)
The dotplots output by squidpy.pl.ligrec are beautiful, but sometimes the number of ligand-receptor interactions can get unwieldy, and are not sorted in a reliable way (though the "means" and "pvalues" dataframes can be sorted by index in order to plot alphabetically, for instance).
I really like how scanpy's matrixplot has the var_group_positions/var_group_labels arguments so that the genes can be grouped and labelled with a bracket of arbitrary names like "inflammation genes" or "T cell markers", to make long dotplots easier to read.
My idea for implementing this in squidpy would be to either do it manually like var_group_positions in scanpy, or pass a column from the ["metadata"] dataframe in the results dictionary to annotate the cell-cell interactions. So for instance drawing from omnipath, if I set the column to sort by as 'secreted_intercell_source', it would bifurcate into "True" and "False" groups together, and maybe alphabetize.
Ultimately, the goal would be to add a column to the metadata that annotates the pathway, like "Delta-Notch signals" and have those all grouped together with a little bracket. That may be beyond the scope but easily doable if the bracket plotting step is done.
Having had a look at the plotting function I think it may be a little bit over my head to implement this though, but I wanted to put it out there as a suggestion - thanks ...
Hi @dnjst , thanks for the suggestions, I think it's great!
Regarding impl., think it should not be a problem (will take a look in the upcoming weeks).
The only issue I see now is that we use var_group_positions/var_group_labels to indicate what is the target cluster of the interaction, so might need to find another way of doing this (maybe as gene1 (cluster1) | gene2 (cluster2)).
hi @dnjst , do you still have interest in submitting this as a contribution? Otherwise would close this due to inactivity