Skip to content
Back to skills

Mass Spectrometry Spectrum Preprocessing

ASecurity

Use when when you have raw LC–QTOF wastewater spectra (or other real

  • 16 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 12, 2026
ai-agentspythongogit

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add HolobiomicsLab/asb-skill-collections --skill mass-spectrometry-spectrum-preprocessing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Mass Spectrometry Spectrum Preprocessing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Mass Spectrometry Spectrum Preprocessing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/holobiomicslab-mass-spectrometry-spectrum-preprocessing/badge)](https://www.skillsdirectory.com/skills/holobiomicslab-mass-spectrometry-spectrum-preprocessing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: mass-spectrometry-spectrum-preprocessing
description: Use when when you have raw LC–QTOF wastewater spectra (or other real
  experimental mass spectrometry data) and need to feed them into a pretrained MSGO
  model for molecular structure prediction.
license: CC-BY-4.0
metadata:
  edam_operation: http://edamontology.org/operation_3214
  edam_topics:
  - http://edamontology.org/topic_0091
  - http://edamontology.org/topic_3172
  tools:
  - Python 3.7
  - Torch
  - Python
  - MSGO model
  techniques:
  - mass-spectrometry
  license_tier: open
  provenance_tier: literature
derived_from:
- doi: 10.1038/s42256-025-01140-5
  title: MSGo
evidence_spans:
- 'Python: 3.7'
- 'Torch: 1.7.1'
claims: []
provenance:
  collection: https://w3id.org/holobiomicslab/asb-skill/collection/metabolomics/v2
  assembled_by: scripts/collect_metabolomics_collection.py
  sources:
  - build: coll_mist_chemical_formula_transformer_cq
    doi: 10.1038/s42256-023-00708-3
    title: MIST (chemical formula transformer)
  - build: coll_msgo_cq
    doi: 10.1038/s42256-025-01140-5
    title: MSGo
  dedup_kept_from: coll_msgo_cq
schema_version: 0.2.0
attribution:
  generator: AgenticScienceBuilder
  original_doi: 10.1038/s42256-025-01140-5
  all_source_dois:
  - 10.1038/s42256-025-01140-5
  zenodo_doi: 10.5281/zenodo.20794027
  curators: []
  promoter: Louis-Félix Nothias
  sponsor: CNRS & Université Côte d'Azur
---

# mass-spectrometry-spectrum-preprocessing

## Summary

Normalize and format experimental mass spectrometry spectra to match the input requirements of a trained neural encoder before inference. This is a critical preprocessing step that ensures real LC–QTOF spectra are compatible with deep learning models trained on pseudo SMILES-spectrum pairs.

## When to use

When you have raw LC–QTOF wastewater spectra (or other real experimental mass spectrometry data) and need to feed them into a pretrained MSGO model for molecular structure prediction. The trigger is a mismatch between raw spectrum format (raw m/z arrays, intensity values, metadata) and the model's expected tensor input shape and normalization convention.

## When NOT to use

- Input spectra are already pseudo SMILES-spectrum pairs generated by cfmid (use them directly for training, not preprocessing)
- You have no reference model or training protocol defining the expected spectrum format (preprocessing requires a known input schema)

## Inputs

- Raw LC–QTOF spectrum (CSV, NetCDF, or vendor format with m/z and intensity columns)
- Experimental wastewater sample spectra (300+ spectra in real datasets)
- Model configuration or metadata describing expected input shape and normalization

## Outputs

- Preprocessed spectrum tensor compatible with MSGO model input layer
- Normalized intensity values and aligned m/z ranges
- Preprocessed spectrum in CSV or HDF5 format suitable for batch inference

## How to apply

Load raw experimental spectra from CSV or vendor-specific formats (e.g., LC–QTOF output). Normalize intensity values and align m/z ranges to match the format used during MSGO model training on 30k+ pseudo SMILES-spectrum pairs. Apply any mass accuracy corrections or intensity scaling required by the model (e.g., log-intensity transformation, m/z binning). Remove or flag low-intensity noise below a model-specific threshold. Convert the formatted spectrum into a tensor representation compatible with Torch 1.7.1. Verify shape and data type match the model's input layer (typically a 2D array of m/z–intensity pairs or a binned mass spectrum vector). This ensures inference produces valid confidence-ranked SMILES predictions rather than numerical errors or out-of-domain outputs.

## Related tools

- **MSGO model** (Pretrained deep learning model that consumes preprocessed spectra to output ranked molecular structure predictions) — github.com/aaronma2020/MSGO
- **Torch** (Deep learning framework (version 1.7.1) used to load model and convert preprocessed spectra to tensors for inference)
- **Python** (Scripting language (version 3.7) for implementing spectrum loading, normalization, and tensor conversion workflows)

## Examples

```
# After downloading and extracting LC–QTOF wastewater spectra to ./data/wastewater.csv, preprocess as follows:
python tools/eval_standard.py --log_path ckpts/pfas --real_csv ./data/wastewater.csv --out_csv ./wastewater_results.csv --beam_size 500 --polar neg
```

## Evaluation signals

- Preprocessed spectrum tensor shape matches MSGO model's input_size parameter (e.g., [batch_size, spectrum_dim])
- Intensity values fall within model's expected range (e.g., [0, 1] if min-max normalized, or log-transformed to typical range observed in training data)
- m/z values are aligned to model's expected mass range (no NaN, inf, or out-of-bounds values)
- Inference on preprocessed spectrum produces valid confidence scores (non-zero, between 0 and 1) and ranked SMILES predictions rather than errors or trivial outputs
- Predictions on known reference compounds or literature-annotated wastewater compounds show non-negligible confidence (>0.01) for correct or near-correct structures

## Limitations

- Preprocessing assumes the model's training distribution (30k+ cfmid-generated pseudo spectra) is representative of real experimental LC–QTOF spectra; domain shift or unusual ionization modes may degrade downstream prediction quality
- Spectrum quality and instrument calibration directly impact preprocessing fidelity; poorly calibrated or noisy raw spectra may fail normalization or produce low-confidence predictions
- No single preprocessing formula is provided in the README; practitioners must infer normalization strategy from model training details or empirical validation against known compounds

## Evidence

- [other] Preprocess the experimental spectra to match the input format expected by the model.: "Preprocess the experimental spectra to match the input format expected by the model."
- [readme] For Training, we use 30k+ pseudo smiles-specturm pairs generated by cfmid: "For Training, we use 30k+ pseudo smiles-specturm pairs generated by cfmid"
- [readme] we use one LC–QTOF dataset for wastewater samples to verify our model: "we use one LC–QTOF dataset for wastewater samples to verify our model"
- [other] Load the pre-trained MSGO model (Torch 1.7.1) and the LC–QTOF wastewater dataset containing 300+ real spectra.: "Load the pre-trained MSGO model (Torch 1.7.1) and the LC–QTOF wastewater dataset containing 300+ real spectra."

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.