R/mm_sig_cps.R

Defines functions mm_sig_cpgs

Documented in mm_sig_cpgs

#' Perform missMethyl on array hits with an FDR <0.5
#'
#' @param sig_hits
#'
#' @return A data frame with the top 50 most significant results from all GO ontologies.
#' @export
#'
#' @examples
mm_sig_cpgs <- function(sig_hits) {
  if (length(sig_hits) > 2) {
    missMethyl::gometh(
      sig.cpg = sig_hits,
      all.cpg = Universe,
      collection = "GO",
      array.type = "EPIC"
    ) %>%
      dplyr::rename("Term" = "TERM") %>%
      limma::topGO(., number = 50) %>%
      arrange(ONTOLOGY) %>%
      readr::write_csv(paste0(data_output, "./missMethyl_results.csv"), col_names = T)
  } else {
    print("n too low for missMethyl on sig cpgs alone")
  }
}
fluentin44/epicR documentation built on June 29, 2022, 6:39 a.m.