Fragment frequency threshold optimization
Curated, evidence-grounded skill and software-tool collections for scientific AI agents, generated by the AgenticScienceBuilder
npx -y skills add HolobiomicsLab/asb-skill-collections --skill fragment-frequency-threshold-optimizationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 14 stars14 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use when you have replicate MS/MS spectra with labeled fragment recurrence frequencies and need to select an optimal frequency threshold (beyond the default 0.1) that maximizes spectral quality metrics while minimizing false positive noise.
The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
9.0 KB, ~1.5k tokens by cl100k_base, as published. Nobody here has run it
fragment-frequency-threshold-optimization
License: restricted — no clear open-source license detected for the underlying tool; verify licensing before commercial use or redistribution. <!-- asb-license-banner -->
Summary
Optimize the frequency cutoff threshold applied during MS/MS spectrum denoising to balance signal retention and noise reduction. This skill determines the minimal recurrence frequency at which fragment ions should be retained in consensus spectra, using statistical and Pareto front analysis methods.
When to use
Apply this skill when you have replicate MS/MS spectra with labeled fragment recurrence frequencies and need to select an optimal frequency threshold (beyond the default 0.1) that maximizes spectral quality metrics while minimizing false positive noise. Use it before the final generate_denoised_spectra step when tuning denoising performance for a new dataset or experimental condition.
When NOT to use
- Input spectra do not have replicate measurements or fragment recurrence frequencies are not computed (l3/l4 outputs not available).
- The dataset is already heavily curated or manually verified and a standard frequency threshold (e.g., default 0.1) is acceptable.
- Computational resources are severely limited; performing a parameter sweep with Wilcoxon tests and Pareto analysis may be prohibitive for very large datasets.
Inputs
- Labeled spectrum object (l4) with fragment recurrence frequencies
- Feature list with precursor m/z and RT annotations
- mzML files containing replicate MS/MS spectra
- Reference spectral library (library_positive.rds or library_negative.rds)
Outputs
- Optimal frequency threshold value (numeric, typically 0.05–0.95)
- Pareto front analysis plot showing trade-offs between metrics
- Wilcoxon test results table (p-values for each threshold)
- Quality metric profiles (dot products, fragment counts, match scores) across thresholds
- Denoised mzML files generated using the optimal threshold
How to apply
Conduct a parameter sweep across a range of frequency thresholds (e.g., 0.05–0.95 in increments of 0.05) on a representative subset of features. For each threshold, apply generate_denoised_spectra and compute quality metrics such as spectral match scores, fragment matching ratios, and metadata consistency. Identify the Pareto front of trade-offs between signal retention and noise reduction using rPref. Apply Wilcoxon rank-sum tests at each frequency relative to the optimal frequency to assess statistical significance of metric changes. Select the threshold that minimizes noise while maintaining signal fidelity, typically balancing forward/reverse dot products (>0.25 threshold) and matching fragment count (≥2 fragments). Verify the choice by checking that annotation consistency across replicate spectra reaches ≥30% and that the number of high-confidence matches increases relative to adjacent thresholds.
Related tools
- rPref (Pareto front analysis to identify optimal trade-offs between signal retention and noise reduction metrics)
- stats (Wilcoxon rank-sum test) (Statistical significance testing of metric changes at each frequency threshold compared to optimal frequency)
- generate_denoised_spectra (Apply candidate frequency thresholds to produce denoised spectra for quality evaluation) — https://github.com/BiosystemEngineeringLab-IITB/dures
- Spectra (Store, access, and manipulate MS/MS spectral data during threshold evaluation)
- ggplot2 (Visualize Pareto fronts, quality metric profiles, and statistical test results)
- patchwork (Combine multiple visualization panels for threshold tuning results)
Examples
# R example using DuReS vignette workflow; tune optimal frequency threshold
l4 = label_individual_spectrum(l3, folder_path, 0.05)
# Sweep frequency thresholds 0.05–0.95 and evaluate quality metrics with rPref Pareto front
freq_sweep <- seq(0.05, 0.95, by=0.05); pareto_results <- lapply(freq_sweep, function(f) { l5_candidate <- generate_denoised_spectra(l4, folder_path, custom_threshold=f, ion_mode="pos"); compute_quality_metrics(l5_candidate, library_positive) })
# Identify Pareto front and optimal threshold using rPref package
Evaluation signals
- Pareto front plot shows a clear trade-off curve with the selected threshold at a non-dominated point.
- Wilcoxon rank-sum test p-value at the optimal threshold is significantly lower (p < 0.05) than adjacent thresholds, indicating a local optimum.
- Denoised spectra from the optimal threshold yield ≥30% annotation consistency across replicate measurements, with forward/reverse dot products >0.25 and ≥2 matching fragments per annotation.
- Quality metrics (e.g., spectral match scores, fragment matching ratios) plateau or decline beyond the optimal threshold, confirming diminishing returns.
- Fragment reduction from original to denoised spectra is consistent with expectations; e.g., reduction from 98 to 81 fragments after grouping and from 81 to ~9–40 fragments after thresholding, proportional to the selected threshold value.
Limitations
- Optimal threshold is dataset-specific and sample-dependent; results may not generalize across different ionization modes, metabolite classes, or MS instruments without re-tuning.
- Wilcoxon tests assume independent samples; replicate spectra from the same feature may violate independence assumptions, potentially inflating or deflating significance estimates.
- Pareto front analysis requires computation of multiple quality metrics across many features, which is time-intensive for large datasets (>10,000 features).
- The choice of frequency increment (e.g., 0.05 vs. 0.01) and the set of quality metrics included in the trade-off analysis can influence the identified optimal threshold; sensitivity analysis is recommended.
- Threshold optimization is most robust when applied to features with ≥20–30 replicate spectra; features with few replicates may yield unstable or unreliable frequency estimates.
Evidence
- [other] Applies Pareto front analysis to identify optimal trade-offs between signal retention and noise reduction: "Applies Pareto front analysis to identify optimal trade-offs between signal retention and noise reduction"
- [other] Performs Wilcoxon rank-sum tests to assess significance of metric changes at each frequency compared to the optimal frequency: "Performs Wilcoxon rank-sum tests to assess significance of metric changes at each frequency compared to the optimal frequency"
- [other] Applies a user-defined frequency threshold (default =
0.1) to retain signal fragments: "Applies a user-defined frequency threshold (default =0.1) to retain signal fragments" - [readme] DuReS provides users with the ability to determine the optimal frequency cutoff for denoising MS/MS spectra.: "DuReS provides users with the ability to determine the optimal frequency cutoff for denoising MS/MS spectra."
- [readme] Annotations must occur in ≥30% of replicate spectra: "Annotations must occur in ≥30% of replicate spectra"
- [readme] Matches with fewer than 2 fragments or dot products < 0.25 are filtered out: "Matches with fewer than 2 fragments or dot products < 0.25 are filtered out"
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.