library(httr)
library(jsonlite)
base_url <- "https://webservice.wikipathways.org"
search_aop_pathways <- function(search_text = "AOP") {
response <- GET(
url = paste0(base_url, "/findPathwaysByText"),
query = list(query = search_text, format = "json")
)
if (response$status_code == 200) {
# Parse the JSON response
response_content <- content(response, as = "text", encoding = "UTF-8")
parsed_response <- fromJSON(response_content, flatten = TRUE)
# Extract pathways information
pathways <- parsed_response$searchResults$pathways
return(pathways)
} else {
stop("Failed to retrieve data from WikiPathways API")
}
}
aop_pathways <- search_aop_pathways()
if (!is.null(aop_pathways)) {
print(aop_pathways)
} else {
print("No pathways found containing the text 'AOP'")
}
-
Notifications
You must be signed in to change notification settings - Fork 0
VittoNico/answer17
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published