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
39c92cf5
Commit
39c92cf5
authored
Sep 22, 2020
by
Marek Ostaszewski
Browse files
Hipathia translation script updated
parent
fb9075a3
Pipeline
#32727
passed with stages
in 36 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Resources/Hipathia/resolve_aliases.R
View file @
39c92cf5
...
...
@@ -10,7 +10,8 @@ library(jsonlite)
### A convenience function to handle API queries
ask_GET
<-
function
(
furl
,
fask
)
{
resp
<-
httr
::
GET
(
url
=
paste0
(
furl
,
fask
),
print
(
URLencode
(
paste0
(
furl
,
fask
)))
resp
<-
httr
::
GET
(
url
=
URLencode
(
paste0
(
furl
,
fask
)),
httr
::
add_headers
(
'Content-Type'
=
"application/x-www-form-urlencoded"
),
### Currently ignoring SSL!
httr
::
set_config
(
config
(
ssl_verifypeer
=
0L
)))
...
...
@@ -21,10 +22,10 @@ ask_GET <- function(furl, fask) {
}
### Define the source file (GitLab, raw link)
diagram
<-
"https://git-r3lab.uni.lu/covid/models/-/raw/master/Curation/
Apoptosis/Apoptosis_03.06.2020
.xml"
diagram
<-
"https://git-r3lab.uni.lu/covid/models/-/raw/master/Curation/
Pyrimidine%20deprivation/Pyrimidine_deprivation_stable
.xml"
### Read in the raw SIF version (here straight from the github of Aurelien)
raw_sif
<-
read.table
(
url
(
"https://
raw.githubusercontent.com/aurelien-naldi/preliminary-
covid
-
model
ing
/master/
covid-models/Apoptosis_03.06.2020
_raw.sif"
),
raw_sif
<-
read.table
(
url
(
"https://
git-r3lab.uni.lu/
covid
/
model
s/-/raw
/master/
Executable%20Modules/SBML_qual_build/sif/Pyrimidine_deprivation_stable
_raw.sif"
),
sep
=
" "
,
header
=
F
,
stringsAsFactors
=
F
)
### Read the list of resources to be integrated, from the MINERVA build scripts
...
...
@@ -83,12 +84,15 @@ group_elements <- function(feid, felements, fentrez) {
### A workaround function to get information about hypothetical complexes;
### currently MINERVA API does not support this, we need to get the entire CD file and parse it
get_groups
<-
function
(
fname
)
{
message
(
paste0
(
"Getting groups for"
,
fname
,
"..."
))
message
(
paste0
(
"Getting groups for
"
,
fname
,
"..."
))
library
(
xml2
)
cd_map
<-
read_xml
(
ask_GET
(
mnv_base
,
paste0
(
"models/"
,
models
$
idObject
[
models
$
name
==
fname
],
":downloadModel?handlerClass=lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser"
)))
### Currently comment out the MINERVA download, some content dlded as binary!
# cd_map <- read_xml(ask_GET(mnv_base,
# paste0("models/",
# models$idObject[models$name == fname],
# ":downloadModel?handlerClass=lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser")))
cd_map
<-
read_xml
(
diagram
)
print
(
cd_map
)
### CellDesigner namespace
ns_cd
<-
xml_ns_rename
(
xml_ns
(
read_xml
(
"<root>
<sbml xmlns = \"http://www.sbml.org/sbml/level2/version4\"/>
...
...
@@ -97,11 +101,13 @@ get_groups <- function(fname) {
d1
=
"sbml"
,
d2
=
"cd"
)
### Get complex ids
cids
<-
xml_attr
(
xml_find_all
(
cd_map
,
"//cd:complexSpeciesAlias"
,
ns_cd
),
"species"
)
print
(
cids
)
### For each check, which is hypothetical
hypocs
<-
sapply
(
xml_attr
(
xml_find_all
(
cd_map
,
"//cd:complexSpeciesAlias"
,
ns_cd
),
"species"
),
function
(
x
)
xml_text
(
xml_find_first
(
xml_find_first
(
cd_map
,
paste0
(
"//sbml:species[@id='"
,
x
,
"']"
),
ns_cd
),
".//cd:hypothetical"
,
ns_cd
)))
hypocs
<-
sapply
(
cids
,
function
(
x
)
{
tcid
<-
xml_find_first
(
cd_map
,
paste0
(
"//sbml:species[@id='"
,
x
,
"']"
),
ns_cd
)
ifelse
(
length
(
tcid
)
>
0
,
xml_text
(
xml_find_first
(
tcid
,
".//cd:hypothetical"
,
ns_cd
)),
NA
)
})
names
(
hypocs
)
<-
gsub
(
"s_id_"
,
""
,
names
(
hypocs
))
return
(
hypocs
)
}
...
...
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