%\VignetteIndexEntry{crlmm copy number Vignette for Illumina}
%\VignetteDepends{crlmm}
%\VignetteKeywords{crlmm, illumina}
%\VignettePackage{crlmm}
\documentclass{article}
\usepackage{graphicx}
\usepackage{natbib}
\newcommand{\Rfunction}[1]{{\texttt{#1}}}
\newcommand{\Rmethod}[1]{{\texttt{#1}}}
\newcommand{\Rcode}[1]{{\texttt{#1}}}
\newcommand{\Robject}[1]{{\texttt{#1}}}
\newcommand{\Rpackage}[1]{{\textsf{#1}}}
\newcommand{\Rclass}[1]{{\textit{#1}}}
\newcommand{\oligo}{\Rpackage{oligo }}
\newcommand{\R}{\textsf{R}}

\begin{document}
\title{Copy number estimation and genotype calling with \Rpackage{crlmm}}
\date{Oct, 2009}
\author{Rob Scharpf}
\maketitle

<<setup, echo=FALSE, results=hide>>=
options(width=60)
options(continue=" ")
options(prompt="R> ")
@ 

<<>>=
library(Biobase)
library(crlmm)
setwd("/thumper/ctsa/snpmicroarray/illumina/IDATS/370k")
@ 

<<readIdat>>=
samplesheet5 = read.csv("HumanHap370Duo_Sample_Map.csv", header=TRUE, as.is=TRUE)[-c(28:46,61:75,78:79),]
if(!exists("RG")){
	RG <- readIdatFiles(samplesheet5, arrayInfoColNames=list(barcode=NULL, position="SentrixPosition"), saveDate=TRUE)
}
@ 

Alternatively, arguments to the readIdatFiles can be passed through the
{\tt ...} argument of the \R{} function \Robject{crlmmWrapper}.

<<wrapper>>=
crlmmWrapper(sampleSheet=samplesheet5,
	     arrayInfoColNames=list(barcode=NULL, position="SentrixPosition"), 
	     saveDate=TRUE,
	     cdfName=cdfName,
	     load.it=FALSE,
	     save.it=TRUE,
	     intensityFile=file.path(platedir, "normalizedIntensities.rda"),
	     crlmmFile=file.path(platedir, "snpsetObject.rda"),
	     rgFile=file.path(platedir, "rgFile.rda"),
	     platform="illumina")
@ 

Note: the code below is run for testing purposes only. None of these
functions are exported, so would not routinely be run directly by the
user.  A typical analysis would involve runnning crlmmWrapper() followed
by update() to obtain copy number.


<<SNR>>=
hist(crlmmOut$SNR) ##approx. 5-fold higher than what we see in Affy!
@ 

\end{document}