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
1dd5f8a6
Commit
1dd5f8a6
authored
Sep 22, 2020
by
Marek Ostaszewski
Browse files
Merge branch 'repo_update' into 'master'
Hipathia translation script updated, zip handled See merge request
!244
parents
87df75a5
d9c82e40
Changes
1
Hide whitespace changes
Inline
Side-by-side
Resources/Hipathia/resolve_aliases.R
View file @
1dd5f8a6
...
...
@@ -11,21 +11,32 @@ library(jsonlite)
### A convenience function to handle API queries
ask_GET
<-
function
(
furl
,
fask
)
{
print
(
URLencode
(
paste0
(
furl
,
fask
)))
resp
<-
httr
::
GET
(
url
=
URLencode
(
paste0
(
furl
,
fask
)),
resp
<-
httr
::
GET
(
url
=
URLencode
(
paste0
(
furl
,
fask
)),
write_memory
(),
httr
::
add_headers
(
'Content-Type'
=
"application/x-www-form-urlencoded"
),
### Currently ignoring SSL!
httr
::
set_config
(
config
(
ssl_verifypeer
=
0L
)))
if
(
httr
::
status_code
(
resp
)
==
200
)
{
### when the content is sent as a zip file, it needs to be handled differently,
### i.e. saved to a tmp file and unzipped
if
(
headers
(
resp
)
$
`content-type`
==
"application/zip"
)
{
tmp
<-
tempfile
()
tmpc
<-
file
(
tmp
,
"wb"
)
writeBin
(
httr
::
content
(
resp
,
as
=
"raw"
),
con
=
tmpc
)
close
(
tmpc
)
unzipped
<-
unzip
(
tmp
)
file.remove
(
tmp
)
return
(
unzipped
)
}
return
(
httr
::
content
(
resp
,
as
=
"text"
))
}
return
(
NULL
)
}
### Define the source file (GitLab, raw link)
diagram
<-
"https://git-r3lab.uni.lu/covid/models/-/raw/master/Curation/
Pyrimidine%20deprivation/Pyrimidine_deprivation
_stable.xml"
diagram
<-
"https://git-r3lab.uni.lu/covid/models/-/raw/master/Curation/
ER%20Stress/ER_Stress
_stable.xml"
### Read in the raw SIF version (here straight from the github of Aurelien)
raw_sif
<-
read.table
(
url
(
"https://git-r3lab.uni.lu/covid/models/-/raw/master/Executable%20Modules/SBML_qual_build/sif/
Pyrimidine_deprivation
_stable_raw.sif"
),
raw_sif
<-
read.table
(
url
(
"https://git-r3lab.uni.lu/covid/models/-/raw/master/Executable%20Modules/SBML_qual_build/sif/
ER_Stress
_stable_raw.sif"
),
sep
=
" "
,
header
=
F
,
stringsAsFactors
=
F
)
### Read the list of resources to be integrated, from the MINERVA build scripts
...
...
@@ -86,13 +97,11 @@ group_elements <- function(feid, felements, fentrez) {
get_groups
<-
function
(
fname
)
{
message
(
paste0
(
"Getting groups for "
,
fname
,
"..."
))
library
(
xml2
)
### 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
)
## 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"
)))
### CellDesigner namespace
ns_cd
<-
xml_ns_rename
(
xml_ns
(
read_xml
(
"<root>
<sbml xmlns = \"http://www.sbml.org/sbml/level2/version4\"/>
...
...
@@ -101,7 +110,6 @@ 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
(
cids
,
function
(
x
)
{
...
...
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