This file is indexed.

/usr/lib/R/site-library/Biobase/doc/esApply.Rnw is in r-bioc-biobase 2.38.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
%
% NOTE -- ONLY EDIT THE .Rnw FILE!!!  The .tex file is
% likely to be overwritten.
%
% \VignetteIndexEntry{esApply Introduction}
%\VignetteDepends{Biobase}
%\VignetteKeywords{Expression Analysis}
%\VignettePackage{Biobase}
\documentclass[12pt]{article}
\usepackage{amsmath,fullpage}
\usepackage[authoryear,round]{natbib}
\usepackage{hyperref}

\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}}}


\bibliographystyle{plainnat}

\begin{document}

\section*{A note on {\tt esApply}}

{\tt ExpressionSet}s are complex objects.
\Robject{exprs(ExpressionSet)} produces $G \times N$,
where $G$ is the number of genes on a chip and $N$ is
the number of tissues analyzed, and
\Robject{pData(ExpressionSet)} produces $N \times p$,
where $p$ is the number of phenotypic or demographic,
etc., variables collected.

Abstractly, we are often interested in evaluating
functions $f(y;x)$ where $y$ is an $N$-vector of
expression results for a specific gene and $x$ is
an $N$-dimensional structure, coordinated with $y$,
that distinguishes elements of $y$ for processing in
the function $f$. A basic problem is to guarantee that
the $j$th element of $y$ is correctly associated with
the $j$th component of $x$.

<<R.hide, results=hide, echo=FALSE>>=
library(Biobase)
data(sample.ExpressionSet)
@

As an example, let's consider \Robject{sample.ExpressionSet},
which is an \Rclass{ExpressionSet} supplied with Biobase.
We will print a little report, then the first $N$-vector of
gene expressions and some covariate data:

<<R>>=
print(sample.ExpressionSet)
print(exprs(sample.ExpressionSet)[1,])
print(pData(sample.ExpressionSet)[1:2,1:3])
@

Now let's see how expressions and a covariate are related:

<<R>>=
print(rbind(exprs(sample.ExpressionSet[1,]),
sex <- t(pData(sample.ExpressionSet))[1,]))
@

A function that evaluates the difference in median expression
across strata defined using an abstract covariate \Robject{x} is

<<R>>=
medContr <- function( y, x ) {
 ys <- split(y,x)
 median(ys[[1]]) - median(ys[[2]])
}
@

We can apply this to a small \Rclass{ExpressionSet} that gives
back the data listed above:

<<R>>=
print(apply(exprs(sample.ExpressionSet[1,,drop=F]), 1,
  medContr, pData(sample.ExpressionSet)[["sex"]]))
@

That's a bit clumsy.  This is where \Rfunction{esApply} comes
in.  We pay for some simplicity by following a strict protocol
for the definition of the statistical function to be applied.

<<R>>=
medContr1 <- function(y) {
 ys <- split(y,sex)
 median(ys[[1]]) - median(ys[[2]])
}

print(esApply( sample.ExpressionSet, 1, medContr1)[1])
@

The manual page on \Rfunction{esApply} has a number of
additional examples that show how applicable functions
can be constructed and used.  The important thing to
note is that the applicable functions {\em know} the names of
the covariates in the \Robject{pData} dataframe.

This is achieved by having an environment populated with all the
variables in \Rclass{phenoData(ExpressionSet)} put in as the
environment of the function that will be applied. If that function
already has an environment we retain that but in the second position.
Thus, there is some potential for variable shadowing.

\section{Session Information}

The version number of R and packages loaded for generating the vignette were:

\begin{verbatim}
<<echo=FALSE,results=tex>>=
sessionInfo()
@
\end{verbatim}


\end{document}