write_gmt: Write a list of gene sets into a GMT file

View source: R/write_gmt.R

write_gmtR Documentation

Write a list of gene sets into a GMT file

Description

Write gene-sets in a GMT-list form into GMT files.

Usage

write_gmt(gmt, file, description = NULL)

Arguments

gmt

A list of gene sets. It can be either (1) a list with each item is a list of three components, named ‘name’, ‘description’ and ‘genes’, or (2) a list of gene identifiers.

file

The GMT file to create

description

Description, used in case gmt is a list of gene identifiers (e.g. without description).

Details

This function can be used, for instance, to combine multiple GMT files into a new one.

Value

Invisible NULL when the file is successfully created. Otherwise an error message will be printed.

Author(s)

Jitao David Zhang <jitao_david.zhang@roche.com>

Examples


idir <- system.file("extdata", package="ribiosIO")
sample.gmt.file <- file.path(idir, "test.gmt")

test.gmt <- read_gmt_list(sample.gmt.file)

outgmt.file <- paste(tempfile(), ".gmt", sep="")

write_gmt(test.gmt[1:2], file=outgmt.file)

## a list of identifiers
testList <- list(A=LETTERS[3:5], B=LETTERS[4:7], C=12:9)
write_gmt(testList, file=outgmt.file)


ribiosIO documentation built on Feb. 20, 2026, 5:09 p.m.