Learn R Programming

ballgown (version 2.4.2)

subset: subset ballgown objects to specific samples or genomic locations

Description

subset ballgown objects to specific samples or genomic locations

Usage

subset(x, ...)
"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.

Value

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

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).

Examples

Run this code
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

Run the code above in your browser using DataLab