R/build_GOannotations.R

Defines functions build.GOannotaions

Documented in build.GOannotaions

#' Builds GO annotation database
#'
#' @return
#' @export
#'
#' @import org.Hs.eg.db
#'
#'
build.GOannotaions <- function() {

  proteins <- rownames(getData())

  a <- mget(x = proteins, envir = org.Hs.egACCNUM2EG, ifnotfound = NA)
  message("ok")

  b <- unlist(lapply(a, function(x) x[[1]]))


  annotations <- lapply(mget(na.omit(b), org.Hs.egGO), names)

  names(annotations) <- names(b)[match(names(annotations), b)]

  for(i in 1:length(a)) {
    if(!names(a)[i] %in% names(annotations)) {
      annotations[length(annotations) + 1] <- list(NULL)
      names(annotations)[length(annotations)] <- names(a)[i]
    }
  }

  saveThis(annotations, "annotations", "info")

}
nicohuttmann/htmnanalysis documentation built on Dec. 6, 2020, 3:02 a.m.