Commit a7d33217 authored by Marek Ostaszewski's avatar Marek Ostaszewski
Browse files

detailed drugs

parent 0c51d734
......@@ -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],
cbind(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 = ";")))
this_drugs))
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment