You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: day1/day1-1a_SpatialExperiment.qmd
+7-8Lines changed: 7 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -53,10 +53,9 @@ library(HDF5Array)
53
53
54
54
## Data for the course
55
55
56
-
We will work on a human colorectal cancer study by [Oliveira _et al_](https://www.nature.com/articles/s41588-025-02193-3). The dataset contains normal adjacent tissue (NAT) and colorectal carcinoma (CRC) from 5 patients.
56
+
We will work on a human colorectal cancer study by [Oliveira _et al_](https://www.nature.com/articles/s41588-025-02193-3). The dataset contains normal adjacent tissue (NAT) and colorectal carcinoma (CRC) from 5 patients. We will focus on data from a patient called "P2", available from the [10X website](https://www.10xgenomics.com/datasets/visium-hd-cytassist-gene-expression-libraries-of-human-crc).
57
57
58
-
We will focus on data from a patient called "P2", available from the [10X website](https://www.10xgenomics.com/datasets/visium-hd-cytassist-gene-expression-libraries-of-human-crc).
59
-
For this sample, the study provides Visium HD data at 2, 8, and 16 um binned resolutions and output from cell segmentation, as well as a matching Xenium dataset. The data were generated from serial sections of the same samples, so they are spatially matched and can be used for cross-platform comparisons.
58
+
For this sample, the study provides Visium HD data at 2, 8, and 16 um resolution and the per-cell output after cell segmentation. Matching Xenium data generated from serial sections of the same sample is also available and can be used for cross-platform comparisons.
60
59
61
60
In this exercise we will work with **Visium HD** data and focus on the "binned output" available as an output of the Space Ranger pipeline (version 3.0). The full output is very large, so for practical reasons we use a region of interest, selected to include an interesting part of the tissue, because it contains gland-like epithelial structures together with stromal or lower-density areas:
62
61
@@ -83,7 +82,7 @@ osta_roi_visium <- c(
83
82
osta_roi_visium
84
83
```
85
84
86
-
*Note 2*: The same study also generated a matching Xenium dataset from serial sections of the same samples, which we will use in `Exercise 1 B` (we subsetted to regions of interest of the P2CRC slide, approximately matching the one selected here).
85
+
*Note 2*: In `Exercise 1B` we focus on the matching Xenium dataset from a serial section of the same P2CRC sample, subsetted to an approximately matching region of interest.
87
86
88
87
89
88
```{r day1-1a-SpatialExperiment-5}
@@ -108,7 +107,7 @@ if (!dir.exists("data/Human_Colon_Cancer_P2/")) {
108
107
}
109
108
```
110
109
111
-
We will import the 16 um binned Visium HD output into a `SpatialExperiment` object and then subset it to the course region. The coordinates are in the native Visium HD image coordinate system returned by `spatialCoords()`.
110
+
We will import the 16 um binned Visium HD output into a `SpatialExperiment` object and then subset it to the region of internet. The coordinates are in the native Visium HD image coordinate system returned by `spatialCoords()`.
112
111
113
112
```{r day1-1a-SpatialExperiment-6}
114
113
spe <- TENxVisiumHD(
@@ -160,7 +159,7 @@ In this exercise, we will inspect the `SpatialExperiment` class used to store th
160
159
161
160

162
161
163
-
*Note*: The practical `Exercise 1 B` uses a Xenium dataset stored into a `SpatialFeatureExperiment` class, which is an extension of the `SpatialExperiment` incorporating geometries, allowing to store cell segmentation polygons for example.
162
+
*Note*: The practical `Exercise 1B` uses a Xenium dataset stored into a `SpatialFeatureExperiment` class, which is an extension of the `SpatialExperiment` incorporating geometries, allowing to store cell segmentation polygons for example.
164
163
165
164
166
165
::: callout-important
@@ -220,7 +219,7 @@ assay(spe)
220
219
class(assay(spe))
221
220
```
222
221
223
-
The `DelayedArray` class allows to store out-of-memory representations of count matrices, which are saved as .h5 files on the disk. This is very useful for efficient processing of large datasets (100,000s of cells or spots)
222
+
The `DelayedArray` class allows to store out-of-memory representations of count matrices, which are saved as `.h5` files on the disk. This is very useful for efficient processing of large datasets (100,000s of cells or spots)
224
223
225
224
The `reducedDims` slot is empty at this stage:
226
225
@@ -270,7 +269,7 @@ Why do we see only a specific region of the slide?
270
269
::: {.callout-tip collapse="true"}
271
270
## Answer
272
271
273
-
The full Visium HD output is much larger than needed for this introductory exercise. At the start of this exercise, we subsetted the object to one representative tissue region so that it remains fast to plot and process. This same region is also used as the anchor for selecting a comparable Xenium region in `Exercise 1 B`.
272
+
The full Visium HD output is much larger than needed for this introductory exercise. At the start of this exercise, we subsetted the object to one representative tissue region so that it remains fast to plot and process. This same region is also used as the anchor for selecting a comparable Xenium region in `Exercise 1B`.
274
273
:::
275
274
276
275
It is possible to colour bins according to a gene or a column in `colData`, for example `PIGR`. We renamed the rows to gene symbols after import, which is why we can refer to this marker as `"PIGR"` rather than by its Ensembl ID. At this stage we plot the number of UMIs since log-normalized counts will be introduced later in the course.
Copy file name to clipboardExpand all lines: day1/day1-1b_SpatialFeatureExperiment.qmd
+33-17Lines changed: 33 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ By the end of this exercise, you will be able to:
16
16
- Explain when `SpatialFeatureExperiment` is useful compared with `SpatialExperiment`.
17
17
- Access cell-level metadata and spatial coordinates from Xenium data.
18
18
- Inspect geometry information such as cell or nucleus boundaries.
19
-
- Compare the Xenium representation with the Visium HD representation from Exercise 1 A.
19
+
- Compare the Xenium representation with the Visium HD representation from Exercise 1A.
20
20
21
21
## Libraries
22
22
@@ -40,7 +40,7 @@ Next, will work with the **Xenium** dataset from the P2 sample (human colorectal
40
40
41
41
This slide is a serial section of the sample used in `Exercise 1A`, so the two datasets are biologically related but not the exact same physical tissue section.
42
42
43
-
The full Xenium output is very large and includes cell boundaries, nucleus boundaries, transcript locations, morphology images, and expression matrices. For this exercise, for practical reasons we use a region of interest, selected to **approximately match the region of interest used in `Exercise 1 A`**, and only include some of the layers in the imported compact course folder. This makes the two exercises comparable while avoiding a full image-registration workflow during the practical.
43
+
The full Xenium output is very large and includes cell boundaries, nucleus boundaries, transcript locations, morphology images, and expression matrices. For this exercise, for practical reasons we use a region of interest, selected to **approximately match the region of interest used in `Exercise 1A`**, and only include some of the layers in the imported compact course folder. This makes the two exercises comparable while avoiding a full image-registration workflow during the practical.
Choose another marker gene and visualize its spatial pattern.
209
209
210
-
How does the interpretation differ from plotting a gene on Visium HD bins?
211
-
212
-
:::
213
-
<!-- JUNA: If we want them to compare to Visium HD we should not delete environment in previous exercise, or load the spe object here as part of the solution -->
214
-
215
-
210
+
How does the interpretation differ from plotting a gene on Visium HD bins? How does the expression of the same gene compares across platforms?
216
211
217
212
::: {.callout-tip collapse="true"}
218
213
## Answer
219
214
220
215
The Xenium signal is measured over segmented cells, while the Visium HD binned signal aggregates molecules within fixed spatial bins. Xenium can therefore represent cell-level heterogeneity more directly, but it measures a targeted panel rather than the whole transcriptome.
216
+
217
+
Here is some code to plot the expression of the same gene across platforms in a similar way:
Copy file name to clipboardExpand all lines: day1/day1-1c_visium_HD_segmented.qmd
+8-9Lines changed: 8 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ execute:
13
13
By the end of this exercise, you will be able to:
14
14
15
15
- TO DEFINE
16
-
<!-- Adapt depending on the final data structure -->
16
+
<!--TO DO: Adapt depending on the final data structure -->
17
17
18
18
19
19
## Libraries
@@ -36,8 +36,7 @@ library(VisiumIO)
36
36
37
37
Finally, we will work with the **Visium HD segmented output**. This data corresponds to the same sample and region of interest as the binned data from `Exercise 1A`, but instead of being binned, it contains the output of cell segmentation. Since Space Ranger version 4.0, the output of cell segmentation is available as an optional output of the pipeline, and it contains the coordinates of the segmented cells and their boundaries.
38
38
39
-
<!-- Download the segmented output from the 10X website if it does not exist in the `data` folder. -->
40
-
39
+
<!-- TO DO: we need to make a smaller version of teh dataset for the course! -->
41
40
42
41
```{r day1-1c-visium_HD_segmented-3}
43
42
options(timeout = 600)
@@ -63,20 +62,20 @@ if (!dir.exists("data/Visium_HD_Human_Colon_Cancer_segmented_outputs/")) {
63
62
64
63
::: callout-important
65
64
## Exercise 1
66
-
Why will we use SpatialFeatureExperiment to work with the segmented data instead of SpatialExperiment as we did for the binned data in Exercise 1A
67
-
?
65
+
Which class do you think should be used to store the Visium HD segmented data? `SpatialExperiment` as we used in Exercise 1A
66
+
or `SpatialFeatureExperiment` as we used in Exercise 1B?
68
67
:::
69
68
70
69
::: {.callout-tip collapse="true"}
71
70
## Answer
72
-
Since segmeneted data contains cell boundaries, the coordinates of the segmented cells are not limited to the spot coordinates as in the binned data. Therefore, we will use `SpatialFeatureExperiment` to work with the segmented data, as it allows us to store and visualize spatial features such as cell boundaries, as we did for the Xenium data in Exercise 1B.
71
+
Since segmented data contains cell boundaries, the coordinates of the segmented cells are not limited to the spot coordinates as in the binned data. Therefore, we will use `SpatialFeatureExperiment` to work with the segmented data, as it allows us to store and visualize spatial features such as cell boundaries, as we did for the Xenium data in Exercise 1B.
73
72
In contrast, `SpatialExperiment` is more suitable for binned data where the coordinates correspond to the spot centroids and there are no additional spatial features to store.
74
73
:::
75
74
76
75
77
-
We will create the `SpatialFeatureExperiment` object in two steps.
78
-
79
-
We start reading the object into a `SpatialExperiment` object and subset it to the course region, as we have done for visium HD binned data in the previous exercises.
76
+
Here we will proceed in two steps:
77
+
- We start reading the object into a `SpatialExperiment` object and subset it to the region of interest, as we have done for Visium HD binned data in the previous exercises. This allows a quick comparison of the two types of processing for the same slide
78
+
-We then convert the object to create a `SpatialFeatureExperiment` object and add the cell segmentation information to it/
0 commit comments