Use when when you need to create synthetic noisy MS/MS spectra for benchmarking
Scanned 9/12/2026
Install to Claude Code
npx -y skills add HolobiomicsLab/asb-skill-collections --skill electronic-noise-generation-uniform-sampling --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Electronic Noise Generation Uniform Sampling?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/holobiomicslab-electronic-noise-generation-uniform-sampling)More formats (shields.io, HTML) on the badges page.
---
name: electronic-noise-generation-uniform-sampling
description: Use when when you need to create synthetic noisy MS/MS spectra for benchmarking
or validating denoising algorithms.
license: CC-BY-4.0
metadata:
edam_operation: http://edamontology.org/operation_3435
edam_topics:
- http://edamontology.org/topic_3520
- http://edamontology.org/topic_0121
tools:
- Python
- scipy
- spectral-denoising
- numpy
techniques:
- LC-MS
license_tier: open
provenance_tier: literature
derived_from:
- doi: 10.1038/s41592-025-02646-x
title: Spectral Denoising
- doi: 10.1038/s41592-023-02012-9
title: ''
evidence_spans:
- Spectral denoising requires ``Python >= 3.8`` installed on your system
- import spectral_denoising as sd
- scipy==1.14.1
- '- ``scipy==1.14.1``'
claims: []
provenance:
collection: https://w3id.org/holobiomicslab/asb-skill/collection/metabolomics/v2
assembled_by: scripts/collect_metabolomics_collection.py
sources:
- build: coll_spectral_denoising_cq
doi: 10.1038/s41592-025-02646-x
title: Spectral Denoising
dedup_kept_from: coll_spectral_denoising_cq
schema_version: 0.2.0
attribution:
generator: AgenticScienceBuilder
original_doi: 10.1038/s41592-025-02646-x
all_source_dois:
- 10.1038/s41592-025-02646-x
- 10.1038/s41592-023-02012-9
zenodo_doi: 10.5281/zenodo.20794027
curators: []
promoter: Louis-Félix Nothias
sponsor: CNRS & Université Côte d'Azur
---
# electronic-noise-generation-uniform-sampling
## Summary
Synthesize realistic electronic noise for MS/MS spectra by uniformly sampling m/z values between 50 and precursor m/z, then drawing ion intensities from a Poisson distribution. This generates benchmark test datasets with known noise characteristics for validating denoising algorithms.
## When to use
When you need to create synthetic noisy MS/MS spectra for benchmarking or validating denoising algorithms. Use this specifically when your goal is to introduce electronic noise (random detector artifacts) rather than chemical noise, and when you have a clean baseline spectrum and know its precursor m/z value. Triggers: you are building a test dataset with controlled noise levels, or you want to measure how well a denoising method recovers signal from spectra with known noise injection.
## When NOT to use
- Spectrum already contains chemical noise (formula-dependent artifacts); use formula_denoising or generate_chemical_noise instead.
- Input is a mass spectrum with m/z < 50 as minimum baseline; uniform sampling from 50 may miss lower mass artifacts.
- You need to simulate isotope patterns or multiply-charged ions; this method generates random noise, not plausible chemical fragments.
## Inputs
- clean mass spectrum (m/z–intensity peak pairs as numpy array, dtype=float32)
- precursor m/z (float, upper bound for noise sampling)
- number of noise ions to generate (integer, typically 5–20)
- Poisson lambda parameter (float, intensity scale; typical range 50–500)
## Outputs
- noisy spectrum (m/z–intensity peak pairs as numpy array, dtype=float32)
- electronic noise ion list (m/z–intensity pairs, shape [num_noise, 2])
## How to apply
Define a generate_noise function that samples m/z values uniformly at random between 50 and the precursor m/z value. For each sampled m/z, draw an intensity from a Poisson distribution with a specified lambda parameter (controlling noise magnitude). Generate a specified number of noise ion pairs (typically 5–20 per spectrum based on empirical MS/MS characteristics). Merge the noise peak array with the clean spectrum using an add_noise function that concatenates peaks and removes duplicate m/z entries by keeping the highest intensity. Validate the output by confirming the resulting ion count and m/z range match expectations (e.g., all noise m/z values fall within [50, precursor_mz], intensities are positive integers).
## Related tools
- **spectral-denoising** (Host package for generate_noise and add_noise functions; provides spectrum I/O, validation, and integration with electronic and chemical denoising workflows.) — https://github.com/FanzhouKong/spectral_denoising
- **numpy** (Uniform and Poisson random sampling, peak array manipulation and merging.)
- **scipy** (Statistical distributions (Poisson) for intensity generation.)
## Examples
```
from spectral_denoising.noise import *; import numpy as np; peak_clean = np.array([[79.02, 521.0], [81.01, 659.0]], dtype=np.float32); peak_noisy = sd.add_noise(peak_clean, num_noise=10, lambda_=100, precursor_mz=195.5)
```
## Evaluation signals
- All generated noise m/z values fall strictly within [50, precursor_mz] range.
- Noise intensity values are non-negative integers (Poisson-sampled).
- After add_noise merges peaks, duplicate m/z entries are removed and the highest intensity is retained for each unique m/z.
- Output spectrum contains exactly num_noise additional ions beyond the clean spectrum baseline (or num_noise peaks total if clean spectrum was empty).
- When comparing denoised output (after electronic_denoising) to the input noisy spectrum, the denoised spectrum recovers m/z and intensity values closer to the original clean baseline; entropy similarity score increases.
## Limitations
- Uniform sampling between 50–precursor_mz does not reproduce observed electronic noise distribution in real instruments; actual noise tends to cluster near precursor or common artifact m/z values.
- Poisson distribution assumes independent shot noise; real electronics introduce correlated, systematic artifacts.
- No mechanism to generate m/z measurement error or peak splitting; assumes perfect mass calibration.
- Lambda parameter must be tuned empirically; no automated selection based on precursor_mz or spectrum dynamic range is provided.
- Does not account for ion suppression or detector saturation effects; purely additive model.
## Evidence
- [other] 1. Define generate_noise function to synthesize electronic noise: sample m/z values uniformly between 50 and precursor m/z, generate intensities from Poisson distribution with parameter lambda, and create specified number of noise ion pairs.: "sample m/z values uniformly between 50 and precursor m/z, generate intensities from Poisson distribution with parameter lambda, and create specified number of noise ion pairs"
- [other] 2. Define add_noise function to combine clean spectrum with generated noise by merging peak arrays and removing duplicate m/z entries (keeping highest intensity).: "combine clean spectrum with generated noise by merging peak arrays and removing duplicate m/z entries (keeping highest intensity)"
- [other] 3. Validate both functions by creating test spectra with known baseline, adding noise, and confirming output arrays contain expected ion counts and m/z ranges.: "creating test spectra with known baseline, adding noise, and confirming output arrays contain expected ion counts and m/z ranges"
- [intro] Noise ions in MS/MS spectra are largely categorized as 1. electronic noises and 2. chemical noises.: "Noise ions in MS/MS spectra are largely categorized as 1. electronic noises and 2. chemical noises"
- [other] The ``electronic_denoising`` function removes obvious electronic noise ions in MS/MS spectra: "The ``electronic_denoising`` function removes obvious electronic noise ions in MS/MS spectra"
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!