esApply package:Biobase R Documentation _A_p_p_l_y _f_o_r _t_h_e _E_x_p_r_e_s_s_i_o_n _D_a_t_a _i_n '_e_x_p_r_S_e_t' _D_e_s_c_r_i_p_t_i_o_n: 'esApply' is a wrapper to apply for use with 'exprSet's and 'eSet's. Because the application of a function to the rows of the expression array usually involves variables in the 'phenoData' slot we have used a special evaluation paradigm here. The function 'FUN' may reference any data in phenoData by name. Consider defining the function as a method for 'exprSet', 'eSet' _U_s_a_g_e: esApply(X, MARGIN, FUN, ...) _A_r_g_u_m_e_n_t_s: X: An instance of class 'exprSet'. It is assumed that 'X' has information on gene expression for G genes in N tissue samples. MARGIN: The margin to apply to, either 1 for rows or 2 for columns. FUN: Any function ...: Additional parameters for 'FUN' _D_e_t_a_i_l_s: The 'phenoData' from 'X' is installed in an environment. This environment is installed as the environment of 'FUN'. This will then provide bindings for any symbols in 'FUN' that are the same as the names of the 'phenoData' of 'X'. If 'FUN' has an environment already it is retained but placed after the newly created environment. Some variable shadowing could occur under these circumstances. _V_a_l_u_e: The result of 'apply(exprs(X),MARGIN, FUN, ...)'. _A_u_t_h_o_r(_s): V.J. Carey , R. Gentleman _S_e_e _A_l_s_o: 'apply', 'exprSet' _E_x_a_m_p_l_e_s: data(sample.exprSet.1) # we know that eset has covariates in the pData called "cov1" and "cov2" # here cov1 is an unbound value, it will be resolved by using the pData # here are two functions conforming to the esApply protocol mytt.demo <- function(y) { ys <- split( y, cov1 ) t.test( ys[[1]], ys[[2]] )$p.value } # obtain the p value of the slope associated with cov2, adjusting for cov1 # (if we were concerned with sign we could save the z statistic instead at coef[3,3] myreg.demo <- function( y ) { summary(lm(y~cov1+cov2))$coef[3,4] } newt <- esApply( sample.exprSet.1, 1, mytt.demo ) # a resampling method resamp <- function( ESET ) { ntiss <- ncol(exprs(ESET)) newind <- sample(1:ntiss, size=ntiss, replace=TRUE) ESET[newind,] } # a filter q3g100filt <- function( eset ) { apply( exprs(eset), 1, function(x)quantile(x,.75)>100 ) } # filter after resampling and then apply set.seed(123) rest <- esApply( { bool <- q3g100filt(resamp(sample.exprSet.1)); sample.exprSet.1[bool,] }, 1, mytt.demo )