liana.pl.tileplot

Contents

liana.pl.tileplot#

liana.pl.tileplot(adata=None, liana_res=None, fill=None, label=None, label_fn=None, source_labels=None, target_labels=None, ligand_complex=None, receptor_complex=None, uns_key='liana_res', top_n=None, orderby=None, orderby_ascending=False, orderby_absolute=True, filter_fn=None, source_title=None, target_title=None, cmap='viridis', figure_size=(5, 5), label_size=12, return_fig=True)#

Tileplot interactions by source and target cells

Parameters:
adata AnnData | None (default: None)

Annotated data object.

liana_res DataFrame | None (default: None)

liana_res a DataFrame in liana’s format.

fill str | None (default: None)

column in liana_res to define the fill of the tiles

label str | None (default: None)

column in liana_res to define the label of the tiles

label_fn Callable[[object], str] | None (default: None)

callable to apply to the label column

source_labels str | list[str] | None (default: None)

List of labels to use as source, the rest are filtered out.

target_labels str | list[str] | None (default: None)

List of labels to use as target, the rest are filtered out.

ligand_complex str | list[str] | None (default: None)

list of ligand complexes to filter the interactions to be plotted. Defaults to None.

receptor_complex str | list[str] | None (default: None)

list of receptor complexes to filter the interactions to be plotted. Defaults to None.

uns_key str (default: 'liana_res')

Key in adata.uns that contains the LIANA results. Default is 'liana_res'.

top_n int | None (default: None)

top_n entities to plot.

orderby str | None (default: None)

If top_n is not None, order the interactions by this column

orderby_ascending bool (default: False)

If top_n is not None, specify how to order the interactions

orderby_absolute bool (default: True)

If top_n is not None, whether to order by the absolute value of the orderby column.

filter_fn Callable[[Series], bool] | None (default: None)

A function, applied along the columns (axis=1), used to filter the results to be plotted.

source_title str | None (default: None)

Title for the source facet. Default is ‘Source’

target_title str | None (default: None)

Title for the target facet. Default is ‘Target’

cmap str (default: 'viridis')

Colour map to use for plotting.

figure_size tuple[float, float] (default: (5, 5))

Figure x,y size

label_size int (default: 12)

Size of the label text

return_fig bool (default: True)

bool whether to return the fig object.

Return type:

plotnine.ggplot | None

Returns:

The resulting tileplot

Examples

fill and label each name a suffix shared by a ligand_/receptor_ pair of columns, so both sides of every interaction are tiled next to each other:

>>> import liana as li
>>> adata = li.ds.generate_toy_adata()
>>> li.mt.cellphonedb(adata, groupby="bulk_labels", n_perms=100)
>>> p = li.pl.tileplot(adata, fill="means", label="props", top_n=10, orderby="lr_means")