featureIds {sparrow} | R Documentation

## Returns the relevant featureIds for a given geneset.

### Description

Gene sets are defined by the unique compound key consisting of their `collection` and `name`. To fetch the featureIds associated with a specific geneset, you must provide values for `i` and `j`. If these are missing, then a character vector of all the unique feature ids within `x` are returned.

If the GeneSetDb `x` has been conformed to an expression object this will default to return only the feature_id's that are matched to the target expression object, and they will be returned using the same identifiers that the target expression object uses. To change this behavior, tweak the values for the `active.only` and `value` parameters, respectively.

`x` can be either a `GeneSetDb` or a `SparrowResult`. If its the latter, then this call simply delegates to the internal `GeneSetDb`.

### Usage

    featureIds(
      x,
      i,
      j,
      value = c("feature_id", "x.id", "x.idx"),
      active.only = is.conformed(x),
      ...
    )

    ## S4 method for signature 'GeneSetDb'
    featureIds(
      x,
      i,
      j,
      value = c("feature_id", "x.id", "x.idx"),
      active.only = is.conformed(x),
      ...
    )

    ## S4 method for signature 'SparrowResult'
    featureIds(
      x,
      i,
      j,
      value = c("feature_id", "x.id", "x.idx"),
      active.only = TRUE,
      ...
    )

### Arguments

`x` | Object to retrieve the gene set from, either a `GeneSetDb` or a `SparrowResult`.
`i, j` | The collection,name compound key identifier of the gene set
`value` | What form do you want the id's in? `"feature_id"`: the IDs used in the original geneset definitions `"x.id"`: the ids of the features as they are used in the expression object. `"x.idx"`: The integer index into the expresion object `x` that the 'GeneSetDb“ has been conformed to.
`active.only` | only look for gene sets that are "active"? Defaults to `TRUE` if `x` is conformed to a target expression object, else `FALSE`. `conform()` for further details.
`...` | pass through arguments

### Value

A vector of identifiers (or indexes into an expression object, depending on the `value` argument) for the features in the specified geneset. `NA` is returned if the geneset is not "active" (ie. listed in `geneSets()`)

### Examples

    gdb <- exampleGeneSetDb()
    fids.gs <- featureIds(gdb, 'c2', 'BIOCARTA_AGPCR_PATHWAY')
    fids.c2 <- featureIds(gdb, 'c2')
    fids.all <- featureIds(gdb)

    vm <- exampleExpressionSet(do.voom=TRUE)
    gdb <- conform(gdb, vm)
    ## fewer than before
    fids.gs2 <- featureIds(gdb, 'c2', 'BIOCARTA_AGPCR_PATHWAY')
    ## same as before
    fids.gs3 <- featureIds(gdb, 'c2', 'BIOCARTA_AGPCR_PATHWAY', active.only=FALSE)
    ## returned as row indices into vm
    fids.idxs <- featureIds(gdb, 'c2', value='x.idx')

[Package sparrow version 1.0.3 Index]