I have been slowly replacing biomaRt queries with the annotations in ensembldb. Basically to retrieve gene symbols, and gene locations, by querying with ensembl IDs. One thing that I could not find was how to retrieve "gene descriptions". Basic example on how to do it with biomaRt:
Sure, that information is also available within ensembldb's EnsDb databases. Ideally, you should get them from AnnotationHub as shown in the example below (thus you can get the EnsDb database for each species for any Ensembl release).
First we're getting the EnsDb for homo sapiens and Ensembl release 100:
> library(AnnotationHub)> ah <- AnnotationHub()
snapshotDate():2020-10-27> query(ah,"EnsDb.Hsapiens.v100")
AnnotationHub with 1 record
# snapshotDate(): 2020-10-27# names(): AH79689# $dataprovider: Ensembl# $species: Homo sapiens# $rdataclass: EnsDb# $rdatadateadded: 2020-04-27# $title: Ensembl 100 EnsDb for Homo sapiens# $description: Gene and protein annotations for Homo sapiens based on Ensem...# $taxonomyid: 9606# $genome: GRCh38# $sourcetype: ensembl# $sourceurl: http://www.ensembl.org# $sourcesize: NA# $tags: c("100", "AHEnsDbs", "Annotation", "EnsDb", "Ensembl", "Gene",# "Protein", "Transcript") # retrieve record with 'object[["AH79689"]]' > edb <- ah[["AH79689"]]
loading from cache
You can then get gene annotations using the genes method:
The gene description if available in metadata column "description". Note also that you could retrieve the results as a data.frame by setting parameter return.type ="data.frame".