Skip to contents

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.

Value

An R6 class generator.

See also

Other modelling: AnovaExtractor, Contrasts, ContrastsComparison, ContrastsDEqMSFacade, ContrastsDEqMSVoomFacade, ContrastsFacadeBase, ContrastsFirth, ContrastsFirthFacade, ContrastsHurdleFacade, ContrastsHurdleNestedFacade, ContrastsLMFacade, ContrastsLMImputeFacade, ContrastsLimma, ContrastsLimmaFacade, ContrastsLimmaVoomFacade, ContrastsLimmaVoomImputeFacade, ContrastsLimpaFacade, ContrastsLimpaNestedFacade, ContrastsLmerNestedFacade, ContrastsModerated, ContrastsModeratedDEqMS, ContrastsPlotter, ContrastsRLMFacade, ContrastsROPECA, ContrastsROPECANestedFacade, ContrastsROPECAV2, ContrastsROPECAV2NestedFacade, ContrastsRfitFacade, ContrastsRfitImputeFacade, ContrastsTable, INTERNAL_FUNCTIONS_BY_FAMILY, Model, ModelFirth, ModelLimma, StrategyLM, StrategyLimma, StrategyLimpa, StrategyLmer, StrategyLogistf, StrategyRLM, StrategyRfit, build_contrast_analysis(), build_model(), build_model_glm_protein(), build_model_impute(), build_model_limma(), build_model_limma_impute(), build_model_limma_voom(), build_model_limma_voom_impute(), build_model_limpa(), compute_borrowed_variance(), compute_borrowed_variance_limma(), df.residual.rfit_prolfqua(), group_label(), impute_from_model(), impute_refit_singular(), list_facades(), lookup_facade(), lr_test(), merge_contrasts_results(), new_imputed_model(), nobs.rfit_prolfqua(), pivot_model_contrasts_to_wide(), prolfqua_analysis_methods, register_facade(), sigma.rfit_prolfqua(), strategy_limma(), strategy_limpa(), strategy_logistf(), vcov.rfit_prolfqua()

Super classes

ContrastsInterface -> ContrastsFacadeBase -> ContrastsLimmaImputeFacade

Methods

Inherited methods


ContrastsLimmaImputeFacade$new()

initialize

Usage

ContrastsLimmaImputeFacade$new(
  lfqdata,
  modelstr,
  contrasts,
  lod = NULL,
  df_method = c("observed", "borrowed"),
  weights = lfqdata$nr_children_col(),
  trend = FALSE,
  robust = FALSE
)

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$nr_children_col()). Pass NULL for unweighted.

trend, robust

passed to eBayes, see strategy_limma


ContrastsLimmaImputeFacade$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(n_proteins = 30, weight_missing = 0.5)
#> `protein_Id`: columns `proteinID`, `idtype2` united with separator '~'.
#> creating sampleName from file_name column
#> setup_analysis: dropped 5 unconfigured columns: average_prot_abundance, sd, mean, N, Replicate.
#> setup_analysis: added 89 rows with NA response for feature and sample combinations absent from the input.
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)
#> fit (limmaImputed): 4 refit at the limit of detection (e.g. DuwH7n~2082, HvIpHG~1448, JcKVfU~4958, JfvT8X~6972): fit failed, singular or missing a group; missing responses imputed at the LOD
#> fit (limmaImputed): 62 missing responses dropped (e.g. 0m5WN4~6730, 7QuTub~6175, 7cbcrd~2687, 9VUkAq~3402, BEJI92~2727, ...): NA response (missing observation) left out of the fit
#> See $provenance().
head(fa$get_contrasts())
#> # A tibble: 6 × 16
#>   modelName    estimate_type protein_Id  contrast     diff   FDR
#>   <chr>        <chr>         <chr>       <chr>       <dbl> <dbl>
#> 1 limma_impute observed      0EfVhX~2956 A_vs_Ctrl  1.24   0.427
#> 2 limma_impute observed      0m5WN4~6730 A_vs_Ctrl -0.0361 0.971
#> 3 limma_impute observed      7QuTub~6175 A_vs_Ctrl  0.909  0.773
#> 4 limma_impute observed      7cbcrd~2687 A_vs_Ctrl  0.612  0.855
#> 5 limma_impute observed      9VUkAq~3402 A_vs_Ctrl  0.768  0.855
#> 6 limma_impute observed      At886V~7759 A_vs_Ctrl -1.86   0.212
#> # ℹ 10 more variables: std.error.unmoderated <dbl>, df.unmoderated <dbl>,
#> #   std.error <dbl>, statistic <dbl>, p.value <dbl>, 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