AnnotationDbi Errors: unable to find an inherited method for function 'select' for signature 'character'.
1
0
Entering edit mode
@hinaabbasbandukwala-23752
Last seen 3.1 years ago
Pakistan

Hello,

I have been trying to use AnnotationDbi to map EntrezIDs to corresponding GeneIDs but I keep running into problems.

library(org.Mm.eg.db)
Mm <- org.Mm.eg.db

 gene_annos <- AnnotationDbi::select(Mm, keys = f_peakAnno_mappings$Genes, columns = c("ENTREZID", "SYMBOL"), keytype = "ENTREZID")

Where 'fpeakAnnomappings' is a data frame with a column called 'Genes' that contains EntrezIDs that need to be mapped. Genes
1 497097
2 497097
3 497097
4 497097
5 497097
6 497097

The Error I get is:

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘select’ for signature ‘"character"’

I originally thought that this may be due to namespace errors with the package 'ChIPseeker', have tried restarting R session and loading AnnotationDbi without Chipseeker as well, but it did not work.

My session_info():

R version 4.0.2 (2020-06-22)

Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Catalina 10.15.4

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale: [1] enCA.UTF-8/enCA.UTF-8/enCA.UTF-8/C/enCA.UTF-8/en_CA.UTF-8

attached base packages: [1] parallel stats4 stats graphics grDevices utils datasets methods base

other attached packages: [1] biomaRt2.44.1 org.Mm.eg.db3.11.4 AnnotationDbi1.50.3 IRanges2.22.2 S4Vectors0.26.1 Biobase2.48.0 BiocGenerics0.34.0 dplyr1.0.1

loaded via a namespace (and not attached): [1] reticulate1.16 tidyselect1.1.0 RSQLite2.2.0 htmlwidgets1.5.1
[5] grid4.0.2 BiocParallel1.22.0 Rtsne0.15 scatterpie0.1.4
[9] munsell0.5.0 codetools0.2-16 ica1.0-2 future1.18.0
[13] miniUI0.1.1.1 colorspace1.4-1 GOSemSim2.14.1 knitr1.29
[17] rstudioapi0.11 Seurat3.2.0 ROCR1.0-11 tensor1.5
[21] DOSE3.14.0 listenv0.8.0 urltools1.7.3 GenomeInfoDbData1.2.3
[25] polyclip1.10-0 bit644.0.2 farver2.0.3 downloader0.4
[29] vctrs0.3.2 generics0.0.2 xfun0.16 BiocFileCache1.12.0
[33] R62.4.1 GenomeInfoDb1.24.2 graphlayouts0.7.0 rsvd1.0.3
[37] bitops1.0-6 spatstat.utils1.17-0 fgsea1.14.0 gridGraphics0.5-0
[41] DelayedArray0.14.1 assertthat0.2.1 promises1.1.1 scales1.1.1
[45] ggraph2.0.3 enrichplot1.8.1 gtable0.3.0 globals0.12.5
[49] goftest1.2-2 tidygraph1.2.0 rlang0.4.7 splines4.0.2
[53] rtracklayer1.48.0 lazyeval0.2.2 europepmc0.4 BiocManager1.30.10
[57] reshape21.4.4 abind1.4-5 GenomicFeatures1.40.1 httpuv1.5.4
[61] qvalue2.20.0 clusterProfiler3.16.0 tools4.0.2 ggplotify0.0.5
[65] ggplot23.3.2 gplots3.0.4 ellipsis0.3.1 RColorBrewer1.1-2
[69] ggridges0.5.2 Rcpp1.0.5 plyr1.8.6 progress1.2.2
[73] zlibbioc1.34.0 purrr0.3.4 RCurl1.98-1.2 prettyunits1.1.1
[77] rpart4.1-15 openssl1.4.2 deldir0.1-28 pbapply1.4-2
[81] viridis0.5.1 cowplot1.0.0 zoo1.8-8 SummarizedExperiment1.18.2
[85] ggrepel0.8.2 cluster2.1.0 magrittr1.5 data.table1.13.0
[89] DO.db2.9 lmtest0.9-37 triebeard0.3.0 RANN2.6.1
[93] fitdistrplus1.1-1 matrixStats0.56.0 hms0.5.3 patchwork1.0.1
[97] mime0.9 xtable1.8-4 XML3.99-0.5 gridExtra2.3
[101] compiler4.0.2 tibble3.0.3 KernSmooth2.23-17 crayon1.3.4
[105] htmltools0.5.0 mgcv1.8-31 later1.1.0.1 tidyr1.1.1
[109] DBI1.1.0 tweenr1.0.1 ChIPseeker1.24.0 dbplyr1.4.4
[113] MASS7.3-51.6 rappdirs0.3.1 boot1.3-25 Matrix1.2-18
[117] gdata2.18.0 igraph1.2.5 TxDb.Hsapiens.UCSC.hg19.knownGene3.2.2 GenomicRanges1.40.0
[121] pkgconfig2.0.3 rvcheck0.1.8 GenomicAlignments1.24.0 plotly4.9.2.1
[125] xml21.3.2 XVector0.28.0 stringr1.4.0 digest0.6.25
[129] sctransform0.2.1 RcppAnnoy0.0.16 spatstat.data1.4-3 Biostrings2.56.0
[133] leiden0.3.3 fastmatch1.1-0 uwot0.1.8 curl4.3
[137] gtools3.8.2 shiny1.5.0 Rsamtools2.4.0 lifecycle0.2.0
[141] nlme3.1-148 jsonlite1.7.0 viridisLite0.3.0 askpass1.1
[145] pillar1.4.6 lattice0.20-41 plotrix3.7-8 fastmap1.0.1
[149] httr1.4.2 survival3.2-3 GO.db3.11.4 glue1.4.1
[153] spatstat1.64-1 png0.1-7 bit4.0.4 ggforce0.3.2
[157] stringi1.4.6 blob1.2.1 caTools1.18.0 memoise1.1.0
[161] irlba2.3.3 future.apply1.6.0 ape_5.4

