Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
COVID-19
models
Commits
f239e6df
Commit
f239e6df
authored
Apr 01, 2021
by
Marek Ostaszewski
Browse files
small update
parent
216912a9
Pipeline
#39215
passed with stages
in 1 minute and 4 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Integration/MINERVA_access/get_identifiers.R
View file @
f239e6df
...
...
@@ -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"
))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment