% -*- mode: noweb; noweb-default-code-mode: R-mode; -*-
%\VignetteIndexEntry{affycomp report}
%\VignetteDepends{biobase}
%\VignettePackage{affycomp}
%documentclass[12pt, a4paper]{article}
\documentclass[12pt]{article}

\usepackage{amsmath}
\usepackage{hyperref}
\usepackage[authoryear,round]{natbib}

\textwidth=6.2in
\textheight=8.5in
%\parskip=.3cm
\oddsidemargin=.1in
\evensidemargin=.1in
\headheight=-.3in

\newcommand{\scscst}{\scriptscriptstyle}
\newcommand{\scst}{\scriptstyle}
\begin{document}
\title{Bioconductor Expression Assessment Tool for Affymetrix Oligonucleotide Arrays (affycomp)}
\maketitle
\tableofcontents

<<echo=F,results=hide>>=
library(affycomp)
@

In this report only assessment using the {\bf HGU95} spike-In experiment 
are presetned.  Figures 2,3, and 4b are therefore ommited.


<<echo=F>>=
for(i in 1:nrow(affycomp.info))
  cat(affycomp.info[i,1],affycomp.info[i,2],"\n")
@ 

<<echo=F>>=
cat("Overall signal to ratio assessment:\n")
tableOverallSNR(spikein.assessment2)
  
cat("\nExpected Rank (out of 12626) for genes with fold change of 2\nwhen all other genes are not differentially expressed\nstratified by nominal concentration.\n")
tableRanks(spikein.assessment2)

cat("\nTable 1 for Spike-in Data:\n")
tableAll(spikein.assessment)
cat("\nTable 2 for Spike-in Data:\n")
tableAll(spikein.assessment2)
@ 

\begin{figure}[htbp]
\begin{center}
<<fig=TRUE,echo=F>>=
affycompPlot(spikein.assessment$MA)
@
\end{center}
{Figure 1: The MA plot shows log fold change as a function of
    mean log expression level.  A set of 14 arrays representing a single
    experiment from the Affymetrix spike-in data are used for this plot.
    A total of 13 sets of fold changes are generated by comparing the
    first array in the set to each of the others. Spiked-in genes are
    symbolized by numbers representing the nominal $\log_2$ fold change
    for the gene.  Non-differentially expressed genes with observed fold
    changes larger than 2 are plotted in red. All other probesets are
    represented with black dots.}
\end{figure}

\begin{figure}[htbp]
\begin{center}
<<fig=TRUE,echo=FALSE>>=
affycomp.figure1b(spikein.assessment2$MA2)
@
\end{center}
{Figure 1b: The MA plot shows log fold change as a function of
    mean log expression level.  A set of 28 arrays representing a single
    experiment from the Affymetrix spike-in data are used for this plot.
    Fold changes are generated for all possible comparisons of the
    the first 14 arrays and the second 14 arrays.
    Spiked-in genes are 
    symbolized by numbers representing the nominal $\log_2$ fold change
    for the gene.  Of the genes that are spiked to be differentially
    expressed, only genes with small nominal fold changes are
    shown. The colors represent 
    four different groups: nominal concentration of genes being compared
    less than or equal to 2 picoMolar (blue), between 4 and 32 picoMolar
    (green), greater than or equal to 64 picoMolar (blue).
    Non-differentially expressed genes with observed fold 
    changes larger than 2 are plotted in red. All other probesets are
    represented with black dots.}
\end{figure}



\begin{figure}[htbp]
\begin{center}
<<echo=F,fig=TRUE>>=
affycomp.figure2b(spikein.assessment2$SpikeInSD)
@
\end{center}
  {Figure 2b:  For each non-spiked-in gene in the 28 arrays used in
  Figure 1b, we calculate the mean log 
  expression and the observed standard deviation across the 28
  replicates. The
  resulting scatterplot is smoothed to generate a single curve
  representing mean standard deviation as a function of mean log
  expression.}
\end{figure}



\begin{figure}[htbp]
\begin{center}
<<echo=F,fig=TRUE>>=
affycomp.figure4a(spikein.assessment$Signal,equal.lims=TRUE)
@
\end{center}
{Figure 4a) Average observed $log_2$ intensity plotted
    against nominal $log_2$ concentration for each spiked-in gene for
    all arrays in  Affymetrix spike-In experiment. The dashed line has the ideal slope of 1.}
\end{figure}

\begin{figure}[htbp]
\begin{center}
<<echo=F,fig=TRUE>>=
affycomp.figure4c(spikein.assessment2$LS)
@
\end{center}
{Figure 4c) Using the 28 arrays of Figure 1b, we compute local
  slopes.  As the slopes shown in Figure 4a), the local slopes
  represent the expected observed log fold-change for probesets 
  with true fold-change of 2 but they are presented as a
  function of the total nominal probeset concentration in the two 
  samples being compared. In theory the local slopes should be one so
  we show the bias (difference between the observed local slope and one).}
\end{figure}



\begin{figure}[htbp]
\begin{center}
<<echo=F,fig=TRUE>>=
affycomp.figure5a(spikein.assessment$FC)
@
\end{center}
  {Figure 5a) A typical identification rule for differential
      expression filters
      genes with fold change exceeding a given threshold.
      This figure shows average ROC curves  which offer a graphical
      representation of both specificity and sensitivity for such a
      detection rule. Average ROC curves based on comparisons with
      nominal fold changes ranging from 2 to 4096.}
\end{figure}

\begin{figure}[htbp]
\begin{center}
<<echo=F,fig=TRUE>>=
affycomp.figure5b(spikein.assessment$FC)
@
\end{center}
  {Figure 5b) As 5a) but with
      nominal fold changes equal to 2.}
\end{figure}

% Fig5cde.Rnw
\begin{figure}[htbp]
\begin{center}
<<echo=F,fig=TRUE>>=
affycomp.figure5c(spikein.assessment2$MA2)
@
\end{center}
{Figure 5c) As 5a) but for comparisons with both nominal concentrations at most
 4 picoMolar and nominal fold changes at most 2.}
\end{figure}

\begin{figure}[htbp]
\begin{center}
<<echo=F,fig=TRUE>>=
affycomp.figure5d(spikein.assessment2$MA2)
@   
\end{center}
{Figure 5d) As 5a) but for comparisons with both nominal concentrations between
 4 and 64 picoMolar and nominal fold changes at most 2.}
\end{figure}
    
\begin{figure}[htbp]
\begin{center}
<<echo=F,fig=TRUE>>=
affycomp.figure5e(spikein.assessment2$MA2)
@
\end{center}
{Figure 5e) As 5a) but for comparisons with both nominal concentrations at least
 64 and with nominal fold changes at most 2.}
\end{figure}
% end Fig5cde.Rnw

\begin{figure}[htbp]
\begin{center}
<<echo=F,fig=TRUE>>=
affycomp.figure6a(spikein.assessment$FC)
@
\end{center}
  {Figure 6a) Observed log fold changes plotted against
    nominal log fold changes. The dashed lines represent highest, 25th
    highest, 100th  highest, 25th percentile, 75th percentile,
    smallest 100th, smallest 25th, and smallest log fold change for
    the genes that were not differentially expressed.}
\end{figure}

\begin{figure}[htbp]
\begin{center}
<<echo=F,fig=TRUE>>=
affycomp.figure6b(spikein.assessment$FC)
@
\end{center}
  {Figure 6b) Like a) but
    the observed fold changes were calculated for spiked in genes with
    nominal concentrations no higher than 2pM.}
\end{figure}


\end{document}

