ppsetApply               package:affy               R Documentation

_A_p_p_l_y _a _f_u_n_c_t_i_o_n _o_v_e_r _t_h_e _P_r_o_b_e_S_e_t_s _i_n _a_n _A_f_f_y_B_a_t_c_h

_D_e_s_c_r_i_p_t_i_o_n:

     Apply a function over the ProbeSets in an AffyBatch

_U_s_a_g_e:

     ppsetApply(abatch, FUN, genenames = NULL, ...)

     ppset.ttest(ppset, covariate, pmcorrect.fun = pmcorrect.pmonly, ...)

_A_r_g_u_m_e_n_t_s:

  abatch: An object inheriting from 'AffyBatch'.

   ppset: An object of class 'ProbeSet'.

covariate: the name a covariate in the slot 'phenoData'.

pmcorrect.fun: a function to corrrect PM intensities

     FUN: A function working on a 'ProbeSet' 

genenames: A list of Affymetrix probesets ids to work with. All probe
          set ids used when 'NULL'.

     ...: Optional parameters to the function 'FUN' 

_V_a_l_u_e:

     Returns a 'list' of objects, or values, as returned by the
     function 'FUN' for each 'ProbeSet' it processes.

_A_u_t_h_o_r(_s):

     Laurent Gautier <laurent@cbs.dtu.dk>

_S_e_e _A_l_s_o:

     'ProbeSet-class'

_E_x_a_m_p_l_e_s:

     ppset.ttest <- function(ppset, covariate, pmcorrect.fun = pmcorrect.pmonly, ...) {
       probes <- do.call("pmcorrect.fun", list(ppset))
       my.ttest <- function(x) {
         y <- split(x, get(covariate))
         t.test(y[[1]], y[[2]])$p.value
       }
       r <- apply(probes, 1, my.ttest)
       return(r)
     }
     ##this takes a long time - and rowttests is a good alternative
     ## eg: rt = rowttests(exprs(Dilution), Dilution$liver)
     ## Not run: 
       data(Dilution)
       all.ttest <- ppsetApply(Dilution, ppset.ttest, covariate="liver")
     ## End(Not run)

