runVoom: Calculate 'voom' transformation and weights.

View source: R/runVoom.R

runVoomR Documentation

Calculate 'voom' transformation and weights.

Description

Use limma-voom to transform counts and calculate exon-level weights.

Usage

runVoom(rs_data)

Arguments

rs_data

RegspliceData object, which has been filtered with filterZeros and filterLowCounts, and (optionally) normalization factors added with runNormalization.

Details

Raw counts do not fulfill the statistical assumptions required for linear modeling. The limma-voom methodology transforms counts to log2-counts per million (logCPM), and calculates exon-level weights based on the observed mean-variance relationship. Linear modeling methods can then be applied.

For more details, see the documentation for voom in the limma package.

Note that voom assumes that exon bins (rows) with zero or low counts have already been removed, so this step should be done after filtering with filterZeros and filterLowCounts.

Normalization factors can be provided in a column named norm_factors in the column meta-data (colData slot) of the RegspliceData object. These will be used by voom to calculate normalized library sizes. If normalization factors are not provided, voom will use non-normalized library sizes (columnwise total counts) instead.

The experimental conditions or group labels for each biological sample are assumed to be in a column named condition in the column meta-data (colData slot) of the RegspliceData object. This column is created when the object is initialized with the RegspliceData() constructor function.

The transformed counts are stored in the updated counts matrix, which can be accessed with the countsData accessor function. The weights are stored in a new data matrix labeled weights, which can be accessed with the weightsData accessor function. In addition, the normalized library sizes (if available) are stored in a new column named lib_sizes in the column meta-data (colData slot).

If you are using exon microarray data, this step should be skipped, since exon microarray intensities are already on a continuous scale.

Previous step: Calculate normalization factors with runNormalization. Next step: Initialize RegspliceResults object with the constructor function RegspliceResults().

Value

Returns a RegspliceData object. Transformed counts are stored in the counts matrix, and weights are stored in a new weights data matrix. The data matrices can be accessed with the accessor functions countsData and weightsData.

See Also

runNormalization fitRegMultiple fitNullMultiple fitFullMultiple

Examples

file_counts <- system.file("extdata/vignette_counts.txt", package = "regsplice")
data <- read.table(file_counts, header = TRUE, sep = "\t", stringsAsFactors = FALSE)
head(data)

counts <- data[, 2:7]
tbl_exons <- table(sapply(strsplit(data$exon, ":"), function(s) s[[1]]))
gene_IDs <- names(tbl_exons)
n_exons <- unname(tbl_exons)
condition <- rep(c("untreated", "treated"), each = 3)

rs_data <- RegspliceData(counts, gene_IDs, n_exons, condition)

rs_data <- filterZeros(rs_data)
rs_data <- filterLowCounts(rs_data)
rs_data <- runNormalization(rs_data)
rs_data <- runVoom(rs_data)


lmweber/regsplice documentation built on March 19, 2024, 1:45 p.m.