Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.

Commit be653ce

Browse files
minor updates on the visium_tuto (mostly typos)
1 parent 569a3c3 commit be653ce

3 files changed

Lines changed: 51 additions & 13 deletions

File tree

docs/10x_tutorials/visium_tuto.ipynb

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -179,21 +179,21 @@
179179
" \n",
180180
"### Showing gene expressions\n",
181181
"\n",
182-
"Using the Xenium Explorer, it is possible to show the gene expression per spot, denoted as \"Transcript Density Map\" in the software. To effectively display transcript counts per spots, activate the \"Cells\" panel, and under the \"Cell color\" dropdown, select \"Transcript Density Map\". Note that, on the example below, the scale of the color map goes from 1 to 9000 transcript count.\n",
182+
"Using the Xenium Explorer, it is possible to show the gene expression per spot, denoted as \"Transcript Density Map\" in the software. To effectively display transcript counts per spot, activate the \"Cells\" panel, and under the \"Cell color\" dropdown, select \"Transcript Density Map\". Note that, in the example below, the scale of the color map goes from 1 to 9000 transcript count.\n",
183183
"\n",
184-
"> Note that the \"Cells\" panel actually display spots, not cells. This is because the Xenium Explorer has been designed for Xenium data, which has single-cell resolution.\n",
184+
"> Note that the \"Cells\" panel actually display spots, not cells. This is because the Xenium Explorer has been designed for Xenium data, which has a single-cell resolution.\n",
185185
"\n",
186186
"<img src=\"assets/visium/density_map.png\" alt=\"image\" width=\"800\" height=\"auto\">\n",
187187
"\n",
188-
"We can also choose a subset of genes, and it will update the density map. Note that we have to update the scale of the color map under the \"Cells\" panel (for instance, from 1 to 10). \n",
189-
"\n",
190-
"> Note that we recommand to keep the \"Transcripts\" panel disabled, since the Visium machine is spot-based. Still, you can select the genes you are interested in, and it will adapt the density map, without actually enabling the \"Transcripts\" panel.\n",
188+
"We can also choose a subset of genes, and it will update the density map. Here, we updated the scale of the color map under the \"Cells\" panel, which goes from 1 to 10 transcript count.\n",
191189
"\n",
192190
"<img src=\"assets/visium/transcripts_subset.png\" alt=\"image\" width=\"800\" height=\"auto\">\n",
193191
"\n",
192+
"> Note that we recommend keeping the \"Transcripts\" panel disabled since the Visium machine is spot-based. Still, you can select the genes you are interested in, and it will adapt the density map without actually enabling the \"Transcripts\" panel.\n",
193+
"\n",
194194
"### Showing spot groups (e.g., clusters)\n",
195195
"\n",
196-
"If you had categorical columns under `sdata.table.obs`, you can show it by selecting the right group under the \"Cell groups\" dropdown. Make sure that \"Cell color\" is set to \"Cluster Affiliation\". On this example, we run `Leiden` clustering using `scanpy` (as in the example below).\n",
196+
"If you have categorical columns under `sdata.table.obs`, you can show it by selecting the right group under the \"Cell groups\" dropdown. Ensure that \"Cell color\" is set to \"Cluster Affiliation\". In this example, we run `Leiden` clustering using `scanpy` (as in the example below).\n",
197197
"\n",
198198
"<img src=\"assets/visium/clusters.png\" alt=\"image\" width=\"800\" height=\"auto\">\n",
199199
"\n",
@@ -210,7 +210,7 @@
210210
"source": [
211211
"### Lasso selection\n",
212212
"\n",
213-
"On the Xenium Explorer, use the Lasso tool to select some spots of interest, like below. Then, click on \"Download Cell Stats as CSV\", as below. It will create a file called `\"Selection_1_cells_stats.csv\"`.\n",
213+
"On the Xenium Explorer, use the Lasso tool to select some spots of interest. Then, click on \"Download Cell Stats as CSV\", as below. It will create a file called `\"Selection_1_cells_stats.csv\"`.\n",
214214
"\n",
215215
"<img src=\"assets/visium/lasso.png\" alt=\"image\" width=\"800\" height=\"auto\">"
216216
]
@@ -227,9 +227,13 @@
227227
"\n",
228228
"# add the path to the file that you downloaded, e.g. \"Selection_1_cells_stats.csv\"\n",
229229
"df_selection = pd.read_csv(\"Selection_1_cells_stats.csv\", skiprows=2)\n",
230+
"\n",
231+
"# this line converts the Xenium spot ID into a spot index\n",
230232
"spot_indices = df_selection[\"Cell ID\"].map(spatialdata_xenium_explorer.utils.int_cell_id).values\n",
231233
"\n",
232-
"sdata.table.obs[\"lasso\"] = pd.Categorical(np.where(np.isin(np.arange(sdata.table.n_obs), spot_indices), \"selected\", \"not-selected\"))"
234+
"sdata.table.obs[\"lasso\"] = pd.Categorical(\n",
235+
" np.where(np.isin(np.arange(sdata.table.n_obs), spot_indices), \"selected\", \"not-selected\")\n",
236+
")"
233237
]
234238
},
235239
{
@@ -296,7 +300,7 @@
296300
"\n",
297301
"Here, we run some Leiden clustering with `scanpy`. Then, we will update the Xenium Explorer files to display the spot clusters.\n",
298302
"\n",
299-
"More generally, you can add new cell categories, i.e. a column of `sdata.table.obs`, and it will be shown by the Xenium Explorer after the instructions below.\n",
303+
"More generally, you can add new cell categories, i.e. a column of `sdata.table.obs`, and the Xenium Explorer will show it after the instructions below.\n",
300304
"\n",
301305
"> Note that we only display categorical columns. If a column from `sdata.table.obs` contains continuous numerical values (e.g., `3.13, 7.89, ...`), it will not be transformed into a categorical variable, and therefore not shown in the Xenium Explorer. In this case, we recommend using `spatiadata_plot` as shown above."
302306
]
@@ -320,9 +324,9 @@
320324
"cell_type": "markdown",
321325
"metadata": {},
322326
"source": [
323-
"Now, you can update the explorer with your new cluster assignment. You don't need to re-run the full conversion, you can simply update the `analysis.zarr.zip` file as below. \n",
327+
"Now, you can update the explorer with your new cluster assignment. You don't need to re-run the complete conversion; you can edit the `analysis.zarr.zip` file only, as below.\n",
324328
"\n",
325-
"> Alternatively, you can use the `spatialdata_xenium_explorer` CLI instead of the API, as detaild [here](https://quentinblampey.github.io/spatialdata_xenium_explorer/cli/#update-obs)."
329+
"> Alternatively, you can use the `spatialdata_xenium_explorer` CLI instead of the API, as detailed [here](https://quentinblampey.github.io/spatialdata_xenium_explorer/cli/#update-obs)."
326330
]
327331
},
328332
{
@@ -346,7 +350,7 @@
346350
"cell_type": "markdown",
347351
"metadata": {},
348352
"source": [
349-
"To visualize these clusters, re-open the `experiment.xenium` file, and select the new cell group (under the \"Cells\" panel, and in the \"Cell groups\" dropdown). See the examples above to see how it looks on the Xenium Explorer."
353+
"To visualize these clusters, re-open the `experiment.xenium` file and select the new cell group (under the \"Cells\" panel and in the \"Cell groups\" dropdown). See the examples above to see how it looks on the Xenium Explorer."
350354
]
351355
}
352356
],

poetry.lock

Lines changed: 34 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ ipykernel = "^6.25.2"
3535
mkdocs-material = "^9.3.2"
3636
mkdocstrings = "^0.23.0"
3737
mkdocstrings-python = "^1.7.3"
38+
jupyter-black = "^0.3.4"
3839

3940
[build-system]
4041
requires = ["poetry-core>=1.0.0"]

0 commit comments

Comments
 (0)