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

"400 Bad Request" using enrichKEGG function from the clusterProfiler #706

Open
RouaPopescu opened this issue Jul 15, 2024 · 2 comments
Open

Comments

@RouaPopescu
Copy link

Hello,
I am encountering an error when using the enrichKEGG function from the clusterProfiler package with my own created library for Klebisella pneumoniae subsp. pneumoniae HS11286 (taxid: 1125630).
Below is an example demonstrating the issue:
`library(clusterProfiler)
ids<-bitr(names(original_gene_list), 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")]),]
df2 = pstexp2[pstexp2$Gene.symbol %in% dedup_ids$SYMBOL,]
df2$Y = dedup_ids$ENTREZID
kegg_gene_list <- df2$logFC
names(kegg_gene_list) <- df2$Y
kegg_gene_list<-na.omit(kegg_gene_list)
kegg_gene_list = sort(kegg_gene_list, decreasing = TRUE)
kegg_sig_genes_df = subset(df2, df2$adj.P.Val < 0.05)
kegg_genes <- kegg_sig_genes_df$logFC
names(kegg_genes) <- kegg_sig_genes_df$Y
kegg_genes <- na.omit(kegg_genes)
kegg_genes <- names(kegg_genes)[abs(kegg_genes) > 0.05]

kegg_organism = "kpm"
kk <- enrichKEGG(gene=kegg_genes, universe=names(kegg_gene_list),organism=organism, pvalueCutoff = 0.05, keyType = "ncbi-geneid")`

The following is my error message:
Reading KEGG annotation online: "https://rest.kegg.jp/link/org.Kpm.eg.db/pathway"... Error in file(con, "r") : cannot open the connection to 'https://rest.kegg.jp/link/org.Kpm.eg.db/pathway' In addition: Warning message: In file(con, "r") : cannot open URL 'https://rest.kegg.jp/link/org.Kpm.eg.db/pathway': HTTP status was '400 Bad Request'

Some one could help me here please?

Best,
Roua Popescu

@guidohooiveld
Copy link

There is a lot of (non-reproducible) code in your post, but to me it seems that when calling the enrichKEGG function the argument organism should be kegg_organism (and not organism).

Note that the URL you posted contains the OrgDb, but it should rather be the kegg organism...

To check:
Doesn't work in browser:
https://rest.kegg.jp/link/org.Kpm.eg.db/pathway

Does work in browser:
https://rest.kegg.jp/link/kpm/pathway

@RouaPopescu
Copy link
Author

Thank you for the suggestions!
Now the enrichKEGG function works.
It seems that the problem was due to the fact that the ENTREZID column had a '.0' at the end of each ENTREZ ID (I don't understand why). But, after I cleaned the ENTREZID column, the enricKEGG function worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants