mergeBatches {casper} | R Documentation

## Merge two ExpressionSet objects by doing quantile normalization and computing partial residuals (i.e. substracting group mean expression in each batch). As currently implemented the method is only valid for balanced designs, e.g. each batch has the same number of samples per group.

### Description

`mergeBatches` combines `x` and `y` into an `ExpressionSet`, performs quantile normalization and adjusts for batch effects by subtracting the mean expression in each batch (and then adding the grand mean so that the mean expression per gene is unaltered).

### Usage

    mergeBatches(x, y, mc.cores=1)

### Arguments

`x` | `ExpressionSet` object with data from batch 1.
`y` | Either `ExpressionSet` object with data from batch 2, or `simulatedSamples` object with data from multiple simulations.
`mc.cores` | Number of processors to be used (ignored when `y` is an `ExpressionSet`)

### Value

When `y` is an `ExpressionSet`, `mergeBatches` returns an `ExpressionSet` with combined expressions. Its `featureData` contains a variable `"batch"` indicating the batch that each sample corresponded to.

When `y` is a `simulatedSamples` object, `mergeBatches` is applied to combine `x` with each dataset in `y` and a list of `ExpressionSet` objects is returned.

### Author(s)

David Rossell

### Examples

    #Fake data from 2 batches
    x <- matrix(rnorm(6),nrow=2)
    colnames(x) <- paste('x',1:3,sep='')
    y <- matrix(1+rnorm(6),nrow=2)
    colnames(y) <- paste('y',1:3,sep='')
    x <- new("ExpressionSet",exprs=x)
    y <- new("ExpressionSet",exprs=y)
    exprs(x)
    exprs(y)

    #Merge & adjust
    z <- mergeBatches(x,y)
    exprs(z)

[Package casper version 2.14.0 Index]