Learn R Programming

asmn (version 1.3.0)

norm_factors: Create normalization factors.

Description

Using either raw data from BeadStudio or MethyLumiSet data, this function creates normalization factors using either all subjects' means or a subset.

Usage

norm_factors(controldata, subjects = NULL, methylumidata = NULL, type = "raw")

Arguments

controldata
A data.frame containing the red and green color channels for all control samples in raw format output from BeadStudio. May also contain detection p-values for each subject. Must contain a column called TargetID, which contains the CpG site identifiers. Either this or methylumidata must be supplied.
subjects
Optional. User can specify the index or names of a given subject or range of subjects to use in the creation of the normalization factors as oppposed to using all the samples.
methylumidata
A MethyLumiSet object containing control data (which can be accessed using the normctls function). See the vignette for this package for an example using this type of data.
type
One of either "raw" (default) or "methylumi" indicating the type of data supplied by the user.

Value

A list of length two containing the normalization factors for each subject in each color channel.

Examples

Run this code
ids <- seq(from = 10, to = 59)
n <- length(ids)
reds.s <- data.frame(matrix(rep(round(abs(rnorm(n, 4, 1))), 30), nrow=30))
names(reds.s) <- paste("X", ids, ".Signal_Red", sep = "")
greens.s <- data.frame(matrix(rep(round(abs(rnorm(n, 5, 2))), 30), nrow = 30))
names(greens.s) <- paste("X", ids, ".Signal_Grn", sep = "")
dat <- data.frame(reds.s, greens.s)
dat <- dat[,order(names(dat))]
indices <- sample(1:30, 30, replace = FALSE)
TargetID.s <- rep(NA, 30)
TargetID.s[indices[1:9]] <- "NORM_A"
TargetID.s[indices[10:18]] <- "NORM_T"
TargetID.s[indices[19:25]] <- "NORM_C"
TargetID.s[indices[25:30]] <- "NORM_G"
controldata.s <- data.frame(TargetID = TargetID.s, dat)

normfactors <- norm_factors(controldata=controldata.s, subjects=NULL, type = "raw")
normfactors <- norm_factors(controldata=controldata.s, subjects=1, type = "raw")

Run the code above in your browser using DataLab