Skip to contents

Limma contrast analysis with LOD imputation facade

Limma contrast analysis with LOD imputation facade

Details

Encapsulates the pipeline: strategy_limma -> build_model_limma_impute -> ContrastsLimma.

Proteins whose limma fit produces NA coefficients (typically from entire missing groups) are recovered by imputing missing values with the limit of detection (LOD) and refitting. The variance is borrowed from successful fits and degrees of freedom are corrected so that inference is not artificially precise from the constant imputation.

See also

Other modelling: AnovaExtractor, Contrasts, ContrastsDEqMSFacade, ContrastsFirth, ContrastsFirthFacade, ContrastsLMFacade, ContrastsLMImputeFacade, ContrastsLMMissingFacade, ContrastsLimma, ContrastsLimmaFacade, ContrastsLmerFacade, ContrastsMissing, ContrastsModerated, ContrastsModeratedDEqMS, ContrastsPlotter, ContrastsRLMFacade, ContrastsROPECA, ContrastsROPECAFacade, ContrastsTable, INTERNAL_FUNCTIONS_BY_FAMILY, LR_test(), Model, ModelFirth, ModelLimma, StrategyLM, StrategyLimma, StrategyLmer, StrategyLogistf, StrategyRLM, build_contrast_analysis(), build_model(), build_model_glm_peptide(), build_model_glm_protein(), build_model_impute(), build_model_limma(), build_model_limma_impute(), build_model_logistf(), compute_borrowed_variance(), compute_borrowed_variance_limma(), compute_contrast(), compute_lmer_contrast(), contrasts_fisher_exact(), get_anova_df(), get_complete_model_fit(), get_p_values_pbeta(), group_label(), impute_refit_singular(), 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(), new_lm_imputed(), 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()

Public fields

model

ModelLimma object (with imputed proteins)

contrast

ContrastsLimma object

.lfqdata

stored reference to input LFQData

.contrast_names

names of the requested contrasts

Methods


Method new()

initialize

Usage

ContrastsLimmaImputeFacade$new(
  lfqdata,
  modelstr,
  contrasts,
  lod = NULL,
  df_method = c("observed", "borrowed"),
  weights = lfqdata$config$nr_children,
  ...
)

Arguments

lfqdata

LFQData object (aggregated to protein level)

modelstr

model formula string (e.g. "~ group_")

contrasts

named character vector of contrasts

lod

numeric limit of detection; if NULL, auto-computed from data

df_method

"observed" uses max(n_observed - p, 1); "borrowed" uses median df from successful fits

weights

column name for per-observation weights (default: lfqdata$config$nr_children). Pass NULL for unweighted.

...

passed to strategy_limma (e.g. trend, robust)


Method get_contrasts()

get contrast results (rows with NA diff are filtered out)

Usage

ContrastsLimmaImputeFacade$get_contrasts(...)

Arguments

...

passed to ContrastsLimma$get_contrasts


Method get_missing()

get protein x contrast pairs that could not be estimated

Usage

ContrastsLimmaImputeFacade$get_missing()


Method get_Plotter()

get ContrastsPlotter

Usage

ContrastsLimmaImputeFacade$get_Plotter(...)

Arguments

...

passed to ContrastsLimma$get_Plotter


Method to_wide()

convert results to wide format

Usage

ContrastsLimmaImputeFacade$to_wide(...)

Arguments

...

passed to ContrastsLimma$to_wide


Method clone()

The objects of this class are cloneable with this method.

Usage

ContrastsLimmaImputeFacade$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

istar <- sim_lfq_data_protein_config(Nprot = 30, weight_missing = 0.5)
#> creating sampleName from fileName column
#> completing cases
#> completing cases done
#> setup done
lfqdata <- LFQData$new(istar$data, istar$config)
lfqdata$rename_response("transformedIntensity")
contrasts <- c("A_vs_Ctrl" = "group_A - group_Ctrl")
fa <- ContrastsLimmaImputeFacade$new(lfqdata, "~ group_", contrasts)
#> Warning: Partial NA coefficients for 4 probe(s)
#> completing cases
head(fa$get_contrasts())
#> # A tibble: 6 × 14
#>   facade modelName protein_Id contrast    diff   FDR std.error statistic p.value
#>   <chr>  <chr>     <chr>      <chr>      <dbl> <dbl>     <dbl>     <dbl>   <dbl>
#> 1 limma… limma     0EfVhX~29… A_vs_Ct…  1.24   0.427     0.666    1.86    0.0853
#> 2 limma… limma     0m5WN4~67… A_vs_Ct… -0.0361 0.971     0.964   -0.0374  0.971 
#> 3 limma… limma     7QuTub~61… A_vs_Ct…  0.909  0.773     0.908    1.00    0.352 
#> 4 limma… limma     7cbcrd~26… A_vs_Ct…  0.612  0.855     1.04     0.588   0.570 
#> 5 limma… limma     9VUkAq~34… A_vs_Ct…  0.768  0.855     1.16     0.664   0.519 
#> 6 limma… limma     At886V~77… A_vs_Ct… -1.86   0.212     0.744   -2.50    0.0258
#> # ℹ 5 more variables: sigma <dbl>, df <dbl>, conf.low <dbl>, conf.high <dbl>,
#> #   avgAbd <dbl>
fa$to_wide()
#> # A tibble: 30 × 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~29…         1.24             0.0853          0.427              1.86  
#>  2 0m5WN4~67…        -0.0361           0.971           0.971             -0.0374
#>  3 7QuTub~61…         0.909            0.352           0.773              1.00  
#>  4 7cbcrd~26…         0.612            0.570           0.855              0.588 
#>  5 9VUkAq~34…         0.768            0.519           0.855              0.664 
#>  6 At886V~77…        -1.86             0.0258          0.212             -2.50  
#>  7 BEJI92~27…        -1.30             0.182           0.545             -1.41  
#>  8 CGzoYe~08…         0.196            0.850           0.971              0.194 
#>  9 CtOJ9t~91…        -0.0717           0.929           0.971             -0.0912
#> 10 DoWup2~28…        -1.82             0.00858         0.129             -3.07  
#> # ℹ 20 more rows