Load packages
Load data and create object
# Load in the RNA UMI matrix for PBMC 1K dataset
cbmc.1k.data <- readDataFrom10X(dir = "../1K/filtered_feature_bc_matrix/")
cbmc.1k <- createObject(data = cbmc.1k.data, project = "CBMC1K")
# Load in the RNA UMI matrix for PBMC 10K dataset
cbmc.10k.data <- readDataFrom10X(dir = "../10K/filtered_feature_bc_matrix/")
cbmc.10k <- createObject(data = cbmc.10k.data, project = "CBMC10K")
pre-process for two datasets
Integrate two dataset using Seurat V3 (integrate RNA expression)
Joint PCA
Joint RNA and ADT distances, clusters, UMAPs
# do distance, clustering and umaps in the same step cbmc.integrated <-
# jointClusteing(object = cbmc.integrated, run_seprate = TRUE)
# joint distance
cbmc.integrated <- jointDistance(cbmc.integrated)
# umaps
cbmc.integrated <- umapFromDistane(cbmc.integrated)
# clustering
cbmc.integrated <- clusteringFromDistance(cbmc.integrated)
directly pool two datasets together as comparision
cbmc.merge <- merge(x = cbmc.1k, y = cbmc.10k)
cbmc.merge <- FindVariableFeatures(object = cbmc.merge)
cbmc.merge <- ScaleData(object = cbmc.merge)
cbmc.merge <- RunPCA(object = cbmc.merge)
# joint distance
cbmc.merge <- jointDistance(cbmc.merge)
# umaps
cbmc.merge <- umapFromDistane(cbmc.merge)
# clustering
cbmc.merge <- clusteringFromDistance(cbmc.merge)
cells from two datasets after Batch effects correction on RNA, ADT and joint map
p01 <- DimPlot(cbmc.merge, reduction = "umap_rna", group.by = "orig.ident") +
ggtitle("RNA UMAP without Batch Effects Correction")
p02 <- DimPlot(cbmc.merge, reduction = "umap_adt", group.by = "orig.ident") +
ggtitle("ADT UMAP without Batch Effects Correction")
p03 <- DimPlot(cbmc.merge, reduction = "umap_joint", group.by = "orig.ident") +
ggtitle("Joint UMAP without Batch Effects Correction")
p1 <- DimPlot(cbmc.integrated, reduction = "umap_rna", group.by = "orig.ident") +
ggtitle("RNA UMAP with Batch Effects Correction")
p2 <- DimPlot(cbmc.integrated, reduction = "umap_adt", group.by = "orig.ident") +
ggtitle("ADT UMAP with Batch Effects Correction")
p3 <- DimPlot(cbmc.integrated, reduction = "umap_joint", group.by = "orig.ident") +
ggtitle("Joint UMAP with Batch Effects Correction")
plot_grid(p01, p02, p03, p1, p2, p3, ncol = 3)