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

enrichKegg function, qvalueCutoff not working, getting as well non-significant results #710

Open
nina-hahn opened this issue Jul 22, 2024 · 4 comments

Comments

@nina-hahn
Copy link

nina-hahn commented Jul 22, 2024

Dear all,

I am using the enrichKegg function. An example

kk <- enrichKEGG(gene         = gene.df.sig$ENTREZID,
+                  organism     = 'mmu',
+                  pvalueCutoff = 0.05,
+                  qvalueCutoff = 0.05,
+                  pAdjustMethod = "BH")

Using this code, I assumed that I should only get significant results based on q-value <0.05. However, it seems that the qvalueCutoff parameter is not working. I get results with a qvalue 0.2

image

Can I change this? I just wand to get significant results based on my q value threshold.

Best,
Nina

@guidohooiveld
Copy link

What is the output from:

tail( as.data.frame(kk) )

@nina-hahn
Copy link
Author

Hi guido,

it is

tail(as.data.frame(kk))
 [1] category    subcategory ID          Description GeneRatio   BgRatio     pvalue      p.adjust   
 [9] qvalue      geneID      Count      
<0 Zeilen> (oder row.names mit Länge 0)

@guidohooiveld
Copy link

guidohooiveld commented Jul 23, 2024

Aha, that suggests the significance filtering indeed worked.

Please be aware that:

  • false discovery rates (FDR) can be calculated according to multiple procedures.
  • Benjamini and Hochberg (BH) were the first to introduce the term FDR, together with an algorithm to calculate the FDR.
  • Gordon Smyth, the author of the limma package implemented the BH algorithm in the stats package, and started calling FDR 'adjusted p-values'. See here.
  • John Storey introduced another procedure to calculate the FDR, and he called these numbers q-values (because of its analogy with p-values).

This explains why the terms FDR, adjusted p-values and q-values are often used routinely (and interchangeably).

Also note that the Benjamini–Hochberg procedure generates more conservative FDR values than those calculated by the q-value, and that clusterProfiler calculates 'adjusted p-values' according to the BH algorithm as well as 'q-values' according to Storey's algorithm (utilizing resp. the packages stats and qvalue).

Lastly, to extract all results from an enrichment analysis you should convert it as a data frame (as.data.frame). See 2nd code chunck.

With this in mind:

  • with identical cutoff values used for both pvalueCutoff (since pAdjustMethod = "BH", these are thus FDR values!) and qvalueCutoff, you effectively will always filter on BH adjusted p-values and NOT q-values, because the BH procedure generates more conservative FDR than Storey's qvalue approach.
  • if you would like to filter on qvalue, set pAdjustMethod = "none".

To show this with some code:

