SEmethods {csaw} | R Documentation

## SummarizedExperiment to DGEList

### Description

Converting a SummarizedExperiment object to a DGEList object for analysis with edgeR.

### Usage

    ## S4 method for signature 'SummarizedExperiment'
    asDGEList(object, lib.sizes, norm.factors, assay=1, ...)

### Arguments

`object` | A SummarizedExperiment object or its derived classes, like that produced by `windowCounts`.
`lib.sizes` | An (optional) integer vector of library sizes.
`norm.factors` | An (optional) numeric vector of normalization factors.
`assay` | A numeric scalar indicating which assay in `object` contains the count matrix.
`...` | Other arguments to be passed to `DGEList`.

### Details

Counts are extracted from specified `assay` matrix in the SummarizedExperiment object and used to construct a DGEList object via `DGEList`. If not specified in `lib.sizes`, library sizes are taken from the `totals` field in the column data of `object`. Warnings will be generated if this field is not present.

If `norm.factors` is not specified, `asDGEList` will attempt to extract normalization factors from `object$norm.factors`. If this is not available, factors will be set to the default (all unity). If `assays(object)$offset` is present, this will be assigned to the `offset` field of the output `DGEList` object.

### Value

A DGEList object is returned containing counts and normalization information.

### Author(s)

Aaron Lun

### See Also

`DGEList`

### Examples

    bamFiles <- system.file("exdata", c("rep1.bam", "rep2.bam"), package="csaw")
    data <- windowCounts(bamFiles, width=100, filter=1)

    asDGEList(data)
    asDGEList(data, lib.sizes=c(10, 100))
    asDGEList(data, norm.factors=c(1.11, 2.23), group=c("a", "b"))

    norm.data <- normOffsets(data, se.out=TRUE)
    norm.data$norm.factors
    asDGEList(norm.data)$samples$norm.factors
    asDGEList(norm.data, norm.factors=c(1,2))$samples$norm.factors # gets priority
    norm.data <- normOffsets(data, type="loess", se.out=TRUE)
    head(asDGEList(norm.data)$offset)

[Package csaw version 1.14.1 Index]