spectrum-peak-counting-and-reporting
Summary
Count and report the number of peaks retained in a mass spectrum after applying a selected noise-threshold method (relative_abundance, signal_noise, or log mode), producing structured records of method identifier and peak counts per ionization mode for comparative evaluation.
When to use
When you need to quantify and compare the filtering efficacy of mutually exclusive noise-threshold methods on the same input mass spectrum, or when validating that a selected noise-filtering strategy retains an expected number of peaks for downstream molecular formula assignment.
When NOT to use
- Input is a mass list that has already been noise-filtered or centroided by the instrument vendor; peak counting is post-hoc reporting, not applicable to data that lacks the raw signal intensity distribution needed to re-apply threshold criteria.
- Analysis goal requires identification of isotopic clusters or fine structure; peak counting reports total peaks but does not distinguish monoisotopic, isotopic, or artifact peaks.
- Spectrum has already been processed through multiple conflicting noise-threshold steps; multiple successive applications of different methods will compound filtering artifacts.
Inputs
- Raw mass spectrum file (Bruker .d, ThermoFisher .raw, or CoreMS HDF5 format)
- MSParameters configuration object with noise-threshold method selection
- Noise-threshold parameters: relative_abundance minimum threshold, signal_noise ratio threshold, or log standard deviation cutoff
Outputs
- Peak count (integer) per noise-threshold method
- Method identifier (string: 'relative_abundance', 'signal_noise', or 'log')
- Ionization mode label (e.g., 'ESI_NEG')
- Structured JSON or CSV record with method name, peak count, and mode
How to apply
Load a raw mass spectrum (e.g., ESI_NEG_SRFA.d in Bruker or .raw format) using CoreMS MSParameters factory. Select one of three mutually exclusive noise-threshold methods: 'relative_abundance' (filtered by minimum relative abundance parameter), 'signal_noise' (filtered by signal-to-noise ratio threshold), or 'log' (filtered by standard deviation parameter). Apply the selected method to the loaded spectrum using CoreMS peak-filtering routines. Capture and serialize the resulting peak count, method name, and ionization mode identifier as a structured JSON or CSV record. Compare peak counts across methods to evaluate which filtering strategy best balances noise suppression and analyte retention for your analysis goal.
Related tools
- CoreMS (Provides MSParameters factory to instantiate noise-threshold configuration, implements conditional dispatch logic for three mutually exclusive threshold methods, and applies peak-filtering routines to compute final peak counts.) — https://github.com/EMSL-Computing/CoreMS
- pandas (Serializes peak count results and method metadata into structured DataFrames; enables export to CSV or Excel for downstream comparison.)
- Docker (Provides containerized execution environment to ensure reproducible CoreMS-based peak counting workflows across systems.)
Examples
from corems.encapsulation.factory.parameters import MSParameters
from corems.data_source.data_source_factory import run_from_file
import json
ms_obj = run_from_file('tests/tests_data/ftms/ESI_NEG_SRFA.d', MSParameters)
for spectrum in ms_obj:
spectrum.apply_noise_threshold(SNR_threshold=10, noise_method='signal_noise')
result = {'method': 'signal_noise', 'peak_count': len(spectrum.peaks), 'ionization_mode': 'ESI_NEG'}
print(json.dumps(result))
Evaluation signals
- Peak count is a non-negative integer; verify it is ≥ 0 and ≤ total m/z centroids detected in the raw spectrum.
- Method identifier matches exactly one of: 'relative_abundance', 'signal_noise', or 'log'; no other mode is reported.
- Peak counts differ across the three mutually exclusive methods applied to the same input spectrum (different methods should produce different retention counts unless the spectrum is trivial).
- Ionization mode label is correctly inherited from input spectrum metadata (e.g., 'ESI_NEG' for negative-ion ESI data).
- JSON or CSV output conforms to expected schema: columns for method name, peak_count, ionization_mode, and optional timestamp; no missing or malformed entries.
Limitations
- Peak count is a global statistic; it does not distinguish peak quality, confidence, or role in molecular formula assignment.
- The three noise-threshold methods are mutually exclusive; a single spectrum can be processed under only one method at a time, preventing simultaneous multi-method evaluation within a single call.
- Peak counting does not account for m/z calibration accuracy; miscalibrated spectra may produce artificially high or low peak counts if threshold criteria are m/z-dependent.
- CoreMS peak-filtering routines are designed for small-molecule analysis (ESI and FT-MS); applicability to GC-MS, LC-MS, or high-resolution imaging mass spectrometry workflows is not documented in the provided evidence.
Evidence
- [other] CoreMS provides three mutually exclusive noise threshold methods: 'relative_abundance' (filtered by minimum relative abundance parameter), 'signal_noise' (filtered by signal-to-noise ratio threshold), and 'log' (filtered by standard deviation parameter), each producing different peak retention counts for the same input spectrum.: "CoreMS provides three mutually exclusive noise threshold methods: 'relative_abundance' (filtered by minimum relative abundance parameter), 'signal_noise' (filtered by signal-to-noise ratio"
- [other] Load mass spectrum data from ESI_NEG_SRFA.d using CoreMS MSParameters factory to instantiate noise-threshold configuration. Implement conditional dispatch logic that selects one of three mutually exclusive noise-threshold methods (COND-001, COND-002, COND-003) based on spectrum properties or user input. Apply the selected noise-threshold method to the loaded spectrum using CoreMS peak-filtering routines. Capture the resulting peak count per ionization mode and method name. Serialize the results (method identifier, peak count per mode) as a structured JSON or CSV record.: "Load mass spectrum data from ESI_NEG_SRFA.d using CoreMS MSParameters factory to instantiate noise-threshold configuration...Apply the selected noise-threshold method to the loaded spectrum using"
- [readme] CoreMS is a comprehensive mass spectrometry framework for software development and data analysis of small molecules analysis.: "CoreMS is a comprehensive mass spectrometry framework for software development and data analysis of small molecules analysis"
- [other] from corems.encapsulation.factory.parameters import MSParameters: "from corems.encapsulation.factory.parameters import MSParameters"
- [readme] Bruker Solarix (CompassXtract), Bruker Solarix transients, ser and fid (FT magnitude mode only), ThermoFisher (.raw), Spectroswiss signal booster data-acquisition station (.hdf5): "Bruker Solarix (CompassXtract), Bruker Solarix transients, ser and fid (FT magnitude mode only), ThermoFisher (.raw)"
1---2name: spectrum-peak-counting-and-reporting-33description: Use when when you need to quantify and compare the filtering efficacy of mutually exclusive noise-threshold methods on the same input mass spectrum, or when validating that a selected noise-filtering strategy retains an expected number of peaks for downstream molecular formula assignment.4license: CC-BY-4.05metadata:6 source: https://skillmd.com/skills/holobiomicslab/spectrum-peak-counting-and-reporting-37 edam_operation: http://edamontology.org/operation_32158 edam_topics:9 - http://edamontology.org/topic_337010 - http://edamontology.org/topic_012111 tools:12 - Docker13 - CoreMS14 - pandas15 - numpy16derived_from:17- doi: 10.5281/zenodo.1400957518 title: corems19evidence_spans:20- from corems.encapsulation.factory.parameters import MSParameters21- CoreMS [section=results; evidence='from corems.encapsulation.factory.parameters import MSParameters']22- import pandas as pd23- pandas [section=results; evidence='import pandas as pd']24- import numpy as np25- numpy [section=results; evidence='import numpy as np']26claims: []27provenance:28 collection: https://w3id.org/holobiomicslab/asb-skill/collection/metabolomics/v129 assembled_by: scripts/collect_metabolomics_collection.py30 sources:31 - build: coll_corems32 doi: 10.5281/zenodo.1400957533 title: corems34 dedup_kept_from: coll_corems35schema_version: 0.2.036---3738# spectrum-peak-counting-and-reporting3940## Summary4142Count and report the number of peaks retained in a mass spectrum after applying a selected noise-threshold method (relative_abundance, signal_noise, or log mode), producing structured records of method identifier and peak counts per ionization mode for comparative evaluation.4344## When to use4546When you need to quantify and compare the filtering efficacy of mutually exclusive noise-threshold methods on the same input mass spectrum, or when validating that a selected noise-filtering strategy retains an expected number of peaks for downstream molecular formula assignment.4748## When NOT to use4950- Input is a mass list that has already been noise-filtered or centroided by the instrument vendor; peak counting is post-hoc reporting, not applicable to data that lacks the raw signal intensity distribution needed to re-apply threshold criteria.51- Analysis goal requires identification of isotopic clusters or fine structure; peak counting reports total peaks but does not distinguish monoisotopic, isotopic, or artifact peaks.52- Spectrum has already been processed through multiple conflicting noise-threshold steps; multiple successive applications of different methods will compound filtering artifacts.5354## Inputs5556- Raw mass spectrum file (Bruker .d, ThermoFisher .raw, or CoreMS HDF5 format)57- MSParameters configuration object with noise-threshold method selection58- Noise-threshold parameters: relative_abundance minimum threshold, signal_noise ratio threshold, or log standard deviation cutoff5960## Outputs6162- Peak count (integer) per noise-threshold method63- Method identifier (string: 'relative_abundance', 'signal_noise', or 'log')64- Ionization mode label (e.g., 'ESI_NEG')65- Structured JSON or CSV record with method name, peak count, and mode6667## How to apply6869Load a raw mass spectrum (e.g., ESI_NEG_SRFA.d in Bruker or .raw format) using CoreMS MSParameters factory. Select one of three mutually exclusive noise-threshold methods: 'relative_abundance' (filtered by minimum relative abundance parameter), 'signal_noise' (filtered by signal-to-noise ratio threshold), or 'log' (filtered by standard deviation parameter). Apply the selected method to the loaded spectrum using CoreMS peak-filtering routines. Capture and serialize the resulting peak count, method name, and ionization mode identifier as a structured JSON or CSV record. Compare peak counts across methods to evaluate which filtering strategy best balances noise suppression and analyte retention for your analysis goal.7071## Related tools7273- **CoreMS** (Provides MSParameters factory to instantiate noise-threshold configuration, implements conditional dispatch logic for three mutually exclusive threshold methods, and applies peak-filtering routines to compute final peak counts.) — https://github.com/EMSL-Computing/CoreMS74- **pandas** (Serializes peak count results and method metadata into structured DataFrames; enables export to CSV or Excel for downstream comparison.)75- **Docker** (Provides containerized execution environment to ensure reproducible CoreMS-based peak counting workflows across systems.)7677## Examples7879```80from corems.encapsulation.factory.parameters import MSParameters81from corems.data_source.data_source_factory import run_from_file82import json8384ms_obj = run_from_file('tests/tests_data/ftms/ESI_NEG_SRFA.d', MSParameters)85for spectrum in ms_obj:86 spectrum.apply_noise_threshold(SNR_threshold=10, noise_method='signal_noise')87 result = {'method': 'signal_noise', 'peak_count': len(spectrum.peaks), 'ionization_mode': 'ESI_NEG'}88 print(json.dumps(result))89```9091## Evaluation signals9293- Peak count is a non-negative integer; verify it is ≥ 0 and ≤ total m/z centroids detected in the raw spectrum.94- Method identifier matches exactly one of: 'relative_abundance', 'signal_noise', or 'log'; no other mode is reported.95- Peak counts differ across the three mutually exclusive methods applied to the same input spectrum (different methods should produce different retention counts unless the spectrum is trivial).96- Ionization mode label is correctly inherited from input spectrum metadata (e.g., 'ESI_NEG' for negative-ion ESI data).97- JSON or CSV output conforms to expected schema: columns for method name, peak_count, ionization_mode, and optional timestamp; no missing or malformed entries.9899## Limitations100101- Peak count is a global statistic; it does not distinguish peak quality, confidence, or role in molecular formula assignment.102- The three noise-threshold methods are mutually exclusive; a single spectrum can be processed under only one method at a time, preventing simultaneous multi-method evaluation within a single call.103- Peak counting does not account for m/z calibration accuracy; miscalibrated spectra may produce artificially high or low peak counts if threshold criteria are m/z-dependent.104- CoreMS peak-filtering routines are designed for small-molecule analysis (ESI and FT-MS); applicability to GC-MS, LC-MS, or high-resolution imaging mass spectrometry workflows is not documented in the provided evidence.105106## Evidence107108- [other] CoreMS provides three mutually exclusive noise threshold methods: 'relative_abundance' (filtered by minimum relative abundance parameter), 'signal_noise' (filtered by signal-to-noise ratio threshold), and 'log' (filtered by standard deviation parameter), each producing different peak retention counts for the same input spectrum.: "CoreMS provides three mutually exclusive noise threshold methods: 'relative_abundance' (filtered by minimum relative abundance parameter), 'signal_noise' (filtered by signal-to-noise ratio"109- [other] Load mass spectrum data from ESI_NEG_SRFA.d using CoreMS MSParameters factory to instantiate noise-threshold configuration. Implement conditional dispatch logic that selects one of three mutually exclusive noise-threshold methods (COND-001, COND-002, COND-003) based on spectrum properties or user input. Apply the selected noise-threshold method to the loaded spectrum using CoreMS peak-filtering routines. Capture the resulting peak count per ionization mode and method name. Serialize the results (method identifier, peak count per mode) as a structured JSON or CSV record.: "Load mass spectrum data from ESI_NEG_SRFA.d using CoreMS MSParameters factory to instantiate noise-threshold configuration...Apply the selected noise-threshold method to the loaded spectrum using"110- [readme] CoreMS is a comprehensive mass spectrometry framework for software development and data analysis of small molecules analysis.: "CoreMS is a comprehensive mass spectrometry framework for software development and data analysis of small molecules analysis"111- [other] from corems.encapsulation.factory.parameters import MSParameters: "from corems.encapsulation.factory.parameters import MSParameters"112- [readme] Bruker Solarix (CompassXtract), Bruker Solarix transients, ser and fid (FT magnitude mode only), ThermoFisher (.raw), Spectroswiss signal booster data-acquisition station (.hdf5): "Bruker Solarix (CompassXtract), Bruker Solarix transients, ser and fid (FT magnitude mode only), ThermoFisher (.raw)"