> ## load library
> library(clusterProfiler)
> 
> ## load sample data
> data(geneList, package="DOSE")
> gene <- names(geneList)[abs(geneList) > 2]
> 
> ## perform enrichment analysis
> ## calculate adjusted p-values according to BH,
> ## and set pvalueCutoff and qvalueCutoff both to 0.05. 
> res1 <- enrichKEGG(gene         = gene,
+                    organism     = 'hsa',
+                    pvalueCutoff = 0.05,
+                    qvalueCutoff = 0.05,
+                    pAdjustMethod = "BH")
> 
> 
> ## check results. Note "7 enriched terms found"
> res1
#
# over-representation test
#
#...@organism    hsa 
#...@ontology    KEGG 
#...@keytype     kegg 
#...@gene        chr [1:207] "4312" "8318" "10874" "55143" "55388" "991" "6280" "2305" ...
#...pvalues adjusted by 'BH' with cutoff <0.05 
#...7 enriched terms found
'data.frame':   7 obs. of  14 variables:
 $ category      : chr  "Cellular Processes" "Cellular Processes" "Cellular Processes" "Environmental Information Processing" ...
 $ subcategory   : chr  "Cell growth and death" "Cell growth and death" "Cell growth and death" "Signaling molecules and interaction" ...
 $ ID            : chr  "hsa04110" "hsa04114" "hsa04218" "hsa04061" ...
 $ Description   : chr  "Cell cycle" "Oocyte meiosis" "Cellular senescence" "Viral protein interaction with cytokine and cytokine receptor" ...
 $ GeneRatio     : chr  "15/106" "10/106" "10/106" "8/106" ...
 $ BgRatio       : chr  "158/8842" "139/8842" "157/8842" "100/8842" ...
 $ RichFactor    : num  0.0949 0.0719 0.0637 0.08 0.0921 ...
 $ FoldEnrichment: num  7.92 6 5.31 6.67 7.68 ...
 $ zScore        : num  9.67 6.55 6.01 6.28 6.44 ...
 $ pvalue        : num  4.95e-10 5.88e-06 1.73e-05 2.44e-05 3.23e-05 ...
 $ p.adjust      : num  1.06e-07 6.29e-04 1.23e-03 1.31e-03 1.38e-03 ...
 $ qvalue        : num  1.04e-07 6.16e-04 1.21e-03 1.28e-03 1.35e-03 ...
 $ geneID        : chr  "8318/991/9133/10403/890/983/4085/81620/7272/9212/1111/9319/891/4174/9232" "991/9133/983/4085/51806/6790/891/9232/3708/5241" "2305/4605/9133/890/983/51806/1111/891/776/3708" "3627/10563/6373/4283/6362/6355/9547/1524" ...
 $ Count         : int  15 10 10 8 7 10 7
#...Citation
 T Wu, E Hu, S Xu, M Chen, P Guo, Z Dai, T Feng, L Zhou, W Tang, L Zhan, X Fu, S Liu, X Bo, and G Yu.
 clusterProfiler 4.0: A universal enrichment tool for interpreting omics data.
 The Innovation. 2021, 2(3):100141 

> 
> ## extract all results. Note that p.adjust values are always (slightly) larger (= more conservative) than qvalue
> as.data.frame(res1)
                                     category
hsa04110                   Cellular Processes
hsa04114                   Cellular Processes
hsa04218                   Cellular Processes
hsa04061 Environmental Information Processing
hsa03320                   Organismal Systems
hsa04814                   Cellular Processes
hsa04914                   Organismal Systems
                                 subcategory       ID
hsa04110               Cell growth and death hsa04110
hsa04114               Cell growth and death hsa04114
hsa04218               Cell growth and death hsa04218
hsa04061 Signaling molecules and interaction hsa04061
hsa03320                    Endocrine system hsa03320
hsa04814                       Cell motility hsa04814
hsa04914                    Endocrine system hsa04914
                                                           Description
hsa04110                                                    Cell cycle
hsa04114                                                Oocyte meiosis
hsa04218                                           Cellular senescence
hsa04061 Viral protein interaction with cytokine and cytokine receptor
hsa03320                                        PPAR signaling pathway
hsa04814                                                Motor proteins
hsa04914                       Progesterone-mediated oocyte maturation
         GeneRatio  BgRatio RichFactor FoldEnrichment   zScore       pvalue
hsa04110    15/106 158/8842 0.09493671       7.919155 9.666494 4.951055e-10
hsa04114    10/106 139/8842 0.07194245       6.001086 6.546129 5.878161e-06
hsa04218    10/106 157/8842 0.06369427       5.313063 6.006176 1.726642e-05
hsa04061     8/106 100/8842 0.08000000       6.673208 6.284498 2.444647e-05
hsa03320     7/106  76/8842 0.09210526       7.682969 6.444999 3.232516e-05
hsa04814    10/106 197/8842 0.05076142       4.234269 5.056780 1.192289e-04
hsa04914     7/106 111/8842 0.06306306       5.260411 4.975404 3.564744e-04
             p.adjust       qvalue
hsa04110 1.059526e-07 1.037116e-07
hsa04114 6.289633e-04 6.156601e-04
hsa04218 1.231671e-03 1.205620e-03
hsa04061 1.307886e-03 1.280223e-03
hsa03320 1.383517e-03 1.354254e-03
hsa04814 4.252499e-03 4.162554e-03
hsa04914 1.089793e-02 1.066743e-02
                                                                           geneID
