R/activateAnnotation.R

Defines functions activateAnnotation

Documented in activateAnnotation

#' activateAnnotation - Get the right annotation (possibly installing it) for an expressionset. It will load the package.
#'
#' @param eset The expression set that has a corresponding (affy) annotation.
#'
#' @return The name of the expression set.
#' @export
#'
#' @examples

activateAnnotation<-function(eset) {

  stopifnot(class(eset)=="ExpressionSet")
  annotationName<-annotation(eset)
  annotationPackage<-paste0(annotationName,".db")
  if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
  if (!requireNamespace(annotationPackage, quietly=TRUE))
    BiocManager::install(annotationPackage)

  library(annotationPackage, character.only = TRUE)

  return(annotationName)
}
steveneschrich/saeAffy documentation built on Nov. 14, 2020, 10:17 a.m.