Learn R Programming

MetNorm (version 0.1)

NormalizeRUVRand: RUV-random normalized data

Description

Given suitable controls, this function may be used to obtain a normalized metabolomics data matrix for downstream statistical analysis

Usage

NormalizeRUVRand(Y,ctl,k=NULL,lambda=NULL,plotk=TRUE)

Arguments

Y
A metabolomics data matrix with samples in rows and metabolites in columns
ctl
A logical vector indicating which metabolites should be used as negative controls
k
The number of factors of unwanted variation
plotk
A logical indicating whether a bargraph for the proportion of variance explained by the factors of unwanted variation needs to be plotted
lambda
The regularization parameter which depends on k. If not entered, it will be estimated. See DeLivera et al, 2014 for details.

Value

normdata.

References

De Livera, A. M., Dias, D. A, De Souza, D., Rupasinghe, T., Pyke, J., Tull, D., Roessner, U., McConville, M., and Speed, T. P. (2012). Normalizing and integrating metabolomics data. Analytical chemistry, 84(24), 10768-76.

De Livera, A.M., Aho-Sysi, M., Jacob, L., Gagnon-Bartch, J., Castillo, S., Simpson, J.A., and Speed, T.P. (2014), Statistical methods for handling unwanted variation in metabolomics data

Examples

Run this code
data(UV)
Y<-data.matrix(UV[,-c(1:3)]) 

##Empirical controls
IS<-Y[,which(colnames(Y)=="IS")] 
r<-numeric(dim(Y)[2])
for(j in 1:length(r)){
  r[j]<-cor(IS,Y[,j])
}
ctl<-logical(length(r))
ctl[which(r>round(quantile(r,0.7),2))]<-TRUE 

## Not run:   
# ruv<-NormalizeRUVRand(Y=Y,ctl=ctl,k=3) 
# ruvclust<-NormalizeRUVRandClust(RUVRand=ruv,
#                    maxIter=200, 
#                    nUpdate=100,
#                    lambdaUpdate=TRUE,
#                    p=2)
# ruvclustY<-ruvclust$newY
# pairs(princomp(ruvclustY,cor=TRUE)$scores[,c(1:3)],
#       pch=as.numeric(UV[,2]), col=UV[,3],
#       main="RUV random for clustering")
# ## End(Not run)

Run the code above in your browser using DataLab