problems annotating genes using org.Hs.eg.db
1
0
Entering edit mode
10 months ago
brtawe • 0

I am trying to use org.Hs.eg.db to annotate gene IDs extracted from calling genes on a TxDB as such

genes <- genes(TxDb.Hsapiens.UCSC.hg38.knownGene)
overlaps <-  join_overlap_left_directedmycoords.gr, genes)
gene_result = as(overlaps, "data.frame")

I used this code taken directly from here https://www.bioconductor.org/packages/release/bioc/vignettes/AnnotationDbi/inst/doc/IntroToAnnotationPackages.pdf

annots <- select(org.Hs.eg.db, keys=gene_result$gene_id,
             columns=c("SYMBOL","GENENAME"), keytype="ENTREZID")

But I get the following error message

Error in UseMethod("select_") : no applicable method for 'select_' applied to an object of class "c('OrgDb', 'AnnotationDb', 'envRefClass', '.environment', 'refClass', 'environment', 'refObject', 'AssayData')"

Any help or an alternate method would be appreciated.

R • 949 views
ADD COMMENT
0
Entering edit mode

What is the output of str(gene_result)?

ADD REPLY
0
Entering edit mode

It's a data frame made from a GRanges object

gene_result = as(overlaps, "data.frame") #convert GRanges object to data frame

problem fixed via other comment, thanks for your help anyway!

ADD REPLY
3
Entering edit mode
10 months ago

There are a few common packages with the select function, so try to explicitly state the correct namespace so R knows what library to use.

annots <- AnnotationDbi::select(
  org.Hs.eg.db, keys=gene_result$gene_id,
  columns=c("SYMBOL","GENENAME"), keytype="ENTREZID"
)
ADD COMMENT
0
Entering edit mode

This fixed it, thanks! I thought this might be the problem since dplyr uses "select" as well. I did not know how to specify functions to packages, this is good knowledge.

I should probably have included all the packages I was using, but the interface here only allows me to add one line of code at a time (or I don't know how to add multiple lines), so I only included what I thought was essential.

ADD REPLY
1
Entering edit mode

Moved to an answer. Please upvote / Accept.

ADD REPLY

Login before adding your answer.

Traffic: 2500 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