Compute contrasts with group mean imputation
Compute contrasts with group mean imputation
If there are no observations in one of the groups for some of the proteins, the group mean cannot be estimated. Therefore, assuming that the observation is missing because the protein abundance is below the detection limit, we substitute the unobserved group with the median of protein abundances observed only in one sample of the group. The variance of a protein is estimated using the pooled variance of all observations of all groups.
Other modelling:
Contrasts
,
ContrastsModerated
,
ContrastsPlotter
,
ContrastsProDA
,
ContrastsROPECA
,
ContrastsTable
,
INTERNAL_FUNCTIONS_BY_FAMILY
,
LR_test()
,
Model
,
build_model()
,
contrasts_fisher_exact()
,
get_anova_df()
,
get_complete_model_fit()
,
get_p_values_pbeta()
,
isSingular_lm()
,
linfct_all_possible_contrasts()
,
linfct_factors_contrasts()
,
linfct_from_model()
,
linfct_matrix_contrasts()
,
merge_contrasts_results()
,
model_analyse()
,
model_summary()
,
moderated_p_limma()
,
moderated_p_limma_long()
,
my_contest()
,
my_contrast()
,
my_contrast_V1()
,
my_contrast_V2()
,
my_glht()
,
pivot_model_contrasts_2_Wide()
,
plot_lmer_peptide_predictions()
,
sim_build_models_lm()
,
sim_build_models_lmer()
,
sim_make_model_lm()
,
sim_make_model_lmer()
,
strategy_lmer()
,
summary_ROPECA_median_p.scaled()
prolfqua::ContrastsInterface
-> ContrastsMissing
subject_Id
subject_id e.g. protein_ID column
contrasts
array with contrasts (see example)
modelName
model name
contrast_result
data frame with results of contrast computation
lfqdata
data frame
confint
confidence interval
p.adjust
function to adjust p-values
global
Take global or local values for imputation
present
default 1, presence in interaction to infer limit of detection.
minsd
default 1, if standard deviation can not be estimated, what is the prior minimum sd, default = 1s
Inherited methods
new()
initialize
ContrastsMissing$new(
lfqdata,
contrasts,
confint = 0.95,
p.adjust = prolfqua::adjust_p_values,
modelName = "groupAverage"
)
to_wide()
convert contrast results to wide format
ContrastsMissing$to_wide(columns = c("p.value", "FDR", "statistic"))
Nprot <- 120
istar <- prolfqua::sim_lfq_data_protein_config(Nprot = Nprot,weight_missing = .4)
#> creating sampleName from fileName column
#> completing cases
istar$data$abundance |> is.na() |> sum()
#> [1] 283
protIntensity <- istar$data
config <- istar$config
lProt <- LFQData$new(protIntensity, config)
lProt$rename_response("transformedIntensity")
Contr <- c("dil.b_vs_a" = "group_A - group_Ctrl")
csi <- ContrastsMissing$new(lProt, contrasts = Contr)
csi$get_contrast_sides()
#> # A tibble: 1 × 3
#> contrast group_1 group_2
#> <chr> <chr> <chr>
#> 1 dil.b_vs_a group_A group_Ctrl
res <- csi$get_contrasts()
#> [1] "group_"
#> completing cases
#> dil.b_vs_a=group_A - group_Ctrl
#> dil.b_vs_a=group_A - group_Ctrl
#> dil.b_vs_a=group_A - group_Ctrl
stopifnot(nrow(res) == (protIntensity$protein_Id |> unique() |> length()))
res$contrast |> table()
#>
#> dil.b_vs_a
#> 120
stopifnot((res$p.value |> is.na() |> sum()) == 0)
plot(res$diff, -log10(res$p.value), pch = ".")
csi$column_description()
#> column_name
#> modelName modelName
#> contrast contrast
#> avgAbd avgAbd
#> diff diff
#> FDR FDR
#> statistic statistic
#> std.error std.error
#> df df
#> p.value p.value
#> conf.low conf.low
#> conf.high conf.high
#> sigma sigma
#> description
#> modelName type of model
#> contrast name of difference e.g. group1_vs_group2
#> avgAbd mean abundance value of protein in all samples
#> diff difference among conditions
#> FDR false discovery rate
#> statistic t-statistics
#> std.error standard error
#> df degrees of freedom
#> p.value p-value
#> conf.low lower value of 95 confidence interval
#> conf.high high value of 95 confidence interval
#> sigma residual standard deviation of linear model (needed for empirical Bayes variance shrinkage).
x<- csi$get_Plotter()
p <- x$volcano()
pdf(file = NULL)
print(p)
#> $p.value
#>
#> $FDR
#>
dev.off()
#> pdf
#> 2
dd <- prolfqua::sim_lfq_data_2Factor_config(Nprot = 100,weight_missing = 0.1)
#> creating sampleName from fileName column
#> completing cases
Contrasts <- c("c1" = "TreatmentA - TreatmentB",
"C2" = "BackgroundX- BackgroundZ",
"c3" = "`TreatmentA:BackgroundX` - `TreatmentA:BackgroundZ`",
"c4" = "`TreatmentB:BackgroundX` - `TreatmentB:BackgroundZ`"
)
lProt <- LFQData$new(dd$data, dd$config)
lProt$rename_response("transformedIntensity")
csi <- ContrastsMissing$new(lProt, contrasts = Contrasts)
res <- csi$get_contrasts()
#> [1] "Treatment" "Background"
#> completing cases
#> [1] "Treatment"
#> completing cases
#> [1] "Background"
#> completing cases
#> c1=TreatmentA - TreatmentB
#> C2=BackgroundX- BackgroundZ
#> c3=`TreatmentA:BackgroundX` - `TreatmentA:BackgroundZ`
#> c4=`TreatmentB:BackgroundX` - `TreatmentB:BackgroundZ`
#> c1=TreatmentA - TreatmentB
#> C2=BackgroundX- BackgroundZ
#> c3=`TreatmentA:BackgroundX` - `TreatmentA:BackgroundZ`
#> c4=`TreatmentB:BackgroundX` - `TreatmentB:BackgroundZ`
#> c1=TreatmentA - TreatmentB
#> C2=BackgroundX- BackgroundZ
#> c3=`TreatmentA:BackgroundX` - `TreatmentA:BackgroundZ`
#> c4=`TreatmentB:BackgroundX` - `TreatmentB:BackgroundZ`
pl <- csi$get_Plotter()
pdf(file = NULL)
pl$volcano()
#> $p.value
#>
#> $FDR
#>
dev.off()
#> pdf
#> 2