Any help will be greatly appreciated! Hina

AnnotationDbi • 9.7k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 8 hours ago
United States

I think the code you supply might not be exactly what you tried. In other words, compare:

> Mm <- org.Mm.eg.db
> Mm2 <- "org.Mm.eg.db"
> select(Mm, head(keys(Mm)), c("ENTREZID","SYMBOL"), "ENTREZID")
'select()' returned 1:1 mapping between keys and columns
  ENTREZID SYMBOL
1    11287    Pzp
2    11298  Aanat
3    11302   Aatk
4    11303  Abca1
5    11304  Abca4
6    11305  Abca2
> select(Mm2, head(keys(Mm)), c("ENTREZID","SYMBOL"), "ENTREZID")
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function 'select' for signature '"character"'
ADD COMMENT
0
Entering edit mode

Hi James,

Mm <- org.Mm.eg.db
Mm2 <- "org.Mm.eg.db"

Iteration 1:

select(Mm, head(keys(Mm)), c("ENTREZID","SYMBOL"), "ENTREZID")

Error:

Error in select(Mm, head(keys(Mm)), c("ENTREZID", "SYMBOL"), "ENTREZID") :

could not find function "select"

Iteration 2:

AnnotationDbi::select(Mm, head(keys(Mm)), c("ENTREZID","SYMBOL"), "ENTREZID")

Error:

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘select’ for signature ‘"character"’

Iteration 3:

AnnotationDbi::select(Mm2, head(keys(Mm)), c("ENTREZID","SYMBOL"), "ENTREZID")

Error:

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘select’ for signature ‘"character"’

I don't think it is a matter or org.Mm.eg.db vs "org.Mm.eg.db" this time, unless I am missing something.

ADD REPLY
0
Entering edit mode

R is pretty convinced your Mm object is character. What happens if you do

> Mm <- org.Mm.eg.db
> Mm
OrgDb object:
| DBSCHEMAVERSION: 2.1
| Db type: OrgDb
| Supporting package: AnnotationDbi
| DBSCHEMA: MOUSE_DB
| ORGANISM: Mus musculus
| SPECIES: Mouse
| EGSOURCEDATE: 2019-Jul10
| EGSOURCENAME: Entrez Gene
| EGSOURCEURL: ftp://ftp.ncbi.nlm.nih.gov/gene/DATA
| CENTRALID: EG
| TAXID: 10090
| GOSOURCENAME: Gene Ontology
| GOSOURCEURL: http://current.geneontology.org/ontology/go-basic.obo
| GOSOURCEDATE: 2020-05-02
| GOEGSOURCEDATE: 2019-Jul10
| GOEGSOURCENAME: Entrez Gene
| GOEGSOURCEURL: ftp://ftp.ncbi.nlm.nih.gov/gene/DATA
| KEGGSOURCENAME: KEGG GENOME
| KEGGSOURCEURL: ftp://ftp.genome.jp/pub/kegg/genomes
| KEGGSOURCEDATE: 2011-Mar15
| GPSOURCENAME: UCSC Genome Bioinformatics (Mus musculus)
| GPSOURCEURL: 
| GPSOURCEDATE: 2019-Sep3
| ENSOURCEDATE: 2019-Dec11
| ENSOURCENAME: Ensembl
| ENSOURCEURL: ftp://ftp.ensembl.org/pub/current_fasta
| UPSOURCENAME: Uniprot
| UPSOURCEURL: http://www.UniProt.org/
| UPSOURCEDATE: Wed May  6 17:50:20 2020

Please see: help('select') for usage information

