Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
models
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
COVID-19
models
Commits
666c7334
Commit
666c7334
authored
4 years ago
by
Marek Ostaszewski
Browse files
Options
Downloads
Patches
Plain Diff
Code updates
parent
a1c4489b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!187
Repo update
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Integration/MINERVA_build/combine_sources.R
+14
-7
14 additions, 7 deletions
Integration/MINERVA_build/combine_sources.R
Resources/Hipathia/resolve_aliases.R
+42
-5
42 additions, 5 deletions
Resources/Hipathia/resolve_aliases.R
with
56 additions
and
12 deletions
Integration/MINERVA_build/combine_sources.R
+
14
−
7
View file @
666c7334
...
...
@@ -93,15 +93,22 @@ construct_overview <- function(elements) {
### Resource: url to the xml content of the diagram
### Type: what kind of file do we integrate
### Name: under which name the diaram is to be shown in the build
# res <- read.csv(url("https://git-r3lab.uni.lu/covid/models/raw/master/Integration/MINERVA_build/resources.csv"),
# header = T, stringsAsFactors = F)
wps
<-
readLines
(
"https://raw.githubusercontent.com/wikipathways/SARS-CoV-2-WikiPathways/master/pathways.txt"
)
regular_build
=
T
if
(
regular_build
)
{
### Regular build
res
<-
read.csv
(
url
(
"https://git-r3lab.uni.lu/covid/models/raw/master/Integration/MINERVA_build/resources.csv"
),
header
=
T
,
stringsAsFactors
=
F
)
}
else
{
### WikiPathways testbuild
wps
<-
readLines
(
"https://raw.githubusercontent.com/wikipathways/SARS-CoV-2-WikiPathways/master/pathways.txt"
)
res
<-
data.frame
(
Include
=
"Yes"
,
Resource
=
paste0
(
"https://raw.githubusercontent.com/wikipathways/SARS-CoV-2-WikiPathways/master/gpml/"
,
wps
,
".gpml"
),
Type
=
"GPML"
,
Name
=
wps
)
}
res
<-
data.frame
(
Include
=
"Yes"
,
Resource
=
paste0
(
"https://raw.githubusercontent.com/wikipathways/SARS-CoV-2-WikiPathways/master/gpml/"
,
wps
,
".gpml"
),
Type
=
"GPML"
,
Name
=
wps
)
### Filter only these to be included
res
<-
res
[
res
$
Include
==
"Yes"
,]
...
...
This diff is collapsed.
Click to expand it.
Resources/Hipathia/resolve_aliases.R
+
42
−
5
View file @
666c7334
...
...
@@ -80,20 +80,57 @@ 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
,
"..."
))
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"
)))
### CellDesigner namespace
ns_cd
<-
xml_ns_rename
(
xml_ns
(
read_xml
(
"<root>
<sbml xmlns = \"http://www.sbml.org/sbml/level2/version4\"/>
<cd xmlns = \"http://www.sbml.org/2001/ns/celldesigner\"/>
</root>"
)),
d1
=
"sbml"
,
d2
=
"cd"
)
### Get complex ids
cids
<-
xml_attr
(
xml_find_all
(
cd_map
,
"//cd:complexSpeciesAlias"
,
ns_cd
),
"species"
)
### 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
)))
names
(
hypocs
)
<-
gsub
(
"s_id_"
,
""
,
names
(
hypocs
))
return
(
hypocs
)
}
cgroups
<-
get_groups
(
diag_name
)
message
(
"Translating..."
)
### Create a copy
translated_sif
<-
raw_sif
### Retrieve Entrez for the entire columns of sources and targets
translated_sif
[,
1
]
<-
sapply
(
raw_sif
[,
1
],
group_elements
,
model_elements
,
entrez
)
translated_sif
[,
3
]
<-
sapply
(
raw_sif
[,
3
],
group_elements
,
model_elements
,
entrez
)
### Retrieve Entrez and type for the entire columns of sources and targets
s.entrez
<-
sapply
(
raw_sif
[,
1
],
group_elements
,
model_elements
,
entrez
)
s.type
<-
sapply
(
raw_sif
[,
1
],
function
(
x
)
{
ifelse
(
x
%in%
names
(
cgroups
),
ifelse
(
is.na
(
cgroups
[
x
]),
"complex"
,
"group"
),
"node"
)
})
t.entrez
<-
sapply
(
raw_sif
[,
3
],
group_elements
,
model_elements
,
entrez
)
t.type
<-
sapply
(
raw_sif
[,
3
],
function
(
x
)
{
ifelse
(
x
%in%
names
(
cgroups
),
ifelse
(
is.na
(
cgroups
[
x
]),
"complex"
,
"group"
),
"node"
)
})
### Collect x.y information
colnames
(
translated_sif
)
<-
c
(
"source"
,
"sign"
,
"target"
)
s.xy
<-
t
(
sapply
(
raw_sif
[,
1
],
function
(
x
)
unlist
(
model_elements
$
bounds
[
model_elements
$
elementId
==
x
,
c
(
3
,
4
)])))
colnames
(
s.xy
)
<-
c
(
"source.x"
,
"source.y"
)
t.xy
<-
t
(
sapply
(
raw_sif
[,
3
],
function
(
x
)
unlist
(
model_elements
[
model_elements
$
elementId
==
x
,
1
][,
c
(
3
,
4
)])))
colnames
(
t.xy
)
<-
c
(
"targets.x"
,
"targets.y"
)
### Combine into a single data frame
translated_sif
<-
data.frame
(
translated_sif
,
s.xy
,
t.xy
)
translated_sif
<-
data.frame
(
source
=
s.entrez
,
source.type
=
s.type
,
sign
=
raw_sif
[,
2
],
target
=
t.entrez
,
target.type
=
t.type
,
s.xy
,
t.xy
)
write.table
(
translated_sif
,
file
=
"translated_sif.txt"
,
sep
=
"\t"
,
quote
=
F
,
col.names
=
T
,
row.names
=
F
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment