Learn R Programming

DESeq2 (version 1.12.3)

normalizationFactors: Accessor functions for the normalization factors in a DESeqDataSet object.

Description

Gene-specific normalization factors for each sample can be provided as a matrix, which will preempt sizeFactors. In some experiments, counts for each sample have varying dependence on covariates, e.g. on GC-content for sequencing data run on different days, and in this case it makes sense to provide gene-specific factors for each sample rather than a single size factor.

Usage

normalizationFactors(object, ...)
normalizationFactors(object, ...) <- value
"normalizationFactors"(object)
"normalizationFactors"(object) <- value

Arguments

object
a DESeqDataSet object.
...
additional arguments
value
the matrix of normalization factors

Details

Normalization factors alter the model of DESeq in the following way, for counts $K_ij$ and normalization factors $NF_ij$ for gene i and sample j:

$$ K_{ij} \sim \textrm{NB}( \mu_{ij}, \alpha_i) $$ $$ \mu_{ij} = NF_{ij} q_{ij} $$

Examples

Run this code

dds <- makeExampleDESeqDataSet(n=100, m=4)

normFactors <- matrix(runif(nrow(dds)*ncol(dds),0.5,1.5),
                      ncol=ncol(dds),nrow=nrow(dds),
                      dimnames=list(1:nrow(dds),1:ncol(dds)))

# the normalization factors matrix should not have 0's in it
# it should have geometric mean near 1 for each row
normFactors <- normFactors / exp(rowMeans(log(normFactors)))
normalizationFactors(dds) <- normFactors

dds <- DESeq(dds)

Run the code above in your browser using DataLab