| Title: | Missing Value-Aware Differential Abundance Analysis of DIA Proteomics Data |
|---|---|
| Description: | Provides an end-to-end workflow for differential abundance analysis of protein quantification data, with particular attention to missing values in data-independent acquisition (DIA) proteomics. Quantification reports exported from Spectronaut, DIA-NN and Proteome Discoverer for TMT and label-free experiments (DDA/DIA) are converted into a common data structure, normalised, optionally batch-corrected, imputed and analysed using limma or limpa. The package includes individual and two-stage imputation strategies that treat values assumed to be missing at random and missing not at random separately. Data-driven functions evaluate and rank normalisation and imputation workflows using simulated missingness or spike-in datasets with known ground truth, allowing method selection to be justified for each dataset. Results can be explored through interactive Highcharts visualisations, static ggplot2 and ComplexHeatmap figures, and sortable tables. |
| Authors: | Sergio Ciordia [aut, cre] (ORCID: <https://orcid.org/0000-0002-5726-853X>) |
| Maintainer: | Sergio Ciordia <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.99.1 |
| Built: | 2026-10-06 12:07:19 UTC |
| Source: | https://github.com/BiocStaging/NADIA |
Applies BERT batch effect correction to a normalized assay in a SummarizedExperiment. BERT uses hierarchical tree decomposition to handle missing values, making it suitable for pre-imputation batch correction on protein-level proteomics data.
batch_correct_proteomics( se, assay_name, batch_column = "Batch", corrected_assay_name = "BERT", algorithm = "ComBat", ComBat_mode = 1, covariates = NULL, qualitycontrol = FALSE, verbose = TRUE )batch_correct_proteomics( se, assay_name, batch_column = "Batch", corrected_assay_name = "BERT", algorithm = "ComBat", ComBat_mode = 1, covariates = NULL, qualitycontrol = FALSE, verbose = TRUE )
se |
SummarizedExperiment with a normalized assay. |
assay_name |
Character. Name of the input assay to correct (e.g., "cycloess"). |
batch_column |
Character. Column in colData(se) containing batch assignments (default "Batch"). |
corrected_assay_name |
Character. Name for the new corrected assay added to the SE (default "BERT"). |
algorithm |
Character: "ComBat" (default), "limma", or "ref". |
ComBat_mode |
Integer 1-4 controlling ComBat behavior: 1 = parametric + mean+variance, 2 = parametric + mean-only, 3 = non-parametric + mean+variance, 4 = non-parametric + mean-only. |
covariates |
Character vector of column names from colData(se) to protect during batch correction (default NULL). These are mapped to BERT's Cov_1, Cov_2, ... format internally. BERT uses those columns directly as the design matrix and encodes nothing itself, so categorical columns are converted to indicator variables here; numeric columns are passed through unchanged and act as continuous covariates. IMPORTANT: for ComBat/limma, include here the biological variable of interest (e.g. the condition) in order to PRESERVE it; otherwise ComBat removes all batch-associated variance and can erase biological signal when condition and batch are confounded. |
qualitycontrol |
Logical. Compute ASW (Average Silhouette Width) quality metrics for raw vs corrected data (default FALSE). |
verbose |
Logical (default TRUE). |
SummarizedExperiment with the new corrected assay added. If BERT returns fewer features than the input, the SE is subsetted to match and a warning is issued.
data(nadia_dia) # nadia_dia has no batch information, so the example builds a plausible one: # two digestion batches crossed with the three conditions. cov <- data.frame(Column = nadia_dia$metadata$Coding, Batch = rep(c("b1", "b2"), length.out = nrow(nadia_dia$metadata)), stringsAsFactors = FALSE) res <- process_proteomics(nadia_dia, covariate_df = cov, verbose = FALSE) # BERT removes the batch effect and adds a "BERT" assay, leaving the # original one untouched se <- batch_correct_proteomics(res$se_proc, assay_name = "Impseqrob_min", batch_column = "Batch", verbose = FALSE) SummarizedExperiment::assayNames(se) # On a real experiment you would normally pass the biological variable of # interest in `covariates`, so that ComBat preserves it instead of removing # it along with the batch effect. `covariates = "Condition"` works on this # example: the assay is already imputed, so each batch-by-condition cell has # its two values. Before imputation, with only two samples per cell, BERT # needs two non-missing values per cell and any protein with a gap there # stops being adjustable.data(nadia_dia) # nadia_dia has no batch information, so the example builds a plausible one: # two digestion batches crossed with the three conditions. cov <- data.frame(Column = nadia_dia$metadata$Coding, Batch = rep(c("b1", "b2"), length.out = nrow(nadia_dia$metadata)), stringsAsFactors = FALSE) res <- process_proteomics(nadia_dia, covariate_df = cov, verbose = FALSE) # BERT removes the batch effect and adds a "BERT" assay, leaving the # original one untouched se <- batch_correct_proteomics(res$se_proc, assay_name = "Impseqrob_min", batch_column = "Batch", verbose = FALSE) SummarizedExperiment::assayNames(se) # On a real experiment you would normally pass the biological variable of # interest in `covariates`, so that ComBat preserves it instead of removing # it along with the batch effect. `covariates = "Condition"` works on this # example: the assay is already imputed, so each batch-by-condition cell has # its two values. Before imputation, with only two samples per cell, BERT # needs two non-missing values per cell and any protein with a gap there # stops being adjustable.
Horizontal bar chart of AUC per comparison, colored by value, with a reference line at 0.5.
benchmark_auc_bars_gg( metrics_table, title = "AUC by Comparison", bar_width = 0.7 )benchmark_auc_bars_gg( metrics_table, title = "AUC by Comparison", bar_width = 0.7 )
metrics_table |
Data frame from compute_benchmark_metrics() |
title |
Plot title |
bar_width |
Bar width (default: 0.7) |
ggplot2 object
data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) if (requireNamespace("pROC", quietly = TRUE)) { metrics <- compute_benchmark_metrics(de, ev) benchmark_auc_bars_gg(metrics) }data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) if (requireNamespace("pROC", quietly = TRUE)) { metrics <- compute_benchmark_metrics(de, ev) benchmark_auc_bars_gg(metrics) }
Heatmap of Comparisons x (TP%, FP%, FN%, TN%) with white-to-blue gradient.
benchmark_confusion_gg( confusion_df, title = "Confusion Matrix by Comparison x Species", text_size = 3.5, axis_text_size = 10 )benchmark_confusion_gg( confusion_df, title = "Confusion Matrix by Comparison x Species", text_size = 3.5, axis_text_size = 10 )
confusion_df |
Data frame from .confusion_by_species() |
title |
Plot title |
text_size |
Size of cell text labels |
axis_text_size |
Size of axis text |
ggplot2 object
data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) bench <- benchmarking_proteomics(de, ev, verbose = FALSE) benchmark_confusion_gg(bench$confusion_by_species)data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) bench <- benchmarking_proteomics(de, ev, verbose = FALSE) benchmark_confusion_gg(bench$confusion_by_species)
Heatmap of Comparisons x (TP%, FP%, FN%, TN%) aggregated across all species, with white-to-blue gradient fill by percentage.
benchmark_confusion_overall_gg( confusion_overall_df, title = "Confusion Matrix by Comparison (Overall)", text_size = 4, axis_text_size = 11 )benchmark_confusion_overall_gg( confusion_overall_df, title = "Confusion Matrix by Comparison (Overall)", text_size = 4, axis_text_size = 11 )
confusion_overall_df |
Data frame from .confusion_overall() |
title |
Plot title |
text_size |
Size of cell text labels |
axis_text_size |
Size of axis text |
ggplot2 object
data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) bench <- benchmarking_proteomics(de, ev, verbose = FALSE) benchmark_confusion_overall_gg(bench$confusion_overall)data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) bench <- benchmarking_proteomics(de, ev, verbose = FALSE) benchmark_confusion_overall_gg(bench$confusion_overall)
Heatmap of Comparisons x Metrics (AUC, Sensitivity, Specificity, Precision, F1, Accuracy). Gradient red -> yellow -> green.
benchmark_heatmap_gg( metrics_table, metrics_to_show = c("AUC", "Sensitivity", "Specificity", "Precision", "F1", "Accuracy"), title = "Benchmark Performance Heatmap", text_size = 4, axis_text_size = 11 )benchmark_heatmap_gg( metrics_table, metrics_to_show = c("AUC", "Sensitivity", "Specificity", "Precision", "F1", "Accuracy"), title = "Benchmark Performance Heatmap", text_size = 4, axis_text_size = 11 )
metrics_table |
Data frame from compute_benchmark_metrics() |
metrics_to_show |
Character vector of metrics to display |
title |
Plot title |
text_size |
Size of cell text labels |
axis_text_size |
Size of axis text |
ggplot2 object
data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) metrics <- compute_benchmark_metrics(de, ev) benchmark_heatmap_gg(metrics, metrics_to_show = c("AUC", "F1", "MCC"))data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) metrics <- compute_benchmark_metrics(de, ev) benchmark_heatmap_gg(metrics, metrics_to_show = c("AUC", "F1", "MCC"))
Grouped bar chart: Comparisons x multiple metrics side by side.
benchmark_metrics_bars_gg( metrics_table, metrics_to_show = c("Sensitivity", "Specificity", "Precision", "F1", "Accuracy"), title = "Benchmark Metrics by Comparison", bar_width = 0.7 )benchmark_metrics_bars_gg( metrics_table, metrics_to_show = c("Sensitivity", "Specificity", "Precision", "F1", "Accuracy"), title = "Benchmark Metrics by Comparison", bar_width = 0.7 )
metrics_table |
Data frame from compute_benchmark_metrics() |
metrics_to_show |
Character vector of metrics to display |
title |
Plot title |
bar_width |
Bar width (default: 0.7) |
ggplot2 object
data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) metrics <- compute_benchmark_metrics(de, ev) benchmark_metrics_bars_gg(metrics, metrics_to_show = c("Sensitivity", "F1"))data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) metrics <- compute_benchmark_metrics(de, ev) benchmark_metrics_bars_gg(metrics, metrics_to_show = c("Sensitivity", "F1"))
Generates ROC curves for each comparison using pROC::ggroc(). Requires the pROC package.
benchmark_roc_gg( classified_df, p_col = "adj.P.Val", comparisons = NULL, title = "ROC Curves by Comparison", zoom = FALSE, palette = "Set1" )benchmark_roc_gg( classified_df, p_col = "adj.P.Val", comparisons = NULL, title = "ROC Curves by Comparison", zoom = FALSE, palette = "Set1" )
classified_df |
Classified data frame (output of .classify_all_comparisons) |
p_col |
P-value column name used as predictor score |
comparisons |
Comparisons to include (NULL = all) |
title |
Plot title |
zoom |
If TRUE, zoom into the low-FPR region (x = 0 to 0.1) |
palette |
RColorBrewer palette name (default: "Set1") |
ggplot2 object or NULL if pROC is not available
data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) if (requireNamespace("pROC", quietly = TRUE)) { bench <- benchmarking_proteomics(de, ev, verbose = FALSE) benchmark_roc_gg(bench$classified_df, comparisons = "B-A") }data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) if (requireNamespace("pROC", quietly = TRUE)) { bench <- benchmarking_proteomics(de, ev, verbose = FALSE) benchmark_roc_gg(bench$classified_df, comparisons = "B-A") }
Stacked bar chart of significant proteins by species, faceted by direction (UP/DOWN).
benchmark_signif_bars_gg( classified_df, ev = NULL, species_colors = NULL, title = "Significant Proteins by Species and Direction" )benchmark_signif_bars_gg( classified_df, ev = NULL, species_colors = NULL, title = "Significant Proteins by Species and Direction" )
classified_df |
Classified data frame |
ev |
Ignored, kept for backwards compatibility with earlier calls |
species_colors |
Named vector of colors per species (optional) |
title |
Plot title |
Counts every protein the pipeline called significant, whatever the direction.
A spike-in found significant with the sign inverted is an FN, so it carries
predicted = 0, but it is still a significant protein and belongs in the
facet its observed logFC points to – which is precisely the facet that
reveals the problem.
ggplot2 object
data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) bench <- benchmarking_proteomics(de, ev, verbose = FALSE) benchmark_signif_bars_gg(bench$classified_df, ev)data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) bench <- benchmarking_proteomics(de, ev, verbose = FALSE) benchmark_signif_bars_gg(bench$classified_df, ev)
Volcano plot colored by Species with plotLines at expected logFC values, dispersion stats in subtitle.
benchmark_volcano_hc( de_res_comp, ev_comp, disp_comp = NULL, alpha = 0.05, lfc_thr = 0, p_col = "adj.P.Val", species_colors = NULL, point_size = 3, title = NULL, height = NULL )benchmark_volcano_hc( de_res_comp, ev_comp, disp_comp = NULL, alpha = 0.05, lfc_thr = 0, p_col = "adj.P.Val", species_colors = NULL, point_size = 3, title = NULL, height = NULL )
de_res_comp |
DE results for one comparison |
ev_comp |
Expected values for one comparison |
disp_comp |
Dispersion metrics for one comparison (optional) |
alpha |
Significance threshold |
lfc_thr |
Log fold-change threshold |
p_col |
P-value column |
species_colors |
Named vector of colors per species |
point_size |
Marker radius (default: 3) |
title |
Custom title (optional) |
height |
Chart height in pixels (optional) |
Highchart object
data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) disp <- compute_dispersion_metrics(de, ev) benchmark_volcano_hc(de[de$Comparison == "B-A", ], ev[ev$Comparison == "B-A", ], disp_comp = disp[disp$Comparison == "B-A", ])data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) disp <- compute_dispersion_metrics(de, ev) benchmark_volcano_hc(de[de$Comparison == "B-A", ], ev[ev$Comparison == "B-A", ], disp_comp = disp[disp$Comparison == "B-A", ])
Generates one volcano plot per comparison.
benchmark_volcano_hc_list( de_res, ev, disp = NULL, alpha = 0.05, lfc_thr = 0, p_col = "adj.P.Val", comparisons = NULL, assay = NULL, species_colors = NULL, point_size = 3, height = NULL, species_df = NULL )benchmark_volcano_hc_list( de_res, ev, disp = NULL, alpha = 0.05, lfc_thr = 0, p_col = "adj.P.Val", comparisons = NULL, assay = NULL, species_colors = NULL, point_size = 3, height = NULL, species_df = NULL )
de_res |
Data frame with DE results |
ev |
Data frame with expected values |
disp |
Dispersion metrics data frame (optional) |
alpha |
Significance threshold (default: 0.05) |
lfc_thr |
Log fold-change threshold (default: 0) |
p_col |
P-value column (default: "adj.P.Val") |
comparisons |
Comparisons to include (NULL = all) |
assay |
Assay to filter (NULL = all) |
species_colors |
Named vector of colors per species (optional) |
point_size |
Marker radius (default: 3) |
height |
Chart height in pixels (optional) |
species_df |
Data frame with Protein.IDs and Species columns (optional). If NULL, de_res must already contain a Species column. |
Named list of highchart objects
data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) volcanoes <- benchmark_volcano_hc_list(de, ev) names(volcanoes) volcanoes[["B-A"]]data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) volcanoes <- benchmark_volcano_hc_list(de, ev) names(volcanoes) volcanoes[["B-A"]]
Orchestrator that imports, ranks, visualizes, and exports results from multiple normalization/imputation method combinations.
benchmarking_multiple( opdea_combined = NULL, confusion_combined = NULL, classified_combined = NULL, bench_metrics_combined = NULL, results_dir = NULL, pattern = "benchmark_opdea_metrics\\.tsv$", method_names = NULL, recursive = TRUE, strip_prefix = "benchmark_", metrics = .BM_METRICS, extended_metrics = .BM_EXTENDED_METRICS, p_col = "adj.P.Val", plots = "all", verbose = TRUE, output_dir = NULL, export_plots = TRUE, export_tables = TRUE, plot_width = 12, plot_height = 8, plot_dpi = 150 )benchmarking_multiple( opdea_combined = NULL, confusion_combined = NULL, classified_combined = NULL, bench_metrics_combined = NULL, results_dir = NULL, pattern = "benchmark_opdea_metrics\\.tsv$", method_names = NULL, recursive = TRUE, strip_prefix = "benchmark_", metrics = .BM_METRICS, extended_metrics = .BM_EXTENDED_METRICS, p_col = "adj.P.Val", plots = "all", verbose = TRUE, output_dir = NULL, export_plots = TRUE, export_tables = TRUE, plot_width = 12, plot_height = 8, plot_dpi = 150 )
opdea_combined |
Optional pre-built data.frame with columns:
Assay, Comparison, nMCC, G_mean, pAUC_001, pAUC_005, pAUC_010.
If NULL, results are imported from |
confusion_combined |
Optional pre-built data.frame with columns:
Assay, Comparison, TP, FP, TN, FN. If NULL and |
classified_combined |
Optional pre-built data.frame with columns:
Assay, Comparison, truth, and a p-value column. If NULL and
|
bench_metrics_combined |
Optional pre-built data.frame from
|
results_dir |
Parent directory containing benchmark subfolders
(each with |
pattern |
Regex for opdea metrics filename (default:
|
method_names |
Optional Assay names for file import |
recursive |
Search subdirectories? (default: TRUE) |
strip_prefix |
Prefix removed from each |
metrics |
Character vector of metrics for OpDEA ranking (default: all 5 OpDEA metrics) |
extended_metrics |
Character vector of metrics for extended ranking (default: all 11 classification + OpDEA metrics) |
p_col |
P-value column name for ROC curves (default: "adj.P.Val") |
plots |
Which plots to generate: "all" or character vector of names. Valid names: "ranking_heatmap_mean", "ranking_heatmap_median", "ranking_bars_mean", "ranking_bars_median", "metrics_heatmap_mean", "metrics_heatmap_median", "metrics_comparison", "extended_ranking_bars", "extended_ranking_heatmap" |
verbose |
Print progress messages (default: TRUE) |
output_dir |
Directory for exporting results (NULL = no export) |
export_plots |
Export plots as PNG (default: TRUE) |
export_tables |
Export tables as TSV (default: TRUE) |
plot_width |
Plot width in inches (default: 12) |
plot_height |
Plot height in inches (default: 8) |
plot_dpi |
Plot resolution (default: 150) |
Named list with:
Combined input data.frame
Mean of metrics per Assay
Median of metrics per Assay
Ranking table (mean-based)
Ranking table (median-based)
Heatmap of ranks (mean)
Heatmap of ranks (median)
Bar chart of final rank (mean)
Bar chart of final rank (median)
Heatmap of metric values (mean)
Heatmap of metric values (median)
Boxplot distributions
Named list of ranking data.frames per comparison
data.frame with all per-comparison rankings
Named list of heatmaps per comparison
Named list of bar charts per comparison
Combined confusion data.frame (if available)
Faceted confusion stacked bars (if available)
Named list of confusion plots per comparison
Combined classified data.frame (if available)
Named list of ROC plots per comparison (if available)
Named list of ROC zoom plots per comparison (if available)
Merged classification + OpDEA data (if bench_metrics available)
Mean-aggregated extended metrics per Assay
Extended ranking table (11 metrics, mean-based)
Bar chart of extended ranking
Heatmap of extended ranking
List of parameters used
data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) root <- file.path(tempdir(), "nadia_bench") for (nm in c("cycloess", "quantile")) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] benchmarking_proteomics(de, ev, output_dir = file.path(root, nm), verbose = FALSE) } result <- benchmarking_multiple(results_dir = root, verbose = FALSE) result$mean_ranking result$gg_ranking_bars_meandata(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) root <- file.path(tempdir(), "nadia_bench") for (nm in c("cycloess", "quantile")) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] benchmarking_proteomics(de, ev, output_dir = file.path(root, nm), verbose = FALSE) } result <- benchmarking_multiple(results_dir = root, verbose = FALSE) result$mean_ranking result$gg_ranking_bars_mean
Evaluates the reliability of DE results by comparing them against known ground truth (multi-species spike-in experiments). Computes classification metrics, dispersion statistics, and generates visualizations.
benchmarking_proteomics( de_res, expected_values, alpha = 0.05, lfc_thr = 0, p_col = "adj.P.Val", comparisons = NULL, assay = NULL, output_dir = NULL, verbose = TRUE, species_colors = NULL, species_df = NULL )benchmarking_proteomics( de_res, expected_values, alpha = 0.05, lfc_thr = 0, p_col = "adj.P.Val", comparisons = NULL, assay = NULL, output_dir = NULL, verbose = TRUE, species_colors = NULL, species_df = NULL )
de_res |
Data frame with DE results. Required columns: Protein.IDs, logFC, P.Value, adj.P.Val, Change, Comparison. Optional: Gene.Names, Assay, Species (if not using species_df). |
expected_values |
Data frame with expected values. Required columns: Comparison, Species, expected_logFC. |
alpha |
Significance threshold (default: 0.05) |
lfc_thr |
Log fold-change threshold (default: 0) |
p_col |
P-value column to use (default: "adj.P.Val") |
comparisons |
Comparisons to include (NULL = all) |
assay |
Assay to filter (NULL = all) |
output_dir |
Directory for exported files (NULL = no export) |
verbose |
Print progress messages (default: TRUE) |
species_colors |
Named vector of colors per species (optional) |
species_df |
Data frame with Protein.IDs and Species columns (optional). If NULL, de_res must already contain a Species column. |
List with:
metrics_table: Classification metrics per comparison
confusion_by_species: Confusion matrix per Comparison x Species
confusion_overall: Confusion matrix aggregated per Comparison
dispersion_metrics: Dispersion stats per Comparison x Species
classified_df: Full classified data frame
gg_heatmap: ggplot2 performance heatmap
gg_confusion_by_species: ggplot2 confusion matrix heatmap (by species)
gg_confusion_overall: ggplot2 confusion matrix heatmap (aggregated)
gg_auc_bars: ggplot2 AUC bar chart
gg_metrics_bars: ggplot2 grouped metrics bar chart
gg_signif_bars: ggplot2 significant proteins stacked bars (absolute)
hc_volcano_list: Named list of Highcharter volcano plots
parameters: List of parameters used
data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) species_df <- data.frame(Protein.IDs = sp$PG.ProteinGroups, Species = sp$PG.OrganismId) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) bench <- benchmarking_proteomics(de, ev, species_df = species_df, verbose = FALSE) bench$metrics_table bench$gg_heatmapdata(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) species_df <- data.frame(Protein.IDs = sp$PG.ProteinGroups, Species = sp$PG.OrganismId) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) bench <- benchmarking_proteomics(de, ev, species_df = species_df, verbose = FALSE) bench$metrics_table bench$gg_heatmap
For each of the 11 metrics, averages across comparisons per Assay (mean), then ranks methods in descending order (higher = better for all metrics). Final rank = mean of the 11 individual ranks.
bm_compute_extended_ranking( opdea_combined, bench_metrics_combined, metrics = .BM_EXTENDED_METRICS )bm_compute_extended_ranking( opdea_combined, bench_metrics_combined, metrics = .BM_EXTENDED_METRICS )
opdea_combined |
data.frame from import_opdea_results() |
bench_metrics_combined |
data.frame from import_benchmark_metrics() |
metrics |
Character vector of metrics to include (default: all 11 extended metrics) |
Note: this extended ranking can drift away from the canonical OpDEA ranking
(bm_compute_ranking, based on nMCC/G_mean/pAUC). Performance is collinear
with F1 (so F1 effectively counts twice), and in spike-in designs
Accuracy/NPV are dominated by the background (TN >> ), hence they have
little discriminative power. Use it as a complementary view, not as a
substitute for the OpDEA ranking.
Named list with:
Merged data.frame (long format)
data.frame of mean metric values per Assay
data.frame with rank columns and rank_final
Number of unique methods
Number of unique comparisons
Metrics actually used
data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- NULL bench_all <- NULL for (nm in c("cycloess", "quantile")) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] opdea_all <- rbind(opdea_all, cbind(compute_opdea_metrics(de, ev), Assay = nm)) bench_all <- rbind(bench_all, cbind(compute_benchmark_metrics(de, ev), Assay = nm)) } ext <- bm_compute_extended_ranking(opdea_all, bench_all) ext$mean_ranking[, c("Assay", "rank_final")]data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- NULL bench_all <- NULL for (nm in c("cycloess", "quantile")) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] opdea_all <- rbind(opdea_all, cbind(compute_opdea_metrics(de, ev), Assay = nm)) bench_all <- rbind(bench_all, cbind(compute_benchmark_metrics(de, ev), Assay = nm)) } ext <- bm_compute_extended_ranking(opdea_all, bench_all) ext$mean_ranking[, c("Assay", "rank_final")]
For each metric, aggregates across comparisons (mean and median), then ranks methods in descending order (rank 1 = best). Final rank = average of individual metric ranks.
bm_compute_ranking(opdea_combined, metrics = .BM_METRICS)bm_compute_ranking(opdea_combined, metrics = .BM_METRICS)
opdea_combined |
data.frame with columns: Assay, Comparison, nMCC, G_mean, pAUC_001, pAUC_005, pAUC_010 |
metrics |
Character vector of metrics to include in ranking (default: all 5 OpDEA metrics) |
Named list with:
data.frame of mean metric values per Assay
data.frame of median metric values per Assay
data.frame of ranks based on mean aggregation
data.frame of ranks based on median aggregation
Input combined data.frame
Number of methods
Number of comparisons
Metrics included in ranking
data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cbind(compute_opdea_metrics(de, ev), Assay = nm) })) ranking <- bm_compute_ranking(opdea_all) ranking$mean_rankingdata(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cbind(compute_opdea_metrics(de, ev), Assay = nm) })) ranking <- bm_compute_ranking(opdea_all) ranking$mean_ranking
For each comparison, ranks methods directly on their metric values (no aggregation needed since there is one value per method per comparison).
bm_compute_ranking_by_comparison(opdea_combined, metrics = .BM_METRICS)bm_compute_ranking_by_comparison(opdea_combined, metrics = .BM_METRICS)
opdea_combined |
data.frame with columns: Assay, Comparison, nMCC, G_mean, pAUC_001, pAUC_005, pAUC_010 |
metrics |
Character vector of metrics to include in ranking |
Named list with:
Named list where each key is a comparison and each value is a data.frame with metric values, ranks, and rank_final
data.frame with all comparisons in long format (includes Comparison column)
data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cbind(compute_opdea_metrics(de, ev), Assay = nm) })) by_comp <- bm_compute_ranking_by_comparison(opdea_all) by_comp$by_comparison[["B-A"]]data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cbind(compute_opdea_metrics(de, ev), Assay = nm) })) by_comp <- bm_compute_ranking_by_comparison(opdea_all) by_comp$by_comparison[["B-A"]]
Horizontal stacked bars showing confusion matrix counts per method.
If comparison is NULL, generates a faceted plot with all comparisons.
bm_plot_confusion_stacked(confusion_combined, comparison = NULL, title = NULL)bm_plot_confusion_stacked(confusion_combined, comparison = NULL, title = NULL)
confusion_combined |
data.frame with columns: Assay, Comparison, TP, FP, TN, FN |
comparison |
Optional: single comparison to plot. If NULL, faceted plot with all comparisons. |
title |
Optional plot title |
ggplot2 object
data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) bench_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cbind(compute_benchmark_metrics(de, ev), Assay = nm) })) bm_plot_confusion_stacked(bench_all) bm_plot_confusion_stacked(bench_all, comparison = "B-A")data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) bench_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cbind(compute_benchmark_metrics(de, ev), Assay = nm) })) bm_plot_confusion_stacked(bench_all) bm_plot_confusion_stacked(bench_all, comparison = "B-A")
Horizontal bar chart of extended combined ranking
bm_plot_extended_ranking_bars(extended_ranking, title = NULL)bm_plot_extended_ranking_bars(extended_ranking, title = NULL)
extended_ranking |
List from bm_compute_extended_ranking() |
title |
Optional plot title |
ggplot object
data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- NULL bench_all <- NULL for (nm in c("cycloess", "quantile")) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] opdea_all <- rbind(opdea_all, cbind(compute_opdea_metrics(de, ev), Assay = nm)) bench_all <- rbind(bench_all, cbind(compute_benchmark_metrics(de, ev), Assay = nm)) } ext <- bm_compute_extended_ranking(opdea_all, bench_all) bm_plot_extended_ranking_bars(ext)data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- NULL bench_all <- NULL for (nm in c("cycloess", "quantile")) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] opdea_all <- rbind(opdea_all, cbind(compute_opdea_metrics(de, ev), Assay = nm)) bench_all <- rbind(bench_all, cbind(compute_benchmark_metrics(de, ev), Assay = nm)) } ext <- bm_compute_extended_ranking(opdea_all, bench_all) bm_plot_extended_ranking_bars(ext)
Heatmap of extended ranking (11 metrics)
bm_plot_extended_ranking_heatmap(extended_ranking, title = NULL)bm_plot_extended_ranking_heatmap(extended_ranking, title = NULL)
extended_ranking |
List from bm_compute_extended_ranking() |
title |
Optional plot title |
ggplot object
data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- NULL bench_all <- NULL for (nm in c("cycloess", "quantile")) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] opdea_all <- rbind(opdea_all, cbind(compute_opdea_metrics(de, ev), Assay = nm)) bench_all <- rbind(bench_all, cbind(compute_benchmark_metrics(de, ev), Assay = nm)) } ext <- bm_compute_extended_ranking(opdea_all, bench_all) bm_plot_extended_ranking_heatmap(ext)data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- NULL bench_all <- NULL for (nm in c("cycloess", "quantile")) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] opdea_all <- rbind(opdea_all, cbind(compute_opdea_metrics(de, ev), Assay = nm)) bench_all <- rbind(bench_all, cbind(compute_benchmark_metrics(de, ev), Assay = nm)) } ext <- bm_compute_extended_ranking(opdea_all, bench_all) bm_plot_extended_ranking_heatmap(ext)
Faceted boxplot showing the distribution of each metric across comparisons for every method.
bm_plot_metrics_comparison(opdea_combined, metrics = .BM_METRICS, title = NULL)bm_plot_metrics_comparison(opdea_combined, metrics = .BM_METRICS, title = NULL)
opdea_combined |
data.frame with Assay, Comparison, and metric columns |
metrics |
Character vector of metrics to plot (default: all 5) |
title |
Optional plot title |
ggplot2 object
data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cbind(compute_opdea_metrics(de, ev), Assay = nm) })) bm_plot_metrics_comparison(opdea_all)data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cbind(compute_opdea_metrics(de, ev), Assay = nm) })) bm_plot_metrics_comparison(opdea_all)
Shows the actual metric values per method, with per-column color scaling.
bm_plot_metrics_heatmap(ranking_result, type = "mean", title = NULL)bm_plot_metrics_heatmap(ranking_result, type = "mean", title = NULL)
ranking_result |
List returned by |
type |
"mean" or "median" aggregation (default: "mean") |
title |
Optional plot title |
ggplot2 object
data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cbind(compute_opdea_metrics(de, ev), Assay = nm) })) ranking <- bm_compute_ranking(opdea_all) bm_plot_metrics_heatmap(ranking)data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cbind(compute_opdea_metrics(de, ev), Assay = nm) })) ranking <- bm_compute_ranking(opdea_all) bm_plot_metrics_heatmap(ranking)
Horizontal bars of rank_final by Assay, ordered best to worst.
bm_plot_ranking_bars(ranking_result, type = "mean", title = NULL)bm_plot_ranking_bars(ranking_result, type = "mean", title = NULL)
ranking_result |
List returned by |
type |
"mean" or "median" aggregation (default: "mean") |
title |
Optional plot title |
ggplot2 object
data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cbind(compute_opdea_metrics(de, ev), Assay = nm) })) ranking <- bm_compute_ranking(opdea_all) bm_plot_ranking_bars(ranking)data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cbind(compute_opdea_metrics(de, ev), Assay = nm) })) ranking <- bm_compute_ranking(opdea_all) bm_plot_ranking_bars(ranking)
Bar chart of final ranks for a single comparison
bm_plot_ranking_bars_by_comp(ranking_by_comp, comparison, title = NULL)bm_plot_ranking_bars_by_comp(ranking_by_comp, comparison, title = NULL)
ranking_by_comp |
List returned by |
comparison |
Character string: which comparison to plot |
title |
Optional plot title |
ggplot2 object
data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cbind(compute_opdea_metrics(de, ev), Assay = nm) })) by_comp <- bm_compute_ranking_by_comparison(opdea_all) bm_plot_ranking_bars_by_comp(by_comp, comparison = "D-A")data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cbind(compute_opdea_metrics(de, ev), Assay = nm) })) by_comp <- bm_compute_ranking_by_comparison(opdea_all) bm_plot_ranking_bars_by_comp(by_comp, comparison = "D-A")
Rows = Assay (ordered by rank_final), columns = metrics. Fill color = rank value (green = best, red = worst).
bm_plot_ranking_heatmap(ranking_result, type = "mean", title = NULL)bm_plot_ranking_heatmap(ranking_result, type = "mean", title = NULL)
ranking_result |
List returned by |
type |
"mean" or "median" aggregation (default: "mean") |
title |
Optional plot title |
ggplot2 object
data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cbind(compute_opdea_metrics(de, ev), Assay = nm) })) ranking <- bm_compute_ranking(opdea_all) bm_plot_ranking_heatmap(ranking)data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cbind(compute_opdea_metrics(de, ev), Assay = nm) })) ranking <- bm_compute_ranking(opdea_all) bm_plot_ranking_heatmap(ranking)
Heatmap of metric ranks for a single comparison
bm_plot_ranking_heatmap_by_comp(ranking_by_comp, comparison, title = NULL)bm_plot_ranking_heatmap_by_comp(ranking_by_comp, comparison, title = NULL)
ranking_by_comp |
List returned by |
comparison |
Character string: which comparison to plot |
title |
Optional plot title |
ggplot2 object
data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cbind(compute_opdea_metrics(de, ev), Assay = nm) })) by_comp <- bm_compute_ranking_by_comparison(opdea_all) bm_plot_ranking_heatmap_by_comp(by_comp, comparison = "B-A")data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) opdea_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cbind(compute_opdea_metrics(de, ev), Assay = nm) })) by_comp <- bm_compute_ranking_by_comparison(opdea_all) bm_plot_ranking_heatmap_by_comp(by_comp, comparison = "B-A")
Generates ROC (or ROC zoom) plot where each curve represents a different method (Assay) for one comparison.
bm_plot_roc( classified_combined, comparison, p_col = "adj.P.Val", zoom = FALSE, palette = "Set2" )bm_plot_roc( classified_combined, comparison, p_col = "adj.P.Val", zoom = FALSE, palette = "Set2" )
classified_combined |
data.frame with columns: Assay, Comparison, truth, and a p-value column |
comparison |
Character. Single comparison to plot (e.g. "B-A") |
p_col |
P-value column name (default: "adj.P.Val") |
zoom |
Logical. If TRUE, zoom to FPR 0-10% and show pAUC in legend |
palette |
RColorBrewer palette name (default: "Set2") |
ggplot2 object or NULL if pROC not available
data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) classified_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cl <- benchmarking_proteomics(de, ev, verbose = FALSE)$classified_df cl$Assay <- nm cl })) if (requireNamespace("pROC", quietly = TRUE)) { bm_plot_roc(classified_all, comparison = "B-A") }data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) classified_all <- do.call(rbind, lapply(c("cycloess", "quantile"), function(nm) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] cl <- benchmarking_proteomics(de, ev, verbose = FALSE)$classified_df cl$Assay <- nm cl })) if (requireNamespace("pROC", quietly = TRUE)) { bm_plot_roc(classified_all, comparison = "B-A") }
Interactive Highcharts Boxplot for Proteomics
boxplot_highchart_list( data, assays = NULL, color_by = "Condition", group_order = NULL, palette = NULL, title = NULL, subtitle = NULL, show_outliers = TRUE, outlier_jitter = 0.15, outlier_size = 3, box_width = 20, horizontal = TRUE, height = NULL )boxplot_highchart_list( data, assays = NULL, color_by = "Condition", group_order = NULL, palette = NULL, title = NULL, subtitle = NULL, show_outliers = TRUE, outlier_jitter = 0.15, outlier_size = 3, box_width = 20, horizontal = TRUE, height = NULL )
data |
Data frame with columns: Column, Assay, Intensity, Condition |
assays |
Vector of assays to include (NULL = all of them) |
color_by |
Column used for colouring (default: "Condition") |
group_order |
Order of the groups/conditions |
palette |
Colour palette: "ggsci::palette", "brewer:Name", or a vector |
title |
Chart title (optional).
Use |
subtitle |
Chart subtitle (optional).
Use |
show_outliers |
Show outliers lying outside the whiskers (default: TRUE) |
outlier_jitter |
Amount of horizontal jitter applied to the outliers (default: 0.15) |
outlier_size |
Radius of the outlier points (default: 3) |
box_width |
Width of the boxplot boxes in pixels (default: 20) |
horizontal |
Horizontal orientation (default: TRUE) |
height |
Chart height in pixels |
List of highchart objects (one per assay)
data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # One boxplot per assay; keep only the imputed one hc_list <- boxplot_highchart_list( res$BoxPlot_Input, assays = "Impseqrob_min", group_order = c("A", "B", "D"), title = "Boxplot: {assay}" ) names(hc_list)data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # One boxplot per assay; keep only the imputed one hc_list <- boxplot_highchart_list( res$BoxPlot_Input, assays = "Impseqrob_min", group_order = c("A", "B", "D"), title = "Boxplot: {assay}" ) names(hc_list)
Build the clustering matrix aggregated by condition
build_clustering_matrix( intensity_matrix, sample_metadata, selected_features, condition_order = NULL, aggregate = c("median", "mean"), verbose = TRUE )build_clustering_matrix( intensity_matrix, sample_metadata, selected_features, condition_order = NULL, aggregate = c("median", "mean"), verbose = TRUE )
intensity_matrix |
Intensity matrix (features x samples) |
sample_metadata |
DataFrame with SampleID, Condition |
selected_features |
Vector of features to include |
condition_order |
Condition order (NULL = alphabetical order) |
aggregate |
Aggregation method: "median" or "mean" |
verbose |
Print progress messages (default: TRUE) |
Matrix of aggregated intensities (features x conditions)
Creates one row per FeatureID-Cluster combination where membership >= min_membership. This lets a protein appear in several clusters (soft clustering).
build_long_output(cl, eset_std, conditions, min_membership)build_long_output(cl, eset_std, conditions, min_membership)
cl |
Mfuzz clustering object |
eset_std |
Standardised ExpressionSet (with z-scores) |
conditions |
Vector of condition names |
min_membership |
Minimum membership threshold |
DataFrame in long format
Build a PCA scores data frame from data in long format
build_pca_scores( pca_input, mode = c("all", "any", "specific"), alpha = 0.05, comparison = NULL, subset_label = NULL, center = TRUE, scale. = TRUE, filter_samples_to_comparison = FALSE, cond_col = "Condition" )build_pca_scores( pca_input, mode = c("all", "any", "specific"), alpha = 0.05, comparison = NULL, subset_label = NULL, center = TRUE, scale. = TRUE, filter_samples_to_comparison = FALSE, cond_col = "Condition" )
pca_input |
Data frame in long format with columns:
|
mode |
Protein filtering mode: "all", "any", or "specific" |
alpha |
Significance threshold for mode "specific" (default: 0.05) |
comparison |
Name of the comparison for mode "specific" (e.g. "B-A") |
subset_label |
Custom label for the subset (optional) |
center |
Center the data before PCA (default: TRUE) |
scale. |
Scale the data before PCA (default: TRUE) |
filter_samples_to_comparison |
Restrict samples to the conditions involved in the specific comparison (default: FALSE) |
cond_col |
Name of the condition column (default: "Condition") |
Data frame with columns: SampleID, PC1, PC2, PC1_Perc, PC2_Perc, Subset, Condition, Replicate
data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # Scores and the variance explained by the first two components scores <- build_pca_scores(res$PCA_Input, mode = "all") head(scores) unique(scores[c("PC1_Perc", "PC2_Perc")])data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # Scores and the variance explained by the first two components scores <- build_pca_scores(res$PCA_Input, mode = "all") head(scores) unique(scores[c("PC1_Perc", "PC2_Perc")])
Builds a comparative plot with the centroids of all the clusters.
cluster_centroids_highchart( data, conditions = NULL, clusters = NULL, min_membership = NULL, centroid_summary = c("mean", "median"), palette = NULL, line_width = 2.5, show_markers = TRUE, title = NULL, height = NULL )cluster_centroids_highchart( data, conditions = NULL, clusters = NULL, min_membership = NULL, centroid_summary = c("mean", "median"), palette = NULL, line_width = 2.5, show_markers = TRUE, title = NULL, height = NULL )
data |
Pattern Profiler DataFrame (LONG format) |
conditions |
Vector of condition names |
clusters |
Clusters to include (NULL = all) |
min_membership |
Membership filter applied before computing the centroids |
centroid_summary |
Method: "mean" or "median" |
palette |
Colour palette |
line_width |
Line width (default: 2.5) |
show_markers |
Show markers on the points (default: TRUE) |
title |
Custom title |
height |
Plot height |
highchart object
if (requireNamespace("Mfuzz", quietly = TRUE) && requireNamespace("e1071", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) pp <- pattern_profiler_analysis(res$se_proc, res$DEPs_results, assay_name = "Impseqrob_min", auto_select_c = FALSE, c = 3, verbose = FALSE) # All the cluster centroids on one chart hc <- cluster_centroids_highchart(pp$long_output, conditions = c("A", "B", "D"), centroid_summary = "median") print(class(hc)) }if (requireNamespace("Mfuzz", quietly = TRUE) && requireNamespace("e1071", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) pp <- pattern_profiler_analysis(res$se_proc, res$DEPs_results, assay_name = "Impseqrob_min", auto_select_c = FALSE, c = 3, verbose = FALSE) # All the cluster centroids on one chart hc <- cluster_centroids_highchart(pp$long_output, conditions = c("A", "B", "D"), centroid_summary = "median") print(class(hc)) }
Builds an interactive plot showing the expression profiles of the proteins in a given cluster.
cluster_profile_highchart( data, cluster, conditions = NULL, min_membership = NULL, show_centroid = TRUE, centroid_summary = c("mean", "median"), cluster_color = NULL, line_width = 1, line_opacity = 0.4, centroid_width = 3, title = NULL, height = NULL )cluster_profile_highchart( data, cluster, conditions = NULL, min_membership = NULL, show_centroid = TRUE, centroid_summary = c("mean", "median"), cluster_color = NULL, line_width = 1, line_opacity = 0.4, centroid_width = 3, title = NULL, height = NULL )
data |
Pattern Profiler DataFrame (LONG format) |
cluster |
Number of the cluster to plot |
conditions |
Vector of condition names (order for the X axis) |
min_membership |
Additional membership filter (NULL = no filter) |
show_centroid |
Show the centroid line (default: TRUE) |
centroid_summary |
Method for the centroid: "mean" or "median" |
cluster_color |
Cluster colour (NULL = automatic) |
line_width |
Width of the profile lines (default: 1) |
line_opacity |
Opacity of the lines (default: 0.4) |
centroid_width |
Width of the centroid line (default: 3) |
title |
Custom title (optional) |
height |
Plot height in pixels |
highchart object
if (requireNamespace("Mfuzz", quietly = TRUE) && requireNamespace("e1071", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) pp <- pattern_profiler_analysis(res$se_proc, res$DEPs_results, assay_name = "Impseqrob_min", auto_select_c = FALSE, c = 3, verbose = FALSE) hc <- cluster_profile_highchart(pp$long_output, cluster = 1, conditions = c("A", "B", "D")) print(class(hc)) }if (requireNamespace("Mfuzz", quietly = TRUE) && requireNamespace("e1071", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) pp <- pattern_profiler_analysis(res$se_proc, res$DEPs_results, assay_name = "Impseqrob_min", auto_select_c = FALSE, c = 3, verbose = FALSE) hc <- cluster_profile_highchart(pp$long_output, cluster = 1, conditions = c("A", "B", "D")) print(class(hc)) }
Builds a list of interactive plots for all the clusters.
cluster_profile_highchart_list( data, conditions = NULL, clusters = NULL, min_membership = NULL, show_centroid = TRUE, centroid_summary = c("mean", "median"), palette = NULL, line_width = 1, line_opacity = 0.4, centroid_width = 3, height = NULL )cluster_profile_highchart_list( data, conditions = NULL, clusters = NULL, min_membership = NULL, show_centroid = TRUE, centroid_summary = c("mean", "median"), palette = NULL, line_width = 1, line_opacity = 0.4, centroid_width = 3, height = NULL )
data |
Pattern Profiler DataFrame (LONG format) |
conditions |
Vector of condition names |
clusters |
Vector of clusters to plot (NULL = all) |
min_membership |
Minimum membership filter |
show_centroid |
Show the centroid line (default: TRUE) |
centroid_summary |
Method for the centroid: "mean" or "median" |
palette |
Palette for the cluster colours |
line_width |
Width of the profile lines (default: 1) |
line_opacity |
Opacity of the lines (default: 0.4) |
centroid_width |
Width of the centroid line (default: 3) |
height |
Height of each plot in pixels |
Named list of highchart objects
if (requireNamespace("Mfuzz", quietly = TRUE) && requireNamespace("e1071", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) pp <- pattern_profiler_analysis(res$se_proc, res$DEPs_results, assay_name = "Impseqrob_min", auto_select_c = FALSE, c = 3, verbose = FALSE) hc_profiles <- cluster_profile_highchart_list(pp$long_output, conditions = c("A", "B", "D")) print(names(hc_profiles)) }if (requireNamespace("Mfuzz", quietly = TRUE) && requireNamespace("e1071", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) pp <- pattern_profiler_analysis(res$se_proc, res$DEPs_results, assay_name = "Impseqrob_min", auto_select_c = FALSE, c = 3, verbose = FALSE) hc_profiles <- cluster_profile_highchart_list(pp$long_output, conditions = c("A", "B", "D")) print(names(hc_profiles)) }
Compute benchmark metrics for all comparisons
compute_benchmark_metrics( de_res, ev, alpha = 0.05, lfc_thr = 0, p_col = "adj.P.Val", comparisons = NULL, assay = NULL, species_df = NULL )compute_benchmark_metrics( de_res, ev, alpha = 0.05, lfc_thr = 0, p_col = "adj.P.Val", comparisons = NULL, assay = NULL, species_df = NULL )
de_res |
Data frame with DE results |
ev |
Data frame with expected values |
alpha |
Significance threshold (default: 0.05) |
lfc_thr |
Log fold-change threshold (default: 0) |
p_col |
P-value column name (default: "adj.P.Val") |
comparisons |
Comparisons to include (NULL = all) |
assay |
Assay to filter (NULL = all) |
species_df |
Data frame with Protein.IDs and Species columns (optional). If NULL, de_res must already contain a Species column. |
Data frame with metrics per comparison
data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) metrics <- compute_benchmark_metrics(de, ev) metrics[, c("Comparison", "TP", "FP", "Sensitivity", "Specificity", "F1")]data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) metrics <- compute_benchmark_metrics(de, ev) metrics[, c("Comparison", "TP", "FP", "Sensitivity", "Specificity", "F1")]
Computes the coordinates of a confidence ellipse based on the chi-squared distribution, similar to FactoMineR::coord.ellipse and ggplot2::stat_ellipse.
compute_confidence_ellipse( scores_df, group_col = "Condition", level = 0.95, npoints = 100 )compute_confidence_ellipse( scores_df, group_col = "Condition", level = 0.95, npoints = 100 )
scores_df |
Data frame with columns PC1, PC2 and the grouping column |
group_col |
Name of the grouping column (default: "Condition") |
level |
Confidence level (default: 0.95) |
npoints |
Number of points used to draw the ellipse (default: 100) |
List of data frames, each one with columns: group, x, y
Calculates MED, SD, CV, MAD, RCV, IQR, trimmed SD/CV for significant proteins with correct direction.
compute_dispersion_metrics( de_res, ev, alpha = 0.05, lfc_thr = 0, p_col = "adj.P.Val", comparisons = NULL, assay = NULL, trim = 0.1, species_df = NULL )compute_dispersion_metrics( de_res, ev, alpha = 0.05, lfc_thr = 0, p_col = "adj.P.Val", comparisons = NULL, assay = NULL, trim = 0.1, species_df = NULL )
de_res |
Data frame with DE results |
ev |
Data frame with expected values |
alpha |
Significance threshold (default: 0.05) |
lfc_thr |
Log fold-change threshold (default: 0) |
p_col |
P-value column name (default: "adj.P.Val") |
comparisons |
Comparisons to include (NULL = all) |
assay |
Assay to filter (NULL = all) |
trim |
Trimming proportion for trimmed SD/CV (default: 0.1) |
species_df |
Data frame with Protein.IDs and Species columns (optional). If NULL, de_res must already contain a Species column. |
Data frame with dispersion metrics
data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) disp <- compute_dispersion_metrics(de, ev) disp[, c("Comparison", "Species", "expected_logFC", "MED", "MAD", "RCV")]data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) disp <- compute_dispersion_metrics(de, ev) disp[, c("Comparison", "Species", "expected_logFC", "MED", "MAD", "RCV")]
Compute the convex hull (enclosing polygon) per group
compute_hulls(scores_df, group_col = "Condition")compute_hulls(scores_df, group_col = "Condition")
scores_df |
Data frame with columns PC1, PC2 and the grouping column |
group_col |
Name of the grouping column (default: "Condition") |
List of data frames, each one with columns: group, x, y
Calculates additional benchmark metrics based on Peng et al. 2024 (Nature Comms, OpDEA framework):
pAUC(0.01), pAUC(0.05), pAUC(0.1): Partial AUC with McClish correction
nMCC: Normalized MCC = (MCC + 1) / 2
G-mean: sqrt(Sensitivity * Specificity)
compute_opdea_metrics( de_res, ev, alpha = 0.05, lfc_thr = 0, p_col = "adj.P.Val", comparisons = NULL, assay = NULL, species_df = NULL )compute_opdea_metrics( de_res, ev, alpha = 0.05, lfc_thr = 0, p_col = "adj.P.Val", comparisons = NULL, assay = NULL, species_df = NULL )
de_res |
Data frame with DE results |
ev |
Data frame with expected values |
alpha |
Significance threshold (default: 0.05) |
lfc_thr |
Log fold-change threshold (default: 0) |
p_col |
P-value column name (default: "adj.P.Val") |
comparisons |
Comparisons to include (NULL = all) |
assay |
Assay to filter (NULL = all) |
species_df |
Data frame with Protein.IDs and Species columns (optional). If NULL, de_res must already contain a Species column. |
Data frame with columns: Comparison, nMCC, G_mean, pAUC_001, pAUC_005, pAUC_010
data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) compute_opdea_metrics(de, ev)data(nadia_dia) de <- process_proteomics(nadia_dia, verbose = FALSE)$DEPs_results sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) compute_opdea_metrics(de, ev)
Configure the colour palette for the clusters
configure_cluster_palette(n_clusters, palette = NULL)configure_cluster_palette(n_clusters, palette = NULL)
n_clusters |
Number of clusters |
palette |
Palette to use (NULL, "ggsci::name", "brewer:name") |
Vector of colours named by cluster
Create an ExpressionSet for Mfuzz
create_expression_set(mat, feature_info = NULL)create_expression_set(mat, feature_info = NULL)
mat |
Expression matrix (features x conditions) |
feature_info |
DataFrame with feature information (optional) |
ExpressionSet object
Coordinates comparison specification, limma analysis, and result extraction.
de_analysis_proteomics( se, assay_name = NULL, comparisons = NULL, control = NULL, logFC_threshold = 0, alpha = 0.05, p_adj = TRUE, eBayes_trend = NULL, eBayes_robust = NULL, de_method = "limma", covariate_column = NULL, bio_replicate_column = NULL, condition_column = "Condition", verbose = TRUE )de_analysis_proteomics( se, assay_name = NULL, comparisons = NULL, control = NULL, logFC_threshold = 0, alpha = 0.05, p_adj = TRUE, eBayes_trend = NULL, eBayes_robust = NULL, de_method = "limma", covariate_column = NULL, bio_replicate_column = NULL, condition_column = "Condition", verbose = TRUE )
se |
SummarizedExperiment with imputed assay (output of impute_proteomics) |
assay_name |
Assay name to use. If NULL, uses the last available assay |
comparisons |
Comparisons to perform. If NULL, auto-generates (pairwise or vs control) |
control |
Control condition. If NULL, generates all pairwise comparisons |
logFC_threshold |
LogFC threshold for significance (default: 0) |
alpha |
Adjusted p-value threshold (default: 0.05) |
p_adj |
Use adjusted p-value (default: TRUE) |
eBayes_trend |
Use trend estimation in eBayes (default: TRUE, recommended for proteomics) |
eBayes_robust |
Use robust estimation in eBayes (default: TRUE, recommended for proteomics) |
de_method |
DE method: "limma" (default) or "limpa" (probabilistic, requires imp_method="limpa") |
covariate_column |
Column name(s) in colData for paired/blocked design. Single string (e.g., "Subject") or character vector (e.g., c("Subject", "Batch")). Default: NULL |
bio_replicate_column |
Column name in colData identifying biological replicates (e.g., "Patient", "Subject"). Used with limma::duplicateCorrelation() to account for technical replicates or paired designs via random effect blocking. Default: NULL |
condition_column |
Condition column name (default: "Condition") |
verbose |
Print progress messages (default: TRUE) |
List with:
DEPs_results: Data frame with differential expression results
comparisons: Comparisons performed
assay_name: Assay name used
data(nadia_dia) norm <- normalize_proteomics(nadia_dia, norm_method = "cycloess", verbose = FALSE) imp <- impute_proteomics(norm$se, normalized_assay_name = "cycloess", verbose = FALSE) # All pairwise comparisons de <- de_analysis_proteomics(imp$se, assay_name = "Impseqrob_min", verbose = FALSE) head(de$DEPs_results[, c("Protein.IDs", "Comparison", "logFC", "adj.P.Val")]) # Or every condition against a single control de2 <- de_analysis_proteomics(imp$se, assay_name = "Impseqrob_min", control = "A", verbose = FALSE) unique(de2$DEPs_results$Comparison)data(nadia_dia) norm <- normalize_proteomics(nadia_dia, norm_method = "cycloess", verbose = FALSE) imp <- impute_proteomics(norm$se, normalized_assay_name = "cycloess", verbose = FALSE) # All pairwise comparisons de <- de_analysis_proteomics(imp$se, assay_name = "Impseqrob_min", verbose = FALSE) head(de$DEPs_results[, c("Protein.IDs", "Comparison", "logFC", "adj.P.Val")]) # Or every condition against a single control de2 <- de_analysis_proteomics(imp$se, assay_name = "Impseqrob_min", control = "A", verbose = FALSE) unique(de2$DEPs_results$Comparison)
Joins the differential-abundance results to the soft clustering, giving the table a functional-enrichment or over-representation analysis needs: the statistics that say which proteins moved, and the cluster that says which pattern they follow.
deps_with_clusters( DEPs_results, pattern_profiler, assignment = c("primary", "all"), min_membership = NULL, comparison = NULL, significant_only = FALSE )deps_with_clusters( DEPs_results, pattern_profiler, assignment = c("primary", "all"), min_membership = NULL, comparison = NULL, significant_only = FALSE )
DEPs_results |
Differential-abundance results, the |
pattern_profiler |
Result of |
assignment |
|
min_membership |
Optional extra membership threshold. It can only be
stricter than the one the analysis ran with: pairs below that one were
discarded when |
comparison |
Optional character vector of comparisons to keep. The
default, |
significant_only |
Keep only the rows classified |
The join is a left join from the results, so every protein that was tested survives it, with or without a cluster. That matters more than it looks: the complete set of tested proteins is the background an enrichment is computed against, and a protein with no cluster – one that was never selected for the clustering, or that the clustering dropped – belongs in that background rather than in the bin.
Clustering is fuzzy, so a protein can belong to several clusters at once.
assignment decides what to do about it. "primary" keeps only the
dominant pattern of each protein and returns exactly one row per protein and
comparison, which is what most enrichment tools expect. "all" keeps every
association above the threshold, which is the honest representation of a soft
clustering and the one to use when the analysis downstream can weight by
membership.
A data frame with the columns of DEPs_results followed by
Cluster, Membership and ClusterRank (1 is the protein's dominant
cluster).
nadia_deps_with_clusters() for the same table read from a
.nadia file, and pattern_profiler_analysis() for the clustering.
data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # Without a clustering the shape is the same and the clusters are NA. fi <- deps_with_clusters(res$DEPs_results, NULL) head(fi) if (requireNamespace("Mfuzz", quietly = TRUE) && requireNamespace("Biobase", quietly = TRUE) && requireNamespace("e1071", quietly = TRUE)) { pp <- pattern_profiler_analysis(res$se_proc, res$DEPs_results, assay_name = "Impseqrob_min", verbose = FALSE) primary <- deps_with_clusters(res$DEPs_results, pp) nrow(primary) == nrow(res$DEPs_results) # the background is intact soft <- deps_with_clusters(res$DEPs_results, pp, assignment = "all") table(soft$ClusterRank) }data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # Without a clustering the shape is the same and the clusters are NA. fi <- deps_with_clusters(res$DEPs_results, NULL) head(fi) if (requireNamespace("Mfuzz", quietly = TRUE) && requireNamespace("Biobase", quietly = TRUE) && requireNamespace("e1071", quietly = TRUE)) { pp <- pattern_profiler_analysis(res$se_proc, res$DEPs_results, assay_name = "Impseqrob_min", verbose = FALSE) primary <- deps_with_clusters(res$DEPs_results, pp) nrow(primary) == nrow(res$DEPs_results) # the background is intact soft <- deps_with_clusters(res$DEPs_results, pp, assignment = "all") table(soft$ClusterRank) }
Detect the condition columns (z-scores)
detect_condition_columns(data)detect_condition_columns(data)
data |
Pattern Profiler DataFrame |
Vector with the names of the condition columns
Evaluate a range of cluster numbers
evaluate_cluster_range( eset_std, c_range = 2:10, m = NULL, seeds = c(42, 123, 456), verbose = TRUE )evaluate_cluster_range( eset_std, c_range = 2:10, m = NULL, seeds = c(42, 123, 456), verbose = TRUE )
eset_std |
Standardised ExpressionSet |
c_range |
Vector of cluster numbers to evaluate |
m |
Fuzziness parameter |
seeds |
Seeds for reproducibility |
verbose |
Show progress |
DataFrame with the metrics per number of clusters
Retrieves the intensity matrix, the feature IDs and the sample metadata from a SummarizedExperiment object.
extract_se_data(se_proc, assay_name = NULL, verbose = TRUE)extract_se_data(se_proc, assay_name = NULL, verbose = TRUE)
se_proc |
SummarizedExperiment object |
assay_name |
Name of the assay to use (NULL = first available) |
verbose |
Print progress messages (default: TRUE) |
List with:
intensity_matrix: features x samples matrix
feature_ids: vector of protein IDs
sample_metadata: DataFrame with SampleID, Condition, etc.
Filter features by significance
filter_significant_features( feature_info, filter_mode = c("any", "all", "specific"), comparison = NULL, alpha = 0.05, verbose = TRUE )filter_significant_features( feature_info, filter_mode = c("any", "all", "specific"), comparison = NULL, alpha = 0.05, verbose = TRUE )
feature_info |
DataFrame with significance columns |
filter_mode |
Selection mode:
|
comparison |
Specific comparison (for mode="specific") |
alpha |
Significance threshold |
verbose |
Print progress messages (default: TRUE) |
Vector of the selected FeatureIDs
Build the Colour Palette for Categorical Annotations
get_annotation_palette(levels, palette = NULL)get_annotation_palette(levels, palette = NULL)
levels |
Vector of levels (categories) |
palette |
Palette specification (same format as get_heatmap_palette) |
Named vector of colours
Build the Colour Palette for the Heatmap Values
get_heatmap_palette(palette = NULL, n = 11, reverse = FALSE)get_heatmap_palette(palette = NULL, n = 11, reverse = FALSE)
palette |
Palette specification:
|
n |
Number of colours to generate |
reverse |
Reverse the palette (default: FALSE) |
Vector of colours, or a colorRamp2 function
Extracts complete-case rows from the assay, introduces artificial NAs, re-imputes with each method, and computes four quality metrics plus a combined ranking.
im_compute_metrics( se, assay_name = NULL, methods = .IM_BENCH_METHODS, combo_methods = list(), condition_col = "Condition", na_prop = 0.2, seed = 42L, pattern = "random", method_args = list(), with_value = NA_real_, verbose = TRUE )im_compute_metrics( se, assay_name = NULL, methods = .IM_BENCH_METHODS, combo_methods = list(), condition_col = "Condition", na_prop = 0.2, seed = 42L, pattern = "random", method_args = list(), with_value = NA_real_, verbose = TRUE )
se |
SummarizedExperiment (from |
assay_name |
Character. Name of the assay to use as starting point (typically the normalized assay, pre-imputation, with real NAs). |
methods |
Character vector of individual imputation methods to benchmark.
Default: |
combo_methods |
Named list of combo/softHybrid configurations. Each
element is a list with: |
condition_col |
Character. Column in colData with condition labels,
required for combo methods. Default |
na_prop |
Numeric (0-1). Proportion of artificial NAs. Default 0.20.
Only used when |
seed |
Integer. Random seed. Default 42. |
pattern |
Character. NA introduction pattern: |
method_args |
Named list of per-method argument lists. |
with_value |
Constant value for method |
verbose |
Logical. Print progress. Default TRUE. |
data.frame with columns: Method, NRMSE, SOR, PSS, ACC_OI, NRMSE_Rank, SOR_Rank, PSS_Rank, ACC_OI_Rank, Rank_Mean. Ordered by Rank_Mean (best first).
data(nadia_dia) se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) # Ground-truth simulation: complete rows are masked and re-imputed, so the # error of each method can be measured against the values it did not see metrics <- im_compute_metrics(se, methods = c("min", "zero", "knn"), verbose = FALSE) metrics[, c("Method", "NRMSE", "SOR", "Rank_Mean")]data(nadia_dia) se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) # Ground-truth simulation: complete rows are masked and re-imputed, so the # error of each method can be measured against the values it did not see metrics <- im_compute_metrics(se, methods = c("min", "zero", "knn"), verbose = FALSE) metrics[, c("Method", "NRMSE", "SOR", "Rank_Mean")]
Bar chart of Average Correlation Coefficient (ACC_OI), ordered descending (higher is better).
im_plot_acc_oi(metrics_df, ...)im_plot_acc_oi(metrics_df, ...)
metrics_df |
data.frame from |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) metrics <- im_compute_metrics(se, methods = c("min", "zero", "knn"), verbose = FALSE) im_plot_acc_oi(metrics)data(nadia_dia) se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) metrics <- im_compute_metrics(se, methods = c("min", "zero", "knn"), verbose = FALSE) im_plot_acc_oi(metrics)
Similar to nm_plot_metrics(): one facet per metric with free y-scales,
labeled values on bars.
im_plot_metrics(metrics_df, ...)im_plot_metrics(metrics_df, ...)
metrics_df |
data.frame from |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) metrics <- im_compute_metrics(se, methods = c("min", "zero", "knn"), verbose = FALSE) im_plot_metrics(metrics)data(nadia_dia) se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) metrics <- im_compute_metrics(se, methods = c("min", "zero", "knn"), verbose = FALSE) im_plot_metrics(metrics)
Bar chart of NRMSE values, ordered ascending (lower is better).
im_plot_nrmse(metrics_df, ...)im_plot_nrmse(metrics_df, ...)
metrics_df |
data.frame from |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) metrics <- im_compute_metrics(se, methods = c("min", "zero", "knn"), verbose = FALSE) im_plot_nrmse(metrics)data(nadia_dia) se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) metrics <- im_compute_metrics(se, methods = c("min", "zero", "knn"), verbose = FALSE) im_plot_nrmse(metrics)
Bar chart of Procrustes Statistical Shape (PSS), ordered ascending (lower is better). Requires vegan; NA values shown as 0-height bars.
im_plot_pss(metrics_df, ...)im_plot_pss(metrics_df, ...)
metrics_df |
data.frame from |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) metrics <- im_compute_metrics(se, methods = c("min", "zero", "knn"), verbose = FALSE) im_plot_pss(metrics)data(nadia_dia) se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) metrics <- im_compute_metrics(se, methods = c("min", "zero", "knn"), verbose = FALSE) im_plot_pss(metrics)
Heatmap (geom_tile + geom_text) showing per-metric ranks and the combined Rank_Mean. Rows = methods (ordered by Rank_Mean), columns = metrics.
im_plot_ranking(metrics_df, ...)im_plot_ranking(metrics_df, ...)
metrics_df |
data.frame from |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) metrics <- im_compute_metrics(se, methods = c("min", "zero", "knn"), verbose = FALSE) im_plot_ranking(metrics)data(nadia_dia) se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) metrics <- im_compute_metrics(se, methods = c("min", "zero", "knn"), verbose = FALSE) im_plot_ranking(metrics)
Bar chart of Sum of Ranks (SOR), ordered ascending (lower is better).
im_plot_sor(metrics_df, ...)im_plot_sor(metrics_df, ...)
metrics_df |
data.frame from |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) metrics <- im_compute_metrics(se, methods = c("min", "zero", "knn"), verbose = FALSE) im_plot_sor(metrics)data(nadia_dia) se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) metrics <- im_compute_metrics(se, methods = c("min", "zero", "knn"), verbose = FALSE) im_plot_sor(metrics)
Convenience function that creates a SE from a proteomics_data object and
applies the winning normalization method (from normalization benchmarking).
The result is ready for imputation_metrics().
im_prepare_se( preprocessing, norm_method = NULL, pc1_rank = NULL, min_reps = NULL, min_groups = 1, covariate_df = NULL, norm_method_args = list(), include_log2 = TRUE, verbose = TRUE )im_prepare_se( preprocessing, norm_method = NULL, pc1_rank = NULL, min_reps = NULL, min_groups = 1, covariate_df = NULL, norm_method_args = list(), include_log2 = TRUE, verbose = TRUE )
preprocessing |
A |
norm_method |
Character scalar. Normalization method name (e.g.
|
pc1_rank |
data.frame from |
min_reps |
Minimum replicates with non-NA values per group for protein
filtering. If NULL, auto-computed as half the smallest group. Default |
min_groups |
Minimum groups meeting |
covariate_df |
Optional covariate data.frame for paired designs
(must contain a |
norm_method_args |
Named list of per-method arguments for normalization.
Default |
include_log2 |
Logical. Include the baseline |
verbose |
Logical. Print progress messages. Default |
Internally calls nm_prepare_se() to build the baseline SE with assay
"log2", then applies the chosen normalization via
.nm_dispatch_normalization().
SummarizedExperiment with assays "log2" (optional) + winner method.
data(nadia_dia) # Option A: name the normalization to benchmark imputation on se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) SummarizedExperiment::assayNames(se) # Option B: let the winner of normalization_metrics() decide. That function # takes a SummarizedExperiment, so the baseline is built first. se_base <- nm_prepare_se(nadia_dia, verbose = FALSE) nm <- normalization_metrics(se_base, methods = c("cycloess", "quantile", "MAD"), plots = "pc1_ranking", verbose = FALSE) nm$pc1_rank se2 <- im_prepare_se(nadia_dia, pc1_rank = nm$pc1_rank, verbose = FALSE) SummarizedExperiment::assayNames(se2)data(nadia_dia) # Option A: name the normalization to benchmark imputation on se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) SummarizedExperiment::assayNames(se) # Option B: let the winner of normalization_metrics() decide. That function # takes a SummarizedExperiment, so the baseline is built first. se_base <- nm_prepare_se(nadia_dia, verbose = FALSE) nm <- normalization_metrics(se_base, methods = c("cycloess", "quantile", "MAD"), plots = "pc1_ranking", verbose = FALSE) nm$pc1_rank se2 <- im_prepare_se(nadia_dia, pc1_rank = nm$pc1_rank, verbose = FALSE) SummarizedExperiment::assayNames(se2)
Reads benchmark_metrics.tsv files from subdirectories,
adding an Assay column derived from the folder name.
import_benchmark_metrics( results_dir, pattern = "benchmark_metrics\\.tsv$", method_names = NULL, recursive = TRUE )import_benchmark_metrics( results_dir, pattern = "benchmark_metrics\\.tsv$", method_names = NULL, recursive = TRUE )
results_dir |
Parent directory containing benchmark subfolders |
pattern |
Regex pattern for the metrics filename |
method_names |
Optional character vector of Assay names |
recursive |
Search subdirectories recursively? (default: TRUE) |
data.frame with columns: Assay, Comparison, TP, FP, TN, FN, Sensitivity, Specificity, Precision, NPV, Accuracy, F1, MCC, AUC, Performance
data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) root <- file.path(tempdir(), "nadia_bench") for (nm in c("cycloess", "quantile")) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] benchmarking_proteomics(de, ev, output_dir = file.path(root, nm), verbose = FALSE) } bench_all <- import_benchmark_metrics(root) bench_all[, c("Assay", "Comparison", "Sensitivity", "Specificity", "F1")]data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) root <- file.path(tempdir(), "nadia_bench") for (nm in c("cycloess", "quantile")) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] benchmarking_proteomics(de, ev, output_dir = file.path(root, nm), verbose = FALSE) } bench_all <- import_benchmark_metrics(root) bench_all[, c("Assay", "Comparison", "Sensitivity", "Specificity", "F1")]
Reads benchmark_classified.tsv files from subdirectories,
adding an Assay column derived from the folder name.
import_classified_results( results_dir, pattern = "benchmark_classified\\.tsv$", method_names = NULL, recursive = TRUE )import_classified_results( results_dir, pattern = "benchmark_classified\\.tsv$", method_names = NULL, recursive = TRUE )
results_dir |
Parent directory containing benchmark subfolders |
pattern |
Regex pattern for the classified filename |
method_names |
Optional character vector of Assay names |
recursive |
Search subdirectories recursively? (default: TRUE) |
data.frame with columns from classified_df plus Assay
data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) root <- file.path(tempdir(), "nadia_bench") for (nm in c("cycloess", "quantile")) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] benchmarking_proteomics(de, ev, output_dir = file.path(root, nm), verbose = FALSE) } classified_all <- import_classified_results(root) table(classified_all$Assay, classified_all$classification)data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) root <- file.path(tempdir(), "nadia_bench") for (nm in c("cycloess", "quantile")) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] benchmarking_proteomics(de, ev, output_dir = file.path(root, nm), verbose = FALSE) } classified_all <- import_classified_results(root) table(classified_all$Assay, classified_all$classification)
Reads benchmark_confusion_overall.tsv files from subdirectories,
adding an Assay column derived from the folder name.
import_confusion_results( results_dir, pattern = "benchmark_confusion_overall\\.tsv$", method_names = NULL, recursive = TRUE )import_confusion_results( results_dir, pattern = "benchmark_confusion_overall\\.tsv$", method_names = NULL, recursive = TRUE )
results_dir |
Parent directory containing benchmark subfolders |
pattern |
Regex pattern for the confusion filename |
method_names |
Optional character vector of Assay names |
recursive |
Search subdirectories recursively? (default: TRUE) |
data.frame with columns: Assay, Comparison, N, TP, FP, TN, FN, plus percentage columns
data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) root <- file.path(tempdir(), "nadia_bench") for (nm in c("cycloess", "quantile")) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] benchmarking_proteomics(de, ev, output_dir = file.path(root, nm), verbose = FALSE) } confusion_all <- import_confusion_results(root) confusion_all[, c("Assay", "Comparison", "TP", "FP", "TN", "FN")]data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) root <- file.path(tempdir(), "nadia_bench") for (nm in c("cycloess", "quantile")) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] benchmarking_proteomics(de, ev, output_dir = file.path(root, nm), verbose = FALSE) } confusion_all <- import_confusion_results(root) confusion_all[, c("Assay", "Comparison", "TP", "FP", "TN", "FN")]
Reads all TSV files matching a pattern from a directory, one assay per file.
Each TSV must have column 1 as protein identifier and remaining columns as
sample names matching the sample_col in the metadata file.
import_imp_matrices( tsv_dir, metadata_path, pattern = "matrix_log2_.*\\.tsv$", method_names = NULL, condition_col = "Condition", sample_col = "Column" )import_imp_matrices( tsv_dir, metadata_path, pattern = "matrix_log2_.*\\.tsv$", method_names = NULL, condition_col = "Condition", sample_col = "Column" )
tsv_dir |
Character. Directory containing the TSV files. |
metadata_path |
Character. Path to a TSV or CSV file with at minimum
columns |
pattern |
Character. Regex to filter files in |
method_names |
Character vector. Assay names to assign (in order).
NULL (default) = extracted from file names between |
condition_col |
Character. Column in metadata with condition/group labels. |
sample_col |
Character. Column in metadata with sample names. |
A SummarizedExperiment with one assay per TSV, colData from metadata,
and rowData containing Protein.IDs.
# Round trip: write the imputed matrices out, then read them back in data(nadia_dia) res <- process_proteomics(nadia_dia, export_dir = tempdir(), export_format = "tsv", verbose = FALSE) meta <- file.path(tempdir(), "metadata.tsv") utils::write.table( data.frame(Column = res$se_proc$Column, Condition = res$se_proc$Condition, Replicate = res$se_proc$Replicate), meta, sep = "\t", row.names = FALSE, quote = FALSE) se <- import_imp_matrices(tsv_dir = tempdir(), metadata_path = meta) SummarizedExperiment::assayNames(se)# Round trip: write the imputed matrices out, then read them back in data(nadia_dia) res <- process_proteomics(nadia_dia, export_dir = tempdir(), export_format = "tsv", verbose = FALSE) meta <- file.path(tempdir(), "metadata.tsv") utils::write.table( data.frame(Column = res$se_proc$Column, Condition = res$se_proc$Condition, Replicate = res$se_proc$Replicate), meta, sep = "\t", row.names = FALSE, quote = FALSE) se <- import_imp_matrices(tsv_dir = tempdir(), metadata_path = meta) SummarizedExperiment::assayNames(se)
Reads all TSV files matching a pattern from a directory, one assay per file.
Each TSV must have column 1 named ProteinGroups and remaining columns as
sample names matching the sample_col in the metadata file.
import_norm_matrices( tsv_dir, metadata_path, pattern = "matrix_log2_.*\\.tsv$", method_names = NULL, condition_col = "Condition", sample_col = "Column" )import_norm_matrices( tsv_dir, metadata_path, pattern = "matrix_log2_.*\\.tsv$", method_names = NULL, condition_col = "Condition", sample_col = "Column" )
tsv_dir |
Character. Directory containing the normalized TSV files. |
metadata_path |
Character. Path to a TSV or CSV file with at minimum
columns |
pattern |
Character. Regex to filter files in |
method_names |
Character vector. Assay names to assign (in order).
NULL (default) = extracted from file names between |
condition_col |
Character. Column in metadata with condition/group labels. |
sample_col |
Character. Column in metadata with sample names. |
A SummarizedExperiment with one assay per TSV, colData from metadata,
and rowData containing Protein.IDs.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "MAD"), verbose = FALSE) # Write the normalized assays as TSVs, then read them back into a new SE tsv_dir <- file.path(tempdir(), "nm_matrices") dir.create(tsv_dir, showWarnings = FALSE) for (a in c("cycloess", "MAD")) { m <- SummarizedExperiment::assay(se, a) utils::write.table( data.frame(ProteinGroups = rownames(m), m, check.names = FALSE), file.path(tsv_dir, paste0("matrix_log2_", a, ".tsv")), sep = "\t", row.names = FALSE, quote = FALSE) } meta_path <- file.path(tsv_dir, "metadata.tsv") utils::write.table(as.data.frame(SummarizedExperiment::colData(se)), meta_path, sep = "\t", row.names = FALSE, quote = FALSE) se_nm <- import_norm_matrices(tsv_dir, meta_path) SummarizedExperiment::assayNames(se_nm)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "MAD"), verbose = FALSE) # Write the normalized assays as TSVs, then read them back into a new SE tsv_dir <- file.path(tempdir(), "nm_matrices") dir.create(tsv_dir, showWarnings = FALSE) for (a in c("cycloess", "MAD")) { m <- SummarizedExperiment::assay(se, a) utils::write.table( data.frame(ProteinGroups = rownames(m), m, check.names = FALSE), file.path(tsv_dir, paste0("matrix_log2_", a, ".tsv")), sep = "\t", row.names = FALSE, quote = FALSE) } meta_path <- file.path(tsv_dir, "metadata.tsv") utils::write.table(as.data.frame(SummarizedExperiment::colData(se)), meta_path, sep = "\t", row.names = FALSE, quote = FALSE) se_nm <- import_norm_matrices(tsv_dir, meta_path) SummarizedExperiment::assayNames(se_nm)
Reads benchmark_opdea_metrics.tsv files from subdirectories,
adding an Assay column derived from the folder name.
import_opdea_results( results_dir, pattern = "benchmark_opdea_metrics\\.tsv$", method_names = NULL, recursive = TRUE )import_opdea_results( results_dir, pattern = "benchmark_opdea_metrics\\.tsv$", method_names = NULL, recursive = TRUE )
results_dir |
Parent directory containing benchmark subfolders |
pattern |
Regex pattern for the opdea metrics filename
(default: |
method_names |
Optional character vector of Assay names. If NULL, names are derived from the parent folder of each file. |
recursive |
Logical. Search subdirectories recursively? (default: TRUE) |
data.frame in long format with columns: Assay, Comparison, nMCC, G_mean, pAUC_001, pAUC_005, pAUC_010
data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) root <- file.path(tempdir(), "nadia_bench") for (nm in c("cycloess", "quantile")) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] benchmarking_proteomics(de, ev, output_dir = file.path(root, nm), verbose = FALSE) } opdea_all <- import_opdea_results(root) head(opdea_all)data(nadia_dia) sp <- utils::read.delim(system.file("extdata", "nadia_dia_spikein.tsv.gz", package = "NADIA")) ev <- data.frame(Comparison = rep(c("B-A", "D-A"), each = 2), Species = c("ECOLI", "YEAST"), expected_logFC = c(1, -0.58, 2, -3.3)) root <- file.path(tempdir(), "nadia_bench") for (nm in c("cycloess", "quantile")) { de <- process_proteomics(nadia_dia, norm_method = nm, verbose = FALSE)$DEPs_results de$Species <- sp$PG.OrganismId[match(de$Protein.IDs, sp$PG.ProteinGroups)] benchmarking_proteomics(de, ev, output_dir = file.path(root, nm), verbose = FALSE) } opdea_all <- import_opdea_results(root) head(opdea_all)
Computes NRMSE, SOR, PSS, ACC_OI via ground-truth simulation, then
generates up to 6 diagnostic plots. Each plot is wrapped in tryCatch()
so that a failure in one does not abort all.
imputation_metrics( se, assay_name = NULL, methods = .IM_BENCH_METHODS, combo_methods = list(), condition_col = "Condition", na_prop = 0.2, seed = 42L, pattern = "random", method_args = list(), with_value = NA_real_, plots = "all", verbose = TRUE, output_dir = NULL, export_plots = TRUE, export_tables = TRUE, plot_width = 12, plot_height = 8, plot_dpi = 150 )imputation_metrics( se, assay_name = NULL, methods = .IM_BENCH_METHODS, combo_methods = list(), condition_col = "Condition", na_prop = 0.2, seed = 42L, pattern = "random", method_args = list(), with_value = NA_real_, plots = "all", verbose = TRUE, output_dir = NULL, export_plots = TRUE, export_tables = TRUE, plot_width = 12, plot_height = 8, plot_dpi = 150 )
se |
SummarizedExperiment (from |
assay_name |
Character. Assay name to use as starting point. NULL (default) = first assay. |
methods |
Character vector of individual methods to benchmark.
Default: |
combo_methods |
Named list of combo/softHybrid configurations.
Each element: |
condition_col |
Character. Column in colData for combo methods.
Default |
na_prop |
Numeric (0-1). Proportion of artificial NAs. Default 0.20.
Only used when |
seed |
Integer. Random seed. Default 42. |
pattern |
Character. |
method_args |
Named list of per-method argument lists. |
with_value |
Constant for method |
plots |
Character vector of plot names or |
verbose |
Logical. Print progress. Default TRUE. |
output_dir |
Character. Path to export directory. If |
export_plots |
Logical. Export plots as PNG when |
export_tables |
Logical. Export tables as TSV when |
plot_width |
Numeric. Width in inches for exported plots. Default |
plot_height |
Numeric. Height in inches for exported plots. Default |
plot_dpi |
Numeric. Resolution for exported plots. Default |
Named list of ggplot objects (or NULL for failed plots), plus
metrics_table: a data.frame from im_compute_metrics().
data(nadia_dia) se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) # The default sweeps 16 methods; a handful is enough to illustrate it res <- imputation_metrics(se, methods = c("min", "zero", "knn"), plots = "ranking", verbose = FALSE) res$metrics_table # Two-stage combos can be compared alongside the individual methods res2 <- imputation_metrics(se, methods = c("min", "knn"), combo_methods = list( "Impseq+min" = list(mar_method = "Impseq", mnar_method = "min")), plots = "ranking", verbose = FALSE) res2$metrics_table$Methoddata(nadia_dia) se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) # The default sweeps 16 methods; a handful is enough to illustrate it res <- imputation_metrics(se, methods = c("min", "zero", "knn"), plots = "ranking", verbose = FALSE) res$metrics_table # Two-stage combos can be compared alongside the individual methods res2 <- imputation_metrics(se, methods = c("min", "knn"), combo_methods = list( "Impseq+min" = list(mar_method = "Impseq", mnar_method = "min")), plots = "ranking", verbose = FALSE) res2$metrics_table$Method
Complete imputation pipeline with 20 methods. Four pathways:
impute_proteomics( se, normalized_assay_name = "cycloess", imputed_assay_name = NULL, imp_method = "combo", mar_method = "Impseqrob", mnar_method = "min", prop_na_mnar = 0.51, prop_present_mar = 0.5, min_present_mar = 1, require_n_conditions = 1, max_na_prop = NULL, method_args = list(), with_value = NA_real_, verbose = TRUE )impute_proteomics( se, normalized_assay_name = "cycloess", imputed_assay_name = NULL, imp_method = "combo", mar_method = "Impseqrob", mnar_method = "min", prop_na_mnar = 0.51, prop_present_mar = 0.5, min_present_mar = 1, require_n_conditions = 1, max_na_prop = NULL, method_args = list(), with_value = NA_real_, verbose = TRUE )
se |
SummarizedExperiment with normalized assay |
normalized_assay_name |
Name of the normalized assay to use (default: "cycloess") |
imputed_assay_name |
Name for the imputed assay. If NULL, it is built
from the method: |
imp_method |
Imputation method (default: "combo"). One of:
"combo", "softHybrid", "bpca", "knn", "mice", "missForest", "Impseq",
"Impseqrob", "QRILC", "MLE", "MinDet", "MinProb", "PI", "min", "halfmin",
"zero", "nbavg", "with", "limpa", "none". |
mar_method |
MAR method for combo/softHybrid mode (default: "Impseqrob") |
mnar_method |
MNAR method for combo/softHybrid mode (default: "min") |
prop_na_mnar |
NA proportion threshold for MNAR classification (default: 0.51) |
prop_present_mar |
Present proportion for MAR (default: 0.5) |
min_present_mar |
Minimum present values for MAR (default: 1) |
require_n_conditions |
Number of conditions required with presence (default: 1) |
max_na_prop |
Maximum NA proportion above which a protein is removed
before imputation. |
method_args |
Named list of per-method argument lists (e.g., list(knn = list(k = 10), bpca = list(nPcs = 3))) |
with_value |
Constant value for imp_method="with" (default: NA_real_) |
verbose |
Print progress messages (default: TRUE) |
imp_method = "none": no imputation
imp_method = "combo": two-stage MAR+MNAR with binary classification
imp_method = "softHybrid": sigmoid-weighted MAR+MNAR blend (continuous)
Any other method: apply to all NAs (no MAR/MNAR distinction)
List with:
se: SummarizedExperiment with imputed assay added
x_imputed: Raw imputed matrix (for direct export)
prefilter_summary: Pre-filtering summary
imputation_summary: Imputation statistics
mnar_mask: MNAR mask matrix (combo only, NULL otherwise)
mar_mask: MAR mask matrix (combo only, NULL otherwise)
data(nadia_dia) norm <- normalize_proteomics(nadia_dia, norm_method = "cycloess", verbose = FALSE) # Default: two-stage combo, Impseqrob for MAR and min for MNAR imp <- impute_proteomics(norm$se, normalized_assay_name = "cycloess", verbose = FALSE) SummarizedExperiment::assayNames(imp$se) sum(is.na(SummarizedExperiment::assay(imp$se, "Impseqrob_min"))) # Any single method works too, and per-method options go in method_args imp2 <- impute_proteomics(norm$se, normalized_assay_name = "cycloess", imp_method = "knn", method_args = list(knn = list(k = 15)), verbose = FALSE) SummarizedExperiment::assayNames(imp2$se)data(nadia_dia) norm <- normalize_proteomics(nadia_dia, norm_method = "cycloess", verbose = FALSE) # Default: two-stage combo, Impseqrob for MAR and min for MNAR imp <- impute_proteomics(norm$se, normalized_assay_name = "cycloess", verbose = FALSE) SummarizedExperiment::assayNames(imp$se) sum(is.na(SummarizedExperiment::assay(imp$se, "Impseqrob_min"))) # Any single method works too, and per-method options go in method_args imp2 <- impute_proteomics(norm$se, normalized_assay_name = "cycloess", imp_method = "knn", method_args = list(knn = list(k = 15)), verbose = FALSE) SummarizedExperiment::assayNames(imp2$se)
Converts DEPs_results (long format) into wide format with one adjP_* column per comparison, and computes sig_any.
merge_significance_info( feature_ids, DEPs_results, assay_name, alpha = 0.05, verbose = TRUE )merge_significance_info( feature_ids, DEPs_results, assay_name, alpha = 0.05, verbose = TRUE )
feature_ids |
Vector of feature IDs |
DEPs_results |
DataFrame with columns Protein.IDs, adj.P.Val, Comparison, Assay |
assay_name |
Name of the assay used to filter DEPs_results |
alpha |
Significance threshold (default: 0.05) |
verbose |
Print progress messages (default: TRUE) |
DataFrame with FeatureID, adjP_*, sig_any
.nadia fileThe clustering is an optional extra step, so it is written separately: this adds it to a file that already holds the analysis, and refuses to create one from scratch.
nadia_add_pattern_profiler( file, pattern_profiler, overwrite = FALSE, verbose = TRUE )nadia_add_pattern_profiler( file, pattern_profiler, overwrite = FALSE, verbose = TRUE )
file |
Path to an existing |
pattern_profiler |
Object from |
overwrite |
Replace a clustering already in the file. |
verbose |
Print progress. |
The path, invisibly.
if (requireNamespace("duckdb", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) f <- file.path(tempdir(), "pp.nadia") write_nadia(f, nadia_dia, res, verbose = FALSE) # pp <- pattern_profiler_analysis(res$se_proc, res$DEPs_results) # nadia_add_pattern_profiler(f, pp) unlink(f) }if (requireNamespace("duckdb", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) f <- file.path(tempdir(), "pp.nadia") write_nadia(f, nadia_dia, res, verbose = FALSE) # pp <- pattern_profiler_analysis(res$se_proc, res$DEPs_results) # nadia_add_pattern_profiler(f, pp) unlink(f) }
.nadia fileFor querying the file directly with SQL or dplyr. Most users want
read_nadia() instead; this is the way in when the file is larger than
memory or when a specific query beats loading everything.
nadia_connect(file, read_only = TRUE)nadia_connect(file, read_only = TRUE)
file |
Path to a |
read_only |
Open without write access. |
The caller owns the connection and must close it with
DBI::dbDisconnect(con, shutdown = TRUE).
A DBI connection.
if (requireNamespace("duckdb", quietly = TRUE)) { data(nadia_dia) f <- file.path(tempdir(), "query.nadia") write_nadia(f, nadia_dia, process_proteomics(nadia_dia, verbose = FALSE), verbose = FALSE) con <- nadia_connect(f) DBI::dbGetQuery(con, "SELECT COUNT(*) AS n FROM proteins") DBI::dbDisconnect(con, shutdown = TRUE) unlink(f) }if (requireNamespace("duckdb", quietly = TRUE)) { data(nadia_dia) f <- file.path(tempdir(), "query.nadia") write_nadia(f, nadia_dia, process_proteomics(nadia_dia, verbose = FALSE), verbose = FALSE) con <- nadia_connect(f) DBI::dbGetQuery(con, "SELECT COUNT(*) AS n FROM proteins") DBI::dbDisconnect(con, shutdown = TRUE) unlink(f) }
.nadia fileThe file's own answer to deps_with_clusters(). The join lives in the file
as the view v_deps_pattern_profiler, so this reads a table rather than
building one, and a client that is not R gets the same table from the same
SQL. The filters are the ones deps_with_clusters() applies, and the two
functions return identical results for the same arguments.
nadia_deps_with_clusters( db, assignment = c("primary", "all"), min_membership = NULL, comparison = NULL, significant_only = FALSE )nadia_deps_with_clusters( db, assignment = c("primary", "all"), min_membership = NULL, comparison = NULL, significant_only = FALSE )
db |
A |
assignment |
|
min_membership |
Optional extra membership threshold. It can only be stricter than the one the analysis ran with. |
comparison |
Optional character vector of comparisons to keep. |
significant_only |
Keep only the rows classified |
The table is read on demand rather than by read_nadia(), because it is as
long as the number of proteins times comparisons times clusters and there is
no reason to carry it around unasked.
A data frame with the columns of DEPs_results followed by
Cluster, Membership and ClusterRank, or NULL if the file holds no
differential-abundance results. A file with results but no clustering
returns the same shape with the three cluster columns NA.
deps_with_clusters(), nadia_add_pattern_profiler()
if (requireNamespace("duckdb", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) f <- file.path(tempdir(), "functional.nadia") write_nadia(f, nadia_dia, res, verbose = FALSE) head(nadia_deps_with_clusters(f)) unlink(f) }if (requireNamespace("duckdb", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) f <- file.path(tempdir(), "functional.nadia") write_nadia(f, nadia_dia, res, verbose = FALSE) head(nadia_deps_with_clusters(f)) unlink(f) }
Output of preprocess_spectronaut() on a trimmed Spectronaut report, ready to
feed process_proteomics() and the rest of the pipeline without having to
read the source file again.
data(nadia_dia)data(nadia_dia)
An S3 object of class c("spectronaut_data", "proteomics_data", "list") with three elements:
metadataData frame of 12 rows and 7 columns, one row per
injection: R.FileName, R.Condition, R.Replicate, Coding and the
three identification counts reported by Spectronaut
(R.PrecursorsIdentified, R.StrippedSequencesIdentified,
R.ProteinGroupsIdentified).
protein_idData frame of 2,000 rows by 52 columns holding the identification information of every protein group.
protein_quantData frame of 2,000 rows by 44 columns: eight
annotation columns plus, for each of the 12 samples, the number of
precursors and of stripped sequences used for quantification and the
intensity (PG.Quantity_<condition>_<replicate>).
The data come from a quantitative proteomics experiment acquired on an Orbitrap Exploris at the Proteomics Facility of the Centro Nacional de Biotecnologia (CNB-CSIC) and processed with Spectronaut v20. The original experiment has 16 injections of the same digest split across four conditions (A-D) of four replicates each, and 10,437 protein groups.
So that the package examples run quickly, three conditions (A, B and D) and a
random sample of 2,000 protein groups are kept. Three and not two conditions
are retained because the soft-clustering in pattern_profiler_analysis()
groups profiles across conditions, and with only two points per profile there
is no pattern left to cluster.
The sample is drawn at random, with a fixed seed, rather than picking the best-covered proteins. That matters: 8.1 % of the intensities are missing and 72.2 % of the proteins are complete, closely matching the 7.9 % and 72.1 % of the full experiment. Selecting the most-quantified proteins instead would yield a dataset with no missing values at all, in which every imputation method returns the input unchanged, and in which 87 % of the proteins come out differentially expressed instead of the 31 % of the full data.
The full recipe is in system.file("scripts", "make_extdata.R", package = "NADIA"). The trimmed report this object is derived from is also
distributed as a file, in system.file("extdata", "nadia_dia_report.tsv.gz", package = "NADIA"), so that preprocess_spectronaut() can be run end to
end.
Proteomics Facility, Centro Nacional de Biotecnologia (CNB-CSIC).
data(nadia_dia) nadia_dia # The three conditions and their four replicates table(nadia_dia$metadata$R.Condition) # Proteins and intensity columns dim(nadia_dia$protein_quant) grep("^PG.Quantity_", colnames(nadia_dia$protein_quant), value = TRUE) # Missing values, which is what the package is about. A Spectronaut report is # long, one row per run and protein group, and where a protein was not # quantified the row is simply absent; the pivot to wide format is what turns # those absences into NA. quant <- as.matrix(nadia_dia$protein_quant[ grep("^PG.Quantity_", colnames(nadia_dia$protein_quant))]) round(100 * mean(is.na(quant)), 1)data(nadia_dia) nadia_dia # The three conditions and their four replicates table(nadia_dia$metadata$R.Condition) # Proteins and intensity columns dim(nadia_dia$protein_quant) grep("^PG.Quantity_", colnames(nadia_dia$protein_quant), value = TRUE) # Missing values, which is what the package is about. A Spectronaut report is # long, one row per run and protein group, and where a protein was not # quantified the row is simply absent; the pivot to wide format is what turns # those absences into NA. quant <- as.matrix(nadia_dia$protein_quant[ grep("^PG.Quantity_", colnames(nadia_dia$protein_quant))]) round(100 * mean(is.na(quant)), 1)
.nadia file to ParquetA way out to an open, stable format. DuckDB reads its own files back a long way, but Parquet is the safer bet for something that has to be readable in ten years by software nobody has written yet, and it is what a repository will expect alongside a publication.
nadia_export_parquet(db, dir, views = TRUE, verbose = TRUE)nadia_export_parquet(db, dir, views = TRUE, verbose = TRUE)
db |
A |
dir |
Directory to write to; created if it does not exist. |
views |
Export the reconstructed canonical tables ( |
verbose |
Print progress. |
The paths written, invisibly.
if (requireNamespace("duckdb", quietly = TRUE) && requireNamespace("arrow", quietly = TRUE)) { data(nadia_dia) f <- file.path(tempdir(), "export.nadia") write_nadia(f, nadia_dia, verbose = FALSE) out <- file.path(tempdir(), "nadia_parquet_export") nadia_export_parquet(f, out, verbose = FALSE) list.files(out) unlink(c(f, out), recursive = TRUE) }if (requireNamespace("duckdb", quietly = TRUE) && requireNamespace("arrow", quietly = TRUE)) { data(nadia_dia) f <- file.path(tempdir(), "export.nadia") write_nadia(f, nadia_dia, verbose = FALSE) out <- file.path(tempdir(), "nadia_parquet_export") nadia_export_parquet(f, out, verbose = FALSE) list.files(out) unlink(c(f, out), recursive = TRUE) }
.nadia fileRebuild the Pattern Profiler table from a .nadia file
nadia_pattern_profiler(db)nadia_pattern_profiler(db)
db |
A |
The long_output data frame, ready for
cluster_profile_highchart_list(), or NULL if the file holds no
clustering.
read_nadia(), nadia_add_pattern_profiler()
if (requireNamespace("duckdb", quietly = TRUE)) { data(nadia_dia) f <- file.path(tempdir(), "nopp.nadia") write_nadia(f, nadia_dia, verbose = FALSE) is.null(nadia_pattern_profiler(read_nadia(f))) unlink(f) }if (requireNamespace("duckdb", quietly = TRUE)) { data(nadia_dia) f <- file.path(tempdir(), "nopp.nadia") write_nadia(f, nadia_dia, verbose = FALSE) is.null(nadia_pattern_profiler(read_nadia(f))) unlink(f) }
.nadia fileReturns an object indistinguishable from what the preprocess_*() function
that wrote the file produced – Spectronaut, DIA-NN, TMT or label-free – so
it can be fed straight to process_proteomics() or to the table functions.
nadia_preprocessing(db)nadia_preprocessing(db)
db |
A |
A proteomics_data object with metadata, protein_id and
protein_quant.
if (requireNamespace("duckdb", quietly = TRUE)) { data(nadia_dia) f <- file.path(tempdir(), "pre.nadia") write_nadia(f, nadia_dia, verbose = FALSE) pre <- nadia_preprocessing(read_nadia(f)) identical(pre$protein_id, nadia_dia$protein_id) unlink(f) }if (requireNamespace("duckdb", quietly = TRUE)) { data(nadia_dia) f <- file.path(tempdir(), "pre.nadia") write_nadia(f, nadia_dia, verbose = FALSE) pre <- nadia_preprocessing(read_nadia(f)) identical(pre$protein_id, nadia_dia$protein_id) unlink(f) }
.nadia fileReturns a proteomics_result with everything process_proteomics() returns,
the SummarizedExperiment included, so that every plotting function in the
package works from the file directly:
nadia_result(db)nadia_result(db)
db |
A |
db <- read_nadia("experiment.nadia")
res <- nadia_result(db)
volcano_highchart_list(res$DEPs_results)
pca_highchart_list(res$PCA_Input)
A proteomics_result object, or an error if the file holds only the
preprocessing step.
read_nadia(), nadia_preprocessing()
if (requireNamespace("duckdb", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) f <- file.path(tempdir(), "result.nadia") write_nadia(f, nadia_dia, res, verbose = FALSE) back <- nadia_result(read_nadia(f)) identical(back$DEPs_results, res$DEPs_results) class(volcano_highchart_list(back$DEPs_results)[[1]]) unlink(f) }if (requireNamespace("duckdb", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) f <- file.path(tempdir(), "result.nadia") write_nadia(f, nadia_dia, res, verbose = FALSE) back <- nadia_result(read_nadia(f)) identical(back$DEPs_results, res$DEPs_results) class(volcano_highchart_list(back$DEPs_results)[[1]]) unlink(f) }
Returns the directory holding the agent skill that ships with NADIA. The
skill documents the analysis pipeline for a coding assistant: which function
to call at each stage, how to choose between the normalisation and imputation
methods, what to verify afterwards, and the mistakes the package's defaults
invite. It is plain Markdown, so any assistant can read it, and it follows
the layout Claude expects for a skill: a SKILL.md entry point that points
at the files under reference/ and scripts/.
nadia_skill_path(...)nadia_skill_path(...)
... |
Character path segments below the skill directory, passed on to
|
To use it with Claude Code, copy the directory into the skills folder of a
project (.claude/skills/nadia/) or of the user (~/.claude/skills/nadia/).
The examples below print the command that does it.
A single character string: the absolute path, or "" when the skill
cannot be found, which is what system.file() returns for a missing file.
vignette("NADIA") for the same pipeline written for a person.
# Where the skill lives nadia_skill_path() # Its entry point, and the files it refers to nadia_skill_path("SKILL.md") list.files(nadia_skill_path(), recursive = TRUE) # Install it for Claude Code, for the current user cat(sprintf( "cp -R '%s' ~/.claude/skills/nadia", nadia_skill_path() ))# Where the skill lives nadia_skill_path() # Its entry point, and the files it refers to nadia_skill_path("SKILL.md") list.files(nadia_skill_path(), recursive = TRUE) # Install it for Claude Code, for the current user cat(sprintf( "cp -R '%s' ~/.claude/skills/nadia", nadia_skill_path() ))
.nadia file without loading itList the contents of a .nadia file without loading it
nadia_tables(file)nadia_tables(file)
file |
Path to a |
A data frame with name, type (table or view) and rows.
if (requireNamespace("duckdb", quietly = TRUE)) { data(nadia_dia) f <- file.path(tempdir(), "tables.nadia") write_nadia(f, nadia_dia, verbose = FALSE) nadia_tables(f) unlink(f) }if (requireNamespace("duckdb", quietly = TRUE)) { data(nadia_dia) f <- file.path(tempdir(), "tables.nadia") write_nadia(f, nadia_dia, verbose = FALSE) nadia_tables(f) unlink(f) }
Iterates over assays in a SummarizedExperiment and computes ten metrics that quantify how well the normalization separates sample groups.
nm_compute_metrics( se, assay_names = NULL, condition_col = "Condition", seed = 42L, ... )nm_compute_metrics( se, assay_names = NULL, condition_col = "Condition", seed = 42L, ... )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
seed |
Integer. Seed for the two metrics that use randomness: the Hopkins statistic, which samples random reference points, and the PERMANOVA p-value, which permutes the group labels. Without it neither column is reproducible between runs. The caller's RNG state is restored on exit. Default 42. |
... |
Additional arguments (unused). |
PC1_VarPct: % variance explained by PC1 (higher = more structure).
PC1_F_ratio: ANOVA F-ratio on PC1 scores (higher = better separation).
PERMANOVA_R2: Proportion of variance explained by grouping (requires vegan; NA if not installed).
Silhouette_mean: Mean silhouette width (requires cluster; NA if not installed).
MDS_GOF: Goodness-of-fit of 2D MDS projection. Note: in benchmarking context, lower values tend to indicate better normalization (a good method preserves multi-dimensional biological variability that 2D cannot capture).
MDS_CophCor: Cophenetic correlation between original and MDS distances. Same caveat as MDS_GOF: lower values tend to correlate with better benchmarking performance.
Spectral_Entropy: Normalized Shannon entropy of PCA eigenvalues (0-1). Values near 0 = variance concentrated in few PCs; near 1 = uniform spread.
CumVar_PC2: Cumulative % variance explained by PC1 + PC2 (0-100).
Hopkins: Hopkins statistic for clustering tendency (0-1). Values > 0.5 suggest non-random cluster structure.
Condition_Number: Ratio of largest to smallest PCA eigenvalue (>= 1). High values indicate multicollinearity or numerical instability.
A data.frame with one row per method and columns:
Method, PC1_VarPct, PC1_F_ratio, PERMANOVA_R2, PERMANOVA_pval,
Silhouette_mean, MDS_GOF, MDS_CophCor, Spectral_Entropy,
CumVar_PC2, Hopkins, Condition_Number.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) metrics_df <- nm_compute_metrics(se) metrics_df[, c("Method", "PC1_VarPct", "PC1_F_ratio", "Silhouette_mean")]data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) metrics_df <- nm_compute_metrics(se) metrics_df[, c("Method", "PC1_VarPct", "PC1_F_ratio", "Silhouette_mean")]
Displays distribution of protein intensities for each sample, faceted by normalization method.
nm_plot_boxplot(se, assay_names = NULL, condition_col = "Condition", ...)nm_plot_boxplot(se, assay_names = NULL, condition_col = "Condition", ...)
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_boxplot(se)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_boxplot(se)
Pairwise within-group correlations for each method shown as boxplots with error bars. Higher and less variable values indicate better normalization.
nm_plot_correlation( se, assay_names = NULL, condition_col = "Condition", cor_method = "pearson", ... )nm_plot_correlation( se, assay_names = NULL, condition_col = "Condition", cor_method = "pearson", ... )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
cor_method |
Correlation method passed to |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_correlation(se, cor_method = "pearson")data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_correlation(se, cor_method = "pearson")
KDE curves for each sample's intensity distribution, faceted by method.
nm_plot_density(se, assay_names = NULL, condition_col = "Condition", ...)nm_plot_density(se, assay_names = NULL, condition_col = "Condition", ...)
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_density(se)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_density(se)
Produces a horizontal bar chart with normalization methods ordered by
ascending final rank (best at top). Uses the same PRONE-style palette
as other nm_plot_*() functions.
nm_plot_final_ranking( se, assay_names = NULL, condition_col = "Condition", cor_method = "pearson", ... )nm_plot_final_ranking( se, assay_names = NULL, condition_col = "Condition", cor_method = "pearson", ... )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
cor_method |
Correlation method forwarded to |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_final_ranking(se)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_final_ranking(se)
Classical MDS on Euclidean distances of scaled, complete-case data. Faceted by method, colored by condition.
nm_plot_mds( se, assay_names = NULL, condition_col = "Condition", mds_scales = c("free", "fixed"), ... )nm_plot_mds( se, assay_names = NULL, condition_col = "Condition", mds_scales = c("free", "fixed"), ... )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
mds_scales |
Facet scaling: |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_mds(se)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_mds(se)
Produces a horizontal bar chart with normalization methods ordered by
ascending MDS1 variance percentage (lower = better normalization).
Uses the same PRONE-style palette as other nm_plot_*() functions.
nm_plot_mds1_ranking(se, assay_names = NULL, condition_col = "Condition", ...)nm_plot_mds1_ranking(se, assay_names = NULL, condition_col = "Condition", ...)
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_mds1_ranking(se)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_mds1_ranking(se)
Calls nm_compute_metrics() internally and produces a faceted bar chart
(one facet per metric, free y-scales) with labeled values.
nm_plot_metrics( se, assay_names = NULL, condition_col = "Condition", seed = 42L, ... )nm_plot_metrics( se, assay_names = NULL, condition_col = "Condition", seed = 42L, ... )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
seed |
Integer. Seed for the two metrics that use randomness: the Hopkins statistic, which samples random reference points, and the PERMANOVA p-value, which permutes the group labels. Without it neither column is reproducible between runs. The caller's RNG state is restored on exit. Default 42. |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_metrics(se)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_metrics(se)
Produces a horizontal bar chart with normalization methods ordered by
descending PC1 variance percentage. Uses the same PRONE-style palette
as other nm_plot_*() functions.
nm_plot_pc1_ranking(se, assay_names = NULL, condition_col = "Condition", ...)nm_plot_pc1_ranking(se, assay_names = NULL, condition_col = "Condition", ...)
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_pc1_ranking(se)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_pc1_ranking(se)
PC1 vs PC2 scatter, colored by condition, faceted by method. Percentage of variance explained shown on each axis.
nm_plot_pca( se, assay_names = NULL, condition_col = "Condition", pca_scales = c("free", "fixed"), ... )nm_plot_pca( se, assay_names = NULL, condition_col = "Condition", pca_scales = c("free", "fixed"), ... )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
pca_scales |
Facet scaling: |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_pca(se, pca_scales = "fixed")data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_pca(se, pca_scales = "fixed")
One boxplot per normalization method showing the per-protein CV distribution
(CV averaged across groups for each protein). Lower and less spread values
indicate better within-group consistency.
With diff = TRUE, shows % reduction vs baseline as a bar chart.
nm_plot_pcv( se, assay_names = NULL, condition_col = "Condition", diff = FALSE, baseline = "log2", ... )nm_plot_pcv( se, assay_names = NULL, condition_col = "Condition", diff = FALSE, baseline = "log2", ... )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
diff |
Logical. If TRUE, show % reduction vs |
baseline |
Character. Assay name used as reference for diff mode.
Default |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_pcv(se) # Percent CV reduction relative to the unnormalized log2 baseline nm_plot_pcv(se, diff = TRUE, baseline = "log2")data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_pcv(se) # Percent CV reduction relative to the unnormalized log2 baseline nm_plot_pcv(se, diff = TRUE, baseline = "log2")
One boxplot per normalization method showing the per-protein variance
distribution (variance averaged across groups for each protein).
Lower values indicate better within-group consistency.
With diff = TRUE, shows % reduction vs baseline as a bar chart.
nm_plot_pev( se, assay_names = NULL, condition_col = "Condition", diff = FALSE, baseline = "log2", ... )nm_plot_pev( se, assay_names = NULL, condition_col = "Condition", diff = FALSE, baseline = "log2", ... )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
diff |
Logical. If TRUE, show % reduction vs |
baseline |
Character. Assay name used as reference for diff mode.
Default |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_pev(se)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_pev(se)
One boxplot per normalization method showing the per-protein MAD distribution
(MAD averaged across groups for each protein). Lower values indicate better
within-group consistency.
With diff = TRUE, shows % reduction vs baseline as a bar chart.
nm_plot_pmad( se, assay_names = NULL, condition_col = "Condition", diff = FALSE, baseline = "log2", ... )nm_plot_pmad( se, assay_names = NULL, condition_col = "Condition", diff = FALSE, baseline = "log2", ... )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
diff |
Logical. If TRUE, show % reduction vs |
baseline |
Character. Assay name used as reference for diff mode.
Default |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_pmad(se)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_pmad(se)
Quantile-quantile plot against a normal distribution for a single sample, one facet per normalization method. Default uses the first column (as NormalyzerDE does).
nm_plot_qq( se, assay_names = NULL, condition_col = "Condition", which_sample = NULL, ... )nm_plot_qq( se, assay_names = NULL, condition_col = "Condition", which_sample = NULL, ... )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
which_sample |
Character. Name of the sample to inspect.
Default = first column of |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_qq(se, which_sample = "A_1")data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_qq(se, which_sample = "A_1")
Plots log2-intensity of one sample against another, one point per protein, for each normalization method. A linear fit and the adjusted R^2 are overlaid. Default comparison uses the first two columns of the SE (as NormalyzerDE does).
nm_plot_scatter( se, assay_names = NULL, condition_col = "Condition", sample1 = NULL, sample2 = NULL, ... )nm_plot_scatter( se, assay_names = NULL, condition_col = "Condition", sample1 = NULL, sample2 = NULL, ... )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
sample1 |
Character. Name of the first sample (x-axis).
Default = first column of |
sample2 |
Character. Name of the second sample (y-axis).
Default = second column of |
... |
Additional arguments (unused). |
ggplot object.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_scatter(se, sample1 = "A_1", sample2 = "A_2")data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_plot_scatter(se, sample1 = "A_1", sample2 = "A_2")
Convenience wrapper that extracts metadata and protein data from a
proteomics_data object (from any of the preprocess_*() functions),
performs zero-to-NA conversion, protein filtering,
and returns a SE with assays "raw" and "log2" – ready for
nm_run_normalizations() or normalization_metrics(..., methods = "all").
nm_prepare_se( preprocessing, min_reps = NULL, min_groups = 1, covariate_df = NULL, verbose = TRUE )nm_prepare_se( preprocessing, min_reps = NULL, min_groups = 1, covariate_df = NULL, verbose = TRUE )
preprocessing |
A |
min_reps |
Minimum replicates with non-NA values per group for protein
filtering. If NULL, auto-computed as half the smallest group. Default |
min_groups |
Minimum groups meeting |
covariate_df |
Optional covariate data.frame for paired designs
(must contain a |
verbose |
Logical. Print progress messages. Default |
Internally calls normalize_proteomics() with norm_method = "log2"
(no additional normalization).
SummarizedExperiment with assays "raw" and "log2".
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) dim(se) SummarizedExperiment::assayNames(se)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) dim(se) SummarizedExperiment::assayNames(se)
Rank normalization methods by median intragroup correlation (descending – higher is better)
nm_rank_cor( se, assay_names = NULL, condition_col = "Condition", cor_method = "pearson", verbose = TRUE )nm_rank_cor( se, assay_names = NULL, condition_col = "Condition", cor_method = "pearson", verbose = TRUE )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
cor_method |
Correlation method: "pearson", "spearman", or "kendall". |
verbose |
Logical. Print progress messages. Default |
A data.frame with columns Method, Median_Cor, Rank.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_rank_cor(se, cor_method = "pearson", verbose = FALSE)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_rank_cor(se, cor_method = "pearson", verbose = FALSE)
For each method, the final rank is the mean of five individual ranks:
four intragroup-precision metrics (pcv, pmad, pev, cor) plus a
group-separation metric (Rank_Sep, the ANOVA F-ratio on PC1 scores,
higher = better separation). Lower final rank = better overall
normalization quality.
nm_rank_final( se, assay_names = NULL, condition_col = "Condition", cor_method = "pearson", verbose = TRUE )nm_rank_final( se, assay_names = NULL, condition_col = "Condition", cor_method = "pearson", verbose = TRUE )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
cor_method |
Correlation method forwarded to |
verbose |
Logical. Print progress messages. Default |
Note: earlier versions averaged Rank_PC1 (PC1 variance %, higher = better)
and Rank_MDS1 (MDS1 variance %, lower = better). Both capture the same
dominant axis of variation but with opposite directions, so they partially
cancelled within the mean. They are replaced here by a single, unambiguous
group-separation rank based on the PC1 F-ratio. The standalone
nm_rank_pc1() / nm_rank_mds1() functions are unchanged for individual
inspection.
A data.frame with columns: Method, Rank_PCV, Rank_PMAD,
Rank_PEV, Rank_Cor, Rank_Sep, Rank_Final, ordered by Rank_Final
ascending (best first).
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_rank_final(se, verbose = FALSE)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_rank_final(se, verbose = FALSE)
For each assay in se, computes the percentage of variance captured by the
first MDS dimension (using only positive eigenvalues from classical MDS) and
returns a ranking ordered by ascending MDS1 variance (lower = better).
nm_rank_mds1( se, assay_names = NULL, condition_col = "Condition", verbose = TRUE )nm_rank_mds1( se, assay_names = NULL, condition_col = "Condition", verbose = TRUE )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
verbose |
Logical. Print progress messages. Default |
A data.frame with columns Method, MDS1_VarPct, Rank,
ordered by MDS1_VarPct ascending (lower = better; rank 1 = best).
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_rank_mds1(se, verbose = FALSE)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_rank_mds1(se, verbose = FALSE)
Computes the percentage of total variance captured by PC1 for each assay in a SummarizedExperiment and returns a data.frame sorted in descending order. Higher PC1 variance generally indicates stronger group separation.
nm_rank_pc1( se, assay_names = NULL, condition_col = "Condition", verbose = TRUE )nm_rank_pc1( se, assay_names = NULL, condition_col = "Condition", verbose = TRUE )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
verbose |
Logical. Print progress messages. Default |
A data.frame with columns Method, PC1_VarPct, Rank,
ordered by PC1_VarPct descending.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_rank_pc1(se, verbose = FALSE)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_rank_pc1(se, verbose = FALSE)
Rank normalization methods by median PCV (ascending – lower is better)
nm_rank_pcv( se, assay_names = NULL, condition_col = "Condition", verbose = TRUE )nm_rank_pcv( se, assay_names = NULL, condition_col = "Condition", verbose = TRUE )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
verbose |
Logical. Print progress messages. Default |
A data.frame with columns Method, Median_PCV, Rank.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_rank_pcv(se, verbose = FALSE)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_rank_pcv(se, verbose = FALSE)
Rank normalization methods by median PEV (ascending – lower is better)
nm_rank_pev( se, assay_names = NULL, condition_col = "Condition", verbose = TRUE )nm_rank_pev( se, assay_names = NULL, condition_col = "Condition", verbose = TRUE )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
verbose |
Logical. Print progress messages. Default |
A data.frame with columns Method, Median_PEV, Rank.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_rank_pev(se, verbose = FALSE)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_rank_pev(se, verbose = FALSE)
Rank normalization methods by median PMAD (ascending – lower is better)
nm_rank_pmad( se, assay_names = NULL, condition_col = "Condition", verbose = TRUE )nm_rank_pmad( se, assay_names = NULL, condition_col = "Condition", verbose = TRUE )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL = all. |
condition_col |
Column in colData with condition labels. |
verbose |
Logical. Print progress messages. Default |
A data.frame with columns Method, Median_PMAD, Rank.
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_rank_pmad(se, verbose = FALSE)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) nm_rank_pmad(se, verbose = FALSE)
Takes a SummarizedExperiment with a log2-scale assay and applies each requested normalization method, returning a new SE with one assay per method.
nm_run_normalizations( se, assay_name = "log2", methods = "all", method_args = list(), include_baseline = TRUE, verbose = TRUE )nm_run_normalizations( se, assay_name = "log2", methods = "all", method_args = list(), include_baseline = TRUE, verbose = TRUE )
se |
SummarizedExperiment with at least one log2-scale assay. |
assay_name |
Name of the baseline assay to normalize from.
Default |
methods |
Character vector of method names, or |
method_args |
Named list of per-method arguments. E.g.
|
include_baseline |
Logical. Include the baseline assay in the output SE.
Default |
verbose |
Logical. Print progress messages. Default |
SummarizedExperiment with one assay per successfully normalized method
(plus baseline if include_baseline = TRUE).
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se_bench <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) SummarizedExperiment::assayNames(se_bench)data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) se_bench <- nm_run_normalizations(se, methods = c("cycloess", "quantile", "MAD"), verbose = FALSE) SummarizedExperiment::assayNames(se_bench)
Calls all (or selected) nm_plot_*() functions on a SummarizedExperiment
produced by import_norm_matrices(). Each plot is wrapped in tryCatch()
so that a failure in one plot does not abort the entire run.
normalization_metrics( se, assay_names = NULL, condition_col = "Condition", plots = "all", cor_method = "pearson", pca_scales = c("free", "fixed", "both"), mds_scales = c("free", "fixed", "both"), methods = NULL, method_args = list(), base_assay = "log2", seed = 42L, verbose = TRUE, output_dir = NULL, export_plots = TRUE, export_tables = TRUE, plot_width = 12, plot_height = 8, plot_dpi = 150 )normalization_metrics( se, assay_names = NULL, condition_col = "Condition", plots = "all", cor_method = "pearson", pca_scales = c("free", "fixed", "both"), mds_scales = c("free", "fixed", "both"), methods = NULL, method_args = list(), base_assay = "log2", seed = 42L, verbose = TRUE, output_dir = NULL, export_plots = TRUE, export_tables = TRUE, plot_width = 12, plot_height = 8, plot_dpi = 150 )
se |
SummarizedExperiment from |
assay_names |
Character vector of assay names to include. NULL (default) = all assays. |
condition_col |
Column name in |
plots |
Character vector of plot names to generate, or |
cor_method |
Correlation method for |
pca_scales |
Facet scaling for PCA plot: |
mds_scales |
Facet scaling for MDS plot: |
methods |
Character vector of normalization method names to
auto-benchmark, |
method_args |
Named list of per-method arguments forwarded to
|
base_assay |
Name of the baseline assay to normalize from when using
auto-normalization. Default |
seed |
Integer. Seed passed to |
verbose |
Logical. Print progress messages. Default |
output_dir |
Character. Path to export directory. If |
export_plots |
Logical. Export plots as PNG when |
export_tables |
Logical. Export tables as TSV when |
plot_width |
Numeric. Width in inches for exported plots. Default |
plot_height |
Numeric. Height in inches for exported plots. Default |
plot_dpi |
Numeric. Resolution for exported plots. Default |
When methods is provided, the function first runs
nm_run_normalizations() to automatically apply the requested normalization
methods from the base_assay, then computes metrics and generates plots on
the resulting multi-assay SE.
Named list of ggplot objects (or NULL for failed plots), plus
data.frames always computed regardless of plots selection:
metrics_table (from nm_compute_metrics()), pc1_rank, mds1_rank,
pcv_rank, pmad_rank, pev_rank, cor_rank, and final_rank
(combined ranking as the mean of the five ranks Rank_PCV, Rank_PMAD,
Rank_PEV, Rank_Cor and Rank_Sep; pc1_rank and mds1_rank are
standalone diagnostics and do not enter it).
data(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) # Auto-benchmark: normalize from the "log2" baseline, then score the methods res <- normalization_metrics(se, methods = c("cycloess", "quantile", "MAD"), plots = c("pcv", "final_ranking"), verbose = FALSE) res$final_rank res$pcvdata(nadia_dia) se <- nm_prepare_se(nadia_dia, verbose = FALSE) # Auto-benchmark: normalize from the "log2" baseline, then score the methods res <- normalization_metrics(se, methods = c("cycloess", "quantile", "MAD"), plots = c("pcv", "final_ranking"), verbose = FALSE) res$final_rank res$pcv
Complete normalization pipeline: zero-to-NA conversion, protein filtering by group presence, SummarizedExperiment creation, and normalization with the selected method. Output is always in log2 scale.
normalize_proteomics( data, metadata = NULL, min_reps = NULL, min_groups = 1, norm_method = "cycloess", cyclic_loess_method = c("fast", "pairs"), cyclic_loess_iterations = 3, cyclic_loess_span = 0.7, verbose = TRUE )normalize_proteomics( data, metadata = NULL, min_reps = NULL, min_groups = 1, norm_method = "cycloess", cyclic_loess_method = c("fast", "pairs"), cyclic_loess_iterations = 3, cyclic_loess_span = 0.7, verbose = TRUE )
data |
Either a |
metadata |
Data frame with Column, Condition, Replicate. Only needed when
|
min_reps |
Minimum replicates for filtering. NULL = auto: floor(min_group_size / 2) |
min_groups |
Minimum groups meeting min_reps (default: 1) |
norm_method |
Normalization method (default: "cycloess"). One of:
|
cyclic_loess_method |
Cyclic Loess method: "fast" or "pairs" (default: "fast") |
cyclic_loess_iterations |
Number of iterations for Cyclic Loess (default: 3) |
cyclic_loess_span |
Span parameter for Cyclic Loess (default: 0.7) |
verbose |
Print progress messages (default: TRUE) |
List with:
se: SummarizedExperiment with assays raw, log2, and <norm_method> (assays raw + log2 only when norm_method = "log2")
filter_summary: Filtering summary
na_overview: NA statistics
data(nadia_dia) # The object returned by preprocess_*() is accepted directly norm <- normalize_proteomics(nadia_dia, norm_method = "cycloess", verbose = FALSE) SummarizedExperiment::assayNames(norm$se) # Zeros become NA and low-coverage proteins are filtered out norm$filter_summary # Any of the 13 methods can be used norm2 <- normalize_proteomics(nadia_dia, norm_method = "quantile", verbose = FALSE) SummarizedExperiment::assayNames(norm2$se)data(nadia_dia) # The object returned by preprocess_*() is accepted directly norm <- normalize_proteomics(nadia_dia, norm_method = "cycloess", verbose = FALSE) SummarizedExperiment::assayNames(norm$se) # Zeros become NA and low-coverage proteins are filtered out norm$filter_summary # Any of the 13 methods can be used norm2 <- normalize_proteomics(nadia_dia, norm_method = "quantile", verbose = FALSE) SummarizedExperiment::assayNames(norm2$se)
Complete clustering pipeline starting from a SummarizedExperiment. Writes a parquet file in LONG format for visualisation.
pattern_profiler_analysis( se_proc, DEPs_results, assay_name = NULL, filter_mode = c("any", "all", "specific"), alpha = 0.05, comparison = NULL, condition_order = NULL, aggregate = c("median", "mean"), c_range = 2:10, auto_select_c = TRUE, c = NULL, selection_method = c("xb", "consensus", "elbow"), min_membership = 0.25, seed = 42, seeds = c(42, 123, 456), output_file = NULL, verbose = TRUE )pattern_profiler_analysis( se_proc, DEPs_results, assay_name = NULL, filter_mode = c("any", "all", "specific"), alpha = 0.05, comparison = NULL, condition_order = NULL, aggregate = c("median", "mean"), c_range = 2:10, auto_select_c = TRUE, c = NULL, selection_method = c("xb", "consensus", "elbow"), min_membership = 0.25, seed = 42, seeds = c(42, 123, 456), output_file = NULL, verbose = TRUE )
se_proc |
SummarizedExperiment with intensity data |
DEPs_results |
DataFrame with differential expression results (must have an 'Assay' column) |
assay_name |
Name of the assay to cluster. It is also the value used to
filter |
filter_mode |
Filtering mode: "any" (significant in at least one
comparison), "all" (ALL features, with no significance filtering),
"specific" (significant in the comparison given by |
alpha |
Significance threshold (default: 0.05) |
comparison |
Specific comparison (for filter_mode="specific") |
condition_order |
Condition order for the profiles |
aggregate |
Aggregation method: "median" or "mean" |
c_range |
Range of cluster numbers to evaluate |
auto_select_c |
Automatic selection of the number of clusters (default: TRUE) |
c |
Fixed number of clusters (if auto_select_c=FALSE) |
selection_method |
Selection method: "xb", "consensus", "elbow" |
min_membership |
Minimum membership threshold for inclusion in the output |
seed |
Integer. Seed for the Mfuzz clustering itself. Fuzzy c-means starts from a random partition, so the cluster labels and the memberships depend on it; fix it to make a run reproducible. The caller's RNG state is restored on exit. Default 42. |
seeds |
Numeric vector of seeds used when |
output_file |
Path of the output parquet file. |
verbose |
Show progress messages |
List (invisible) with the clustering results: optimal_c, m,
conditions, feature counts, selection_metrics, cluster_counts, the
Mfuzz cl object, the standardised eset_std and long_output, the
long-format data.frame that is written when output_file is given.
if (requireNamespace("Mfuzz", quietly = TRUE) && requireNamespace("e1071", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # auto_select_c = TRUE would cluster once per value of c_range pp <- pattern_profiler_analysis( res$se_proc, DEPs_results = res$DEPs_results, assay_name = "Impseqrob_min", filter_mode = "any", condition_order = c("A", "B", "D"), auto_select_c = FALSE, c = 3, verbose = FALSE ) print(pp$cluster_counts) print(head(pp$long_output)) }if (requireNamespace("Mfuzz", quietly = TRUE) && requireNamespace("e1071", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # auto_select_c = TRUE would cluster once per value of c_range pp <- pattern_profiler_analysis( res$se_proc, DEPs_results = res$DEPs_results, assay_name = "Impseqrob_min", filter_mode = "any", condition_order = c("A", "B", "D"), auto_select_c = FALSE, c = 3, verbose = FALSE ) print(pp$cluster_counts) print(head(pp$long_output)) }
Generates PCA scatter plots (PC1 vs PC2) from a SummarizedExperiment assay, coloring points by different covariates. Useful for visually identifying batch effects or confounding.
pca_covariates_plot( se, assay_name = NULL, covariates, na_action = "complete", fill_value = -1, center = TRUE, scale. = TRUE, de_results = NULL, comparison = "any", alpha = 0.05, filter_samples = FALSE, condition_column = "Condition", point_size = 3, verbose = TRUE )pca_covariates_plot( se, assay_name = NULL, covariates, na_action = "complete", fill_value = -1, center = TRUE, scale. = TRUE, de_results = NULL, comparison = "any", alpha = 0.05, filter_samples = FALSE, condition_column = "Condition", point_size = 3, verbose = TRUE )
se |
SummarizedExperiment object. |
assay_name |
Character. Assay to analyze. NULL = second assay (normalized, pre-imputation). |
covariates |
Character vector. Column names in colData(se) to use for coloring (e.g., c("Injection", "Digestion", "Condition")). |
na_action |
Character: "complete" (default) or "fill". |
fill_value |
Numeric. NA replacement when na_action="fill" (default -1). |
center |
Logical. Center before PCA (default TRUE). |
scale. |
Logical. Scale before PCA (default TRUE). |
de_results |
Data.frame with differential expression results (e.g., result$DEPs_results). Must contain columns "Protein.IDs", "adj.P.Val", and "Comparison". When provided, PCA is computed using only significant proteins. Default NULL (all proteins). |
comparison |
Character. Which comparison to filter by. Use "any" (default) to keep proteins significant in any comparison, or specify a comparison name (e.g., "Post_vs_Pre") to filter to that one only. Ignored if de_results is NULL. |
alpha |
Numeric. Significance threshold for adj.P.Val when filtering by de_results (default 0.05). Ignored if de_results is NULL. |
filter_samples |
Logical. If TRUE and a specific comparison is given (not "any"), subset samples to only those belonging to the comparison conditions. Mirrors pca_highchart_list(filter_samples_to_comparison). Default FALSE (use all samples). |
condition_column |
Character. Column name in colData(se) containing condition labels, used when filter_samples=TRUE. Default "Condition". |
point_size |
Numeric. Size of scatter points (default 3). |
verbose |
Logical (default TRUE). |
Categorical covariates use a discrete color scale; numeric covariates use a continuous viridis gradient.
Named list:
ggplot2 facet_wrap with one panel per covariate
Named list of individual ggplot2 objects per covariate
data.frame with PC1/PC2 variance explained
Assay used
Number of proteins used
data(nadia_dia) # nadia_dia has no batch information, so the example builds a plausible one: # two digestion batches crossed with the three conditions. cov <- data.frame(Column = nadia_dia$metadata$Coding, Batch = rep(c("b1", "b2"), length.out = nrow(nadia_dia$metadata)), stringsAsFactors = FALSE) res <- process_proteomics(nadia_dia, covariate_df = cov, verbose = FALSE) # How the samples lay out in PCA space against each covariate p <- pca_covariates_plot(res$se_proc, assay_name = "Impseqrob_min", covariates = c("Condition", "Batch")) names(p)data(nadia_dia) # nadia_dia has no batch information, so the example builds a plausible one: # two digestion batches crossed with the three conditions. cov <- data.frame(Column = nadia_dia$metadata$Coding, Batch = rep(c("b1", "b2"), length.out = nrow(nadia_dia$metadata)), stringsAsFactors = FALSE) res <- process_proteomics(nadia_dia, covariate_df = cov, verbose = FALSE) # How the samples lay out in PCA space against each covariate p <- pca_covariates_plot(res$se_proc, assay_name = "Impseqrob_min", covariates = c("Condition", "Batch")) names(p)
Builds a PCA scatter plot with the option of showing per-group ellipses or convex hulls, similar to factoextra::fviz_pca_ind.
pca_highchart( scores_df, color_by = "Condition", group_order = NULL, palette = NULL, title = NULL, addEllipses = TRUE, ellipse_type = c("convex", "confidence"), ellipse_level = 0.95, ellipse_fill_opacity = 0.12, ellipse_line_width = 1, ellipse_npoints = 100, point_size = 5, show_labels = FALSE, label_size = 10 )pca_highchart( scores_df, color_by = "Condition", group_order = NULL, palette = NULL, title = NULL, addEllipses = TRUE, ellipse_type = c("convex", "confidence"), ellipse_level = 0.95, ellipse_fill_opacity = 0.12, ellipse_line_width = 1, ellipse_npoints = 100, point_size = 5, show_labels = FALSE, label_size = 10 )
scores_df |
Data frame produced by build_pca_scores() with columns: PC1, PC2, PC1_Perc, PC2_Perc, Subset, Condition, Replicate, SampleID |
color_by |
Column used to colour the points (default: "Condition") |
group_order |
Vector with the order of the groups/conditions (optional) |
palette |
Named vector of colours, or NULL for an automatic palette |
title |
Chart title (optional, defaults to Subset) |
addEllipses |
Show ellipses/hulls around the groups (default: TRUE) |
ellipse_type |
Ellipse type: "convex" for a convex hull or "confidence" for a confidence ellipse based on the normal distribution (default: "convex") |
ellipse_level |
Confidence level for ellipse_type = "confidence" (default: 0.95). Typical values: 0.95, 0.90, 0.68 |
ellipse_fill_opacity |
Fill opacity (0-1, default: 0.12) |
ellipse_line_width |
Outline line width (default: 1) |
ellipse_npoints |
Number of points used to draw the confidence ellipse (default: 100). Only applies to ellipse_type = "confidence" |
point_size |
Point radius (default: 5) |
show_labels |
Show the point labels (SampleID) (default: FALSE) |
label_size |
Label font size in px (default: 10) |
A highchart object
# The scores are normally built internally by pca_highchart_list(); # this is the layout the function expects (one row per sample). scores <- data.frame( SampleID = paste(rep(c("A", "B", "D"), each = 4), 1:4, sep = "_"), Condition = rep(c("A", "B", "D"), each = 4), Replicate = rep(1:4, times = 3), PC1 = c(-5.1, -4.6, -5.4, -4.9, 0.4, 0.9, 0.2, 0.7, 4.8, 5.2, 4.5, 5.0), PC2 = c(1.2, 0.7, -0.9, -1.1, 2.4, 1.8, -1.6, -2.2, 0.9, 0.4, -0.8, -1.3), PC1_Perc = 62.4, PC2_Perc = 18.7, Subset = "All proteins", stringsAsFactors = FALSE ) hc <- pca_highchart(scores, group_order = c("A", "B", "D"), ellipse_type = "confidence", show_labels = TRUE) class(hc)# The scores are normally built internally by pca_highchart_list(); # this is the layout the function expects (one row per sample). scores <- data.frame( SampleID = paste(rep(c("A", "B", "D"), each = 4), 1:4, sep = "_"), Condition = rep(c("A", "B", "D"), each = 4), Replicate = rep(1:4, times = 3), PC1 = c(-5.1, -4.6, -5.4, -4.9, 0.4, 0.9, 0.2, 0.7, 4.8, 5.2, 4.5, 5.0), PC2 = c(1.2, 0.7, -0.9, -1.1, 2.4, 1.8, -1.6, -2.2, 0.9, 0.4, -0.8, -1.3), PC1_Perc = 62.4, PC2_Perc = 18.7, Subset = "All proteins", stringsAsFactors = FALSE ) hc <- pca_highchart(scores, group_order = c("A", "B", "D"), ellipse_type = "confidence", show_labels = TRUE) class(hc)
Automatically builds PCA plots for "all", "any" and/or specific comparisons. Similar to factoextra::fviz_pca_ind with ellipse options.
pca_highchart_list( pca_input, modes = c("all", "any"), alpha = 0.05, color_by = "Condition", group_order = NULL, palette = NULL, addEllipses = TRUE, ellipse_type = c("convex", "confidence"), ellipse_level = 0.95, ellipse_fill_opacity = 0.12, ellipse_line_width = 1, ellipse_npoints = 100, point_size = 5, show_labels = FALSE, label_size = 10, center = TRUE, scale. = TRUE, filter_samples_to_comparison = FALSE )pca_highchart_list( pca_input, modes = c("all", "any"), alpha = 0.05, color_by = "Condition", group_order = NULL, palette = NULL, addEllipses = TRUE, ellipse_type = c("convex", "confidence"), ellipse_level = 0.95, ellipse_fill_opacity = 0.12, ellipse_line_width = 1, ellipse_npoints = 100, point_size = 5, show_labels = FALSE, label_size = 10, center = TRUE, scale. = TRUE, filter_samples_to_comparison = FALSE )
pca_input |
Data frame in long format (see build_pca_scores for the structure) |
modes |
Vector of modes to generate: "all", "any", and/or comparison names (default: c("all", "any")) |
alpha |
Significance threshold for DEPs (default: 0.05) |
color_by |
Column used to colour the points (default: "Condition") |
group_order |
Order of the groups/conditions (optional) |
palette |
Named vector of colours, or NULL for an automatic palette |
addEllipses |
Show ellipses/hulls around the groups (default: TRUE) |
ellipse_type |
Ellipse type: "convex" or "confidence" (default: "convex") |
ellipse_level |
Confidence level for ellipse_type = "confidence" (default: 0.95) |
ellipse_fill_opacity |
Ellipse fill opacity (0-1, default: 0.12) |
ellipse_line_width |
Outline line width (default: 1) |
ellipse_npoints |
Number of points for the confidence ellipse (default: 100) |
point_size |
Point radius (default: 5) |
show_labels |
Show the point labels (SampleID) (default: FALSE) |
label_size |
Label font size in px (default: 10) |
center |
Center the data before PCA (default: TRUE) |
scale. |
Scale the data before PCA (default: TRUE) |
filter_samples_to_comparison |
For specific comparisons, restrict the samples to the conditions involved (default: FALSE) |
Named list of highchart objects
data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # One PCA over all proteins and one over the significant ones hc_pcas <- pca_highchart_list( res$PCA_Input, modes = c("all", "any"), group_order = c("A", "B", "D"), ellipse_type = "confidence", ellipse_level = 0.95 ) names(hc_pcas)data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # One PCA over all proteins and one over the significant ones hc_pcas <- pca_highchart_list( res$PCA_Input, modes = c("all", "any"), group_order = c("A", "B", "D"), ellipse_type = "confidence", ellipse_level = 0.95 ) names(hc_pcas)
Prepare Long-Format Data for tidyHeatmap
prepare_heatmap_data( data, mode = c("all", "any", "target"), alpha = 0.05, comparison = NULL, feature_ids = NULL, scale_data = c("row", "none", "column"), sample_order = c("clustering", "condition", "custom"), condition_order = NULL )prepare_heatmap_data( data, mode = c("all", "any", "target"), alpha = 0.05, comparison = NULL, feature_ids = NULL, scale_data = c("row", "none", "column"), sample_order = c("clustering", "condition", "custom"), condition_order = NULL )
data |
Data frame in long format with columns:
|
mode |
Filtering mode: "all", "any", or "target" |
alpha |
Significance threshold for mode "target" (default: 0.05) |
comparison |
Name of the comparison for mode "target" (e.g. "B-A") |
feature_ids |
Vector of specific FeatureIDs (when supplied, mode/alpha are ignored) |
scale_data |
Scaling type: "none", "row", "column" (default: "row") |
sample_order |
Sample order: "clustering", "condition", or a custom vector |
condition_order |
Condition order when sample_order = "condition" |
Data frame in long format, ready for tidyHeatmap
Converts a DIA-NN protein-group matrix (report.pg_matrix.tsv, wide TSV
format) into the same output structure as preprocess_spectronaut(): three
data.frames (metadata, protein_id, protein_quant) ready for the
downstream pipeline (process_proteomics() and the associated modules).
DIA-NN names its intensity columns after the raw file, which says nothing
about the experimental design, so the design has to be declared. There are
two ways: rename the columns to Abundance: <Condition>_<Replicate> as
Proteome Discoverer writes them, or pass a sample sheet through annot_path.
The design is never inferred from the raw-file name – a guess that happened
to be right for one export would be wrong and silent for the next.
A protein-group matrix carries only intensities. The identification metrics
the wide contract expects are filled from what DIA-NN does report
(N.Sequences, N.Proteotypic.Sequences), left as NA where it reports
nothing (the precursor counts), or omitted where nothing downstream needs
them (coverage and the Spectronaut C-score).
preprocess_diann( file_path, condition_order, annot_path = NULL, export_dir = NULL, timestamp_suffix = TRUE, verbose = TRUE )preprocess_diann( file_path, condition_order, annot_path = NULL, export_dir = NULL, timestamp_suffix = TRUE, verbose = TRUE )
file_path |
Path to the |
condition_order |
Character vector with the order of the experimental
conditions (e.g. |
annot_path |
Path to a sample sheet with columns The sheet is a file rather than a vector of labels because a vector would be positional, and nothing guarantees the column order of an export: a re-export that reordered them would relabel every run without any way to notice. Matching by name either matches or fails. |
export_dir |
Directory to export the TSV files to. If |
timestamp_suffix |
Logical. If |
verbose |
Logical. If |
A list with class c("diann_data", "proteomics_data", "list")
containing:
Data frame with one record per run, including the number of protein groups quantified in each
Data frame with the identification metrics per protein (wide format, the global metrics replicated per run)
Data frame with the quantification metrics per
protein (includes PG.Quantity_<Coding>)
The call that produced the object and a fingerprint of the file it was read
from (path, size, modification time and MD5) travel with it as the
attributes nadia_call and nadia_source. They are attributes rather than
list elements so that the three-element structure above is unchanged;
write_nadia() records them as the provenance of an analysis.
# A trimmed DIA-NN protein-group matrix ships with the package. Its run # columns have been renamed to the "Abundance: <Condition>_<Replicate>" # convention, so no further argument is needed. report <- system.file("extdata", "nadia_diann_report.tsv.gz", package = "NADIA") diann <- preprocess_diann(report, condition_order = c("A", "B", "D"), verbose = FALSE) diann table(diann$metadata$R.Condition) # Straight from DIA-NN, where the columns are still raw-file paths, the # design is given instead by a sheet whose 'Column' holds those paths: # preprocess_diann("report.pg_matrix.tsv", # condition_order = c("A", "B", "D"), # annot_path = "design.tsv")# A trimmed DIA-NN protein-group matrix ships with the package. Its run # columns have been renamed to the "Abundance: <Condition>_<Replicate>" # convention, so no further argument is needed. report <- system.file("extdata", "nadia_diann_report.tsv.gz", package = "NADIA") diann <- preprocess_diann(report, condition_order = c("A", "B", "D"), verbose = FALSE) diann table(diann$metadata$R.Condition) # Straight from DIA-NN, where the columns are still raw-file paths, the # design is given instead by a sheet whose 'Column' holds those paths: # preprocess_diann("report.pg_matrix.tsv", # condition_order = c("A", "B", "D"), # annot_path = "design.tsv")
Converts a Proteome Discoverer LFQ protein export (wide TSV format) into the
same output structure as preprocess_spectronaut() / preprocess_tmt():
three data.frames (metadata, protein_id, protein_quant) ready for the
downstream pipeline (process_proteomics()).
The experimental design comes from the Abundance: <Condition>_<Replicate>
column suffixes, exactly as in preprocess_tmt() and preprocess_diann().
For a report whose columns are not named that way, annot_path takes a sample
sheet instead.
The intensities (Abundance: <sample>) and the three per-sample metric
families (Score Mascot, # PSMs (by Search Engine),
# Peptides (by Search Engine)) are mapped BY SAMPLE NAME, never by position:
Proteome Discoverer writes the four families in different orders.
preprocess_lfq( file_path, annot_path = NULL, condition_order = NULL, export_dir = NULL, timestamp_suffix = TRUE, verbose = TRUE )preprocess_lfq( file_path, annot_path = NULL, condition_order = NULL, export_dir = NULL, timestamp_suffix = TRUE, verbose = TRUE )
file_path |
Path to the data TSV exported from Proteome Discoverer. |
annot_path |
Path to a sample sheet with columns |
condition_order |
Character vector with the order of the conditions. If
|
export_dir |
Directory to export the TSVs to. |
timestamp_suffix |
Logical. If |
verbose |
Logical. If |
A list with class c("lfq_data", "proteomics_data", "list")
containing metadata, protein_id and protein_quant.
The call that produced the object and a fingerprint of the files it was read
from – the report, and the sample sheet when there is one – (path, size,
modification time and MD5) travel with it as the attributes nadia_call and
nadia_source. They
are attributes rather than list elements so that the three-element structure
above is unchanged; write_nadia() records them as the provenance of an
analysis.
# A trimmed Proteome Discoverer LFQ report ships with the package. Its columns # follow the "Abundance: <Condition>_<Replicate>" convention, so the design # needs no further argument. report <- system.file("extdata", "nadia_lfq_report.tsv.gz", package = "NADIA") lfq <- preprocess_lfq(report, verbose = FALSE) lfq lfq$metadata[, c("Coding", "R.Condition", "R.Replicate")] # The same design, declared in a sheet instead. Use this route when the # columns are not named by the convention; here it is the same experiment, so # it produces the same sample table. annot <- system.file("extdata", "nadia_lfq_annotation.tsv", package = "NADIA") from_sheet <- preprocess_lfq(report, annot_path = annot, verbose = FALSE) identical(from_sheet$metadata, lfq$metadata)# A trimmed Proteome Discoverer LFQ report ships with the package. Its columns # follow the "Abundance: <Condition>_<Replicate>" convention, so the design # needs no further argument. report <- system.file("extdata", "nadia_lfq_report.tsv.gz", package = "NADIA") lfq <- preprocess_lfq(report, verbose = FALSE) lfq lfq$metadata[, c("Coding", "R.Condition", "R.Replicate")] # The same design, declared in a sheet instead. Use this route when the # columns are not named by the convention; here it is the same experiment, so # it produces the same sample table. annot <- system.file("extdata", "nadia_lfq_annotation.tsv", package = "NADIA") from_sheet <- preprocess_lfq(report, annot_path = annot, verbose = FALSE) identical(from_sheet$metadata, lfq$metadata)
Converts a Spectronaut report (long TSV format) into three structured tables: run metadata, protein identification and protein quantification.
The report has to carry the right columns, and rather than leave that to be reconstructed by hand the package ships the Spectronaut export schema that produces them:
system.file("extdata", "NADIA_Report.rs", package = "NADIA")
Import that file into Spectronaut as a report schema and export with it. The
result has the shape of nadia_dia_report.tsv.gz, the example that ships
alongside it.
preprocess_spectronaut( file_path, condition_order, export_dir = NULL, agg_coverage_run = c("max", "mean", "median", "min"), agg_coverage_global = c("max", "mean", "median", "min"), agg_mw = c("max", "mean", "median", "min"), agg_cscore_runwise = c("mean", "max", "median", "min"), timestamp_suffix = TRUE, verbose = TRUE )preprocess_spectronaut( file_path, condition_order, export_dir = NULL, agg_coverage_run = c("max", "mean", "median", "min"), agg_coverage_global = c("max", "mean", "median", "min"), agg_mw = c("max", "mean", "median", "min"), agg_cscore_runwise = c("mean", "max", "median", "min"), timestamp_suffix = TRUE, verbose = TRUE )
file_path |
Path to the Spectronaut TSV file. |
condition_order |
Character vector that selects the experimental
conditions to retain and sets their order in subsequent analysis stages
(e.g. |
export_dir |
Directory to export the TSV files to. If |
agg_coverage_run |
Aggregation method for the per-sample PG.Coverage. Options: "max" (default), "mean", "median", "min". |
agg_coverage_global |
Aggregation method for PG.Coverage.Global. Options: "max" (default), "mean", "median", "min". |
agg_mw |
Aggregation method for PG.MolecularWeight. Options: "max" (default), "mean", "median", "min". |
agg_cscore_runwise |
Aggregation method for PG.Cscore.RunWise. Options: "mean" (default), "max", "median", "min". |
timestamp_suffix |
Logical. If |
verbose |
Logical. If |
A list with class spectronaut_data containing:
Data frame with the run information (1 row per sample)
Data frame with the identification metrics per protein
Data frame with the quantification metrics per protein
The call that produced the object and a fingerprint of the file it was read
from (path, size, modification time and MD5) travel with it as the
attributes nadia_call and nadia_source. They are attributes rather than
list elements so that the three-element structure above is unchanged;
write_nadia() records them as the provenance of an analysis.
# A trimmed Spectronaut report ships with the package report <- system.file("extdata", "nadia_dia_report.tsv.gz", package = "NADIA") prep <- preprocess_spectronaut(report, condition_order = c("A", "B", "D"), verbose = FALSE) prep dim(prep$protein_quant) # Nothing is written to disk unless export_dir is given prep <- preprocess_spectronaut(report, condition_order = c("A", "B", "D"), export_dir = tempdir(), verbose = FALSE)# A trimmed Spectronaut report ships with the package report <- system.file("extdata", "nadia_dia_report.tsv.gz", package = "NADIA") prep <- preprocess_spectronaut(report, condition_order = c("A", "B", "D"), verbose = FALSE) prep dim(prep$protein_quant) # Nothing is written to disk unless export_dir is given prep <- preprocess_spectronaut(report, condition_order = c("A", "B", "D"), export_dir = tempdir(), verbose = FALSE)
Converts a Proteome Discoverer protein export (wide TSV format, with
Abundance: <Condition>_<Replicate> columns) into the same output structure
as preprocess_spectronaut(): three data.frames (metadata, protein_id,
protein_quant) ready for the downstream pipeline (process_proteomics()
and the associated modules).
The global PD identification metrics (# PSMs, # Peptides,
# Unique Peptides, Coverage [%]) are replicated into per-channel columns
to fit the wide Spectronaut contract.
preprocess_tmt( file_path, condition_order, annot_path = NULL, export_dir = NULL, timestamp_suffix = TRUE, verbose = TRUE )preprocess_tmt( file_path, condition_order, annot_path = NULL, export_dir = NULL, timestamp_suffix = TRUE, verbose = TRUE )
file_path |
Path to the TSV exported from Proteome Discoverer. |
condition_order |
Character vector with the order of the experimental
conditions (e.g. |
annot_path |
Path to a sample sheet with columns |
export_dir |
Directory to export the TSV files to. If |
timestamp_suffix |
Logical. If |
verbose |
Logical. If |
A list with class c("tmt_data", "proteomics_data", "list")
containing:
Data frame with one record per channel/sample
Data frame with the identification metrics per protein (wide format, global metrics replicated per channel)
Data frame with the quantification metrics per
protein (includes PG.Quantity_<Coding>)
The call that produced the object and a fingerprint of the file it was read
from (path, size, modification time and MD5) travel with it as the
attributes nadia_call and nadia_source. They are attributes rather than
list elements so that the three-element structure above is unchanged;
write_nadia() records them as the provenance of an analysis.
# A trimmed Proteome Discoverer TMTpro report ships with the package: three # conditions of eight replicates, split across two TMT mixes (replicates 1-4 # are the first mix, 5-8 the second) and bridged by four "IS" channels. report <- system.file("extdata", "nadia_tmt_report.tsv.gz", package = "NADIA") # condition_order is required, and doubles as a filter: the report also holds # an "IS" channel (internal standards) that is left out by not listing it tmt <- preprocess_tmt(report, condition_order = c("A", "B", "D"), verbose = FALSE) tmt table(tmt$metadata$R.Condition)# A trimmed Proteome Discoverer TMTpro report ships with the package: three # conditions of eight replicates, split across two TMT mixes (replicates 1-4 # are the first mix, 5-8 the second) and bridged by four "IS" channels. report <- system.file("extdata", "nadia_tmt_report.tsv.gz", package = "NADIA") # condition_order is required, and doubles as a filter: the report also holds # an "IS" channel (internal standards) that is left out by not listing it tmt <- preprocess_tmt(report, condition_order = c("A", "B", "D"), verbose = FALSE) tmt table(tmt$metadata$R.Condition)
Reports the number of runs, protein groups and conditions, so that the shape of the experiment can be checked at a glance before processing it.
## S3 method for class 'diann_data' print(x, ...)## S3 method for class 'diann_data' print(x, ...)
x |
A |
... |
Ignored, present for compatibility with the |
x, invisibly. Called for the summary it prints.
diann <- preprocess_diann( system.file("extdata", "nadia_diann_report.tsv.gz", package = "NADIA"), condition_order = c("A", "B", "D"), verbose = FALSE) print(diann)diann <- preprocess_diann( system.file("extdata", "nadia_diann_report.tsv.gz", package = "NADIA"), condition_order = c("A", "B", "D"), verbose = FALSE) print(diann)
Reports the number of samples, protein groups and conditions, so that the shape of the experiment can be checked at a glance before processing it.
## S3 method for class 'lfq_data' print(x, ...)## S3 method for class 'lfq_data' print(x, ...)
x |
An |
... |
Ignored, present for compatibility with the |
x, invisibly. Called for the summary it prints.
lfq <- preprocess_lfq( system.file("extdata", "nadia_lfq_report.tsv.gz", package = "NADIA"), annot_path = system.file("extdata", "nadia_lfq_annotation.tsv", package = "NADIA"), verbose = FALSE) print(lfq)lfq <- preprocess_lfq( system.file("extdata", "nadia_lfq_report.tsv.gz", package = "NADIA"), annot_path = system.file("extdata", "nadia_lfq_annotation.tsv", package = "NADIA"), verbose = FALSE) print(lfq)
.nadia filePrint a summary of a .nadia file
## S3 method for class 'nadia_db' print(x, ...)## S3 method for class 'nadia_db' print(x, ...)
x |
A |
... |
Ignored. |
x, invisibly.
Renders the object built by proteomics_heatmap() on the current graphics
device, adding the title stored in the object. Printing is what actually draws
the heatmap: building it does not.
## S3 method for class 'proteomics_heatmap' print(x, ...)## S3 method for class 'proteomics_heatmap' print(x, ...)
x |
A |
... |
Further arguments passed to |
The drawn HeatmapList, invisibly. Called for its side effect.
if (requireNamespace("ComplexHeatmap", quietly = TRUE) && requireNamespace("tidyHeatmap", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) hm <- proteomics_heatmap(res$PCA_Input, mode = "any") # Drawing needs a graphics device; send it to a temporary file f <- tempfile(fileext = ".png") grDevices::png(f) print(hm) grDevices::dev.off() file.remove(f) }if (requireNamespace("ComplexHeatmap", quietly = TRUE) && requireNamespace("tidyHeatmap", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) hm <- proteomics_heatmap(res$PCA_Input, mode = "any") # Drawing needs a graphics device; send it to a temporary file f <- tempfile(fileext = ".png") grDevices::png(f) print(hm) grDevices::dev.off() file.remove(f) }
Print method for proteomics_result
## S3 method for class 'proteomics_result' print(x, ...)## S3 method for class 'proteomics_result' print(x, ...)
x |
proteomics_result object |
... |
Additional arguments (ignored) |
x, invisibly. Called for the summary it prints: the assays of the
SummarizedExperiment, the comparisons performed, the number of differential
proteins and the parameters used.
data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) print(res)data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) print(res)
Reports the number of runs, protein groups and conditions, so that the shape of the experiment can be checked at a glance before processing it.
## S3 method for class 'spectronaut_data' print(x, ...)## S3 method for class 'spectronaut_data' print(x, ...)
x |
A |
... |
Ignored, present for compatibility with the |
x, invisibly. Called for the summary it prints.
data(nadia_dia) print(nadia_dia)data(nadia_dia) print(nadia_dia)
Reports the number of channels, protein groups and conditions, so that the shape of the experiment can be checked at a glance before processing it.
## S3 method for class 'tmt_data' print(x, ...)## S3 method for class 'tmt_data' print(x, ...)
x |
A |
... |
Ignored, present for compatibility with the |
x, invisibly. Called for the summary it prints.
tmt <- preprocess_tmt( system.file("extdata", "nadia_tmt_report.tsv.gz", package = "NADIA"), condition_order = c("A", "B", "D"), verbose = FALSE) print(tmt)tmt <- preprocess_tmt( system.file("extdata", "nadia_tmt_report.tsv.gz", package = "NADIA"), condition_order = c("A", "B", "D"), verbose = FALSE) print(tmt)
Complete processing pipeline: filtering, normalization, imputation and differential expression analysis. Coordinates sub-modules Normalization.R, Imputation.R, and DEAnalysis.R.
process_proteomics( preprocessing, export_dir = NULL, min_reps_filter = NULL, min_groups_filter = 1, norm_method = "cycloess", cyclic_loess_method = "fast", cyclic_loess_iterations = 3, cyclic_loess_span = 0.7, batch_correct = FALSE, batch_column = "Batch", batch_algorithm = "ComBat", batch_ComBat_mode = 1, batch_covariates = NULL, batch_qualitycontrol = FALSE, imp_method = "combo", mar_method = "Impseqrob", mnar_method = "min", prop_na_mnar = 0.51, prop_present_mar = 0.5, min_present_mar = 1, require_n_conditions = 1, max_na_prop = NULL, method_args = list(), with_value = NA_real_, comparisons = NULL, control = NULL, logFC_threshold = 0, alpha = 0.05, eBayes_trend = NULL, eBayes_robust = NULL, de_method = "limma", covariate_df = NULL, covariate_column = NULL, bio_replicate_column = NULL, export_normalized = TRUE, export_imputed = TRUE, export_format = "tsv", export_volcano = TRUE, export_boxplot = TRUE, export_pca = TRUE, verbose = TRUE )process_proteomics( preprocessing, export_dir = NULL, min_reps_filter = NULL, min_groups_filter = 1, norm_method = "cycloess", cyclic_loess_method = "fast", cyclic_loess_iterations = 3, cyclic_loess_span = 0.7, batch_correct = FALSE, batch_column = "Batch", batch_algorithm = "ComBat", batch_ComBat_mode = 1, batch_covariates = NULL, batch_qualitycontrol = FALSE, imp_method = "combo", mar_method = "Impseqrob", mnar_method = "min", prop_na_mnar = 0.51, prop_present_mar = 0.5, min_present_mar = 1, require_n_conditions = 1, max_na_prop = NULL, method_args = list(), with_value = NA_real_, comparisons = NULL, control = NULL, logFC_threshold = 0, alpha = 0.05, eBayes_trend = NULL, eBayes_robust = NULL, de_method = "limma", covariate_df = NULL, covariate_column = NULL, bio_replicate_column = NULL, export_normalized = TRUE, export_imputed = TRUE, export_format = "tsv", export_volcano = TRUE, export_boxplot = TRUE, export_pca = TRUE, verbose = TRUE )
preprocessing |
A |
export_dir |
Output directory for exported files. Defaults to |
min_reps_filter |
Minimum replicates for filtering. If NULL, auto-computed |
min_groups_filter |
Minimum groups for filtering (default: 1) |
norm_method |
Normalization method passed to normalize_proteomics() (default: "cycloess"). See normalize_proteomics() for all 13 options. |
cyclic_loess_method |
Cyclic Loess method: "fast" or "pairs" (default: "fast") |
cyclic_loess_iterations |
Number of iterations for Cyclic Loess (default: 3) |
cyclic_loess_span |
Span parameter for Cyclic Loess (default: 0.7) |
batch_correct |
Logical. Apply BERT batch correction after normalization (default: FALSE). Requires covariate_df with batch_column. |
batch_column |
Column in covariate_df containing batch assignments (default: "Batch"). Must have >= 2 unique values. |
batch_algorithm |
Batch correction algorithm: "ComBat" (default), "limma", or "ref" |
batch_ComBat_mode |
Integer 1-4 for ComBat parametric/mean-only settings (default: 1) |
batch_covariates |
Character vector of colData column names to protect during BERT batch correction (default: NULL). Categorical columns are encoded as indicator variables automatically; numeric columns are passed through unchanged and therefore act as continuous covariates. |
batch_qualitycontrol |
Logical. Compute ASW quality metrics (default: FALSE) |
imp_method |
Imputation method (default: "combo"). See impute_proteomics() for all options. |
mar_method |
MAR method for combo mode (default: "Impseqrob") |
mnar_method |
MNAR method for combo mode (default: "min") |
prop_na_mnar |
NA proportion for MNAR classification (default: 0.51) |
prop_present_mar |
Present proportion for MAR (default: 0.5) |
min_present_mar |
Minimum present values for MAR (default: 1) |
require_n_conditions |
Required conditions with presence (default: 1) |
max_na_prop |
Maximum NA proportion above which a protein is removed
before imputation. |
method_args |
Named list of per-method argument lists |
with_value |
Constant value for imp_method="with" |
comparisons |
Comparisons for DE. If NULL, generates all pairwise |
control |
Control condition. If NULL, compares all |
logFC_threshold |
LogFC threshold for significance (default: 0) |
alpha |
Adjusted p-value threshold (default: 0.05) |
eBayes_trend |
Use trend estimation in eBayes. If NULL (default), it is resolved from de_method: TRUE for "limma", FALSE for "limpa". |
eBayes_robust |
Use robust estimation in eBayes. If NULL (default), it is resolved from de_method: TRUE for "limma", FALSE for "limpa". |
de_method |
DE method: "limma" (default) or "limpa" (probabilistic, requires imp_method="limpa") |
covariate_df |
Data frame with Column + covariate column(s) for paired/blocked design (default: NULL) |
covariate_column |
Name(s) of the covariate column(s) for the DE model. Single string (e.g., "Subject") or character vector (e.g., c("Subject", "Batch")). Default: NULL |
bio_replicate_column |
Column name in covariate_df identifying biological replicates (e.g., "Patient", "Subject"). Used with limma::duplicateCorrelation() to account for technical replicates or paired designs via random effect blocking. Default: NULL |
export_normalized |
Export normalized matrix (default: TRUE) |
export_imputed |
Export imputed matrix (default: TRUE) |
export_format |
Export format: "tsv", "parquet", or "both" (default: "tsv") |
export_volcano |
Export VolcanoPlot_Input (default: TRUE) |
export_boxplot |
Export BoxPlot_Input (default: TRUE) |
export_pca |
Export PCA_Input (default: TRUE) |
verbose |
Print progress messages (default: TRUE) |
The input is a proteomics_data object, which every preprocessing function
returns with the same three elements, so the pipeline is indifferent to the
acquisition and the search engine the data came from.
List of class proteomics_result with:
se_proc: Processed SummarizedExperiment with all assays
DEPs_results: Data frame with differential expression results
BoxPlot_Input: Long-format data frame with one row per protein,
sample and assay (columns Column, Assay, Intensity, Condition,
Replicate, Protein.IDs). Feed it to boxplot_highchart_list().
PCA_Input: Long-format data frame with the imputed intensities plus
one adjP_* column per comparison and a sig_any flag. Feed it to
pca_highchart_list(), proteomics_heatmap() or
proteomics_heatmap_list().
comparisons: Comparisons performed
parameters: Parameters used
BoxPlot_Input and PCA_Input are always returned, whether or not
export_dir is given: the plotting layer needs them, and requiring a round
trip through disk to obtain them would be gratuitous.
data(nadia_dia) # Normalization, imputation and differential expression in one call res <- process_proteomics(nadia_dia, verbose = FALSE) res SummarizedExperiment::assayNames(res$se_proc) table(res$DEPs_results$Comparison, res$DEPs_results$Change) # The plotting layer is fed straight from the result, no files involved names(res$BoxPlot_Input) names(res$PCA_Input) # Another combination: quantile normalization and a single imputation method res2 <- process_proteomics(nadia_dia, norm_method = "quantile", imp_method = "QRILC", verbose = FALSE) SummarizedExperiment::assayNames(res2$se_proc)data(nadia_dia) # Normalization, imputation and differential expression in one call res <- process_proteomics(nadia_dia, verbose = FALSE) res SummarizedExperiment::assayNames(res$se_proc) table(res$DEPs_results$Comparison, res$DEPs_results$Change) # The plotting layer is fed straight from the result, no files involved names(res$BoxPlot_Input) names(res$PCA_Input) # Another combination: quantile normalization and a single imputation method res2 <- process_proteomics(nadia_dia, norm_method = "quantile", imp_method = "QRILC", verbose = FALSE) SummarizedExperiment::assayNames(res2$se_proc)
Builds a reactable table with 2-level grouped headers, static columns pinned (sticky) to the left and data bars coloured by condition inside each numeric cell. It reproduces the usual Excel layout and improves on it.
protein_list_reactable( data, metadata = NULL, page_size = 15, height = 720, element_id = NULL, selection = NULL, searchable = TRUE )protein_list_reactable( data, metadata = NULL, page_size = 15, height = 720, element_id = NULL, selection = NULL, searchable = TRUE )
data |
Data frame or path to a Protein_ID TSV/CSV/Parquet file (output of any preprocess_*() function -> protein_id). |
metadata |
Optional: metadata data frame (run_summary) with a Coding column that fixes the order of the sample columns. |
page_size |
Rows per page (default 15). |
height |
Table height in px (default 720). |
element_id |
Reactable element ID (default NULL). |
selection |
"single" | "multiple" | NULL. |
searchable |
Enable the search box (default TRUE). |
A reactable object.
data(nadia_dia) # metadata$Coding fixes the order of the sample columns tbl <- protein_list_reactable(nadia_dia$protein_id, metadata = nadia_dia$metadata) class(tbl)data(nadia_dia) # metadata$Coding fixes the order of the sample columns tbl <- protein_list_reactable(nadia_dia$protein_id, metadata = nadia_dia$metadata) class(tbl)
Wraps protein_list_reactable() with:
A search bar and buttons (toggle filters, clear, export to Excel).
Per-condition chips that hide/show the 16 associated columns.
A numeric filter on MW in Da with AND/OR operators.
Excel export with 2-level headers (merged groups + sub-labels) and a per-condition tint, reproducing the manual layout.
protein_list_widget( data, metadata = NULL, page_size = 15, height = 720, element_id = "protein_id_table", selection = NULL, searchable = TRUE )protein_list_widget( data, metadata = NULL, page_size = 15, height = 720, element_id = "protein_id_table", selection = NULL, searchable = TRUE )
data |
Data frame or path to a Protein_ID TSV/CSV/Parquet file (output of any preprocess_*() function -> protein_id). |
metadata |
Optional: metadata data frame (run_summary) with a Coding column that fixes the order of the sample columns. |
page_size |
Rows per page (default 15). |
height |
Table height in px (default 720). |
element_id |
Element ID (default "protein_id_table"). |
selection |
"single" | "multiple" | NULL. |
searchable |
Enable the search box (default TRUE). |
A browsable htmltools object.
if (requireNamespace("jsonlite", quietly = TRUE)) { data(nadia_dia) w <- protein_list_widget(nadia_dia$protein_id, metadata = nadia_dia$metadata) print(class(w)) # print(w) itself opens it in the Viewer / browser }if (requireNamespace("jsonlite", quietly = TRUE)) { data(nadia_dia) w <- protein_list_widget(nadia_dia$protein_id, metadata = nadia_dia$metadata) print(class(w)) # print(w) itself opens it in the Viewer / browser }
Create a tidyHeatmap Heatmap for Proteomics
proteomics_heatmap( data, mode = c("all", "any", "target"), alpha = 0.05, comparison = NULL, feature_ids = NULL, row_annotation = NULL, row_annotation_cols = NULL, row_annotation_palette = NULL, row_annotation_size = NULL, row_annotation_name_size = 8, row_order_by = NULL, split_rows_by = NULL, scale_data = c("row", "none", "column"), sample_order = "clustering", condition_order = NULL, cluster_rows = FALSE, cluster_columns = TRUE, show_row_names = NULL, show_column_names = TRUE, palette_value = NULL, palette_annotation = NULL, reverse_palette = FALSE, row_title = "Proteins", column_title = "Samples", row_title_size = 10, column_title_size = 10, show_row_title = TRUE, show_column_title = TRUE, show_annotation = TRUE, split_by_condition = FALSE, show_adjp_annotation = TRUE, palette_adjp = NULL, row_names_size = 7, column_names_size = 9, column_names_rotation = 45, column_dend_height = NULL, row_dend_width = NULL, show_heatmap_legend = TRUE, show_annotation_legend = TRUE, border_color = NULL, heatmap_title = NULL, heatmap_title_size = 14, heatmap_title_face = c("bold", "plain", "italic", "bold.italic"), export_path = NULL, export_file = NULL, plot_width = 10, plot_height = 8, export_dpi = 300 )proteomics_heatmap( data, mode = c("all", "any", "target"), alpha = 0.05, comparison = NULL, feature_ids = NULL, row_annotation = NULL, row_annotation_cols = NULL, row_annotation_palette = NULL, row_annotation_size = NULL, row_annotation_name_size = 8, row_order_by = NULL, split_rows_by = NULL, scale_data = c("row", "none", "column"), sample_order = "clustering", condition_order = NULL, cluster_rows = FALSE, cluster_columns = TRUE, show_row_names = NULL, show_column_names = TRUE, palette_value = NULL, palette_annotation = NULL, reverse_palette = FALSE, row_title = "Proteins", column_title = "Samples", row_title_size = 10, column_title_size = 10, show_row_title = TRUE, show_column_title = TRUE, show_annotation = TRUE, split_by_condition = FALSE, show_adjp_annotation = TRUE, palette_adjp = NULL, row_names_size = 7, column_names_size = 9, column_names_rotation = 45, column_dend_height = NULL, row_dend_width = NULL, show_heatmap_legend = TRUE, show_annotation_legend = TRUE, border_color = NULL, heatmap_title = NULL, heatmap_title_size = 14, heatmap_title_face = c("bold", "plain", "italic", "bold.italic"), export_path = NULL, export_file = NULL, plot_width = 10, plot_height = 8, export_dpi = 300 )
data |
Data frame in long format (see prepare_heatmap_data for the structure) |
mode |
Protein filtering mode: "all", "any", or "target" |
alpha |
Significance threshold for DEP proteins (default: 0.05) |
comparison |
Name of the comparison for mode "target" (e.g. "B-A") |
feature_ids |
Vector of specific FeatureIDs to show (default: NULL, uses the mode-based filtering). When supplied, only these proteins are shown and the mode/alpha filtering is ignored. |
row_annotation |
Row annotations (FeatureIDs). It can be:
|
row_annotation_cols |
Vector of column names to display as annotations. Default: NULL (uses every column except FeatureID) |
row_annotation_palette |
Named list of palettes, one per annotation. Example: list(Pathway = "brewer:Set1", Function = c("red", "blue", "green")) |
row_annotation_size |
Width of the row annotation bars. It can be:
|
row_annotation_name_size |
Font size of the row annotation names (default: 8) |
row_order_by |
Row order. It can be:
|
split_rows_by |
Name of the annotation column used to split the rows into groups (default: NULL) |
scale_data |
Scaling type: "none", "row", "column" (default: "row") |
sample_order |
Sample order: "clustering", "condition", or a custom vector |
condition_order |
Condition order when sample_order = "condition" |
cluster_rows |
Cluster the rows (default: FALSE) |
cluster_columns |
Cluster the columns (default: TRUE) |
show_row_names |
Show the row names (default: TRUE when <= 50 proteins) |
show_column_names |
Show the column names (default: TRUE) |
palette_value |
Palette for the heatmap values (see get_heatmap_palette) |
palette_annotation |
Palette for the Condition annotation |
reverse_palette |
Reverse the value palette (default: FALSE) |
row_title |
Title for the rows |
column_title |
Title for the columns |
row_title_size |
Font size of the row title (default: 10) |
column_title_size |
Font size of the column title (default: 10) |
show_row_title |
Show the row title (default: TRUE) |
show_column_title |
Show the column title (default: TRUE) |
show_annotation |
Show the Condition annotation (default: TRUE) |
split_by_condition |
Split the heatmap by condition (default: FALSE) |
show_adjp_annotation |
Show the adjP row annotation when mode="target" (default: TRUE) |
palette_adjp |
Palette for the adjP annotation. It can be:
|
row_names_size |
Font size of the row names (default: 7) |
column_names_size |
Font size of the column names (default: 9) |
column_names_rotation |
Rotation of the column names in degrees (default: 45) |
column_dend_height |
Height of the column dendrogram. It can be:
|
row_dend_width |
Width of the row dendrogram. Same format as column_dend_height |
show_heatmap_legend |
Show the heatmap legend (default: TRUE) |
show_annotation_legend |
Show the annotation legends (default: TRUE) |
border_color |
Border colour of the heatmap cells. It can be:
|
heatmap_title |
Main heatmap title (default: NULL, no title) |
heatmap_title_size |
Font size of the main title (default: 14) |
heatmap_title_face |
Font face of the title: "plain", "bold", "italic", "bold.italic" (default: "bold") |
export_path |
Path used to export the heatmap data to TSV (default: NULL, nothing is exported). The file contains FeatureID, the per-sample intensity values, and the metadata (adjP where applicable). |
export_file |
Path used to export the plot. The format is taken from the extension:
|
plot_width |
Plot width in inches (default: 10). To get pixels: pixels = inches x dpi (e.g. 10" x 300dpi = 3000px) |
plot_height |
Plot height in inches (default: 8). To get pixels: pixels = inches x dpi (e.g. 8" x 300dpi = 2400px) |
export_dpi |
Resolution for PNG output in dots per inch (default: 300). Higher dpi = more detail. Common values: 72 (web), 150 (draft), 300 (publication) |
tidyHeatmap/ComplexHeatmap object
if (requireNamespace("ComplexHeatmap", quietly = TRUE) && requireNamespace("tidyHeatmap", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # Proteins significant in the B-A comparison, samples grouped by condition hm <- proteomics_heatmap( res$PCA_Input, mode = "target", comparison = "B-A", scale_data = "row", sample_order = "condition", condition_order = c("A", "B", "D") ) print(class(hm)) # print(hm) itself draws it on the current device }if (requireNamespace("ComplexHeatmap", quietly = TRUE) && requireNamespace("tidyHeatmap", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # Proteins significant in the B-A comparison, samples grouped by condition hm <- proteomics_heatmap( res$PCA_Input, mode = "target", comparison = "B-A", scale_data = "row", sample_order = "condition", condition_order = c("A", "B", "D") ) print(class(hm)) # print(hm) itself draws it on the current device }
Automatically builds heatmaps for "all", "any" and/or specific comparisons.
proteomics_heatmap_list( data, modes = c("all", "any"), alpha = 0.05, feature_ids = NULL, row_annotation = NULL, row_annotation_cols = NULL, row_annotation_palette = NULL, row_annotation_size = NULL, row_annotation_name_size = 8, row_order_by = NULL, split_rows_by = NULL, scale_data = c("row", "none", "column"), sample_order = "clustering", condition_order = NULL, cluster_rows = FALSE, cluster_columns = TRUE, show_row_names = NULL, show_column_names = TRUE, palette_value = NULL, palette_annotation = NULL, reverse_palette = FALSE, row_title_size = 10, column_title_size = 10, show_row_title = TRUE, show_column_title = TRUE, show_annotation = TRUE, split_by_condition = FALSE, show_adjp_annotation = TRUE, palette_adjp = NULL, row_names_size = 7, column_names_size = 9, column_names_rotation = 45, column_dend_height = NULL, row_dend_width = NULL, show_heatmap_legend = TRUE, show_annotation_legend = TRUE, border_color = NULL, heatmap_title = NULL, heatmap_title_size = 14, heatmap_title_face = "bold", export_path = NULL, export_modes = NULL, export_file = NULL, plot_width = 10, plot_height = 8, export_dpi = 300 )proteomics_heatmap_list( data, modes = c("all", "any"), alpha = 0.05, feature_ids = NULL, row_annotation = NULL, row_annotation_cols = NULL, row_annotation_palette = NULL, row_annotation_size = NULL, row_annotation_name_size = 8, row_order_by = NULL, split_rows_by = NULL, scale_data = c("row", "none", "column"), sample_order = "clustering", condition_order = NULL, cluster_rows = FALSE, cluster_columns = TRUE, show_row_names = NULL, show_column_names = TRUE, palette_value = NULL, palette_annotation = NULL, reverse_palette = FALSE, row_title_size = 10, column_title_size = 10, show_row_title = TRUE, show_column_title = TRUE, show_annotation = TRUE, split_by_condition = FALSE, show_adjp_annotation = TRUE, palette_adjp = NULL, row_names_size = 7, column_names_size = 9, column_names_rotation = 45, column_dend_height = NULL, row_dend_width = NULL, show_heatmap_legend = TRUE, show_annotation_legend = TRUE, border_color = NULL, heatmap_title = NULL, heatmap_title_size = 14, heatmap_title_face = "bold", export_path = NULL, export_modes = NULL, export_file = NULL, plot_width = 10, plot_height = 8, export_dpi = 300 )
data |
Data frame in long format (see prepare_heatmap_data for the structure) |
modes |
Vector of modes to generate: "all", "any", and/or comparison names (default: c("all", "any")) |
alpha |
Significance threshold for DEP proteins (default: 0.05) |
feature_ids |
Vector of specific FeatureIDs to show (default: NULL) |
row_annotation |
Row annotations (TSV path or data.frame) |
row_annotation_cols |
Columns to use as row annotations |
row_annotation_palette |
List of palettes for the row annotations |
row_annotation_size |
Width of the row annotation bars (a number in cm, or a unit) |
row_annotation_name_size |
Font size of the row annotation names (default: 8) |
row_order_by |
Row order: "clustering", annotation column(s), or include "adjP" for mode="target" |
split_rows_by |
Annotation column used to split the rows into groups |
scale_data |
Scaling type: "none", "row", "column" (default: "row") |
sample_order |
Sample order: "clustering", "condition", or a custom vector |
condition_order |
Condition order when sample_order = "condition" |
cluster_rows |
Cluster the rows (default: FALSE) |
cluster_columns |
Cluster the columns (default: TRUE) |
show_row_names |
Show the row names (default: auto) |
show_column_names |
Show the column names (default: TRUE) |
palette_value |
Palette for the heatmap values |
palette_annotation |
Palette for the Condition annotation |
reverse_palette |
Reverse the value palette (default: FALSE) |
row_title_size |
Font size of the row title (default: 10) |
column_title_size |
Font size of the column title (default: 10) |
show_row_title |
Show the row title (default: TRUE) |
show_column_title |
Show the column title (default: TRUE) |
show_annotation |
Show the Condition annotation (default: TRUE) |
split_by_condition |
Split the heatmap by condition (default: FALSE) |
show_adjp_annotation |
Show the adjP row annotation for comparisons (default: TRUE) |
palette_adjp |
Palette for the adjP annotation (see proteomics_heatmap) |
row_names_size |
Font size of the row names (default: 7) |
column_names_size |
Font size of the column names (default: 9) |
column_names_rotation |
Rotation of the column names (default: 45) |
column_dend_height |
Height of the column dendrogram (a number in mm, or a unit) |
row_dend_width |
Width of the row dendrogram (a number in mm, or a unit) |
show_heatmap_legend |
Show the heatmap legend (default: TRUE) |
show_annotation_legend |
Show the annotation legends (default: TRUE) |
border_color |
Border colour of the cells (NULL, TRUE, or a colour) |
heatmap_title |
Main heatmap title (default: NULL, no title). "{mode}" can be used as a placeholder, and is replaced by the mode name |
heatmap_title_size |
Font size of the main title (default: 14) |
heatmap_title_face |
Font face of the title (default: "bold") |
export_path |
Base path used to export the data to TSV (default: NULL). The mode name is appended to the file name (e.g. "export_all.tsv", "export_B-A.tsv") |
export_modes |
Vector of modes to export (default: NULL, exports all of them). Only relevant when export_path is set. Example: c("all", "B-A") |
export_file |
Base path used to export the plots. The mode is appended to the name. The format is taken from the extension (.png, .svg, .pdf) |
plot_width |
Plot width in inches (default: 10) |
plot_height |
Plot height in inches (default: 8) |
export_dpi |
Resolution for PNG output in dots per inch (default: 300) |
Named list of tidyHeatmap objects
if (requireNamespace("ComplexHeatmap", quietly = TRUE) && requireNamespace("tidyHeatmap", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # "any" plus one heatmap per named comparison hm_list <- proteomics_heatmap_list( res$PCA_Input, modes = c("any", "B-A"), sample_order = "condition", condition_order = c("A", "B", "D"), palette_value = "brewer:RdYlBu" ) print(names(hm_list)) # print(hm_list[["B-A"]]) draws one of them }if (requireNamespace("ComplexHeatmap", quietly = TRUE) && requireNamespace("tidyHeatmap", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # "any" plus one heatmap per named comparison hm_list <- proteomics_heatmap_list( res$PCA_Input, modes = c("any", "B-A"), sample_order = "condition", condition_order = c("A", "B", "D"), palette_value = "brewer:RdYlBu" ) print(names(hm_list)) # print(hm_list[["B-A"]]) draws one of them }
Runs the full PVCA workflow: compute variance components, generate plot, and optionally export results.
pvca_analysis( se, assay_name = NULL, technical_factors = character(0), biological_factors = character(0), pca_covariates = NULL, pca_threshold = 0.6, variance_threshold = 0.01, na_action = "complete", fill_value = -1, colors = NULL, verbose = TRUE, output_dir = NULL, export_plots = TRUE, export_tables = TRUE, plot_width = 10, plot_height = 6, plot_dpi = 150 )pvca_analysis( se, assay_name = NULL, technical_factors = character(0), biological_factors = character(0), pca_covariates = NULL, pca_threshold = 0.6, variance_threshold = 0.01, na_action = "complete", fill_value = -1, colors = NULL, verbose = TRUE, output_dir = NULL, export_plots = TRUE, export_tables = TRUE, plot_width = 10, plot_height = 6, plot_dpi = 150 )
se |
SummarizedExperiment object. |
assay_name |
Character. Assay to analyze. NULL = second assay (normalized, pre-imputation). |
technical_factors |
Character vector. Factors representing technical variation (e.g., "Injection", "Digestion"). |
biological_factors |
Character vector. Factors representing biological variation (e.g., "Condition", "Gender", "Age"). |
pca_covariates |
Character vector or NULL. If provided, generates PCA plots colored by each covariate (grid + individual plots). These are included in the returned list and exported as PNGs. Default NULL (skip). |
pca_threshold |
Numeric (0-1). Cumulative variance threshold for PCA (default 0.6). |
variance_threshold |
Numeric (0-1). Minimum weight for individual display (default 0.01). |
na_action |
Character: "complete", "fill", or "none" (default "complete"). |
fill_value |
Numeric. NA replacement when na_action = "fill" (default -1). |
colors |
Named character vector for category colors (default NULL = built-in palette). |
verbose |
Logical (default TRUE). |
output_dir |
Character. Directory for exports. NULL = no export. |
export_plots |
Logical (default TRUE). |
export_tables |
Logical (default TRUE). |
plot_width |
Numeric in inches (default 10). |
plot_height |
Numeric in inches (default 6). |
plot_dpi |
Numeric (default 150). |
Named list:
data.frame with label, weights, category
ggplot2 object
Number of proteins used in the analysis
Assay analyzed
List of parameters used
data(nadia_dia) # nadia_dia has no batch information, so the example builds a plausible one: # two digestion batches crossed with the three conditions. cov <- data.frame(Column = nadia_dia$metadata$Coding, Batch = rep(c("b1", "b2"), length.out = nrow(nadia_dia$metadata)), stringsAsFactors = FALSE) res <- process_proteomics(nadia_dia, covariate_df = cov, verbose = FALSE) # Variance decomposition: how much of the signal each factor explains pv <- pvca_analysis(res$se_proc, assay_name = "Impseqrob_min", technical_factors = "Batch", biological_factors = "Condition", verbose = FALSE) pv$pvca_tabledata(nadia_dia) # nadia_dia has no batch information, so the example builds a plausible one: # two digestion batches crossed with the three conditions. cov <- data.frame(Column = nadia_dia$metadata$Coding, Batch = rep(c("b1", "b2"), length.out = nrow(nadia_dia$metadata)), stringsAsFactors = FALSE) res <- process_proteomics(nadia_dia, covariate_df = cov, verbose = FALSE) # Variance decomposition: how much of the signal each factor explains pv <- pvca_analysis(res$se_proc, assay_name = "Impseqrob_min", technical_factors = "Batch", biological_factors = "Condition", verbose = FALSE) pv$pvca_table
Performs Principal Variance Component Analysis on a SummarizedExperiment object. Decomposes total variance into contributions from each specified factor, their pairwise interactions, and residual variance.
pvca_compute( se, assay_name = NULL, factors, pca_threshold = 0.6, variance_threshold = 0.01, na_action = "complete", fill_value = -1, verbose = TRUE )pvca_compute( se, assay_name = NULL, factors, pca_threshold = 0.6, variance_threshold = 0.01, na_action = "complete", fill_value = -1, verbose = TRUE )
se |
SummarizedExperiment object. |
assay_name |
Character. Name of the assay to use. If NULL, uses the second assay (typically the normalized one). |
factors |
Character vector. Column names in colData(se) to include as variance components. All specified factors must exist in colData. |
pca_threshold |
Numeric (0-1). Minimum cumulative proportion of variance explained by retained principal components (default 0.6). |
variance_threshold |
Numeric (0-1). Factors explaining less than this proportion are grouped into a "Below X%" category (default 0.01). |
na_action |
Character. How to handle NAs: "complete" (default) removes rows with any NA, "fill" replaces NAs with fill_value, "none" assumes no NAs (errors if present). |
fill_value |
Numeric. Replacement for NAs when na_action = "fill" (default -1). |
verbose |
Logical. Print progress messages (default TRUE). |
Uses lme4 directly to fit mixed models, which allows automatic detection and exclusion of interaction terms where the number of levels equals or exceeds the number of observations (e.g., Condition:Patient in paired designs with one observation per patient-condition combination).
data.frame with columns:
Factor name, interaction term, "Below X%", or "resid"
Weighted average proportion of variance (0-1)
data(nadia_dia) # nadia_dia has no batch information, so the example builds a plausible one: # two digestion batches crossed with the three conditions. cov <- data.frame(Column = nadia_dia$metadata$Coding, Batch = rep(c("b1", "b2"), length.out = nrow(nadia_dia$metadata)), stringsAsFactors = FALSE) res <- process_proteomics(nadia_dia, covariate_df = cov, verbose = FALSE) # Weight of each factor, and of their interaction, on the total variance vc <- pvca_compute(res$se_proc, assay_name = "Impseqrob_min", factors = c("Condition", "Batch"), verbose = FALSE) vcdata(nadia_dia) # nadia_dia has no batch information, so the example builds a plausible one: # two digestion batches crossed with the three conditions. cov <- data.frame(Column = nadia_dia$metadata$Coding, Batch = rep(c("b1", "b2"), length.out = nrow(nadia_dia$metadata)), stringsAsFactors = FALSE) res <- process_proteomics(nadia_dia, covariate_df = cov, verbose = FALSE) # Weight of each factor, and of their interaction, on the total variance vc <- pvca_compute(res$se_proc, assay_name = "Impseqrob_min", factors = c("Condition", "Batch"), verbose = FALSE) vc
Creates a bar plot showing the weighted average proportion of variance attributed to each factor, colored by category (technical, biological, interaction, residual).
pvca_plot( pvca_res, technical_factors = NULL, biological_factors = NULL, variance_threshold = 0.01, colors = NULL, title = NULL, base_size = 15 )pvca_plot( pvca_res, technical_factors = NULL, biological_factors = NULL, variance_threshold = 0.01, colors = NULL, title = NULL, base_size = 15 )
pvca_res |
data.frame. Output from pvca_compute() with columns 'label' and 'weights'. Optionally pre-categorized with 'category'. |
technical_factors |
Character vector. Factor names classified as technical. Required if pvca_res lacks a 'category' column. |
biological_factors |
Character vector. Factor names classified as biological. Required if pvca_res lacks a 'category' column. |
variance_threshold |
Numeric. Used for categorization if pvca_res lacks 'category' (default 0.01). |
colors |
Named character vector of 4 colors for categories: "residual", "biological", "biol:techn", "technical". If NULL, defaults are used. |
title |
Character. Plot title (default NULL). |
base_size |
Numeric. Base font size for theme_classic (default 15). |
ggplot2 object
data(nadia_dia) # nadia_dia has no batch information, so the example builds a plausible one: # two digestion batches crossed with the three conditions. cov <- data.frame(Column = nadia_dia$metadata$Coding, Batch = rep(c("b1", "b2"), length.out = nrow(nadia_dia$metadata)), stringsAsFactors = FALSE) res <- process_proteomics(nadia_dia, covariate_df = cov, verbose = FALSE) vc <- pvca_compute(res$se_proc, assay_name = "Impseqrob_min", factors = c("Condition", "Batch"), verbose = FALSE) pvca_plot(vc, technical_factors = "Batch", biological_factors = "Condition")data(nadia_dia) # nadia_dia has no batch information, so the example builds a plausible one: # two digestion batches crossed with the three conditions. cov <- data.frame(Column = nadia_dia$metadata$Coding, Batch = rep(c("b1", "b2"), length.out = nrow(nadia_dia$metadata)), stringsAsFactors = FALSE) res <- process_proteomics(nadia_dia, covariate_df = cov, verbose = FALSE) vc <- pvca_compute(res$se_proc, assay_name = "Impseqrob_min", factors = c("Condition", "Batch"), verbose = FALSE) pvca_plot(vc, technical_factors = "Batch", biological_factors = "Condition")
Reactable table that reproduces the layout of the Protein-List_QUANT Excel sheet, with 2-level headers, sticky columns, a blue palette, aggregated filters and Excel export. It appends to Protein_QUANT the 16 columns of the normalized/imputed log2 matrix, matching by Protein Groups.
quant_list_widget( data = NULL, matrix_data = NULL, metadata = NULL, page_size = 15, height = 720, element_id = "quant_id_table", selection = NULL, searchable = TRUE )quant_list_widget( data = NULL, matrix_data = NULL, metadata = NULL, page_size = 15, height = 720, element_id = "quant_id_table", selection = NULL, searchable = TRUE )
data |
Data frame or path to a Protein_QUANT TSV/CSV/Parquet file. Required; there is no default. |
matrix_data |
Data frame or path to a TSV/CSV/Parquet file with the
normalized/imputed log2 matrix (a ProteinGroups column + |
metadata |
Optional: metadata data frame with a Coding column that fixes the sample order. |
page_size |
Rows per page (default 15). |
height |
Table height in px (default 720). |
element_id |
Reactable element ID. |
selection |
"single" | "multiple" | NULL. |
searchable |
Enable the search box (default TRUE). |
A browsable object.
if (requireNamespace("jsonlite", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # The log2 matrix: a ProteinGroups column plus one column per sample mat <- SummarizedExperiment::assay(res$se_proc, "Impseqrob_min") mat_df <- data.frame(ProteinGroups = rownames(mat), mat, check.names = FALSE) w <- quant_list_widget(nadia_dia$protein_quant, matrix_data = mat_df, metadata = nadia_dia$metadata) print(class(w)) }if (requireNamespace("jsonlite", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # The log2 matrix: a ProteinGroups column plus one column per sample mat <- SummarizedExperiment::assay(res$se_proc, "Impseqrob_min") mat_df <- data.frame(ProteinGroups = rownames(mat), mat, check.names = FALSE) w <- quant_list_widget(nadia_dia$protein_quant, matrix_data = mat_df, metadata = nadia_dia$metadata) print(class(w)) }
.nadia fileLoads the whole analysis: the preprocessing tables, the processing results, the intensity matrices, the parameters and the provenance. The canonical tables come out of the SQL views stored in the file, with their R classes and column order restored.
read_nadia(file)read_nadia(file)
file |
Path to a |
To get objects the rest of the package can use directly, pass the result to
nadia_preprocessing() or nadia_result().
An object of class nadia_db: a list with file, meta,
parameters, calls, packages, source_files, the canonical tables
(metadata, protein_id, protein_quant and, when present,
DEPs_results, BoxPlot_Input, PCA_Input, pattern_profiler), the
matrices and the imputed_values mask.
write_nadia(), nadia_result(), nadia_preprocessing()
if (requireNamespace("duckdb", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) f <- file.path(tempdir(), "read.nadia") write_nadia(f, nadia_dia, res, verbose = FALSE) db <- read_nadia(f) db identical(db$protein_quant, nadia_dia$protein_quant) unlink(f) }if (requireNamespace("duckdb", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) f <- file.path(tempdir(), "read.nadia") write_nadia(f, nadia_dia, res, verbose = FALSE) db <- read_nadia(f) db identical(db$protein_quant, nadia_dia$protein_quant) unlink(f) }
Read Pattern Profiler data from a parquet file
read_pattern_profiler_data(file_path, min_membership = NULL)read_pattern_profiler_data(file_path, min_membership = NULL)
file_path |
Path to the parquet file |
min_membership |
Optional filter by minimum membership |
DataFrame with the clustering data
if (requireNamespace("arrow", quietly = TRUE) && requireNamespace("Mfuzz", quietly = TRUE) && requireNamespace("e1071", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # Write the clustering to parquet, then read it back f <- file.path(tempdir(), "pattern_profiler.parquet") pattern_profiler_analysis(res$se_proc, res$DEPs_results, assay_name = "Impseqrob_min", auto_select_c = FALSE, c = 3, output_file = f, verbose = FALSE) pp_data <- read_pattern_profiler_data(f, min_membership = 0.5) unlink(f) print(head(pp_data)) }if (requireNamespace("arrow", quietly = TRUE) && requireNamespace("Mfuzz", quietly = TRUE) && requireNamespace("e1071", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # Write the clustering to parquet, then read it back f <- file.path(tempdir(), "pattern_profiler.parquet") pattern_profiler_analysis(res$se_proc, res$DEPs_results, assay_name = "Impseqrob_min", auto_select_c = FALSE, c = 3, output_file = f, verbose = FALSE) pp_data <- read_pattern_profiler_data(f, min_membership = 0.5) unlink(f) print(head(pp_data)) }
Builds a professionally formatted reactable table to display protein
differential expression results. Works both in Shiny (it returns a reactable
object) and standalone via results_list_widget().
results_list_reactable( data, protein_quant = NULL, comparisons = NULL, ain = NULL, alpha = 0.05, lfc_thr = 0, page_size = 15, height = 720, show_missing = TRUE, element_id = NULL, selection = NULL, searchable = TRUE )results_list_reactable( data, protein_quant = NULL, comparisons = NULL, ain = NULL, alpha = 0.05, lfc_thr = 0, page_size = 15, height = 720, show_missing = TRUE, element_id = NULL, selection = NULL, searchable = TRUE )
data |
Data frame or path to a TSV/CSV/Parquet file with DE results. Required columns: Protein.IDs, Gene.Names, logFC, P.Value, adj.P.Val, Change, Comparison. Optional: Assay, and the four missingness columns MissGlobal, MissComp, MissCND1 and MissCND2, which are shown only if all four are present |
protein_quant |
Data frame (preprocessing$protein_quant) or path to a Protein_QUANT_*.tsv file. If not NULL, the Description and Quant_Pepts columns are added. |
comparisons |
Vector of comparisons to include (NULL = all of them) |
ain |
Vector of assays to keep (NULL = all of them) |
alpha |
Significance threshold used to highlight the FDR (default: 0.05) |
lfc_thr |
log2 fold-change threshold (default: 0, reserved for future use) |
page_size |
Rows per page (default: 15) |
height |
Table height in pixels (default: 720) |
show_missing |
Show the missingness percentage columns (default: TRUE) |
element_id |
Element ID for the Reactable JS API (default: NULL) |
selection |
Selection type: "single", "multiple", or NULL (default: NULL) |
searchable |
Enable the internal search box (default: TRUE) |
A reactable object
data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # protein_quant adds the Description and Quant_Pepts columns tbl <- results_list_reactable( res$DEPs_results, protein_quant = nadia_dia$protein_quant, comparisons = "B-A" ) class(tbl)data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # protein_quant adds the Description and Quant_Pepts columns tbl <- results_list_reactable( res$DEPs_results, protein_quant = nadia_dia$protein_quant, comparisons = "B-A" ) class(tbl)
Wraps results_list_reactable() with interactive crosstalk filters
(Comparison, Change, Method), a search box, an export-to-Excel button and
embedded CSS. The result is browsable: printing it at the console opens it
automatically in the RStudio Viewer or in the browser.
results_list_widget( data, protein_quant = NULL, comparisons = NULL, ain = NULL, alpha = 0.05, lfc_thr = 0, page_size = 15, height = 720, show_missing = TRUE, element_id = "deps_table", selection = NULL, searchable = TRUE )results_list_widget( data, protein_quant = NULL, comparisons = NULL, ain = NULL, alpha = 0.05, lfc_thr = 0, page_size = 15, height = 720, show_missing = TRUE, element_id = "deps_table", selection = NULL, searchable = TRUE )
data |
Data frame or path to a TSV/CSV/Parquet file with DE results. Required columns: Protein.IDs, Gene.Names, logFC, P.Value, adj.P.Val, Change, Comparison. Optional: Assay, and the four missingness columns MissGlobal, MissComp, MissCND1 and MissCND2, which are shown only if all four are present |
protein_quant |
Data frame (preprocessing$protein_quant) or path to a Protein_QUANT_*.tsv file. If not NULL, the Description and Quant_Pepts columns are added. |
comparisons |
Vector of comparisons to include (NULL = all of them) |
ain |
Vector of assays to keep (NULL = all of them) |
alpha |
Significance threshold used to highlight the FDR (default: 0.05) |
lfc_thr |
log2 fold-change threshold (default: 0, reserved for future use) |
page_size |
Rows per page (default: 15) |
height |
Table height in pixels (default: 720) |
show_missing |
Show the missingness percentage columns (default: TRUE) |
element_id |
Element ID (default: "deps_table") |
selection |
Selection type: "single", "multiple", or NULL (default: NULL) |
searchable |
Enable the internal search box (default: TRUE) |
A browsable htmltools object
if (requireNamespace("crosstalk", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # Printing the widget opens it in the Viewer / browser w <- results_list_widget(res$DEPs_results, protein_quant = nadia_dia$protein_quant) print(class(w)) }if (requireNamespace("crosstalk", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # Printing the widget opens it in the Viewer / browser w <- results_list_widget(res$DEPs_results, protein_quant = nadia_dia$protein_quant) print(class(w)) }
Run Mfuzz clustering
run_mfuzz_clustering(eset_std, c, m, seed = 42)run_mfuzz_clustering(eset_std, c, m, seed = 42)
eset_std |
Standardised ExpressionSet |
c |
Number of clusters |
m |
Fuzziness parameter |
seed |
Seed for reproducibility |
Mfuzz clustering object
Select the optimal number of clusters
select_optimal_clusters( eset_std, c_range = 2:10, m = NULL, method = c("xb", "consensus", "elbow"), seeds = c(42, 123, 456), verbose = TRUE )select_optimal_clusters( eset_std, c_range = 2:10, m = NULL, method = c("xb", "consensus", "elbow"), seeds = c(42, 123, 456), verbose = TRUE )
eset_std |
Standardised ExpressionSet |
c_range |
Range of cluster numbers to evaluate |
m |
Fuzziness parameter |
method |
Method: "xb", "consensus", "elbow" |
seeds |
Seeds passed on to |
verbose |
Show progress |
List with optimal_c, metrics, m
Standardise an ExpressionSet (row-wise z-score)
standardize_eset(eset, verbose = TRUE)standardize_eset(eset, verbose = TRUE)
eset |
ExpressionSet object |
verbose |
Print progress messages (default: TRUE) |
Standardised ExpressionSet
Summary of the Pattern Profiler data
summarize_pattern_profiler(data)summarize_pattern_profiler(data)
data |
Pattern Profiler DataFrame |
List with summary statistics
if (requireNamespace("Mfuzz", quietly = TRUE) && requireNamespace("e1071", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) pp <- pattern_profiler_analysis(res$se_proc, res$DEPs_results, assay_name = "Impseqrob_min", auto_select_c = FALSE, c = 3, verbose = FALSE) info <- summarize_pattern_profiler(pp$long_output) print(info$cluster_summary) }if (requireNamespace("Mfuzz", quietly = TRUE) && requireNamespace("e1071", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) pp <- pattern_profiler_analysis(res$se_proc, res$DEPs_results, assay_name = "Impseqrob_min", auto_select_c = FALSE, c = 3, verbose = FALSE) info <- summarize_pattern_profiler(pp$long_output) print(info$cluster_summary) }
Builds a reactable table that reproduces the layout of the metadata Excel sheet (FileName, Condition, Replicate, Coding, # Unique PSMs, # Unique Peptides, # Protein Groups). Black header, rows tinted by condition in light shades and Condition/Coding cells with a strong colour chip (the same scheme used by protein_list_widget() / quant_list_widget()).
summary_list_widget( data = NULL, page_size = 16, height = 540, element_id = "summary_table", selection = NULL, searchable = FALSE )summary_list_widget( data = NULL, page_size = 16, height = 540, element_id = "summary_table", selection = NULL, searchable = FALSE )
data |
Data frame or path to a metadata TSV/CSV file. Required; there is no default. It must have the columns R.FileName, R.Condition, R.Replicate, Coding, R.PrecursorsIdentified, R.StrippedSequencesIdentified, R.ProteinGroupsIdentified. |
page_size |
Page size (default 16, i.e. all the rows). |
height |
Height in px of the table container (default 540). |
element_id |
Widget id in the DOM (default "summary_table"). |
selection |
Selection type ("multiple" or NULL). |
searchable |
Enable the global search box (default FALSE). |
An htmltools object (browsable tagList) ready to be rendered.
if (requireNamespace("jsonlite", quietly = TRUE)) { data(nadia_dia) # LFQ/TMT metadata lack the identification counts; the widget then shows # only FileName/Condition/Replicate/Coding w <- summary_list_widget(nadia_dia$metadata) print(class(w)) }if (requireNamespace("jsonlite", quietly = TRUE)) { data(nadia_dia) # LFQ/TMT metadata lack the identification counts; the widget then shows # only FileName/Condition/Replicate/Coding w <- summary_list_widget(nadia_dia$metadata) print(class(w)) }
Interactive Volcano Plot with Highcharter
volcano_highchart_list( de_res, ain = NULL, comparisons = NULL, lfc_thr = 0, alpha = 0.05, p_col = "adj.P.Val", point_size = 4, colors = NULL, palette = NULL, show_top_genes = 0, highlight_genes = NULL, title = NULL )volcano_highchart_list( de_res, ain = NULL, comparisons = NULL, lfc_thr = 0, alpha = 0.05, p_col = "adj.P.Val", point_size = 4, colors = NULL, palette = NULL, show_top_genes = 0, highlight_genes = NULL, title = NULL )
de_res |
Data frame with differential expression results |
ain |
Vector of assays to filter on (optional) |
comparisons |
Vector of comparisons to include (optional) |
lfc_thr |
log2 fold-change threshold (default: 0) |
alpha |
Significance threshold (default: 0.05) |
p_col |
Column of p-values to use |
point_size |
Point size (default: 4) |
colors |
List of colours for "up", "down", "ns" (ignored when palette is used) |
palette |
Name of a paletteer palette (e.g. "ggsci::default_jco"). Uses 3 colours: up, down, ns |
show_top_genes |
Number of top genes to label by significance (default: 0) |
highlight_genes |
Vector of gene names to highlight manually (default: NULL) |
title |
Custom chart title (default: NULL, uses "Comparison (Assay)").
Use |
List of highchart objects
data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # One volcano per comparison, labelling the 10 most significant proteins hc_list <- volcano_highchart_list( res$DEPs_results, comparisons = c("B-A", "D-A"), lfc_thr = 1, alpha = 0.05, show_top_genes = 10 ) names(hc_list)data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) # One volcano per comparison, labelling the 10 most significant proteins hc_list <- volcano_highchart_list( res$DEPs_results, comparisons = c("B-A", "D-A"), lfc_thr = 1, alpha = 0.05, show_top_genes = 10 ) names(hc_list)
Wrap a Heatmap Together With Its Title
wrap_heatmap_with_title(hm, title, title_size = 14, title_face = "bold")wrap_heatmap_with_title(hm, title, title_size = 14, title_face = "bold")
hm |
tidyHeatmap object (InputHeatmap) |
title |
Heatmap title |
title_size |
Font size of the title |
title_face |
Font face of the title |
proteomics_heatmap object (S3 list)
.nadia fileStores the preprocessing tables, the processing results and, optionally, the Pattern Profiler output in one DuckDB database, together with the parameters and the provenance of the run. Nothing is duplicated: everything that can be derived is left out and rebuilt on reading, through SQL views stored in the file itself.
write_nadia( file, preprocessing, result = NULL, pattern_profiler = NULL, overwrite = FALSE, verbose = TRUE )write_nadia( file, preprocessing, result = NULL, pattern_profiler = NULL, overwrite = FALSE, verbose = TRUE )
file |
Path to write to. The |
preprocessing |
A |
result |
Object from |
pattern_profiler |
Object from |
overwrite |
Replace |
verbose |
Print progress. |
Use read_nadia() to read it back, and nadia_result() to get an object the
rest of the package can plot directly.
The path, invisibly.
Twelve tables. samples and proteins are the dimensions;
protein_sample_metrics, intensities, imputed_values and de_results
the facts; pp_membership and pp_profile the optional clustering; and
nadia_meta, nadia_packages, nadia_source_files, nadia_calls,
parameters and nadia_schema the provenance.
Three things are deliberately not stored, because they are exactly
derivable: the log2 assay (log2 of the raw one), the PCA_Input table
(the imputed assay joined to the DE results) and the observed cells of the
imputed assay (identical to the normalized ones). The last of these is
checked rather than assumed, since a model-based method such as limpa can
revise observed values; when it does, the full assay is stored instead.
Not inside a synchronised folder such as iCloud Drive, Dropbox or OneDrive while you are working. DuckDB keeps the file open with locks and partial writes, and a synchronising client can corrupt it. Write it locally and copy it afterwards.
read_nadia(), nadia_result(), nadia_add_pattern_profiler()
if (requireNamespace("duckdb", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) f <- file.path(tempdir(), "example.nadia") write_nadia(f, nadia_dia, res, verbose = FALSE) db <- read_nadia(f) db unlink(f) }if (requireNamespace("duckdb", quietly = TRUE)) { data(nadia_dia) res <- process_proteomics(nadia_dia, verbose = FALSE) f <- file.path(tempdir(), "example.nadia") write_nadia(f, nadia_dia, res, verbose = FALSE) db <- read_nadia(f) db unlink(f) }