Question: problems annotating genes using org.Hs.eg.db
0
gravatar for brtawe
7 weeks ago by
brtawe0
brtawe0 wrote:

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 • 127 views
ADD COMMENTlink written 7 weeks ago by brtawe0

What is the output of str(gene_result)?

ADD REPLYlink written 7 weeks ago by Kevin Blighe71k

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 REPLYlink written 7 weeks ago by brtawe0
1
gravatar for rpolicastro
7 weeks ago by
rpolicastro4.1k
Bloomington, IN
rpolicastro4.1k wrote:

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 COMMENTlink written 7 weeks ago by rpolicastro4.1k

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 REPLYlink written 7 weeks ago by brtawe0
1

Moved to an answer. Please upvote / Accept.

ADD REPLYlink written 7 weeks ago by Kevin Blighe71k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1552 users visited in the last hour
_