# NOT RUN {
data("alldata_eg")
featuredata_eg<-alldata_eg$featuredata
dataview(featuredata_eg)
sampledata_eg<-alldata_eg$sampledata
dataview(sampledata_eg)
metabolitedata_eg<-alldata_eg$metabolitedata
dataview(metabolitedata_eg)
logdata <- LogTransform(featuredata_eg)
dataview(logdata$featuredata)
imp <- MissingValues(logdata$featuredata,sampledata_eg,metabolitedata_eg,
feature.cutof=0.8, sample.cutoff=0.8, method="knn")
dataview(imp$featuredata)
#Linear model fit using unadjusted data
factormat<-model.matrix(~gender +Age +bmi, sampledata_eg)
unadjustedFit<-LinearModelFit(featuredata=imp$featuredata,
factormat=factormat,
ruv2=FALSE)
unadjustedFit
#Linear model fit using `is' normalized data
Norm_is <-NormQcmets(imp$featuredata, method = "is",
isvec = imp$featuredata[,which(metabolitedata_eg$IS ==1)[1]])
isFit<-LinearModelFit(featuredata=Norm_is$featuredata,
factormat=factormat,
ruv2=FALSE)
isFit
#Linear model fit with ruv-2 normalization
ruv2Fit<-LinearModelFit(featuredata=imp$featuredata,
factormat=factormat,
ruv2=TRUE,k=2,
qcmets = which(metabolitedata_eg$IS ==1))
ruv2Fit
lnames<- list(names(ruv2Fit$coef[,"Age"])[which(ruv2Fit$p.value[,"Age"]<0.05)],
names(unadjustedFit$coef[,"Age"])[which(unadjustedFit$p.value[,"Age"]<0.05)],
names(isFit$coef[,"Age"])[which(isFit$p.value[,"Age"]<0.05)])
VennPlot(lnames, group.labels=c("ruv2","unadjusted","is"))
# }
Run the code above in your browser using DataLab