agentsclimarketplace

Metabolomics sample comparison

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v1/skills/metabolomics-sample-comparison

Use when you have a MemoMatrix (sample-by-fingerprint matrix) from aligned MS2 spectra and need to visually compare sample similarity or clustering patterns, especially when samples show poor feature overlap, strong retention time shifts across different LC methods, or were acquired on different.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill metabolomics-sample-comparison

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

metabolomics-sample-comparison

Summary

Apply MDS or PCoA dimensionality reduction to MS2 fingerprint vectors to generate low-dimensional sample comparison plots, enabling visual clustering and relationship assessment of chemodiverse metabolomics samples independent of retention time.

When to use

You have a MemoMatrix (sample-by-fingerprint matrix) from aligned MS2 spectra and need to visually compare sample similarity or clustering patterns, especially when samples show poor feature overlap, strong retention time shifts across different LC methods, or were acquired on different mass spectrometer technologies (e.g., Maxis Q-ToF vs. Q-Exactive Orbitrap).

When NOT to use

  • Input is already a pre-computed distance matrix or coordinate table from a different method (e.g., from TMAP or Heatmap); skip to visualization.
  • Sample set contains <3 unique samples; MDS/PCoA requires sufficient dimensionality to meaningfully reduce.
  • All samples have identical or near-identical MS2 fingerprints (e.g., technical replicates with zero variance); dimensionality reduction will not reveal structure.

Inputs

  • MemoMatrix file (sample-by-fingerprint matrix from aligned MS2 spectra)
  • Sample grouping/metadata (optional, for coloring/labeling points)

Outputs

  • 2D coordinate table (samples × 2D positions)
  • 2D scatter plot visualization (SVG, PNG, or interactive HTML)
  • Pairwise sample distance matrix (intermediate)

How to apply

Load the MemoMatrix using memo-ms and compute pairwise sample distances from the aligned MS2 fingerprint vectors. Apply Multidimensional Scaling (MDS) or Principal Coordinate Analysis (PCoA) to reduce the distance matrix to 2D coordinates suitable for visualization. Generate a 2D scatter plot with samples as points, optionally colored or labeled by sample group identity. The resulting low-dimensional embedding preserves relative sample distances and reveals patterns in sample composition that would be obscured by retention time shifts or feature sparsity. Export both the coordinate table and the visualization for downstream interpretation and publication.

Related tools

  • MEMO (Core framework providing MS2 fingerprint alignment and sample vectorization that feeds into MDS/PCoA visualization) — https://github.com/mandelbrot-project/memo
  • memo-ms (Python package for loading and parsing MemoMatrix files and aligned MS2 fingerprint data)
  • scikit-bio (Provides PCoA (Principal Coordinate Analysis) implementation for dimensionality reduction of distance matrices)
  • numpy (Numerical computation of pairwise sample distances from fingerprint vectors)
  • Python 3.8+ (Runtime environment (Python 3.8 minimum; ≥3.9 recommended for string methods))

Examples

from memo_ms import load_memomatrix; from scipy.spatial.distance import pdist, squareform; from skbio.diversity import beta_diversity; import numpy as np; M = load_memomatrix('samples.memomatrix'); D = squareform(pdist(M, metric='euclidean')); coords = beta_diversity('pcoa', D); coords.plot(kind='scatter')

Evaluation signals

  • 2D coordinates are centered near origin with sensible variance (Euclidean distance between points matches input distance matrix).
  • Visually distinct sample groups (if metadata provided) cluster together; technical replicates or closely related samples occupy nearby regions.
  • Eigenvalue plot (if generated) shows that the first two principal coordinates capture sufficient variance (typically >50% combined for informative plots).
  • Coordinate table has exactly N rows (one per sample) and 2 columns (PC1, PC2); no NaN or infinite values.
  • Distance preservation: Euclidean distance between any two samples in the 2D plot is monotonically correlated with the original pairwise distance (Spearman ρ > 0.8).

Limitations

  • MDS/PCoA is sensitive to outlier samples with extreme fingerprints; consider filtering or blanks removal before dimensionality reduction.
  • 2D representation discards higher-order structure; if variance in PC3+ is substantial (>20%), consider 3D visualization or alternative methods (TMAP).
  • Sample grouping or visual patterns may be confounded by batch effects, sequencing/instrument drift, or environmental factors not captured in the fingerprint.
  • Results depend on prior MS2 peak/neutral loss filtering and fingerprint alignment quality; garbage fingerprints produce uninterpretable plots.

Evidence

  • [other] MEMO applies MDS/PCoA visualization techniques to aligned MS2 fingerprints to generate low-dimensional embeddings that enable visual comparison of different samples.: "MEMO applies MDS/PCoA visualization techniques to aligned MS2 fingerprints to generate low-dimensional embeddings that enable visual comparison of different samples."
  • [other] Apply Multidimensional Scaling (MDS) or Principal Coordinate Analysis (PCoA) to reduce the distance matrix to 2D coordinates.: "Apply Multidimensional Scaling (MDS) or Principal Coordinate Analysis (PCoA) to reduce the distance matrix to 2D coordinates."
  • [other] The occurence of MS2 peaks and neutral losses (to the precursor) in each sample is counted and used to generate an MS2 fingerprint of the sample. These fingerprints can in a second stage be aligned to compare different samples.: "The occurence of MS2 peaks and neutral losses (to the precursor) in each sample is counted and used to generate an MS2 fingerprint of the sample. These fingerprints can in a second stage be aligned"
  • [other] MEMO suits particularly well to compare chemodiverse samples, ie with a poor features overlap, or to compare samples with a strong RT shift, acquired using different LC methods or even different mass spectrometers technology (MaXis Q-ToF vs Q-Exactive).: "MEMO suits particularly well to compare chemodiverse samples, i.e. with a poor features overlap, or to compare samples with a strong RT shift, acquired using different LC methods or even different"
  • [intro] different filtering (remove peaks/losses from blanks for example) and visualization techniques (MDS/PCoA, TMAP, Heatmap, ...) can be used: "different filtering (remove peaks/losses from blanks for example) and visualization techniques (MDS/PCoA, TMAP, Heatmap, ...) can be used"
  • [other] Compute pairwise sample distances from the fingerprint vectors.: "Compute pairwise sample distances from the fingerprint vectors."
  • [other] Generate a 2D scatter plot with samples as points, colored or labeled by group identity if provided.: "Generate a 2D scatter plot with samples as points, colored or labeled by group identity if provided."

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.