agentsclimarketplace

Mass spectrometry matrix background simulation

Skill HolobiomicsLab/asb-skill-collections/packs/metabolomics/gc-ms/skills/mass-spectrometry-matrix-background-simulation

Use when when you need to create negative control or background-only reference datasets for LC/GC-MS analysis pipelines—specifically to validate peak-picking algorithms, assess false-positive rates, or simulate instrument background and matrix effects (e.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill mass-spectrometry-matrix-background-simulation

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 15 stars15 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 file declares

Copied from the file, not written here

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

8.2 KB, ~1.5k tokens by cl100k_base, as published. Nobody here has run it

mass-spectrometry-matrix-background-simulation

Summary

Generate realistic background-only .mzML files for LC/GC-MS data, containing either pure noise or noise combined with matrix ion peaks, without analyte signals. This skill produces ground-truth reference files for benchmarking feature detection and noise modeling in untargeted metabolomics workflows.

When to use

When you need to create negative control or background-only reference datasets for LC/GC-MS analysis pipelines—specifically to validate peak-picking algorithms, assess false-positive rates, or simulate instrument background and matrix effects (e.g., serum, plasma) independently of compound signals. Use this when your input is a noise intensity specification (retention-time range, intensity distribution) and optionally a matrix peak dataset (e.g., mzm from MoNA/HMDB), and your output requirement is a .mzML file with no simulated analyte peaks.

When NOT to use

  • Input already contains real MS data or ground-truth analyte peak lists — use direct file I/O instead.
  • Goal is to simulate complete LC/GC-MS runs with analyte peaks and realistic chromatographic shapes — use simmzml() (full simulation) instead.
  • Requirement is to generate feature tables with batch/condition effects — use mzrtsim() (peak list simulation) instead.
  • Matrix composition is unknown or needs to be learned from data — use empirical background estimation tools instead.

Inputs

  • .mzML-compliant instrument parameters (m/z range, resolution, scan type)
  • Noise intensity range specification (rtrange parameter or min/max intensity bounds)
  • Optional matrix ion peak dataset (mzm matrix peaks from MoNA or HMDB)
  • Output file path and name prefix

Outputs

  • .mzML file (XML-formatted, base64-encoded binary spectral data, background + optional matrix only)
  • Optional .csv metadata file (if matrix peaks enabled: m/z, retention time, matrix peak name, intensity)

How to apply

Call simmzml_blank() with parameters specifying the noise model (rtrange for retention-time coverage, noise intensity distribution), and optionally pass the matrixmz parameter to overlay matrix ion peaks (e.g., from the mzm serum matrix dataset). The function synthesizes m/z and retention-time arrays covering the full instrument m/z–RT range, generates synthetic background noise using a realistic distribution (Poisson or Gaussian), retrieves and overlays matrix peaks if enabled, base64-encodes the combined spectral data, and writes the mzML XML structure with appropriate scan headers and product ion arrays. Validate output by confirming: (1) .mzML file structure is valid XML with base64-encoded binary arrays, (2) CSV companion file is absent or contains only matrix peak metadata (no analyte entries), (3) simulated intensity ranges match input noise specification, and (4) when matrix peaks are enabled, peaks appear only at database m/z values and specified intensities.

Related tools

  • mzrtsim (Main R package providing simmzml_blank() function for background-only .mzML file generation) — https://github.com/yufree/mzrtsim
  • base64enc (Encodes synthetic spectral binary data as base64 for inclusion in mzML XML structure)
  • R (Execution environment and host language for simmzml_blank() workflow)
  • mzR (Not required for this skill (mzrtsim handles binary encoding internally without mzR dependency))

Examples

library(mzrtsim); data(monams1); simmzml_blank(rtrange=c(0, 3600), noise_intensity=c(100, 500), name='background_only')

Evaluation signals

  • Output .mzML file is valid XML with properly formatted scan headers, precursor metadata, and product ion arrays.
  • Base64-encoded binary spectral data decodes to m/z and intensity arrays spanning the instrument's full m/z range with appropriate resolution.
  • When pure noise mode (rtrange only): intensity distribution matches specified noise model (Poisson/Gaussian), no peaks cluster at database m/z values.
  • When matrix peaks enabled: peaks appear only at m/z values from the input matrix dataset with intensities matching or proportional to database values; no analyte peaks present.
  • CSV companion file (if generated) contains only matrix peak metadata; no entries have analyte compound names or sim_ins (ground-truth analyte intensity) columns.

Limitations

  • simmzml_blank() does not model chromatographic peak shapes or retention-time tailing—background is uniform across the RT dimension.
  • Matrix dataset must be pre-loaded in R memory (e.g., mzm from MoNA/HMDB); custom matrices require manual preparation in msp or RDS format.
  • Noise model is simplified (Poisson or Gaussian); real instrument background may exhibit more complex spectral structure or m/z-dependent noise profiles.
  • Output .mzML files do not include scan-level metadata such as instrument type, ionization mode, or collision energy (these are filled with defaults).
  • No changelog available for version compatibility or breaking changes in simmzml_blank() API.

Evidence

  • [other] simmzml_blank() produces .mzML files with configurable options: pure noise blanks via rtrange parameter, or blanks with serum matrix peaks by passing the mzm matrix dataset to the matrixmz parameter.: "simmzml_blank() produces .mzML files with configurable options: pure noise blanks via rtrange parameter, or blanks with serum matrix peaks by passing the mzm matrix dataset to the matrixmz parameter."
  • [other] Generate synthetic m/z and retention-time arrays covering the full instrument range with appropriate resolution. Synthesize background noise using a realistic noise model (e.g., Poisson or Gaussian distribution) across the m/z–retention-time matrix. If matrix peaks are enabled, retrieve or load the mzm matrix dataset and overlay selected matrix ion peaks at specified intensities onto the noise baseline.: "Generate synthetic m/z and retention-time arrays covering the full instrument range with appropriate resolution. Synthesize background noise using a realistic noise model (e.g., Poisson or Gaussian"
  • [other] Encode the combined spectral data (noise + optional matrix) as base64-encoded binary using the base64enc package. Construct mzML XML structure with appropriate scan headers, precursor metadata, and product ion arrays, then write to the output .mzML file.: "Encode the combined spectral data (noise + optional matrix) as base64-encoded binary using the base64enc package. Construct mzML XML structure with appropriate scan headers, precursor metadata, and"
  • [intro] The underlying engine handles binary data encoding via the base64enc package: "The underlying engine handles binary data encoding via the base64enc package"
  • [intro] removing the need for mzR or other heavy dependencies for file generation: "removing the need for mzR or other heavy dependencies for file generation"

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.