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' 

_D_e_t_a_i_l_s:

_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)
     }

     ## create a dataset
     data(affybatch.example)
     abatch <- merge(affybatch.example, affybatch.example2)
     intensity(abatch) <- 2^jitter(log2(intensity(abatch)),1,1)
     chip.variate <- c("a", "b", "a", "a", "b", "a")
     pData(abatch) <- data.frame(whatever = chip.variate)

     ## run a test over _all_ probes.
     all.ttest <- ppsetApply(abatch, ppset.ttest, covariate="whatever")