hsa04110 8318/991/9133/10403/890/983/4085/81620/7272/9212/1111/9319/891/4174/9232
hsa04114                          991/9133/983/4085/51806/6790/891/9232/3708/5241
hsa04218                           2305/4605/9133/890/983/51806/1111/891/776/3708
hsa04061                                 3627/10563/6373/4283/6362/6355/9547/1524
hsa03320                                       4312/9415/9370/5105/2167/3158/5346
hsa04814                   9493/1062/81930/3832/3833/146909/10112/24137/4629/7802
hsa04914                                          9133/890/983/4085/6790/891/5241
         Count
hsa04110    15
hsa04114    10
hsa04218    10
hsa04061     8
hsa03320     7
hsa04814    10
hsa04914     7
> 
> 
> 
> ## repeat, but set qvalueCutoff = 0.01
> ## this shows that filtering on qvalue works; since only "6 enriched terms found" 
> res2 <- enrichKEGG(gene         = gene,
+                    organism     = 'hsa',
+                    pvalueCutoff = 0.05,
+                    qvalueCutoff = 0.01,
+                    pAdjustMethod = "BH")
> 
> res2
#
# over-representation test
#
#...@organism    hsa 
#...@ontology    KEGG 
#...@keytype     kegg 
#...@gene        chr [1:207] "4312" "8318" "10874" "55143" "55388" "991" "6280" "2305" ...
#...pvalues adjusted by 'BH' with cutoff <0.05 
#...6 enriched terms found
'data.frame':   6 obs. of  14 variables:
 $ category      : chr  "Cellular Processes" "Cellular Processes" "Cellular Processes" "Environmental Information Processing" ...
 $ subcategory   : chr  "Cell growth and death" "Cell growth and death" "Cell growth and death" "Signaling molecules and interaction" ...
 $ ID            : chr  "hsa04110" "hsa04114" "hsa04218" "hsa04061" ...
 $ Description   : chr  "Cell cycle" "Oocyte meiosis" "Cellular senescence" "Viral protein interaction with cytokine and cytokine receptor" ...
 $ GeneRatio     : chr  "15/106" "10/106" "10/106" "8/106" ...
 $ BgRatio       : chr  "158/8842" "139/8842" "157/8842" "100/8842" ...
 $ RichFactor    : num  0.0949 0.0719 0.0637 0.08 0.0921 ...
 $ FoldEnrichment: num  7.92 6 5.31 6.67 7.68 ...
 $ zScore        : num  9.67 6.55 6.01 6.28 6.44 ...
 $ pvalue        : num  4.95e-10 5.88e-06 1.73e-05 2.44e-05 3.23e-05 ...
 $ p.adjust      : num  1.06e-07 6.29e-04 1.23e-03 1.31e-03 1.38e-03 ...
 $ qvalue        : num  1.04e-07 6.16e-04 1.21e-03 1.28e-03 1.35e-03 ...
 $ geneID        : chr  "8318/991/9133/10403/890/983/4085/81620/7272/9212/1111/9319/891/4174/9232" "991/9133/983/4085/51806/6790/891/9232/3708/5241" "2305/4605/9133/890/983/51806/1111/891/776/3708" "3627/10563/6373/4283/6362/6355/9547/1524" ...
 $ Count         : int  15 10 10 8 7 10
#...Citation
 T Wu, E Hu, S Xu, M Chen, P Guo, Z Dai, T Feng, L Zhou, W Tang, L Zhan, X Fu, S Liu, X Bo, and G Yu.
 clusterProfiler 4.0: A universal enrichment tool for interpreting omics data.
 The Innovation. 2021, 2(3):100141 

> 
> as.data.frame(res2)
                                     category
hsa04110                   Cellular Processes
hsa04114                   Cellular Processes
hsa04218                   Cellular Processes
hsa04061 Environmental Information Processing
hsa03320                   Organismal Systems
hsa04814                   Cellular Processes
                                 subcategory       ID
