\inputencoding{latin1}
\HeaderA{detectSB}{Spatial bias detection}{detectSB}
\methaliasA{detectSB.arrayCGH}{detectSB}{detectSB.arrayCGH}
\methaliasA{detectSB.default}{detectSB}{detectSB.default}
\begin{Description}\relax
This function detects spatial bias on array CGH.
\end{Description}
\begin{Usage}
\begin{verbatim}
## S3 method for class 'arrayCGH':
detectSB(arrayCGH, variable, proportionup=0.25,
proportiondown,type="up", thresholdup=0.2, thresholddown=0.2, ... ) 
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{arrayCGH}] Object of \code{\LinkA{arrayCGH}{arrayCGH}}.
\item[\code{variable}] Variable used to compare the mean of zones detected by
\code{\LinkA{nem}{nem}}
\item[\code{proportionup}] Maximal proportion of the array which may be
affected by spatial bias with high values.
\item[\code{proportiondown}] Maximal proportion of the array which may be
affected by spatial bias with low values.
\item[\code{type}] Type of spatial bias detected. Specify either "up" (to
detect spatial bias with high values), or "down" (to detect spatial
bias with low values) or "upanddown" (to detect both type of spatial bias).
\item[\code{thresholdup}] Threshold used to detect spatial bias with high values.
\item[\code{thresholddown}] Threshold used to detect spatial bias with low values.
\item[\code{...}] 
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
You must run the \code{\LinkA{arrayTrend}{arrayTrend}} and \code{\LinkA{nem}{nem}} function before detecting
spatial bias: the \code{\LinkA{arrayTrend}{arrayTrend}} computes a spatial trend
and the \code{\LinkA{nem}{nem}} function performs a
classification with spatial constraints defining different zones on
the array. Based on those results, spatial bias is detected.
\end{Details}
\begin{Value}
An object of class \code{arrayCGH} with the following added
information in the data.frame attribute \code{arrayValues}:
\begin{ldescription}
\item[\code{SB}] Spots located in zone of spatial bias are coded either by 1
(if they correspond to a spatial bias with high values) or by -1 (if
they correspond to a spatial bias with low values). Otherwise they
are coded by 0.
\end{ldescription}
\end{Value}
\begin{Note}\relax
People interested in tools for array-CGH analysis can
visit our web-page: \url{http://bioinfo.curie.fr}.
\end{Note}
\begin{Author}\relax
Philippe Hupé, \email{Philippe.Hupe@.curie.fr}.
\end{Author}
\begin{References}\relax
P. Neuvial, P. Hupé, I. Brito, S. Liva, E. Manié, C. Brennetot,
A. Aurias, F. Radvanyi, and E. Barillot. \emph{Spatial normalization of
array-CGH data}. In preparation.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{arrayTrend}{arrayTrend}}, \code{\LinkA{nem}{nem}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data(spatial)  ## arrays with local spatial effects

## Plot of LogRatio measured on the array CGH
arrayPlot(edge,"LogRatio", main="Log2-Ratio measured on the array
CGH", zlim=c(-1,1), bar="v", mediancenter=TRUE) 

## Spatial trend of the scaled log-ratios (the variable "ScaledLogRatio"
## equals to the log-ratio minus the median value of the corresponding
## chromosome arm)

edgeTrend <- arrayTrend(edge, variable="ScaledLogRatio",
span=0.03, degree=1, iterations=3, family="symmetric")   
arrayPlot(edgeTrend, variable="Trend", main="Spatial trend of the
array CGH", bar="v")  

## Not run: 
## Classification with spatial constraint of the spatial trend
edgeNem <- nem(edgeTrend, variable="Trend")
arrayPlot(edgeNem, variable="ZoneNem", main="Spatial zones identified
by nem", bar="v") 

# Detection of spatial bias
edgeDet <- detectSB(edgeNem, variable="LogRatio", proportionup=0.25,type="up", thresholdup=0.15) 
arrayPlot(edgeDet, variable="SB", main="Zone of spatial bias in red", bar="v")

# CGH profile 
plot(LogRatio ~ PosOrder, data=edgeDet$arrayValues,
col=c("black","red")[as.factor(SB)], pch=20, main="CGH profile: spots
located in spatial bias are in red")  
## End(Not run)
\end{ExampleCode}
\end{Examples}

