Base class for all Contrasts classes
Base class for all Contrasts classes
Public fields
configContrastConfigurationdescribing the backend's column-role mapping and behaviour flags. Subclasses should populate this ininitialize()so generic consumers can resolve column names without hard-coding them.
Methods
Method get_config()
Return the ContrastConfiguration, constructing an
LM-flavoured default on demand if a subclass has not set one.
Method get_missing()
get protein × contrast pairs that could not be estimated. Returns a data.frame with hierarchy columns and contrast, or 0 rows.
Method get_rank()
get rank-list input table for enrichment tools.
If the backend's ContrastConfiguration has a p-value
column the default rank score is signed
sign(effect) * -log10(p.value). Otherwise the default is the
effect column itself.
Method get_ora()
get ORA input table — features passing the FDR and absolute effect-size threshold in the requested direction.
Method filter_significant()
Filter contrast rows that pass the FDR and effect-size threshold.
By default this is symmetric on the effect column
(|effect| > diff_threshold). For backends whose
ContrastConfiguration has
significance_directional = TRUE (e.g. SAINTexpress, where
only positive enrichment is biologically meaningful), the filter
is one-sided (effect > diff_threshold).
Method contrast_summary_table()
Per-subject summary table for downstream report grobs. Returns a
small data.frame with canonical column names
contrast, effect, score, fdr
regardless of backend.
Method extra_artifacts()
Backend-specific extra artifacts that a report should carry along with the contrast results (e.g. SAINT input tables). Default returns an empty named list.
Examples
int <- ContrastsInterface$new()
testthat::expect_error(int$get_contrast_sides())
testthat::expect_error(int$get_contrasts())
testthat::expect_error(int$get_missing())
testthat::expect_error(int$get_Plotter())
testthat::expect_error(int$to_wide())
# get_rank / get_ora / filter_significant call get_contrasts() internally,
# which is not implemented on the bare interface, so they surface that error.
testthat::expect_error(int$get_rank())
testthat::expect_error(int$get_ora())
testthat::expect_error(int$filter_significant())
identical(int$extra_artifacts(), list())
#> [1] TRUE
int$column_description()
#> column_name
#> modelName modelName
#> contrast contrast
#> avgAbd avgAbd
#> diff diff
#> FDR FDR
#> statistic statistic
#> std.error std.error
#> df df
#> p.value p.value
#> conf.low conf.low
#> conf.high conf.high
#> sigma sigma
#> description
#> modelName type of model
#> contrast name of difference e.g. group1_vs_group2
#> avgAbd mean abundance value of protein in all samples
#> diff difference among conditions
#> FDR false discovery rate
#> statistic t-statistics
#> std.error standard error
#> df degrees of freedom
#> p.value p-value
#> conf.low lower value of 95 confidence interval
#> conf.high high value of 95 confidence interval
#> sigma residual standard deviation of linear model (needed for empirical Bayes variance shrinkage).