agentsclimarketplace

Spectral metadata extraction

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/spectral-metadata-extraction

Use when after loading an MSP spectral library file into memory using mssearchr's MSP parser, when you need to verify that each spectrum record contains complete and valid metadata (precursor m/z values, peak lists, header annotations) before writing the parsed spectra to a new MSP file or.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill spectral-metadata-extraction

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

7.5 KB, ~1.0k tokens by cl100k_base, as published. Nobody here has run it

spectral-metadata-extraction

License: restricted — no clear open-source license detected for the underlying tool; verify licensing before commercial use or redistribution. <!-- asb-license-banner -->

Summary

Extract and validate key spectral metadata fields (precursor m/z, peaks, annotations) from mass spectral records parsed from MSP library files. This skill ensures structural and semantic correctness of spectral data before downstream analysis or file export.

When to use

Apply this skill after loading an MSP spectral library file into memory using mssearchr's MSP parser, when you need to verify that each spectrum record contains complete and valid metadata (precursor m/z values, peak lists, header annotations) before writing the parsed spectra to a new MSP file or performing library search operations.

When NOT to use

  • Input spectra are already validated and certified by an upstream quality-control pipeline — extraction and re-validation would be redundant.
  • You are performing raw peak detection or deconvolution (not metadata annotation) — use signal processing tools instead.
  • The MSP file is known to be non-standard or uses a custom dialect not conforming to MSP specification — validate dialect first or use a custom parser.

Inputs

  • parsed MSP spectrum objects (in-memory R list or data frame)
  • individual spectrum records with header fields and peak data

Outputs

  • validated metadata dictionary per spectrum (precursor m/z, peaks, annotations)
  • validation report (pass/fail per record, error flags for missing/malformed fields)
  • cleaned spectrum objects ready for writing or search

How to apply

After parsing an MSP file into an in-memory R data structure (list or data frame of spectrum objects) using mssearchr, iterate over each spectrum record and extract the key metadata fields: precursor m/z, peak list with intensity values, and metadata annotations (retention index, compound name, etc.). Validate each field against MSP specification requirements: check that precursor m/z is numeric and within expected mass range, verify that peak lists are non-empty and formatted as m/z–intensity pairs, and confirm that required header fields are populated. Compare extracted metadata to source records to detect parsing errors, missing values, or format violations. Flag records that fail validation for manual review or correction before proceeding to file output or spectral searching.

Related tools

  • mssearchr (parses MSP files into in-memory R data structures; provides MSP reader and writer functions for spectrum object manipulation and validation) — https://github.com/AndreySamokhin/mssearchr
  • R (execution environment for mssearchr package and metadata extraction workflows)

Examples

# After loading MSP file with mssearchr, extract and validate metadata:
spectra <- read_msp('library.msp')
for (i in seq_along(spectra)) {
  spectrum <- spectra[[i]]
  precursor_mz <- spectrum$precursor_mz
  peaks <- spectrum$peaks
  validate_metadata(precursor_mz, peaks, spectrum$annotations)
}

Evaluation signals

  • All spectrum records in the output contain non-null precursor m/z values within the expected mass range for the instrument.
  • Each record's peak list is non-empty, formatted as m/z–intensity pairs, and contains no NaN or negative values.
  • Metadata annotations (compound name, retention index, etc.) match the original MSP input file when spot-checked against source records.
  • Writing the extracted and validated spectra back to a new MSP file produces a structurally valid output that re-parses without errors.
  • Comparison of parsed fields from the output MSP file to the original input records shows zero or minimal discrepancies (accounting for floating-point precision).

Limitations

  • The skill assumes the input MSP file is well-formed; malformed header syntax or non-standard field ordering may cause extraction failures.
  • Validation rules are tied to MSP specification compliance; custom or legacy MSP dialects may not conform to standard field names or value ranges.
  • The skill does not perform spectral peak deconvolution, isotope correction, or advanced quality metrics — it validates only metadata structure and basic semantic correctness.

Evidence

  • [other] Extract and validate key spectral fields from each record (precursor m/z, peaks, metadata annotations).: "Extract and validate key spectral fields from each record (precursor m/z, peaks, metadata annotations)."
  • [other] Load an MSP spectral library file using mssearchr's MSP parser into an in-memory R data structure (list or data frame of spectrum objects).: "Load an MSP spectral library file using mssearchr's MSP parser into an in-memory R data structure (list or data frame of spectrum objects)."
  • [readme] reading/writing msp files: "reading/writing msp files"
  • [other] Verify output file structure by reading it back and comparing parsed fields to the original input records.: "Verify output file structure by reading it back and comparing parsed fields to the original input records."

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.