# TODO: Add comment
# 
# Author: E.Korsching Mar 15, 2012
###############################################################################



######## mtt test with real data
date()
#test1 <- mtt(
#test1a <- mtt(
test1b <- mtt(
#		x=hd.medip.n[ ,c(2:10),drop=F],				#signal data, data.frame
#		categories=c("a","a","a","b","b","b","c","c","c"),		#group structure for all given columns 
		x=hd.medip.n[1:3 ,c(2:35),drop=F],				#signal data, data.frame
		categories=c("a","a","a","c","a","a","c","c","c","c","c","c","c","a","a","a","c","a","c","a","a","a","c","b","b","b","b","b","b","b","b","b","b","b"),		#34 #group structure for all given columns 
		permutations=1,			#permutation test of results, 1= no testing
		reg=c("a.b","a.c"),				#rules: regulation wanted between groups (categories), all other pairwise comparisons: no regulation
		method="lsd",			# Fisher's LSD (Least Significant Difference) ("t-test","bonferroni","lsd","tukey","sidak","scheffe")
		proc="BH",					# raw p adjusting ("noadjust","Bonferroni", "Holm", "Hochberg", "SidakSS", "SidakSD", "BH", "BY")
		var.equal=T,				####
		palpha=0.05,				# alpha error threshold
		plot.it=T,					# plot graphs
		gin=h.methylation.anno.a,		# genom information, annotation
		label.cols=c("Gene.Symbol","label"),			# annotation columns of gin (one or more)
		mf.row=c(2,2),				# page areas for plotting
		cex=0.5,					# font size
		plottype="interval",		# LSD plot types ("fold.change","bar","interval")
		result="short"			# return: "full": full results-permutations=1, "short": short results-permutations=1, "perm": short results-permutations>1
)
date()



######### create test2 data set
test.data.anova.categ <- c("a","a","a","c","b","b","b","a","c","c")
test.data.anova.anno <- data.frame(
		abc=c("ya","yb","yc","yd","ye"),
		Gene.Symbol=c("xa","xb","xc","xd","xe"),
		label=c("xa","xb","xc","xd","xe"),
		row.names=c("a","b","c","d","e")
)
test.data.anova <- data.frame(rnorm(n=5, mean=14, sd=1),
		rnorm(n=5, mean=15, sd=1),
		rnorm(n=5, mean=16, sd=1),
		rnorm(n=5, mean=4, sd=1),
		rnorm(n=5, mean=5, sd=1),
		rnorm(n=5, mean=6, sd=1),
		rnorm(n=5, mean=5, sd=1),
		rnorm(n=5, mean=15, sd=1),
		rnorm(n=5, mean=5, sd=1),
		rnorm(n=5, mean=4, sd=1),
		row.names=c("a","b","c","d","e")
)
names(test.data.anova) <- paste("x",c(1:10),sep="")
# win eol ! - Linux \n
write.table(x=test.data.anova.categ, file="test.data.anova.categ.txt", append=FALSE, quote=F, sep="\t", eol="\r\n", na="NA", dec=".", row.names=TRUE, col.names=TRUE)
write.table(x=test.data.anova.anno, file="test.data.anova.anno.txt", append=FALSE, quote=F, sep="\t", eol="\r\n", na="NA", dec=".", row.names=TRUE, col.names=TRUE)
write.table(x=test.data.anova, file="test.data.anova.txt", append=FALSE, quote=F, sep="\t", eol="\r\n", na="NA", dec=".", row.names=TRUE, col.names=TRUE)



######### test2 data
pdf(file=paste(getwd(),"/results/test2data",".",format(Sys.time(), "%Y%m%d%H%M"),".pdf", sep=""),
		width=11, height=7, onefile=T, title="mtt", pointsize=12)

test2 <- mtt(
		x=test.data.anova,				#signal data, data.frame
		categories=test.data.anova.categ,		#group structure for all given columns
		permutations=1,			#permutation test of results, 1= no testing
		reg=c("a.b","a.c"),				#rules: regulation wanted between groups (categories), all other pairwise comparisons: no regulation
		method="lsd",			# Fisher's LSD (Least Significant Difference) ("t-test","bonferroni","lsd","tukey","sidak","scheffe")
		proc="BH",					# raw p adjusting ("noadjust","Bonferroni", "Holm", "Hochberg", "SidakSS", "SidakSD", "BH", "BY")
		var.equal=T,				####
		palpha=0.05,				# alpha error threshold
		plot.it=T,					# plot graphs
		gin=test.data.anova.anno,		# genom information, annotation
		label.cols=c("Gene.Symbol","label"),			# annotation columns of gin (one or more)
		mf.row=c(2,2),				# page areas for plotting
		cex=0.5,					# font size
		plottype="interval",		# LSD plot types ("fold.change","bar","interval")
		result="short"			# return: "full": full results-permutations=1, "short": short results-permutations=1, "perm": short results-permutations>1
)

dev.off()

	
#write.table(x=test2, file="test2.txt", append=FALSE, quote=F, sep="\t", eol="\n", na="NA", dec=".", row.names=TRUE, col.names=TRUE)



