ligrec

ligrec#

squidpy.pl.ligrec(adata, *, cluster_key=None, source_groups=None, target_groups=None, means_range=(-inf, inf), pvalue_threshold=1.0, remove_empty_interactions=True, remove_nonsig_interactions=False, dendrogram=None, alpha=0.001, swap_axes=False, title=None, figsize=None, dpi=None, save=None, **kwargs)[source]#

Plot the result of a receptor-ligand permutation test.

The result was computed by squidpy.gr.ligrec().

\(molecule_1\) belongs to the source clusters displayed on the top (or on the right, if swap_axes = True, whereas \(molecule_2\) belongs to the target clusters.

Parameters:
adata AnnData | Mapping[str, DataFrame]

Annotated data object. It can also be a dict, as returned by squidpy.gr.ligrec().

cluster_key str | None (default: None)

Key in anndata.AnnData.obs where clustering is stored. Only used when adata is of type AnnData.

source_groups str | Sequence[str] | None (default: None)

Source interaction clusters. If None, select all clusters.

target_groups str | Sequence[str] | None (default: None)

Target interaction clusters. If None, select all clusters.

means_range tuple[float, float] (default: (-inf, inf))

Only show interactions whose means are within this closed interval.

pvalue_threshold float (default: 1.0)

Only show interactions with p-value <= pvalue_threshold.

remove_empty_interactions bool (default: True)

Remove rows and columns that only contain interactions with NaN values.

remove_nonsig_interactions bool (default: False)

Remove rows and columns that only contain interactions that are larger than alpha.

dendrogram Literal['interacting_molecules', 'interacting_clusters', 'both'] | None (default: None)

How to cluster based on the p-values. Valid options are:

  • None - do not perform clustering.

  • ’interacting_molecules’ - cluster the interacting molecules.

  • ’interacting_clusters’ - cluster the interacting clusters.

  • ’both’ - cluster both rows and columns. Note that in this case, the dendrogram is not shown.

alpha float | None (default: 0.001)

Significance threshold. All elements with p-values <= alpha will be marked by tori instead of dots.

swap_axes bool (default: False)

Whether to show the cluster combinations as rows and the interacting pairs as columns.

title str | None (default: None)

Title of the plot.

figsize tuple[float, float] | None (default: None)

Size of the figure in inches.

dpi int | None (default: None)

Dots per inch.

save str | Path | None (default: None)

Whether to save the plot.

scalebar_kwargs

Keyword arguments for matplotlib_scalebar.ScaleBar.

edges_kwargs

Keyword arguments for networkx.drawing.nx_pylab.draw_networkx_edges() [Hagberg et al., 2008].

kwargs Any

Keyword arguments for matplotlib.pyplot.scatter() or matplotlib.pyplot.imshow().

kwargs

Keyword arguments for scanpy.pl.DotPlot.style() or scanpy.pl.DotPlot.legend().

Returns:

None – Nothing, just plots the figure and optionally saves the plot.