Dataset
Take from http://livercellatlas.org/ human single-nuclei and spatial datasets
Look at spatial data
Code
suppressPackageStartupMessages ({
library (tidyverse)
library (Seurat)
})
object.names <- c ("H35_1" , "H35_2" , "H36" , "H37" , "H38" )
spatial.rna.objects <- list ()
for (object.name in object.names) {
object <- readRDS (paste0 ("/NAS/qscb2025/Guilliams_2022_livercellatlas/data/liver/spatial/" , object.name, ".rds" ))
object2 <- CreateSeuratObject (
counts = LayerData (object, assay = "Spatial" , layer = "counts" ),
meta.data = object@ meta.data
)
object2 <- NormalizeData (object2)
spatial.rna.objects[[object.name]] <- object2
}
Normalizing layer: counts
Normalizing layer: counts
Normalizing layer: counts
Normalizing layer: counts
Normalizing layer: counts
Code
spatial.rna.merged <- merge (spatial.rna.objects[[1 ]], spatial.rna.objects[2 : length (spatial.rna.objects)])
spatial.rna.merged <- SCTransform (spatial.rna.merged, verbose = FALSE )
spatial.rna.merged <- RunPCA (spatial.rna.merged, verbose = FALSE )
spatial.rna.merged <- FindNeighbors (spatial.rna.merged, dims = 1 : 30 , verbose = FALSE )
spatial.rna.merged <- RunUMAP (spatial.rna.merged, dims = 1 : 30 , verbose = FALSE )
Warning: The default method for RunUMAP has changed from calling Python UMAP via reticulate to the R-native UWOT using the cosine metric
To use Python UMAP via reticulate, set umap.method to 'umap-learn' and metric to 'correlation'
This message will be shown once per session
Exercise 1: Does this require integration?
If so show implement it
Code
DimPlot (spatial.rna.merged, group.by = "sample_name" )
Code
Exercise 2: Does this require integration?
If so show implement it
Code
rna.merged <- readRDS ("/NAS/qscb2025/Guilliams_2022_livercellatlas/data/liver/rna/GSE192740_rna.rds" )
# check metadata
head (rna.merged)
Code
# Perform steps
# YOUR CODE HERE
Code
DimPlot (rna.merged, group.by = "sample" )
Code
Exercise 3: Subset H37 patient and predict the celltypes in H38 patient
Exercise 4: You were given the objects pre-processed (to some extent)
Go to http://livercellatlas.org/ or search GSE192740 to download the raw counts file and metadata and create the seurat objects
Exercise 5: Integrate the mouse and the human datasets