Skip to content

Commit e2e86ca

Browse files
authored
Merge pull request #4 from cambiotraining/crit-revisions
add and render xenium and merfish code chunks
2 parents 3d5ba9a + 81d286f commit e2e86ca

9 files changed

Lines changed: 63 additions & 24 deletions

File tree

_freeze/materials/01-LoadingData/execute-results/html.json

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.
206 KB
Loading
-35 Bytes
Loading
-17 Bytes
Loading
17 Bytes
Loading
30 Bytes
Loading
118 KB
Loading
727 KB
Loading

materials/01-LoadingData.qmd

Lines changed: 61 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -316,34 +316,21 @@ To re-read the object later on, you can use:
316316
```{r}
317317
#| label: load-visium-object
318318
#| eval: false
319-
#| purl: false
320319
321320
# Load the Seurat object from disk
322321
visium <- readRDS("results/visium_brain.rds")
323322
```
324323

325-
<!--
326-
Hugo note: I have for now commented this out, to keep things simple and focused on Visium, which forms the main component of the detailed workflow chapters. Perhaps these details can be added to the case study later on?
327-
328-
## Loading Xenium Data into Seurat
324+
## Loading Xenium Data
329325

330326
If you are working with 10X Genomics Xenium data, you can use the `LoadXenium()` function to load the data into a Seurat object.
331327
This function is specifically designed to handle the unique structure of Xenium data, which includes spatial transcriptomics data with high-resolution spatial coordinates and associated images.
332328

333-
::: {.callout-warning}
334-
#### Xenium data is large!
335-
336-
Xenium datasets can be quite large, so make sure you have enough memory available to load the data.
337-
If you encounter memory issues, consider using a machine with more RAM or using a subset of the data for analysis.
338-
:::
339-
340329
We will use another dataset from the 10X examples.
341330
The data is available on the 10X website and has been downloaded for you in the course materials at `data/human_melanoma_xenium`.
342331

343332
```{r}
344333
#| label: load-xenium-data
345-
#| eval: false
346-
#| purl: false
347334
348335
# load the xenium data - takes a while to load
349336
xenium <- LoadXenium("data/human_melanoma_xenium", fov = "fov")
@@ -352,18 +339,19 @@ xenium <- LoadXenium("data/human_melanoma_xenium", fov = "fov")
352339
The FOV (Field of View) parameter allows you to specify which field of view to load if the dataset contains multiple fields.
353340
In this case, we are loading the default field of view.
354341

355-
To visualise the Xenium data we will use the `ImageDimPlot()` function to plot the spatial distribution of cells or spots in the tissue slide.
356-
We can also visualise the number of features measured in each location using `ImageFeaturePlot()`.
357-
This shows that while the spatial resolution is very high, the number of features measured per location is quite low compared to other spatial transcriptomics technologies.
358-
In this case only 382 genes were measured.
342+
For single-cell resolution methods like Xenium, we can use the `ImageDimPlot()` function to plot the spatial distribution of cells or spots in the tissue slide:
359343

360344
```{r}
361345
#| label: visualise-xenium-data
362-
#| eval: false
363-
#| purl: false
364346
365-
# Visualise the dots representing the locations of the transcripts on the tissue slide
347+
# Visualise the locations of the transcripts on the tissue slide
366348
ImageDimPlot(xenium)
349+
```
350+
351+
We can also visualise the number of features measured in each location using `ImageFeaturePlot()`:
352+
353+
```{r}
354+
#| label: visualise-xenium-nfeature
367355
368356
# Visualise the transcript density on the tissue slide
369357
ImageFeaturePlot(
@@ -373,7 +361,58 @@ ImageFeaturePlot(
373361
)
374362
```
375363

376-
-->
364+
This shows that while the spatial resolution is very high, the number of features measured per location is low compared to other spatial transcriptomics technologies.
365+
In this case only `r nrow(xenium)` genes were measured, and the visualisation above shows the scale only going up to a maximum of 150 features detected per position.
366+
367+
We can compare the range of features detected between the two technologies here:
368+
369+
```{r}
370+
#| label: compare-nfeature
371+
372+
# Summary of number of detected features
373+
summary(xenium$nFeature_Xenium)
374+
summary(visium$nFeature_Spatial)
375+
```
376+
377+
You will explore this dataset more fully in the [_Xenium: Human Melanoma_ case study](11-XeniumExample.qmd).
378+
379+
::: {.callout-warning}
380+
#### Xenium data is large!
381+
382+
Xenium datasets can be quite large, so make sure you have enough memory available to load the data.
383+
If you encounter memory issues, consider using a machine with more RAM or using a subset of the data for analysis.
384+
:::
385+
386+
## Example MERFISH file
387+
388+
As an example, we provide a pre-processed MERFISH file of the Human heart, which has been saved as a Seurat object:
389+
390+
```{r}
391+
#| label: load-preprocessed-merfish
392+
393+
# Load the preprocessed MERFISH dataset
394+
merfish <- readRDS("data/human_heart_merfish/overall_merfish.rds")
395+
396+
# Examine the object
397+
merfish
398+
```
399+
400+
MERFISH data does not have an associated image with it, and is stored as if it was a single-cell dataset.
401+
The spatial information is represented as a dimensionality reduction slot, which we can visualise with the `DimPlot()` function.\
402+
403+
```{r}
404+
#| label: visualise-merfish
405+
406+
# Visualize the structure of the heart in the MERFISH data
407+
DimPlot(
408+
merfish,
409+
reduction = "spatial",
410+
group.by = "communities",
411+
cols = paletteer_d("ggthemes::Tableau_20")
412+
)
413+
```
414+
415+
This is just a quick look at a MERFISH dataset, you will explore this dataset more in the [_MERFISH: Human Heart_ case study](12-MerfishExample.qmd).
377416

378417
## Summary
379418

0 commit comments

Comments
 (0)