agentsclimarketplace

Chemical structure smiles assignment

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/chemical-structure-smiles-assignment

Use when you have a mass spectral library (EI or MS2 format) loaded into R via read_lib() and possess either MOL files (from Lib2NIST export) or an SDF file containing the corresponding chemical structures, but the library entries lack SMILES fields or have incomplete structure information.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill chemical-structure-smiles-assignment

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

chemical-structure-smiles-assignment

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

Summary

Assign SMILES (Simplified Molecular Input Line Entry System) chemical structure strings to mass spectral library entries using structure files derived from MOL or SDF files. This skill enables enrichment of MS libraries with standardized chemical structure notation needed for downstream metabolomics workflows like MS-DIAL.

When to use

Apply this skill when you have a mass spectral library (EI or MS2 format) loaded into R via read_lib() and possess either MOL files (from Lib2NIST export) or an SDF file containing the corresponding chemical structures, but the library entries lack SMILES fields or have incomplete structure information.

When NOT to use

  • Library already contains complete and valid SMILES fields from the source (e.g., RIKEN EI library)—skip directly to combination or write steps.
  • Structure files (MOL/SDF) are unavailable or unaligned with library entries by name or InChIKey—structure assignment will fail silently on non-matching records.
  • Working with MoNA libraries—use reorganize_mona() instead, which extracts SMILES from the Comment field without requiring external structure files.

Inputs

  • mass spectral library object (loaded via read_lib with type='EI' or type='MS2')
  • MOL file directory (from Lib2NIST export) or pre-existing SDF file
  • structure reference file (tab-delimited text with name/InChIKey and SMILES columns, from extract_structure())

Outputs

  • mass spectral library object with SMILES field populated
  • ready for downstream polarity separation or RI assignment

How to apply

First, prepare a structure reference file by either combining MOL files into a single SDF using combine_mol2sdf(), or use an existing SDF. Extract structure information (name and SMILES pairs) from the SDF file using extract_structure(), which produces a tab-delimited text file with compound names and SMILES strings. Then call assign_smiles() with the loaded library object and the extracted structure file, specifying match='name' for Windows/Agilent workflows or match='inchikey' for Linux/Mac systems (when InChIKey is available). The function performs name-based or InChIKey-based lookup and cross-references entries, appending SMILES to library records where matches are found. For large NIST libraries, enable parallel computing via future/future.apply before calling assign_smiles() to reduce processing time from hours to minutes.

Related tools

  • mspcompiler (R package providing assign_smiles(), extract_structure(), and combine_mol2sdf() functions for structure assignment to spectral libraries) — https://github.com/QizhiSu/mspcompiler
  • Lib2NIST (Windows tool for exporting NIST libraries to MSP + MOL files in the required format for mspcompiler structure extraction) — https://chemdata.nist.gov/dokuwiki/doku.php?id=chemdata:nist17
  • ChemmineR / ChemmineOB (Bioconductor packages used by mspcompiler for SDF parsing and structure format conversions)
  • future / future.apply (R packages enabling parallel backend for assign_smiles() on multi-core systems to accelerate SMILES matching)

Examples

library(mspcompiler); library(future); plan(multisession(workers = detectCores() - 1)); nist_ei <- read_lib("D:/MS_libraries/NIST.MSP", type = "EI"); combine_mol2sdf("D:/MS_libraries/NIST.MOL", "D:/MS_libraries/nist.sdf"); nist_ei_structure <- extract_structure("D:/MS_libraries/nist.sdf", "D:/MS_libraries/nist_structure.txt"); nist_ei <- assign_smiles(nist_ei, nist_ei_structure, match = "name"); plan(sequential)

Evaluation signals

  • All or nearly all library entries now contain non-empty SMILES fields (inspect head() of library object and compare pre/post assignment counts).
  • SMILES strings conform to standard SMILES grammar (correct valence, no dangling bonds, parseable by cheminformatics tools).
  • Match rate (number of records with assigned SMILES / total records) is ≥ 95% for high-quality sources like NIST, or ≥ 80% for public libraries with nomenclature variation.
  • No false positive SMILES assignments—spot-check 10–20 entries by comparing assigned SMILES to the original compound name or InChIKey to ensure lookup correctness.
  • Library can be successfully written to MSP format via write_EI_msp() or write_MS2_msp() without schema errors.

Limitations

  • MOL/SDF structure files must be aligned with library entries by compound name or InChIKey; mismatches or typos in nomenclature cause silent failures (no error raised, no SMILES assigned).
  • InChIKey-based matching (match='inchikey') is recommended for Linux/Mac but requires InChIKey fields in both the structure file and library metadata—unavailable in some older NIST releases.
  • Processing time scales with library size (NIST EI: several hours on single core; parallel computing highly recommended). Intermediate SDF files (from combine_mol2sdf) can occupy hundreds of gigabytes.
  • MOL folder manipulation (copy/move/delete) is extremely slow due to the large number of small files; choose storage location carefully before exporting from Lib2NIST.
  • Some compounds lack MOL representations or valid SMILES, resulting in partial coverage—no imputation or fallback mechanism is provided.

Evidence

  • [other] Assign SMILES structures via assign_smiles with match='name'.: "Assign SMILES structures via assign_smiles; if you are working with Linux-based or Mac OS, please use "match = "inchikey"."
  • [readme] Extract structure based on the sdf file exported before.: "Extract structure based on the sdf file exported before. nist_ei_structure <- extract_structure("D:/MS_libraries/nist.sdf", "D:/MS_libraries/nist_structure.txt")"
  • [readme] Combine all mol files into a single sdf file for subsequent structure retrieval.: "Combine all mol files into a single sdf file for subsequent structure retrieval. combine_mol2sdf("D:/MS_libraries/NIST.MOL", "D:/MS_libraries/nist.sdf")"
  • [readme] The whole process is time-consuming (several hours, depending on the capability of your PC), so we suggests to use parallel computing.: "The whole process is time-consuming (several hours, depending on the capability of your PC), so we suggests to use parallel computing."
  • [other] For MoNA MS2 libraries, apply reorganize_mona() to relocate SMILES from Comment field to SMILES field.: "For MoNA MS2 libraries (positive and negative), apply reorganize_mona() to relocate SMILES from Comment field to SMILES 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.