Record a preferred OrgDb package to use when functions such as annotateWindows() are called without an explicit annoDb.

setMesaAnnoDb(annoDb)

Arguments

annoDb

character(1) or NULL. Name of an installed OrgDb package (e.g., "org.Hs.eg.db" or "org.Mm.eg.db"), or NULL to clear the setting. The package must be installed if a string is supplied. Default: none (must be supplied).

Value

Invisibly returns TRUE on success.

Details

This sets the session option options(mesa_annoDb = <annoDb>). When present, helpers like annotateWindows() will use this OrgDb by default (particularly for GRCh38 workflows) unless an explicit annoDb is provided. Use setMesaGenome() and setMesaTxDb() to configure complementary defaults for the genome and TxDb, respectively.

Examples

# Set default annoDb for human (only if the package is installed)
if (requireNamespace("org.Hs.eg.db", quietly = TRUE)) {
    setMesaAnnoDb("org.Hs.eg.db")
    getOption("mesa_annoDb")
}
#> [1] "org.Hs.eg.db"

# Set default annoDb for mouse (only if the package is installed)
if (requireNamespace("org.Mm.eg.db", quietly = TRUE)) {
    setMesaAnnoDb("org.Mm.eg.db")
    getOption("mesa_annoDb")
}
#> [1] "org.Mm.eg.db"

# Unset the default annoDb
setMesaAnnoDb(NULL)
is.null(getOption("mesa_annoDb"))
#> [1] TRUE