Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orthology translation does not work: oma_pairwise fails with HTTP 503 #100

Closed
ZZQ-1117 opened this issue Apr 23, 2024 · 8 comments
Closed
Assignees
Labels
bug Something isn't working resource-update Update in a resource broke OmnipathR

Comments

@ZZQ-1117
Copy link

net <- get_progeny(organism = 'mouse', top = 500)

[2024-04-23 21:14:14] [SUCCESS] [OmnipathR] Loaded 700239 annotation records from cache.
Error in usemethod( mutate ) no applicable method for 'mutate' applied to an object of class list

@deeenes deeenes self-assigned this Apr 23, 2024
@deeenes
Copy link
Member

deeenes commented Apr 23, 2024

Hello, Could you please share a full trace (by traceback, or by rlang::last_trace), and also the output of sessionInfo()?

@ZZQ-1117
Copy link
Author

ZZQ-1117 commented Apr 23, 2024 via email

@ZZQ-1117
Copy link
Author

ZZQ-1117 commented Apr 23, 2024

> library(decoupleR)
> library(dplyr)
> library(tibble)
> library(tidyr)
> library(ggplot2)
> library(pheatmap)
> library(ggrepel)
> net <- get_progeny(organism = 'human', top = 500)
[2024-04-24 01:26:29] [SUCCESS] [OmnipathR] Loaded 700239 annotation records from cache.
> net <- get_progeny(organism = 'mouse', top = 500)
[2024-04-24 01:26:46] [SUCCESS] [OmnipathR] Loaded 700239 annotation records from cache.
Error in UseMethod("mutate") : "mutate"没有适用于"list"目标对象的方法
> sessionInfo()
R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default


locale:
[1] LC_COLLATE=Chinese (Simplified)_China.utf8  LC_CTYPE=Chinese (Simplified)_China.utf8   
[3] LC_MONETARY=Chinese (Simplified)_China.utf8 LC_NUMERIC=C                               
[5] LC_TIME=Chinese (Simplified)_China.utf8    

time zone: Asia/Shanghai
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggrepel_0.9.5   pheatmap_1.0.12 ggplot2_3.5.0   tidyr_1.3.1     tibble_3.2.1   
[6] dplyr_1.1.4     decoupleR_2.9.7

loaded via a namespace (and not attached):
  [1] logger_0.3.0            readxl_1.4.3            rlang_1.1.3            
  [4] magrittr_2.0.3          compiler_4.3.1          systemfonts_1.0.5      
  [7] vctrs_0.6.5             devEMF_4.4-2            rvest_1.0.4            
 [10] stringr_1.5.1           httpcode_0.3.0          pkgconfig_2.0.3        
 [13] crayon_1.5.2            fastmap_1.1.1           backports_1.4.1        
 [16] ellipsis_0.3.2          utf8_1.2.4              promises_1.2.1         
 [19] rmarkdown_2.26          tzdb_0.4.0              ragg_1.2.7             
 [22] bit_4.0.5               purrr_1.0.2             xfun_0.43              
 [25] jsonlite_1.8.8          progress_1.2.3          later_1.3.2            
 [28] uuid_1.2-0              BiocParallel_1.34.2     tweenr_2.0.2           
 [31] broom_1.0.5             parallel_4.3.1          prettyunits_1.2.0      
 [34] R6_2.5.1                stringi_1.8.3           RColorBrewer_1.1-3     
 [37] parallelly_1.37.0       lubridate_1.9.3         cellranger_1.1.0       
 [40] Rcpp_1.0.12             knitr_1.46              base64enc_0.1-3        
 [43] readr_2.1.5             httpuv_1.6.14           Matrix_1.6-5           
 [46] igraph_2.0.3            timechange_0.3.0        tidyselect_1.2.1       
 [49] rstudioapi_0.15.0       yaml_2.3.8              codetools_0.2-19       
 [52] curl_5.2.0              lattice_0.22-5          shiny_1.8.0            
 [55] withr_3.0.0             flextable_0.9.4         askpass_1.2.0          
 [58] evaluate_0.23           polyclip_1.10-6         zip_2.3.1              
 [61] stargazer_5.2.3         xml2_1.3.6              pillar_1.9.0           
 [64] checkmate_2.3.1         generics_0.1.3          vroom_1.6.5            
 [67] hms_1.1.3               munsell_0.5.1           scales_1.3.0           
 [70] xtable_1.8-4            OmnipathR_3.10.1        glue_1.7.0             
 [73] gdtools_0.3.6           tools_4.3.1             gfonts_0.2.0           
 [76] data.table_1.15.0       openxlsx_4.2.5.2        rgl_1.2.8              
 [79] cowplot_1.1.3           grid_4.3.1              colorspace_2.1-0       
 [82] export_0.3.0            ggforce_0.4.2           cli_3.6.2              
 [85] rappdirs_0.3.3          rvg_0.3.3               textshaping_0.3.7      
 [88] officer_0.6.5           fontBitstreamVera_0.1.1 fansi_1.0.6            
 [91] gtable_0.3.4            selectr_0.4-2           digest_0.6.34          
 [94] fontquiver_0.2.1        crul_1.4.0              htmlwidgets_1.6.4      
 [97] farver_2.1.1            htmltools_0.5.7         lifecycle_1.0.4        
