Learn R Programming

asmn (version 1.3.0)

normalize_asmn: Perform all sample mean normalization.

Description

This function normalizes either raw data output from BeadStudio or data of type MethyLumiSet.

Usage

normalize_asmn(normfactors, rawdata, featuredata, methylumidata = NULL, type = "raw")

Arguments

normfactors
The output from norm_factors
rawdata
A data.frame, or matrix containing the methylation values the user wishes to normalize. Must contain column names that specify the detection signal type (A or B) and have the number of rows equal the number of CpG sites to be analyzed.
featuredata
A data.frame containing information for each row of rawdata specifying the ID of the CpG sites, the Infinium design type (I or II), and the color channel (red or green). This determines which normalization factors are used.
methylumidata
A MethyLumiSet data object containing the methylated/unmethylated sites as well as color channel identifiers accessed using fData. 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.

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)
ncpg <- 100
IlmnIDs.s <- paste("cg00", seq(1:ncpg), sep = "")
Infinium_Design_type.s <- sample(c("I", "II"), size=ncpg, replace = TRUE)
Color_Channel.s <- vector()
Color_Channel.s[Infinium_Design_type.s == "I"] <- sample(c("Red", "Grn"), size = length(Color_Channel.s[Infinium_Design_type.s == "I"]), replace = TRUE)
featuredata.s <- data.frame(IlmnIDs = IlmnIDs.s, Infinium_Design_Type = Infinium_Design_type.s, Color_Channel = Color_Channel.s)
signalA.s <- data.frame(matrix(rep(round(abs(rnorm(n, 4000, 2000))), ncpg), nrow=ncpg))
names(signalA.s) <- paste("X", ids, ".Signal_A", sep = "")
signalB.s <- data.frame(matrix(rep(round(abs(rnorm(n, 5000, 2000))), ncpg), nrow = ncpg))
names(signalB.s) <- paste("X", ids, ".Signal_B", sep = "")
dat <- data.frame(signalA.s, signalB.s)
mydata.s <- dat[,order(names(dat))]

newbetas <- normalize_asmn(normfactors=normfactors, rawdata=mydata.s, featuredata=featuredata.s, methylumidata = NULL, type = "raw")

Run the code above in your browser using DataLab