decoupler.pl.filter_by_prop

Contents

decoupler.pl.filter_by_prop#

decoupler.pl.filter_by_prop(adata, min_prop=0.1, min_smpls=2, kw_hist=None, **kwargs)#

Plot to help determining the thresholds of the decoupler.pp.filter_by_prop function.

Parameters:
  • adata (AnnData) – Annotated data matrix with observations (rows) and features (columns).

  • min_prop (float (default: 0.1)) – Minimum proportion of cells that express a gene in a sample.

  • min_smpls (int (default: 2)) – Minimum number of samples with bigger or equal proportion of cells with expression than min_prop.

  • kw_hist (dict | None (default: None)) – Keyword arguments passed to matplotlib.pyplot.hist.

  • 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_by_prop(tcells)