Impute the missing values for mat2 using tail imputation approach if mat1 has more than percent1 (percentage) of quantified values and mat2 has less than percent2 (percentage) quantified values, and vice versa if paired is set to be true. That is if mat2 has percentage of quantified values more than percent1 and mat1 has percentage quantified values less than percent2.

ptImpute(
    mat1, 
    mat2, 
    percent1, 
    percent2, 
    m = 1.6, 
    s = 0.6, 
    paired = TRUE, 
    verbose = TRUE,
    assay
)

Arguments

mat1

a matrix (or PhosphoExperiment object) with rows correspond to phosphosites and columns correspond to replicates within treatment1.

mat2

a matrix (or PhosphoExperiment object) with rows correspond to phosphosites and columns correspond to replicates within treatment2.

percent1

a percent indicating minimum quantified percentages required for considering for imputation.

percent2

a percent indicating minimum quantified percentages required for considering for imputation.

m

a numeric number of for controlling mean downshifting.

s

a numeric number of for controlling standard deviation of downshifted sampling values.

paired

a flag indicating whether to impute for both treatment1 and treatment2 (default) or treatment2 only (if paired=FALSE).

verbose

Default to TRUE to show messages during the progress. All messages will be suppressed if set to FALSE

assay

an assay to be selected if mat is a PhosphoExperiment object.

Value

An imputed matrix

Examples


data('phospho.cells.Ins.sample')
grps = gsub('_[0-9]{1}', '', colnames(phospho.cells.Ins))
phospho.cells.Ins.filtered <- selectGrps(phospho.cells.Ins, grps, 0.5, n=1)

set.seed(123)
phospho.cells.Ins.impute <-
    scImpute(
    phospho.cells.Ins.filtered,
    0.5,
    grps)[,colnames(phospho.cells.Ins.filtered)]

set.seed(123)
phospho.cells.Ins.impute[,seq(6)] <- 
    ptImpute(phospho.cells.Ins.impute[,seq(7,12)],
phospho.cells.Ins.impute[,seq(6)], percent1 = 0.6, percent2 = 0, 
    paired = FALSE)
#> idx1: 28


# For PhosphoExperiment objects
# mat = PhosphoExperiment(
#     assay = phospho.cells.Ins.impute,
#     colData = S4Vectors::DataFrame(
#         groups = grps
#     )
# )
# SummarizedExperiment::assay(mat)[,seq(6)] <- 
#     ptImpute(SummarizedExperiment::assay(mat)[,seq(7,12)],
#         SummarizedExperiment::assay(mat)[,seq(6)], percent1 = 0.6, 
#         percent2 = 0, paired = FALSE)