@@ -8,6 +8,10 @@ if (!doDiet && length(seuratObjects) > 20 && !disableAutoDietSeurat) {
88filesToDelete <- c()
99
1010mergeBatchInMemory <- function (datasetIdToFilePath , saveFile ) {
11+ if (all(is.null(names(datasetIdToFilePath )))) {
12+ stop(' No names provided on datasetIdToFilePath' )
13+ }
14+
1115 toMerge <- list ()
1216 for (datasetId in names(datasetIdToFilePath )) {
1317 print(paste0(' Loading: ' , datasetId ))
@@ -43,7 +47,7 @@ mergeBatchInMemory <- function(datasetIdToFilePath, saveFile) {
4347 saveRDS(seuratObj , file = saveFile )
4448 filesToDelete <<- c(filesToDelete , saveFile )
4549
46- return (fn )
50+ return (saveFile )
4751}
4852
4953mergeBatch <- function (seuratObjects , outerBatchIdx , maxBatchSize = 20 , maxInputFileSizeMb = maxAllowableInputFileSizeMb ) {
@@ -89,8 +93,9 @@ mergeBatch <- function(seuratObjects, outerBatchIdx, maxBatchSize = 20, maxInput
8993 activeBatch <- batchList [[i ]]
9094 logger :: log_info(paste0(' Merging inner batch ' , i , ' of ' , length(batchList ), ' with ' , length(activeBatch ), ' files' ))
9195
92- saveFile <- paste0(' merge.' , outerBatchIdx , ' .' , i , ' .rds' )
93- mergedObjectFiles [[i ]] <- mergeBatchInMemory(activeBatch , saveFile = saveFile )
96+ batchName <- paste0(' merge.' , outerBatchIdx , ' .' , i )
97+ saveFile <- paste0(batchName , ' .rds' )
98+ mergedObjectFiles [[batchName ]] <- mergeBatchInMemory(activeBatch , saveFile = saveFile )
9499
95100 logger :: log_info(paste0(' mem used: ' , R.utils :: hsize(as.numeric(pryr :: mem_used()))))
96101 gc()
0 commit comments