What steps/functions did we use to calculate clusters previously?
Principle component analysis: RunPCA()
Evaluate necessity of integration
Find k-nearest neighbors: FindNeighbors()
Cluster cells: FindClusters()
Exercise 2
What does the UMAP look like when use the BANKSY derived Harmony latent space to calculate UMAP coordinates?
First, we calculate UMAP on the BANKSY Harmony latent space.
# Run UMAP on BANKSY harmony latent spaceseurat_banksy <-RunUMAP(seurat_banksy,reduction ="harmony.banksy",reduction.name ="umap.harmony.banksy", return.model =TRUE, dims =1:30,seed.use =12345)seurat_banksy
An object of class Seurat
36170 features across 135798 samples within 2 assays
Active assay: Spatial.008um (18085 features, 2000 variable features)
2 layers present: counts, data
1 other assay present: sketch
7 dimensional reductions calculated: pca.sketch, umap.sketch, full.pca.sketch, full.umap.sketch, pca.banksy, harmony.banksy, umap.harmony.banksy
2 spatial fields of view present: P5CRC.008um P5NAT.008um
Then, we can visualize what each of the resulting clusters appear like on the BANKSY derived UMAP space:
# Create DimPlot using the BANKSY derived UMAP spaceDimPlot(seurat_banksy, group.by =c("banksy_cluster","seurat_cluster.projected"),reduction ="umap.harmony.banksy",label =TRUE)
Figure 1: UMAP of both BANKSY derived clusters and gene expression derived clusters.
The BANKSY clusters align much better with the BANKSY derived UMAP coordinates. This is due to the fact that they have the same underlying structure. We can also see more clearly that the cluster 1 tumor cells we identified earlier appear to have been split into different sub-groups. This aligns with what we see in the spatial slide, where there appears to be spatially-constrained clusters of tumor bins in the BANKSY clusters.
Exercise 3
Use the DotPlot() function in conjunction with marker_list to see if clusters correspond well with celltypes.
Roughly identify which clusters correspond to which celltypes to provide better context for future analyses.
Based upon the dotplot, the good thing is that while it may not be the clearest signal, we are able to identify major populations of cells in the clusters.
---title: "Spatially Derived Clusters - Answer Key"author: - Noor Sohaildate: "2026-04-18"license: "CC-BY-4.0"editor_options: markdown: wrap: 72---```{r}#| label: load_libraries_data#| echo: false# Load libraries and datalibrary(Seurat)library(tidyverse)# Set parallelization (multithreading) to speed up calculationsplan("multicore", workers = parallel::detectCores() -1)# Load datasetseurat_banksy <- qs2::qs_read("intermediate/09_seurat_banksy_2.qs")```# Exercise 11. What steps/functions did we use to calculate clusters previously?- Principle component analysis: `RunPCA()`- Evaluate necessity of integration- Find k-nearest neighbors: `FindNeighbors()`- Cluster cells: `FindClusters()`# Exercise 22. What does the UMAP look like when use the BANKSY derived Harmony latent space to calculate UMAP coordinates?First, we calculate UMAP on the BANKSY Harmony latent space.```{r}#| label: RunUMAP_banksy# Run UMAP on BANKSY harmony latent spaceseurat_banksy <-RunUMAP(seurat_banksy,reduction ="harmony.banksy",reduction.name ="umap.harmony.banksy", return.model =TRUE, dims =1:30,seed.use =12345)seurat_banksy```Then, we can visualize what each of the resulting clusters appear like on the BANKSY derived UMAP space:```{r}#| label: fig-umap_banksy#| fig-cap: UMAP of both BANKSY derived clusters and gene expression derived clusters.#| fig-width: 14# Create DimPlot using the BANKSY derived UMAP spaceDimPlot(seurat_banksy, group.by =c("banksy_cluster","seurat_cluster.projected"),reduction ="umap.harmony.banksy",label =TRUE)```The BANKSY clusters align much better with the BANKSY derived UMAP coordinates. This is due to the fact that they have the same underlying structure. We can also see more clearly that the cluster 1 tumor cells we identified earlier appear to have been split into different sub-groups. This aligns with what we see in the spatial slide, where there appears to be spatially-constrained clusters of tumor bins in the BANKSY clusters.# Exercise 33. Use the `DotPlot()` function in conjunction with `marker_list` to see if clusters correspond well with celltypes.```{r}#| label: marker_list# Create marker listmarker_list <-list("B cells"=c("IGKC", "IGHM", "CD79A", "MS4A1", "MZB1"),"Endothelial cells"=c("PECAM1", "VWF", "PLVAP", "ENG", "KLF2"),"Fibroblasts"=c("COL1A1", "COL3A1", "DCN", "LUM", "COL6A2"),"Intestinal epithelial cells"=c("CLCA1", "FCGBP", "MUC2", "PIGR", "ZG16"),"Myeloid cells"=c("C1QC", "SELENOP", "SPP1", "LYZ", "CD68"),"Neural cells"=c("NRXN1", "L1CAM", "NCAM1", "VIP", "CALB2"),"Smooth muscle cells"=c("TAGLN", "ACTA2", "MYH11", "MYL9", "CNN1"),"T cells"=c("TRAC", "CD3E", "TRBC2", "IL7R", "CD52"),"Tumor cells"=c("CEACAM6", "CEACAM5", "EPCAM", "KRT8", "LCN2"))``````{r}#| label: dotplot#| fig-width: 15#| fig-height: 8DotPlot(seurat_banksy, marker_list,group.by ="banksy_cluster",cluster.idents =TRUE) +theme(axis.text.x =element_text(angle =45, hjust =1))```3. Roughly identify which clusters correspond to which celltypes to provide better context for future analyses.Based upon the dotplot, the good thing is that while it may not be the clearest signal, we are able to identify major populations of cells in the clusters.| BANKSY Cluster | Cell Type ||---------|-----------|| 1 | B cells || 2 | Intestinal epithelial cells || 3 | Intestinal epithelial cells || 4 | ? || 5 | Endothelial cells || 6 | Intestinal epithelial cells || 7 | T cells || 8 | ? || 9 | Smooth muscle cells || 10 | Intestinal epithelial cells || 11 | Intestinal epithelial cells || 12 | Myeloid cells || 13 | Tumor cells || 14 | Tumor cells || 15 | Tumor cells || 16 | Intestinal epithelial cells || 17 | ? || 18 | Tumor cells || 19 | Tumor cells || 20 | Neural cells |***[Back to Lesson >>](11_banksy_clustering.qmd)[Back to Schedule](../schedule/schedule.qmd)