markers#

API pages include interactive (HTML) plots that would possibly not render correctly on a mobile device.

markers(data: AnnData | MuData, groups: Sequence[str] | None = None, *, modality: str | None = None, key: str = 'rank_genes_groups', n_genes: int = 20, mapping: FeatureSpec | None = None, text_color: str = '#1f1f1f', text_size: float = 4.0, fontface: str = 'bold', angle: float = 90.0, rank_color: bool = False, line: bool = False, line_color: str = '#3f3f3f', line_size: float = 0.4, line_alpha: float = 0.6, line_kwargs: dict | None = None, variable_column: str = 'variable', score_column: str = 'score', rank_column: str = 'rank', group_column: str = 'group', interactive: bool = False, share_labels: bool = True, share_axis: bool = False, layers: Sequence[FeatureSpec | LayerSpec] | FeatureSpec | LayerSpec | None = None, ncol: int | None = 3, 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', **geom_kwargs) → SupPlotsSpec#

Grid of ranked genes per group.

Parameters:
  • data (AnnData | MuData) – The single-cell data object holding the precomputed differential expression ranking.

  • groups (Sequence[str] | None, default None) – Subset of groups to plot, one panel per group. None keeps all groups in their stored order.

  • modality (str | None, default None) – Which modality’s stored analysis results to use. Required for a multimodal object holding more than one modality, and not accepted otherwise.

  • key (str, default 'rank_genes_groups') – The key under which the precomputed ranking is stored on data.

  • n_genes (int, default 20) – Number of top genes to show per panel.

  • mapping (FeatureSpec | None, default None) – Additional aesthetic mappings, the result of aes(). Merged on top of the default aes(x=rank, y=score, label=variable).

  • text_color (str, default '#1f1f1f') – Color of the gene-name text.

  • text_size (float, default 4.0) – Size of the gene-name text.

  • fontface (str, default 'bold') – Font face of the gene-name text (e.g. ‘plain’, ‘bold’, ‘italic’).

  • angle (float, default 90.0) – Rotation angle of the gene-name text, in degrees.

  • rank_color (bool, default False) – Whether to color the gene-name text by rank. When True, the best-ranked gene is pure red, fading toward light gray for the lowest-ranked.

  • line (bool, default False) – Whether to draw a dashed path connecting the genes’ (rank, score) points, showing the score decay across the ranking.

  • line_color (str, default '#3f3f3f') – Color of the dashed score-curve line.

  • line_size (float, default 0.4) – Size (thickness) of the dashed score-curve line.

  • line_alpha (float, default 0.6) – Alpha (opacity) of the dashed score-curve line.

  • line_kwargs (dict | None, default None) – Additional parameters passed to the score-curve geom_path layer.

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

  • score_column (str, default 'score') – Output column name for the ranking scores.

  • rank_column (str, default 'rank') – Output column name for the per-group rank index (0-based).

  • group_column (str, default 'group') – Output column name for the group label.

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

  • share_labels (bool, default True) – 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 3) – Number of columns in grid. If None, shows plots horizontally, in one row.

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

  • sharey (str | None, default None) – Controls sharing of axis limits between subplots in the grid. See ggrust.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 ggrust.gggrid().

  • **geom_kwargs – Additional parameters for the geom_text layer of each panel.

Returns:

SupPlotsSpec – Grid of ranked-genes panels, one per group.

Raises:
  • UnsupportedDataTypeError – If data is not a supported single-cell data object.

  • KeyNotFoundError – If the ranking result or a requested group is missing.

  • ValueError – If n_genes is out of range.

  • TypeError – If groups is neither a Sequence of strings nor None.

Notes

Builds one panel per group from a precomputed ranking, placing the top n_genes gene names as text at their (rank, score) position. Each panel is titled “{group} vs. rest”.

Examples

A simple grid of ranked genes per group, with optional score-curve lines.

import scanpy as sc

import cellestial as cl

data = sc.datasets.pbmc68k_reduced()