> AnnotationDbi::select(Mm, head(keys(Mm)), c("ENTREZID","SYMBOL"))
'select()' returned 1:1 mapping between keys and columns
  ENTREZID SYMBOL
1    11287    Pzp
2    11298  Aanat
3    11302   Aatk
4    11303  Abca1
5    11304  Abca4
6    11305  Abca2

> head(keys(Mm))
[1] "11287" "11298" "11302" "11303" "11304" "11305"
ADD REPLY
0
Entering edit mode

Or better yet, quit with the renaming and just do

select(org.Mm.eg.db, head(keys(org.Mm.eg.db)), c("ENTREZID","SYMBOL"))

ADD REPLY
0
Entering edit mode

Hi James,

I just retried what you suggested after restarting my R session and removing all variables from my working environment but I am still getting the same error.

Mm <- org.Mm.eg.db
AnnotationDbi::select(org.Mm.eg.db, head(keys(org.Mm.eg.db)), c("ENTREZID","SYMBOL"))

Error:

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘select’ for signature ‘"character"’

When I look at Mm, this is what I get:

Mm

[1] "org.Mm.eg.db" "dplyr" "ggplot2" "gplots" "IHW" "apeglm"
[7] "biomaRt" "EnsDb.Mmusculus.v79" "readr" "tximport" "RColorBrewer" "DESeq2"
[13] "SummarizedExperiment" "DelayedArray" "BiocParallel" "matrixStats" "ensembldb" "AnnotationFilter"
[19] "GenomicFeatures" "AnnotationDbi" "Biobase" "GenomicRanges" "GenomeInfoDb" "IRanges"
[25] "S4Vectors" "stats4" "BiocGenerics" "parallel" "stats" "graphics"
[31] "grDevices" "utils" "datasets" "methods" "base"

When I look at keys:

keys(org.Mm.eg.db)

I get the same error:

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘keys’ for signature ‘"character"’
#

# # # # # Btw I am not sure if this is helpful but when I load the library, the output looks like this:

library(org.Mm.eg.db)

Loading required package: AnnotationDbi Loading required package: stats4 Loading required package: BiocGenerics Loading required package: parallel

Attaching package: ‘BiocGenerics’

The following objects are masked from ‘package:parallel’:

clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply,
parSapply, parSapplyLB

The following objects are masked from ‘package:stats’:

IQR, mad, sd, var, xtabs

The following objects are masked from ‘package:base’:

anyDuplicated, append, as.data.frame, basename, cbind, colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep, grepl,
intersect, is.unsorted, lapply, Map, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, Reduce,
rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min

Loading required package: Biobase Welcome to Bioconductor

Vignettes contain introductory material; view with 'browseVignettes()'. To cite Bioconductor, see 'citation("Biobase")', and for packages
'citation("pkgname")'.

Loading required package: IRanges Loading required package: S4Vectors

Attaching package: ‘S4Vectors’

The following object is masked from ‘package:base’:

expand.grid

Attaching package: ‘org.Mm.eg.db’

The following object is masked by ‘.GlobalEnv’:

org.Mm.eg.db

Do you think this "The following object is masked by ‘.GlobalEnv’: org.Mm.eg.db" means anything?

ADD REPLY
0
Entering edit mode

Hi James,

The issue is finally solved.

I removed all variables from my current working environment, reloaded the library, and tried the following:

rm(list=ls())
library(org.Mm.eg.db)
AnnotationDbi::select(org.Mm.eg.db, head(keys(org.Mm.eg.db)), c("ENTREZID","SYMBOL"))

Output:

'select()' returned 1:1 mapping between keys and columns

In conclusion, not renaming 'org.Mm.eg.db' as 'Mm' made the function work, most probably because it is no longer being masked by ‘.GlobalEnv’.

Thanks for your help.

ADD REPLY
0
Entering edit mode

You had a character vector, probably in a saved workspace (which is why I never save workspaces!) called org.Mm.eg.db, that contained a bunch of package names.

There is no reason why you should have anything like that, which is why I didn't think to ask. This is what the masking warning you see is telling you. As an example:

> org.Mm.eg.db <- "this is not a thing"
> library(org.Mm.eg.db)
Loading required package: AnnotationDbi
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    anyDuplicated, append, as.data.frame, basename, cbind, colnames,
    dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
    grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
    rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which, which.max, which.min

Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: IRanges
Loading required package: S4Vectors

Attaching package: 'S4Vectors'

The following object is masked from 'package:base':

    expand.grid


Attaching package: 'IRanges'

The following object is masked from 'package:grDevices':

    windows



Attaching package: 'org.Mm.eg.db'

The following object is masked _by_ '.GlobalEnv':

    org.Mm.eg.db

> select(org.Mm.eg.db, "2345", "SYMBOL")
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function 'select' for signature '"character"'

ADD REPLY

Login before adding your answer.

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