hsa04110               Cell growth and death hsa04110
hsa04114               Cell growth and death hsa04114
hsa04218               Cell growth and death hsa04218
hsa04061 Signaling molecules and interaction hsa04061
hsa03320                    Endocrine system hsa03320
hsa04814                       Cell motility hsa04814
                                                           Description
hsa04110                                                    Cell cycle
hsa04114                                                Oocyte meiosis
hsa04218                                           Cellular senescence
hsa04061 Viral protein interaction with cytokine and cytokine receptor
hsa03320                                        PPAR signaling pathway
hsa04814                                                Motor proteins
         GeneRatio  BgRatio RichFactor FoldEnrichment   zScore       pvalue
hsa04110    15/106 158/8842 0.09493671       7.919155 9.666494 4.951055e-10
hsa04114    10/106 139/8842 0.07194245       6.001086 6.546129 5.878161e-06
hsa04218    10/106 157/8842 0.06369427       5.313063 6.006176 1.726642e-05
hsa04061     8/106 100/8842 0.08000000       6.673208 6.284498 2.444647e-05
hsa03320     7/106  76/8842 0.09210526       7.682969 6.444999 3.232516e-05
hsa04814    10/106 197/8842 0.05076142       4.234269 5.056780 1.192289e-04
             p.adjust       qvalue
hsa04110 1.059526e-07 1.037116e-07
hsa04114 6.289633e-04 6.156601e-04
hsa04218 1.231671e-03 1.205620e-03
hsa04061 1.307886e-03 1.280223e-03
hsa03320 1.383517e-03 1.354254e-03
hsa04814 4.252499e-03 4.162554e-03
                                                                           geneID
hsa04110 8318/991/9133/10403/890/983/4085/81620/7272/9212/1111/9319/891/4174/9232
hsa04114                          991/9133/983/4085/51806/6790/891/9232/3708/5241
hsa04218                           2305/4605/9133/890/983/51806/1111/891/776/3708
hsa04061                                 3627/10563/6373/4283/6362/6355/9547/1524
hsa03320                                       4312/9415/9370/5105/2167/3158/5346
hsa04814                   9493/1062/81930/3832/3833/146909/10112/24137/4629/7802
         Count
hsa04110    15
hsa04114    10
hsa04218    10
hsa04061     8
hsa03320     7
hsa04814    10
> 
> 
> 
> ## FDR filter by qvalue only
> ## by setting pAdjustMethod = "none"
> res3 <- enrichKEGG(gene         = gene,
+                    organism     = 'hsa',
+                    pvalueCutoff = 0.05,
+                    qvalueCutoff = 0.05,
+                    pAdjustMethod = "none")
> 
> res3
#
# over-representation test
#
#...@organism    hsa 
#...@ontology    KEGG 
#...@keytype     kegg 
#...@gene        chr [1:207] "4312" "8318" "10874" "55143" "55388" "991" "6280" "2305" ...
#...pvalues adjusted by 'none' with cutoff <0.05 
#...7 enriched terms found
'data.frame':   7 obs. of  14 variables:
 $ category      : chr  "Cellular Processes" "Cellular Processes" "Cellular Processes" "Environmental Information Processing" ...
 $ subcategory   : chr  "Cell growth and death" "Cell growth and death" "Cell growth and death" "Signaling molecules and interaction" ...
 $ ID            : chr  "hsa04110" "hsa04114" "hsa04218" "hsa04061" ...
 $ Description   : chr  "Cell cycle" "Oocyte meiosis" "Cellular senescence" "Viral protein interaction with cytokine and cytokine receptor" ...
 $ GeneRatio     : chr  "15/106" "10/106" "10/106" "8/106" ...
 $ BgRatio       : chr  "158/8842" "139/8842" "157/8842" "100/8842" ...
 $ RichFactor    : num  0.0949 0.0719 0.0637 0.08 0.0921 ...
 $ FoldEnrichment: num  7.92 6 5.31 6.67 7.68 ...
 $ zScore        : num  9.67 6.55 6.01 6.28 6.44 ...
 $ pvalue        : num  4.95e-10 5.88e-06 1.73e-05 2.44e-05 3.23e-05 ...
 $ p.adjust      : num  4.95e-10 5.88e-06 1.73e-05 2.44e-05 3.23e-05 ...
 $ qvalue        : num  1.04e-07 6.16e-04 1.21e-03 1.28e-03 1.35e-03 ...
 $ geneID        : chr  "8318/991/9133/10403/890/983/4085/81620/7272/9212/1111/9319/891/4174/9232" "991/9133/983/4085/51806/6790/891/9232/3708/5241" "2305/4605/9133/890/983/51806/1111/891/776/3708" "3627/10563/6373/4283/6362/6355/9547/1524" ...
 $ Count         : int  15 10 10 8 7 10 7
