Introduction to prolfqua
Witold E. Wolski
Functional Genomics Center Zurich (FGCZ), ETH Zurich and University of ZurichSource:
vignettes/prolfqua.Rmd
prolfqua.Rmd
Documentation
The vignettes of this package, in reading order:
- Introduction to prolfqua (this vignette)
-
Importing your data:
reading your own data into an
AnalysisConfiguration -
Comparing two groups: QC,
normalization and contrasts with
lm_impute -
All modelling methods at a
glance: every
build_contrast_analysis()method on one small dataset - Two-factor designs
- Contrasts from factors
-
Filling the gaps: model-based
imputation for heatmaps and PCA: completing the data matrix with
impute_from_model() - QC and sample size estimation
- Transforming and calibrating LFQ data: the active response, and calibration against internal standards or external calibrants
The package website https://fgcz.github.io/prolfqua/ has three more articles:
-
Comparing
modelling methods on one dataset: all
build_contrast_analysis()methods compared withContrastsComparison: the pairs each estimates, their estimates, significant calls and conflicts - Simulating peptide-level data
-
Under
the hood: strategy, model and contrasts: the classes behind
build_contrast_analysis()
Introduction
prolfqua covers the steps of a label-free quantification (LFQ) proteomics analysis: quality control, normalization, aggregation of peptides to proteins, modelling, hypothesis testing and sample size estimation (Wolski et al. 2023).
The centre of the package is a factory,
build_contrast_analysis(). It takes the data, a model
formula, the contrasts and a method, and returns a ready
analysis: one model per protein and the requested contrasts.

