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
a7d33217
Commit
a7d33217
authored
Feb 02, 2021
by
Marek Ostaszewski
Browse files
detailed drugs
parent
0c51d734
Changes
1
Hide whitespace changes
Inline
Side-by-side
Integration/MINERVA_access/get_drug_targets.R
View file @
a7d33217
...
...
@@ -35,6 +35,15 @@ upd <- sapply(refs, unique_drugs)
### Get the id of the default project
map_project
<-
paste0
(
map
,
"projects/"
,
get_default_project
(
map
),
"/"
)
format_targeting_drugs
<-
function
(
falias
,
fproject
)
{
ddata
<-
fromJSON
(
ask_GET
(
paste0
(
fproject
,
"drugs:search?target=ALIAS:"
,
falias
)))
ret
<-
c
()
for
(
i
in
1
:
length
(
ddata
$
id
))
{
ret
<-
rbind
(
ret
,
cbind
(
drug
=
ddata
$
id
[
i
],
ddata
$
references
[[
i
]][,
c
(
"resource"
,
"type"
)]))
}
return
(
ret
)
}
### Lengthy calculation, ask for drug targets of all unique UniProt ids in every pathway
all_drugs
<-
c
()
### For each pathway
...
...
@@ -45,11 +54,12 @@ for(u in 1:length(upd)) {
for
(
p
in
1
:
length
(
upd
[[
u
]]))
{
### Add a row to the global table with pathway name, UniProt id and the drugs
### targeting the element alias associated with this UniProt
this_drugs
<-
format_targeting_drugs
(
upd
[[
u
]][
p
],
map_project
)
if
(
is.null
(
this_drugs
))
{
next
}
all_drugs
<-
rbind
(
all_drugs
,
c
(
pathway_name
=
map_components
$
models
$
name
[
u
],
uniprot
=
names
(
upd
[[
u
]])[
p
],
drugs
=
paste
(
fromJSON
(
ask_GET
(
paste0
(
map_project
,
"drugs:search?target=ALIAS:"
,
upd
[[
u
]][
p
])))
$
name
,
collapse
=
";"
)))
cbind
(
pathway_name
=
map_components
$
models
$
name
[
u
],
uniprot
=
names
(
upd
[[
u
]])[
p
],
this_drugs
))
}
}
}
...
...
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