CellChat
CellChat copied to clipboard
Error: Will not launch future due to the size of the globals 4.98 GiB exceeds 2.93 GiB
Hello,
Thanks a lot for this great tool! How can I resolve the error when I run the following code?
cellchat <- subsetData(cellchat) # This step is necessary even if using the whole database
future::plan("multisession", workers = 12) # do parallel
cellchat <- identifyOverExpressedGenes(cellchat)
cellchat <- identifyOverExpressedInteractions(cellchat)
execution.time = Sys.time() - ptm
print(as.numeric(execution.time, units = "secs"))
Error: Will not launch future due to the size of the globals 4.98 GiB exceeds 2.93 GiB. The total size of the 9 globals exported for future expression ('{; "# future::getGlobalsAndPackages(): wrapping the original future"; "# expression in do.call(), because function called uses '...' "; "# as a global variable "; do.call(function(...) {; "# future::getGlobalsAndPackages(): FUN() uses '...' internally "; ...; }; }, args = future.call.arguments); }') is 2.49 GiB The three largest globals are '...future.FUN' (2.49 GiB of class 'function'), 'complexSubunits' (23.57 KiB of class 'list') and 'features.sig' (12.55 KiB of class 'character')
Traceback:
1. unlist(x = my.sapply(X = 1:nrow(complexSubunits), FUN = function(x) {
. complexsubunitsV <- unlist(complexSubunits[x, ], use.names = F)
. complexsubunitsV <- complexsubunitsV[complexsubunitsV !=
. ""]
. if (length(intersect(complexsubunitsV, features.sig)) > 0 &
. all(complexsubunitsV %in% gene.use)) {
. return(x)
. }
. }))
2. my.sapply(X = 1:nrow(complexSubunits), FUN = function(x) {
. complexsubunitsV <- unlist(complexSubunits[x, ], use.names = F)
. complexsubunitsV <- complexsubunitsV[complexsubunitsV !=
. ""]
. if (length(intersect(complexsubunitsV, features.sig)) > 0 &
. all(complexsubunitsV %in% gene.use)) {
. return(x)
. }
. })
3. future_lapply(X = X, FUN = FUN, ..., future.envir = future.envir,
. future.label = future.label)
4. future_xapply(FUN = FUN, nX = nX, chunk_args = X, args = list(...),
. get_chunk = `chunkWith[[`, expr = expr, envir = envir, future.envir = future.envir,
. future.globals = future.globals, future.packages = future.packages,
. future.scheduling = future.scheduling, future.chunk.size = future.chunk.size,
. future.stdout = future.stdout, future.conditions = future.conditions,
. future.seed = future.seed, future.label = future.label, fcn_name = fcn_name,
. args_name = args_name, debug = debug)
5. future(expr, substitute = FALSE, envir = future.envir, stdout = future.stdout,
. conditions = future.conditions, globals = globals_ii, packages = packages_ii,
. seed = future.seed, label = labels[ii])
6. run(future)
7. run.Future(future)
8. validateFutureGlobals(backend, future)
9. validateFutureGlobals.FutureBackend(backend, future)
10. stop(FutureError(msg, future = future))
options(future.globals.maxSize = 50 * 1024 * 1024 * 1024)
@danli349 run this command may help