agentsclimarketplace

Msi data format interoperability

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v1/skills/msi-data-format-interoperability

Use when your MSI data is stored in a Cardinal imaging experiment object (version 2.2+) that has already been peak-binned with peakBin(), and you want to run mass2adduct's massdiff() and adductMatch() pipeline without manually exporting to CSV;From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill msi-data-format-interoperability

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

Convert Cardinal MSI Objects to mass2adduct-Compatible Format

Summary

Converts Cardinal's MSProcessedImagingExperiment or MSContinuousImagingExperiment objects to the msimat matrix format required by downstream mass2adduct analysis, enabling seamless integration of Cardinal-preprocessed MSI data into adduct detection pipelines.

When to use

Your MSI data is stored in a Cardinal imaging experiment object (version 2.2+) that has already been peak-binned with peakBin(), and you want to run mass2adduct's massdiff() and adductMatch() pipeline without manually exporting to CSV; or your workflow already uses Cardinal for preprocessing and you wish to avoid intermediate file I/O.

When NOT to use

  • Your MSI data has not yet been peak-binned; cardinal2msimat() requires processed Cardinal objects with a defined peaklist, not raw imaging experiments.
  • You are importing MSI data from non-Cardinal sources (e.g., MSiReader, SCiLS); use the CSV-based msimat() function instead.
  • You only need to extract m/z values without pixel intensity information; use scan() on a plain-text mass list instead.

Inputs

  • Cardinal MSProcessedImagingExperiment or MSContinuousImagingExperiment object (version 2.2+)
  • Must be pre-processed with peak binning (peakBin() applied)
  • ImzML or vendor-native MSI file loaded via readImzML()

Outputs

  • msimat object (mass intensity matrix with classes 'msimat' and 'data.frame')
  • Rows represent m/z peaks, columns represent image pixels
  • Preserves intensity values for downstream spatial correlation tests

How to apply

After preprocessing your Cardinal object with normalize(), smoothSignal(), reduceBaseline(), peakBin(peaklist), and process(), pass the resulting MSProcessedImagingExperiment or MSContinuousImagingExperiment object to cardinal2msimat(). This function extracts the peak intensities and spatial coordinates, reformatting them into the msimat class (a matrix where rows are m/z values and columns are pixel locations). Verify the conversion succeeded by comparing the peak histogram from the original Cardinal object (plot(d_peaks)) with the msimat histogram (plot(d_msimat))—they should be visually identical. The output msimat object is then ready for massdiff() to compute all pairwise mass differences across pixels.

Related tools

  • Cardinal (Preprocesses raw MSI data (normalize, smooth, reduce baseline, peak bin) before format conversion) — http://cardinalmsi.org/
  • mass2adduct (Receives msimat output to compute pairwise mass differences and match adducts) — https://github.com/kbseah/mass2adduct
  • R (Execution environment; required for loading Cardinal and running cardinal2msimat())

Examples

d <- readImzML("msi_file"); d_peaks <- d %>% normalize() %>% smoothSignal() %>% reduceBaseline() %>% peakBin(peaklist) %>% process(); d_msimat <- cardinal2msimat(d_peaks); d.diff <- massdiff(d_msimat)

Evaluation signals

  • Output object has class 'msimat' and can be printed with standard R print() to show row (m/z) and column (pixel) dimensions.
  • Peak histogram from converted msimat (plot(d_msimat)) matches the histogram from the original Cardinal object (plot(d_peaks)) visually and quantitatively (same peak positions and relative heights).
  • Intensity values are preserved: spot-check several m/z peaks by comparing intensity profiles in Cardinal vs. msimat using indexing (e.g., d_msimat[1, 1:10]).
  • The msimat object is compatible with downstream mass2adduct functions: massdiff(d_msimat) runs without error and returns a massdiff object.
  • Spatial dimensions match: number of columns in msimat equals the total number of pixels in the original Cardinal imaging experiment.

Limitations

  • Requires Cardinal version 2.2 or later; earlier versions lack MSProcessedImagingExperiment and MSContinuousImagingExperiment classes.
  • Data must be pre-processed and peak-binned before conversion; raw, unpeak-binned Cardinal objects cannot be converted.
  • Large MSI datasets (hundreds of thousands of peaks × millions of pixels) may consume significant memory even after conversion; consider sparse triplet format for very large files (via msimunging.pl).
  • The conversion preserves only intensity information and peak lists; metadata such as scan times, instrument parameters, or custom annotations in the Cardinal object are not transferred to msimat.

Evidence

  • [readme] Cardinal MSProcessedImagingExperiment or MSContinuousImagingExperiment objects (requires Cardinal v2.2 and above) can be converted to mass2adduct's msimat format. However, the data must first be pre-processed, with peaks already binned with the peakBin() function from Cardinal.: "Cardinal MSProcessedImagingExperiment or MSContinuousImagingExperiment objects (requires Cardinal v2.2 and above) can be converted to mass2adduct's msimat format. However, the data must first"
  • [methods] If you are using Cardinal to process your MSI data, data objects in the MSProcessedImagingExperiment or MSContinuousImagingExperiment formats can be converted to mass2adduct's msimat format: "If you are using Cardinal to process your MSI data, data objects in the MSProcessedImagingExperiment or MSContinuousImagingExperiment formats can be converted to mass2adduct's msimat format"
  • [readme] Compare peak histograms from Cardinal vs mass2adduct, should look the same: "Compare peak histograms from Cardinal vs mass2adduct, should look the same"
  • [readme] Pre-process and peak bin with existing peaklist: d_peaks <- d %>% normalize() %>% smoothSignal() %>% reduceBaseline() %>% peakBin(peaklist) %>% process; Convert to msimat format for mass2adduct: d_msimat <- cardinal2msimat(d_peaks): "d_peaks <- d %>% normalize() %>% smoothSignal() %>% reduceBaseline() %>% peakBin(peaklist) %>% process; d_msimat <- cardinal2msimat(d_peaks)"
  • [methods] Take all possible pairs of masses and calculate the mass difference for each pair. These mass differences represent potential molecular adducts.: "Take all possible pairs of masses and calculate the mass difference for each pair. These mass differences represent potential molecular adducts."

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.