%\VignetteIndexEntry{ALL data intro}
%\VignetteDepends{ALL, randomForest}
%\VignettePackage{ALL}
%
% NOTE -- ONLY EDIT THE .Rnw FILE!!!  The .tex file is
% likely to be overwritten.
%
\documentclass[12pt]{article}

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


\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}}}
\newcommand{\Rmethod}[1]{{\texttt{#1}}}
\newcommand{\Rfunarg}[1]{{\texttt{#1}}}
\newcommand{\Rclass}[1]{{\textit{#1}}}

\textwidth=6.2in

\bibliographystyle{plainnat} 
 
\begin{document}
%\setkeys{Gin}{width=0.55\textwidth}

\title{Intro to ALL data for Bioc monograph}
\author{VJ Carey}
\maketitle

\section{Introduction}
This document is for authors of the Bioc monograph,
it just goes over various aspects of the ALL data.
Example analyses can be added here for illustration.

\section{Attachment and data list}
\begin{Schunk}
\begin{Sinput}
> library(ALL)
> data(ALL)
> show(ALL)
\end{Sinput}
\begin{Soutput}
ExpressionSet (storageMode: lockedEnvironment)
assayData: 12625 features, 128 samples 
  element names: exprs 
phenoData
  sampleNames: 01005, 01010, ..., LAL4 (128 total)
  varLabels and varMetadata:
    cod:  Patient ID
    diagnosis:  Date of diagnosis
    ...: ...
    date last seen:  date patient was last seen
    (21 total)
featureData
  featureNames: 1000_at, 1001_at, ..., AFFX-YEL024w/RIP1_at (12625 total)
  varLabels and varMetadata: none
experimentData: use 'experimentData(object)'
  pubMedIds: 14684422 
Annotation [1] "hgu95av2"
\end{Soutput}
\end{Schunk}
\section{Tables and graphs for phenodata}
\begin{Schunk}
\begin{Sinput}
> print(summary(pData(ALL)))
\end{Sinput}
\begin{Soutput}
     cod             diagnosis           sex          age              BT    
 Length:128         Length:128         F   :42   Min.   : 5.00   B2     :36  
 Class :character   Class :character   M   :83   1st Qu.:19.00   B3     :23  
 Mode  :character   Mode  :character   NA's: 3   Median :29.00   B1     :19  
                                                 Mean   :32.37   T2     :15  
                                                 3rd Qu.:45.50   B4     :12  
                                                 Max.   :58.00   T3     :10  
                                                 NA's   : 5.00   (Other):13  
 remission      CR              date.cr           t(4;11)       
 CR  :99   Length:128         Length:128         Mode :logical  
 REF :15   Class :character   Class :character   FALSE:86       
 NA's:14   Mode  :character   Mode  :character   TRUE :7        
                                                 NA's :35       
                                                                
                                                                
                                                                
  t(9;22)        cyto.normal        citog               mol.biol 
 Mode :logical   Mode :logical   Length:128         ALL1/AF4:10  
 FALSE:67        FALSE:69        Class :character   BCR/ABL :37  
 TRUE :26        TRUE :24        Mode  :character   E2A/PBX1: 5  
 NA's :35        NA's :35                           NEG     :74  
                                                    NUP-98  : 1  
                                                    p15/p16 : 1  
                                                                 
   fusion protein     mdr                kinet       ccr         
 p190     :17     Length:128         dyploid:94   Mode :logical  
 p190/p210: 8     Class :character   hyperd.:27   FALSE:74       
 p210     : 8     Mode  :character   NA's   : 7   TRUE :26       
 NA's     :95                                     NA's :28       
                                                                 
                                                                 
                                                                 
  relapse        transplant          f.u            date last seen    
 Mode :logical   Mode :logical   Length:128         Length:128        
 FALSE:35        FALSE:91        Class :character   Class :character  
 TRUE :65        TRUE :9         Mode  :character   Mode  :character  
 NA's :28        NA's :28                                             
\end{Soutput}
\end{Schunk}
\begin{Schunk}
\begin{Sinput}
> hist(cvv <- apply(exprs(ALL), 1, function(x) sd(x)/mean(x)))
\end{Sinput}
\end{Schunk}
\includegraphics{ALLintro-003}
\begin{Schunk}
\begin{Sinput}
> ok <- cvv > 0.08 & cvv < 0.18
> fALL <- ALL[ok, ]
> show(fALL)
\end{Sinput}
\begin{Soutput}
ExpressionSet (storageMode: lockedEnvironment)
assayData: 3841 features, 128 samples 
  element names: exprs 
phenoData
  sampleNames: 01005, 01010, ..., LAL4 (128 total)
  varLabels and varMetadata:
    cod:  Patient ID
    diagnosis:  Date of diagnosis
    ...: ...
    date last seen:  date patient was last seen
    (21 total)
featureData
  rowNames: 1005_at, 1007_s_at, ..., AFFX-YEL024w/RIP1_at (3841 total)
  varLabels and varMetadata: none
experimentData: use 'experimentData(object)'
  pubMedIds: 14684422 
Annotation [1] "hgu95av2"
\end{Soutput}
\begin{Sinput}
> allx2 <- data.frame(t(exprs(fALL)), class = ALL$BT)
\end{Sinput}
\end{Schunk}
\begin{Schunk}
\begin{Sinput}
> library(randomForest)
\end{Sinput}
\begin{Soutput}
randomForest 4.5-16 
Type rfNews() to see new features/changes/bug fixes.
\end{Soutput}
\begin{Sinput}
> rf1 <- randomForest(class ~ ., data = allx2)
> print(rf1)
\end{Sinput}
\begin{Soutput}
Call:
 randomForest(formula = class ~ ., data = allx2) 
               Type of random forest: classification
                     Number of trees: 500
No. of variables tried at each split: 61

        OOB estimate of  error rate: 44.88%
Confusion matrix:
   B B1 B2 B3 B4 T T1 T2 T3 T4 class.error
B  0  0  4  0  1 0  0  0  0  0   1.0000000
B1 0  9  8  2  0 0  0  0  0  0   0.5263158
B2 0  1 31  4  0 0  0  0  0  0   0.1388889
B3 0  0  9 14  0 0  0  0  0  0   0.3913043
B4 0  0  6  6  0 0  0  0  0  0   1.0000000
T  0  0  0  0  0 0  0  5  0  0   1.0000000
T1 0  0  0  0  0 0  0  0  0  0         NaN
T2 0  0  0  0  0 0  0 13  2  0   0.1333333
T3 0  0  0  0  0 0  0  7  3  0   0.7000000
T4 0  0  0  0  0 0  0  2  0  0   1.0000000
\end{Soutput}
\end{Schunk}
\end{document}
