runNormalization: Calculate normalization factors.

Description Usage Arguments Details Value See Also Examples

View source: R/runNormalization.R

Description

Calculate normalization factors to scale library sizes, using the TMM (trimmed mean of M-values) method implemented in edgeR.

Usage

1
runNormalization(rs_data, norm_method = "TMM")

Arguments

rs_data

RegspliceData object, which has already been filtered with filterZeros and filterLowCounts.

norm_method

Normalization method to use. Options are "TMM", "RLE", "upperquartile", and "none". See documentation for calcNormFactors in edgeR package for details. Default is "TMM".

Details

Normalization factors are used to scale the raw library sizes (total read counts per sample). We use the TMM (trimmed mean of M-values) normalization method (Robinson and Oshlack, 2010), as implemented in the edgeR package.

For more details, see the documentation for calcNormFactors in the edgeR package.

This step should be performed after filtering with filterZeros and filterLowCounts. The normalization factors are then used by limma-voom in the next step (runVoom).

The normalization factors are stored in a new column named norm_factors in the column meta-data (colData slot) of the RegspliceData object. The colData can be accessed with the accessor function colData().

Normalization should be skipped when using exon microarray data. (When using the regsplice wrapper function, normalization can be disabled with the argument normalize = FALSE).

Previous step: Filter low-count exon bins with filterLowCounts. Next step: Calculate limma-voom transformation and weights with runVoom.

Value

Returns a RegspliceData object. Normalization factors are stored in the column norm_factors in the column meta-data (colData slot), which can be accessed with the colData() accessor function.

See Also

filterLowCounts runVoom

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)

regsplice documentation built on Nov. 8, 2020, 5:32 p.m.