batchCorrectionAssay | R Documentation |
SummarizedExperiment
The function batchCorrectionAssay
removes the batch effect of
(count/intensity) values of a SummarizedExperiment
.
It uses either the removeBatchEffect
or ComBat
functions
or no batch effect correction method (pass-through,
none
).
batchCorrectionAssay(
se,
method = c("none", "removeBatchEffect (limma)", "ComBat"),
batch = NULL,
batch2 = NULL,
...
)
se |
|
method |
|
batch |
|
batch2 |
|
... |
further arguments passed to |
The column batch
in colData(se)
contains the information
on the batch identity. For method = "removeBatchEffect (limma)"
,
batch2
may indicate a second series of batches.
Internal use in shinyQC
.
If batch
is NULL and method
is set to
method = "removeBatchEffect (limma)"
or method = "ComBat"
,
no batch correction will be performed (equivalent to
method = "none"
).
The method ComBat
will only perform batch correction on valid
features: (1) more or equal than two observations (no NA
) per level
and per feature, (2) variance greater than 0 per feature, and (3) more than
two valid features as given by (1) and (2). For non-valid features, values
are taken from assay(se)
.
matrix
## create se
a <- matrix(seq_len(100), nrow = 10, ncol = 10,
dimnames = list(seq_len(10), paste("sample", seq_len(10))))
a[c(1, 5, 8), seq_len(5)] <- NA
set.seed(1)
a <- a + rnorm(100)
cD <- data.frame(name = colnames(a),
type = c(rep("1", 5), rep("2", 5)), batch = rep(c(1, 2), 5))
rD <- data.frame(spectra = rownames(a))
se <- SummarizedExperiment::SummarizedExperiment(assay = a,
rowData = rD, colData = cD)
## method = "removeBatchEffect (limma)"
batchCorrectionAssay(se, method = "removeBatchEffect (limma)",
batch = "batch", batch2 = NULL)
## method = "ComBat"
batchCorrectionAssay(se, method = "ComBat",
batch = "batch", batch2 = NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.