%\VignetteDepends{}
%\VignetteIndexEntry{Course Introduction}
%\VignettePackage{AdvancedR2011}

\documentclass{beamer}

\usepackage{BioconductorSlides}
\SweaveOpts{keep.source=TRUE}

\title{Advanced \R{} Programming: Course Introduction}
\author{Martin Morgan \\ Fred Hutchinson Cancer Research Center}
\date{17-18 February, 2011}

\begin{document}

<<setup, echo=FALSE>>=
options(width = 40)
library(ggplot2)
@ 

\frame{\titlepage}

\begin{frame}{Advanced \R{} Programming}
  \begin{enumerate}
  \item Efficient \R{}
  \item Interfacing with common resources: SQL, netCDF
  \item Using and writing S4 classes and methods
  \item `Foreign language' interface: \Rfunction{.C},
    \Rfunction{.Fortran}, \Rfunction{.Call}
  \item Packages
  \end{enumerate}
\end{frame}

\begin{frame}{\Bioconductor{}: Analysis and Comprehension of High 
    Throughput Genomic Data}
  Hallmarks of effective computational software
  \begin{enumerate}
  \item Extensive: data, annotation
  \item Statistical: volume, technology, experimental design
  \item Reproducible: long-term, multi-participant science
  \item Leading edge: novel, technology-driven
  \item Accessible: affordable, transparent, usable
  \end{enumerate}
\end{frame}

\begin{frame}{Course Structure: \Rpackage{StudentGWAS}}
  \begin{columns}
    \column{.5\textwidth}
    Develop a package to manage a genome-wide association study.
    \begin{itemize}
    \item \textbf<1>{Thousands of samples} with measured covariates
      including case / control disease status
    \item \textbf<2>{Millions of SNPs} assayed with commercial
      microarrays
    \item \textbf<3>{Goal}: identify SNPs associated with disease
      status; integrate with existing body of knowledge
    \end{itemize}
    
    \column{.5\textwidth}
    \only<1>{
      \begin{tabular}{lccc}
        Id & Status & \ldots & Array \\\hline
        1 & Case & \ldots & A\\
        2 & Case & \ldots & B\\
        \ldots \\
        M & Control & \ldots & Z\\\hline
      \end{tabular}
      \bigskip\par
      \begin{tabular}{lccc}
        Array & Date & Facility & \ldots \\\hline
        A & 12/1/09 & FHCRC & \ldots \\
        \ldots \\
        Z & 2/16/11 & JHU & \ldots\\\hline
      \end{tabular}
    }
    \only<2>{
      \begin{tabular}{lcccc}
        Id & snp1 & snp2 & \ldots & snpN \\\hline
        1 & AA & CC & \ldots & AA \\
        2 & AA & CC & \ldots & AT \\
        \ldots \\
        M & AC & CC & \ldots & AA\\\hline
      \end{tabular}
    }
    \only<3>{
<<echo=FALSE,fig=TRUE>>=

set.seed(123)
p <- 0.9
Snp1 <- factor(sample(c("AA", "AC", "CC"), 1000, TRUE,
                      c(p^2, 2*p*(1-p), (1-p)^2)))
Score <- as.integer(Snp1) + rnorm(length(Snp1))
Status <- factor(ifelse(Score > 1, "Case", "Control"),
                 levels=c("Control", "Case"))
df0 <- data.frame(Snp1=Snp1, Score=Score, Status=Status)
df <- as.data.frame(xtabs(~Status+Snp1, df0))

print(ggplot(df, aes(Snp1, Status)) + 
    geom_point(aes(size=Freq), legend=FALSE) + 
    scale_area(to=c(1, 25), legend=FALSE) +
    xlab("    SNP 1") +
    opts(axis.title.x=theme_text(size=30),
         axis.text.y=theme_text(colour = "grey50", 
           size = 10, hjust = .5, lineheight = 0.9, angle=90),
         axis.title.y=theme_text(size=30, angle=90)))
@ 
    }
  \end{columns}
\end{frame}

\begin{frame}{Logistics}
  Each portion of course:
  \begin{itemize}
  \item Presentation to motivate and orient
  \item Collaboration to implement specific capabilities
  \item Review common challenges / concepts
  \item Update \Rpackage{StudentGWAS} to reflect development
  \end{itemize}
\end{frame}

\end{document}

%% Local Variables:
%% compile-command: "R CMD make -f devmakefile CourseIntroduction.pdf"
%% End:
