Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update KEGG API #540

Merged
merged 5 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: clusterProfiler
Type: Package
Title: A universal enrichment tool for interpreting omics data
Version: 4.7.0
Version: 4.7.1
Authors@R: c(
person(given = "Guangchuang", family = "Yu", email = "[email protected]", role = c("aut", "cre", "cph"), comment = c(ORCID = "0000-0002-6485-8781")),
person(given = "Li-Gen", family = "Wang", email = "[email protected]", role = "ctb"),
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ TODO:


-->
# clusterProfiler 4.7.0.991
+ update KEGG api (2023-03-01, Wed)

# clusterProfiler 4.5.3

Expand Down
7 changes: 4 additions & 3 deletions R/enrichKEGG.R
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ download.KEGG.Path <- function(species) {
keggpathid2extid.df[,1] %<>% gsub("[^:]+:", "", .)
keggpathid2extid.df[,2] %<>% gsub("[^:]+:", "", .)

keggpathid2name.df <- kegg_list("pathway")
keggpathid2name.df[,1] %<>% gsub("path:map", species, .)
keggpathid2name.df <- kegg_list("pathway", species)
# keggpathid2name.df[,1] %<>% gsub("path:map", species, .)

## if 'species="ko"', ko and map path are duplicated, only keep ko path.
##
Expand All @@ -204,7 +204,8 @@ download.KEGG.Module <- function(species) {
keggmodule2extid.df[,2] %<>% gsub("[^:]+:", "", .)

keggmodule2name.df <- kegg_list("module")
keggmodule2name.df[,1] %<>% gsub("md:", "", .)
# now module do not nedd sub 'md:'
# keggmodule2name.df[,1] %<>% gsub("md:", "", .)
return(list(KEGGPATHID2EXTID=keggmodule2extid.df,
KEGGPATHID2NAME =keggmodule2name.df))
}
Expand Down
2 changes: 1 addition & 1 deletion R/gson.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ gson_KEGG_mapper = function(file,
}

if (type == "pathway"){
all_pathway = kegg_list("pathway")
all_pathway = kegg_list("pathway", species)
colnames(all_pathway) = c("pathway","pathway_name")
all_pathway %<>%
dplyr::mutate_at(.vars = "pathway", .funs = "remove_db_prefix")
Expand Down
10 changes: 8 additions & 2 deletions R/kegg-utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,14 @@ kegg_link <- function(target_db, source_db) {
}


kegg_list <- function(db) {
url <- paste0("https://rest.kegg.jp/list/", db, collapse="")
kegg_list <- function(db, species = NULL) {
if (db == "pathway") {
url <- paste("https://rest.kegg.jp/list", db, species, sep="/")
} else {
## module do not need species
url <- paste("https://rest.kegg.jp/list", db, sep="/")
}

kegg_rest(url)
}

Expand Down