#...Citation
 T Wu, E Hu, S Xu, M Chen, P Guo, Z Dai, T Feng, L Zhou, W Tang, L Zhan, X Fu, S Liu, X Bo, and G Yu.
 clusterProfiler 4.0: A universal enrichment tool for interpreting omics data.
 The Innovation. 2021, 2(3):100141 

> 
> as.data.frame(res3)
                                     category
hsa04110                   Cellular Processes
hsa04114                   Cellular Processes
hsa04218                   Cellular Processes
hsa04061 Environmental Information Processing
hsa03320                   Organismal Systems
hsa04814                   Cellular Processes
hsa04914                   Organismal Systems
                                 subcategory       ID
hsa04110               Cell growth and death hsa04110
hsa04114               Cell growth and death hsa04114
hsa04218               Cell growth and death hsa04218
hsa04061 Signaling molecules and interaction hsa04061
hsa03320                    Endocrine system hsa03320
hsa04814                       Cell motility hsa04814
hsa04914                    Endocrine system hsa04914
                                                           Description
hsa04110                                                    Cell cycle
hsa04114                                                Oocyte meiosis
hsa04218                                           Cellular senescence
hsa04061 Viral protein interaction with cytokine and cytokine receptor
hsa03320                                        PPAR signaling pathway
hsa04814                                                Motor proteins
hsa04914                       Progesterone-mediated oocyte maturation
         GeneRatio  BgRatio RichFactor FoldEnrichment   zScore       pvalue
hsa04110    15/106 158/8842 0.09493671       7.919155 9.666494 4.951055e-10
hsa04114    10/106 139/8842 0.07194245       6.001086 6.546129 5.878161e-06
hsa04218    10/106 157/8842 0.06369427       5.313063 6.006176 1.726642e-05
hsa04061     8/106 100/8842 0.08000000       6.673208 6.284498 2.444647e-05
hsa03320     7/106  76/8842 0.09210526       7.682969 6.444999 3.232516e-05
hsa04814    10/106 197/8842 0.05076142       4.234269 5.056780 1.192289e-04
hsa04914     7/106 111/8842 0.06306306       5.260411 4.975404 3.564744e-04
             p.adjust       qvalue
hsa04110 4.951055e-10 1.037116e-07
hsa04114 5.878161e-06 6.156601e-04
hsa04218 1.726642e-05 1.205620e-03
hsa04061 2.444647e-05 1.280223e-03
hsa03320 3.232516e-05 1.354254e-03
hsa04814 1.192289e-04 4.162554e-03
hsa04914 3.564744e-04 1.066743e-02
                                                                           geneID
hsa04110 8318/991/9133/10403/890/983/4085/81620/7272/9212/1111/9319/891/4174/9232
hsa04114                          991/9133/983/4085/51806/6790/891/9232/3708/5241
hsa04218                           2305/4605/9133/890/983/51806/1111/891/776/3708
hsa04061                                 3627/10563/6373/4283/6362/6355/9547/1524
hsa03320                                       4312/9415/9370/5105/2167/3158/5346
hsa04814                   9493/1062/81930/3832/3833/146909/10112/24137/4629/7802
hsa04914                                          9133/890/983/4085/6790/891/5241
         Count
hsa04110    15
hsa04114    10
hsa04218    10
hsa04061     8
hsa03320     7
hsa04814    10
hsa04914     7
> 

