intensity-threshold-noise-filtering
Summary
Remove low-intensity noise peaks from tandem mass spectra by applying intensity thresholds relative to the base peak intensity and optionally capping the total number of retained peaks. This preprocessing step improves signal-to-noise ratio and reduces computational burden in downstream spectrum matching and visualization.
When to use
Apply this skill when you have loaded a raw or partially processed MsmsSpectrum object and need to reduce spectral noise before annotation, matching, or visualization. Use it especially when spectra contain many weak peaks (e.g., chemical noise, instrument artifacts) that may confound peptide fragmentation pattern matching or when memory/computational resources are constrained and you want to retain only the strongest signals.
When NOT to use
- Spectra have already been filtered by a stricter downstream pipeline or quality control step; re-filtering with looser thresholds risks loss of valid diagnostic peaks.
- The analysis requires all detected peaks for spectral entropy, complexity metrics, or similarity scores that depend on full peak representation.
- Input is a processed feature table or quantification matrix rather than a raw spectrum object.
Inputs
- MsmsSpectrum object with m/z and intensity arrays
- min_intensity threshold (float, 0.0–1.0, relative to base peak)
- max_num_peaks limit (int, peak count cap)
Outputs
- MsmsSpectrum object with filtered m/z and intensity arrays
- Reduced peak count meeting both intensity and cardinality constraints
How to apply
Load an MsmsSpectrum object (e.g., via Universal Spectrum Identifier from a public proteomics repository) and apply the filter_intensity() method with two key parameters: min_intensity (typically 0.05, representing the minimum intensity as a fraction of the base peak) and max_num_peaks (typically 50, capping the total number of peaks to retain). The method automatically removes all peaks below the min_intensity threshold; if the remaining peak count exceeds max_num_peaks, only the max_num_peaks strongest peaks are kept. This two-stage filtering balances noise removal with retention of diagnostic fragment ions, and is typically applied after m/z range restriction and precursor peak removal but before intensity scaling for normalization.
Related tools
Examples
spectrum.filter_intensity(min_intensity=0.05, max_num_peaks=50)
Evaluation signals
- The output spectrum's m/z and intensity arrays contain only peaks with intensity ≥ (min_intensity × base_peak_intensity).
- The number of peaks in the filtered spectrum does not exceed max_num_peaks.
- Peaks are sorted by m/z value and intensities are non-negative.
- The base peak (highest intensity) is always retained unless it exactly equals a filtered peak.
- Re-running the filter with identical parameters produces identical output (deterministic).
Limitations
- Fixed relative thresholds (e.g., 0.05 of base peak) may be too lenient for low signal-to-noise spectra or too strict for high-quality data; instrument type and fragmentation method may require calibration.
- The filter is order-dependent when both min_intensity and max_num_peaks constraints are active: peaks are first thresholded, then capped by rank; this can yield different results than rank-first filtering.
- No adaptive or data-driven threshold optimization is provided; users must manually tune min_intensity and max_num_peaks based on empirical validation.
- Post-filter mass shifts or centroiding artifacts are not corrected; filtering assumes correctly calibrated m/z values.
Evidence
- [intro] Common spectrum processing operations (precursor & noise peak removal, intensity filtering, intensity scaling) optimized for computational efficiency.: "Common spectrum processing operations (precursor & noise peak removal, intensity filtering, intensity scaling) optimized for computational efficiency."
- [other] Apply filter_intensity with min_intensity=0.05 (as a fraction of base peak) and max_num_peaks=50 to remove low-intensity noise and cap the peak count.: "Apply filter_intensity with min_intensity=0.05 (as a fraction of base peak) and max_num_peaks=50 to remove low-intensity noise and cap the peak count."
- [other] Filter low-intensity noise peaks using .filter_intensity(min_intensity=0.05, max_num_peaks=50): ".filter_intensity(min_intensity=0.05, max_num_peaks=50)"
1---2name: intensity-threshold-noise-filtering-33description: Use when you have loaded a raw or partially processed MsmsSpectrum object4 and need to reduce spectral noise before annotation, matching, or visualization.5 Use it especially when spectra contain many weak peaks (e.6license: CC-BY-4.07metadata:8 source: https://skillmd.com/skills/holobiomicslab/intensity-threshold-noise-filtering-39 edam_operation: http://edamontology.org/operation_393710 edam_topics:11 - http://edamontology.org/topic_012112 - http://edamontology.org/topic_352013 tools:14 - Python15 - spectrum_utils16 techniques:17 - LC-MS18 license_tier: open19 provenance_tier: literature20derived_from:21- doi: 10.1021/acs.analchem.9b0488422 title: spectrumutils23evidence_spans:24- spectrum_utils is a Python package25- spectrum = sus.MsmsSpectrum.from_usi(usi)26claims: []27provenance:28 collection: https://w3id.org/holobiomicslab/asb-skill/collection/metabolomics/v229 assembled_by: scripts/collect_metabolomics_collection.py30 sources:31 - build: coll_spectrumutils32 doi: 10.1021/acs.analchem.9b0488433 title: spectrumutils34 dedup_kept_from: coll_spectrumutils35schema_version: 0.2.036attribution:37 generator: AgenticScienceBuilder38 original_doi: 10.1021/acs.analchem.9b0488439 all_source_dois:40 - 10.1021/acs.analchem.9b0488441 zenodo_doi: 10.5281/zenodo.2079402742 curators: []43 promoter: Louis-Félix Nothias44 sponsor: CNRS & Université Côte d'Azur45---4647# intensity-threshold-noise-filtering4849## Summary5051Remove low-intensity noise peaks from tandem mass spectra by applying intensity thresholds relative to the base peak intensity and optionally capping the total number of retained peaks. This preprocessing step improves signal-to-noise ratio and reduces computational burden in downstream spectrum matching and visualization.5253## When to use5455Apply this skill when you have loaded a raw or partially processed MsmsSpectrum object and need to reduce spectral noise before annotation, matching, or visualization. Use it especially when spectra contain many weak peaks (e.g., chemical noise, instrument artifacts) that may confound peptide fragmentation pattern matching or when memory/computational resources are constrained and you want to retain only the strongest signals.5657## When NOT to use5859- Spectra have already been filtered by a stricter downstream pipeline or quality control step; re-filtering with looser thresholds risks loss of valid diagnostic peaks.60- The analysis requires all detected peaks for spectral entropy, complexity metrics, or similarity scores that depend on full peak representation.61- Input is a processed feature table or quantification matrix rather than a raw spectrum object.6263## Inputs6465- MsmsSpectrum object with m/z and intensity arrays66- min_intensity threshold (float, 0.0–1.0, relative to base peak)67- max_num_peaks limit (int, peak count cap)6869## Outputs7071- MsmsSpectrum object with filtered m/z and intensity arrays72- Reduced peak count meeting both intensity and cardinality constraints7374## How to apply7576Load an MsmsSpectrum object (e.g., via Universal Spectrum Identifier from a public proteomics repository) and apply the filter_intensity() method with two key parameters: min_intensity (typically 0.05, representing the minimum intensity as a fraction of the base peak) and max_num_peaks (typically 50, capping the total number of peaks to retain). The method automatically removes all peaks below the min_intensity threshold; if the remaining peak count exceeds max_num_peaks, only the max_num_peaks strongest peaks are kept. This two-stage filtering balances noise removal with retention of diagnostic fragment ions, and is typically applied after m/z range restriction and precursor peak removal but before intensity scaling for normalization.7778## Related tools7980- **spectrum_utils** (Provides the MsmsSpectrum class and the filter_intensity() method for intensity-based noise filtering) — https://github.com/bittremieux/spectrum_utils/8182## Examples8384```85spectrum.filter_intensity(min_intensity=0.05, max_num_peaks=50)86```8788## Evaluation signals8990- The output spectrum's m/z and intensity arrays contain only peaks with intensity ≥ (min_intensity × base_peak_intensity).91- The number of peaks in the filtered spectrum does not exceed max_num_peaks.92- Peaks are sorted by m/z value and intensities are non-negative.93- The base peak (highest intensity) is always retained unless it exactly equals a filtered peak.94- Re-running the filter with identical parameters produces identical output (deterministic).9596## Limitations9798- Fixed relative thresholds (e.g., 0.05 of base peak) may be too lenient for low signal-to-noise spectra or too strict for high-quality data; instrument type and fragmentation method may require calibration.99- The filter is order-dependent when both min_intensity and max_num_peaks constraints are active: peaks are first thresholded, then capped by rank; this can yield different results than rank-first filtering.100- No adaptive or data-driven threshold optimization is provided; users must manually tune min_intensity and max_num_peaks based on empirical validation.101- Post-filter mass shifts or centroiding artifacts are not corrected; filtering assumes correctly calibrated m/z values.102103## Evidence104105- [intro] Common spectrum processing operations (precursor & noise peak removal, intensity filtering, intensity scaling) optimized for computational efficiency.: "Common spectrum processing operations (precursor & noise peak removal, intensity filtering, intensity scaling) optimized for computational efficiency."106- [other] Apply filter_intensity with min_intensity=0.05 (as a fraction of base peak) and max_num_peaks=50 to remove low-intensity noise and cap the peak count.: "Apply filter_intensity with min_intensity=0.05 (as a fraction of base peak) and max_num_peaks=50 to remove low-intensity noise and cap the peak count."107- [other] Filter low-intensity noise peaks using .filter_intensity(min_intensity=0.05, max_num_peaks=50): ".filter_intensity(min_intensity=0.05, max_num_peaks=50)"