I am trying to use AnnotationDbi to map Ensembl IDs to GeneIDs for an RNAseq experiment, but I keep coming up with an error.
Starting from a new R session, I install and load the genome package.
>BiocManager::install("BSgenome.Hsapiens.UCSC.hg19")
>library(BSgenome.Hsapiens.UCSC.hg19)
> ls("package:BSgenome.Hsapiens.UCSC.hg19")
[1] "BSgenome.Hsapiens.UCSC.hg19"
However, when I try to see what keytypes or columns are available, I get an error:
> keytypes(BSgenome.Hsapiens.UCSC.hg19)
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function 'keytypes' for signature '"BSgenome"'
> AnnotationDbi::columns(BSgenome.Hsapiens.UCSC.hg19)
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function 'columns' for signature '"BSgenome"'
I cannot proceed with mapping the GeneIDs if the keys and columns functions do not work. Is there something I'm missing? Any advice would be greatly appreciated!
>sessionInfo( )
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
attached base packages:
[1] stats4 stats graphics grDevices utils datasets methods base
other attached packages:
[1] AnnotationDbi_1.60.0 Biobase_2.58.0 BSgenome.Hsapiens.UCSC.hg19.masked_1.3.993
[4] BSgenome.Hsapiens.UCSC.hg19_1.4.3 BSgenome_1.66.3 rtracklayer_1.58.0
[7] Biostrings_2.66.0 XVector_0.38.0 GenomicRanges_1.50.2
[10] GenomeInfoDb_1.34.9 IRanges_2.32.0 S4Vectors_0.36.1
[13] BiocGenerics_0.44.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.10 locfit_1.5-9.7 lattice_0.20-45 Rsamtools_2.14.0 png_0.1-8
[6] utf8_1.2.3 R6_2.5.1 RSQLite_2.2.20 httr_1.4.7 ggplot2_3.4.2
[11] pillar_1.9.0 zlibbioc_1.44.0 rlang_1.1.1 rstudioapi_0.15.0 annotate_1.76.0
[16] blob_1.2.4 Matrix_1.5-3 BiocParallel_1.32.5 geneplotter_1.76.0 RCurl_1.98-1.10
[21] bit_4.0.5 munsell_0.5.0 DelayedArray_0.23.2 compiler_4.2.2 pkgconfig_2.0.3
[26] tidyselect_1.2.0 KEGGREST_1.38.0 SummarizedExperiment_1.28.0 tibble_3.2.1 GenomeInfoDbData_1.2.9
[31] codetools_0.2-19 matrixStats_0.63.0 XML_3.99-0.13 fansi_1.0.4 crayon_1.5.2
[36] dplyr_1.1.2 GenomicAlignments_1.34.1 bitops_1.0-7 grid_4.2.2 xtable_1.8-4
[41] gtable_0.3.4 lifecycle_1.0.3 DBI_1.1.3 magrittr_2.0.3 scales_1.2.1
[46] cli_3.6.0 cachem_1.0.6 vctrs_0.6.3 generics_0.1.3 rjson_0.2.21
[51] restfulr_0.0.15 RColorBrewer_1.1-3 tools_4.2.2 bit64_4.0.5 glue_1.6.2
[56] DESeq2_1.38.3 MatrixGenerics_1.10.0 parallel_4.2.2 fastmap_1.1.0 yaml_2.3.7
[61] colorspace_2.1-0 BiocManager_1.30.21 memoise_2.0.1 BiocIO_1.8.0

Yes, I meant I wanted to generate the HUGO symbols for each gene, so I'll go ahead and use EnsDb. I am getting the same error when I use this database though. It installs fine, but I cannot use arguments such as 'select' or 'keys' etc.
It looks like you loaded some tidyverse package(s) after having loaded
AnnotationHub. In which case you will have to use the qualified name of the function.This worked, thank you!