agentsclimarketplace

Mass spectrometry imaging data import

Skill HolobiomicsLab/asb-skill-collections/packs/metabolomics/ms-imaging/skills/mass-spectrometry-imaging-data-import

Use when you have raw MS imaging data in imzML (continuous or processed) or Analyze 7.5 format and need to load it into R for spectral processing, normalization, peak-picking, or statistical analysis.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill mass-spectrometry-imaging-data-import

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 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

6.9 KB, ~1.3k tokens by cl100k_base, as published. Nobody here has run it

mass-spectrometry-imaging-data-import

Summary

Import raw mass spectrometry imaging datasets in imzML or Analyze 7.5 formats into Cardinal's MSImagingExperiment or MSImagingArrays objects for downstream statistical analysis and visualization. This skill validates that spectral dimensions, m/z features, and pixel coordinates are correctly parsed and retained in memory or as out-of-memory references.

When to use

You have raw MS imaging data in imzML (continuous or processed) or Analyze 7.5 format and need to load it into R for spectral processing, normalization, peak-picking, or statistical analysis. Use this skill as the first step in any Cardinal-based MS imaging workflow, before any pre-processing or analysis method.

When NOT to use

  • Input is already a processed feature table or peak intensity matrix (use readMSIData() only for raw vendor or mzML/imzML formats).
  • Data is already loaded as an MSImagingExperiment in memory or you only need to append new columns (use accessor or merge methods instead).
  • Input file is in a non-standard format not supported by Cardinal (e.g., vendor-proprietary binary without imzML or Analyze 7.5 export).

Inputs

  • imzML file (continuous or processed format)
  • Analyze 7.5 format file (.hdr, .img, .t2m)
  • File path (character string)

Outputs

  • MSImagingExperiment object (in-memory spectral imaging matrix with pixel coordinates and m/z features)
  • MSImagingArrays object (out-of-memory spectral imaging matrix backed by matter)
  • SpectralImagingData or SpectralImagingExperiment object (new class hierarchy in Cardinal 3.6)

How to apply

Load the Cardinal package using library(Cardinal), then call readMSIData() with the file path to your imzML or Analyze 7.5 file. The function automatically parses file headers to infer whether the format is 'continuous' (raw unprocessed spectra with shared m/z axes) or 'processed' (centroided peaks), and returns an MSImagingExperiment object (in-memory) or MSImagingArrays (out-of-memory) depending on dataset size. Verify the resulting object by inspecting its class, confirming pixel count (nrow), m/z feature count (ncol), and the integrity of the mass spectral data matrix. For out-of-memory datasets, readMSIData() provides transparent backing via the matter package.

Related tools

  • Cardinal (Primary package providing readMSIData() function and MSImagingExperiment/MSImagingArrays class definitions) — https://github.com/kuwisdelu/Cardinal
  • matter (Provides out-of-memory array backing for MSImagingArrays when datasets exceed RAM)
  • CardinalIO (Provides example imzML files (continuous and processed) for testing and validation)
  • BiocManager (Package manager for installing Cardinal and its Bioconductor dependencies)

Examples

library(Cardinal); path_continuous <- CardinalIO::exampleImzMLFile('continuous'); msi_obj <- readMSIData(path_continuous); msi_obj

Evaluation signals

  • Returned object has class MSImagingExperiment or MSImagingArrays (or parent SpectralImagingExperiment in Cardinal 3.6+).
  • Pixel count (nrow) and m/z feature count (ncol) match the declared dimensions in the imzML file header or Analyze 7.5 metadata.
  • All spectra share identical m/z values (for continuous imzML) or have variable m/z axes (for processed imzML); inspect mz(object) to confirm.
  • Spectral intensity values are numeric, non-negative, and preserve the dynamic range of the raw data (no unexpected truncation or scaling).
  • Pixel coordinate matrix (pixelData) contains spatial (x, y) and optional (z) positions matching the number of spectra.

Limitations

  • readMSIData() does not automatically align or recalibrate m/z axes across spectra; use recalibrate() post-import if needed.
  • Continuous imzML files are expected to have all spectra sharing the same m/z axis; processed imzML with variable m/z per spectrum require separate handling.
  • Out-of-memory MSImagingArrays objects may be slower for certain operations (e.g., random-access peak picking) compared to in-memory MSImagingExperiment.
  • No built-in validation of imzML file integrity or corruption; malformed files may produce cryptic errors or silent data loss.

Evidence

  • [intro] readMSIData() function for imzML and Analyze 7.5 formats: "Cardinal natively supports reading and writing imzML (both 'continuous' and 'processed' types) and Analyze 7.5 formats via the readMSIData() and writeMSIData() functions"
  • [intro] MSImagingExperiment and MSImagingArrays classes: "Updated MSImagingExperiment class with a new counterpart MSImagingArrays class for better representing raw spectra"
  • [intro] Out-of-memory dataset support via matter: "New imaging experiment classes such as ImagingExperiment, SparseImagingExperiment, and MSImagingExperiment provide better support for out-of-memory datasets"
  • [intro] Continuous vs. processed imzML parsing: "Support for writing imzML in addition to reading it; more options and support for importing out-of-memory imzML for both 'continuous' and 'processed' formats"
  • [readme] Installation via BiocManager: "Cardinal can be installed via the BiocManager package"
  • [readme] Library loading and example imzML retrieval: "Once installed, Cardinal can be loaded with library(): library(Cardinal)"
  • [other] Task validation of readMSIData() on continuous imzML: "Reading the CardinalIO 'continuous' example imzML file with readMSIData() returns an MSImagingExperiment object containing 9 mass spectra each with 8,399 m/z values, where all spectra share the same"

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,852. 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.