NOTE: I am using the development version of DOSE, and therefore more columns with results are returned (RichFactor, FoldEnrichment, and zScore). Yet, this is unrelated to the issue you observed!

See commit: YuLab-SMU/DOSE@98301d9

> packageVersion("DOSE")
[1] ‘3.31.2’
>

To obtain the results that are filtered on e.g. qvalue cutoff. you extract these through as.data.frame.
If you directly access the result slot using low-level @ accessor, then the UNfiltered results are accessed. This is what likely is visible in your screenshot in the first post.

> ## obtain filtered results.
> ## this is what end-user usually should do
> as.data.frame(res3)
                                     category                         subcategory       ID
hsa04110                   Cellular Processes               Cell growth and death hsa04110
hsa04114                   Cellular Processes               Cell growth and death hsa04114
hsa04218                   Cellular Processes               Cell growth and death hsa04218
hsa04061 Environmental Information Processing Signaling molecules and interaction hsa04061
hsa03320                   Organismal Systems                    Endocrine system hsa03320
hsa04814                   Cellular Processes                       Cell motility hsa04814
hsa04914                   Organismal Systems                    Endocrine system hsa04914
                                                           Description GeneRatio  BgRatio
hsa04110                                                    Cell cycle    15/106 158/8842
hsa04114                                                Oocyte meiosis    10/106 139/8842
hsa04218                                           Cellular senescence    10/106 157/8842
hsa04061 Viral protein interaction with cytokine and cytokine receptor     8/106 100/8842
hsa03320                                        PPAR signaling pathway     7/106  76/8842
hsa04814                                                Motor proteins    10/106 197/8842
hsa04914                       Progesterone-mediated oocyte maturation     7/106 111/8842
         RichFactor FoldEnrichment   zScore       pvalue     p.adjust       qvalue
hsa04110 0.09493671       7.919155 9.666494 4.951055e-10 4.951055e-10 1.037116e-07
hsa04114 0.07194245       6.001086 6.546129 5.878161e-06 5.878161e-06 6.156601e-04
hsa04218 0.06369427       5.313063 6.006176 1.726642e-05 1.726642e-05 1.205620e-03
hsa04061 0.08000000       6.673208 6.284498 2.444647e-05 2.444647e-05 1.280223e-03
hsa03320 0.09210526       7.682969 6.444999 3.232516e-05 3.232516e-05 1.354254e-03
hsa04814 0.05076142       4.234269 5.056780 1.192289e-04 1.192289e-04 4.162554e-03
hsa04914 0.06306306       5.260411 4.975404 3.564744e-04 3.564744e-04 1.066743e-02
                                                                           geneID Count
hsa04110 8318/991/9133/10403/890/983/4085/81620/7272/9212/1111/9319/891/4174/9232    15
hsa04114                          991/9133/983/4085/51806/6790/891/9232/3708/5241    10
hsa04218                           2305/4605/9133/890/983/51806/1111/891/776/3708    10
hsa04061                                 3627/10563/6373/4283/6362/6355/9547/1524     8
hsa03320                                       4312/9415/9370/5105/2167/3158/5346     7
hsa04814                   9493/1062/81930/3832/3833/146909/10112/24137/4629/7802    10
hsa04914                                          9133/890/983/4085/6790/891/5241     7
> 
> 
> ## directly access results using @
> ## this should NOT be done by end-user
> ## note that no filtering is applied!
> head(res3@result)
                                     category                         subcategory       ID
hsa04110                   Cellular Processes               Cell growth and death hsa04110
hsa04114                   Cellular Processes               Cell growth and death hsa04114
hsa04218                   Cellular Processes               Cell growth and death hsa04218
hsa04061 Environmental Information Processing Signaling molecules and interaction hsa04061
hsa03320                   Organismal Systems                    Endocrine system hsa03320
hsa04814                   Cellular Processes                       Cell motility hsa04814
                                                           Description GeneRatio  BgRatio
