decoupler.pl.volcano

Contents

decoupler.pl.volcano#

decoupler.pl.volcano(data, x, y, net=None, name=None, top=5, thr_stat=0.5, thr_sign=0.05, max_stat=None, max_sign=None, color_pos='#D62728', color_neg='#1F77B4', color_null='gray', kw_scatter=None, **kwargs)#

Plot logFC and p-values from a long formated data-frame.

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

  • x (str) – Column name of data storing the change statitsics.

  • y (str) – Column name of data storing the associated p-values.

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

  • name (str | None (default: None)) – Name of the source to subset net.

  • top (int | str | list[str] (default: 5)) – Number of top differentially abundant features to show. Can also be a gene name (str) or a list of gene names (list[str]) to annotate specific features.

  • thr_stat (float (default: 0.5)) – Significance threshold for change statitsics.

  • thr_sign (float (default: 0.05)) – Significance threshold for p-values.

  • max_stat (float | None (default: None)) – Limit of change statitsics to plot in absolute value.

  • max_sign (float | None (default: None)) – Limit of p-values to plot in -log10.

  • color_pos (str (default: '#D62728')) – Color to plot significant positive features.

  • color_neg (str (default: '#1F77B4')) – Color to plot significant negative features.

  • color_null (str (default: 'gray')) – Color to plot rest of the genes.

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

  • 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
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")
dc.pl.volcano(data=deg, x="logfoldchanges", y="pvals")