set.seed(2015); rand1 <- round(runif(600) +rnorm(600,1,2),3)
dat1 <- matrix(rand1,ncol=6) + matrix(rep((1:100)/20,6),ncol=6)
dat1[13:16,1:3] <- dat1[13:16,1:3] +2 # augment lines 13:16
dat1[19:20,1:3] <- dat1[19:20,1:3] +3 # augment lines 19:20
dat1[15:18,4:6] <- dat1[15:18,4:6] +1.4 # augment lines 15:18
dat1[dat1 <1] <- NA # mimick some NAs for low abundance
## normalize data
boxplot(dat1, main="Data Before Normalization", las=1)
dat1 <- wrMisc::normalizeThis(as.matrix(dat1), meth="median")
## designate replicate relationships in samples ...
grp1 <- gl(2, 3, labels=LETTERS[1:2])
## moderated t-test with repeated imputations (may take >10 sec, >60 sec if ROTSn >0 !)
PLtestR1 <- testRobustToNAimputation(dat=dat1, gr=grp1, retnNA=TRUE, nLoop=20)
names(PLtestR1)
head(PLtestR1$p.value)
head(PLtestR1$BH)
head(PLtestR1$means)
boxplot(PLtestR1$datImp, main="Data At Normalization & Imputation", las=1)
## custom selection of comparisons (incl custom orientation)
useComp <- c("A-B", "B-A") # You can choose orientation sample/reference
PLtestR2 <- testRobustToNAimputation(dat=dat1, gr=grp1, useComparison=useComp,
retnNA=TRUE, nLoop=20)
head(PLtestR2$BH)
head(PLtestR2$means)
Run the code above in your browser using DataLab