multiscoresplot 1.0.6__tar.gz → 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/PKG-INFO +26 -36
  2. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/README.md +25 -35
  3. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/docs/api/colorspace.md +10 -0
  4. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/docs/api/index.md +3 -2
  5. multiscoresplot-2.0.0/docs/changelog.md +35 -0
  6. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/docs/examples.md +13 -24
  7. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/docs/getting-started.md +2 -7
  8. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/docs/index.md +3 -8
  9. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/docs/pipeline.md +37 -18
  10. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/pyproject.toml +3 -1
  11. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/src/multiscoresplot/__init__.py +3 -1
  12. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/src/multiscoresplot/_colorspace.py +106 -10
  13. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/src/multiscoresplot/_interactive.py +117 -52
  14. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/src/multiscoresplot/_plotting.py +103 -29
  15. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/uv.lock +1 -1
  16. multiscoresplot-1.0.6/docs/changelog.md +0 -19
  17. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/.github/workflows/ci.yml +0 -0
  18. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/.github/workflows/docs.yml +0 -0
  19. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/.github/workflows/publish.yml +0 -0
  20. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/.gitignore +0 -0
  21. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/.pre-commit-config.yaml +0 -0
  22. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/LICENSE +0 -0
  23. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/docs/api/interactive.md +0 -0
  24. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/docs/api/legend.md +0 -0
  25. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/docs/api/plotting.md +0 -0
  26. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/docs/api/scoring.md +0 -0
  27. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/mkdocs.yml +0 -0
  28. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/src/multiscoresplot/_legend.py +0 -0
  29. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/src/multiscoresplot/_scoring.py +0 -0
  30. {multiscoresplot-1.0.6 → multiscoresplot-2.0.0}/src/multiscoresplot/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: multiscoresplot
3
- Version: 1.0.6
3
+ Version: 2.0.0
4
4
  Summary: Multi-dimensional gene set scoring and visualization for single-cell transcriptomics
5
5
  Project-URL: Homepage, https://github.com/AndreMacedo88/multiscoresplot
6
6
  Project-URL: Documentation, https://AndreMacedo88.github.io/multiscoresplot/
