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

Universal background gene list used in enricher function #62

Open
merckey opened this issue Jan 12, 2022 · 1 comment
Open

Universal background gene list used in enricher function #62

merckey opened this issue Jan 12, 2022 · 1 comment

Comments

@merckey
Copy link

merckey commented Jan 12, 2022

Dear Guangchuang,
Big fan of all the R suites your group develop!
I have a question regarding the universal gene list used in the enricher function for the Over Representation Analysis.

Test enrichment overall all the GSEA Hallmark genesets and didn't supply a background universe gene list. My understanding is that the program will generate a "universal" list using the TMER2GENE list.

library(clusterProfiler)
library(msigdbr)

genesets = msigdbr(species = "Homo sapiens", category = "H")
h = genesets  %>% dplyr::select(gs_name, gene_symbol)

# randomly select some genes as input
set.seed(1)
sel_genes = sample(h$gene_symbol,20)

# test on all hallmark genesets
egmt.h <- enricher(sel_genes, TERM2GENE=h, pvalueCutoff = 1,qvalueCutoff=0.05,maxGSSize = 3000)
egmt.h@result$BgRatio[1]

However, when I try to test enrichment overall a selected GSEA Hallmark geneset with a universe gene list manually created from hallmark genesets, it reported the following error.

# test only HALLMARK_ADIPOGENESIS gene set.
egmt.h.single <- enricher(sel_genes, TERM2GENE=h[h$gs_name=="HALLMARK_ADIPOGENESIS",],pvalueCutoff = 1,qvalueCutoff=0.05,maxGSSize = 3000,universe = unique(h$gene_symbol))

# with the following error.
--> No gene can be mapped....
--> Expected input gene ID: CAVIN1,LAMA4,NDUFA5,GPD2,SLC27A1,CAT
--> return NULL...

So I checked the code for this function and found that the universe gene list is not used as background gene for the statistical test. Please correct me if I'm wrong.

Thank you for your help!

Jin

extID <- intersect(extID, universe)

R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS

Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.8.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 
 clusterProfiler_4.2.1


loaded via a namespace (and not attached):

DOSE_3.20.1 

@GuangchuangYu
Copy link
Member

The universe passed by the user is indeed used as a background for enrichment analysis.

Your issue cannot be reproduced, see the following screenshot:

image

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