| 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.3 |
| Built: | 2026-11-12 22:02:28 UTC |
| Source: | https://github.com/bioc/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. Protecting covariates needs at least two non-missing values of a protein
in every combination of batch and covariate level. Proteins that lack them
are corrected for the batch alone, without protecting the covariates, so
that none of their measured values is lost; BERT itself would set them to
missing. With a balanced design (every condition equally represented in
every batch) this is harmless; when batch and condition are unbalanced, it
can remove part of the biological signal of those proteins. Their names
are listed in |
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, and
metadata(se)$batch_correction, a list naming the features kept
unadjusted (unadjusted, no variance within a batch) and those corrected
for the batch only (batch_only). 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. Before imputation, a protein that lacks # two values in some batch-by-condition cell is corrected for the batch only.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. Before imputation, a protein that lacks # two values in some batch-by-condition cell is corrected for the batch only.
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, the
|
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 (empty if the suggested package highcharter is not installed)
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
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: |
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)
if (requireNamespace("highcharter", quietly = TRUE)) { 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) }if (requireNamespace("highcharter", quietly = TRUE)) { 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("highcharter", quietly = TRUE) && 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("highcharter", quietly = TRUE) && 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("highcharter", quietly = TRUE) && 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("highcharter", quietly = TRUE) && 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 |
Colour palette: |
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("highcharter", quietly = TRUE) && 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("highcharter", quietly = TRUE) && 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)) }
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
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
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 |
Colour palette: |
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, n_starts = 3L, verbose = TRUE )evaluate_cluster_range( eset_std, c_range = 2:10, m = NULL, n_starts = 3L, verbose = TRUE )
eset_std |
Standardised ExpressionSet |
c_range |
Vector of cluster numbers to evaluate |
m |
Fuzziness parameter |
n_starts |
Number of random starts per candidate number of clusters; the metrics are averaged over them. Drawn from the caller's RNG. |
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 |
Colour 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 for the values, used as a colour ramp: |
n |
Number of colours to generate |
reverse |
Reverse the palette (default: FALSE) |
Vector of colours, or a colorRamp2 function
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 |
The |
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
.norm_dispatch().
SummarizedExperiment with assays "log2" (optional) + winner method;
only "log2" when that is the 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 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)
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, 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, 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 is a list with: |
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 |
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 with one row per method and the columns
NRMSE, SOR, PSS, ACC_OI and Rank_Mean.
The cells masked to build the ground truth are drawn from the caller's RNG,
and so are the imputations of the stochastic methods (MinProb, QRILC,
PI, mice, missForest, MLE). Call set.seed() beforehand to
reproduce a run.
data(nadia_dia) se <- im_prepare_se(nadia_dia, norm_method = "cycloess", verbose = FALSE) # The default sweeps 15 methods; a handful is enough to illustrate it set.seed(42) 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 15 methods; a handful is enough to illustrate it set.seed(42) 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 19 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", "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))). For |
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) }
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)
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", 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", 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 the |
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 |
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 (one row per method and metric), 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).
Two columns use random numbers: Hopkins, which samples random reference
points, and PERMANOVA_pval, which permutes the group labels. Both draw
from the caller's RNG, so call set.seed() beforehand to reproduce them.
Every other column is deterministic.
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, n_starts = 3L, 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, n_starts = 3L, 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 |
n_starts |
Integer. Number of random starts 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.
Fuzzy c-means starts from a random partition, so the cluster labels, the
memberships and, with auto_select_c = TRUE, the chosen number of clusters
depend on the caller's RNG. Call set.seed() immediately before the function
to make a run reproducible on its own, whatever ran before it.
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 set.seed(42) 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 set.seed(42) 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)
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 |
Colour 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
if (requireNamespace("highcharter", quietly = TRUE)) { 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) }if (requireNamespace("highcharter", quietly = TRUE)) { 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 SummarizedExperiment of protein intensities into the
proteomics_data object that every NADIA reader returns. It is the way in
for data imported with other Bioconductor tools, for instance one of the
assays of a QFeatures object. process_proteomics() also accepts the
SummarizedExperiment directly and calls this function; call it yourself to
keep the object, for example to store it with write_nadia().
preprocess_se( se, condition_order = NULL, assay_name = NULL, log2_input = FALSE, condition_column = "Condition", replicate_column = "Replicate", verbose = TRUE )preprocess_se( se, condition_order = NULL, assay_name = NULL, log2_input = FALSE, condition_column = "Condition", replicate_column = "Replicate", verbose = TRUE )
se |
A |
condition_order |
Optional character vector with the conditions to
keep, in the order they should appear. |
assay_name |
Name or index of the assay with the intensities. |
log2_input |
|
condition_column |
Column of |
replicate_column |
Column of |
verbose |
Print progress messages. Default |
What is read from the object:
Intensities: the assay assay_name, proteins in rows and samples in
columns. With log2_input = TRUE the values are taken back to the linear
scale, because NADIA applies the log2 transformation when it normalises.
Zeros are treated as missing values, as for the other readers.
Proteins: the row names, which must be present and unique. The gene
names come from rowData()$Genes and the descriptions from
rowData()$Description, when those columns exist.
Design: the condition from colData()[[condition_column]] and the
replicate from colData()[[replicate_column]]; without a replicate
column the samples are numbered within each condition, in column order.
The samples are renamed <condition>_<replicate>, the convention the rest
of NADIA relies on, and the original column names are kept in
metadata$R.FileName. Identification metrics (precursor or peptide counts,
scores) are not read from rowData(), so those columns of the tables are
left empty.
An object of class c("se_data", "proteomics_data", "list") with
the elements metadata, protein_id and protein_quant, like the other
readers.
process_proteomics(), which accepts the SummarizedExperiment
directly.
data(nadia_dia) # A SummarizedExperiment built from the example data quant <- as.matrix(nadia_dia$protein_quant[, grep("^PG\\.Quantity_", names(nadia_dia$protein_quant))]) rownames(quant) <- nadia_dia$protein_quant$PG.ProteinGroups se <- SummarizedExperiment::SummarizedExperiment( assays = list(intensity = quant), colData = data.frame(Condition = nadia_dia$metadata$R.Condition, Replicate = nadia_dia$metadata$R.Replicate), rowData = data.frame(Genes = nadia_dia$protein_quant$PG.Genes)) pre <- preprocess_se(se, verbose = FALSE) pre # The same values on the log2 scale SummarizedExperiment::assay(se, "intensity") <- log2(quant) pre_log2 <- preprocess_se(se, log2_input = TRUE, verbose = FALSE)data(nadia_dia) # A SummarizedExperiment built from the example data quant <- as.matrix(nadia_dia$protein_quant[, grep("^PG\\.Quantity_", names(nadia_dia$protein_quant))]) rownames(quant) <- nadia_dia$protein_quant$PG.ProteinGroups se <- SummarizedExperiment::SummarizedExperiment( assays = list(intensity = quant), colData = data.frame(Condition = nadia_dia$metadata$R.Condition, Replicate = nadia_dia$metadata$R.Replicate), rowData = data.frame(Genes = nadia_dia$protein_quant$PG.Genes)) pre <- preprocess_se(se, verbose = FALSE) pre # The same values on the log2 scale SummarizedExperiment::assay(se, "intensity") <- log2(quant) pre_log2 <- preprocess_se(se, log2_input = TRUE, verbose = FALSE)
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 the run-wise C-score, stored as
|
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) && requireNamespace("circlize", 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) && requireNamespace("circlize", 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)
Print a Summary of Data Imported from a SummarizedExperiment
## S3 method for class 'se_data' print(x, ...)## S3 method for class 'se_data' print(x, ...)
x |
An |
... |
Ignored, present for compatibility with the |
x, invisibly. Called for the summary it prints.
data(nadia_dia) quant <- as.matrix(nadia_dia$protein_quant[, grep("^PG\\.Quantity_", names(nadia_dia$protein_quant))]) rownames(quant) <- nadia_dia$protein_quant$PG.ProteinGroups se <- SummarizedExperiment::SummarizedExperiment( assays = list(intensity = quant), colData = data.frame(Condition = nadia_dia$metadata$R.Condition)) print(preprocess_se(se, verbose = FALSE))data(nadia_dia) quant <- as.matrix(nadia_dia$protein_quant[, grep("^PG\\.Quantity_", names(nadia_dia$protein_quant))]) rownames(quant) <- nadia_dia$protein_quant$PG.ProteinGroups se <- SummarizedExperiment::SummarizedExperiment( assays = list(intensity = quant), colData = data.frame(Condition = nadia_dia$metadata$R.Condition)) print(preprocess_se(se, verbose = FALSE))
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, assay_name = NULL, log2_input = FALSE, 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, assay_name = NULL, log2_input = FALSE, 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"). It applies to every file written, the matrices and the plot inputs alike. Parquet needs the suggested package arrow, which is checked before the analysis starts. |
export_volcano |
Export VolcanoPlot_Input (default: TRUE) |
export_boxplot |
Export BoxPlot_Input (default: TRUE) |
export_pca |
Export PCA_Input (default: TRUE) |
assay_name |
For a |
log2_input |
For a |
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. A
SummarizedExperiment is also accepted, for data imported with other
tools: it is converted by preprocess_se(), with assay_name and
log2_input.
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.
if (requireNamespace("reactable", quietly = TRUE)) { 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) }if (requireNamespace("reactable", quietly = TRUE)) { 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("reactable", 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("reactable", 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:
Empty values, and proteins the annotation does not list, are shown as "NA" in white and placed last when ordering or splitting by it. |
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, three colours for
adjP = 0, 0.01 and 0.05: |
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) && requireNamespace("circlize", 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) && requireNamespace("circlize", 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) && requireNamespace("circlize", 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) && requireNamespace("circlize", 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
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("reactable", 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("reactable", 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
if (requireNamespace("reactable", quietly = TRUE)) { 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) }if (requireNamespace("reactable", quietly = TRUE)) { 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("reactable", quietly = TRUE) && 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("reactable", quietly = TRUE) && 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)run_mfuzz_clustering(eset_std, c, m)
eset_std |
Standardised ExpressionSet |
c |
Number of clusters |
m |
Fuzziness parameter |
The initial partition is drawn from the caller's RNG.
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"), n_starts = 3L, verbose = TRUE )select_optimal_clusters( eset_std, c_range = 2:10, m = NULL, method = c("xb", "consensus", "elbow"), n_starts = 3L, verbose = TRUE )
eset_std |
Standardised ExpressionSet |
c_range |
Range of cluster numbers to evaluate |
m |
Fuzziness parameter |
method |
Method: "xb", "consensus", "elbow" |
n_starts |
Random starts per candidate, 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("reactable", 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("reactable", 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 |
Colour palette for up, down and non-significant proteins, in
that order: |
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
if (requireNamespace("highcharter", quietly = TRUE)) { 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) }if (requireNamespace("highcharter", quietly = TRUE)) { 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) }