[100] httr_1.4.7              mime_0.12               bit64_4.0.5            
[103] fontLiberation_0.1.0    openssl_2.1.1           MASS_7.3-60.0.1   



> traceback
function (x = NULL, max.lines = getOption("traceback.max.lines", 
    getOption("deparse.max.lines", -1L))) 
{
    n <- length(x <- .traceback(x, max.lines = max.lines))
    if (n == 0L) 
        cat(gettext("No traceback available"), "\n")
    else {
        for (i in 1L:n) {
            xi <- x[[i]]
            label <- paste0(n - i + 1L, ": ")
            m <- length(xi)
            srcloc <- if (!is.null(srcref <- attr(xi, "srcref"))) {
                srcfile <- attr(srcref, "srcfile")
                paste0(" at ", basename(srcfile$filename), "#", 
                  srcref[1L])
            }
            if (isTRUE(attr(xi, "truncated"))) {
                xi <- c(xi, " ...")
                m <- length(xi)
            }
            if (!is.null(srcloc)) {
                xi[m] <- paste0(xi[m], srcloc)
            }
            if (m > 1) 
                label <- c(label, rep(substr("          ", 1L, 
                  nchar(label, type = "w")), m - 1L))
            cat(paste0(label, xi), sep = "\n")
        }
    }
    invisible(x)
}
<bytecode: 0x0000024a8f63f2a8>
<environment: namespace:base> 

@ZZQ-1117
Copy link
Author

"human" can run successfully, but "mouse" will error

Thank you

@deeenes
Copy link
Member

deeenes commented Apr 23, 2024

Thanks! Above you pasted the code of the traceback function, you have to call it: traceback(). Also, before checking again, I'd recommend to update OmnipathR from git:

remotes::install_github('saezlab/OmnipathR')

@ZZQ-1117
Copy link
Author

ZZQ-1117 commented Apr 23, 2024

I am so sorry, I have updated "OmnipathR" according to your suggestion. Unfortunately, it shows the same error.

> traceback()
29: mutate(., across(starts_with("id_organism"), ~str_extract(.x, 
        "([^_]*)")))
28: filter(., !str_detect(id_organism_a, sprintf("%s\\d+", organism_a)) & 
        !str_detect(id_organism_b, sprintf("%s\\d+", organism_b)) & 
        mapping %in% mappings)
27: "oma_pairwise" %>% generic_downloader(reader_param = list(col_names = c("id_organism_a", 
        "id_organism_b", "mapping", "oma_group"), col_types = cols(), 
        comment = "#"), url_param = list(organism_a, organism_b, 
        id_type)) %>% mutate(across(starts_with("id_organism"), ~str_extract(.x, 
        "([^_]*)"))) %>% filter(!str_detect(id_organism_a, sprintf("%s\\d+", 
        organism_a)) & !str_detect(id_organism_b, sprintf("%s\\d+", 
        organism_b)) & mapping %in% mappings) %>% {
        if (only_ids) 
            select(., id_organism_a, id_organism_b)
        else .
    }
