clusterProfiler icon indicating copy to clipboard operation
clusterProfiler copied to clipboard

goplot does not find ontology

Open davidvilanova opened this issue 9 months ago • 2 comments

Hi, I am trying to reproduce the example code provided below and i get an error


> data(geneList, package = "DOSE")
> de <- names(geneList)[1:100]
> yy <- enrichGO(de, 'org.Hs.eg.db', ont="BP", pvalueCutoff=0.01)
> head(yy)
                   ID                          Description GeneRatio   BgRatio RichFactor FoldEnrichment   zScore       pvalue
GO:0007059 GO:0007059               chromosome segregation     34/99 431/18805 0.07888631       14.98441 21.36650 4.744689e-31
GO:0098813 GO:0098813       nuclear chromosome segregation     31/99 322/18805 0.09627329       18.28706 22.76225 6.561567e-31
GO:0000819 GO:0000819         sister chromatid segregation     28/99 234/18805 0.11965812       22.72900 24.33225 1.457950e-30
GO:0000070 GO:0000070 mitotic sister chromatid segregation     26/99 193/18805 0.13471503       25.58905 24.97906 9.463712e-30
GO:0140014 GO:0140014             mitotic nuclear division     29/99 282/18805 0.10283688       19.53381 22.81319 1.026099e-29
GO:0000280 GO:0000280                     nuclear division     33/99 448/18805 0.07366071       13.99182 20.24698 3.996836e-29
               p.adjust       qvalue
GO:0007059 5.367362e-28 4.306460e-28
GO:0098813 5.367362e-28 4.306460e-28
GO:0000819 7.950689e-28 6.379172e-28
GO:0000070 3.357397e-27 2.693781e-27
GO:0140014 3.357397e-27 2.693781e-27
GO:0000280 1.089804e-26 8.743954e-27
                                                                                                                                                                                              geneID
GO:0007059 55143/991/9493/1062/4605/9133/10403/7153/23397/259266/9787/11065/55355/220134/51203/22974/10460/4751/79019/55839/983/4085/81930/81620/332/3832/7272/64151/9212/9319/9055/3833/146909/6790
GO:0098813                   55143/991/9493/1062/4605/9133/10403/7153/23397/259266/9787/11065/220134/51203/22974/10460/4751/983/4085/81930/81620/332/3832/7272/64151/9212/9319/9055/3833/146909/6790
GO:0000819                                    55143/991/9493/1062/4605/10403/7153/23397/9787/11065/220134/51203/22974/10460/4751/983/4085/81930/81620/332/3832/7272/64151/9212/9319/9055/3833/146909
GO:0000070                                               55143/991/9493/1062/4605/10403/23397/9787/11065/220134/51203/22974/4751/983/4085/81930/81620/332/3832/7272/64151/9212/9319/9055/3833/146909
GO:0140014                               55143/991/9493/1062/4605/10403/23397/9787/11065/220134/51203/22974/4751/27338/983/4085/81930/81620/332/3832/7272/64151/9212/1111/9319/9055/3833/146909/6790
GO:0000280        55143/991/9493/1062/4605/9133/10403/7153/23397/259266/9787/11065/220134/51203/22974/4751/10635/27338/983/4085/81930/81620/332/3832/7272/64151/9212/1111/9319/9055/3833/146909/6790
           Count
GO:0007059    34
GO:0098813    31
GO:0000819    28
GO:0000070    26
GO:0140014    29
GO:0000280    33

This is the error, the object contains the ontology so dont know the problem ?

