\HeaderA{dyeswapfilter}{Gene filter for dye-swap experiment}{dyeswapfilter}
\keyword{models}{dyeswapfilter}
\begin{Description}\relax
This function is used to flag the questionable spot in any kind of
dye-swap experiment.

This function only works for 2-dye arrays.
\end{Description}
\begin{Usage}
\begin{verbatim}
dyeswapfilter(dataobj, r=4)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{dataobj}] An object of class \code{madata}.
\item[\code{r}] A cut-off value for bad spot. The genes with log-ratio
difference larger than r times standard deviation will be flagged.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
For each pair of dye-swap, the difference in log ratios (d) are
computed. Then compute the IQR (interquartile range) of d and convert
that to Standard Deviation by SD = IQR/1.35. Any gene with d larger
than r times SD will be flagged.

Note that I assume in the input data object, the adjacent arrays is a
dye-swap pair.
\end{Details}
\begin{Value}
An object of class \code{rawdata} or \code{madata} with the
\code{flag} field created or updated.
\end{Value}
\begin{Author}\relax
Hao Wu
\end{Author}
\begin{Examples}
\begin{ExampleCode}
## Not run: 
data(kidney)
# riplot before filtering
riplot(kidney.raw, array=1)
# filter the gene
rawdata <- dyeswapfilter(kidney.raw)
# riplot again - some genes are highlighted
riplot(rawdata, array=1)
## End(Not run)
\end{ExampleCode}
\end{Examples}

