\Header{qualityParameters}{Calculation of quality characteristics for
DNA microarray hybridisations}
\keyword{utilities}{qualityParameters}
\begin{Description}\relax
Several quality measures are calculated.
The return value, i.e. a list of quality scores,
should be used as input argument for the function
\code{\Link{qualityDiagnostics}}.
For details on the quality measures
read the value section.
\end{Description}
\begin{Usage}
\begin{verbatim}qualityParameters(arrayDataObject, exprSetRGObject, spotIdentifier = "Name", slideNameColumn = "slideName", identifiersToBeSkipped=NA, resultFileName, verbose = TRUE)\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{arrayDataObject}] object of type \code{\Link{arrayData}};
required; default: missing
\item[\code{exprSetRGObject}] object of type \code{\Link{exprSetRG}};
required; default: missing
\item[\code{spotIdentifier}] character string; required; specifies a
column of \code{getSpotAttr(arrayDataObject)};
the column is used to determine spot replicas;
default: "Name"
\item[\code{slideNameColumn}] character string; required; specifies a
column of \code{getHybAttr(arrayDataObject)};
the column is used to extract the names
of the hybridisations; if not found
the hybridisations are consecutively numbered;
default: "slideName"
\item[\code{identifiersToBeSkipped}] vector of character strings of
spot identifiers to be excluded
from calculations;
required; default: \code{NA}
\item[\code{resultFileName}] character string; results are stored
in a tab-deliminated file if supplied;
default: missing
\item[\code{verbose}] logical; default \code{TRUE}
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
For details on the quality measures read the value section.
\end{Details}
\begin{Value}
returns a list of results, i.e. a
\code{data.frame} \code{qualityParameters} containing
several scores for each hybridisation, as well as
pairwise comparisons, i.e.
a matrix \code{slideDistance},
a matrix \code{slideDistanceLogRaw},
a matrix \code{slideDistanceGreen},
a matrix \code{slideDistanceGreenLogRaw},
a matrix \code{slideDistanceRed},
a matrix \code{slideDistanceRedLogRaw},
and an integer \code{replicateSpots},
i.e. the number of detected spot replicas.

The matrix \code{slideDistanceLogRaw} contains a  calculated
distance (similarity) for each pair of slides$_{ij}$,
i.e. the median absolute deviation (mad)
taken over all spots of the log-ratio of the raw data;
alike the matrix \code{slideDistance}
the mad taken over all spots of the difference
of the log-ratios 
(here: the difference of the normalised and transformed
expression values of the two channels on the slide).
Similarly the matrices  \code{slideDistanceGreen},
\code{slideDistanceGreenLogRaw},
\code{slideDistanceRed},
and \code{slideDistanceRedLogRaw} contain calculated distances
for each pair of slides$_{ij}$ based on the mad of the difference
of the same channel (normalised or logged) taken over all spots.


A brief summary of all parameters given in
the \code{data.frame} \code{qualityParameters}:

\code{width}
a robust estimate of the noise, i.e. the median absolute deviation
of the difference of the normalised channels taken over all spots, i.e.
the "width" of the scatterplot

\code{medianDistance}
a robust measure for the typical distance (similarity) of one slide
with all other slides, i.e. the median of the "distances"
between slides (c.f. \code{slideDistance}))

\code{correlation(LogRaw)}
of the expression values between the two normalised (log raw) channels
of the slide taken over all spots

\code{meanSignalGreen}
the mean taken over all spots of the green raw data channel 

\code{meanSignalRed}
the mean taken over all spots of the red raw data channel

\code{meanSignal}
mean taken over all spots of the raw data of both channels,

\code{signalRangeGreen}
the range between the 10th and 95th percentile
of the signal intensities given in the green raw data channel

\code{signalRangeRed}
the range between the 10th and 95th percentile
of the signal intensities given in the red raw data channel

\code{backgroundRangeGreen}
the range between the 10th and 95th percentile
of the background intensities given in the green raw data channel

\code{backgroundRangeRed}
the range between the 10th and 95th percentile
of the background intensities given in the red raw data channel

\code{signalToBackgroundGreen}
the ratio of the median signal intensity and the median background
intensity given in the green raw data channel

\code{signalToBackgroundRed}
the ratio of the median signal intensity and the median background
intensity given in the red raw data channel

\code{spotReplicatesConcordanceGreen(LogRaw)}
the median of the standard deviations of all spot replicas
for each unique identifier
of the normalised (log raw) green channel is calculated;
in case of duplicates, i.e.
\code{replicateSpots == 2},
the Pearson and Spearman correlation is calculated instead

\code{spotReplicatesConcordanceGreen(LogRaw)}
the median of the standard deviations of all spot replicas
for each unique identifier
of the normalised (log raw) green channel is calculated;
in case of duplicates, i.e.
\code{replicateSpots == 2},
the Pearson and Spearman correlation is calculated instead

\code{greenvsAllGreen} and \code{redvsAllRed}
the correlation between each channel is measured against the
averaged (median) channel over all hybridisations
(like a virtual reference) separately for each channel
\end{Value}
\begin{Author}\relax
Andreas Buness <a.buness@dkfz.de>
\end{Author}
\begin{SeeAlso}\relax
\code{\Link{qualityDiagnostics}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
      spotIdentifierVec <- c("A","A","Blank","B","B","Blank")
      hybNames <- "H1"
      R1 <- N1 <- c(1,1,9,2,2,10)
      R2 <- N2 <- c(2,2,7,4,4,8)
      rawDataIntensityValues <- array(0, dim=c(6,2,1))
      rawDataIntensityValues[,1,] <- R1
      rawDataIntensityValues[,2,] <- R2
      dimnames(rawDataIntensityValues) <- list(NULL, c("green","red"), NULL)
      spotAttr <- data.frame(Name=I(spotIdentifierVec))
      hybAttr <- data.frame(slideName=I(hybNames))
      arrayDataObject <- new("arrayData", intensities=rawDataIntensityValues, hybAttrList=list(red=hybAttr,green=hybAttr), spotAttr=spotAttr)
      indGreen <- 1
      indRed <- 2
      channels <- matrix( c(indGreen,indRed), nrow=length(indGreen), byrow=FALSE )
      colnames(channels) <- c("green","red")
      exprSetRGObject <- new("exprSetRG",       
      exprs <- matrix(c(R1,R2), nrow=6, byrow=FALSE), phenoData=        
          new("phenoData", pData=data.frame(matrix(0,nrow=2,ncol=1)),
              varLabels=list(rep("varLabel1",1))), channels=channels)           
      Re1 <- qualityParameters(arrayDataObject=arrayDataObject, exprSetRGObject=exprSetRGObject, identifiersToBeSkipped= "Blank")
      stopifnot(all.equal.numeric(as.numeric(Re1$qualityParameters["H1",c("correlation")]),c(1)))
      stopifnot(Re1$replicateSpots==2)

   

        \end{ExampleCode}
\end{Examples}

