decoupler.pl.leading_edge

Contents

decoupler.pl.leading_edge#

decoupler.pl.leading_edge(df, net, stat, name, cmap='RdBu_r', color='#88c544', **kwargs)#

Plot the running score of GSEA.

Parameters:
  • data – DataFrame containing feature-level statistics. Feature names must be in df.index.

  • net (DataFrame) – Dataframe in long format. Must include source and target columns, and optionally a weight column.

  • stat (str) – Column with the ranking statistic, for example t-values or log2FCslog_{2}FCs.

  • name (str) – Which source to plot.

  • cmap (default: 'RdBu_r') – Colormap to use.

  • color (default: '#88c544') – Color to plot the running-sum statistic.

  • 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:

tuple[None | Figure, ndarray]

Returns:

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

Example

import decoupler as dc
import scanpy as sc

adata, net = dc.ds.toy()
sc.tl.rank_genes_groups(adata, groupby="group")
deg = sc.get.rank_genes_groups_df(adata, group="A").set_index("names")
_, le = dc.pl.leading_edge(
    deg,
    stat="scores",
    net=net,
    name="T1",
)
le