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
193 stars 24 forks source link

Error in `rlang::set_names()` get_progeny mouse #135

Closed bioshot-dotcom closed 2 weeks ago

bioshot-dotcom commented 3 months ago

Hello!

I was following this tutorial (https://saezlab.github.io/decoupleR/articles/pw_bk.html) for pathway activity inference. I have mouse data, so I tried: net <- get_progeny(organism = 'mouse', top = 100)

but I got this:

> [2024-08-06 17:16:45] [SUCCESS] [OmnipathR] Loaded 700239 annotation records from cache.
> [2024-08-06 17:16:47] [SUCCESS] [OmnipathR] UniProt (rest.uniprot.org): loaded 17217 records from cache
> Error in `rlang::set_names()`:
> ! The size of `nm` (4) must be compatible with the size of `x` (0).
> Backtrace:
>  1. decoupleR::get_progeny(organism = "mouse", top = 100)
>  4. rlang::abort(message = message)
>  
> Error in rlang::set_names(., c("source", "target", "weight", "p_value")) :
> 6. stop(fallback)
> 5. signal_abort(cnd, .file)
> 4. abort(message = message)
> 3. rlang::set_names(., c("source", "target", "weight", "p_value"))
> 2. get_resource("PROGENy", organism = organism) %>% dplyr::distinct(pathway,
>     genesymbol, .keep_all = TRUE) %>% dplyr::mutate(weight = as.double(weight),
>     p_value = as.double(p_value)) %>% dplyr::select(genesymbol,
>     p_value, pathway, weight) %>% dplyr::group_by(pathway) %>% ...
> 1. get_progeny(organism = "mouse", top = 100)

R version: 4.4.1 decoupleR: 2.10.0 OmnipathR: 3.11.10 dplyr: 1.1.4 tibble: 3.2.1 tidyr: 1.3.1

deeenes commented 3 months ago

Hello, This error suggests that after the translation to mouse by orthologous gene pairs, zero rows remained in the data frame. One reason might be a corrupt cache item left behind after a failed download. To test this, I recommend to try with an empty cache:

library(OmnipathR)
library(decoupleR)

omnipath_set_console_loglevel('trace')
omnipath_set_cachedir(tempdir())

pr <- get_progeny(organism = 'mouse')
bioshot-dotcom commented 3 months ago

I tried but I keep getting the same error, instead I solved with this:

net = as.tibble(progeny::model_mouse_full)
net <- net %>%
  mutate(target = as.character(gene),
         source = as.character(pathway)) %>%
  select(-gene, -pathway)