R toolkit for inference, visualization and analysis of cell-cell communication from single-cell and spatially resolved transcriptomics
GNU General Public License v3.0
276
stars
45
forks
source link
Error in identifyOverExpressedInteractions() after plan("multisession") - Error in rep(no, length.out = len) : attempt to replicate an object of type 'closure' #93
I noticed an interesting error in identifyOverExpressedInteractions() when attempting to parallelize using future.
> plan("multisession", workers = availableCores()) # with this session, future::availableCores() = 6
> for (i in seq_along(cellchat_list)) {
+ cellchat_list[[i]] <- identifyOverExpressedGenes(cellchat_list[[i]])
+ cellchat_list[[i]] <- identifyOverExpressedInteractions(cellchat_list[[i]])
+ }
Error in rep(no, length.out = len) :
attempt to replicate an object of type 'closure'
When I try to run identifyOverExpressedInteractions() outside of the for loop on just one of the four CellChat objects in the list, I get the same error, indicating the issue is not in my iteration scheme.
> cellchat_list[[2]] <- identifyOverExpressedInteractions(cellchat_list[[2]])
Error in rep(no, length.out = len) :
attempt to replicate an object of type 'closure'
However, when I change to running in sequential, the function works as intended:
> plan("sequential")
> for (i in seq_along(cellchat_list)) {
+ cellchat_list[[i]] <- identifyOverExpressedGenes(cellchat_list[[i]])
+ cellchat_list[[i]] <- identifyOverExpressedInteractions(cellchat_list[[i]])
+ }
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=01s
The number of highly variable ligand-receptor pairs used for signaling inference is 2762
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02s
The number of highly variable ligand-receptor pairs used for signaling inference is 2361
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=01s
The number of highly variable ligand-receptor pairs used for signaling inference is 2606
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=01s
The number of highly variable ligand-receptor pairs used for signaling inference is 2840
I'm able to progress with my analysis, and the runtime was short enough that parallelization wasn't necessary, but I figured this was worth bringing to your attention - others may work with larger individual datasets where not being able to parallelize the function may be more of a concern.
I noticed an interesting error in
identifyOverExpressedInteractions()
when attempting to parallelize using future.When I try to run
identifyOverExpressedInteractions()
outside of thefor
loop on just one of the fourCellChat
objects in the list, I get the same error, indicating the issue is not in my iteration scheme.However, when I change to running in sequential, the function works as intended:
I'm able to progress with my analysis, and the runtime was short enough that parallelization wasn't necessary, but I figured this was worth bringing to your attention - others may work with larger individual datasets where not being able to parallelize the function may be more of a concern.
Here is the session information for your use: