View source: R/combat_helpers.R
cb.correct.apply_cComBat | R Documentation |
ComBat allows users to adjust for batch effects in datasets where the batch covariate is known, using methodology described in Johnson et al. 2007. It uses either parametric or non-parametric empirical Bayes frameworks for adjusting data for batch effects. Users are returned an expression matrix that has been corrected for batch effects. The input data are assumed to be cleaned and normalized before batch effect removal.
cb.correct.apply_cComBat(Ys, Ts, Xs, Model)
Ys |
an |
Ts |
|
Xs |
|
Model |
a list containing the following parameters:
This model is output after fitting with |
Note: this code is adapted directly from the ComBat
algorithm featured in the 'sva' package.
an [n, d]
matrix, the batch-effect corrected data.
library(causalBatch)
sim <- cb.sims.sim_linear(a=-1, n=200, err=1/8, unbalancedness=3)
# fit batch effect correction for first 100 samples
cb.fit <- cb.correct.matching_cComBat(sim$Ys[1:100,,drop=FALSE], sim$Ts[1:100],
data.frame(Covar=sim$Xs[1:100,,drop=FALSE]), "Covar")
# apply to all samples
cor.dat <- cb.correct.apply_cComBat(sim$Ys, sim$Ts, data.frame(Covar=sim$Xs), cb.fit$Model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.