YuLab-SMU / clusterProfiler

:bar_chart: A universal enrichment tool for interpreting omics data
https://yulab-smu.top/biomedical-knowledge-mining-book/
1.02k stars 256 forks source link

defining background universe produces error #265

Open ahdee opened 4 years ago

ahdee commented 4 years ago

Hi when I use the enricher function by trying to define my background it produces the following warning... `universe is not in character and will be ignored...`

basically I have a list of pathways I'm interested in however I want to make sure that the background contains NOT only genes present in those pathways but for my entire dataset. For example say I'm only interested in testing reactome pathways but I want to make sure that the background is not just pulled from the genes in reactome but all the genes in my dataset.

enricher(dge$entrezgene_id, TERM2GENE=   pathway.p
              , universe = all$entrezgene_id
              , minGSSize=1)

thanks!

daviddolan commented 4 years ago

I am also having this trouble when using enrichGO on a set of old mirco-array results in which I need to limit the universe to only the genes that were present on the chip.

I loaded in the human genome database org.Hs.eg.db and was using Entrez IDs

egoBPup <- enrichGO(gene=up, universe=uni, OrgDb = org.Hs.eg.db, ont = "BP", pAdjustMethod = "BH", pvalueCutoff = 0.05, keyType = "ENTREZID", readable = T)

and also received the error

universe is not in character and will be ignored.

It looks to possibly be related to an older issue https://github.com/YuLab-SMU/clusterProfiler/issues/217 in which an old function in IRanges called universe was causing trouble.

However as it stands over representation on limited gene universes is not possible

All the best

David David

peranti commented 4 years ago

@GuangchuangYu Hi, Thanks for the package!

Does this fix means: the function takes the background into account and ignores the fact that the background is not a character object?

Or, the background information provided will be ignored too?

davetang commented 3 years ago

Check the class of the universe vector (and your gene vector) and make sure the class is character.

For example:

enricher(
   gene = as.character(dge$entrezgene_id),
   TERM2GENE = pathway.p,
   universe = as.character(all$entrezgene_id),
   minGSSize=1
)