annotate.gct {cmapR} | R Documentation

## Add annotations to a GCT object

### Description

Given a GCT object and either a `data.frame` or a path to an annotation table, apply the annotations to the gct using the given `keyfield`.

### Usage

    annotate.gct(...)

    annotate_gct(g, annot, dim = "row", keyfield = "id")

    ## S4 method for signature 'GCT'
    annotate_gct(g, annot, dim = "row", keyfield = "id")

### Arguments

`...` | arguments passed on to `annotate_gct`
`g` | a GCT object
`annot` | a `data.frame` or path to text table of annotations
`dim` | either 'row' or 'column' indicating which dimension of `g` to annotate
`keyfield` | the character name of the column in `annot` that matches the row or column identifiers in `g`

### Value

a GCT object with annotations applied to the specified dimension

### See Also

Other GCT utilities: `melt.gct()`, `merge.gct()`, `rank.gct()`, `subset.gct()`

### Examples

    gct_path <- system.file("extdata", "modzs_n25x50.gctx", package="cmapR")
    # read the GCT file, getting the matrix only
    g <- parse_gctx(gct_path, matrix_only=TRUE)
    # separately, read the column annotations and then apply them using
    # annotate_gct
    cdesc <- read_gctx_meta(gct_path, dim="col")
    g <- annotate_gct(g, cdesc, dim="col", keyfield="id")

[Package cmapR version 1.0.0 Index]