cl.markers(data, line=True)
RGS19 HIST1H4C IL32 GSTK1 SKP1 TMBIM6 CALM3 COPE CD3E CAPN2 ICAM3 TMBIM4-1 MZT2B PPP2R5C CLPP C10orf54 OSTF1 TCEAL8 CD3D KLF3 0 5 10 15 0.2 0.25 0.3 0.35 0.4 score CD4+/CD25 T Reg vs. rest ITM2A RPL39 TIMM10 CWC15 CXCR4 LSM5 LSMD1 SUPT4H1 SRSF7 MTDH SIAH2 CAPN2 EIF3E PLGRKT IGJ APBB1IP POU2AF1 UCHL3 CCT6A RP11-277L2.3 0 5 10 15 0.12 0.14 0.16 0.18 0.2 0.22 CD4+/CD45RA+/CD25- Naive T vs. rest CAPG GABARAPL2 FDX1 CRIP1 GATA3 HPCAL1 DNAJC1 C20orf27 MIEN1 ACAA1 EMB DENND2D EBP PMVK SPG21 GZMK ADD3 MRPS21 CCT6A GZMA 0 5 10 15 0.16 0.18 0.2 0.22 0.24 0.26 CD4+/CD45RO+ Memory vs. rest CCL5 GNLY NKG7 GZMH CHCHD7 SRSF2 ANXA1 MRFAP1 DUSP2 KLRB1 CST7 IRF1 FYB GZMK PSMD7 ANXA5 ANKRD12 RCSD1 CCDC115 EIF3E 0 5 10 15 0.2 0.3 0.4 0.5 score CD8+ Cytotoxic T vs. rest CD8B CD8A RP11-291B21.2 CD7 NECAP2 ANAPC16 SAMD3 YWHAB CARS HMGA1 S100B NDFIP1 HMHA1 MRPS25 SSU72 GZMM POMP AMICA1 SNHG15 ID2 0 5 10 15 0.2 0.3 0.4 0.5 CD8+/CD45RA+ Naive Cytotoxic vs. rest C1QA PSAP COX14 NEAT1 NUP214 RAB7A OAS1 HMGB2 SLTM TMEM176B SRGN SOD2 TMEM176A RAB10 SLC11A1 IFI30 SSR3 COMMD5 TNFSF13B TYROBP 0 5 10 15 0.2 0.25 0.3 0.35 0.4 0.45 CD14+ Monocyte vs. rest CD79A CD79B MS4A1 IGJ IGLL5 SPIB UBE2J1 SMARCB1 MZB1 CCDC50 C16orf74 CAPG CD74 TNFRSF13B FKBP11 AL928768.3 ZNF706 SUB1 PLAC8 HLA-DRB5 0 5 10 15 0.1 0.2 0.3 0.4 score CD19+ B vs. rest PRSS57 SNHG7 SERPINB1 C19orf77 SPINK2 IMPDH2 H2AFY EGFL7 CYTL1 SNHG8 SOX4 C6orf48 HSP90AB1 NFE2 IGFBP7 ZFAS1 EBPL H1FX HSD17B11 NME4 0 5 10 15 0.1 0.15 ranking CD34+ vs. rest GNLY NKG7 CD7 CLIC3 SPON2 TYROBP GZMB PLAC8 FCER1G CTSW CST7 MIEN1 IGFBP7 GZMA ITGB2 MATK MSN DCXR MCM7 MEA1 0 5 10 15 0.1 0.15 0.2 0.25 0.3 ranking CD56+ NK vs. rest CST3 LYZ LST1 IRF7 C10orf54 ZNHIT1 CD33 ILK IL32 CPVL SRRM2 HLA-DPB1 MNDA C19orf43 APEX1 GPX1 IFT20 SEPT9 ANXA1 APH1A 0 5 10 15 0.2 0.3 0.4 0.5 0.6 ranking score Dendritic vs. rest

Color the gene names by rank.

