marker_genes_dict#
API pages include interactive (HTML) plots that would possibly not render correctly on a mobile device.
- marker_genes_dict(data: AnnData, groups: Sequence[str] | None = None, *, key: str = 'rank_genes_groups', n_genes: int = 5) dict[str, list[str]]#
Select the top-ranked marker gene names per group from a precomputed ranking.
Like marker_genes, but keeps the grouping: each group maps to its own full top-n_genes list.
- Parameters:
data (
AnnData) – The single-cell data object holding the precomputed differential expression ranking.groups (
Sequence[str] | None, defaultNone) – Subset of groups to pull markers from, in order. None keeps all groups in their stored order.key (
str, default'rank_genes_groups') – The key under which the precomputed ranking is stored on data.n_genes (
int, default5) – Number of top genes to pull per group.
- Returns:
dict[str,list[str]]– Mapping from group label to its top-n_genes gene names, in group order. Each list is complete; a gene that ranks highly in several groups appears under each of them.- 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
Reads only the gene names, not their scores; use markers to plot the ranking itself. Use marker_genes for a flat, de-duplicated list.
Examples
Inspect the top markers of each group.
import scanpy as sc import cellestial as cl data = sc.datasets.pbmc68k_reduced() cl.marker_genes_dict(data, n_genes=3)
{'CD4+/CD25 T Reg': ['RGS19', 'HIST1H4C', 'IL32'], 'CD4+/CD45RA+/CD25- Naive T': ['ITM2A', 'RPL39', 'TIMM10'], 'CD4+/CD45RO+ Memory': ['CAPG', 'GABARAPL2', 'FDX1'], 'CD8+ Cytotoxic T': ['CCL5', 'GNLY', 'NKG7'], 'CD8+/CD45RA+ Naive Cytotoxic': ['CD8B', 'CD8A', 'RP11-291B21.2'], 'CD14+ Monocyte': ['C1QA', 'PSAP', 'COX14'], 'CD19+ B': ['CD79A', 'CD79B', 'MS4A1'], 'CD34+': ['PRSS57', 'SNHG7', 'SERPINB1'], 'CD56+ NK': ['GNLY', 'NKG7', 'CD7'], 'Dendritic': ['CST3', 'LYZ', 'LST1']}