#' EMMA_get_record
#'
#' @param res Functional Enrichment Analysis results (enrichResult, gseaResult ...)
#' generated by `EMMA_run()`
#'
#' @return list of metadata recorded during FEA runtime
#' @export
#' 
#' @seealso [enrichGO()], [groupGO()], [gseGO()], [gseKEGG()], [enrichKEGG()],
#'  [gost()], [run_cluPro()], [run_topGO()], [run_goseq()]
#'
#' @examples
#' data("fea_res", package = "EMMA")
#' EMMA_get_record(fea_res)
EMMA_get_record <- function(res){
  
  rec <- attr(res, "EMMA_record")
  
  if (is.null(rec)) {
    stop("No `EMMA_record` was found. Try running `EMMA_run()` first.")
  }
  
  if (!is.list(rec)) {
    stop("Invalid structure. `EMMA_record` must be a `list`")
  }
  
  attr(res, "EMMA_record")
}