decoupler.pl.filter_samples#

decoupler.pl.filter_samples(adata, groupby=None, log=True, min_cells=10, min_counts=1000, kw_scatterplot=None, **kwargs)#

Plot to assess the quality of the obtained pseudobulk samples from decoupler.pp.pseudobulk.

Parameters:
adata AnnData

Annotated data matrix with observations (rows) and features (columns).

groupby str | list | None (default: None)

Name or nomes of the adata.obs column/s to group by.

log bool (default: True)

If set, log10 transform the psbulk_n_cells and psbulk_counts columns during visualization.

min_cells int | float (default: 10)

Minimum number of cells per sample.

min_counts int | float (default: 1000)

Minimum number of counts per sample.

kw_scatterplot dict | None (default: None)

Keyword arguments passed to seaborn.scatterplot.

ax

An existing matplotlib.axes._axes.Axes instance to plot on. If None, a new figure and axes will be created.

figsize

Size of the figure in inches as (width, height).

dpi

Dots per inch for the figure resolution.

return_fig

If True, plotting methods should return the figure object instead of showing it.

save

If set, path to save the plot automatically to a file.

Return type:

None | Figure

Returns:

If return_fig=True, returns matplotlib.figure.Figure instance.

Example

import decoupler as dc

adata = dc.ds.covid5k()
pdata = dc.pp.pseudobulk(adata, sample_col="individual", groups_col="celltype")
tcells = pdata[pdata.obs["celltype"] == "T cell"].copy()
dc.pl.filter_samples(tcells, groupby="individual")