welch-lab / liger

R package for integrating and analyzing multiple single-cell datasets
GNU General Public License v3.0
380 stars 78 forks source link

Add option for Leiden algorithm #274

Closed samuel-marsh closed 5 months ago

samuel-marsh commented 1 year ago

Hi LIGER team,

It seems at glance that louvain cluster function utilizes some of the cpp backend from Seurat to run clustering but defaults the algorithm option in the call to RunModularityClusteringCpp to only run louvain. It would seem (perhaps naively…?) that it would be easy either rename function and allow for choice of louvain vs Leiden or to prevent confusion with changing a function name to just add another function (e.g., LeidenCluster) which defaults the algorithm to Leiden.

Would this be possible?

Best, Sam

theAeon commented 1 year ago

I could be wrong, as I'm not the most familiar with the Seurat backend, but it looks as if the Leiden backend on Seurat's side of things is calling the R leiden package rather than using the cpp codepath that contains the louvain implementation. We haven't vendored their Clustering.R-the file that calls in to the clustering algorithms-in favor of calling into their Rcpp bindings. It shouldn't be too hard to hack it in, but it might be a bit more difficult to do so in a way that doesn't duplicate code. Thoughts, @jsodicoff?