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

small update

parent 216912a9
Pipeline #39215 passed with stages
in 1 minute and 4 seconds
......@@ -13,27 +13,33 @@ source("https://git-r3lab.uni.lu/covid/models/-/raw/master/Integration/MINERVA_a
### The address of the COVID-19 Disease Map in MINERVA
map <- "https://covid19map.elixir-luxembourg.org/minerva/api/"
components <- get_map_components(map)
components <- get_map_components(map, project_id = "covid19_map_11Mar21")
### You may want to save components to JSON if you want to explore the structure of MINERVA's output
get_annotations <- function(model_elements, annotation_type) {
### For erroneous response, skip to next diagram
if(is.null(model_elements)) { return(NULL) }
### Only elements that have annotations
these_refs <- model_elements$references[sapply(model_elements$references, length) > 0]
### For empty list, skip to next diagram
if(length(these_refs) == 0) { return(NULL) }
### Get all identifiers, for elements that have the requested annotation
identifiers <- sapply(these_refs,
function(x) x[x$type == annotation_type, "resource"])
identifiers <- identifiers[sapply(identifiers,
function(x) ifelse(is.character(x) & length(x) > 0, TRUE, FALSE))]
return(identifiers)
# get_annotations <- function(model_elements, annotation_type) {
# ### For erroneous response, skip to next diagram
# if(is.null(model_elements)) { return(NULL) }
# ### Only elements that have annotations
# these_refs <- model_elements$references[sapply(model_elements$references, length) > 0]
# ### For empty list, skip to next diagram
# if(length(these_refs) == 0) { return(NULL) }
#
# ### Get all identifiers, for elements that have the requested annotation
# identifiers <- sapply(these_refs,
# function(x) x[x$type == annotation_type, "resource"])
# identifiers <- identifiers[sapply(identifiers,
# function(x) ifelse(is.character(x) & length(x) > 0, TRUE, FALSE))]
# return(identifiers)
# }
get_annotation <- function(references, selected_type) {
if(length(references) == 0) { return(NA) }
with(data.frame(references), resource[type == selected_type])
}
### Get all HGNC symbols
all_hgncs <- sapply(components$map_elements, get_annotations, "HGNC_SYMBOL")
all_hgncs <- lapply(components$map_elements,
function(x) lapply(x$references, get_annotation, "HGNC_SYMBOL"))
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