subsetByComposition {CAGEfightR} | R Documentation

## Subset by composition across samples

### Description

A convenient wrapper around calcComposition and subset.

### Usage

    subsetByComposition(
      object,
      inputAssay = "counts",
      outputColumn = "composition",
      unexpressed = 0.1,
      genes = "geneID",
      minSamples = 1
    )

### Arguments

`object` | RangedSummarizedExperiment: CAGE data quantified at CTSS, cluster or gene-level.
`inputAssay` | character: Name of assay holding input expression values.
`outputColumn` | character: Name of column in rowRanges to hold composition values.
`unexpressed` | numeric: Composition will be calculated based on features larger than this cutoff.
`genes` | character: Name of column in rowData holding genes (NAs are not allowed.)
`minSamples` | numeric: Only features with composition in more than this number of samples will be kept.

### Value

RangedSummarizedExperiment with composition values added as a column in rowData and features with less composition than minSamples removed.

### See Also

Other Subsetting functions: `subsetByBidirectionality()`, `subsetBySupport()`

Other Calculation functions: `calcBidirectionality()`, `calcComposition()`, `calcPooled()`, `calcShape()`, `calcSupport()`, `calcTPM()`, `calcTotalTags()`, `subsetByBidirectionality()`, `subsetBySupport()`

### Examples

    data(exampleUnidirectional)

    # Annotate clusters with geneIDs:
    library(TxDb.Mmusculus.UCSC.mm9.knownGene)
    txdb <- TxDb.Mmusculus.UCSC.mm9.knownGene

    exampleUnidirectional <- assignGeneID(exampleUnidirectional,
                                          geneModels=txdb,
                                          outputColumn='geneID')
    exampleUnidirectional <- subset(exampleUnidirectional, !is.na(geneID))

    # Keep only clusters more than 10% in more than one sample:
    calcComposition(exampleUnidirectional)

    # Keep only clusters more than 5% in more than 2 samples:
    subsetByComposition(exampleUnidirectional, unexpressed = 0.05, minSamples=2)

[Package CAGEfightR version 1.10.0 Index]