ContrastsMissing | R Documentation |
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.
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
new()
initialize
ContrastsMissing$new( lfqdata, contrasts, confint = 0.95, p.adjust = prolfqua::adjust_p_values, modelName = "groupAverage" )
lfqdata
LFQData
contrasts
array of contrasts (see example)
confint
confidence interval
p.adjust
method for p-value adjustment - default Benjamini Hochberg
modelName
default "groupAverage"
get_contrast_sides()
get contrasts sides
ContrastsMissing$get_contrast_sides()
get_contrasts()
table with results of contrast computation
ContrastsMissing$get_contrasts(all = FALSE)
all
FALSE, do not show all columns (default)
get_Plotter()
get ContrastsPlotter
ContrastsMissing$get_Plotter()
Contrast_Plotter
to_wide()
convert contrast results to wide format
ContrastsMissing$to_wide(columns = c("p.value", "FDR", "statistic"))
columns
value column default p.value
data.frame
clone()
The objects of this class are cloneable with this method.
ContrastsMissing$clone(deep = FALSE)
deep
Whether to make a deep clone.
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()
Nprot <- 120
istar <- prolfqua::sim_lfq_data_protein_config(Nprot = Nprot,weight_missing = .4)
istar$data$abundance |> is.na() |> sum()
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()
res <- csi$get_contrasts()
stopifnot(nrow(res) == (protIntensity$protein_Id |> unique() |> length()))
res$contrast |> table()
stopifnot((res$p.value |> is.na() |> sum()) == 0)
plot(res$diff, -log10(res$p.value), pch = ".")
csi$column_description()
x<- csi$get_Plotter()
p <- x$volcano()
pdf(file = NULL)
print(p)
dev.off()
dd <- prolfqua::sim_lfq_data_2Factor_config(Nprot = 100,weight_missing = 0.1)
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()
pl <- csi$get_Plotter()
pdf(file = NULL)
pl$volcano()
dev.off()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.