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

problem in run compareCluster #669

Open
8 tasks
gongxin8888 opened this issue Feb 20, 2024 · 4 comments
Open
8 tasks

problem in run compareCluster #669

gongxin8888 opened this issue Feb 20, 2024 · 4 comments

Comments

@gongxin8888
Copy link

Hi Dr. Yu,

Here is my code:

Serumenricher <- compareCluster(geneCluster=Serum,
fun=enricher,
pvalueCutoff = 1,
minGSSize = 4,
maxGSSize = 500,
pAdjustMethod="BH",
TERM2GENE=path2comp,
TERM2NAME=path2Names
);

Serum is a list of KEGG ID
List of 7
$ blue : chr [1:20] "C16325" "C16353" "C11045" "D02381" ...
$ black : chr [1:6] "D07176" "C06869" "D07614" "C01921" ...
$ red : chr [1:7] "C01801" "C00486" "C02237" "C00078" ...
$ brown : chr [1:12] "C16651" "C16366" "C00486" "C00486" ...
$ turquoise: chr [1:19] "C01089" "C03601" "C00114" "D07690" ...
$ green : chr [1:17] "C00300" "C00791" "D03600" "C17935" ...
$ yellow : chr [1:12] "C11993" "C00939" "C07597" "C07597" ..

It failed with the following errors::

Error in fun(i, ...) : could not find function "fun"

Any suggestion?

Thanks

GongXin

Prerequisites

  • Have you read Feedback and followed the guide?
    • make sure you are using the latest release version
    • read the documentation
    • google your quesion/issue

Describe your issue

  • Make a reproducible example (e.g. 1)
  • your code should contain comments to describe the problem (e.g. what you expected and what actually happened)

Ask in the right place

  • for bugs or feature requests, post here (github issue)
  • for questions, please post to Bioconductor or Biostars with the tag clusterProfiler
@guidohooiveld
Copy link

Does it work with the example code (since your code as such is not reproducible)? What is your sessionInfo()?

> library(clusterProfiler)
> data(gcSample)
> xx <- compareCluster(gcSample, fun=enrichKEGG,
+                      organism="hsa", pvalueCutoff=0.05)
> xx
#
# Result of Comparing 8 gene clusters 
#
#.. @fun         enrichKEGG 
#.. @geneClusters       List of 8
 $ X1: chr [1:216] "4597" "7111" "5266" "2175" ...
 $ X2: chr [1:805] "23450" "5160" "7126" "26118" ...
 $ X3: chr [1:392] "894" "7057" "22906" "3339" ...
 $ X4: chr [1:838] "5573" "7453" "5245" "23450" ...
 $ X5: chr [1:929] "5982" "7318" "6352" "2101" ...
 $ X6: chr [1:585] "5337" "9295" "4035" "811" ...
 $ X7: chr [1:582] "2621" "2665" "5690" "3608" ...
 $ X8: chr [1:237] "2665" "4735" "1327" "3192" ...
#...Result      'data.frame':   76 obs. of  12 variables:
 $ Cluster    : Factor w/ 8 levels "X1","X2","X3",..: 2 2 2 3 3 3 4 4 4 4 ...
 $ category   : chr  "Human Diseases" "Human Diseases" "Cellular Processes" "Environmental Information Processing" ...
 $ subcategory: chr  "Infectious disease: viral" "Immune disease" "Cell growth and death" "Signaling molecules and interaction" ...
 $ ID         : chr  "hsa05169" "hsa05340" "hsa04110" "hsa04512" ...
 $ Description: chr  "Epstein-Barr virus infection" "Primary immunodeficiency" "Cell cycle" "ECM-receptor interaction" ...
 $ GeneRatio  : chr  "23/406" "8/406" "18/406" "9/193" ...
 $ BgRatio    : chr  "202/8662" "38/8662" "157/8662" "89/8662" ...
 $ pvalue     : num  6.83e-05 3.07e-04 3.83e-04 1.53e-04 3.29e-04 ...
 $ p.adjust   : num  0.0214 0.0399 0.0399 0.0362 0.0362 ...
 $ qvalue     : num  0.0199 0.0372 0.0372 0.0335 0.0335 ...
 $ geneID     : chr  "4067/3383/7128/1869/890/1871/578/864/637/9641/6891/355/9134/5971/916/956/6850/7187/3551/919/4734/958/6772" "100/6891/3932/973/916/925/958/64421" "991/1869/890/1871/701/990/10926/9088/8317/9700/9134/1029/2810/699/11200/23594/8555/4173" "7057/3339/1299/3695/1101/3679/3910/3696/3693" ...
 $ Count      : int  23 8 18 9 17 19 17 10 22 19 ...
