\HeaderA{normalize.AffyBatch.vsn}{Wrapper for vsn to be used as a normalization method in the package affy}{normalize.AffyBatch.vsn}
\keyword{robust}{normalize.AffyBatch.vsn}
\begin{Description}\relax
Wrapper for \code{\LinkA{vsn}{vsn}} to be used as a normalization method in the package affy
\end{Description}
\begin{Usage}
\begin{verbatim}normalize.AffyBatch.vsn(abatch, subsample=20000, niter = 4, strata, ...)\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{abatch}] An object of type \code{\LinkA{AffyBatch}{AffyBatch}}.
\item[\code{subsample}] The number of probes to be sampled for the fit of the transformation parameters.
\item[\code{niter}] Parameter passed on to \code{\LinkA{vsn}{vsn}}.
\item[\code{strata}] Integer vector of length nrow(y). See 
\code{\LinkA{vsn}{vsn}} for details.
\item[\code{...}] Further parameters for \code{\LinkA{vsn}{vsn}}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Please refer to the "details" and "references" sections of the man page for
\code{\LinkA{vsn}{vsn}} for more details about this method.

\bold{Important note}: after calling \code{\LinkA{vsn}{vsn}}, the function
\code{normalize.AffyBatch.vsn} \bold{exponentiates} the data. This is done in
order to make the behavior of this function similar to the other
normalization methods in affy. There, it is assumed that in subsequent
analysis steps (e.g. in \code{\LinkA{medpolish}{medpolish}}), the logarithm to
base 2 needs to be taken.
\end{Details}
\begin{Value}
An object of class \code{\LinkA{AffyBatch}{AffyBatch}}.
\end{Value}
\begin{Author}\relax
Wolfgang Huber \url{http://www.ebi.ac.uk/huber}
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{vsn}{vsn}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
### The example has been commented out because it takes a long time.
### Please also refer to the vignette.

## library(affy)
## library(affydata)
## data(Dilution)

### let affy know about vsn
## normalize.AffyBatch.methods <- c(normalize.AffyBatch.methods, "vsn")

## es1 = expresso(Dilution[1:2], 
##        bg.correct       = FALSE,   ## bg correction is done by vsn
##        normalize.method = "vsn",
##        pmcorrect.method = "pmonly", 
##        summary.method   = "medianpolish")

## es2 = expresso(Dilution[1:2], 
##        bgcorrect.method = "rma",
##        normalize.method = "quantiles", 
##        pmcorrect.method = "pmonly",
##        summary.method   = "medianpolish")

## par(mfrow=c(2,2), pch=".")

### extract expression values
## x1 = exprs(es1)
## x2 = exprs(es2) 
 
### scatter plot
## plot(x1, main="vsn: chip 3 vs 4")
## plot(x2, main="rma: chip 3 vs 4")

### rank(mean) - difference plot
## ylim = c(-0.7, 0.7)
## plot(rank(rowSums(x1)), diff(t(x1)), ylim=ylim, main="rank(mean) vs differences")
## abline(h=0, col="red")

## plot(rank(rowSums(x2)), diff(t(x2)), ylim=ylim, main="rank(mean) vs differences")
## abline(h=0, col="red")
\end{ExampleCode}
\end{Examples}

