R/write.gmt.R

Defines functions write.gmt

Documented in write.gmt

#' Write GMT list to a formatted file.
#'
#' Adds new lines per pathway and "`\t`" as a separator.
#'
#' @param list_gmt [type: list<character>] List of GMT pathways.
#' @param output_file [type: character] Output file name.
#'
#' @export
#'
#' @examples
#'

write.gmt <- function(list_gmt, output_file) {
    list_gmt <- lapply(list_gmt, function(pathway) {
        return(paste0(pathway, collapse = "\t"))
    })

    list_gmt <- unlist(unname(list_gmt))

    writeLines(list_gmt, output_file, sep = "\n") # will rely on writeLines to give path errors
}
CoarfaBCM/derecksLabTools documentation built on April 3, 2022, 10:29 p.m.