Welcome to clusterProfiler Discussions! #373
GuangchuangYu
announced in
Announcements
Replies: 1 comment
-
Hi Nitesh,
I don't know why you said our code was wrong. Have you try to download files from 'https://rest.kegg.jp/link/hsa/pathway' and 'https://rest.kegg.jp/link/pathway/hsa'?
Best wishes,
Erqiang Hu
At 2022-08-11 04:44:00, "Nshriwash" ***@***.***> wrote:
Hi GuangyuangYu,
I am encountering an error in your code and found the bug.
"Reading KEGG annotation online:
fail to download KEGG data...
Error in download.KEGG.Path(species) :
'species' should be one of organisms listed in 'http://www.genome.jp/kegg/catalog/org_list.html'...
In addition: Warning message:
In utils::download.file(url, quiet = TRUE, method = method, ...) :
URL 'https://rest.kegg.jp/link/hsa/pathway': status was 'Failure when receiving data from the peer' ..."
I am getting this error while using enrichKEGG().
I trace it back into the source code and find that there is an error in source code of download.KEGG.Path() and kegg_link().
the argument passed in kegg_link in download.KEGG.Path function is different from what is required in source code of kegg_link().
Here is the piece of code with bugs:
`download.KEGG.Path <- function(species) {
keggpathid2extid.df <- kegg_link(species, "pathway")
if (is.null(keggpathid2extid.df)) {
message <- paste("Failed to download KEGG data.",
"Wrong 'species' or the network is unreachable.",
"The 'species' should be one of organisms listed in",
"'https://www.genome.jp/kegg/catalog/org_list.html'")
stop(message)
}
keggpathid2extid.df[,1] %<>% gsub("[^:]+:", "", .)
keggpathid2extid.df[,2] %<>% gsub("[^:]+:", "", .)
keggpathid2name.df <- kegg_list("pathway")
keggpathid2name.df[,1] %<>% gsub("path:map", species, .)
## if 'species="ko"', ko and map path are duplicated, only keep ko path.
##
## https://www.kegg.jp/dbget-bin/www_bget?ko+ko00010
## https://www.kegg.jp/dbget-bin/www_bget?ko+map0001
##
keggpathid2extid.df <- keggpathid2extid.df[keggpathid2extid.df[,1] %in% keggpathid2name.df[,1],]
return(list(KEGGPATHID2EXTID=keggpathid2extid.df,
KEGGPATHID2NAME=keggpathid2name.df))
}
kegg_link <- function(target_db, source_db) {
url <- paste0("https://rest.kegg.jp/link/", target_db, "/", source_db, collapse="")
kegg_rest(url)
}`
here target_db must be "pathway" and source_db should be "species". But kegg_link in download.KEGG.Path giving "pathway" as a source_db and "species" as a target_db.
right link = "https://rest.kegg.jp/link/<target_db>/<source_db>"
resulting link from download.KEGG.Path = "https://rest.kegg.jp/link/<source_db>/<target_db>" which is wrong link.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
👋 Welcome!
We’re using Discussions as a place to connect with other members of our community. We hope that you:
build together 💪.
To get started, comment below with an introduction of yourself and tell us about what you do with this community.
Beta Was this translation helpful? Give feedback.
All reactions