Hi all, now I'm analyzing scRNA seq. The problem is that I don't think batch correction work well. I want to see the aging difference between young and old group so I want to do batch correction in sex. but, I don;t think it work well. (I don't have any repeats in my dataset) Thank you so muuch!!
WAT <- merge(WAT_M_Y, y = c(WAT_M_O, WAT_F_Y, WAT_F_O),
project = "WAT")
WAT@meta.data$type <- c(rep("Young", ncol(WAT_M_Y)),
rep("Old", ncol(WAT_M_O)),
rep("Young", ncol(WAT_F_Y)),
rep("Old", ncol(WAT_F_O)))
WAT@meta.data$sex <- c(rep("Male", ncol(WAT_M_Y)),
rep("Male", ncol(WAT_M_O)),
rep("Female", ncol(WAT_F_Y)),
rep("Female", ncol(WAT_F_O)))
WAT$lowQC <- ifelse(WAT$nFeature_RNA>500 &
WAT$percent.mt <10, "PASS", "FAIL")
WAT<- subset(WAT, subset = lowQC == "PASS")
WAT <- NormalizeData(WAT)
WAT_variable <- FindVariableFeatures(WAT, selection.method = "vst", nfeatures = 2000)
WAT_variable <- ScaleData(WAT_variable, vars.to.regress = c("percent.mt"))
VariableFeaturePlot(object= WAT_variable)
WAT_variable <- RunPCA(WAT_variable, features = VariableFeatures(WAT_variable), verbose = T)
#batch correction
library(harmony)
library(Rcpp)
WAT_variable2 <- RunHarmony(WAT_variable, group.by.vars = "sex")
Based on the plots generated using your guidance, it seems that batch correction might not be necessary, or it has been effectively applied. Thank you for your kind and detailed response.