Differential expression analysis engine using prolfqua facade classes

Description

Differential expression analysis engine using prolfqua facade classes

Differential expression analysis engine using prolfqua facade classes

Details

Takes prepared LFQData (at the correct hierarchy level for the chosen facade) and runs statistical modelling via prolfqua’s ContrastsFacade classes or the prolfquasaint SAINTexpress adapter.

The caller (e.g. ProteinDataPrep$build_deanalyse()) is responsible for providing data at the right level: aggregated protein-level for most facades, or nested peptide-level for lmer/ropeca.

Public fields

prolfq_app_config
ProlfquAppConfig
lfq_data
LFQData to model (transformed, at correct hierarchy level)
lfq_data_raw
raw (untransformed) LFQData for reporting
rowAnnot
ProteinAnnotation
contrasts
vector with contrasts
FDR_threshold
FDR threshold
diff_threshold
difference threshold
summary
data.frame with contaminant/decoy summary
annotated_contrasts
contrasts joined with row annotations
annotated_contrasts_signif
significant annotated contrasts
formula
model formula
contrast_results
named list of facade objects
default_model
facade registry key for the default model

Methods

Public methods


Method new()

Initialize DEAnalyse

Usage
DEAnalyse\$new(
  lfq_data,
  rowAnnot,
  prolfq_app_config,
  contrasts,
  default_model = "lm_impute",
  lfq_data_raw = NULL,
  summary = NULL
)
Arguments
lfq_data
LFQData to model (transformed, at correct hierarchy level)
rowAnnot
ProteinAnnotation object
prolfq_app_config
ProlfquAppConfig object
contrasts
named vector of contrast definitions
default_model
facade registry key (default "lm_impute")
lfq_data_raw
raw (untransformed) LFQData for reporting (optional)
summary
data.frame with contaminant/decoy summary (optional)

Method build_facade()

Build a facade by registry key. Dispatches through prolfqua::lookup_facade() so any facade registered by a downstream package (e.g. prolfquasaint::ContrastsSAINTFacade registered as “saint”) is reachable the same way as the built-in prolfqua facades. SAINT-style backends that need the protein annotation (registry attribute needs_saint_annotation = TRUE) receive row_annot from self$rowAnnot.

Usage
DEAnalyse\$build_facade(name, modelstr = NULL)
Arguments
name
facade registry key (e.g. "lm", "lm_missing", "limma", "saint")
modelstr
model formula string; auto-generated if NULL. Ignored by facades whose backend derives contrasts from annotation (e.g. SAINT).
Returns

the facade object (invisibly)


Method build_default()

Build the default facade (as set in default_model)

Usage
DEAnalyse\$build_default()

Method get_annotated_contrasts()

Join default-model contrasts with protein row annotations. Significance filtering is delegated to contrast_obj$filter_significant(); backends with ContrastConfiguration$significance_directional = TRUE (e.g. SAINT) get one-sided filtering automatically.

Usage
DEAnalyse\$get_annotated_contrasts()

Method filter_contrasts()

Return contrast rows passing FDR and difference thresholds

Usage
DEAnalyse\$filter_contrasts()

Method clone()

The objects of this class are cloneable with this method.

Usage
DEAnalyse\$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.

Examples

library("prolfquapp")

pep <- prolfqua::sim_lfq_data_peptide_config(Nprot = 100)
pep <- prolfqua::LFQData$new(pep$data, pep$config)
pA <- data.frame(protein_Id = unique(pep$data_long()$protein_Id))
pA <- pA |> dplyr::mutate(fasta.annot = paste0(pA$protein_Id, "_description"))
pA <- prolfquapp::ProteinAnnotation$new(pep, row_annot = pA, description = "fasta.annot")
GRP2 <- prolfquapp::make_DEA_config_R6()
GRP2$processing_options$diff_threshold <- 0.2
GRP2$processing_options$transform <- "robscale"

contrasts <- c("AVsC" = "group_A - group_Ctrl", BVsC = "group_B - group_Ctrl")

data_prep <- prolfquapp::ProteinDataPrep$new(pep, pA, GRP2)
data_prep$cont_decoy_summary()
  totalNrOfProteins percentOfContaminants percentOfDecoys
1               100                     0               0
data_prep$aggregate()
data_prep$transform_data()

deanalyse <- data_prep$build_deanalyse(contrasts)
deanalyse$build_default()
stopifnot(nrow(deanalyse$contrast_results[[deanalyse$default_model]]$get_contrasts()) == 200)