% -*- mode: noweb; noweb-default-code-mode: R-mode; -*-
%\VignetteIndexEntry{affy primer}
%\VignetteKeywords{Preprocessing, Affymetrix}
%\VignetteDepends{affy}
%\VignettePackage{affy}
%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): Comparison to MAS 5.0}

\maketitle

<<echo=F,results=hide>>=
library(affycomp)
data(mas5.assessment)
@

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

Table:
<<echo=F>>=
tableAll(mas5.assessment,tmp.assessment)
@ 

\begin{figure}[htbp]
\begin{center}
<<echo=F,fig=TRUE>>=
affycompPlot(mas5.assessment$MA)
@
\end{center}
Figure 1: for MAS 5.0: 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}
<<echo=F,fig=TRUE>>=
affycompPlot(tmp.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. 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}

Or you can use the auxiliary figure functions that will need to have a
specific assessment list
\begin{figure}[htbp]
\begin{center}
<<echo=F,fig=TRUE>>=
affycomp.compfig2(list(mas5.assessment$Dilution,tmp.assessment$Dilution),
                  method.names=c("MAS 5.0",tmp.assessment$method.name))
@
\end{center}
Figure 2:   For each gene,
  and each experimental condition, we calculate the mean log
  expression and the observed standard deviation across   5
  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.compfig3(list(mas5.assessment$Dilution,tmp.assessment$Dilution),
                  method.names=c("MAS 5.0",tmp.assessment$method.name))
@
\end{center}
Figure 3: This plot, using the GeneLogic dilution data,
  shows the sensitivity of fold change calculations to total RNA
  abundance.  Average log fold-changes between liver and CNS for the
  lowest concentration and the   highest in the dilution data set are
  computed.  Orange and red color is used to denote genes with
$M_{6g}-M_{1g}$ bigger than $\log_2(2)$ and $\log_2(3)$
respectively. The rest are denoted with black.
\end{figure}

\begin{figure}[htbp]
\begin{center}
<<echo=F,fig=TRUE>>=
affycomp.compfig4a(list(mas5.assessment$Signal,tmp.assessment$Signal),
                  method.names=c("MAS 5.0",tmp.assessment$method.name))
@
\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.
\end{figure}

\begin{figure}[htbp]
\begin{center}
<<echo=F,fig=TRUE>>=
affycomp.compfig4b(list(mas5.assessment$Dilution,tmp.assessment$Dilution),
                  method.names=c("MAS 5.0",tmp.assessment$method.name))
@
\end{center}
  Figure 4b) For the GeneLogic
    dilution data, log expression values are regressed against their
    log nominal concentration. The slope estimates are plotted against
    average log intensity across all concentrations.
\end{figure}

\begin{figure}[htbp]
\begin{center}
<<echo=F,fig=TRUE>>=
affycomp.compfig5a(list(mas5.assessment$FC,tmp.assessment$FC),
                  method.names=c("MAS 5.0",tmp.assessment$method.name))
@
\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. b) As a) but with
  nominal fold changes equal to 2.
\end{figure}

\begin{figure}[htbp]
\begin{center}
<<echo=F,fig=TRUE>>=
affycomp.compfig5b(list(mas5.assessment$FC2,tmp.assessment$FC2),
                  method.names=c("MAS 5.0",tmp.assessment$method.name))
@
\end{center}
  Figure 5b) As a) but with
      nominal fold changes equal to 2.
\end{figure}

\begin{figure}[htbp]
\begin{center}
<<echo=F,fig=TRUE>>=
affycomp.figure6a(mas5.assessment$FC,main="a) MAS 5.0",ylim=c(-12,12))
@
\end{center}
  Figure 6a MAS: 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.figure6a(tmp.assessment$FC,main=paste("a)",tmp.assessment$method.name) ,ylim=c(-12,12))
@
\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(mas5.assessment$FC,main="b) MAS 5.0",ylim=c(-6,6))
@
\end{center}
  Figure 6b for MAS 5.0: Like 6a) but
    the observed fold changes were calculated for spiked in genes with
    nominal concentrations no higher than 2pM.
\end{figure}

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

\end{document}
