From 695d2987e10c5fe5664c545ccc0ea34fbf54c13d Mon Sep 17 00:00:00 2001 From: Elena Krismer <70535771+elena-krismer@users.noreply.github.com> Date: Fri, 3 Nov 2023 10:26:16 +0100 Subject: [PATCH] #217 fix joining dataframes - pathway id --- R/fetch_kegg.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/R/fetch_kegg.R b/R/fetch_kegg.R index 4f2c94a4..5657f91f 100644 --- a/R/fetch_kegg.R +++ b/R/fetch_kegg.R @@ -34,6 +34,10 @@ fetch_kegg <- function(species) { return(invisible(NULL)) } colnames(result_link) <- c("kegg_id", "pathway_id") + # remove path: from pathway_id + result_link <- result_link %>% + dplyr::mutate(pathway_id = stringr::str_replace(pathway_id, "^path:", "")) + # download pathway_id names url_name <- paste("https://rest.kegg.jp/list/pathway", species, sep = "/") result_name <- try_query(url_name, col_names = FALSE, progress = FALSE, show_col_types = FALSE) @@ -56,7 +60,7 @@ fetch_kegg <- function(species) { ) # combine datasets result <- result_link %>% - dplyr::left_join(result_name, by = "pathway_id") %>% - dplyr::left_join(result_conv, by = "kegg_id") + dplyr::left_join(result_name, by = "pathway_id", relationship = "many-to-many") %>% + dplyr::left_join(result_conv, by = "kegg_id", relationship = "many-to-many") result }