build_contrast_analysis() is a factory: the method key selects the model, and every model rolls out with the same interface.
The method argument selects the model: linear models
(lm, rlm, rfit), limma and
limma-voom (Smyth 2004), DEqMS variance
moderation, limpa’s detection probability model, Firth logistic and
binomial models of detection, mixed models (as in
MSqRob, Goeminne, Gevaert, and Clement 2016) and a derivation of
ROPECA (Suomi and Elo 2017) on
peptide-level data, a hurdle model combining intensity and detection,
and variants that impute groups without observations at the limit of
detection.
Every method returns an object with the same interface:
get_contrasts(), get_Plotter(),
get_missing() and to_wide(). Results of
different methods therefore have the same columns and can be compared or
combined directly.
build_contrast_analysis() takes its data as an
LFQData object. The package works with data in long format,
one row per measured feature (protein, peptide, precursor) and
sample:
-
AnalysisConfigurationmaps the columns of the table to their roles: the feature hierarchy (protein, peptide, …), the explanatory factors, the sample and the intensity column. -
LFQDataholds the data together with its configuration. Its methods return helpers for transformation (get_Transformer()), aggregation (get_Aggregator()), summary statistics (get_Stats()), missing-value summaries (get_Summariser()) and plots (get_Plotter()).
Installation
Install prolfqua from Bioconductor with:
if (!requireNamespace("BiocManager", quietly = TRUE)) {
install.packages("BiocManager")
}
BiocManager::install("prolfqua")The development version is available on GitHub; installing it needs the remotes package:
install.packages(c("BiocManager", "remotes"))
BiocManager::install("fgcz/prolfqua")Quick start
We simulate peptide-level intensities for 100 proteins measured in
three groups (A, B and Ctrl).
sim_lfq_data_peptide_config() returns the data together
with a matching AnalysisConfiguration.
library(prolfqua)
istar <- sim_lfq_data_peptide_config(n_proteins = 100, seed = 1234)
lfqdata <- LFQData$new(istar$data, istar$config)
lfqdata$factors() |> head()
#> # A tibble: 6 × 3
#> sample sampleName group_
#> <chr> <chr> <chr>
#> 1 A_V1 A_V1 A
#> 2 A_V2 A_V2 A
#> 3 A_V3 A_V3 A
#> 4 A_V4 A_V4 A
#> 5 B_V1 B_V1 B
#> 6 B_V2 B_V2 BWe transform the intensities, scale them robustly, and aggregate the peptides to proteins with Tukey’s median polish.
lfqdata <- lfqdata$get_Transformer()$log2()$robscale()$lfq
lfqprot <- lfqdata$get_Aggregator()$aggregate()
lfqprot$get_Plotter()$intensity_distribution_density()
Distribution of the normalized protein intensities per sample.
We compare groups A and B with the control
group using lm_impute: a linear model per protein with
moderated variances. Proteins whose fit fails because a group has no
observations are refitted with the missing values imputed at the limit
of detection, borrowing the variance from the other proteins.
contrasts <- c(
"A_vs_Ctrl" = "group_A - group_Ctrl",
"B_vs_Ctrl" = "group_B - group_Ctrl"
)
fa <- build_contrast_analysis(lfqprot, "~ group_", contrasts, method = "lm_impute")
res <- fa$get_contrasts()
head(res[, c("protein_Id", "contrast", "diff", "p.value", "FDR")])
#> # A tibble: 6 × 5
#> protein_Id contrast diff p.value FDR
#> <chr> <chr> <dbl> <dbl> <dbl>
#> 1 0EfVhX~3967 A_vs_Ctrl 0.199 0.000123 0.000397
#> 2 0m5WN4~6025 A_vs_Ctrl 0.178 0.0000160 0.0000726
#> 3 0YSKpy~2865 A_vs_Ctrl -0.175 0.00277 0.00554
#> 4 3QLHfm~8938 A_vs_Ctrl 0.214 0.00456 0.00807
#> 5 3QYop0~7543 A_vs_Ctrl -0.221 0.00000298 0.0000179
#> 6 76k03k~7094 A_vs_Ctrl -0.0822 0.00980 0.0156
fa$get_Plotter()$volcano()$FDR
Volcano plot of the two contrasts.
All available methods are listed by list_facades(); the
vignette All modelling methods at a
glance runs each of them on one small dataset.
names(list_facades())
#> [1] "binomial_firth_nested" "binomial_nested" "deqms"
#> [4] "deqms_voom" "firth" "hurdle_nested"
#> [7] "limma" "limma_impute" "limma_voom"
#> [10] "limma_voom_impute" "limpa" "limpa_nested"
#> [13] "lm" "lm_impute" "lmer_nested"
#> [16] "rfit" "rfit_impute" "rlm"
#> [19] "ropeca_nested" "ropecaV2_nested"Session info
sessionInfo()
#> R version 4.6.2 (2026-10-29)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 26.04.1 LTS
#>
#> Matrix products: default
#> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.32.so; LAPACK version 3.12.0
#>
#> locale:
#> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
#> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
#> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
#> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
#>
#> time zone: UTC
#> tzcode source: system (glibc)
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] prolfqua_1.9.10 BiocStyle_2.40.0
#>
#> loaded via a namespace (and not attached):
#> [1] gtable_0.3.6 xfun_0.62 bslib_0.12.0
#> [4] ggplot2_4.0.4 htmlwidgets_1.6.4 ggrepel_0.9.8
#> [7] vctrs_0.7.3 tools_4.6.2 crosstalk_1.2.2
#> [10] generics_0.1.4 tibble_3.3.1 pkgconfig_2.0.3
#> [13] data.table_1.18.6.1 RColorBrewer_1.1-3 S7_1.0.0
#> [16] desc_1.4.3 lifecycle_1.0.5 compiler_4.6.2
#> [19] farver_2.1.2 stringr_1.6.0 textshaping_1.1.0
#> [22] progress_1.2.3 statmod_1.5.2 httpuv_1.6.17
#> [25] htmltools_0.5.9 sass_0.5.0 yaml_2.3.12
#> [28] plotly_4.12.1 pillar_1.11.1 pkgdown_2.2.1
#> [31] later_1.4.8 crayon_1.5.3 jquerylib_0.1.4
#> [34] tidyr_1.3.2 MASS_7.3-66 cachem_1.1.0
#> [37] limma_3.68.5 mime_0.13 tidyselect_1.2.1
#> [40] digest_0.6.39 stringi_1.8.9 dplyr_1.2.1
#> [43] purrr_1.2.2 bookdown_0.48 labeling_0.4.3
#> [46] fastmap_1.2.0 grid_4.6.2 cli_3.6.6
#> [49] magrittr_2.0.5 utf8_1.2.6 withr_3.0.3
#> [52] prettyunits_1.2.0 scales_1.4.0 promises_1.5.0
#> [55] rmarkdown_2.32 httr_1.4.9 otel_0.3.0
#> [58] ragg_1.5.2 hms_1.1.4 shiny_1.15.0
#> [61] evaluate_1.0.5 knitr_1.52 viridisLite_0.4.3
#> [64] rlang_1.3.0 Rcpp_1.1.2 xtable_1.8-8
#> [67] glue_1.8.1 BiocManager_1.30.27 jsonlite_2.0.0
#> [70] R6_2.6.1 systemfonts_1.3.4 fs_2.1.0