YuLab-SMU / clusterProfiler

:bar_chart: A universal enrichment tool for interpreting omics data
https://yulab-smu.top/biomedical-knowledge-mining-book/
967 stars 246 forks source link

gseKEGG using KEGG database error (cannot open URL 'https://rest.kegg.jp/conv/ncbi=geneid/mmu': HTTP status was '400 Bad Request') #694

Open ChoIYS98 opened 1 month ago

ChoIYS98 commented 1 month ago

Regarding the KEGG annotation usage error, I have already followed up with #572 Seems like the error comes from not updating R or BiocManager or clusterprofiler..

I am currently using R 4.4, BiocManager 1.30.23, clusterprofiler 4.12

Yet, I still get the following error:

KEGG

Convert gene IDs for gseKEGG function

We will lose some genes here because not all IDs will be converted

ids <- bitr(names(CB_pathway), fromType = "SYMBOL", toType = "ENTREZID", OrgDb = organism)

Remove duplicate IDs (here I use "ENSEMBL", but it should be whatever was selected as keyType)

dedup_ids <- ids[!duplicated(ids[c("SYMBOL")]),]

tmp=data.frame(SYMBOL=names(CB_pathway), logfc=as.numeric(CB_pathway)) tmp=merge(tmp, dedup_ids, by="SYMBOL") CB_pathway=tmp$logfc names(CB_pathway)=dedup_ids$ENTREZID CB_pathway=sort(CB_pathway, decreasing = T)

k_CB <- gseKEGG(geneList = CB_pathway, organism = "mmu", nPerm = 1000, minGSSize = 15, maxGSSize = 500, pvalueCutoff = 0.05, pAdjustMethod = "none", keyType = "ncbi=geneid")

ERROR: Reading KEGG annotation online: "https://rest.kegg.jp/conv/ncbi=geneid/mmu"... Error in file(con, "r") : cannot open the connection to 'https://rest.kegg.jp/conv/ncbi=geneid/mmu' In addition: Warning message: In file(con, "r") : cannot open URL 'https://rest.kegg.jp/conv/ncbi=geneid/mmu': HTTP status was '400 Bad Request'

guidohooiveld commented 1 month ago

If you check the last line of your code, you will see it contains a spelling error! keyType = "ncbi=geneid")

Replace = (equal symbol) by - (hyphen), so the line reads: keyType = "ncbi-geneid")