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
Hi James,
Iteration 1:
Error:
could not find function "select"
Iteration 2:
Error:
Iteration 3:
Error:
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.
R is pretty convinced your
Mm
object is character. What happens if you doOr better yet, quit with the renaming and just do
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.
Error:
When I look at Mm, this is what I get:
[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:
I get the same error:
#
# # # # # Btw I am not sure if this is helpful but when I load the library, the output looks like this:
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’:
The following objects are masked from ‘package:stats’:
The following objects are masked from ‘package:base’:
Loading required package: Biobase Welcome to Bioconductor
Loading required package: IRanges Loading required package: S4Vectors
Attaching package: ‘S4Vectors’
The following object is masked from ‘package:base’:
Attaching package: ‘org.Mm.eg.db’
The following object is masked by ‘.GlobalEnv’:
Do you think this "The following object is masked by ‘.GlobalEnv’: org.Mm.eg.db" means anything?
Hi James,
The issue is finally solved.
I removed all variables from my current working environment, reloaded the library, and tried the following:
Output:
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.
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: