agentsclimarketplace

Peptide spectrum representation learning

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/peptide-spectrum-representation-learning

Use when you have a collection of MS/MS spectra (in mzML or MGF format) and need to group or compare spectra from the same peptide without prior sequence annotation.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill peptide-spectrum-representation-learning

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

peptide-spectrum-representation-learning

Summary

Learn a low-dimensional neural network embedding of mass spectra such that spectra from the same peptide cluster together in a 32-dimensional space. This enables efficient joint analysis of millions of MS/MS spectra by converting high-dimensional peak data into a compact, semantically meaningful representation suitable for downstream clustering and annotation.

When to use

You have a collection of MS/MS spectra (in mzML or MGF format) and need to group or compare spectra from the same peptide without prior sequence annotation. This skill is especially valuable when processing large-scale spectral datasets (millions of spectra) where pairwise similarity computation becomes computationally prohibitive, or when you want to detect spectrum clusters corresponding to the same peptide independent of database search results.

When NOT to use

  • Your spectra are already annotated with high-confidence peptide identifications and you only need to validate or refine those assignments — use a spectrum library search or peptide scoring method instead.
  • You need real-time, single-spectrum queries against a reference library — GLEAMS is designed for batch processing and offline clustering, not online retrieval.
  • Your input spectra are from non-standard instruments or fragmentation methods (e.g., ETD, ECD) that are significantly different from the HCD/CID spectra used in the MassIVE-KB training set — generalization may be poor.

Inputs

  • MS/MS spectra in mzML format
  • MS/MS spectra in MGF format
  • Peak list files compatible with GLEAMS input format

Outputs

  • 32-dimensional embedding vectors (NumPy array, n × 32)
  • Spectrum metadata table (Parquet format)
  • Cluster assignments (optional, via gleams cluster)

How to apply

Prepare your MS/MS spectra in mzML or MGF format, then invoke the gleams embed command to encode each spectrum as a feature vector and pass it through a pre-trained neural network encoder. The encoder projects each spectrum into a 32-dimensional space in which spectra derived from the same peptide are positioned close together. The output is a NumPy array (n × 32) where n is the number of spectra, plus a Parquet metadata file. You can then apply hierarchical clustering (e.g., via gleams cluster with a distance threshold of 0.3) on these embeddings to detect spectrum clusters; the rationale is that Euclidean distance in the learned embedding space reflects spectral and peptide similarity more reliably than raw peak-space metrics.

Related tools

  • GLEAMS (Pre-trained neural network encoder that transforms mass spectra into 32-dimensional embeddings via the gleams embed command) — https://github.com/bittremieux/GLEAMS
  • Python (Required runtime environment; GLEAMS requires Python 3.8+)
  • Conda (Dependency and environment management for installing GLEAMS and GPU runtime)
  • CUDA-enabled GPU (Hardware accelerator required for efficient neural network inference during embedding computation)

Examples

gleams embed *.mzML --embed_name GLEAMS_embed

Evaluation signals

  • Output embedding array has shape (n, 32) where n equals the number of input spectra, with no NaN or Inf values.
  • Spectra known to originate from the same peptide (via database search or manual curation) have Euclidean distances < 0.3 in embedding space; cross-peptide distances are > 0.3.
  • Downstream hierarchical clustering with distance threshold 0.3 produces clusters in which >90% of spectra share the same peptide annotation (precision) and >85% of spectra from the same peptide are grouped together (recall).
  • Metadata Parquet file contains one row per spectrum with consistent indexing and no missing values for scan numbers or precursor m/z.
  • Runtime scales approximately linearly with spectral count; embedding computation for 1 million spectra completes within expected GPU-accelerated time (typically hours, not days).

Limitations

  • GLEAMS requires a Linux operating system and a CUDA-enabled GPU; CPU-only systems are not supported.
  • The pre-trained model was optimized on 30 million PSMs from HCD/CID fragmentation of human proteomes in the MassIVE-KB dataset; performance on spectra from non-standard fragmentation methods (ETD, UVPD) or organism-specific proteomes may be degraded.
  • The 32-dimensional space is optimized for grouping spectra by peptide identity but does not explicitly capture post-translational modification states; PTM-bearing spectra from the same sequence may not cluster tightly.
  • Very low-abundance or noisy spectra with few detected peaks may produce poor embeddings or be assigned to noise clusters (label -1) during clustering.
  • Installation can encounter Git LFS bandwidth quota errors; manual download of pre-trained model weights may be required as a workaround.

Evidence

  • [intro] GLEAMS encodes mass spectra as vectors of features and feeds them to a neural network to embed them into a 32-dimensional space in which spectra generated by the same peptide are close together.: "GLEAMS encodes mass spectra as vectors of features and feeds them to a neural network to embed them into a 32-dimensional space in which spectra generated by the same peptide are close together"
  • [readme] GLEAMS provides the gleams embed command to convert MS/MS spectra in peak files to 32-dimensional embeddings.: "GLEAMS provides the gleams embed command to convert MS/MS spectra in peak files to 32-dimensional embeddings"
  • [readme] This will read the MS/MS spectra from all matched mzML files and export the results to a two-dimensional NumPy array of dimension n x 32.: "export the results to a two-dimensional NumPy array of dimension n x 32 in file GLEAMS_embed.npy, with n the number of MS/MS spectra"
  • [readme] GLEAMS requires Python 3.8, a Linux operating system, and a CUDA-enabled GPU.: "GLEAMS requires Python 3.8, a Linux operating system, and a CUDA-enabled GPU"
  • [readme] GLEAMS was trained on 30 million PSMs from the MassIVE-KB (v1) dataset.: "GLEAMS was trained on 30 million PSMs from the MassIVE-KB (v1) dataset"
  • [intro] It then detects spectrum clusters of spectra generated by the same peptide.: "It then detects spectrum clusters of spectra generated by the same peptide"
  • [readme] This will perform hierarchical clustering on the embeddings with the given distance threshold.: "This will perform hierarchical clustering on the embeddings with the given distance threshold"

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.