%
% NOTE -- ONLY EDIT THE .Rnw FILE!!!  The .tex file is
% likely to be overwritten.
%
%\VignetteDepends{MVCClass}
%\VignetteKeywords{Model, View, Controller}
%\VignettePackage{BioMVCClass}
%\VignetteIndexEntry{BioMVCClass}

\documentclass[11pt]{article}


\usepackage{amsmath}
\usepackage[authoryear,round]{natbib}
\usepackage{hyperref}
\usepackage{times}
\usepackage{comment}
\usepackage{epsfig}
\usepackage{graphics}
\usepackage{graphicx}


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

\newcommand{\scscst}{\scriptscriptstyle}
\newcommand{\scst}{\scriptstyle}

\newcommand{\Rfunction}[1]{{\texttt{#1}}}
\newcommand{\Robject}[1]{{\texttt{#1}}}
\newcommand{\Rpackage}[1]{{\textit{#1}}}


\bibliographystyle{plainnat}

\title{Extensions to the Model-View-Controller Package}
\author{Elizabeth Whalen}
\date{July 28, 2006}

\begin{document}
\maketitle

\section{Overview}\label{Sec:Overview}

The \Rpackage{BioMVCClass} package extends the model and view classes that are
defined in the \Rpackage{MVCClass} package.  These new classes were not placed
in the \Rpackage{MVCClass} package because we did not want that package to
depend on the \Rpackage{Biobase}, \Rpackage{graph}, and \Rpackage{Rgraphviz}
packages.  The classes defined in the \Rpackage{MVCClass} and
\Rpackage{BioMVCClass} packages let developers create model-view-controller
applications of linked, interactive views of data.  Please see the
\Rpackage{MVCClass} Vignette for more information on that package.
The \Rpackage{BioMVCClass} package depends on the \Rpackage{MVCClass},
\Rpackage{Biobase}, \Rpackage{graph}, and \Rpackage{Rgraphviz} packages.

\section{Model Classes}\label{Sec:Model}

The model class is responsible for storing and updating the data.  These two
functions are reflected in Figure \ref{Fig:Model}, which shows the inheritance
structure for the model classes.  Here the virtual class,
\Robject{gModel}, has the slots: modelData, linkData, virtualData, modelName,
and modelVar.  These five slots are common information that all models need.  
The modelData slot is the data set for this model, the linkData slot is
a list of two functions, \Rfunction{toParent} and \Rfunction{fromParent},
which link this model to its parent and child models, respectively (see Section
\ref{Sec:MVC}), the virtualData slot is data pertaining to the views
that needs to be stored with the model so that it can be shown in all views of
this model, the modelName slot is the name of the model (and the name of the
MVC), and the modelVar slot is a list of named model variables (for example, a
statistic for each element in the model).  Note that in Figure
\ref{Fig:Model}, the \Robject{gModel} class is defined in the
\Rpackage{MVCClass} package and the \Robject{graphModel}, \Robject{exprModel},
and \Robject{gseModel} classes are defined in the \Rpackage{BioMVCClass}
package. 

\begin{figure}[ht]
  \begin{center}
    \scalebox{0.8}{\includegraphics{BioModelClass.jpg}}
    \caption{ Inheritance for Model Objects. }
    \label{Fig:Model}
  \end{center}
\end{figure}

For specific model classes, there are \Robject{graphModel},
\Robject{exprModel}, and \Robject{gseModel}.  The
\Robject{graphModel} class represents a model where the modelData has class
\Robject{graph}, the \Robject{exprModel} class represents a model where the
modelData has class \Robject{ExpressionSet}, and the \Robject{gseModel} class
represents a model where the modelData has class \Robject{GSE}.  The
\Robject{GSE} class, which is defined in the \Rpackage{BioMVCClass} package,
is discussed below in Section \ref{Ssec:GSE}.

\subsection{Gene Set Enrichment (GSE) Class}\label{Ssec:GSE}

One type of data that we are interested in studying is data from a gene set
enrichment (GSE) analysis.  This data is bound in a class called GSE, which
has the slots incidMat, gTestStat, gsTestStat, expData, and descr.  The
incidMat slot holds the incidence matrix that shows which genes belong to
which gene sets, the gTestStat slot holds the test statistic that relates the
gene to the phenotype, the gsTestStat slot holds the gene set test statistic
that is calculated by multiplying the incidence matrix and the gene test
statistics, the expData slot holds the experimental data, and the descr slot
is a description of the gene sets being studied.  The class definition for
\Robject{GSE} is shown in Figure \ref{Fig:GSE}. 

\begin{figure}[ht]
  \begin{center}
    \scalebox{0.3}{\includegraphics{GSE.jpg}}
    \caption{ The Gene Set Enrichment (GSE) Class. }
    \label{Fig:GSE}
  \end{center}
\end{figure}

The \Robject{GSE} class is then used in the modelData slot of the
\Robject{gseModel} class. 

\section{View Classes}\label{Sec:View}

The view classes represent the visual depictions of the model.  All views
need to store some common information and respond to certain events through
methods.  This consideration led to an object model where the different view
classes inherit from a view virtual class, called \Robject{genView}.  The
object model for the view classes is shown in Figure \ref{Fig:View}.  Note
that in Figure \ref{Fig:View}, the \Robject{genView} and \Robject{plotView}
classes are defined in the \Rpackage{MVCClass} package and the
\Robject{graphView}, and \Robject{heatmapView} classes are defined in the
\Rpackage{BioMVCClass} package. 

\begin{figure}[ht]
  \begin{center}
    \scalebox{0.8}{\includegraphics{BioViewClass.jpg}}
    \caption{ Inheritance for View Objects. }
    \label{Fig:View}
  \end{center}
\end{figure}

The \Robject{genView} class has three slots, dataName, win, and winNum.
dataName is the name of the model that the view displays, win is the Gtk
window object that holds the view, and winNum is the number of the window so
that the window can be identified in the GUI that other packages create.  All 
views need to know these three pieces of information so \Robject{genView} 
binds the view classes together. 

When creating a plot of a data set, there is a general class, called
\Robject{plotView}, that has the slots, plotDevice, plotPar, and drArea, which
store the device number of the plot, the plotting parameters, and the Gtk
drawing area object, respectively.  This class is a virtual class because it
is not intended to have any objects as it just represents a general plot.  The
plot classes that can have objects are the specific plot classes,
\Robject{graphView} and \Robject{heatmapView}, which inherit from the
\Robject{plotView} class. 

The \Robject{graphView} class represents a graph plot view and it has the
extra slot, grLayout, which holds a \Robject{Ragraph} object that represents
the layout of the graph plot.  The \Robject{heatmapView} represents a heatmap
view of the data and it contains the slots, ordering and rNames, which are a
list that is returned from the \Rfunction{heatmap} function to give
information about the dendrogram ordering and the names of the rows from the
model that are shown in the heatmap, respectively.  Note that some of these
views are only applicable for certain model types.  For example, the
\Robject{graphView} class only makes sense for a view of a graph object, which
would be stored in the \Robject{graphModel} class. 

%% note: the heatmapView class may need to be changed to include slots for row
%% and column images!!!

\section{Conclusions}\label{Sec:Conc}

This package is intended to be a behind the scenes package that is used by
other packages for its class definitions.  Currently, this package is used by
the \Rpackage{iSNetwork} package.

\end{document}

