Conditional-Dispatch Workflow Implementation
Summary
A pattern for implementing mutually exclusive signal-processing branches in mass spectrometry workflows, where spectrum properties or user parameters trigger selection of one noise-thresholding method (relative_abundance, signal_noise, or log) to filter and retain different peak populations from raw MS data.
When to use
When you have loaded a raw mass spectrum (e.g., ESI_NEG_SRFA.d in Bruker or .raw format) and need to apply one of several noise-threshold strategies based on user preference or spectrum metadata. Use this skill when you must decide between filtering by minimum relative abundance, signal-to-noise ratio, or standard deviation, and each choice produces materially different peak retention counts that will affect downstream annotation or quantification.
When NOT to use
- Input spectrum has already been noise-filtered or peak-picked by the instrument firmware or an upstream processing step; re-applying conditional dispatch risks losing peaks or introducing inconsistent thresholds.
- All three noise-threshold methods are expected to yield equivalent results (e.g., a synthetic or heavily pre-processed spectrum with already-separated signal and noise); conditional dispatch adds computational overhead without informing method choice.
- A single fixed noise-threshold strategy is mandated by protocol or regulatory requirement; conditional dispatch implies flexibility that may not be available or desirable.
Inputs
- Raw mass spectrum file (Bruker .d, Thermo .raw, or CoreMS-exported HDF5)
- MSParameters configuration object specifying noise-threshold mode and parameters
- User selection or programmatic trigger indicating preferred noise-threshold strategy
Outputs
- Filtered mass spectrum object with peaks retained according to selected noise-threshold method
- Peak count per ionization mode and method identifier
- Structured JSON or CSV record containing method name, peak counts, and metadata
How to apply
Load mass spectrum data using CoreMS MSParameters factory to instantiate noise-threshold configuration. Implement conditional logic (e.g., if-then or case dispatch) that selects one of three mutually exclusive noise-threshold methods based on spectrum properties or user input: '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 the resulting peak count per ionization mode and method name, then serialize results (method identifier, peak count per mode) as structured JSON or CSV for downstream analysis or comparison.
Related tools
- CoreMS (Provides MSParameters factory, mass spectrum data structures, and mutually exclusive noise-threshold filtering routines (relative_abundance, signal_noise, log modes)) — https://github.com/EMSL-Computing/CoreMS
- pandas (Serialization and tabular representation of filtered peak counts and method results)
- Docker (Containerized execution environment for reproducible conditional-dispatch workflows)
- numpy (Numerical array operations supporting parameter thresholds and peak count aggregation)
Examples
from corems.encapsulation.factory.parameters import MSParameters; params = MSParameters('tests/tests_data/ftms/ESI_NEG_SRFA.d'); params.ms_peak.noise_threshold_method = 'signal_noise'; spectrum = params.get_spectrum(); filtered_peaks = spectrum.apply_noise_threshold(); print(f'Method: signal_noise, Peaks retained: {len(filtered_peaks)}')
Evaluation signals
- Verify that exactly one of the three noise-threshold methods was applied (no overlapping or duplicate filtering).
- Confirm that peak counts differ between methods for the same input spectrum, validating that the conditional branch was correctly selected and executed.
- Check that serialized JSON/CSV output contains method identifier, peak count per ionization mode, and expected metadata fields.
- Validate that the filtered peak list is a proper subset of the original spectrum (no new peaks introduced).
- Confirm reproducibility: running the same workflow with identical parameters and user selection yields identical method name and peak counts.
Limitations
- The three noise-threshold methods are mutually exclusive by design; a single spectrum cannot be processed with multiple methods simultaneously within a single workflow execution without repeated dispatch cycles.
- Peak count alone does not validate method correctness; chemical interpretation requires downstream molecular formula assignment or spectral comparison.
- Parameter sensitivity varies by method: relative_abundance depends on minimum abundance cutoff, signal_noise depends on SNR threshold, and log depends on standard deviation multiplier; user must understand and tune parameters appropriate to the ionization mode and analyte class.
- CoreMS noise-threshold methods are optimized for small-molecule analysis; applicability to polymer or macromolecular MS data is not documented.
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 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. Implement conditional dispatch logic that selects one of three mutually"
- [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."
- [readme] from corems.encapsulation.factory.parameters import MSParameters: "from corems.encapsulation.factory.parameters import MSParameters"
- [readme] Manual and automatic noise threshold calculation: "Manual and automatic noise threshold calculation"
1---2name: conditional-dispatch-workflow-implementation3description: Use when when you have loaded a raw mass spectrum (e.g., ESI_NEG_SRFA.d in Bruker or .raw format) and need to apply one of several noise-threshold strategies based on user preference or spectrum metadata.4license: CC-BY-4.05---67# Conditional-Dispatch Workflow Implementation89## Summary1011A pattern for implementing mutually exclusive signal-processing branches in mass spectrometry workflows, where spectrum properties or user parameters trigger selection of one noise-thresholding method (relative_abundance, signal_noise, or log) to filter and retain different peak populations from raw MS data.1213## When to use1415When you have loaded a raw mass spectrum (e.g., ESI_NEG_SRFA.d in Bruker or .raw format) and need to apply one of several noise-threshold strategies based on user preference or spectrum metadata. Use this skill when you must decide between filtering by minimum relative abundance, signal-to-noise ratio, or standard deviation, and each choice produces materially different peak retention counts that will affect downstream annotation or quantification.1617## When NOT to use1819- Input spectrum has already been noise-filtered or peak-picked by the instrument firmware or an upstream processing step; re-applying conditional dispatch risks losing peaks or introducing inconsistent thresholds.20- All three noise-threshold methods are expected to yield equivalent results (e.g., a synthetic or heavily pre-processed spectrum with already-separated signal and noise); conditional dispatch adds computational overhead without informing method choice.21- A single fixed noise-threshold strategy is mandated by protocol or regulatory requirement; conditional dispatch implies flexibility that may not be available or desirable.2223## Inputs2425- Raw mass spectrum file (Bruker .d, Thermo .raw, or CoreMS-exported HDF5)26- MSParameters configuration object specifying noise-threshold mode and parameters27- User selection or programmatic trigger indicating preferred noise-threshold strategy2829## Outputs3031- Filtered mass spectrum object with peaks retained according to selected noise-threshold method32- Peak count per ionization mode and method identifier33- Structured JSON or CSV record containing method name, peak counts, and metadata3435## How to apply3637Load mass spectrum data using CoreMS MSParameters factory to instantiate noise-threshold configuration. Implement conditional logic (e.g., if-then or case dispatch) that selects one of three mutually exclusive noise-threshold methods based on spectrum properties or user input: '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 the resulting peak count per ionization mode and method name, then serialize results (method identifier, peak count per mode) as structured JSON or CSV for downstream analysis or comparison.3839## Related tools4041- **CoreMS** (Provides MSParameters factory, mass spectrum data structures, and mutually exclusive noise-threshold filtering routines (relative_abundance, signal_noise, log modes)) — https://github.com/EMSL-Computing/CoreMS42- **pandas** (Serialization and tabular representation of filtered peak counts and method results)43- **Docker** (Containerized execution environment for reproducible conditional-dispatch workflows)44- **numpy** (Numerical array operations supporting parameter thresholds and peak count aggregation)4546## Examples4748```49from corems.encapsulation.factory.parameters import MSParameters; params = MSParameters('tests/tests_data/ftms/ESI_NEG_SRFA.d'); params.ms_peak.noise_threshold_method = 'signal_noise'; spectrum = params.get_spectrum(); filtered_peaks = spectrum.apply_noise_threshold(); print(f'Method: signal_noise, Peaks retained: {len(filtered_peaks)}')50```5152## Evaluation signals5354- Verify that exactly one of the three noise-threshold methods was applied (no overlapping or duplicate filtering).55- Confirm that peak counts differ between methods for the same input spectrum, validating that the conditional branch was correctly selected and executed.56- Check that serialized JSON/CSV output contains method identifier, peak count per ionization mode, and expected metadata fields.57- Validate that the filtered peak list is a proper subset of the original spectrum (no new peaks introduced).58- Confirm reproducibility: running the same workflow with identical parameters and user selection yields identical method name and peak counts.5960## Limitations6162- The three noise-threshold methods are mutually exclusive by design; a single spectrum cannot be processed with multiple methods simultaneously within a single workflow execution without repeated dispatch cycles.63- Peak count alone does not validate method correctness; chemical interpretation requires downstream molecular formula assignment or spectral comparison.64- Parameter sensitivity varies by method: relative_abundance depends on minimum abundance cutoff, signal_noise depends on SNR threshold, and log depends on standard deviation multiplier; user must understand and tune parameters appropriate to the ionization mode and analyte class.65- CoreMS noise-threshold methods are optimized for small-molecule analysis; applicability to polymer or macromolecular MS data is not documented.6667## Evidence6869- [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"70- [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 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. Implement conditional dispatch logic that selects one of three mutually"71- [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."72- [readme] from corems.encapsulation.factory.parameters import MSParameters: "from corems.encapsulation.factory.parameters import MSParameters"73- [readme] Manual and automatic noise threshold calculation: "Manual and automatic noise threshold calculation"