hsa04110                                                    Cell cycle    15/106 158/8842
hsa04114                                                Oocyte meiosis    10/106 139/8842
hsa04218                                           Cellular senescence    10/106 157/8842
hsa04061 Viral protein interaction with cytokine and cytokine receptor     8/106 100/8842
hsa03320                                        PPAR signaling pathway     7/106  76/8842
hsa04814                                                Motor proteins    10/106 197/8842
         RichFactor FoldEnrichment   zScore       pvalue     p.adjust       qvalue
hsa04110 0.09493671       7.919155 9.666494 4.951055e-10 4.951055e-10 1.037116e-07
hsa04114 0.07194245       6.001086 6.546129 5.878161e-06 5.878161e-06 6.156601e-04
hsa04218 0.06369427       5.313063 6.006176 1.726642e-05 1.726642e-05 1.205620e-03
hsa04061 0.08000000       6.673208 6.284498 2.444647e-05 2.444647e-05 1.280223e-03
hsa03320 0.09210526       7.682969 6.444999 3.232516e-05 3.232516e-05 1.354254e-03
hsa04814 0.05076142       4.234269 5.056780 1.192289e-04 1.192289e-04 4.162554e-03
                                                                           geneID Count
hsa04110 8318/991/9133/10403/890/983/4085/81620/7272/9212/1111/9319/891/4174/9232    15
hsa04114                          991/9133/983/4085/51806/6790/891/9232/3708/5241    10
hsa04218                           2305/4605/9133/890/983/51806/1111/891/776/3708    10
hsa04061                                 3627/10563/6373/4283/6362/6355/9547/1524     8
hsa03320                                       4312/9415/9370/5105/2167/3158/5346     7
hsa04814                   9493/1062/81930/3832/3833/146909/10112/24137/4629/7802    10
> 
> tail(res3@result)
                                     category                   subcategory       ID
hsa05014                       Human Diseases     Neurodegenerative disease hsa05014
hsa04714                   Organismal Systems      Environmental adaptation hsa04714
hsa04014 Environmental Information Processing           Signal transduction hsa04014
hsa05131                       Human Diseases Infectious disease: bacterial hsa05131
hsa04144                   Cellular Processes      Transport and catabolism hsa04144
hsa04740                   Organismal Systems                Sensory system hsa04740
                           Description GeneRatio  BgRatio  RichFactor FoldEnrichment
hsa05014 Amyotrophic lateral sclerosis     2/106 371/8842 0.005390836      0.4496771
hsa04714                 Thermogenesis     1/106 235/8842 0.004255319      0.3549578
hsa04014         Ras signaling pathway     1/106 238/8842 0.004201681      0.3504836
hsa05131                   Shigellosis     1/106 249/8842 0.004016064      0.3350004
hsa04144                   Endocytosis     1/106 252/8842 0.003968254      0.3310123
hsa04740        Olfactory transduction     1/106 453/8842 0.002207506      0.1841393
            zScore    pvalue  p.adjust    qvalue    geneID Count
hsa05014 -1.192846 0.9410369 0.9410369 0.9384057 2066/7802     2
hsa04714 -1.103935 0.9434525 0.9434525 0.9384057      5346     1
hsa04014 -1.118860 0.9455164 0.9455164 0.9384057     51806     1
hsa05131 -1.172454 0.9524653 0.9524653 0.9384057      3708     1
hsa04144 -1.186777 0.9542030 0.9542030 0.9384057     23362     1
hsa04740 -1.963620 0.9963352 0.9963352 0.9752618     51806     1
> 
> 

@nina-hahn
Copy link
Author

Dear Guido,

thanks a lot, this was really helpful! I tried with my data as well and it is working. Then, it is clear for me, why I am exporting enriched KEGG terms using write.csv with kk@result while DotPlots are not working. Since there are no significant terms and I am solely exporting unfiltered terms to csv. I guess, I should now export as.data.frame(kk) to a csv file.

One thing related: You mentioned that @Result should not be used by the enduser, since it shows unfiltered results. However, for similar functions e.g. gseGO it is working and the@result output is already filtered based on the chosen cut off values.

Best,
Nina

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