Learn R Programming

csaw (version 1.6.1)

SEmethods: Statistical wrappers for SummarizedExperiment objects

Description

Convenience wrappers for statistical routines operating on SummarizedExperiment objects.

Usage

"normOffsets"(object, lib.sizes, assay=1, ...) "normalize"(object, lib.sizes, type="scaling", assay=1, ...) "asDGEList"(object, lib.sizes, norm.factors, ...)

Arguments

object
a SummarizedExperiment object or its derived classes, like that produced by windowCounts
lib.sizes
an (optional) integer vector of library sizes
assay
a numeric scalar indicating which assay in object contains the count matrix
type
a character scaling indicating the type of normalization, see normOffsets
norm.factors
an (optional) numeric vector of normalization factors
...
other arguments to be passed to the function being wrapped

Value

For normOffsets, either a numeric matrix or vector is returned; see normOffsets,matrix-method.For normalize, an object of the same class as object is returned with normalization data stored in various fields.For asDGEList, a DGEList object is returned.

Details

For normalize and normOffset, counts are extracted from the matrix corresponding to the first assay in the SummarizedExperiment object (different assays can be specified with the assay argument). For asDGEList, counts are extracted from the assay named "counts", with the first assay used if no such assay exists with that name. 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.

In the normOffsets and normalize methods, the extracted counts and library sizes are supplied to normOffsets,matrix-method. Similarly, the asDGEList method wraps the DGEList constructor. In both cases, any arguments in ... are also passed to the wrapped functions.

If type="scaling" in normalize, a vector of normalization factors is stored in the norm.factors field of the colData in the output object. If type="loess", an offset matrix is instead stored as a named entry in the assays of the output object.

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.

See Also

normOffsets, DGEList, windowCounts

Examples

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

normOffsets(data)
normOffsets(data, lib.sizes=c(10, 100))
head(normOffsets(data, type="loess"))

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

norm.data <- normalize(data)
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 <- normalize(data, type="loess")
head(asDGEList(norm.data)$offset)

Run the code above in your browser using DataLab