Skip to content

Replace glasso with glassoFast#107

Open
mikemartinez99 wants to merge 3 commits into
cole-trapnell-lab:masterfrom
mikemartinez99:master
Open

Replace glasso with glassoFast#107
mikemartinez99 wants to merge 3 commits into
cole-trapnell-lab:masterfrom
mikemartinez99:master

Conversation

@mikemartinez99

Copy link
Copy Markdown

Since graphical lasso does not support multithreading safely as mentioned in #70 , I replaced instances of glasso with glassoFast for some moderate speed increases. While the difference is not too extreme, it did shave ~1 hour off my connection calculation time.

In run_cicero.R, I added a wrapper function called cicero_glasso_fast that takes as input a covariate matrix, rho matrix and a threshold (ridge term) value. All arguments are synonymous to the original glasso function.

cicero_glasso_fast <- function(cov_mat, rho_mat, thr = 1e-4) {
  out <- glassoFast::glassoFast(cov_mat,
                                rho_mat,
                                thr = thr)   # keep quiet

  # Convert the output list to the naming convention that Cicero expects.
  #   out$Theta  -> w
  #   out$W      -> wi
  list(w  = out$w,
       wi = out$wi)
}

Then, functions that originally called glasso instead call the wrapper function:
Functions where glasso was replaced:

find_distance_parameter and generate_cicero_models

mikemartinez99 and others added 3 commits January 10, 2026 10:46
- Added the `cicero_glasso_fast` wrapper function to call `glassoFast` as such:

```
out <- glassoFast::glassoFast(cov_mat,
                                rho_mat,
                                thr = thr)
```
This wrapper is then called in `generate_cicero_models` and `find_distance_parameter` to increase speed of calculation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant