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

How to convert geneID from the enrichKEGG output from entrez to gene symbol? #688

Closed thisisamirv closed 2 months ago

thisisamirv commented 2 months ago

As you can see, the output of enrichKEGG is gene IDs in entrez ids. How can I instead convert it to gene symbols:

> KEGG
#
# over-representation test
#
#...@organism    hsa 
#...@ontology    KEGG 
#...@keytype     kegg 
#...@gene        chr [1:1341] "8379" "3927" "57679" "84254" "51364" "56919" "6833" "1750" ...
#...pvalues adjusted by 'BH' with cutoff <1 
#...8 enriched terms found
'data.frame':   8 obs. of  11 variables:
 $ category   : chr  "Environmental Information Processing" "Human Diseases" "Organismal Systems" "Organismal Systems" ...
 $ subcategory: chr  "Signal transduction" "Substance dependence" "Nervous system" "Nervous system" ...
 $ ID         : chr  "hsa04390" "hsa05030" "hsa04725" "hsa04724" ...
 $ Description: chr  "Hippo signaling pathway" "Cocaine addiction" "Cholinergic synapse" "Glutamatergic synapse" ...
 $ GeneRatio  : chr  "20/490" "9/490" "15/490" "15/490" ...
 $ BgRatio    : chr  "157/8753" "49/8753" "113/8753" "115/8753" ...
 $ pvalue     : num  0.00046 0.00138 0.00151 0.00181 0.00193 ...
 $ p.adjust   : num  0.122 0.122 0.122 0.122 0.122 ...
 $ qvalue     : num  0.117 0.117 0.117 0.117 0.117 ...
 $ geneID     : chr  "1496/5590/2736/1739/7161/7481/655/23286/7474/7475/652/7483/9231/3689/5584/8323/8945/8322/6657/5501" "2770/6531/9586/2905/111/627/3725/1812/2913" "3784/2782/43/3717/1143/2770/773/9586/2786/2353/111/1132/23236/56479/4893" "5337/2782/57084/2770/773/2900/9456/2905/22941/2786/2897/111/23236/10991/2913" ...
 $ Count      : int  20 9 15 15 26 17 14 13
guidohooiveld commented 2 months ago

Did you read the workflow on the clusterProfiler book? https://yulab-smu.top/biomedical-knowledge-mining-book/useful-utilities.html#setReadable

Anyway, you can do this with the function setReadable.

> library(org.Hs.eg.db)
> KEGG.symbols <- setReadable(KEGG,
+                             OrgDb = 'org.Hs.eg.db',
+                             keyType = 'ENTREZID') 
> 
thisisamirv commented 2 months ago

Thank you very much!