% TIGR 212
\subsection{TIGR 212-gene experiment}
\hspace{14pt}This is a 23-array experiment done by TIGR. It is a combination of
double loop and double reference. We selected 212 genes from it
so you will see a lot of genes are significantly expressed. 

There are technical replicates in this experiment, e.g., each spot is duplicated
in the slide. We will skip the fixed model part in this example. We will show 
you that in mixed model, to collapse the replicates has similar result as
to fit Spot and Labeling effect as random.

\begin{enumerate}
\item load in data\\
\code{data(tigr212)}

\item First we create data object without replicates collapsed. Then
we do data normalization using shift method.\\
\code{data2<-createData(tigr212.data,n.rep=2)}\\
\code{data2.shift<-smooth(data2, method="shift", lolim=-50000, uplim=50000)}\\
\code{graphics.off()}

\item Make model object for mixed model. Array, Spot and Labeling effect
are random factors.\\
\code{model.mix.2 <- makeModel(data2.shift, formula=$\sim$AG+DG+SG+LG+SampleID,}\\
\hspace*{50pt}\code{random=$\sim$AG+SG+LG)}

\item Fit ANOVA model and do f test on samples\\
\code{anova.mix.2 <- fitmaanova(data2.shift, model.mix.2)}\\
\code{Ftest.mix.2 <- ftest(data2.shift, model=model.mix.2, term="SampleID")}

\item Volcano plot and find significant genes\\
\code{idx.mix.2 <- volcano(anova.mix.2, Ftest.mix.2)}

\item Create data object with replicates collapsed
and do normalization using shift method. \\
\code{data1 <- createData(tigr212.data,n.rep=2, avgreps=1)}\\
\code{data1.shift<-smooth(data1, method="shift", lolim=-50000, uplim=50000)}\\
\code{graphics.off()}

\item Make model object for mixed model. Because the technical replicates
are collapsed so we cannot fit SG an LG effect now. The only random term
is AG.\\
\code{model.mix.1 <- makeModel(data1.shift, formula=$\sim$AG+DG+SampleID, random=$\sim$AG)}

\item Fit ANOVA model and F test samples \\
\code{anova.mix.1 <- fitmaanova(data1.shift, model.mix.1)\\
Ftest.mix.1 <- ftest(data1.shift, model=model.mix.1, term="SampleID")}

\item Volcano plot and pick significant genes\\
\code{idx.mix.1 <- volcano(anova.mix.1, Ftest.mix.1)}

\item What's the difference of collapsing the replicates or not?\\
\code{length(idx.mix.1)\\
length(idx.mix.2)\\
setdiff(idx.mix.1, idx.mix.2)}\\
We can see the significant gene lists are very similar. Keeping
the replicates and fitting AG and LG gives 84 significant genes.
Collapsing the replicates gives 79 significant genes. The gene 
lists are almost the same. Collapsing the replicates is computationally
much faster. So we recommend users collapse the replicates when
using mixed model if the quality of your slides are good. 

\end{enumerate}


