Differential expression analysis engine using prolfqua facade classes
Source:R/R6_DEAnalyse.R
DEAnalyse.RdDifferential 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.
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_configProlfquAppConfig
lfq_dataLFQData to model (transformed, at correct hierarchy level)
lfq_data_rawraw (untransformed) LFQData for reporting
rowAnnotProteinAnnotation
contrastsvector with contrasts
FDR_thresholdFDR threshold
diff_thresholddifference threshold
summarydata.frame with contaminant/decoy summary
annotated_contrastscontrasts joined with row annotations
annotated_contrasts_signifsignificant annotated contrasts
formulamodel formula
contrast_resultsnamed list of facade objects
default_modelfacade registry key for the default model
Methods
Method new()
Initialize DEAnalyse
Usage
DEAnalyse$new(
lfq_data,
rowAnnot,
prolfq_app_config,
contrasts,
default_model = "lm_missing",
lfq_data_raw = NULL,
summary = NULL
)Arguments
lfq_dataLFQData to model (transformed, at correct hierarchy level)
rowAnnotProteinAnnotation object
prolfq_app_configProlfquAppConfig object
contrastsnamed vector of contrast definitions
default_modelfacade registry key (default "lm_missing")
lfq_data_rawraw (untransformed) LFQData for reporting (optional)
summarydata.frame with contaminant/decoy summary (optional)
Method build_facade()
Build a facade by registry key
Examples
pep <- prolfqua::sim_lfq_data_peptide_config(Nprot = 100)
#> creating sampleName from fileName column
#> completing cases
#> completing cases done
#> setup done
pep <- prolfqua::LFQData$new(pep$data, pep$config)
pA <- data.frame(protein_Id = unique(pep$data$protein_Id))
pA <- pA |> dplyr::mutate(fasta.annot = paste0(pA$protein_Id, "_description"))
pA <- prolfquapp::ProteinAnnotation$new(pep, row_annot = pA, description = "fasta.annot")
#> Warning: no exp_nr_children column specified, computing using nr_obs_experiment function
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 percentOfFalsePositives
#> 1 100 0 0
#> NrOfProteinsNoDecoys
#> 1 100
data_prep$remove_cont_decoy()
#> Joining with `by = join_by(protein_Id)`
#> INFO [2026-03-23 19:48:01] removing contaminants and reverse sequences with patterns: ^zz|^CON|Cont_^REV_|^rev_
data_prep$aggregate()
#> INFO [2026-03-23 19:48:01] AGGREGATING PEPTIDE DATA: medpolish.
#> Column added : log_abundance
#> starting aggregation
#> Column added : exp_medpolish
#> INFO [2026-03-23 19:48:03] END OF PROTEIN AGGREGATION
data_prep$transform_data()
#> INFO [2026-03-23 19:48:03] Transforming using robscale.
#> Column added : log2_exp_medpolish
#> data is : TRUE
#> Joining with `by = join_by(protein_Id, sampleName, isotopeLabel)`
#> INFO [2026-03-23 19:48:03] Transforming data : robscale.
deanalyse <- data_prep$build_deanalyse(contrasts)
deanalyse$build_default()
#> INFO [2026-03-23 19:48:03] model formula: normalized_abundance ~ group_
#> Joining with `by = join_by(protein_Id)`
#> determine linear functions:
#> get_contrasts -> contrasts_linfct
#> contrasts_linfct
#> Joining with `by = join_by(protein_Id, contrast)`
#> completing cases
#> AVsC=group_A - group_Ctrl
#> BVsC=group_B - group_Ctrl
#> AVsC=group_A - group_Ctrl
#> BVsC=group_B - group_Ctrl
#> AVsC=group_A - group_Ctrl
#> BVsC=group_B - group_Ctrl
#> Joining with `by = join_by(protein_Id, contrast)`
#> Joining with `by = join_by(protein_Id, contrast)`
stopifnot(nrow(deanalyse$contrast_results[[deanalyse$default_model]]$get_contrasts()) == 200)