Lmer contrast analysis facade
Lmer contrast analysis facade
Details
Encapsulates the pipeline: strategy_lmer ->
build_model -> Contrasts ->
ContrastsModerated.
This facade requires data with hierarchy below the analysis subject, for example peptide-level measurements nested within proteins.
See also
Other modelling:
Contrasts,
ContrastsDEqMSFacade,
ContrastsFirth,
ContrastsLMFacade,
ContrastsLMMissingFacade,
ContrastsLimma,
ContrastsLimmaFacade,
ContrastsMissing,
ContrastsModerated,
ContrastsModeratedDEqMS,
ContrastsPlotter,
ContrastsProDA,
ContrastsROPECA,
ContrastsROPECAFacade,
ContrastsTable,
INTERNAL_FUNCTIONS_BY_FAMILY,
LR_test(),
Model,
ModelFirth,
ModelLimma,
build_contrast_analysis(),
build_model(),
build_model_limma(),
build_model_logistf(),
contrasts_fisher_exact(),
get_anova_df(),
get_complete_model_fit(),
get_p_values_pbeta(),
group_label(),
isSingular_lm(),
linfct_all_possible_contrasts(),
linfct_factors_contrasts(),
linfct_from_model(),
linfct_matrix_contrasts(),
merge_contrasts_results(),
model_analyse(),
model_summary(),
moderated_p_deqms(),
moderated_p_deqms_long(),
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_build_models_logistf(),
sim_make_model_lm(),
sim_make_model_lmer(),
strategy_limma(),
strategy_logistf(),
summary_ROPECA_median_p.scaled()
Methods
Method new()
initialize
Usage
ContrastsLmerFacade$new(lfqdata, modelstr, contrasts, ...)Arguments
lfqdataLFQData object
modelstrmodel formula string (e.g. "~ group_ + (1 | peptide_Id)")
contrastsnamed character vector of contrasts
...passed to
strategy_lmer
Examples
istar <- sim_lfq_data_peptide_config()
#> creating sampleName from fileName column
#> completing cases
#> completing cases done
#> setup done
istar$config <- old2new(istar$config)
lfqdata <- LFQData$new(istar$data, istar$config)
lfqdata <- lfqdata$get_Transformer()$log2()$lfq
#> Column added : log2_abundance
contrasts <- c("A_vs_Ctrl" = "group_A - group_Ctrl")
fa <- ContrastsLmerFacade$new(
lfqdata,
"~ group_ + (1 | peptide_Id) + (1 | sampleName)",
contrasts
)
#> boundary (singular) fit: see help('isSingular')
#> boundary (singular) fit: see help('isSingular')
#> boundary (singular) fit: see help('isSingular')
#> boundary (singular) fit: see help('isSingular')
#> boundary (singular) fit: see help('isSingular')
#> Warning: There were 4 warnings in `dplyr::mutate()`.
#> The first warning was:
#> ℹ In argument: `linear_model = purrr::map(data, model_strategy$model_fun, pb =
#> pb)`.
#> ℹ In group 2: `protein_Id = "7cbcrd~5725"`.
#> Caused by warning in `value[[3L]]()`:
#> ! WARN :Error: grouping factors must have > 1 sampled level
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 3 remaining warnings.
#> Joining with `by = join_by(protein_Id)`
head(fa$get_contrasts())
#> determine linear functions:
#> get_contrasts -> contrasts_linfct
#> contrasts_linfct
#> Joining with `by = join_by(protein_Id, contrast)`
#> # A tibble: 6 × 14
#> facade modelName protein_Id contrast diff std.error avgAbd statistic df
#> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 lmer WaldTest… 0EfVhX~00… A_vs_Ct… -8.32e-4 0.0730 4.34 -0.0115 28.9
#> 2 lmer WaldTest… BEJI92~52… A_vs_Ct… 3.22e-1 0.0832 4.22 2.81 11.6
#> 3 lmer WaldTest… Fl4JiV~86… A_vs_Ct… -4.13e-2 0.0850 4.38 -0.503 39.5
#> 4 lmer WaldTest… HvIpHG~90… A_vs_Ct… -3.72e-1 0.0616 4.40 -5.65 21.8
#> 5 lmer WaldTest… JcKVfU~96… A_vs_Ct… -1.07e-1 0.0577 5.05 -1.88 79.8
#> 6 lmer WaldTest… SGIVBl~57… A_vs_Ct… 3.07e-2 0.0695 4.68 0.452 61.0
#> # ℹ 5 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
#> # sigma <dbl>, FDR <dbl>
fa$to_wide()
#> # A tibble: 6 × 5
#> protein_Id diff.A_vs_Ctrl p.value.A_vs_Ctrl FDR.A_vs_Ctrl statistic.A_vs_Ctrl
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 0EfVhX~0087 -0.000832 0.991 0.991 -0.0115
#> 2 BEJI92~5282 0.322 0.0161 0.0484 2.81
#> 3 Fl4JiV~8625 -0.0413 0.618 0.783 -0.503
#> 4 HvIpHG~9079 -0.372 0.0000113 0.0000680 -5.65
#> 5 JcKVfU~9653 -0.107 0.0637 0.127 -1.88
#> 6 SGIVBl~5782 0.0307 0.653 0.783 0.452