agentsclimarketplace

Spectral library metadata reorganization

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

Use when when ingesting mass spectral libraries (EI or MS2) where SMILES information is embedded in the Comment field rather than in a dedicated SMILES metadata field—particularly common in MoNA GC-MS and LC-MS/MS exports.From its SKILL.md

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

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

5.8 KB, 982 tokens by cl100k_base, as published. Nobody here has run it

spectral-library-metadata-reorganization

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

Summary

Reorganize embedded chemical metadata within mass spectral library records by extracting SMILES notation from unstructured comment fields and populating dedicated structured metadata slots. This ensures proper organization and downstream compatibility with spectral matching and analysis tools like MS-DIAL.

When to use

When ingesting mass spectral libraries (EI or MS2) where SMILES information is embedded in the Comment field rather than in a dedicated SMILES metadata field—particularly common in MoNA GC-MS and LC-MS/MS exports. Apply this skill before combining multiple spectral libraries or assigning additional derived metadata (e.g., molecular formula, retention index).

When NOT to use

  • Input library already has SMILES information in a dedicated SMILES field
  • Comment field does not contain SMILES notation or contains only free-text comments
  • Library format is not MSP (e.g., mgf format; use complete_mgf() instead)

Inputs

  • MSP format spectral library file with Comment field containing embedded SMILES
  • Loaded library object from read_lib()

Outputs

  • Reorganized library object with SMILES field populated from Comment field
  • MSP format file with dedicated SMILES metadata field (after write_EI_msp() or write_MS2_msp())

How to apply

Load the MSP file into R using read_lib() with the appropriate type parameter ('EI' or 'MS2'). Parse the Comment field of each record to identify and extract SMILES notation strings using pattern matching. Validate extracted SMILES for chemical plausibility (balanced brackets, valid SMILES syntax). Populate the SMILES field for each record with the extracted and validated value using the reorganize_mona() function. Verify that all records with Comment-embedded SMILES now have a non-empty SMILES field and confirm the reorganized library object is returned with proper structure intact.

Related tools

  • mspcompiler (R package providing reorganize_mona() function to extract and relocate SMILES from Comment field to SMILES field) — https://github.com/QizhiSu/mspcompiler
  • R (Runtime environment for executing read_lib() and reorganize_mona() functions)
  • MS-DIAL (Downstream spectral matching and analysis tool that requires properly organized SMILES in dedicated field)

Examples

mona_ei <- read_lib("D:/MS_libraries/MoNA-export-GC-MS_Spectra.msp", type = "EI"); mona_ei <- reorganize_mona(mona_ei)

Evaluation signals

  • All records with Comment-embedded SMILES now have a non-empty SMILES field after reorganization
  • SMILES strings validate syntactically (balanced brackets, valid atom/bond notation)
  • No data loss: record count and spectrum peak information remain unchanged
  • Reorganized library object structure passes schema validation for MSP format
  • Comment field still retains original content or is appropriately cleared per library requirements

Limitations

  • Requires SMILES notation to be present in the Comment field; fails silently or returns empty SMILES if pattern does not match expected format
  • Does not handle malformed or incomplete SMILES strings; validation detects syntax errors but does not repair them
  • Function is library-specific (reorganize_mona); MoNA-specific patterns may not generalize to other libraries with different Comment field conventions
  • No changelog or version tracking documented; compatibility with different mspcompiler versions not specified

Evidence

  • [readme] This file has SMILES information though, it is in the Comment field. Therefore, the SMILES has to be extracted from the Comment and put into the SMILES field: "This file has SMILES information though, it is in the Comment field. Therefore, the SMILES has to be extracted from the Comment and put into the SMILES field"
  • [methods] Parse the Comment field of each record to identify and extract SMILES notation strings. Validate extracted SMILES strings for chemical plausibility (e.g., balanced brackets, valid SMILES syntax).: "Parse the Comment field of each record to identify and extract SMILES notation strings. Validate extracted SMILES strings for chemical plausibility (e.g., balanced brackets, valid SMILES syntax)."
  • [readme] mona_ei <- reorganize_mona(mona_ei): "mona_ei <- reorganize_mona(mona_ei)"
  • [methods] Reorganize SMILES field from MoNA Comment field: "Reorganize SMILES field from MoNA Comment field"

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.