% This is a template file for Sweave used in MAGeCK
% Author: Wei Li, Shirley Liu lab
% Do not modify lines beginning with "#__".
\documentclass{article}

\usepackage{amsmath}
\usepackage{amscd}
\usepackage[tableposition=top]{caption}
\usepackage{ifthen}
\usepackage{fullpage}
\usepackage[utf8]{inputenc}

\begin{document}
\setkeys{Gin}{width=0.9\textwidth}

\title{MAGeCK Comparison Report}
\author{Wei Li}

\maketitle


\tableofcontents

\section{Summary}

%Function definition
<<label=funcdef,include=FALSE,echo=FALSE>>=
genreporttable<-function(comparisons,ngenes,direction,fdr1,fdr5,fdr25){
  xtb=data.frame(Comparison=comparisons,Genes=ngenes,Selection=direction,FDR1=fdr1,FDR5=fdr5,FDR25=fdr25);
  colnames(xtb)=c("Comparison","Genes","Selection","FDR1%","FDR5%","FDR25%");
  return (xtb);
}
@

The statistics of comparisons is as indicated in the following table. 

<<label=tab1,echo=FALSE,results=tex>>=
library(xtable)
#__GENE_SUMMARY_STAT__
cptable=genreporttable(comparisons,ngenes,direction,fdr1,fdr5,fdr25);
print(xtable(cptable, caption = "Summary of comparisons", label = "tab:one",
    digits = c(0, 0, 0, 0, 0, 0, 0),
    table.placement = "tbp",
    caption.placement = "top"))
@

The meanings of the columns are as follows.

\begin{itemize}
\item \textbf{Comparison}: The label for comparisons;
\item \textbf{Genes}: The number of genes in the library;
\item \textbf{Selection}: The direction of selection, either positive selection or negative selection;
\item \textbf{FDR1\%}: The number of genes with FDR $<$ 1\%;
\item \textbf{FDR5\%}: The number of genes with FDR $<$ 5\%;
\item \textbf{FDR25\%}: The number of genes with FDR $<$ 25\%;
\end{itemize}

The following figures show:

\begin{itemize}
\item Individual sgRNA read counts of selected genes in selected samples; 
\item The distribution of RRA scores and p values of all genes; and
\item The RRA scores and p values of selected genes.
\end{itemize}

%__INDIVIDUAL_PAGE__

\end{document}
