Yes, please have a look at the excellent ENSEMBL-based annotation packages Johannes Rainer provides through the AnnotationHub
!
See below for some code to get you started. Note that I am using ENSEMBL v100, but if needed you can easily create a EnsDb for another ENSEMBL version!
> # if needed, install required libraries.
> BiocManager::install(c("AnnotationHub", "ensembldb", "AnnotationForge")
>
> library(AnnotationHub)
> library(ensembldb)
> library(AnnotationForge)
>
> # start an AnnotationHub instance/connection.
> ah <- AnnotationHub()
snapshotDate(): 2020-04-27
>
> # query for availabel Rat Ensembl databases
> EnsDb.rat <- query(ah, c("EnsDb", "Rattus norvegicus"))
> EnsDb.rat
AnnotationHub with 14 records
# snapshotDate(): 2020-04-27
# $dataprovider: Ensembl
# $species: Rattus norvegicus
# $rdataclass: EnsDb
# additional mcols(): taxonomyid, genome, description,
# coordinate_1_based, maintainer, rdatadateadded, preparerclass, tags,
# rdatapath, sourceurl, sourcetype
# retrieve records with, e.g., 'object[["AH53239"]]'
title
AH53239 | Ensembl 87 EnsDb for Rattus Norvegicus
AH53743 | Ensembl 88 EnsDb for Rattus Norvegicus
AH56709 | Ensembl 89 EnsDb for Rattus Norvegicus
AH57792 | Ensembl 90 EnsDb for Rattus Norvegicus
AH60814 | Ensembl 91 EnsDb for Rattus Norvegicus
... ...
AH69261 | Ensembl 96 EnsDb for Rattus norvegicus
AH73956 | Ensembl 97 EnsDb for Rattus norvegicus
AH75088 | Ensembl 98 EnsDb for Rattus norvegicus
AH78871 | Ensembl 99 EnsDb for Rattus norvegicus
AH79776 | Ensembl 100 EnsDb for Rattus norvegicus
>
> # Fetch the v100 EnsDb and put it in the cache.
> EnsDb.rat <- EnsDb.rat[["AH79776"]]
>
> #check
> columns(EnsDb.rat)
[1] "DESCRIPTION" "ENTREZID" "EXONID"
[4] "EXONIDX" "EXONSEQEND" "EXONSEQSTART"
[7] "GCCONTENT" "GENEBIOTYPE" "GENEID"
<<snip>>
>
>
> # Now copy, and install the database locally.
> # By doing so, you can just quickly load the library next time.
> # see: ?makeEnsembldbPackage
>
> #set working dir to store the relaively large files.
> setwd("E:\\myDir")
>
> #copy databse from the cache to working dir
> file.copy(AnnotationHub::cache(ah["AH79776"]), "./EnsDb.rat.sqlite")
[1] TRUE
>
> # now make it a package. Change name and email accordingly
> makeEnsembldbPackage("EnsDb.rat.sqlite", version="0.0.1",
+ maintainer = "First Name <first.last@mydomain.com>",
+ author = "First Name <first.last@mydomain.com>",
+ destDir=".", license="Artistic-2.0")
Creating package in ./EnsDb.Rnorvegicus.v100
[1] TRUE
>
>
> # install package in R.
> # note modifed name of created directory (not EnsDb.rat... but EnsDb.Rnorvegicus.v100)
> install.packages("./EnsDb.Rnorvegicus.v100", type = "source", repos = NULL)
* installing *source* package 'EnsDb.Rnorvegicus.v100' ...
** using staged installation
* DONE (EnsDb.Rnorvegicus.v100)
>
> #check:
> library(EnsDb.Rnorvegicus.v100)
> EnsDb.Rnorvegicus.v100
EnsDb for Ensembl:
|Backend: SQLite
|Db type: EnsDb
|Type of Gene ID: Ensembl Gene ID
|Supporting package: ensembldb
|Db created by: ensembldb package from Bioconductor
|script_version: 0.3.5
|Creation time: Sat May 2 05:29:36 2020
|ensembl_version: 100
|ensembl_host: localhost
|Organism: Rattus norvegicus
|taxonomy_id: 10116
|genome_build: Rnor_6.0
|DBSCHEMAVERSION: 2.1
| No. of genes: 32883.
| No. of transcripts: 41078.
|Protein data available.
>
> columns(EnsDb.Rnorvegicus.v100)
[1] "DESCRIPTION" "ENTREZID" "EXONID"
<<snip>>
[37] "UNIPROTID" "UNIPROTMAPPINGTYPE"
>
Below some code to create 'an-easy-to-transport' package from it (didn't fit in answer above).
You can then install the packages (see remarks James below). :-)
Don't forget the installation!
And now you can load like any package.