-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parallel computation #15
Comments
Great question. To identify spatially heterogenous genes, MERINGUE evaluates each gene independently. So one potential approach to multicore processing would be to split genes into groups and evaluate each group in parallel. Here is an example starting from the MOB analysis tutorial:
# Identify sigificantly spatially auto-correlated genes
start_time <- Sys.time()
I <- getSpatialPatterns(mat, w, verbose = FALSE)
end_time <- Sys.time()
print(end_time - start_time)
## Alternative parallelized version
## split genes into 4 groups
ncore <- 4
groups <- split(rownames(mat), sample(1:ncore,nrow(mat),replace=TRUE))
length(groups)
sapply(groups, length)
## parallelize groups 4 cores
start_time <- Sys.time()
I <- do.call(rbind, parallel::mclapply(groups, function(gs) {
+ I <- getSpatialPatterns(mat[gs,], w, verbose=FALSE)
+ }, mc.cores=ncore))
end_time <- Sys.time()
print(end_time - start_time)
Hope that helps, |
Hi Jean, Thanks! It works. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Jean and team,
Thanks for your work! I'm wondering if I can use MERINGUE with multicore properly. I'd like to compare the computational effeiciency of MERINGUE with other approaches.
Thanks in advance!
The text was updated successfully, but these errors were encountered: