plot_scores¶
plot_scores
¶
plot_scores(
adata: AnnData,
gene_sets: dict[str, list[str]],
*,
max_rank: int = 1500,
chunk_size: int = 1000,
n_jobs: int = -1,
inplace: bool = True,
clip_pct: float | tuple[float, float] | None = None,
normalize: bool = False,
prefix: str = "score-",
suffix: str = "",
method: str | Callable[..., NDArray] | None = None,
colors: list[tuple[float, float, float]] | None = None,
n_components: int = 3,
component_prefix: str | None = None,
basis: str = "X_umap",
interactive: bool = False,
show: bool = True,
**kwargs: object,
) -> tuple[
DataFrame, RGBResult, Axes | Figure | object | None
]
Score gene sets, map to RGB, and plot — all in one call.
This is a convenience wrapper around the 3-step pipeline:
:func:score_gene_sets → :func:blend_to_rgb / :func:reduce_to_rgb
→ :func:plot_embedding / :func:plot_embedding_interactive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adata
|
AnnData
|
Annotated data matrix (cells x genes) with a precomputed embedding
in |
required |
gene_sets
|
dict[str, list[str]]
|
Mapping of gene set names to lists of gene symbols. |
required |
max_rank
|
int
|
Rank cap passed to pyUCell. |
1500
|
chunk_size
|
int
|
Number of cells processed per batch. |
1000
|
n_jobs
|
int
|
Parallelism ( |
-1
|
inplace
|
bool
|
If True, scores are stored in |
True
|
clip_pct
|
float | tuple[float, float] | None
|
Percentile clipping — see :func: |
None
|
normalize
|
bool
|
Min-max rescaling — see :func: |
False
|
prefix
|
str
|
Column name prefix for score columns (default |
'score-'
|
suffix
|
str
|
Column name suffix for score columns (default |
''
|
method
|
str | Callable[..., NDArray] | None
|
Color-mapping method. |
None
|
colors
|
list[tuple[float, float, float]] | None
|
Base colours for :func: |
None
|
n_components
|
int
|
Number of components for reduction (max 3). |
3
|
component_prefix
|
str | None
|
Label prefix for reduction legend axes. |
None
|
basis
|
str
|
Full obsm key for the embedding (e.g. |
'X_umap'
|
interactive
|
bool
|
If True, use :func: |
False
|
show
|
bool
|
If True (default), display the plot. |
True
|
**kwargs
|
object
|
Extra keyword arguments forwarded to the plotting function or reducer as appropriate. |
{}
|
Returns:
| Type | Description |
|---|---|
tuple[DataFrame, RGBResult, Axes | Figure | None]
|
|
Source code in src/multiscoresplot/_pipeline.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |