Commit a3acfe93 authored by cylon-x's avatar cylon-x 🤖

Merge branch 'repo_update' of https://git-r3lab.uni.lu/covid/models into repo_update

parents 303a75c0 d5ae43b3
Pipeline #37218 passed with stages
in 2 minutes and 9 seconds
This diff is collapsed.
{
"Virus replication cycle": [
"WP4846",
"WP4799",
"Virus replication cycle",
"Nsp9 protein interactions",
"SARS-CoV-2 RTC and transcription",
"Nsp4 and Nsp6 protein interactions",
"E protein interactions",
"Orf3a protein interactions",
"R-HSA-9678110",
"R-HSA-9679504",
"R-HSA-9694514",
"R-HSA-9683701",
"R-HSA-9679509",
"R-HSA-9694614",
"R-HSA-9694676",
"R-HSA-9694682",
"R-HSA-9694635",
"R-HSA-9694322"
],
"ER stress and unfolded protein response": [
"WP4861",
"WP5027",
"Endoplasmatic Reticulum stress",
"Orf10 Cul2 pathway"
],
"Autophagy and protein degradation": [
"WP4860",
"WP4936",
"WP4863",
"Endoplasmatic Reticulum stress"
],
"Apoptosis pathway": [
"WP4864",
"WP4877",
"WP5038",
"Apoptosis pathway",
"JNK pathway",
"Electron Transport Chain disruption"
],
"Renin-angiotensin system": [
"WP4883",
"WP4965",
"WP4969",
"Renin-angiotensin pathway"
],
"Coagulopathy pathway": [
"WP4927",
"Coagulation pathway"
],
"PAMP signalling": [
"WP4912",
"PAMP signalling"
],
"Induction of interferons and the cytokine storm": [
"WP4868",
"WP4880",
"WP4876",
"WP4884",
"WP4961",
"WP5039",
"Interferon 1 pathway",
"Interferon lambda pathway",
"TGFbeta signalling",
"NLRP3 inflammasome activation"
],
"Altered host metabolism": [
"WP4853",
"WP4904",
"Kynurenine synthesis pathway",
"HMOX1 pathway",
"Nsp14 and metabolism",
"Pyrimidine deprivation"
],
"Other diagrams": [
"WP4891",
"WP5017",
"overview"
]
}
##################################################
## Project: COVID-19 Disease Map
## Script purpose: Convenience functions for accessing the MINERVA Platform
## Date: 24.12.2020
## Author: Marek Ostaszewski
##################################################
library(httr)
library(jsonlite)
### A convenience function to handle API queries
ask_GET <- function(fask_url, verbose = F) {
if(verbose) {
message(URLencode(fask_url))
}
resp <- httr::GET(url = URLencode(fask_url),
httr::add_headers('Content-Type' = "application/x-www-form-urlencoded"))
if(httr::status_code(resp) == 200) {
return(httr::content(resp, as = "text"))
}
return(NULL)
}
### Get the components of a given map/project on the MINERVA Platform
get_map_components <- function(map_api, project_id = NULL) {
if(is.null(project_id)) {
### If project id not given, get configuration of the map, to obtain the latest (default) version
cfg <- fromJSON(ask_GET(paste0(map_api, "configuration/")))
project_id <- cfg$options[cfg$options$type == "DEFAULT_MAP","value"]
}
### The address of the latest (default) build
mnv_base <- paste0(map_api, "projects/",project_id,"/")
message(paste0("Asking for diagrams in: ", mnv_base, "models/"))
### Get diagrams
models <- fromJSON(ask_GET(paste0(mnv_base, "models/")))
### Get elements of the chosen diagram
model_elements <- lapply(models$idObject,
function(x)
fromJSON(ask_GET(paste0(mnv_base,"models/",x,"/",
"bioEntities/elements/?columns=id,name,type,references,elementId,complexId")),
flatten = F))
### 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/reactions/?columns=modifiers,products,reactants")),
flatten = F))
### Pack all into a list and return
return(list(models = models, map_elements = model_elements, map_reactions = model_reactions))
}
### Get annotation of a given type, from element/reaction references
get_annotation <- function(freferences, ftype) {
sapply(freferences,
function(x) {
ifelse(any(x$type == ftype), x$resource[x$type == ftype], NA)
})
}
\ No newline at end of file
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