agentsclimarketplace

Reference database tolerance mapping

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/reference-database-tolerance-mapping

Curated, evidence-grounded skill and software-tool collections for scientific AI agents, generated by the AgenticScienceBuilder

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill reference-database-tolerance-mapping

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

  • 14 stars14 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 author says it does

Copied from the file, not written here

Use when you have calculated pairwise mass differences from MS peaks (via massdiff()) and binned them into a histogram, and now need to identify which observed mass differences correspond to known molecular adducts (e.g., [M+Na]+, [M+H]+, matrix-related species) rather than random noise.

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

Reference-Database Tolerance Mapping

Summary

Match observed mass differences to known chemical adducts by finding the closest-matching bin in a mass difference histogram within a user-specified tolerance window. This skill annotates mass spectrometry peaks with their likely adduct identities, enabling metabolite annotation and validation.

When to use

You have calculated pairwise mass differences from MS peaks (via massdiff()) and binned them into a histogram, and now need to identify which observed mass differences correspond to known molecular adducts (e.g., [M+Na]+, [M+H]+, matrix-related species) rather than random noise. This is essential when your goal is to annotate the 'dark metabolome'—peaks obscured by adduct formation—or validate parent–adduct ion relationships in MALDI-MSI datasets.

When NOT to use

  • Your mass differences have not yet been binned into a histogram (must call hist() first to account for measurement error and uncertainty)
  • You are working with unbinned, raw mass differences without accounting for instrument precision—closest-bin matching requires a histogram structure
  • Your reference adduct table is incomplete or lacks the required 'name', 'formula', 'mass' columns; the function depends on exact schema match

Inputs

  • massdiff object (data.frame with columns for parent mass A, adduct mass B, mass difference)
  • mass difference histogram (output from hist() applied to massdiff)
  • reference adduct table (data.frame with columns: name, formula, mass)

Outputs

  • annotated massdiff object with 'matches' column listing matched adduct names
  • summary report with matched adduct names, counts per adduct type, and quantile ranks

How to apply

Load a massdiff object (output from massdiff() containing pairwise mass A, B, and difference) and a reference adduct table (built-in 'adducts' or 'adducts2' datasets, or a custom data.frame with columns 'name', 'formula', 'mass'). Apply adductMatch() to find the closest-matching bin in the mass difference histogram for each observed mass difference, using the bin width set during histogram construction (typically 0.01 Da for high-resolution instruments). The function reports the count of ion pairs per adduct type and their quantile ranks. Filter results to retain only matches meeting your significance threshold. The rationale is that true molecular adducts will cluster tightly around reference mass values (within instrument precision), while random mass differences will scatter; the histogram bins aggregate this clustering, and closest-bin matching leverages the fact that molecular adducts are discrete, not continuous.

Related tools

  • mass2adduct (R package providing massdiff(), hist(), and adductMatch() functions for adduct identification workflow) — https://github.com/kbseah/mass2adduct
  • R (Execution environment for mass2adduct package and adductMatch function)
  • Cardinal (Optional: pre-processes MSI data and can convert MSProcessedImagingExperiment or MSContinuousImagingExperiment objects to mass2adduct's msimat format for downstream adduct matching) — http://cardinalmsi.org/

Examples

head(adductMatch(d.diff.hist))

Evaluation signals

  • Matched adducts appear in the output with non-zero counts (not all matches will succeed; zero-count matches indicate poor reference-data alignment)
  • Quantile ranks are reported for each matched adduct; high quantile values (>0.9) are expected because most mass differences are rare or zero-count
  • Ion pairs with successful matches have a new 'matches' column populated with adduct names; unmatched pairs are absent or carry NA
  • The number of unique adducts matched is ≤ the size of the reference table (sanity check: no spurious extra adducts invented)
  • Downstream spatial correlation test (corrPairsMSI) shows significant Pearson correlation (p < 0.05 with Bonferroni correction) between parent and matched adduct ion intensities across pixels, validating the biological relevance of the match

Limitations

  • Matching quality depends critically on histogram bin width (set during hist() call); bin width must reflect true instrument mass precision. If bin width is too wide, multiple distinct adducts will collapse into one bin; if too narrow, true adducts will scatter across bins and fail to match.
  • The function finds only the closest-matching bin; if the reference table is sparse or incomplete, true adducts may not be present and will be missed or matched to the nearest wrong entry.
  • Quantile values are typically very high (skewed toward 1.0) because the majority of mass differences have zero or near-zero counts; this does not reflect biological confidence, only statistical rank. True adducts must be validated by spatial correlation (corrPairsMSI) or other downstream evidence.
  • The method assumes adducts are discrete and well-separated in mass space; overlapping or near-identical adducts in the reference table may cause ambiguous or incorrect assignments.

Evidence

  • [other] The adductMatch function identifies known adducts by finding the closest-matching bin in a mass difference histogram produced from pairwise mass comparisons: "The following function looks for known adducts by finding the closest-matching bin in the mass difference histogram produced above."
  • [other] Reference adduct tables contain biologically-relevant chemical species in standardized format: "There are two built-in data sets adducts and adducts2 (shorter), which list biologically-relevant chemical species"
  • [readme] Histogram binning is essential to handle measurement error and precision: "The calculated mass differences are misleadingly precise, because measurement error and uncertainty are not taken into account. They should be binned into a histogram with a user-specified bin width,"
  • [readme] Output includes matched adduct names, counts, and quantile ranks: "It reports the number of counts (i.e. how many pairs of MS peaks have that mass difference) and the quantile."
  • [readme] Custom adduct tables follow a specific schema: "Users can supply their own custom sets of adducts as long as they are in the same format (as a data.frame with three columns: name, formula, mass)"

Keep looking

Skills are one crate of 328,083. 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.