Commit be348161 authored by Marek Ostaszewski's avatar Marek Ostaszewski
Browse files

revision-related updates

parent 9fb1930f
Pipeline #42493 passed with stages
in 41 seconds
......@@ -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),"/")
......
......@@ -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))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment