doImputation.Rd
Perform imputation of missing values (represented by NA
) in one assay
in a SummarizedExperiment
, and generate a new assay containing the
complete data (including imputed values).
doImputation(sce, method, assayName, imputedAssayName, ...)
A SummarizedExperiment
object (or a derivative).
Character scalar giving the imputation method. Currently,
"MinProb"
(provided in the MsCoreUtils
package),
"impSeqRob"
(provided in the rrcovNA
package), and
"MinProbGlobal"
(a reimplementation of the MinProb algorithm
using a global mean value rather than sample-specific ones) are
supported.
Character scalar giving the name of the assay in sce
to be imputed. The matrix should have missing values represented as
NA
.
Character scalar providing the name that will be given to the assay containing the imputed values.
Additional arguments that will be passed on to the imputation function.
An object of the same type as sce
with an additional assay
named imputedAssayName
.
## Import data
sce <- importExperiment(system.file("extdata", "mq_example",
"1356_proteinGroups.txt",
package = "einprot"),
iColPattern = "^iBAQ\\.")$sce
## Log-transform iBAQ values
SummarizedExperiment::assay(sce, "log2_iBAQ") <-
log2(SummarizedExperiment::assay(sce, "iBAQ"))
## Replace non-finite values by NA
SummarizedExperiment::assay(sce, "log2_iBAQ")[!is.finite(
SummarizedExperiment::assay(sce, "log2_iBAQ"))] <- NA
## Impute missing values
sce <- doImputation(sce, method = "MinProb", assayName = "log2_iBAQ",
imputedAssayName = "imputed_iBAQ")
#> Imputing along margin 2 (samples/columns).
#> [1] 1.265887
SummarizedExperiment::assayNames(sce)
#> [1] "iBAQ" "MS.MS.Count" "LFQ.intensity"
#> [4] "Intensity" "Sequence.coverage" "Unique.peptides"
#> [7] "Razor.unique.peptides" "Peptides" "Identification.type"
#> [10] "log2_iBAQ" "imputed_iBAQ"