The version of the annotation db must match with the genome used for mapping because the coordinates may differ for different genome releases. Therefore, if you used Mus_musculus.v103 for mapping, you'd best also use EnsDb.Mmusculus.v103 for annotation.
Below are 3 options to fetch the annotation files:
With AnnotationHub
library(AnnotationHub)
ah <- AnnotationHub()
EnsDb.Mmusculus <- query(ah, pattern = c("Mus musculus", "EnsDb"))
EnsDb.Mmusculus
EnsDb.Mmusculus.v101 <- EnsDb.Mmusculus[[length(EnsDb.Mmusculus)]]
class(EnsDb.Mmusculus.v101)
Note that AnnotationHub is not always up-to-date (it has v101 as the latest version as of 2021/03/06).
With ChIPpeakAnno::getAnnotation()
library(ChIPpeakAnno)
library(biomaRt)
listMarts()
mart <- useMart(biomart="ENSEMBL_MART_ENSEMBL", dataset="mmusculus_gene_ensembl")
Annotation <- getAnnotation(mart)
Note that getAnnotation() leverages biomart, which is always up-to-date.
Build your own EnsDb package (need extra effort)
There is a good tutorial on how to use makeEnsembldbPackage to generate EnsDb. It calls the Ensembl Perl API internally, and it may need some extra effort to set up the Perl environment.
Okay Thank you for the reply I will Try above mentioned methods.