@@ -56,18 +56,18 @@ mergeBatch <- function(seuratObjects, outerBatchIdx, maxBatchSize = 20, maxInput
5656
5757 # Phase 1: group into batches:
5858 batchList <- list ()
59- activeBatch <- c ()
59+ activeBatch <- list ()
6060 sizeOfBatch <- 0
6161 batchIdx <- 1
6262 for (datasetId in names(seuratObjects )) {
63- activeBatch <- c( activeBatch , seuratObjects [[datasetId ]])
63+ activeBatch [[ datasetId ]] <- seuratObjects [[datasetId ]]
6464 sizeInMb <- (file.size(seuratObjects [[datasetId ]]) / 1024 ^ 2 )
6565 sizeOfBatch <- sizeOfBatch + sizeInMb
6666
6767 if (length(activeBatch ) > = maxBatchSize || (sizeOfBatch > = maxInputFileSizeMb && length(activeBatch ) > 1 )) {
68- logger :: log_info(paste0(' adding to batch with ' , length(activeBatch ), ' files and ' , sizeOfBatch , ' MB' ))
69- batchList [batchIdx ] <- activeBatch
70- activeBatch <- c ()
68+ logger :: log_info(paste0(' adding to batch with ' , length(activeBatch ), ' files and ' , sizeOfBatch , ' MB' ))
69+ batchList [[ batchIdx ] ] <- activeBatch
70+ activeBatch <- list ()
7171 sizeOfBatch <- 0
7272 batchIdx <- batchIdx + 1
7373 next
@@ -76,8 +76,8 @@ mergeBatch <- function(seuratObjects, outerBatchIdx, maxBatchSize = 20, maxInput
7676
7777 # Account for final files:
7878 if (length(activeBatch ) > 0 ) {
79- logger :: log_info(paste0(' finalizing batch with ' , length(activeBatch ), ' files and ' , sizeOfBatch , ' MB' ))
80- batchList [batchIdx ] <- activeBatch
79+ logger :: log_info(paste0(' finalizing batch with ' , length(activeBatch ), ' files and ' , sizeOfBatch , ' MB' ))
80+ batchList [[ batchIdx ] ] <- activeBatch
8181 }
8282
8383 if (length(batchList ) == 0 ){
0 commit comments