getVarianceStabilizedData {DESeq}R Documentation

Apply a variance stabilizing transformation (VST) to the count data

Description

This function calculates a variance stabilizing transformation (VST) from the fitted dispersion-mean relation(s) and then transforms the count data (normalized by division by the size factor), yielding a matrix of values which are now approximately homoskedastic. This is useful as input to statistical analyses requiring homoskedasticity.

Usage

varianceStabilizingTransformation(cds)
getVarianceStabilizedData(cds)

Arguments

cds

a CountDataSet which also contains the fitted dispersion-mean relation

Details

For each sample (i.e., column of counts(cds)), the full variance function is calculated from the raw variance (by scaling according to the size factor and adding the shot noise). The function requires a blind estimate of the variance function, i.e., one ignoring conditions. Usually, this is achieved by calling estimateDispersions with method="blind" before calling it. A typical workflow is shown in Section Variance stabilizing transformation in the package vignette.

If estimateDispersions was called with fitType="parametric", a closed-form expression for the variance stabilizing transformation is used on the normalized count data. The expression can be found in the file ‘vst.pdf’ which is distributed with the vignette.

If estimateDispersions was called with fitType="locfit", the reciprocal of the square root of the variance of the normalized counts, as derived from the dispersion fit, is then numerically integrated, and the integral (approximated by a spline function) is evaluated for each count value in the column, yielding a transformed value.

In both cases, the transformation is scaled such that for large counts, it becomes asymptotically (for large values) equal to the logarithm to base 2.

Limitations: In order to preserve normalization, the same transformation has to be used for all samples. This results in the variance stabilizition to be only approximate. The more the size factors differ, the more residual dependence of the variance on the mean you will find in the transformed data. As shown in the vignette, you can use the function meanSdPlot from the package vsn to see whether this is a problem for your data.

Value

For varianceStabilizingTransformation, an ExpressionSet.

For getVarianceStabilizedData, a matrix of the same dimension as the count data, containing the transformed values.

Author(s)

Simon Anders <sanders@fs.tum.de>

Examples

cds <- makeExampleCountDataSet()
cds <- estimateSizeFactors( cds )
cds <- estimateDispersions( cds, method="blind" )
vsd <- getVarianceStabilizedData( cds )
colsA <- conditions(cds) == "A"
plot( rank( rowMeans( vsd[,colsA] ) ), genefilter::rowVars( vsd[,colsA] ) )

[Package DESeq version 1.38.0 Index]