R/write_geneSets_to_gmt.R

Defines functions write_geneSets_to_gmt

Documented in write_geneSets_to_gmt

write_geneSets_to_gmt <-
function(gs, fileName = "gene_sets.gmt") {
  gs_name <- names(gs)
  link  <- unlist(lapply(gs, function(x) attr(x, "link")))
  geneSet <- lapply(gs, function(x) paste0(x, collapse = '\t'))
  tmp <- paste(gs_name, link, geneSet, sep = "\t")
  cat(tmp[1], file = fileName, append = FALSE, sep = "\n")
  for(k in 2:length(tmp)) cat(tmp[k], file = fileName, append = TRUE, sep = "\n")
  invisible(NULL)
}

Try the massiveGST package in your browser

Any scripts or data that you put into this service are public.

massiveGST documentation built on March 31, 2023, 8:59 p.m.