26: (function (organism_a = "human", organism_b = "mouse", id_type = "uniprot", 
        mappings = c("1:1", "1:m", "n:1", "n:m"), only_ids = TRUE) 
    {
        .slow_doctest()
        if (id_type == "genesymbol") {
            id_type <- "uniprot"
            return(environment() %>% as.list %>% exec(oma_pairwise_genesymbols, 
                !!!.))
        }
        id_organism_a <- id_organism_b <- mapping <- NULL
        organism_a %<>% oma_code
        organism_b %<>% oma_code
        id_type %<>% oma_id_type
        args <- match.call() %>% as.list %>% tail(-1L)
        for (arg in names(args)) {
            if (is.null(get(arg)) || any(is.na(get(arg)))) {
                msg <- sprintf("Could not recognize %s: `%s`.", if (arg == 
                    "id_type") 
                    "ID type"
                else "organism", args[[arg]])
     ...
25: exec(loader, !!!param)
24: load_db(key, param = param)
23: get_db(db_name, param = orthology_param)
22: select(., -any_of("hgroup"))
21: set_names(., c(ORTHO_SOURCE_COL, ORTHO_TARGET_COL))
20: get_db(db_name, param = orthology_param) %>% select(-any_of("hgroup")) %>% 
        set_names(c(ORTHO_SOURCE_COL, ORTHO_TARGET_COL)) %>% {
        if (translate_complexes) 
            bind_rows(., complex_orthology(orthology = ., identifiers = data %>% 
                pull(!!sym(column)), one_to_many = translate_complexes))
        else .
    }
19: OmnipathR::orthology_translate_column(., "uniprot", target_organism = organism, 
        replace = TRUE)
18: OmnipathR::translate_ids(., uniprot, genesymbol, organism = organism)
17: OmnipathR::orthology_translate_column(., "uniprot", target_organism = organism, 
        replace = TRUE) %>% OmnipathR::translate_ids(., uniprot, 
        genesymbol, organism = organism)
16: tryCatch(OmnipathR::import_omnipath_annotations(resources = name, 
        ..., wide = TRUE), error = function(e) {
        tryCatch(OmnipathR::static_table(query = "annotations", resource = name, 
            organism = organism), error = function(e) {
            msg <- sprintf(paste0("[decoupleR] Failed to download annotation resource `%s` ", 
                "from OmniPath. For more information, see the OmnipathR log."), 
                name)
            OmnipathR::omnipath_msg("error", msg)
            stop(msg)
        })
    }) %>% {
        if (organism != 9606L) 
            OmnipathR::orthology_translate_column(., "uniprot", target_organism = organism, 
                replace = TRUE) %>% OmnipathR::translate_ids(., uniprot, 
                genesymbol, organism = organism)
        else .
    }
15: get_resource("PROGENy", organism = organism)
14: dplyr::distinct(., pathway, genesymbol, .keep_all = TRUE)
13: dplyr::mutate(., weight = as.double(weight), p_value = as.double(p_value))
12: dplyr::select(., genesymbol, p_value, pathway, weight)
11: dplyr::group_by(., pathway)
10: dplyr::group_split(.)
9: vctrs_vec_compat(.x, .purrr_user_env)
8: map_("list", .x, .f, ..., .progress = .progress)
7: purrr::map(., function(df) {
       df %>% dplyr::arrange(p_value) %>% head(top)
   })
6: list2(...)
5: dplyr::bind_rows(.)
4: dplyr::select(., pathway, genesymbol, weight, p_value)
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) %>% 
       dplyr::group_split() %>% purrr::map(function(df) {
       df %>% dplyr::arrange(p_value) %>% head(top)
   }) %>% dplyr::bind_rows() %>% dplyr::select(pathway, genesymbol, 
       weight, p_value) %>% rlang::set_names(c("source", "target", 
       "weight", "p_value"))
1: get_progeny(organism = "mouse", top = 500)

@deeenes deeenes transferred this issue from saezlab/decoupleR Apr 23, 2024
@deeenes deeenes changed the title Error in usemethod( mutate ) Orthology translation does not work: oma_pairwise fails with HTTP 503 Apr 23, 2024
@deeenes deeenes added bug Something isn't working resource-update Update in a resource broke OmnipathR labels Apr 23, 2024
@deeenes
Copy link
Member

deeenes commented Apr 23, 2024

Thanks for the traceback, I found that OMA, the resource that we use for gene orthology data, has updated its HTTP API very recently. Hence I have to do some updates in OmnipathR, adjusting it to the new API. I'll do this most likely tomorrow, and let you know here once ready. Thank you for reporting this issue!

@deeenes deeenes pinned this issue Apr 23, 2024
@deeenes
Copy link
Member

deeenes commented Apr 24, 2024

Hello, I've done the updates required by the new OMA API. If you update OmnipathR from github, I expect it should work:

remotes::install_github('saezlab/OmnipathR')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resource-update Update in a resource broke OmnipathR
Projects
None yet
Development

No branches or pull requests

2 participants