diff --git a/Integration/MINERVA_access/get_drug_targets.R b/Integration/MINERVA_access/get_drug_targets.R index d5b1881ddd7288e61e44983e6bbed61f56c9c1a8..cff64b8164a572d09a1d7d82cfb089e3a91a3804 100644 --- a/Integration/MINERVA_access/get_drug_targets.R +++ b/Integration/MINERVA_access/get_drug_targets.R @@ -12,11 +12,17 @@ source("https://git-r3lab.uni.lu/covid/models/-/raw/master/Integration/MINERVA_a map <- "https://covid19map.elixir-luxembourg.org/minerva/api/" ### Get the components of MINERVA and WikiPathways (see minerva_access.R) map_components <- get_map_components(map) - message("Retrieving MINERVA Uniprot collection") -refs <- lapply(map_components$map_elements, function(x) data.frame(id = x$id, - uniprot = get_annotation(x$references, "UNIPROT"))) -names(refs) <- map_components$models$name +refs <- get_components_annotations(map_components, "UNIPROT") + +### Create a compact list of element ids and their UNIPROT annotations +ids <- lapply(map_components$map_elements, function(x) x$id ) +idrefs <- list() +for(i in 1:length(ids)) { + flatrefs <- sapply(refs[[i]], function(x) ifelse(length(x) == 0, NA, x[1])) + idrefs[[length(idrefs)+1]] <- data.frame(id = ids[[i]][!is.na(flatrefs)], uniprot = flatrefs[!is.na(flatrefs)]) +} +names(idrefs) <- map_components$models$name ### A helper function to retrieve one (first) element alias for all unique UniProts. ### The drug search API call is based on the alias of an element in the MINERVA project, @@ -30,7 +36,7 @@ unique_drugs <- function(funiprot_references) { } ### Get the UniProt-alias mappings using the helper function -upd <- sapply(refs, unique_drugs) +upd <- sapply(idrefs, unique_drugs) ### Get the id of the default project map_project <- paste0(map,"projects/",get_default_project(map),"/") diff --git a/Integration/MINERVA_access/minerva_access_functions.R b/Integration/MINERVA_access/minerva_access_functions.R index 8f195fe2ca32721aadbb7395d5645a1e4da27076..1d21ea3ae1ccc9370eb4582f45bec232696ce7b2 100644 --- a/Integration/MINERVA_access/minerva_access_functions.R +++ b/Integration/MINERVA_access/minerva_access_functions.R @@ -67,7 +67,7 @@ get_map_components <- function(map_api, project_id = NULL, ### Request for reactions that have at least one top 10 element as participant model_reactions <- lapply(models$idObject, function(x) - fromJSON(ask_GET(paste0(mnv_base,"models/",x,"/","bioEntities/elements/",r_columns)), + fromJSON(ask_GET(paste0(mnv_base,"models/",x,"/","bioEntities/reactions/",r_columns)), flatten = F)) ### Pack all into a list and return return(list(models = models, map_elements = model_elements, map_reactions = model_reactions)) diff --git a/Resources/Crosstalks/C19DM_crosstalks_focused.cys b/Resources/Crosstalks/C19DM_crosstalks_focused.cys index 62d18dae63157d79ae3777b0acbc761ca2bc0f72..71efbd125dc581152ccd9699838aa0c0790f8249 100644 Binary files a/Resources/Crosstalks/C19DM_crosstalks_focused.cys and b/Resources/Crosstalks/C19DM_crosstalks_focused.cys differ