@@ -71,16 +71,11 @@ gene_sets = {
71
71
  # 1. Score gene sets per cell
72
72
  scores = msp.score_gene_sets(adata, gene_sets, inplace=True)
73
73
 
74
- # 2. Map scores to RGB colors
74
+ # 2. Map scores to RGB colors (returns RGBResult with metadata)
75
75
  rgb = msp.reduce_to_rgb(scores, method="pca")
76
76
 
77
- # 3. Plot
78
- msp.plot_embedding(
79
- adata, rgb,
80
- basis="umap",
81
- method="pca",
82
- gene_set_names=list(gene_sets.keys()),
83
- )
77
+ # 3. Plot — method & gene_set_names auto-detected from RGBResult
78
+ msp.plot_embedding(adata, rgb, basis="X_umap")
84
79
  ```
85
80
 
86
81
  ## Pipeline
@@ -106,7 +101,7 @@ scores = msp.score_gene_sets(
106
101
 
107
102
  ### Step 2 — Map scores to RGB
108
103
 
109
- Convert gene set scores into per-cell RGB colors. Two options depending on how many gene sets you want to visualize:
104
+ Convert gene set scores into per-cell RGB colors. Both functions return an `RGBResult` that carries the RGB array plus metadata (method, gene set names, colors) used automatically by the plotting functions.
110
105
 
111
106
  **Blend (2–3 gene sets)** — multiplicative blending from white, where each gene set darkens toward its base color proportional to the score.
112
107
 
@@ -131,26 +126,22 @@ rgb = msp.reduce_to_rgb(scores, method="ica")
131
126
  Scatter plot of embedding coordinates colored by RGB values, with an integrated color-space legend.
132
127
 
133
128
  ```python
134
- # Static matplotlib plot
135
- msp.plot_embedding(
136
- adata, rgb,
137
- basis="umap",
138
- method="pca",
139
- gene_set_names=["qNSCs", "aNSCs", "TAP", "NB"],
140
- )
129
+ # Static matplotlib plot — method & gene_set_names auto-detected from RGBResult
130
+ msp.plot_embedding(adata, rgb, basis="X_umap")
141
131
 
142
132
  # Options
143
133
  ax = msp.plot_embedding(
144
134
  adata, rgb,
145
- basis="umap",
146
- method="pca",
147
- gene_set_names=["qNSCs", "aNSCs", "TAP", "NB"],
135
+ basis="X_umap",
148
136
  legend=True, # show color legend (default)
149
137
  legend_style="inset", # "inset" or "side"
150
138
  legend_loc="lower right", # legend position
139
+ legend_size=0.30, # legend size (fraction of plot)
140
+ legend_resolution=128, # legend image resolution
151
141
  point_size=3,
152
142
  alpha=0.8,
153
143
  figsize=(6, 6),
144
+ dpi=100, # figure resolution
154
145
  title="SVZ lineage",
155
146
  show=False, # return axes instead of displaying
156
147
  )
@@ -161,16 +152,14 @@ ax = msp.plot_embedding(
161
152
  ```python
162
153
  msp.plot_embedding_interactive(
163
154
  adata, rgb,
164
- basis="umap",
155
+ basis="X_umap",
165
156
  scores=scores,
166
- method="nmf",
167
- gene_set_names=["qNSCs", "aNSCs", "TAP", "NB"],
168
- hover_columns=["n_counts", "cell_type"], # extra adata.obs columns
157
+ hover_columns=["n_counts", "cell_type", "Dcx"], # obs columns or gene names
169
158
  legend=True,
170
159
  legend_loc="lower right",
171
160
  point_size=2,
172
- width=600,
173
- height=500,
161
+ figsize=(6.5, 6.0), # figure size in inches
162
+ dpi=100, # pixels = figsize * dpi
174
163
  )
175
164
  ```
176
165
 
@@ -225,16 +214,17 @@ Full documentation is available at **[AndreMacedo88.github.io/multiscoresplot](h
225
214
 
226
215
  ## API Reference
227
216
 
228
- | Function | Description |
229
- | --------------------------------------------------- | ----------------------------------------- |
230
- | `score_gene_sets(adata, gene_sets)` | Score gene sets per cell via pyUCell |
231
- | `blend_to_rgb(scores)` | Multiplicative blend to RGB (2–3 sets) |
232
- | `reduce_to_rgb(scores, method="pca")` | Dimensionality reduction to RGB (2+ sets) |
233
- | `plot_embedding(adata, rgb, basis=...)` | Static matplotlib scatter plot |
234
- | `plot_embedding_interactive(adata, rgb, basis=...)` | Interactive Plotly scatter plot |
235
- | `render_legend(ax, method)` | Draw color-space legend on axes |
236
- | `register_reducer(name, fn)` | Register a custom reduction method |
237
- | `get_component_labels(method)` | Get axis labels for a reduction method |
217
+ | Function / Class | Description |
218
+ | --------------------------------------------------- | --------------------------------------------------- |
219
+ | `score_gene_sets(adata, gene_sets)` | Score gene sets per cell via pyUCell |
220
+ | `blend_to_rgb(scores)` | Multiplicative blend to RGB (2–3 sets) → RGBResult |
221
+ | `reduce_to_rgb(scores, method="pca")` | Dimensionality reduction to RGB (2+ sets) → RGBResult |
222
+ | `RGBResult` | RGB array + metadata (method, gene set names, colors) |
223
+ | `plot_embedding(adata, rgb, basis=...)` | Static matplotlib scatter plot |
224
+ | `plot_embedding_interactive(adata, rgb, basis=...)` | Interactive Plotly scatter plot |
225
+ | `render_legend(ax, method)` | Draw color-space legend on axes |
226
+ | `register_reducer(name, fn)` | Register a custom reduction method |
227
+ | `get_component_labels(method)` | Get axis labels for a reduction method |
238
228
 
239
229
  ## Development
240
230
 
@@ -38,16 +38,11 @@ gene_sets = {
38
38
  # 1. Score gene sets per cell
39
39
  scores = msp.score_gene_sets(adata, gene_sets, inplace=True)
40
40
 
41
- # 2. Map scores to RGB colors
41
+ # 2. Map scores to RGB colors (returns RGBResult with metadata)
42
42
  rgb = msp.reduce_to_rgb(scores, method="pca")
43
43
 
44
- # 3. Plot
45
- msp.plot_embedding(
46
- adata, rgb,
47
- basis="umap",
48
- method="pca",
49
- gene_set_names=list(gene_sets.keys()),
50
- )
44
+ # 3. Plot — method & gene_set_names auto-detected from RGBResult
45
+ msp.plot_embedding(adata, rgb, basis="X_umap")
51
46
  ```
52
47
 
53
48
  ## Pipeline
@@ -73,7 +68,7 @@ scores = msp.score_gene_sets(
73
68
 
74
69
  ### Step 2 — Map scores to RGB
75
70
 
76
- Convert gene set scores into per-cell RGB colors. Two options depending on how many gene sets you want to visualize:
71
+ Convert gene set scores into per-cell RGB colors. Both functions return an `RGBResult` that carries the RGB array plus metadata (method, gene set names, colors) used automatically by the plotting functions.
77
72
 
78
73
  **Blend (2–3 gene sets)** — multiplicative blending from white, where each gene set darkens toward its base color proportional to the score.
79
74
 
@@ -98,26 +93,22 @@ rgb = msp.reduce_to_rgb(scores, method="ica")
98
93
  Scatter plot of embedding coordinates colored by RGB values, with an integrated color-space legend.
99
94
 
100
95
  ```python
101
- # Static matplotlib plot
102
- msp.plot_embedding(
103
- adata, rgb,
104
- basis="umap",
105
- method="pca",
106
- gene_set_names=["qNSCs", "aNSCs", "TAP", "NB"],
107
- )
96
+ # Static matplotlib plot — method & gene_set_names auto-detected from RGBResult
97
+ msp.plot_embedding(adata, rgb, basis="X_umap")
108
98
 
109
99
  # Options
110
100
  ax = msp.plot_embedding(
111
101
  adata, rgb,
112
- basis="umap",
113
- method="pca",
114
- gene_set_names=["qNSCs", "aNSCs", "TAP", "NB"],
102
+ basis="X_umap",
115
103
  legend=True, # show color legend (default)
116
104
  legend_style="inset", # "inset" or "side"
117
105
  legend_loc="lower right", # legend position
106
+ legend_size=0.30, # legend size (fraction of plot)
107
+ legend_resolution=128, # legend image resolution
118
108
  point_size=3,
119
109
  alpha=0.8,
120
110
  figsize=(6, 6),
111
+ dpi=100, # figure resolution
121
112
  title="SVZ lineage",
122
113
  show=False, # return axes instead of displaying
123
114
  )
@@ -128,16 +119,14 @@ ax = msp.plot_embedding(
128
119
  ```python
129
120
  msp.plot_embedding_interactive(
130
121
  adata, rgb,
131
- basis="umap",
122
+ basis="X_umap",
132
123
  scores=scores,
133
- method="nmf",
134
- gene_set_names=["qNSCs", "aNSCs", "TAP", "NB"],
135
- hover_columns=["n_counts", "cell_type"], # extra adata.obs columns
124
+ hover_columns=["n_counts", "cell_type", "Dcx"], # obs columns or gene names
136
125
  legend=True,
137
126
  legend_loc="lower right",
138
127
  point_size=2,
139
- width=600,
140
- height=500,
128
+ figsize=(6.5, 6.0), # figure size in inches
129
+ dpi=100, # pixels = figsize * dpi
141
130
  )
142
131
  ```
143
132
 
@@ -192,16 +181,17 @@ Full documentation is available at **[AndreMacedo88.github.io/multiscoresplot](h
192
181
 
193
182
  ## API Reference
194
183
 
195
- | Function | Description |
196
- | --------------------------------------------------- | ----------------------------------------- |
197
- | `score_gene_sets(adata, gene_sets)` | Score gene sets per cell via pyUCell |
198
- | `blend_to_rgb(scores)` | Multiplicative blend to RGB (2–3 sets) |
199
- | `reduce_to_rgb(scores, method="pca")` | Dimensionality reduction to RGB (2+ sets) |
200
- | `plot_embedding(adata, rgb, basis=...)` | Static matplotlib scatter plot |
201
- | `plot_embedding_interactive(adata, rgb, basis=...)` | Interactive Plotly scatter plot |
202
- | `render_legend(ax, method)` | Draw color-space legend on axes |
203
- | `register_reducer(name, fn)` | Register a custom reduction method |
204
- | `get_component_labels(method)` | Get axis labels for a reduction method |
184
+ | Function / Class | Description |
185
+ | --------------------------------------------------- | --------------------------------------------------- |
186
+ | `score_gene_sets(adata, gene_sets)` | Score gene sets per cell via pyUCell |
187
+ | `blend_to_rgb(scores)` | Multiplicative blend to RGB (2–3 sets) → RGBResult |
188
+ | `reduce_to_rgb(scores, method="pca")` | Dimensionality reduction to RGB (2+ sets) → RGBResult |
189
+ | `RGBResult` | RGB array + metadata (method, gene set names, colors) |
190
+ | `plot_embedding(adata, rgb, basis=...)` | Static matplotlib scatter plot |
191
+ | `plot_embedding_interactive(adata, rgb, basis=...)` | Interactive Plotly scatter plot |
192
+ | `render_legend(ax, method)` | Draw color-space legend on axes |
193
+ | `register_reducer(name, fn)` | Register a custom reduction method |
194
+ | `get_component_labels(method)` | Get axis labels for a reduction method |
205
195
 
206
196
  ## Development
207
197
 
@@ -2,6 +2,16 @@
2
2
 
3
3
  Color mapping from gene set scores to RGB (pipeline steps 2–3).
4
4
 
5
+ Both `blend_to_rgb` and `reduce_to_rgb` return an `RGBResult` object that wraps
6
+ the RGB array with metadata (method, gene set names, colors). This metadata is
7
+ auto-detected by the plotting functions.
8
+
9
+ ## RGBResult
10
+
11
+ ::: multiscoresplot.RGBResult
12
+
13
+ ---
14
+
5
15
  ## Blending (2–3 gene sets)
6
16
 
7
17
  ::: multiscoresplot.blend_to_rgb
@@ -2,11 +2,12 @@
2
2
 
3
3
  ## Overview
4
4
 
5
- | Function | Description | Pipeline Step |
6
- |----------|-------------|---------------|
5
+ | Function / Class | Description | Pipeline Step |
6
+ |------------------|-------------|---------------|
7
7
  | [`score_gene_sets`](scoring.md) | Score gene sets per cell via pyUCell | Step 1 |
8
8
  | [`blend_to_rgb`](colorspace.md#multiscoresplot.blend_to_rgb) | Multiplicative blend to RGB (2–3 sets) | Step 2 |
9
9
  | [`reduce_to_rgb`](colorspace.md#multiscoresplot.reduce_to_rgb) | Dimensionality reduction to RGB (2+ sets) | Step 2 |
10
+ | [`RGBResult`](colorspace.md#multiscoresplot.RGBResult) | Return type of `blend_to_rgb` / `reduce_to_rgb` with metadata | Step 2 |
10
11
  | [`plot_embedding`](plotting.md) | Static matplotlib scatter plot | Step 3 |
11
12
  | [`plot_embedding_interactive`](interactive.md) | Interactive Plotly scatter plot | Step 3 |
12
13
  | [`render_legend`](legend.md) | Draw color-space legend on axes | Optional |
@@ -0,0 +1,35 @@
1
+ # Changelog
2
+
3
+ ## 2.0.0
4
+
5
+ ### Breaking changes
6
+ - `blend_to_rgb` and `reduce_to_rgb` now return `RGBResult` (carries RGB array + metadata). The object supports numpy array protocol, so `np.asarray(result)`, indexing, and comparisons still work.
7
+ - `plot_embedding` and `plot_embedding_interactive`: `basis=` now takes the **full obsm key** (e.g. `"X_umap"`, `"umap_consensus"`). The old short form (`basis="umap"`) still works but emits a `DeprecationWarning`.
8
+ - `plot_embedding`: `legend=True` (default) now **requires** a known method. Previously it silently skipped the legend when `method=None`; now it raises `ValueError`. Pass `legend=False` or provide `method=`, or use an `RGBResult`.
9
+ - `plot_embedding_interactive`: `width`/`height` replaced by `figsize` (inches) + `dpi`. Pixel dimensions = `figsize * dpi`.
10
+
11
+ ### New features
12
+ - **`RGBResult`**: new dataclass returned by `blend_to_rgb` / `reduce_to_rgb`. Carries `method`, `gene_set_names`, and `colors` metadata that plotting functions auto-detect.
13
+ - **`plot_embedding`**: new params `legend_size`, `legend_resolution`, `dpi`.
14
+ - **`plot_embedding_interactive`**: new param `legend_kwargs`. `figsize`/`dpi` replace `width`/`height`.
15
+ - **Both plotting functions**: consistent `legend_size`, `legend_resolution`, and `legend_kwargs` params.
16
+ - **`hover_columns`** now falls back to `adata.var_names` for gene expression values (sparse matrices supported).
17
+ - **`gene_set_names`** behavior is now consistent between static and interactive plots.
18
+
19
+ ## 1.0.3
20
+
21
+ - Fix badge display in README
22
+
23
+ ## 1.0.2
24
+
25
+ - Fix legend not being plotted in interactive "direct" methods
26
+ - Fix CI badge path in README
27
+
28
+ ## 1.0.1
29
+
30
+ - Initial stable release
31
+ - 5-step pipeline: score, blend, reduce, plot, legend
32
+ - Built-in reducers: PCA, NMF, ICA
33
+ - Pluggable reducer registry
34
+ - Static matplotlib and interactive Plotly plotting
35
+ - Color-space legends for direct and reduction modes
@@ -38,10 +38,9 @@ def umap_reducer(X, n_components, **kwargs):
38
38
  # Register it
39
39
  msp.register_reducer("umap", umap_reducer, component_prefix="UMAP")
40
40
 
41
- # Use it
41
+ # Use it — method auto-detected from RGBResult
42
42
  rgb = msp.reduce_to_rgb(scores, method="umap")
43
- msp.plot_embedding(adata, rgb, basis="umap", method="umap",
44
- gene_set_names=list(gene_sets.keys()))
43
+ msp.plot_embedding(adata, rgb, basis="X_umap")
45
44
  ```
46
45
 
47
46
  ## Different Embeddings
@@ -56,12 +55,10 @@ rgb = msp.reduce_to_rgb(scores, method="pca")
56
55
 
57
56
  fig, axes = plt.subplots(1, 3, figsize=(18, 5))
58
57
 
59
- for ax, basis in zip(axes, ["umap", "pca", "X_scanorama"]):
58
+ for ax, basis in zip(axes, ["X_umap", "X_pca", "X_scanorama"]):
60
59
  msp.plot_embedding(
61
60
  adata, rgb,
62
61
  basis=basis,
63
- method="pca",
64
- gene_set_names=list(gene_sets.keys()),
65
62
  ax=ax,
66
63
  title=basis.upper(),
67
64
  show=False,
@@ -86,9 +83,7 @@ for ax, method in zip(axes, ["pca", "nmf", "ica"]):
86
83
  rgb = msp.reduce_to_rgb(scores, method=method)
87
84
  msp.plot_embedding(
88
85
  adata, rgb,
89
- basis="umap",
90
- method=method,
91
- gene_set_names=list(gene_sets.keys()),
86
+ basis="X_umap",
92
87
  ax=ax,
93
88
  title=method.upper(),
94
89
  show=False,
@@ -108,14 +103,12 @@ rgb = msp.reduce_to_rgb(scores, method="nmf")
108
103
 
109
104
  msp.plot_embedding_interactive(
110
105
  adata, rgb,
111
- basis="umap",
106
+ basis="X_umap",
112
107
  scores=scores,
113
- method="nmf",
114
- gene_set_names=list(gene_sets.keys()),
115
- hover_columns=["n_counts", "cell_type"], # any adata.obs columns
108
+ hover_columns=["n_counts", "cell_type", "Dcx"], # obs columns or gene names
116
109
  point_size=2,
117
- width=800,
118
- height=600,
110
+ figsize=(8.0, 6.0),
111
+ dpi=100,
119
112
  )
120
113
  ```
121
114
 
@@ -124,16 +117,16 @@ msp.plot_embedding_interactive(
124
117
  ```python
125
118
  ax = msp.plot_embedding(
126
119
  adata, rgb,
127
- basis="umap",
128
- method="pca",
129
- gene_set_names=list(gene_sets.keys()),
120
+ basis="X_umap",
130
121
  point_size=5,
131
122
  alpha=0.6,
132
123
  figsize=(8, 8),
124
+ dpi=150,
133
125
  title="SVZ Neural Lineage",
134
126
  legend=True,
135
127
  legend_style="side", # legend in a separate panel
136
128
  legend_loc="upper right",
129
+ legend_size=0.35, # legend size (fraction of plot)
137
130
  show=False,
138
131
  )
139
132
 
@@ -156,10 +149,6 @@ two_sets = {
156
149
  scores = msp.score_gene_sets(adata, two_sets, inplace=True)
157
150
  rgb = msp.blend_to_rgb(scores) # blue/red by default
158
151
 
159
- msp.plot_embedding(
160
- adata, rgb,
161
- basis="umap",
162
- method="direct",
163
- gene_set_names=list(two_sets.keys()),
164
- )
152
+ # method="direct" and gene_set_names auto-detected from RGBResult
153
+ msp.plot_embedding(adata, rgb, basis="X_umap")
165
154
  ```
@@ -42,13 +42,8 @@ rgb = msp.blend_to_rgb(scores)
42
42
  # Or reduce via dimensionality reduction (any number of gene sets)
43
43
  rgb = msp.reduce_to_rgb(scores, method="pca")
44
44
 
45
- # 4. Plot on a UMAP embedding (step 3 of the pipeline)
46
- msp.plot_embedding(
47
- adata, rgb,
48
- basis="umap",
49
- method="pca",
50
- gene_set_names=list(gene_sets.keys()),
51
- )
45
+ # 4. Plot on a UMAP embedding method & labels auto-detected from RGBResult
46
+ msp.plot_embedding(adata, rgb, basis="X_umap")
52
47
  ```
53
48
 
54
49
  !!! tip "Which color mapping to use?"
@@ -29,16 +29,11 @@ gene_sets = {
29
29
  # 1. Score gene sets per cell
30
30
  scores = msp.score_gene_sets(adata, gene_sets, inplace=True)
31
31
 
32
- # 2. Map scores to RGB colors
32
+ # 2. Map scores to RGB colors (returns RGBResult with metadata)
33
33
  rgb = msp.reduce_to_rgb(scores, method="pca")
34
34
 
35
- # 3. Plot
36
- msp.plot_embedding(
37
- adata, rgb,
38
- basis="umap",
39
- method="pca",
40
- gene_set_names=list(gene_sets.keys()),
41
- )
35
+ # 3. Plot — method & gene_set_names auto-detected from RGBResult
36
+ msp.plot_embedding(adata, rgb, basis="X_umap")
42
37
  ```
43
38
 
44
39
  [Get Started](getting-started.md){ .md-button .md-button--primary }
@@ -143,53 +143,72 @@ as possible.
143
143
  Scatter plot of embedding coordinates (UMAP, PCA, etc.) colored by the RGB values,
144
144
  with an integrated color-space legend.
145
145
 
146
+ Both `blend_to_rgb` and `reduce_to_rgb` return an `RGBResult` object that carries
147
+ the RGB array together with metadata (method, gene set names, colors). The plotting
148
+ functions detect this metadata automatically, so you don't need to repeat `method=`
149
+ and `gene_set_names=`.
150
+
151
+ !!! note "Full obsm key"
152
+ The `basis` parameter now takes the **full obsm key** (e.g., `"X_umap"`,
153
+ `"umap_consensus"`), not a short name. This lets you use any obsm key, not
154
+ just those prefixed with `X_`.
155
+
146
156
  ```python
147
- # Basic usage
148
- msp.plot_embedding(
149
- adata, rgb,
150
- basis="umap",
151
- method="pca",
152
- gene_set_names=["qNSCs", "aNSCs", "TAP", "NB"],
153
- )
157
+ # Basic usage — method and gene_set_names auto-detected from RGBResult
158
+ msp.plot_embedding(adata, rgb, basis="X_umap")
154
159
 
155
160
  # With customization
156
161
  ax = msp.plot_embedding(
157
162
  adata, rgb,
158
- basis="umap",
159
- method="pca",
160
- gene_set_names=["qNSCs", "aNSCs", "TAP", "NB"],
163
+ basis="X_umap",
161
164
  legend=True, # show color legend (default)
162
165
  legend_style="inset", # "inset" or "side"
163
166
  legend_loc="lower right", # legend position
167
+ legend_size=0.30, # legend size (fraction of plot)
168
+ legend_resolution=128, # legend image resolution
164
169
  point_size=3,
165
170
  alpha=0.8,
166
171
  figsize=(6, 6),
172
+ dpi=100, # figure resolution
167
173
  title="SVZ lineage",
168
174
  show=False, # return axes instead of displaying
169
175
  )
176
+
177
+ # You can still override metadata from RGBResult
178
+ msp.plot_embedding(
179
+ adata, rgb,
180
+ basis="X_umap",
181
+ method="pca", # override RGBResult.method
182
+ gene_set_names=["A", "B", "C", "D"], # override RGBResult.gene_set_names
183
+ )
170
184
  ```
171
185
 
186
+ If you pass a raw `(n_cells, 3)` numpy array instead of an `RGBResult`, you must
187
+ provide `method=` explicitly when `legend=True`.
188
+
172
189
  ### Interactive Plot (requires Plotly)
173
190
 
174
191
  WebGL-accelerated scatter plot with hover info showing gene set scores, RGB channel
175
- values, and custom metadata.
192
+ values, and custom metadata. Uses the same `RGBResult` metadata as `plot_embedding`.
176
193
 
177
194
  ```python
178
195
  msp.plot_embedding_interactive(
179
196
  adata, rgb,
180
- basis="umap",
181
- scores=scores,
182
- method="nmf",
183
- gene_set_names=["qNSCs", "aNSCs", "TAP", "NB"],
184
- hover_columns=["n_counts", "cell_type"],
197
+ basis="X_umap",
198
+ scores=scores, # optional: explicit score DataFrame
199
+ hover_columns=["n_counts", "Dcx"], # obs columns or gene names
185
200
  legend=True,
186
201
  legend_loc="lower right",
187
202
  point_size=2,
188
- width=600,
189
- height=500,
203
+ figsize=(6.5, 6.0), # figure size in inches
204
+ dpi=100, # pixels = figsize * dpi
190
205
  )
191
206
  ```
192
207
 
208
+ !!! tip "Hover over genes"
209
+ `hover_columns` accepts both `adata.obs` column names **and** gene names from
210
+ `adata.var_names`. Gene names display the expression value from `adata.X`.
211
+
193
212
  !!! note
194
213
  Interactive plots require the `plotly` extra: `pip install 'multiscoresplot[interactive]'`
195
214
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "multiscoresplot"
7
- version = "1.0.6"
7
+ version = "2.0.0"
8
8
  description = "Multi-dimensional gene set scoring and visualization for single-cell transcriptomics"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -94,6 +94,8 @@ module = [
94
94
  "sklearn.*",
95
95
  "plotly",
96
96
  "plotly.*",
97
+ "scipy",
98
+ "scipy.*",
97
99
  ]
98
100
  ignore_missing_imports = true
99
101
  disable_error_code = ["import-untyped"]
@@ -1,6 +1,7 @@
1
1
  """multiscoresplot -- multi-dimensional gene set scoring visualization."""
2
2
 
3
3
  from multiscoresplot._colorspace import (
4
+ RGBResult,
4
5
  blend_to_rgb,
5
6
  get_component_labels,
6
7
  project_direct,
@@ -14,6 +15,7 @@ from multiscoresplot._plotting import plot_embedding
14
15
  from multiscoresplot._scoring import score_gene_sets
15
16
 
16
17
  __all__ = [
18
+ "RGBResult",
17
19
  "blend_to_rgb",
18
20
  "get_component_labels",
19
21
  "plot_embedding",
@@ -25,4 +27,4 @@ __all__ = [
25
27
  "render_legend",
26
28
  "score_gene_sets",
27
29
  ]
28
- __version__ = "1.0.6"
30
+ __version__ = "2.0.0"