conversion {sparrow} | R Documentation

## Convert a GeneSetDb to other formats.

### Description

As awesome as a GeneSetDb is, you might find a time when you'll need your gene set information in an other format. To do that, we provide the following functions:

- `as(gdb, "BiocSetf')`: convert to a `BiocSet::BiocSet()`.

- `as(gdb, "GeneSetCollection")`: Convert to a `GSEABase::GeneSetCollection()` object.

- `as.data.(table|frame)(gdb)`: Perhaps the most natural format to convert to in order to save locally and examine outside of Bioconductor's GSEA universe, but not many other tools accept gene set definitions in this format.

- `as.list(gdb)`: A named list of feature identifiers. This is the format that many of the limma gene set testing methods use

### Usage

    ## S3 method for class 'GeneSetDb'
    as.data.table(
      x,
      keep.rownames = FALSE,
      value = c("feature_id", "x.id", "x.idx"),
      active.only = is.conformed(x),
      ...
    )

    ## S3 method for class 'GeneSetDb'
    as.data.frame(
      x,
      row.names = NULL,
      optional = NULL,
      value = c("feature_id", "x.id", "x.idx"),
      active.only = is.conformed(x),
      ...
    )

### Arguments

`x` | A `GeneSetDb` object
`keep.rownames` | included here just for consistency with `data.table::as.data.table`, but it is not used
`value` | The value type to export for the feature ids, defaults to `"feature_id"`.
`active.only` | If the `GeneSetDb` is conformed, do you want to only return the features and genests that match target and are "active"?
`...` | pass through arguments (not used)
`row.names, optional` | included here for consistency with `as.data.frame` generic function definition, but these are not used.

### Details

The `as.*` functions accept a `value` parameter which indicates the type of IDs you want to export in the conversion:

- `"feature_id"`: The ID used as originally entered into the `GeneSetDb`.

- `"x.idx"`: Only valid if the GeneSetDb `x` has been `conform`-ed to an expession container. This option will export the features as the integer rows of the expression container.

- `"x.id"`: Only valid if the GeneSetDb `x` has been `conform`-ed. The target expression container might use feature identifiers that are different than what is in the GeneSetDb. If an active featureMap is set on the GeneSetDb, this will convert the original feature identifiers into a different target space (entrez to ensembl, for instance). Using this option, the features will be provided in the target space.

### Value

a converted `GeneSetDb`

### Functions

- `as.data.frame.GeneSetDb`: convert a GeneSetDb to data.frame

### Examples

    es <- exampleExpressionSet()
    gdb <- conform(exampleGeneSetDb(), es)
    bs <- as(gdb, "BiocSet")
    gdf <- as.data.frame(gdb)
    gdb <- conform(gdb, es)
    gdfi <- as.data.frame(gdb, value = 'x.idx')
    gdl <- as.list(gdb)

[Package sparrow version 1.0.3 Index]