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 viagggrid. All single-plot styling and threshold options behave the same as involcano().- Parameters:
data (
AnnData) – The AnnData object holding the differential expression results indata.uns[key](scanpy’srank_genes_groupsconvention).groups (
Sequence[str]) – The group names to plot results for. One subplot per group.group_by (
str | None, defaultNone) – Observation column to group by. When provided,data.uns[key]is (re)computed viascanpy.tl.rank_genes_groupsif it is missing or was computed with a differentgroupby. Computed once on the first subplot and reused thereafter.key (
str, default'rank_genes_groups') – The key underdata.unsstoring the differential expression results.use_adjusted_pvalue (
bool, defaultTrue) – Whether to use adjusted p-values (pvals_adj) instead of raw p-values.logfoldchange_threshold (
float, default1.0) – Absolute log fold change threshold used to label up/down regulated.pvalue_threshold (
float, default0.05) – P-value threshold used to label significance.mapping (
FeatureSpec | None, defaultNone) – 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, default2.0) – Default point size; can be overridden viapoint_kwargs.alpha (
float, default0.8) – Default point alpha; can be overridden viapoint_kwargs.show_threshold_lines (
bool, defaultTrue) – Whether to draw the dashed threshold lines.threshold_color (
str, default'#3f3f3f') – Color of the threshold lines.threshold_size (
float, default0.4) – Size (thickness) of the threshold lines.threshold_linetype (
str, default'dashed') – Line type of the threshold lines.threshold_kwargs (
dict | None, defaultNone) – Additional parameters passed to the thresholdgeom_hlineandgeom_vlinelayers.top_n (
int | None, default10) – Number of top up- and top down-regulated genes (by-log10(pvalue)) to label per subplot. Set toNoneor0to disable labels.label_color (
str, default'#1f1f1f') – Color of the gene labels.label_size (
float, default4.0) – Size of the gene labels.segment_size (
float, default0.4) – Width of the line segment connecting the label to the point.label_kwargs (
dict | None, defaultNone) – Additional parameters passed to thegeom_text_repellabel layer.nonsignificant_subsample (
int | None, default2000) – 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 toNoneto 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, defaultNone) – Additional keyword arguments forwarded toscanpy.tl.rank_genes_groupswhengroup_bytriggers a (re)compute.tooltips (
{'none'}| Sequence[str] | FeatureSpec | None, defaultNone) – Tooltips to show when hovering over the geom.interactive (
bool, defaultFalse) – Whether to make the plot interactive.share_labels (
bool, defaultFalse) – 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, defaultFalse) – 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, defaultNone) – Layers to add to all the plots in the grid.ncol (
int, defaultNone) – Number of columns in grid. If not specified, shows plots horizontally, in one row.sharex (
str | None, defaultNone) – Controls sharing of axis limits between subplots in the grid. Seelets_plot.gggrid().sharey (
str | None, defaultNone) – Controls sharing of axis limits between subplots in the grid. Seelets_plot.gggrid().widths (
list[float], defaultNone) – Relative width of each column of the grid.heights (
list[float], defaultNone) – Relative height of each row of the grid.hspace (
float | None, defaultNone) – Cell horizontal/vertical spacing in px.vspace (
float | None, defaultNone) – Cell horizontal/vertical spacing in px.fit (
bool, defaultNone) – Whether to stretch each plot to match the aspect ratio of its cell.align (
bool, defaultNone) – Whether to align inner areas of plots.guides (
str, default'auto') – How guides (legends/colorbars) should be treated in the layout. Seelets_plot.gggrid().**point_kwargs – Additional parameters for the
geom_pointlayer 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.