%\VignetteIndexEntry{GeneGroupAnalysis:  a package for performance assessment and comparison for survival analysis}
%\VignetteDepends{MCMCpack, GO.db}
%\VignetteSuggests{AnnotationDbi, annotate}
%\VignetteKeywords{Breast Cancer, Survival Analysis, GeneExpression, DifferentialExpression}
%\VignettePackage{survcomp}

\documentclass[12pt]{article}

\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage[numbers]{natbib}
\usepackage[american]{babel}
\usepackage{authblk}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{Sweave}
\renewcommand{\topfraction}{0.85}
\renewcommand{\textfraction}{0.1}
\usepackage{tikz}
\usepackage[utf8]{inputenc}

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

%------------------------------------------------------------
% newcommand
%------------------------------------------------------------
\newcommand{\scscst}{\scriptscriptstyle}
\newcommand{\scst}{\scriptstyle}
\newcommand{\Robject}[1]{{\texttt{#1}}}
\newcommand{\Rfunction}[1]{{\texttt{#1}}}
\newcommand{\Rclass}[1]{\textit{#1}}
\newcommand{\Rpackage}[1]{\textit{#1}}
\newcommand{\Rexpression}[1]{\texttt{#1}}
\newcommand{\Rmethod}[1]{{\texttt{#1}}}
\newcommand{\Rfunarg}[1]{{\texttt{#1}}}

\begin{document}

%------------------------------------------------------------
\title{\vspace{-2cm}\Rpackage{GeneGroupAnalysis}:  a package to perform gene-set significance analysis for data sets with cross-sectional or time series designs.}
%------------------------------------------------------------
\author[1]{Alejandro Quiroz-Z\'{a}rate}
\author[1,2,3]{John Quackenbush}

\affil[1]{Department of Biostatistics, Harvard University}
\affil[2]{Computational Biology and Functional Genomics Laboratory, Dana-Farber Cancer Institute, Harvard School of Public Health}
\affil[3]{Center for Cancer Computational Biology, Dana-Farber Cancer Institute}


\SweaveOpts{highlight=TRUE, tidy=TRUE, keep.space=TRUE, keep.blank.space=FALSE, keep.comment=TRUE, keep.source=true}

%<<setup,echo=FALSE>>=
%library(pgfSweave)
%setCacheDir("cache")
%options(keep.source=TRUE)
%@

\maketitle
\tableofcontents

%------------------------------------------------------------
\clearpage
\section{Introduction}
%------------------------------------------------------------ 
The \Rpackage{GeneGroupAnalysis} package provides functions to perform statistical identification of gene functional classes that behave in a distinct manner between the phenotypes of interest for data sets under cross-sectional or time series designs. This package includes (i) functions to perform gene set comparison (ii) examples to visualize the results of such comparisons.

%------------------------------------------------------------
\subsection{Installation}
%------------------------------------------------------------ 
\Rpackage{GeneGroupAnalysis} requires that \Rpackage{MCMCpack},  \Rpackage{AnnotationDbi},  \Rpackage{GO.db}, \Rpackage{annotate}, \Rpackage{tcltk} and  \Rpackage{R} (>= 2.10.0) are installed. These should be installed automatically when you install \Rpackage{GeneGroupAnalysis}. To install 	 	
\Rpackage{GeneGroupAnalysis}, source biocLite from bioconductor:

<<install-pkg, eval=false>>=
source("http://bioconductor.org/biocLite.R")
biocLite("GeneGroupAnalysis")
@

Load the \Rpackage{GeneGroupAnalysis}, into your current workspace:
<<loadlib, eval=false>>=
library(GeneGroupAnalysis)
@ 
%------------------------------------------------------------
\subsection{Further help}
%------------------------------------------------------------ 
To view the \Rpackage{GeneGroupAnalysis} description and a summary of all the functions within \Rpackage{GeneGroupAnalysis}, type the following:

<<GeneGroupAnalysishelp,results=hide,eval=false>>=
library(help=GeneGroupAnalysis)
@
%------------------------------------------------------------
\subsection{Citing}
%------------------------------------------------------------ 
We are delighted if you use this package. Please do email us if you find a bug or have a suggestion.  We would be very grateful if you could cite:\\

Quiroz-Zarate A and  Quackenbush J (2012). \textit{Manuscript in preparation} .

%------------------------------------------------------------
\section{Two simple cases: from gene expression to functional class selection.}
%------------------------------------------------------------ 
We will very briefly demonstrate the use of some functions in \Rpackage{GeneGroupAnalysis} by providing its application on two data sets with different experimental design. \\

We use the \Rpackage{breastCancerVDX} data library from Bioconductor for demonstration purposes under a cross-sectional design. This data set corresponds to the data set from \cite{Minn2007}. Minn, AJ  and colleagues used Affymetrix U133A Gene Chips to profile gene expression in $286$ fresh-frozen tumor samples from patients with lymph-node-negative breast cancer who were treated during $1980-95$, but who did not receive systemic neoadjuvant or adjuvant therapy. These samples correspond from the data set used in \cite{Wang2005} with GEO reference accession number GSE2034, from the tumor bank at the Erasmus Medical Center in Rotterdam, Netherlands. An additional $58$ estrogen receptor-negative samples were added from \cite{Minn2007} GEO (GSE5327). In total $209$ tumor samples are classified as ER+ and $135$ as ER-. Even though this data set comes from a $5$-year follow-up design, the way the data is conceived for this analysis is cross-sectional.
For purposes of providing an example on the use of the functions on the package the data set with cross-sectional design has a $70\%$ of the samples with ER+ and with ER- where selected randomly selected.\\

For a demonstration on a data set with a time series design we use the \Rpackage{rheumaticConditionWOLLBOLD} data library from Bioconductor. This data set corresponds to the data used in \cite{Wollbold2009}. Wollbold and colleagues used Affymetrix U133plus2 Gene Chips to profile expression of Synovial fibroblasts (SFB) cell cultures derived from six patients with rheumatic diseases, three with rheumatoid arthritis (RA) and three with osteoarthritis (OA). For each patient, SFB in culture were treated independently with TNF$\alpha$ and TGF$\beta$1 and profiled at $0,1,2,4$ and $12$ hours after treatment; all analyses were performed in duplicate. 

%------------------------------------------------------------
\subsection{Example: Data analysis under a cross-sectional setting.}
%------------------------------------------------------------ 
This is an example on how to perform an analysis with the proposed method in \cite{Quiroz2011} for a data set with cross-sectional design. This example is divided in two parts. The data preparation and the execution of the Gibb's sampler function.
%------------------------------------------------------------
\subsubsection{Data preprocessing stage}
%------------------------------------------------------------ 
The original gene expression data set Minn AJ and colleagues \cite{Minn2007} has a U133A Affymetrix platform. The normalized data set was saved to the variable \Robject{vdx} in the \Rpackage{breastCancerVDX} data library from Bioconductor. 
<<eval=true>>=
library(breastCancerVDX)
library(GeneGroupAnalysis)
library(hgu133a.db)
library(annotate)

data(vdx,package="breastCancerVDX")
#-Normalized expression data set
minn.data.expr=exprs(vdx)
#--- Checking that the columns correspond to their respective phenotype data id
#all(colnames(minn.data.expr)==rownames(pData(vdx)))
@

The data on \Robject{minn.data.expr} has the following appearance (maybe with a different column order):\\
\begin{tabular}{|c||c|c|c||c|c|c|}
\hline
 &\multicolumn{3}{c|}{ER $+$}&\multicolumn{3}{c|}{ER $-$}\\
\cline{2-7}
                      & Sample $1$ & $\ldots$ & Sample $209$ & Sample $1$ & $\ldots$ & Sample $135$\\
\hline\hline
Probe ID $1$  & $7.84$        & $\ldots$ & $7.31$        & $7.11$             & $\ldots$ & $6.98$     \\
    $\vdots$    & $\vdots$     & $\vdots$& $\vdots$     & $\vdots$          & $\vdots$ & $\vdots$ \\
Probe ID $q$  & $6.14$        & $\ldots$ & $6.81$        & $6.52$             & $\ldots$ & $6.37$     \\
\hline
\end{tabular}\\
\\
 The rows correspond the the measurements for the Affymetrix identifiers and the columns correspond to the gene expression measurements on the samples.\\
 
The first function from the \Rpackage{GeneGroupAnalysis} package to be used is \Rfunction{ArrayInfoFun}. The function arguments are the normalized data set and the mapping between the probe identifiers and the gene symbols. The output of this functions is a list with four items containing the necessary information from the respective array platform in therms of gene symbols and probe identifiers.
<<eval=true>>=
#---Checking the annotation of the data
#annotation(vdx)
array.info=ArrayInfoFun(minn.data.expr,hgu133aSYMBOL)
@

The vectors \Robject{er.pos} and \Robject{er.neg} contain the column identifiers of the samples with ER $+$ and ER $-$ status respectively. These vectors are obtained from the phenotype information provided along with the \Robject{vdx} eSet. Our next step is to obtain the probe identifiers with the largest variability between ER status across the samples for which there exist a gene symbol. By applying the \Rfunction{GeneMaxVarFun} we obtain a list the the row numbers of the probe identifiers that presented the largest variability and its associated Affymetrix identifier.
<<eval=true>>=
#---ER status of patients
er.status=pData(vdx)$er
er.pos=which(er.status==1)
er.neg=which(er.status==0)
genes.max.var=GeneMaxVarFun(array.info,minn.data.expr,er.pos,er.neg)
@

Before moving on, we will define the amount of gene functional classes to considered for the analysis. At the moment the \Rpackage{GeneGroupAnalysis} package only considers Gene Ontology (GO) functional classes.  For this example we will focus on its Cellular Component (CC) ontology up to a depth of $3$ on the CC directed acyclic graph (DAG). For this we use the \Robject{CC.trees}. This object contains the GO processes and their associated gene symbols. This annotation is a transformation from the original MSigDB "c5.all.v3.0.symbols.gmt" provided by the Broad Institute. It contains only the information provided by the respective Gene Ontology Gene Sets with no additional information. The function \Rfunction{GeneGrps2AffyGrpsFun} makes the gene symbol to their associated Affymetrix identifier transformation:
\footnotesize
<<eval=true>>=
GO2Gene.grps=GeneGrps2AffyGrpsFun("CC",3,array.info$genes.name.unique,genes.max.var$IndexMaxVar)
@
\normalsize

Gene functional classes with low number of genes may obscure the potential inferences drawn from the proposed method. With the objective to keep only the meaningful functional classes, the function \Rfunction{SizeGOAffyGrps} selects only those functional classes with our desired size. For this example we chose the minimum group size of $10$.
<<eval=true>>=
Minn07WrkngGrps=SizeGOAffyGrps(GO2Gene.grps$index.GO.grps,100)
@

In order to implement the Gibb's sampler procedure the data set \Robject{minn.data.expr} needs to be transformed to a data set with functional class expression measurements. The \Robject{MCMCData.cs} performs this transformation.
<<eval=true>>=
Minn07MCMCData=MCMCData.cs(Minn07WrkngGrps$groups,GO2Gene.grps$index.GO.grps,
GO2Gene.grps$GO.grps,minn.data.expr,er.pos,er.neg)
@

%------------------------------------------------------------
\subsubsection{Gibb's sampler executable example}
%------------------------------------------------------------ 
To implement the Gibbs sampler we need to define the empty objects in which the posterior samples of the parameters of interest are to be kept.  The Gibb's sampler implementation is in the following way (toy example):

\footnotesize
<<eval=true>>=
nsim=40       
burn.in=10   

v.SS.A.i=matrix(0,length(Minn07MCMCData$proc.GO),nsim)
v.SS.B.i=matrix(0,length(Minn07MCMCData$proc.GO),nsim)
v.SS.Al=rep(0,nsim)
v.beta.i=matrix(0,length(Minn07MCMCData$proc.GO),nsim)
v.alfa.i=matrix(0,length(Minn07MCMCData$proc.GO),nsim)
v.pi.a.i=matrix(0,length(Minn07MCMCData$proc.GO),nsim)
v.rho.a=rep(0,nsim)
#----- Initialization of the parameters
v.beta.i[,1]=rnorm(length(Minn07MCMCData$proc.GO),0,1)
v.alfa.i[,1]=rnorm(length(Minn07MCMCData$proc.GO),0,1)
v.SS.Al[1]=0.1   
L0.alfa=0.001
v.pi.a.i[,1]=runif(length(Minn07MCMCData$proc.GO))
v.rho.a[1]=0.1
Grps.apriori.diff.exp=23 
shape=3
scale=0.3
mm.pi=0.75
aa.pi=10
often=20
cut.off=0.7

result.MCMC=GeneGroupAnalysis::GibbsFun.cs(Minn07MCMCData$y.mu.a,Minn07MCMCData$y.mu.b,
Minn07WrkngGrps$group.size,v.beta.i,v.alfa.i,v.SS.A.i,v.SS.B.i,v.SS.Al,v.rho.a,v.pi.a.i,mm.pi,shape,
scale,aa.pi,Grps.apriori.diff.exp,nsim,burn.in,often,cut.off)
@
\normalsize
%------------------------------------------------------------
\subsubsection{Visualizing which gene groups are differentially expressed between phenotypes.}
%------------------------------------------------------------ 
To plot the probabilities of the functional classes of being differentially expressed we proposed the following:
\small
<<fig=true,eps=false>>=
#-------------------------------------------------
#- Executable example after the application of GibbsFun.cs.
#-------------------------------------------------
total=length(burn.in:nsim)
prob.a=apply(result.MCMC$Alfa[,burn.in:nsim],1,function(x) length(which(x!=0))/total)
no.groups=length(Minn07MCMCData$proc.GO)
plot(1:no.groups,prob.a,type="h",main="Probabilities of Alpha different to 0",
xlab="CC processes considered",ylab="probability of being differentially expressed")
abline(h=cut.off,lwd=2,col="red")
@
\normalsize

%------------------------------------------------------------
\subsection{Example: Data analysis under a time series setting.}
%------------------------------------------------------------ 
This is an example on how to perform an analysis with the proposed method in \cite{Quiroz2011} for a data set with time series design.\\
This example is divided in two parts. The data preparation and the execution of the Gibb's sampler function.
%------------------------------------------------------------
\subsubsection{Data preprocessing stage}
%------------------------------------------------------------ 
The original gene expression data set Wollbold J and colleagues \cite{Wollbold2009} use has a U133plus2 Affymetrix platform. The normalized data set was saved to the variable \Robject{wollbold} in the \Rpackage{rheumaticConditionWOLLBOLD} data library from Bioconductor.

<<eval=true>>=
library(GeneGroupAnalysis)
library(annotate)
library(rheumaticConditionWOLLBOLD)
library(hgu133plus2.db)

data(wollbold,package="rheumaticConditionWOLLBOLD")
#----Normalized expression data set
woll.data.exp=exprs(wollbold)
@

The data on \Robject{woll.data.exp} has the following appearance:\\
\footnotesize
\begin{tabular}{|c||c|c|c|c|c|c|c||c|c|c|c|c|c|c|}
\hline
                      &\multicolumn{7}{c||}{TGF}&\multicolumn{7}{c|}{TNF}\\
\cline{2-15}
                      &\multicolumn{3}{c|}{0hrs}&\multicolumn{1}{c|}{\ldots} &\multicolumn{3}{c||}{12hrs}&\multicolumn{3}{c|}{0hrs}&\multicolumn{1}{c|}{\ldots} &\multicolumn{3}{c|}{12hrs}\\
\cline{2-15}
                      &Sbj $1$  & $\ldots$ & Sbj $6$ &$\ldots$ &Sbj $1$  & $\ldots$ & Sbj $6$
 &Sbj $1$  & $\ldots$ & Sbj $6$ &$\ldots$ & Sbj $1$  & $\ldots$ & Sbj $6$\\
\hline\hline
Probe ID $1$   & $7.84$& $\ldots$ & $7.31$ &$\ldots$& $7.11$ & $\ldots$ & $6.98$ & $7.05$& $\ldots$ & $6.73$ &$\ldots$& $6.45$ & $\ldots$ & $6.89$\\
$\vdots$ & $\vdots$ & $\vdots$ & $\vdots$& $\vdots$ & $\vdots$ & $\vdots$ & $\vdots$ & $\vdots$ & $\vdots$ & $\vdots$& $\vdots$ & $\vdots$ & $\vdots$ & $\vdots$\\
Probe ID $q$   & $5.23$& $\ldots$ & $5.09$ &$\ldots$& $8.93$ & $\ldots$ & $8.34$ & $6.12$& $\ldots$ & $6.32$ &$\ldots$& $9.05$ & $\ldots$ & $8.89$\\
\hline
\end{tabular}\\
\normalsize
\\
 The rows correspond the the measurements for the Affymetrix identifiers. The subjects between stimuli are different, but are the same across time, meaning that Sbj $1$ at time 0 hrs under TGF is the same as Sbj $1$ at time 12 hrs under TGF, but different from the one on the same times but under TNF.

The first function from the \Rpackage{GeneGroupAnalysis} package to be used is \Rfunction{ArrayInfoFun}. The function arguments are the normalized data set and the mapping between the probe identifiers and the gene symbols. The output of this functions is a list with four items containing the necessary information from the respective array platform in therms of gene symbols and probe identifiers.

<<eval=true>>=
#---Checking the annotation of the data
#annotation(wollbold)
array.info=ArrayInfoFun(woll.data.exp,hgu133plus2SYMBOL)
@

The vectors \Robject{TGF.exp} and \Robject{TNF.exp} contain the column identifiers of the samples with TGF$\beta1$ and TNF$\alpha$
stimulus respectively. These vectors are obtained from the phenotype information provided along with the \Robject{wollbold} eSet. Our next step is to obtain the probe identifiers with the largest variability between stimuli status across the samples for which there exist a gene symbol. By applying the \Rfunction{GeneMaxVarFun} we obtain a list the the row numbers of the probe identifiers that presented the largest variability and its associated Affymetrix identifier.
<<eval=true>>=
#---ER status of patients
TGF.exp=1:30
TNF.exp=31:60
genes.max.var=GeneMaxVarFun(array.info,woll.data.exp,TGF.exp,TNF.exp)
@

Before moving on, we will define the amount of gene functional classes to considered for the analysis. At the moment the \Rpackage{GeneGroupAnalysis} package only considers Gene Ontology (GO) functional classes.  For this example we will focus on its Molecular Function (MF) ontology up to a depth of $3$ on the MF directed acyclic graph (DAG). For this we use the \Robject{MF.trees}. This object contains the GO processes and their associated gene symbols. This annotation is a transformation from the origial MSigDB "c5.all.v3.0.symbols.gmt" provided by the Broad Institute. It contains only the information provided by the respective Gene Ontology Gene Sets with no additional information. The function \Rfunction{GeneGrps2AffyGrpsFun} makes the gene symbol to their associated Affymetrix identifier transformation:
\footnotesize
<<eval=true>>=
GO2Gene.grps=GeneGrps2AffyGrpsFun("MF",3,array.info$genes.name.unique,genes.max.var$IndexMaxVar)
@
\normalsize

Gene functional classes with low number of genes may obscure the potential inferences drawn from the proposed method. With the objective to keep only the meaningful functional classes, the function \Rfunction{SizeGOAffyGrps} selects only those functional classes with our desired size. For this example we chose the minimum group size of $10$. 
<<eval=true>>=
Wollbold09WrkngGrps=SizeGOAffyGrps(GO2Gene.grps$index.GO.grps,100)
@

In order to implement the Gibb's sampler procedure the data set \Robject{woll.data.exp} needs to be transformed to a data set with functional class expression measurements. The \Rfunction{MCMCData.ts} performs this transformation.
\small
<<eval=true>>=
indexes.1=c(1,2,3,4,5,6)
Wollbold09MCMCData=MCMCData.ts(Wollbold09WrkngGrps$groups,GO2Gene.grps$index.GO.grps,
GO2Gene.grps$GO.grps,woll.data.exp,TGF.exp,TNF.exp,indexes.1,5)
@
\normalsize

The function \Rfunction{MCMCData.ts} differs from the \Rfunction{MCMCData.cs} function in the last two arguments. The first argument of these two is \Rfunarg{indexes.1}. This is a vector with the order in which the subjects are recorded across the time course considered on \Robject{woll.data.exp}. In this case \Rfunarg{indexes.1}$=c(1,2,3,4,5,6)$. The next argument is the number of time points in the time series. In \Robject{woll.data.exp} the number of time points considered is $5$: $0$hrs, $1$hrs, $2$hrs, $4$hrs and $12$hrs.\\

%------------------------------------------------------------
\subsubsection{Gibb's sampler executable example}
%------------------------------------------------------------ 
To implement the Gibbs sampler we need to define the empty objects in which the posterior samples of the parameters of interest are to be kept.  The Gibb's sampler implementation is in the following way (toy example):

\small
<<eval=true>>=
nsim=40
burn.in=10
Grps.apriori.diff.exp=23
shape=3
scale=0.1
mm.pi=0.75
aa.pi=10
often=20
cut.off=0.72
df.lambda=10
no.time.pnts=5
no.pcnts=6

v.SS.i=array(0,c(length(Wollbold09MCMCData$proc.GO),no.time.pnts,no.time.pnts,2))
v.SS.Al=array(0,c((no.time.pnts-1),(no.time.pnts-1),2))
v.beta.i=array(0,c(length(Wollbold09MCMCData$proc.GO),no.time.pnts,nsim))
v.alfa.0.i=matrix(0,length(Wollbold09MCMCData$proc.GO),nsim)
v.alfa.i=array(0,c(length(Wollbold09MCMCData$proc.GO),(no.time.pnts-1),nsim))
v.pi.a.i=matrix(0,length(Wollbold09MCMCData$proc.GO),nsim)
v.rho.a=rep(0,nsim)
v.beta.i[,,1]=rnorm(length(Wollbold09MCMCData$proc.GO),0,1)
v.alfa.i[,,1]=rnorm(length(Wollbold09MCMCData$proc.GO),0,1)
v.alfa.0.i[,1]=rnorm(length(Wollbold09MCMCData$proc.GO),0,1)
v.SS.Al[,,1]=diag(0.1,(no.time.pnts-1))
v.pi.a.i[,1]=runif(length(Wollbold09MCMCData$proc.GO))
v.rho.a[1]=0.1                
L0.alfa=diag(0.005,(no.time.pnts-1))

indexes.1=c(0,6,12,18,24) 
indexes.2=c(0,6,12,18)  

results.MCMC=GeneGroupAnalysis::GibbsNPFun.ts(Wollbold09MCMCData$y.mu.a,
Wollbold09MCMCData$y.mu.b,Wollbold09WrkngGrps$group.size,v.beta.i,v.alfa.0.i,
v.alfa.i,v.SS.Al,v.rho.a,v.pi.a.i,mm.pi,aa.pi,Wollbold09MCMCData$lambda,df.lambda,L0.alfa,
indexes.1,indexes.2,no.time.pnts,no.pcnts,Grps.apriori.diff.exp,nsim,burn.in,often,cut.off)
@
\normalsize

In \Rfunction{GibbsNPFun.ts} the vector \Rfunarg{indexes.1}  has the indices that indicate the column number on \Robject{woll.data.expr} where a new time point period starts. Vector \Rfunarg{indexes.2} does the same for the parameter Alpha (see \cite{Quiroz2011}). For both vectors first column number starts in $0$ ONLY for this function.

%------------------------------------------------------------
\subsubsection{Visualizing which gene groups are differentially expressed between phenotypes.}
%------------------------------------------------------------ 
To plot the probabilities of the functional classes of being differentially expressed we proposed the following:
\small
<<fig=true,eps=false>>=
#---------------------------------------------------
#- Executable example after the application of GibbsNPFun.ts
#---------------------------------------------------
total=length(burn.in:nsim)
prob.a=apply(results.MCMC$Alfa[,1,burn.in:nsim],1,function(x) length(which(x!=0))/total)
no.groups=length(Wollbold09MCMCData$proc.GO)
plot(1:no.groups,prob.a,type="h",main="Probabilities of Alpha different to 0",
xlab="CC processes considered",ylab="probability of being differentially expressed")
abline(h=cut.off,lwd=2,col="red")
@
\normalsize
%------------------------------------------------------------
\subsubsection{Obtaining of the functional classes differentially expressed between phenotypes.}
%------------------------------------------------------------ 
<<eval=true>>=
#---------------------------------------------------
#- Executable example after the application of GibbsNPFun.ts
#---------------------------------------------------
library(annotate)
library(GO.db)
selection=which(prob.a>=cut.off)
selected.GO.groups=GO2Gene.grps$GO.grps[Wollbold09WrkngGrps$groups][selection]
print(selected.GO.groups)
funct.classes=getGOTerm(selected.GO.groups)[[1]]
print(funct.classes)
@

\newpage
%------------------------------------------------------------
\section{Session Info}
%------------------------------------------------------------ 
<<sessionInfo,echo=FALSE,results=tex>>==
toLatex(sessionInfo())
@

\newpage
%------------------------------------------------------------
\section{Functions and Data sets within \Rpackage{GeneGroupAnalysis}}
%------------------------------------------------------------ 
For references to the following functions, please see \cite{Quiroz2011}.

\begin{table}[h]
\footnotesize
\begin{tabular}{p{5cm} p{11cm}}
\noindent \textsc{Function} & \noindent \textsc{Description}\\
ArrayInfoFun &   Function that extracts the required information from the data set\\
GOGrps2GeneGrpsFun & Function that translates GO functional classes into their respective gene symbol groups and into data matrix row number groups\\
GOProcsFun    &     Function that computes the GO functional classes to a desired depth of the GO DAG for the ontology of interest\\
GeneGroupAnalysis-package & Perform Gene Functional Class Analysis\\
GeneMaxVarFun    &    Function to compute the Affymetrix identifiers with the maximum variability between phenotypes\\
GibbsAllFun.ts    &       Function to compute the Gibb's sampler for the series data design\\
GibbsFun.cs      &        Function to compute the Gibb's sampler for the cross-sectional data design\\
GibbsNPFun.ts     &     Function to compute the Gibb's sampler for the series data design\\
MCMCData.cs      &     Function that computes the requiered data set objects for the Gibb's sampler under a cross-sectional data design\\
MCMCData.ts     &      Function that computes the requiered data set objects for the Gibb's sampler under a time series data design\\
MeanMatGrps.Aux.ts   &    Auxiliary function to 'MCMCData.ts'\\
SizeGOAffyGrps     &   Function to compute gene functional classes with a desired size\\
\end{tabular}
\end{table}
\normalsize
\newpage
%------------------------------------------------------------
% BIBLIO
%------------------------------------------------------------ 
\begin{thebibliography}{10}

\bibitem{Minn2007}
Minn AJ, Gupta GP, Padua D, Bos P, Nguyen DX, Nuyten D, Kreike B, Zhang Y, Wang Y, Ishwaran H, Foekens JA, Van de Vijver M and Massagu\'{e} J:
\newblock Lung Metastasis Genes Couple Breast Tumor Size and Metastatic Spread.
\newblock \textit{PNAS}, \textbf{104(16)}, 6740-6745. 2007.

\bibitem{Quiroz2011}
Quiroz-Zarate A and  Quackenbush J
\newblock XXXX: Genes as repeated measures of gene-set significance \textit{Journal}  
\newblock \textbf{Vol(Num):Page 1-Page N}. 2011.

\bibitem{Wang2005}
Wang Y, Klijn JGM, Zhang Y, Sieuwerts AM, Look MP, Yanh F, Talantov D, Timmermans M, Gelder, MEMG, Yu J, Jatkoe T, Berns EMJJ, Atkins D and Foekens JA:
\newblock Gene-expression Profiles to Predict Distant Metastasis of Lymph-Node-Negative Primary Breast Cancer.
\newblock \textit{Lancet}, \textbf{365}, 671-679. 2005.

\bibitem{Wollbold2009}
Wollbold J, Huber R, Pohlers D, Koczan D, Guthke R, Kinne RW and Gausmann U:
\newblock Adapted Boolean Network Models for Extracellular Matrix Formation.
\newblock \textit{BMC Systems Biology}, \textbf{3(77)}, 2009.

%\bibitem{}
%
%\newblock 
%\newblock \textit{}, \textbf{}, . .

\end{thebibliography}

\end{document}