cl.markers(data, rank_color=True)
RGS19 HIST1H4C IL32 GSTK1 SKP1 TMBIM6 CALM3 COPE CD3E CAPN2 ICAM3 TMBIM4-1 MZT2B PPP2R5C CLPP C10orf54 OSTF1 TCEAL8 CD3D KLF3 0 5 10 15 0.2 0.25 0.3 0.35 0.4 score CD4+/CD25 T Reg vs. rest ITM2A RPL39 TIMM10 CWC15 CXCR4 LSM5 LSMD1 SUPT4H1 SRSF7 MTDH SIAH2 CAPN2 EIF3E PLGRKT IGJ APBB1IP POU2AF1 UCHL3 CCT6A RP11-277L2.3 0 5 10 15 0.12 0.14 0.16 0.18 0.2 0.22 CD4+/CD45RA+/CD25- Naive T vs. rest CAPG GABARAPL2 FDX1 CRIP1 GATA3 HPCAL1 DNAJC1 C20orf27 MIEN1 ACAA1 EMB DENND2D EBP PMVK SPG21 GZMK ADD3 MRPS21 CCT6A GZMA 0 5 10 15 0.16 0.18 0.2 0.22 0.24 0.26 CD4+/CD45RO+ Memory vs. rest CCL5 GNLY NKG7 GZMH CHCHD7 SRSF2 ANXA1 MRFAP1 DUSP2 KLRB1 CST7 IRF1 FYB GZMK PSMD7 ANXA5 ANKRD12 RCSD1 CCDC115 EIF3E 0 5 10 15 0.2 0.3 0.4 0.5 score CD8+ Cytotoxic T vs. rest CD8B CD8A RP11-291B21.2 CD7 NECAP2 ANAPC16 SAMD3 YWHAB CARS HMGA1 S100B NDFIP1 HMHA1 MRPS25 SSU72 GZMM POMP AMICA1 SNHG15 ID2 0 5 10 15 0.2 0.3 0.4 0.5 CD8+/CD45RA+ Naive Cytotoxic vs. rest C1QA PSAP COX14 NEAT1 NUP214 RAB7A OAS1 HMGB2 SLTM TMEM176B SRGN SOD2 TMEM176A RAB10 SLC11A1 IFI30 SSR3 COMMD5 TNFSF13B TYROBP 0 5 10 15 0.2 0.25 0.3 0.35 0.4 0.45 CD14+ Monocyte vs. rest CD79A CD79B MS4A1 IGJ IGLL5 SPIB UBE2J1 SMARCB1 MZB1 CCDC50 C16orf74 CAPG CD74 TNFRSF13B FKBP11 AL928768.3 ZNF706 SUB1 PLAC8 HLA-DRB5 0 5 10 15 0.1 0.2 0.3 0.4 score CD19+ B vs. rest PRSS57 SNHG7 SERPINB1 C19orf77 SPINK2 IMPDH2 H2AFY EGFL7 CYTL1 SNHG8 SOX4 C6orf48 HSP90AB1 NFE2 IGFBP7 ZFAS1 EBPL H1FX HSD17B11 NME4 0 5 10 15 0.1 0.15 ranking CD34+ vs. rest GNLY NKG7 CD7 CLIC3 SPON2 TYROBP GZMB PLAC8 FCER1G CTSW CST7 MIEN1 IGFBP7 GZMA ITGB2 MATK MSN DCXR MCM7 MEA1 0 5 10 15 0.1 0.15 0.2 0.25 0.3 ranking CD56+ NK vs. rest CST3 LYZ LST1 IRF7 C10orf54 ZNHIT1 CD33 ILK IL32 CPVL SRRM2 HLA-DPB1 MNDA C19orf43 APEX1 GPX1 IFT20 SEPT9 ANXA1 APH1A 0 5 10 15 0.2 0.3 0.4 0.5 0.6 ranking score Dendritic vs. rest

Select a subset of groups.

cl.markers(
    data,
    groups=["CD14+ Monocyte", "CD4+/CD25 T Reg", "CD4+/CD45RO+ Memory", "CD34+"],
    ncol=2,
    rank_color=True,
)
C1QA PSAP COX14 NEAT1 NUP214 RAB7A OAS1 HMGB2 SLTM TMEM176B SRGN SOD2 TMEM176A RAB10 SLC11A1 IFI30 SSR3 COMMD5 TNFSF13B TYROBP 0 5 10 15 0.2 0.25 0.3 0.35 0.4 0.45 score CD14+ Monocyte vs. rest RGS19 HIST1H4C IL32 GSTK1 SKP1 TMBIM6 CALM3 COPE CD3E CAPN2 ICAM3 TMBIM4-1 MZT2B PPP2R5C CLPP C10orf54 OSTF1 TCEAL8 CD3D KLF3 0 5 10 15 0.2 0.25 0.3 0.35 0.4 CD4+/CD25 T Reg vs. rest CAPG GABARAPL2 FDX1 CRIP1 GATA3 HPCAL1 DNAJC1 C20orf27 MIEN1 ACAA1 EMB DENND2D EBP PMVK SPG21 GZMK ADD3 MRPS21 CCT6A GZMA 0 5 10 15 0.16 0.18 0.2 0.22 0.24 0.26 ranking score CD4+/CD45RO+ Memory vs. rest PRSS57 SNHG7 SERPINB1 C19orf77 SPINK2 IMPDH2 H2AFY EGFL7 CYTL1 SNHG8 SOX4 C6orf48 HSP90AB1 NFE2 IGFBP7 ZFAS1 EBPL H1FX HSD17B11 NME4 0 5 10 15 0.08 0.1 0.12 0.14 0.16 0.18 ranking CD34+ vs. rest