ScpModel-DataCorrection | R Documentation |
The function uses the data modelling output to generate corrected
data that can be used for downstream analysis. The input
is expected to be a SingleCellExperiment
object that contains an
estimated ScpModel
. There are two approaches:
scpKeepEffect()
: keep the effects of interests. The
reconstructed data is the sum of the effect matrices for the
variable of interest and the residuals. Note that the intercepts
(baseline intensity of each feature) are not included by
default, but they can be added when intercept = TRUE
.
scpRemoveBatchEffect()
: remove any undesired effect. The batch
corrected data is the input data minus the effect matrices that
correspond to batch effect variables. Note that the intercepts
(baseline intensity of each feature) are removed by default, but
they can be kept when intercept = FALSE
.
Despite the two approaches are conceptually different, they can lead to similar results if the effects that are used to reconstruct the data are the ones that are not removed when performing batch correction (see examples).
The function returns a new SingleCellExperiment
that contains an
assay with the batch corrected data. Note that the 'ScpModel' is
erased in this new object.
scpKeepEffect(object, effects = NULL, intercept = FALSE, name)
scpRemoveBatchEffect(object, effects = NULL, intercept = TRUE, name)
object |
An object that inherits from the
|
effects |
A |
intercept |
A |
name |
A |
Christophe Vanderaa, Laurent Gatto
ScpModel for functions to extract information from the
ScpModel
object
ScpModel-Workflow to run a model on SCP data required for batch correction.
data("leduc_minimal")
scpModelFormula(leduc_minimal)
reconstructed <- scpKeepEffect(leduc_minimal, effects = "SampleType")
batchCorreced <- scpRemoveBatchEffect(
leduc_minimal, effects = c("Channel", "Set", "MedianIntensity")
)
## The two approaches are identical
identical(reconstructed, batchCorreced)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.