Seurat merge and batch correction
1
0
Entering edit mode
25 days ago
sooni ▴ 20

Hello.

I want to merge 7 Seurat objects and do batch correction. How can I do this?

I'm going to use the merge() function to merge seurat objects. If there is another better way, please let me know.

Seurat • 283 views
ADD COMMENT
3
Entering edit mode
25 days ago
bk11 ★ 2.5k

You can merge your seven Seurat objects and perform integration using Seurat V5 to remove the batch effect-

library(Seurat)
library(ggplot2)
library(patchwork)

#first merge your seven Seurat objects:
SeuratObj <- merge(SeuratObj1, y = c(SeuratObj2, SeuratObj3, SeuratObj4,SeuratObj5, SeuratObj6, SeuratObj7), add.cell.ids = c("subj1", "subj2", "subj3","subj4", "subj5", "subj6", "subj7"), project = "test_project")

#Perform these before integration 
SeuratObj <- NormalizeData(SeuratObj)
SeuratObj <- FindVariableFeatures(SeuratObj)
SeuratObj <- ScaleData(SeuratObj)
SeuratObj <- RunPCA(SeuratObj)

SeuratObj <- FindNeighbors(SeuratObj, dims = 1:30, reduction = "pca")
SeuratObj <- FindClusters(SeuratObj, resolution = 1.5, cluster.name = "unintegrated_clusters")

SeuratObj <- RunUMAP(obj, dims = 1:30, reduction = "pca", reduction.name = "umap.unintegrated")

#Data Integration using Harmony
SeuratObj_Integrated <- IntegrateLayers(object = SeuratObj, method = HarmonyIntegration, orig.reduction = "pca", new.reduction = harmony", verbose = FALSE)

SeuratObj_Integrated <- FindNeighbors(SeuratObj_Integrated, reduction = "integrated.harmony", dims = 1:30)
SeuratObj_Integrated <- FindClusters(SeuratObj_Integrated, resolution = 1.5, cluster.name = "harmony_clusters")

SeuratObj_Integrated <- RunUMAP(SeuratObj_Integrated, reduction = "integrated.harmony", dims = 1:30, reduction.name = "umap.harmony")

p1 <- DimPlot(SeuratObj, reduction = "umap.unintegrated", group.by = c("unintegrated_clusters"))
p2 <- DimPlot(SeuratObj_Integrated, reduction = "umap.harmony", group.by = c("harmony_clusters"))

p1|p2
ADD COMMENT

Login before adding your answer.

Traffic: 1263 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6