Skip to content

Commit

Permalink
Merge pull request #540 from huerqiang/KEGGapi
Browse files Browse the repository at this point in the history
update KEGG API
  • Loading branch information
GuangchuangYu authored Mar 1, 2023
2 parents aae0a70 + a171052 commit fa231bd
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
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
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ TODO:
-->
# clusterProfiler 4.7.1

+ update according to the KEGG api changes (2023-03-01, Wed)

# clusterProfiler 4.6.0

+ Bioconductor 3.16 release

# 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

0 comments on commit fa231bd

Please sign in to comment.