Frequently, the data are available in tables, where the rows represent proteins, and the columns do represent samples. The example shows such a table. The first column contains, the protein id, while the other columns store the intensities for sample A, B, C.
df <- data.frame(protein_Id = c("tr|A|HUMAN","tr|B|HUMAN","tr|C|HUMAN","tr|D|HUMAN"),
Intensity_A = c(100,10000,10,NA),
Intensity_B = c(NA, 9000, 20, 100),
Intensity_C = c(200,8000,NA,150),
Intensity_D = c(130,11000, 50, 50))
df
## protein_Id Intensity_A Intensity_B Intensity_C Intensity_D
## 1 tr|A|HUMAN 100 NA 200 130
## 2 tr|B|HUMAN 10000 9000 8000 11000
## 3 tr|C|HUMAN 10 20 NA 50
## 4 tr|D|HUMAN NA 100 150 50
This table can be converted into a table in the long format using:
table_long <- tidyr::pivot_longer(df, starts_with("Intensity_"),names_to = "Sample", values_to = "Intensity")
table_long
## # A tibble: 16 × 3
## protein_Id Sample Intensity
## <chr> <chr> <dbl>
## 1 tr|A|HUMAN Intensity_A 100
## 2 tr|A|HUMAN Intensity_B NA
## 3 tr|A|HUMAN Intensity_C 200
## 4 tr|A|HUMAN Intensity_D 130
## 5 tr|B|HUMAN Intensity_A 10000
## 6 tr|B|HUMAN Intensity_B 9000
## 7 tr|B|HUMAN Intensity_C 8000
## 8 tr|B|HUMAN Intensity_D 11000
## 9 tr|C|HUMAN Intensity_A 10
## 10 tr|C|HUMAN Intensity_B 20
## 11 tr|C|HUMAN Intensity_C NA
## 12 tr|C|HUMAN Intensity_D 50
## 13 tr|D|HUMAN Intensity_A NA
## 14 tr|D|HUMAN Intensity_B 100
## 15 tr|D|HUMAN Intensity_C 150
## 16 tr|D|HUMAN Intensity_D 50
In addition you will need a table with the Sample annotations. In this example with have two groups A, B.
annot <- data.frame(Sample = c("Intensity_A", "Intensity_B", "Intensity_C", "Intensity_D"), Group = c("A","A","B","C"))
Now you can annotate the samples in the table with the Intensities.
table_long <- dplyr::inner_join(annot, table_long)
We create a AnalysisConfiguration and start annotating the data frame, that is specifying which column contains which type of information.
config <- prolfqua::AnalysisConfiguration$new()
config$file_name = "Sample"
config$work_intensity = "Intensity"
The columns identifying the measured features, which are proteins, peptides or precursors, are described using the named list hierarchy. The values of the list are the column names, while the names are arbitrary as long as they are valid R column names. Here we use the same names as the column names.
The list factors, is used to point to the columns containing the factors of your analysis (Group).
config$hierarchy[["protein_Id"]] <- "protein_Id"
config$factors[["Group"]] <- "Group"
analysis_data <- prolfqua::setup_analysis(table_long, config)
lfqdata <- prolfqua::LFQData$new(analysis_data, config)
lfqdata$hierarchy_counts()
## # A tibble: 1 × 2
## isotopeLabel protein_Id
## <chr> <int>
## 1 light 4
smrz <- lfqdata$get_Summariser()
smrz$plot_hierarchy_counts_sample()
Given for example a Peptide Quantification Report generated by Spectronaut (a table in long format), we demonstrate how to create a configuration that is required to use it with prolfqua. To do this, an AnalysisConfiguration has to be configured and some fields (fileName, hierarchy, factors, workingIntensity) need to defined.
The configuration object describes the columns in the long table so that prolfqua functions know which columns to use.
dataLongFormat <- prolfqua::sim_lfq_data(Nprot = 20, PEPTIDE = TRUE)
head(dataLongFormat)
## # A tibble: 6 × 12
## proteinID idtype2 average_prot_abundance sd peptideID sample group mean
## <chr> <chr> <dbl> <dbl> <chr> <chr> <chr> <dbl>
## 1 TSCQbR 8758 15.3 1 9oQxWGuO Ctrl_V1 Ctrl 0
## 2 TSCQbR 8758 15.3 1 9oQxWGuO Ctrl_V2 Ctrl 0
## 3 TSCQbR 8758 15.3 1 9oQxWGuO Ctrl_V3 Ctrl 0
## 4 TSCQbR 8758 15.3 1 9oQxWGuO Ctrl_V4 Ctrl 0
## 5 TSCQbR 8758 17.3 1 9oQxWGuO A_V1 A -2
## 6 TSCQbR 8758 17.3 1 9oQxWGuO A_V2 A -2
## # ℹ 4 more variables: N <dbl>, avg_peptide_abd <dbl>, Replicate <chr>,
## # abundance <dbl>
We create a Table annotation object and start annotating the data we read. Since in this example we eventually want to do more filtering on data quality we will also define the ident_qValue in this AnalysisConfiguration.
config <- prolfqua::AnalysisConfiguration$new()
config$file_name = "sample"
config$work_intensity = "abundance"
The columns identifying the measured features, which are proteins, peptides or precursors, are described using the named list hierarchy. The values of the list are the column names, while the names are arbitrary as long as they are valid R column names. Here we use the same names as the column names.
The list factors, is used to point to the columns containing the factors of your analysis (group). Here, we rename the column “R.Condition” to “Marker”. In figures and legends generated by prolfqua the name “Marker” will then be used and not “R.Condition”. The data.frame can also contain more than one factor.
config$hierarchy[["proteinID"]] <- "proteinID"
config$hierarchy[["peptideID"]] <- "peptideID"
config$factors[["group"]] <- "group"
Lastly, the function setup_analysis, creates from data frame in long format a data.frame compatible with your configuration. We can now run most of the function in the package using the data and configuration.
analysis_data <- prolfqua::setup_analysis(dataLongFormat, config)
lfq_tmp <- prolfqua::LFQData$new(analysis_data, config)
lfq_tmp$summarize_hierarchy()
## # A tibble: 20 × 3
## proteinID isotopeLabel_n peptideID_n
## <chr> <int> <int>
## 1 3qY5Bt 1 3
## 2 AXMMN0 1 3
## 3 CaX6he 1 2
## 4 QpTTOE 1 5
## 5 TSCQbR 1 4
## 6 V2D49Y 1 1
## 7 VMFDwf 1 1
## 8 amG1z5 1 1
## 9 c70e5b 1 1
## 10 gAixrb 1 1
## 11 iD5bvr 1 1
## 12 isl56H 1 2
## 13 iyVdDQ 1 1
## 14 kzoc34 1 1
## 15 lnsnc0 1 4
## 16 mYkykV 1 1
## 17 nGBqK9 1 5
## 18 nPKJNT 1 1
## 19 pysPNP 1 2
## 20 qGMFKr 1 3
Now the analysis_data object is ready to generate the LFQData class instance. This object is the start for further analysis.
lfqdata <- prolfqua::LFQData$new(analysis_data, config)
With this, it is possible for example to use the get_Summariser function to visualize and summarise the data efficiently.
smrz <- lfqdata$get_Summariser()
smrz$plot_hierarchy_counts_sample()
Figure 1: Shown are how many precursors or proteins are found in each sample
The prolfqua package is described in (Wolski et al. 2023).
sessionInfo()
## R version 4.6.1 (2026-06-24)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.5 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.24-bioc/R/lib/libRblas.so
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0 LAPACK version 3.12.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_GB LC_COLLATE=C
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## time zone: America/New_York
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] prolfqua_0.99.8 dplyr_1.2.1 BiocStyle_2.41.0
##
## loaded via a namespace (and not attached):
## [1] Rdpack_2.6.6 gridExtra_2.3.1 sandwich_3.1-3
## [4] rlang_1.3.0 magrittr_2.0.5 clue_0.3-68
## [7] GetoptLong_1.1.1 multcomp_1.4-32 otel_0.2.0
## [10] matrixStats_1.5.0 compiler_4.6.1 mgcv_1.9-5
## [13] png_0.1-9 vctrs_0.7.3 pkgconfig_2.0.3
## [16] shape_1.4.6.1 crayon_1.5.3 fastmap_1.2.0
## [19] magick_2.9.1 backports_1.5.1 labeling_0.4.3
## [22] utf8_1.2.6 promises_1.5.0 rmarkdown_2.32
## [25] nloptr_2.2.1 UpSetR_1.4.1 tinytex_0.61
## [28] purrr_1.2.2 xfun_0.62 glmnet_5.2
## [31] jomo_2.7-6 logistf_1.26.1 cachem_1.1.0
## [34] jsonlite_2.0.0 progress_1.2.3 later_1.4.8
## [37] pan_2.0 prettyunits_1.2.0 broom_1.0.13
## [40] parallel_4.6.1 cluster_2.1.8.3 R6_2.6.1
## [43] stringi_1.8.9 bslib_0.12.0 RColorBrewer_1.1-3
## [46] limma_3.99.4 boot_1.3-32 rpart_4.1.27
## [49] jquerylib_0.1.4 estimability_2.0.0 Rcpp_1.1.2
## [52] bookdown_0.48 iterators_1.0.14 knitr_1.52
## [55] zoo_1.9-1 IRanges_2.47.5 httpuv_1.6.17
## [58] Matrix_1.7-6 splines_4.6.1 nnet_7.3-21
## [61] tidyselect_1.2.1 dichromat_2.0-1 yaml_2.3.12
## [64] doParallel_1.0.17 codetools_0.2-20 lattice_0.23-1
## [67] tibble_3.3.1 plyr_1.8.9 shiny_1.14.0
## [70] withr_3.0.3 S7_0.2.2 coda_0.19-4.1
## [73] evaluate_1.0.5 survival_3.8-12 circlize_0.4.18
## [76] pillar_1.11.1 BiocManager_1.30.27 mice_3.19.0
## [79] KernSmooth_2.23-27 foreach_1.5.2 stats4_4.6.1
## [82] reformulas_0.4.4 plotly_4.12.1 generics_0.1.4
## [85] hms_1.1.4 S4Vectors_0.51.10 ggplot2_4.0.3
## [88] scales_1.4.0 minqa_1.2.8 xtable_1.8-8
## [91] glue_1.8.1 emmeans_2.0.4 tools_4.6.1
## [94] data.table_1.18.6.1 lme4_2.1-0 forcats_1.0.1
## [97] mvtnorm_1.4-2 Cairo_1.7-0 grid_4.6.1
## [100] tidyr_1.3.2 crosstalk_1.2.2 rbibutils_2.4.1
## [103] colorspace_2.1-4 nlme_3.1-172 formula.tools_1.7.1
## [106] cli_3.6.6 viridisLite_0.4.3 ComplexHeatmap_2.29.0
## [109] gtable_0.3.6 sass_0.4.10 digest_0.6.39
## [112] operator.tools_1.6.3.1 BiocGenerics_0.59.12 ggrepel_0.9.8
## [115] TH.data_1.1-5 htmlwidgets_1.6.4 rjson_0.2.23
## [118] farver_2.1.2 htmltools_0.5.9 lifecycle_1.0.5
## [121] httr_1.4.9 mime_0.13 GlobalOptions_0.1.4
## [124] mitml_0.4-5 statmod_1.5.2 MASS_7.3-66