ppsetApply {affy} | R Documentation

## Apply a function over the ProbeSets in an AffyBatch

### Description

Apply a function over the ProbeSets in an AffyBatch

### Usage

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

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

### Arguments

`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`

### Details

### Value

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

### Author(s)

Laurent Gautier <laurent@cbs.dtu.dk>

### See Also

`ProbeSet-class`

### Examples

    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")

[Package affy version 1.14.2 Index]