decoupler.pl.order_targets

Contents

decoupler.pl.order_targets#

decoupler.pl.order_targets(adata, net, source, order, score='score_ulm', label=None, nbins=100, top=10, pos_cmap='Reds', neg_cmap='Blues', color_score='#88c544', vmin=None, vmax=None, **kwargs)#

Plot a source score, together with its targets readouts, along a continuous ordered process such as pseudotime.

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

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

  • source (str) – Which source from net to show.

  • order (str) – The name of the column in adata.obs to consider for ordering.

  • score (str (default: 'score_ulm')) – adata.obsm key where enrichment scores are stored.

  • label (str | None (default: None)) – The name of the column in adata.obs to consider for coloring the grouping. By default None.

  • nbins (int (default: 100)) – Number of bins to use.

  • top (int (default: 10)) – How many targets to show ranked by their standard deviation along the ordered process.

  • pos_cmap (str (default: 'Reds')) – Colormap for targets with positive weights.

  • net_cmap – Colormap for targets with negative weights.

  • color_score (str (default: '#88c544')) – Color used to plot the enrichment score.

  • vmin (int | float (default: None)) – Minimum value to color.

  • vmax (int | float (default: None)) – Minimum value to color.

  • 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, net = dc.ds.toy(pstime=True)
dc.mt.ulm(adata, net, tmin=3)
dc.pl.order_targets(
    adata=adata,
    net=net,
    label="group",
    source="T1",
    order="pstime",
)