liana.pl.dotplot_by_sample

liana.pl.dotplot_by_sample#

liana.pl.dotplot_by_sample(adata=None, uns_key='liana_res', liana_res=None, sample_key='sample', colour=None, size=None, inverse_colour=False, inverse_size=False, source_labels=None, target_labels=None, ligand_complex=None, receptor_complex=None, size_range=(2, 9), cmap='viridis', figure_size=(8, 6), return_fig=True)#

A dotplot of interactions by sample

Parameters:
adata AnnData | None (default: None)

Annotated data object.

uns_key str (default: 'liana_res')

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

liana_res DataFrame | None (default: None)

liana_res a DataFrame in liana’s format.

sample_key str (default: 'sample')

sample_key used to group different samples/contexts from liana_res. Defaults to ‘sample’.

colour str | None (default: None)

column in liana_res to define the colours of the dots.

size str | None (default: None)

column in liana_res to define the size of the dots.

inverse_colour bool (default: False)

Whether to -log10 the colour column for plotting. False by default.

inverse_size bool (default: False)

Whether to -log10 the size column for plotting. False by default.

source_labels str | None (default: None)

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

target_labels str | None (default: None)

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

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

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

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

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

size_range tuple[float, float] (default: (2, 9))

Define size range. Tuple of (min, max) integers.

cmap str (default: 'viridis')

Colour map to use for plotting.

figure_size tuple[float, float] (default: (8, 6))

Figure x,y size

return_fig bool (default: True)

bool whether to return the fig object.

Return type:

plotnine.ggplot | None

Returns:

Returns a dot plot for the specified interactions by sample.

Examples

Expects a by-sample result, as written by any method’s .by_sample:

>>> import liana as li
>>> adata = li.ds.generate_toy_adata()
>>> li.mt.rank_aggregate.by_sample(adata, sample_key="sample", groupby="bulk_labels", n_perms=None)
>>> p = li.pl.dotplot_by_sample(adata, colour="lr_means", size="magnitude_rank", ligand_complex="HLA-DRA")