agentsclimarketplace

Spec2vec similarity scoring

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v1/skills/spec2vec-similarity-scoring

Use when after discovering Mass2Motifs via LDA on preprocessed MS/MS spectra, use this skill to assign putative substructure annotations by matching each motif's fragmentation pattern against a pre-indexed spectral library using learned spectral embeddings.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill spec2vec-similarity-scoring

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.3k tokens by cl100k_base, as published. Nobody here has run it

spec2vec-similarity-scoring

Summary

Compute Spec2Vec cosine similarity scores between Mass2Motifs and a spectral library to retrieve top-ranked annotated spectra for each motif. This enables automated annotation of discovered fragmentation motifs by identifying the most similar known spectral references.

When to use

After discovering Mass2Motifs via LDA on preprocessed MS/MS spectra, use this skill to assign putative substructure annotations by matching each motif's fragmentation pattern against a pre-indexed spectral library using learned spectral embeddings. Apply when you have a trained motifset JSON file and need to generate per-motif annotation records with similarity confidence metrics for visualization and export.

When NOT to use

  • Input motifset has not been validated or contains incomplete Mass2Motif definitions
  • Spectral library index is incompatible with the loaded Spec2Vec model version or was built from a different training corpus
  • Cosine similarity threshold has not been calibrated for your spectral domain or quality requirements — using arbitrary thresholds risks over-annotation or under-annotation

Inputs

  • Trained motifset JSON file (motifset_optimized.json) containing discovered Mass2Motifs
  • Pre-trained Spec2Vec model and embeddings (from Zenodo zenodo.org/records/15688609)
  • Spec2Vec-indexed spectral library database

Outputs

  • Per-motif annotation records in JSON format (compatible with MS2LDAViz)
  • Motif-to-substructure label mappings with cosine similarity scores
  • Confidence metrics for each annotation

How to apply

Load the pre-trained Spec2Vec model and embeddings from the designated Zenodo repository (zenodo.org/records/15688609), then load the trained motifset JSON file containing all discovered Mass2Motifs. For each Mass2Motif, compute cosine similarity scores between the motif's embedded representation and all entries in the Spec2Vec-indexed spectral library. Retrieve the top-ranked annotated spectra or reference entries for each motif based on a cosine similarity threshold (implementation determines sensitivity/specificity tradeoff). Generate annotation records that map each motif identifier to suggested labels, similarity scores, and confidence metrics, then export the output in JSON format compatible with MS2LDAViz for downstream exploration and curation.

Related tools

  • Spec2Vec (Computes learned spectral embeddings and cosine similarity scores between Mass2Motifs and spectral library entries)
  • MAG (Mass2Motif Annotation Guidance) (Orchestrates automated annotation workflow integrating Spec2Vec similarity lookup with annotation record generation) — https://github.com/vdhooftcompmet/MS2LDA
  • MS2LDA (Provides the LDA-based motif discovery framework whose outputs (motifset JSON) serve as input to Spec2Vec annotation) — https://github.com/vdhooftcompmet/MS2LDA
  • MS2LDAViz (Consumes the JSON annotation output and enables interactive visualization and export of per-motif annotation records) — https://github.com/vdhooftcompmet/MS2LDA

Evaluation signals

  • Annotation JSON output conforms to MS2LDAViz schema and can be loaded without parsing errors
  • All discovered Mass2Motifs receive at least one annotation record with a non-null similarity score
  • Cosine similarity scores fall within the [0, 1] range and show expected distribution (mean and variance consistent with library diversity and motif specificity)
  • Top-ranked annotations are biologically plausible given the motif's fragmentation composition (neutral losses and fragments align with known substructure losses)
  • Similarity score ranking is monotonically decreasing; top candidate has higher score than second candidate

Limitations

  • Annotation quality depends critically on the quality and completeness of the spectral library index and the Spec2Vec model's training corpus; poorly-trained or biased embeddings will produce spurious high-similarity matches
  • Cosine similarity alone does not capture semantic or chemical validity; a high score does not guarantee the annotation is correct or that the motif truly represents the proposed substructure
  • Motifs with fragmentation patterns absent or underrepresented in the training library will receive low-confidence annotations or no match above threshold
  • The skill does not perform de novo structure elucidation; it relies on the existence of reference spectra in the indexed library

Evidence

  • [methods] Automated Mass2Motif Annotation Guidance (MAG) with Spec2Vec: "Automated Mass2Motif Annotation Guidance (MAG) with Spec2Vec"
  • [other] For each Mass2Motif, compute Spec2Vec similarity scores against the Spec2Vec-indexed spectral library using the loaded model. Retrieve the top-ranked annotated spectra or reference entries for each motif based on cosine similarity threshold.: "For each Mass2Motif, compute Spec2Vec similarity scores against the Spec2Vec-indexed spectral library using the loaded model. 4. Retrieve the top-ranked annotated spectra or reference entries for"
  • [other] Download and load the pre-trained Spec2Vec model and embeddings from the Zenodo repository (zenodo.org/records/15688609). Load the trained motifset JSON file (motifset_optimized.json) containing all discovered Mass2Motifs.: "Download and load the pre-trained Spec2Vec model and embeddings from the Zenodo repository (zenodo.org/records/15688609). 2. Load the trained motifset JSON file (motifset_optimized.json) containing"
  • [other] Generate annotation records mapping each motif identifier to suggested labels, similarity scores, and confidence metrics. Export the per-motif annotation output in JSON format compatible with MS2LDAViz.: "Generate annotation records mapping each motif identifier to suggested labels, similarity scores, and confidence metrics. 6. Export the per-motif annotation output in JSON format compatible with"
  • [other] MS2LDA provides automated annotation of Mass2Motifs using MAG with Spec2Vec, which loads a trained motifset together with the Spec2Vec model from a Zenodo repository to output per-motif annotation records.: "MS2LDA provides automated annotation of Mass2Motifs using MAG with Spec2Vec, which loads a trained motifset together with the Spec2Vec model from a Zenodo repository to output per-motif annotation"

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.