saezlab / decoupleR

R package to infer biological activities from omics data using a collection of methods.
https://saezlab.github.io/decoupleR/
GNU General Public License v3.0
190 stars 24 forks source link

Error in `map2()` #97

Closed noranekonobokkusu closed 11 months ago

noranekonobokkusu commented 12 months ago

Hi,

I am getting a weird error when I'm trying to run decouple on my data after some time computing:

res_decouple <- decouple(mat, 
+                          net, 
+                          .source='source', 
+                          .target='target',
+                          minsize = 0)
Error in `map2()`:
ℹ In index: 1.
Caused by error in `.data$mor`:
! Column `mor` not found in `.data`.
Run `rlang::last_trace()` to see where the error occurred.
Warning message:
In doTryCatch(return(expr), name, parentenv, handler) :
  cannot pop the top-level viewport ('grid' and 'graphics' output mixed?)
> rlang::last_trace()

Error in `map2()`:
ℹ In index: 1.
Caused by error in `.data$mor`:
! Column `mor` not found in `.data`.
---
Backtrace:
     ▆
  1. ├─decoupleR::decouple(...)
  2. │ ├─... %>% mutate(run_id = as.numeric(.data$run_id))
  3. │ └─purrr::map2_dfr(...)
  4. │   └─purrr::map2(.x, .y, .f, ...)
  5. │     └─purrr:::map2_("list", .x, .y, .f, ..., .progress = .progress)
  6. │       ├─purrr:::with_indexed_errors(...)
  7. │       │ └─base::withCallingHandlers(...)
  8. │       ├─purrr:::call_with_cleanup(...)
  9. │       └─decoupleR (local) .f(.x[[i]], .y[[i]], ...)
 10. │         ├─base::eval(.call)
 11. │         │ └─base::eval(.call)
 12. │         └─decoupleR::run_mlm(...)
 13. │           └─network %>% ...
 14. ├─dplyr::mutate(., run_id = as.numeric(.data$run_id))
 15. ├─dplyr::select(...)
 16. ├─decoupleR::rename_net(...)
 17. │ └─network %>% ...
 18. ├─decoupleR::convert_f_defaults(...)
 19. │ └─tidyselect::eval_rename(.expr, data = .data)
 20. │   └─tidyselect:::rename_impl(...)
 21. │     └─tidyselect:::eval_select_impl(...)
 22. │       ├─tidyselect:::with_subscript_errors(...)
 23. │       │ └─rlang::try_fetch(...)
 24. │       │   └─base::withCallingHandlers(...)
 25. │       └─tidyselect:::vars_select_eval(...)
 26. │         └─tidyselect:::walk_data_tree(expr, data_mask, context_mask)
 27. │           └─tidyselect:::eval_c(expr, data_mask, context_mask)
 28. │             └─tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
 29. │               └─tidyselect:::walk_data_tree(new, data_mask, context_mask)
 30. │                 └─tidyselect:::eval_c(expr, data_mask, context_mask)
 31. │                   └─tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
 32. │                     └─tidyselect:::walk_data_tree(new, data_mask, context_mask)
 33. │                       └─base::eval(expr, data_mask)
 34. │                         └─base::eval(expr, data_mask)
 35. │                           ├─mor
 36. │                           └─rlang:::`$.rlang_data_pronoun`(.data, mor)
 37. │                             └─rlang:::data_pronoun_get(...)
 38. └─rlang:::abort_data_pronoun(x, call = y)

I am at lost where is it coming from, mat and net look like proper objects. My original Seurar object is huge, so I tried downsampling it to 1000 cells and now it crashes almost instantly. Do you have any clues where is it coming from?

UPD. I've also checked that run_mlm does work on a small 1000-cells dataset without errors.

Thanks!

deeenes commented 12 months ago

Hi,

mor stands for mode of regulation, a value that should be positive for activation and negative for inhibition. See the .mor parameter here. It's supposed to be a column in net, just like in the data frames returned by get_collectri or get_dorothea. If you use a different column name, pass it by the .mor parameter. If you don't have such information, maybe best to consider all relations positive and provide a column filled with 1's.

noranekonobokkusu commented 11 months ago

Got it, thank you!