seurat
seurat copied to clipboard
rPCA IntegrateData causes R to crash with a relatively small dataset
Hello all,
When running IntegrateData via rPCA on three ~7K cells samples R consistently crashes. I have 32gb of memory, and before running I have ~20gb free. Once integrateData is called memory usage ramps up and hovers around 30gb until the final integration step then is pushed 32 and crashes. From what I understand R shouldn't be struggling so much with relatively small dataset like this? Where am I going wrong? Any help would be greatly appreciated.
After QC filtering I run the below code (sce is a list of the three specimens).
options(future.globals.maxSize = 1024 * 1024 * 1024) # 1 GB
SCT <- function(x){
s.genes <- cc.genes.updated.2019$s.genes
g2m.genes <- cc.genes.updated.2019$g2m.genes
x <- NormalizeData(x)
x <- CellCycleScoring(x, s.features = s.genes, g2m.features = g2m.genes, set.ident = TRUE)
x <- SCTransform(x, vars.to.regress = c("percent.mt", "S.Score", "G2M.Score"))
x
}
sce <- lapply(sce, SCT)
names(sce) <- c("combo1","veh1","veh2")
features <- SelectIntegrationFeatures(object.list = sce, nfeatures = 3000)
sce <- PrepSCTIntegration(object.list = sce, anchor.features = features)
sce <- lapply(X = sce, FUN = RunPCA, features = features)
sce <- FindIntegrationAnchors(object.list = sce, normalization.method = "SCT", anchor.features = features, dims = 1:30, reduction = "rpca", k.anchor = 20)
sce.combined <- IntegrateData(anchorset = sce, normalization.method = "SCT", dims = 1:30)