Skip to contents

A contrast object around a ready-made contrast table, for example the result of merge_contrasts_results(). It provides the shared methods of ContrastsInterface (plots, wide format, ranking) but no linear functions, because no model stands behind it.

Value

An R6 class generator.

See also

Other modelling: AnovaExtractor, Contrasts, ContrastsComparison, ContrastsDEqMSFacade, ContrastsDEqMSVoomFacade, ContrastsFacadeBase, ContrastsFirth, ContrastsFirthFacade, ContrastsHurdleFacade, ContrastsHurdleNestedFacade, ContrastsLMFacade, ContrastsLMImputeFacade, ContrastsLimma, ContrastsLimmaFacade, ContrastsLimmaImputeFacade, ContrastsLimmaVoomFacade, ContrastsLimmaVoomImputeFacade, ContrastsLimpaFacade, ContrastsLimpaNestedFacade, ContrastsLmerNestedFacade, ContrastsModerated, ContrastsModeratedDEqMS, ContrastsPlotter, ContrastsRLMFacade, ContrastsROPECA, ContrastsROPECANestedFacade, ContrastsROPECAV2, ContrastsROPECAV2NestedFacade, ContrastsRfitFacade, ContrastsRfitImputeFacade, 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 class

ContrastsInterface -> ContrastsTable

Public fields

contrast_result

contrast results

model_name

model name

subject_id

default protein_Id

Methods

Inherited methods


ContrastsTable$new()

initialize

Usage

ContrastsTable$new(
  contrastsdf,
  subject_id = "protein_Id",
  model_name = "ContrastTable",
  config = NULL
)

Arguments

contrastsdf

data.frame

subject_id

default protein_Id

model_name

default ContrastTable

config

optional ContrastConfiguration describing the result columns; default NULL builds an LM-flavoured one on demand


ContrastsTable$get_contrast_sides()

return sides of contrast

Usage

ContrastsTable$get_contrast_sides()

Returns

data.frame


ContrastsTable$get_linfct()

not implemented

Usage

ContrastsTable$get_linfct()


ContrastsTable$get_contrasts()

get contrasts

Usage

ContrastsTable$get_contrasts(all = FALSE)

Arguments

all

ignored; kept for the ContrastsInterface signature. The stored table is returned as is


ContrastsTable$get_Plotter()

get ContrastsPlotter

Usage

ContrastsTable$get_Plotter(fc_threshold = 1, fdr_threshold = 0.1)

Arguments

fc_threshold

fold change threshold

fdr_threshold

fdr threshold


ContrastsTable$clone()

The objects of this class are cloneable with this method.

Usage

ContrastsTable$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples


istar <- prolfqua::sim_lfq_data_protein_config(n_proteins = 30)
#> `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 39 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("aC" = "group_A - group_Ctrl",
"bC" = "group_B - group_Ctrl")
fa <- ContrastsLMFacade$new(lfqdata, "~ group_", Contrasts)
#> fit (Model): 39 missing responses dropped (e.g. 0m5WN4~6730, 7QuTub~6175, 9VUkAq~3402, DuwH7n~2082, FVUJxd~9571, ...): NA response (missing observation) left out of the fit
#> See $provenance().
ctr <- fa$get_contrasts()
fa$contrast$subject_id
#> [1] "protein_Id"
xcx <- ContrastsTable$new(ctr, subject_id = fa$contrast$subject_id, model_name = "TableTest")
xcx$get_contrasts()
#> # A tibble: 59 × 16
#>    modelName estimate_type protein_Id  contrast    diff avgAbd
#>    <chr>     <chr>         <chr>       <chr>      <dbl>  <dbl>
#>  1 lm        observed      0EfVhX~2956 aC        1.24     22.6
#>  2 lm        observed      0m5WN4~6730 aC       -0.0361   20.8
#>  3 lm        observed      7QuTub~6175 aC       -0.680    16.6
#>  4 lm        observed      7cbcrd~2687 aC        0.704    22.0
#>  5 lm        observed      9VUkAq~3402 aC        0.768    20.0
#>  6 lm        observed      At886V~7759 aC       -1.86     29.1
#>  7 lm        observed      BEJI92~2727 aC       -0.721    22.1
#>  8 lm        observed      CGzoYe~0821 aC       -0.389    21.1
#>  9 lm        observed      CtOJ9t~9170 aC       -0.0717   27.8
#> 10 lm        observed      DoWup2~2837 aC       -1.82     26.1
#> # ℹ 49 more rows
#> # ℹ 10 more variables: std.error.unmoderated <dbl>, df.unmoderated <int>,
#> #   std.error <dbl>, statistic <dbl>, df <dbl>, p.value <dbl>, conf.low <dbl>,
#> #   conf.high <dbl>, sigma <dbl>, FDR <dbl>
xcx$get_Plotter()$volcano()
#> $p.value

#> 
#> $FDR

#> 
stopifnot(is.null(xcx$get_contrast_sides()))
stopifnot(is.null(xcx$get_linfct()))
stopifnot(ncol(xcx$to_wide()) == 9)