enrichGO() error: unable to find an inherited method for function ‘keytypes’ for signature ‘"GRanges"’
0
0
Entering edit mode
3.6 years ago
Trinh • 0

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 )

clusterProfile • 3.2k views
ADD COMMENT
1
Entering edit mode

Hi Trinh,

I checked the AnnotationHub R documentation Here.

You can try CalbicansEntrez <- makeTxDbFromGRanges(CalbicansEntrez) before using enrichGO().

ADD REPLY
0
Entering edit mode

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.

library(rtracklayer) library(GenomicRanges) library(GenomicFeatures) library(clusterProfiler) library(AnnotationHub) hub <- AnnotationHub() query(hub, "Candida albicans") CalbicansEntrez <- hub[["AH74123"]] head(CalbicansEntrez) CalbicansEntrez <- makeTxDbFromGRanges(CalbicansEntrez)

demo <- c("3636627", "3643917", "3646558")

keytypes(CalbicansEntrez)

enrichGO( demo, OrgDb = CalbicansEntrez, keyType = "GENEID",
ont = "BP", pvalueCutoff = 0.05, pAdjustMethod = "BH", universe, qvalueCutoff = 0.2, minGSSize = 10, maxGSSize = 500, readable = TRUE, pool = FALSE )

Error in testForValidKeytype(x, keytype) : Invalid keytype: GOALL. Please use the keytypes method to see a listing of valid arguments.

ADD REPLY
1
Entering edit mode

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...

keytypes(CalbicansEntrez) 
[1] "CDSID"    "CDSNAME"  "EXONID"   "EXONNAME" "GENEID"   "TXID"     "TXNAME"

For details you can use functions like genes(), transcripts(), exons() to check

> genes(CalbicansEntrez) %>% head
GRanges object with 6 ranges and 1 metadata column:
                            seqnames      ranges strand |     gene_id
                               <Rle>   <IRanges>  <Rle> | <character>
  C1_00010W_B Ca22chr1B_C_albicans..   4059-4397      + | C1_00010W_B
  C1_00020C_B Ca22chr1B_C_albicans..   4409-4720      - | C1_00020C_B
  C1_00030C_B Ca22chr1B_C_albicans..   8597-8908      - | C1_00030C_B
  C1_00040W_B Ca22chr1B_C_albicans.. 10718-11485      + | C1_00040W_B
  C1_00050C_B Ca22chr1B_C_albicans.. 11648-11995      - | C1_00050C_B
  C1_00060W_B Ca22chr1B_C_albicans.. 12163-13701      + | C1_00060W_B
  -------
  seqinfo: 8 sequences from FungiDB-45_CalbicansSC5314_B genome; no seqlengths

...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 the makeTxDbFromGRanges part can be ommited.

ADD REPLY
0
Entering edit mode

I also repeat my code with demo 3 genes having in the database. It continue to have the same error. :(

C1_00010W_B Ca22chr1B_C_albicans.. 4059-4397 + | C1_00010W_B
C1_00020C_B Ca22chr1B_C_albicans.. 4409-4720 - | C1_00020C_B
C1_00030C_B Ca22chr1B_C_albicans.. 8597-8908 - | C1_00030C_B

ADD REPLY

Login before adding your answer.

Traffic: 1900 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6