Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
COVID-19
models
Commits
e5bfdbe8
Commit
e5bfdbe8
authored
Jun 08, 2020
by
Marek Ostaszewski
Browse files
Alias resolver
parent
55bae3ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Resources/Hipathia/resolve_aliases.R
View file @
e5bfdbe8
...
...
@@ -52,7 +52,7 @@ this_refs <- models[models$name == diag_name]
### Get elements of the chosen diagram
model_elements
<-
fromJSON
(
ask_GET
(
paste0
(
mnv_base
,
"models/"
,
models
$
idObject
[
models
$
name
==
diag_name
],
"/"
),
"bioEntities/elements/?columns=id,name,type,references,elementId,complexId"
),
"bioEntities/elements/?columns=id,name,type,references,elementId,complexId
,bounds
"
),
flatten
=
F
)
message
(
"Fetching entrez ids..."
)
...
...
@@ -86,6 +86,15 @@ 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
)
### 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
)
write.table
(
translated_sif
,
file
=
"translated_sif.txt"
,
sep
=
"\t"
,
quote
=
F
,
col.names
=
F
,
row.names
=
F
)
message
(
"Done."
)
\ No newline at end of file
message
(
"Done."
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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