Learn R Programming

ActivePathways (version 1.0.1)

GMT: Read and Write GMT files

Description

Functions to read and Write Gene Matrix Transposed (GMT) files and to test if an object inherits from GMT

Usage

read.GMT(filename)

write.GMT(gmt, filename, path = ".")

# S3 method for GMT [(x, i)

# S3 method for GMT [[(x, i)

# S3 method for GMT $(x, i)

is.GMT(x)

Arguments

filename

name of the GMT file

gmt

a GMT object

path

location of the GMT file

x

object to test

i

index of GMT object

Value

read.GMT returns a GMT object. write.GMT returns NULL. is.GMT returns TRUE if x is a GMT object, else FALSE

Format

A GMT object is a named list of terms, where each term is a list with the items:

id

The term id

name

The full name of the term

genes

A character vector of genes annotated to this term

Details

A GMT file describes gene sets, such as pathways. GMT files are tab delimeted and each row contains a term id, a term name, and all genes annotated to the term.

Examples

Run this code
# NOT RUN {
gmt <- read.GMT(system.file('extdata', 'hsapiens_REAC_subset.gmt', package='ActivePathways'))
is.GMT(gmt)
gmt[1:10]
gmt[[1]]
gmt[1]$id
gmt[1]$genes
gmt[1]$name
gmt$`REAC:3108214`
# }
# NOT RUN {
  write.GMT(gmt, 'filename.gmt', path = tempdir())
# }

Run the code above in your browser using DataLab