satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.27k stars 910 forks source link

FindAllMarkers + Future #6985

Closed errcricket closed 1 year ago

errcricket commented 1 year ago

Is there any plan to make FindAllMarkers and FindConservedMarkers parallelizable with the future R package (it already exists for FindMarkers https://satijalab.org/seurat/articles/future_vignette.html)?

samuel-marsh commented 1 year ago

Hi,

Not member of dev team but hopefully can be helpful. So this already is kind of the case as FindAllMarkers calls FindMarkers internally.

Quick Example:

> tictoc::tic()
> markers <- FindAllMarkers(pbmc)
Calculating cluster Naive CD4 T
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=05s  
Calculating cluster Memory CD4 T
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=03s  
Calculating cluster CD14+ Mono
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=08s  
Calculating cluster B
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=05s  
Calculating cluster CD8 T
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=04s  
Calculating cluster FCGR3A+ Mono
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=08s  
Calculating cluster NK
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=09s  
Calculating cluster DC
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=07s  
Calculating cluster Platelet
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=16s  
> tictoc::toc()
67.942 sec elapsed

> plan("multisession", workers = 4)
> tictoc::tic()
> markers <- FindAllMarkers(pbmc)
Calculating cluster Naive CD4 T
Calculating cluster Memory CD4 T
Calculating cluster CD14+ Mono
Calculating cluster B
Calculating cluster CD8 T
Calculating cluster FCGR3A+ Mono
Calculating cluster NK
Calculating cluster DC
Calculating cluster Platelet
> tictoc::toc()
33.92 sec elapsed

Even on small dataset ~1/2 the time to run.

Were you thinking of different implementation?

Best, Sam

errcricket commented 1 year ago

Brilliant -- thank you Sam!!! Great to know that it works inherently/already. Do you have an info on FindConservedMarkers?

BenjaminDEMAILLE commented 1 year ago

you can use presto. that's is a way more faster

samuel-marsh commented 1 year ago

@errcricket Anything that uses FindMarkers under the hood should benefit. Also will second what @BenjaminDEMAILLE mentioned that if you are just running wilcoxon (default of FindMarkers) then you can use the presto implementation which is very fast. There is a wrapper containing functions RunPresto and RunPrestoAll in the SeuratWrappers package (https://github.com/satijalab/seurat-wrappers).

Best, Sam