%\VignetteIndexEntry{crlmmDownstream} %\VignetteKeywords{copy number, genotype, SNP} %\VignettePackage{VanillaICE} \documentclass{article} \usepackage{amsmath} \usepackage{graphicx} \usepackage[numbers]{natbib} \usepackage{color} \usepackage[margin=1in]{geometry} \newcommand{\scscst}{\scriptscriptstyle} \newcommand{\scst}{\scriptstyle} \newcommand{\Rpackage}[1]{\textit{#1}} \newcommand{\Rfunction}[1]{\texttt{#1}} \newcommand{\Robject}[1]{\texttt{#1}} \newcommand{\Rclass}[1]{\texttt{#1}} \newcommand{\R}{\textsf{R}} \newcommand{\hmmoptions}{\Robject{HmmOptions}} \newcommand{\hmmparam}{\Robject{HmmParameter}} \newcommand{\crlmm}{\Rpackage{crlmm}} \newcommand{\oligo}{\Rpackage{oligo}} \title{Integration with the crlmm package for copy number inference} \author{Robert Schgarpf} \begin{document} \maketitle We load a portion of chromosome 8 from 2 HapMap samples that were processed using the \Rpackage{crlmm} package. <>= library(oligoClasses) library(VanillaICE) library2(crlmm) library2(SNPchip) library2(IRanges) data(cnSetExample, package="crlmm") @ The data \Robject{cnSetExample} is an object of class \Rclass{CNSet}. We coerce the \Rclass{CNSet} object to a list class that contains information on copy number (log R ratios), genotypes, genotype probabilities, and B allele frequencies. <>= oligoList <- constructOligoSetListFrom(cnSetExample) @ The \verb+[[+ method can be used to extract a \Rclass{oligoSnpSet} for the first element in the list: <>= oligoSet <- oligoList[[1]] @ Next, we fit a 6-state hidden markov model from estimates of the B allele frequency and log R ratios. <>= res <- hmm(oligoSet, p.hom=0.1, nupdates=5, TAUP=1e8) @ The \texttt{TAUP} parameter scales the transition probability matrix. Larger values of \texttt{TAUP} makes it more expensive to transition from the normal copy number state to states with altered copy number. In the following code chunk, we use a lattice multi-panel display to plot each of the altered stated. We frame each alteration by plotting a genomic interval of 200kb on each side (using the \texttt{frame=200e3} argument): <>= rd <- res[chromosome(res) == "chr8", ] rd <- res[!state(res)%in%c(3,4), ] if(require(SNPchip)){ fig <- xyplotLrrBaf(rd, oligoSet, frame=200e3, panel=xypanelBaf, scales=list(x="free"), par.strip.text=list(cex=0.9), cex=0.4, state.col="black", state.cex=0.8, pch=21) } @ % %<>= %pdf("crlmmDownstream-latticeFig.pdf", width=10, height=7) %@ % <>= print(fig) @ % %<>= %dev.off() %@ \begin{figure}[t] \centering \includegraphics[width=\textwidth]{crlmmDownstream-latticeFig} \caption{\label{fig:chr8} Plot of log R ratios (grey) and B allele frequencies (blue). The B allele frequencies have a range of 0-1 and were rescaled for ease of viewing alongside the log R ratios. Each panel displays one region with a copy number alteration predicted from the 6-state HMM with padding on either side given by the \texttt{frame} argument.} \end{figure} \section{Session Information} The version number of R and packages loaded for generating the vignette were: <>= toLatex(sessionInfo()) @ \end{document}