I want to get data from AnnotationHub and cluster it. However, I have a error in the enrichGO(): Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘keytypes’ for signature ‘"GRanges"’
Please help me, thank you very much!
library(clusterProfiler) library(AnnotationHub) hub <- AnnotationHub() query(hub, "Candida albicans") CalbicansEntrez <- hub[["AH74041"]] head(CalbicansEntrez)
demo <- c("3635832", "30515194", "3636627")
enrichGO( demo, OrgDb = CalbicansEntrez, keyType = "ENTREZID",
ont = "BP", pvalueCutoff = 0.05, pAdjustMethod = "BH", universe, qvalueCutoff = 0.2, minGSSize = 10, maxGSSize = 500, readable = TRUE, pool = FALSE )
Hi Trinh,
I checked the AnnotationHub R documentation Here.
You can try
CalbicansEntrez <- makeTxDbFromGRanges(CalbicansEntrez)
before usingenrichGO()
.Thank you so much, I have add your code. I think it worked. However, another error appear: When I run the code, it cannot match with keytype. I check the keytype and change to Genename, GeneID... however, it's not work.
If you know how to get the right keyType from ENTREZID or Genenames (B9J08_001380, B9J08_004112, B9J08_002819, B9J08_003276) for it, please help me.
I repeated your code and got the same error. I think it's because the
CalbicansEntrez
doesn't have enough annotation info.As you might have noticed that the output of
keytypes()
shows only...For details you can use functions like
genes(), transcripts(), exons()
to check...and you will find there's no enough annotation for your
demo
.FYI there's a similar question answered by GC.Yu (developer of clusterProfiler) here you can take a look.
BTW you can use
query(hub, "Candida albicans") %>% display
to choose your database, for instance"AH74762"
is in TxDb format so themakeTxDbFromGRanges
part can be ommited.I also repeat my code with demo 3 genes having in the database. It continue to have the same error. :(