agentsclimarketplace

Spectral reference peak summarization

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/spectral-reference-peak-summarization

Use when after peak picking and alignment have been performed on preprocessed spectra (normalized, smoothed, and baseline-reduced), and you need to create a unified peak reference table that can be applied consistently across all spectra in an imaging dataset.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill spectral-reference-peak-summarization

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

spectral-reference-peak-summarization

Summary

Aggregate detected and aligned peaks across a subset of mass spectrometry imaging spectra to create reference peak positions, then summarize these positions for every spectrum in the full dataset. This skill transforms preprocessed MSImagingArrays data into an aligned, filtered MSImagingExperiment with consistent peak annotations across the imaging array.

When to use

After peak picking and alignment have been performed on preprocessed spectra (normalized, smoothed, and baseline-reduced), and you need to create a unified peak reference table that can be applied consistently across all spectra in an imaging dataset. Use this when working with MSImagingArrays data where you want to reduce m/z alignment noise and establish a canonical set of peaks for downstream statistical analysis or classification.

When NOT to use

  • Input is already a feature table or peak intensity matrix — peakProcess() is a detection and summarization step, not a transformation of pre-computed features.
  • Spectra have not been preprocessed (normalized, smoothed, baseline-reduced) — reference peak quality depends on clean input spectra.
  • You require peak picking on the full dataset without subset sampling — sampleSize=1.0 may be computationally expensive but is supported if necessary.

Inputs

  • MSImagingArrays object (preprocessed with normalization, smoothing, and baseline reduction)
  • Peak picking results (detected peaks with m/z positions and intensities)
  • Alignment information (spectral alignment warping or local maxima correspondences)

Outputs

  • MSImagingExperiment object with reference peak table
  • Peak feature matrix (features × spectra)
  • Reference peak metadata (m/z positions, frequency, SNR per peak)

How to apply

First, apply peakProcess() with method='diff' to detect and align peaks across a representative subset of spectra (controlled by sampleSize parameter, e.g., 0.3 for 30% of spectra). Specify noise estimation parameters (SNR=6, filterFreq=0.02) to filter out weak or low-frequency peaks during reference creation. The function aggregates detected peaks into reference peak positions by finding consensus m/z values across the subset. Finally, summarize these reference peaks for every spectrum in the full dataset, outputting an MSImagingExperiment object containing the reference peak table and associated metadata. Optionally apply quality filtering by frequency threshold or signal-to-noise ratio to further refine the reference peaks.

Related tools

  • Cardinal (Primary package implementing peakProcess() function and MSImagingArrays/MSImagingExperiment classes for peak detection, alignment, and summarization) — github.com/kuwisdelu/Cardinal
  • BiocParallel (Enables parallel processing of peakProcess() via BPPARAM option to accelerate peak detection across large imaging arrays)
  • matter (Underlying low-level signal processing library providing efficient handling of out-of-memory spectra data structures)

Examples

library(Cardinal); data <- readMSIData("data.imzML"); data_proc <- normalize(data) %>% smooth() %>% reduceBaseline(); peaks <- peakProcess(data_proc, method="diff", SNR=6, sampleSize=0.3, filterFreq=0.02); summary_peaks <- featureApply(peaks, fun=mean)

Evaluation signals

  • Output MSImagingExperiment contains non-zero reference peak table with m/z positions and frequencies matching input spectra alignment.
  • Number of reference peaks is substantially smaller than total number of peaks detected in raw data (compression confirms successful summarization).
  • Peak intensity values in full dataset are aligned to reference m/z values with minimal m/z drift (verify via histogram of peak position residuals).
  • Quality metrics (SNR, frequency) of reference peaks meet specified thresholds (SNR ≥ 6, filterFreq ≥ 0.02 in this example).
  • Downstream statistical analysis (e.g., PCA, clustering) shows improved separation and reproducibility compared to non-summarized peaks.

Limitations

  • Reference peak quality depends heavily on the sampleSize parameter — too small a subset may miss rare or low-intensity peaks; too large risks computational overhead.
  • Peak summarization assumes spectra are adequately aligned before reference creation; misalignment will produce multiple reference peaks for the same true m/z.
  • Filtering by frequency threshold (filterFreq) removes infrequent peaks, which may discard biologically relevant features that are present in only a subset of pixels.
  • Out-of-memory datasets require Cardinal 3.6+ support for continuous and processed imzML formats; older versions may require data subsetting.

Evidence

  • [other] peakProcess() performs peak picking and alignment on a subset of spectra (specified by sampleSize) to create reference peaks, then summarizes these reference peaks for every spectrum in the full dataset: "peakProcess() performs peak picking and alignment on a subset of spectra (specified by sampleSize) to create reference peaks, then summarizes these reference peaks for every spectrum in the full"
  • [other] Apply peakProcess() function in Cardinal to detect and align peaks across all spectra, using specified noise estimation and peak filtering parameters: "Apply peakProcess() function in Cardinal to detect and align peaks across all spectra, using specified noise estimation and peak filtering parameters"
  • [other] Filter peaks according to quality criteria (e.g., frequency threshold, signal-to-noise ratio): "Filter peaks according to quality criteria (e.g., frequency threshold, signal-to-noise ratio)"
  • [intro] New peak picking methods in peakPick(): Derivative-based noise estimation, Quantile-based noise estimation, SD/MAD-based noise estimatino, Dynamic peak filtering, Continuous wavelet transform (CWT): "New peak picking methods in peakPick(): Derivative-based noise estimation, Quantile-based noise estimation, SD/MAD-based noise estimatino, Dynamic peak filtering"
  • [intro] Updated MSImagingExperiment class with a new counterpart MSImagingArrays class for better representing raw spectra: "Updated MSImagingExperiment class with a new counterpart MSImagingArrays class for better representing raw spectra"
  • [intro] Parallel processing support via the BiocParallel package for all pre-processing methods and any statistical analysis methods with a BPPARAM option: "Parallel processing support via the BiocParallel package for all pre-processing methods and any statistical analysis methods with a BPPARAM option"

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.