#.. number of enriched terms found for each gene cluster:
#..   X1: 0 
#..   X2: 3 
#..   X3: 3 
#..   X4: 22 
#..   X5: 10 
#..   X6: 1 
#..   X7: 17 
#..   X8: 20 
#
#...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 

>

@gongxin8888
Copy link
Author

gongxin8888 commented Feb 22, 2024 via email

@guidohooiveld
Copy link

Happy to hear you got it somehow working, but to show for the record/archive that compareCluster also works with the generic function enricher:

> library(clusterProfiler)
> 
> ## load some example data
> data(gcSample)
> 
> ## manually download KEGG data; to be used as input for TERM2GENE and TERM2NAME
> kegg.data <- download_KEGG(species="hsa", keggType = "KEGG", keyType = "kegg")
Reading KEGG annotation online: "https://rest.kegg.jp/link/hsa/pathway"...
Reading KEGG annotation online: "https://rest.kegg.jp/list/pathway/hsa"...
> gene.sets <- kegg.data$KEGGPATHID2EXTID; colnames(gene.sets) <- c("PathwayID","GeneID")
> set.names <- kegg.data$KEGGPATHID2NAME; colnames(set.names) <- c("PathwayID","Description")
> 
> ## run compareCluster with generic function enricher
> yy <- compareCluster(geneClusters = gcSample,
+                      fun = "enricher",
+                      minGSSize = 10,
+                      maxGSSize = 500,
+                      pvalueCutoff = 1,
+                      pAdjustMethod = "BH",
+                      TERM2GENE = gene.sets[, c("PathwayID","GeneID") ], #proper order columns
+                      TERM2NAME = set.names[, c("PathwayID","Description") ]
+                      )
> 
> ## check
> yy
#
# Result of Comparing 8 gene clusters 
#
#.. @fun         enricher 
#.. @geneClusters       List of 8
 $ X1: chr [1:216] "4597" "7111" "5266" "2175" ...
 $ X2: chr [1:805] "23450" "5160" "7126" "26118" ...
 $ X3: chr [1:392] "894" "7057" "22906" "3339" ...
 $ X4: chr [1:838] "5573" "7453" "5245" "23450" ...
 $ X5: chr [1:929] "5982" "7318" "6352" "2101" ...
 $ X6: chr [1:585] "5337" "9295" "4035" "811" ...
 $ X7: chr [1:582] "2621" "2665" "5690" "3608" ...
 $ X8: chr [1:237] "2665" "4735" "1327" "3192" ...
#...Result      'data.frame':   226 obs. of  10 variables:
 $ Cluster    : Factor w/ 8 levels "X1","X2","X3",..: 1 1 1 2 2 2 2 2 2 2 ...
 $ ID         : chr  "hsa04061" "hsa05146" "hsa04060" "hsa05169" ...
 $ Description: chr  "Viral protein interaction with cytokine and cytokine receptor" "Amoebiasis" "Cytokine-cytokine receptor interaction" "Epstein-Barr virus infection" ...
 $ GeneRatio  : chr  "6/103" "6/103" "10/103" "23/406" ...
 $ BgRatio    : chr  "100/8661" "102/8661" "297/8661" "202/8661" ...
 $ pvalue     : num  1.18e-03 1.31e-03 2.72e-03 6.84e-05 3.08e-04 ...
 $ p.adjust   : num  0.1283 0.1283 0.1778 0.0214 0.04 ...
 $ qvalue     : num  0.1206 0.1206 0.1671 0.0199 0.0373 ...
 $ geneID     : chr  "6364/3559/2921/8793/3576/6374" "7850/2921/6317/3576/1281/22798" "7850/653/6364/3559/3595/2921/8793/10663/3576/6374" "4067/3383/7128/1869/890/1871/578/864/637/9641/6891/355/9134/5971/916/956/6850/7187/3551/919/4734/958/6772" ...
 $ Count      : int  6 6 10 23 8 18 22 13 12 14 ...
#.. number of enriched terms found for each gene cluster:
#..   X1: 3 
#..   X2: 20 
#..   X3: 5 
#..   X4: 76 
#..   X5: 48 
#..   X6: 4 
#..   X7: 36 
#..   X8: 34 
#
#...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 

> 

@gongxin8888
Copy link
Author

gongxin8888 commented Feb 23, 2024 via email

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