subset {ballgown} | R Documentation

## subset ballgown objects to specific samples or genomic locations

### Description

subset ballgown objects to specific samples or genomic locations

### Usage

    subset(x, ...)

    ## S4 method for signature 'ballgown'
    subset(x, cond, genomesubset = TRUE)

### Arguments

`x` | a ballgown object
`...` | further arguments to generic subset
`cond` | Condition on which to subset. See details.
`genomesubset` | if TRUE, subset `x` to a specific part of the genome. Otherwise, subset x to only include specific samples. TRUE by default.

### Details

To use `subset`, you must provide the `cond` argument as a string representing a logical expression specifying your desired subset. The subset expression can either involve column names of `texpr(x, "all")` (if `genomesubset` is `TRUE`) or of `pData(x)` (if `genomesubset` is `FALSE`). For example, if you wanted a ballgown object for only chromosome 22, you might call `subset(x, "chr == 'chr22'")`. (Be sure to handle quotes within character strings appropriately).

### Value

a subsetted ballgown object, containing only the regions or samples satisfying `cond`.

### Author(s)

Alyssa Frazee

### Examples

    data(bg)
    bg_twogenes = subset(bg, "gene_id=='XLOC_000454' | gene_id=='XLOC_000024'")
    bg_twogenes
    # ballgown instance with 4 assembled transcripts and 20 samples

    bg_group0 = subset(bg, "group == 0", genomesubset=FALSE)
    bg_group0
    # ballgown instance with 100 assembled transcripts and 10 samples

[Package ballgown version 2.24.0 Index]