volcanos#

volcanos(data: AnnData, groups: Sequence[str], *, group_by: str | None = None, key: str = 'rank_genes_groups', use_adjusted_pvalue: bool = True, logfoldchange_threshold: float = 1.0, pvalue_threshold: float = 0.05, mapping: FeatureSpec | None = None, color_up: str = '#b22222', color_down: str = '#6495ed', color_nonsignificant: str = '#bebebe', size: float = 2.0, alpha: float = 0.8, show_threshold_lines: bool = True, threshold_color: str = '#3f3f3f', threshold_size: float = 0.4, threshold_linetype: str = 'dashed', threshold_kwargs: dict | None = None, top_n: int | None = 10, label_color: str = '#1f1f1f', label_size: float = 4.0, segment_size: float = 0.4, label_kwargs: dict | None = None, nonsignificant_subsample: int | None = 2000, variable_column: str = 'variable', logfoldchange_column: str = 'logfoldchange', pvalue_column: str = 'pvalue', neg_log_pvalue_column: str = 'neg_log_pvalue', significance_column: str = 'significance', up_label: str = 'up', down_label: str = 'down', nonsignificant_label: str = 'ns', rank_genes_kwargs: dict | None = None, tooltips: Literal['none'] | Sequence[str] | FeatureSpec | None = None, interactive: bool = False, share_labels: bool = False, share_axis: bool = False, layers: Sequence[FeatureSpec | LayerSpec] | FeatureSpec | LayerSpec | None = None, ncol: int | None = None, sharex: str | None = None, sharey: str | None = None, widths: list[float] | None = None, heights: list[float] | None = None, hspace: float | None = None, vspace: float | None = None, fit: bool | None = None, align: bool | None = None, guides: str = 'auto', **point_kwargs)#

Grid of volcano plots, one per group.

Builds a volcano plot for each entry in groups (vs the rest) and arranges them in a grid via gggrid. All single-plot styling and threshold options behave the same as in volcano().

Parameters:
  • data (AnnData) – The AnnData object holding the differential expression results in data.uns[key] (scanpy’s rank_genes_groups convention).

  • groups (Sequence[str]) – The group names to plot results for. One subplot per group.

  • group_by (str | None, default None) – Observation column to group by. When provided, data.uns[key] is (re)computed via scanpy.tl.rank_genes_groups if it is missing or was computed with a different groupby. Computed once on the first subplot and reused thereafter.

  • key (str, default 'rank_genes_groups') – The key under data.uns storing the differential expression results.

  • use_adjusted_pvalue (bool, default True) – Whether to use adjusted p-values (pvals_adj) instead of raw p-values.

  • logfoldchange_threshold (float, default 1.0) – Absolute log fold change threshold used to label up/down regulated.

  • pvalue_threshold (float, default 0.05) – P-value threshold used to label significance.

  • mapping (FeatureSpec | None, default None) – Additional aesthetic mappings, the result of aes().

  • color_up (str, default '#b22222') – Color for significantly up-regulated points.

  • color_down (str, default '#6495ed') – Color for significantly down-regulated points.

  • color_nonsignificant (str, default '#bebebe') – Color for non-significant points.

  • size (float, default 2.0) – Default point size; can be overridden via point_kwargs.

  • alpha (float, default 0.8) – Default point alpha; can be overridden via point_kwargs.

  • show_threshold_lines (bool, default True) – Whether to draw the dashed threshold lines.

  • threshold_color (str, default '#3f3f3f') – Color of the threshold lines.

  • threshold_size (float, default 0.4) – Size (thickness) of the threshold lines.

  • threshold_linetype (str, default 'dashed') – Line type of the threshold lines.

  • threshold_kwargs (dict | None, default None) – Additional parameters passed to the threshold geom_hline and geom_vline layers.

  • top_n (int | None, default 10) – Number of top up- and top down-regulated genes (by -log10(pvalue)) to label per subplot. Set to None or 0 to disable labels.

  • label_color (str, default '#1f1f1f') – Color of the gene labels.

  • label_size (float, default 4.0) – Size of the gene labels.

  • segment_size (float, default 0.4) – Width of the line segment connecting the label to the point.

  • label_kwargs (dict | None, default None) – Additional parameters passed to the geom_text_repel label layer.

  • nonsignificant_subsample (int | None, default 2000) – Maximum number of non-significant points to keep per subplot. Significant points (up/down) are always kept in full. Reducing this shrinks the embedded data in the rendered grid (smaller HTML/notebook output) at no visible cost since the non-significant cloud is heavily overplotted. Set to None to keep every non-significant point. Sampling is deterministic (seed=42).

  • variable_column (str, default 'variable') – Output column name for the gene/feature names.

  • logfoldchange_column (str, default 'logfoldchange') – Output column name for the log fold changes.

  • pvalue_column (str, default 'pvalue') – Output column name for the p-values.

  • neg_log_pvalue_column (str, default 'neg_log_pvalue') – Output column name for the -log10(pvalue) transform.

  • significance_column (str, default 'significance') – Output column name for the categorical significance label.

  • up_label (str, default 'up') – Label for significantly up regulated features.

  • down_label (str, default 'down') – Label for significantly down regulated features.

  • nonsignificant_label (str, default 'ns') – Label for non-significant features.

  • rank_genes_kwargs (dict | None, default None) – Additional keyword arguments forwarded to scanpy.tl.rank_genes_groups when group_by triggers a (re)compute.

  • tooltips ({'none'} | Sequence[str] | FeatureSpec | None, default None) – Tooltips to show when hovering over the geom.

  • interactive (bool, default False) – Whether to make the plot interactive.

  • share_labels (bool, default False) – Whether to share axis labels across the grid. If True, only X labels on bottom row and Y labels on left column are shown.

  • share_axis (bool, default False) – Whether to share axes across the grid. If True, only X axis on bottom row and Y axis on left column is shown.

  • layers (Sequence[FeatureSpec|LayerSpec] | FeatureSpec | LayerSpec | None, default None) – Layers to add to all the plots in the grid.

  • ncol (int, default None) – Number of columns in grid. If not specified, shows plots horizontally, in one row.

  • sharex (str | None, default None) – Controls sharing of axis limits between subplots in the grid. See lets_plot.gggrid().

  • sharey (str | None, default None) – Controls sharing of axis limits between subplots in the grid. See lets_plot.gggrid().

  • widths (list[float], default None) – Relative width of each column of the grid.

  • heights (list[float], default None) – Relative height of each row of the grid.

  • hspace (float | None, default None) – Cell horizontal/vertical spacing in px.

  • vspace (float | None, default None) – Cell horizontal/vertical spacing in px.

  • fit (bool, default None) – Whether to stretch each plot to match the aspect ratio of its cell.

  • align (bool, default None) – Whether to align inner areas of plots.

  • guides (str, default 'auto') – How guides (legends/colorbars) should be treated in the layout. See lets_plot.gggrid().

  • **point_kwargs – Additional parameters for the geom_point layer of each subplot.

Returns:

SupPlotsSpec – Grid of volcano plots.

Examples

import scanpy as sc

import cellestial as cl

data = sc.read_h5ad("data/pbmc3k_pped.h5ad")

cl.volcanos(
    data,
    groups=["B Cells", "Monocytes", "Erythroid", "Lymphocytes"],
    group_by="cell_type_lvl1",
    ncol=2,
)
WARNING: It seems you use rank_genes_groups on the raw count data. Please logarithmize your data before calling rank_genes_groups.