> goplot(yy)
Error in goplot.enrichResult(x, showCategory = showCategory, color = color,  : 
  Ontology should be one of 'MF', 'CC' or 'BP'

> yy@ontology
[1] "BP"

Subset of the returned yy object:
> str(yy)
Formal class 'enrichResult' [package "DOSE"] with 15 slots
  ..@ result       :'data.frame':	1636 obs. of  12 variables:
  .. ..$ ID            : chr [1:1636] "GO:0007059" "GO:0098813" "GO:0000819" "GO:0000070" ...
  .. ..$ Description   : chr [1:1636] "chromosome segregation" "nuclear chromosome segregation" "sister chromatid segregation" "mitotic sister chromatid segregation" ...
  .. ..$ GeneRatio     : chr [1:1636] "34/99" "31/99" "28/99" "26/99" ...
  .. ..$ BgRatio       : chr [1:1636] "431/18805" "322/18805" "234/18805" "193/18805" ...
  .. ..$ RichFactor    : num [1:1636] 0.0789 0.0963 0.1197 0.1347 0.1028 ...
  .. ..$ FoldEnrichment: num [1:1636] 15 18.3 22.7 25.6 19.5 ...
  .. ..$ zScore        : num [1:1636] 21.4 22.8 24.3 25 22.8 ...
  .. ..$ pvalue        : num [1:1636] 4.74e-31 6.56e-31 1.46e-30 9.46e-30 1.03e-29 ...
  .. ..$ p.adjust      : num [1:1636] 5.37e-28 5.37e-28 7.95e-28 3.36e-27 3.36e-27 ...
  .. ..$ qvalue        : num [1:1636] 4.31e-28 4.31e-28 6.38e-28 2.69e-27 2.69e-27 ...
  .. ..$ geneID        : chr [1:1636] "55143/991/9493/1062/4605/9133/10403/7153/23397/259266/9787/11065/55355/220134/51203/22974/10460/4751/79019/5583"| __truncated__ "55143/991/9493/1062/4605/9133/10403/7153/23397/259266/9787/11065/220134/51203/22974/10460/4751/983/4085/81930/8"| __truncated__ "55143/991/9493/1062/4605/10403/7153/23397/9787/11065/220134/51203/22974/10460/4751/983/4085/81930/81620/332/383"| __truncated__ "55143/991/9493/1062/4605/10403/23397/9787/11065/220134/51203/22974/4751/983/4085/81930/81620/332/3832/7272/6415"| __truncated__ ...
  .. ..$ Count         : int [1:1636] 34 31 28 26 29 33 33 21 20 17 ...
  ..@ pvalueCutoff : num 0.01
  ..@ pAdjustMethod: chr "BH"
  ..@ qvalueCutoff : num 0.2
  ..@ organism     : chr "Homo sapiens"
  ..@ ontology     : chr "BP"
  ..@ gene         : chr [1:100] "4312" "8318" "10874" "55143" ...
  ..@ keytype      : chr "ENTREZID"
  ..@ universe     : chr [1:18805] "142" "291" "1763" "1890" ...
  ..@ gene2Symbol  : chr(0) 
  ..@ geneSets     :List of 2248
  .. ..$ GO:0000018: chr [1:142] "25" "60" "86" "142" ...
  .. ..$ GO:0000022: chr [1:12] "332" "3619" "4926" "6795" ...
  .. ..$ GO:0000070: chr [1:193] "324" "332" "387" "472" ...
  ...
  .. .. [list output truncated]
  ..@ readable     : logi FALSE
  ..@ termsim      : num[0 , 0 ] 
  ..@ method       : chr(0) 
  ..@ dr           : list()
> 

Running the packages below for clusterProfiler and R

packageVersion("clusterProfiler") [1] ‘4.16.0’ R.version _
platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 4
minor 5.0
year 2025
month 04
day 11
svn rev 88135
language R
version.string R version 4.5.0 (2025-04-11) nickname How About a Twenty-Six

Any idea of what is wrong ???

davidvilanova avatar May 14 '25 09:05 davidvilanova

I am getting excactly the same error from goplot() in any type of enrich result object I have tried

My clusterProfiler and R details as follows:

packageVersion("clusterProfiler") [1] ‘4.16.0’ R.version _
platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 4
minor 5.0
year 2025
month 04
day 11
svn rev 88135
language R
version.string R version 4.5.0 (2025-04-11) nickname How About a Twenty-Six

cbouyio avatar May 16 '25 17:05 cbouyio

I have the same problem, there's a bug in the goplot function which is provided by the enrichplot package. In goplot, the recently introduced ontology check where it checks for BF instead of BP, this line specifically. It's a quick fix, I submitted a pull request here: https://github.com/YuLab-SMU/enrichplot/pull/321

In the meantime, the fork works well:

devtools::install_github("davorvr/enrichplot")
library(enrichplot)
library(clusterProfiler)

davorvr avatar May 19 '25 20:05 davorvr