agentsclimarketplace

Mass spectrometry image normalization

Skill HolobiomicsLab/asb-skill-collections/packs/metabolomics/ion-mobility/skills/mass-spectrometry-image-normalization

Use when after loading a pixel array (NumPy format) and its associated metadata JSON file from MSIGen, when you need to account for pixel-to-pixel variations in total ion signal or when comparing relative abundances of multiple ions within or across samples.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill mass-spectrometry-image-normalization

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

mass-spectrometry-image-normalization

Summary

Normalize pixel intensity arrays from mass spectrometry imaging (MSI) data to total ion current (TIC) or an internal standard to enable quantitative and comparable visualization across ion images. This corrects for variations in ion abundance and detector response across the sample.

When to use

Apply this skill after loading a pixel array (NumPy format) and its associated metadata JSON file from MSIGen, when you need to account for pixel-to-pixel variations in total ion signal or when comparing relative abundances of multiple ions within or across samples. Use TIC normalization when absolute signal variations are expected and should be corrected; use internal standard normalization when a known, stable reference compound is present in the sample and you want intensity ratios relative to that standard.

When NOT to use

  • When the pixel array has already been normalized or when you are working with preprocessed, vendor-supplied normalized images
  • When no suitable internal standard is available in the sample and TIC variation is not a meaningful correction for your biological question
  • When processing data from imaging modalities other than line-scan nano-DESI MSI, as MSIGen is designed specifically for nano-DESI MSI line-scan data

Inputs

  • NumPy pixel array (from MSIGen load_pixels output)
  • metadata JSON file with mass list, image dimensions, and standard information
  • mass list file (Excel or compatible format) with m/z, precursor m/z, fragment m/z, ion mobility, and charge for standards

Outputs

  • normalized pixel intensity array (NumPy format)
  • publication-style ion images (PNG/PDF)
  • raw normalized images (NumPy arrays or CSV)
  • normalized metadata file documenting normalization mode and parameters applied

How to apply

Load the pixel array and metadata using MSIGen's load_pixels() function. Choose a normalization mode: 'TIC' to normalize each pixel to its total ion current, 'intl_std' to normalize to an internal standard, or 'none' to skip normalization. If using 'intl_std', identify the internal standard by mass list index (std_idx) or by matching precursor m/z, fragment m/z, ion mobility, and charge parameters (std_precursor, std_mass, std_fragment, std_mobility, std_charge). Call get_and_display_images() with the chosen normalize parameter and standard identifiers. Optionally apply pixel intensity scaling via the scale parameter (e.g., scale=0.999 sets maximum to the 99.9th percentile of pixel intensities) or manual threshold to improve dynamic range. Save the normalized output according to image_savetype (e.g., publication figures, raw images, or CSV arrays).

Related tools

  • MSIGen (Core package providing load_pixels(), get_and_display_images(), and normalization parameter handling) — https://github.com/LabLaskin/MSIGen
  • Python (Runtime environment; MSIGen requires Python >=3.9 and <=3.11)
  • Jupyter Notebook (Interactive environment for loading pixels, configuring normalization parameters, and visualizing results)
  • NumPy (Array data structure for pixel intensity matrices)
  • pyBaf2Sql (Optional dependency for reading Bruker .baf format raw data files into MSIGen) — https://github.com/gtluu/pyBaf2Sql

Examples

pixels, metadata = msigen.load_pixels(load_path); vis.get_and_display_images(pixels, metadata, normalize='TIC', scale=0.999, image_savetype='fig')

Evaluation signals

  • Normalized pixel arrays have intensity distributions appropriate to the chosen method: TIC-normalized pixels should have similar sums across the image; internal standard-normalized pixels should reflect relative abundance ratios to the standard
  • Metadata JSON retains all normalization parameters (normalize mode, std_idx, std_precursor, scale, threshold) for reproducibility and audit trail
  • Visually inspected ion images show improved contrast and reduced artifactual spatial variation compared to unnormalized raw images, particularly when scale or threshold parameters are applied
  • Output image dimensions (height, width) match the input pixel array and metadata specifications
  • No infinity or NaN values appear in the normalized array (or are explicitly documented in handle_infinity parameter for ratio images if used downstream)

Limitations

  • TIC normalization assumes that total ion current is a reliable proxy for sample abundance; it may fail or be misleading if ion suppression or enhancement varies spatially across the sample
  • Internal standard normalization requires that the standard compound is uniformly distributed across the sample area; inhomogeneous standard distribution will produce incorrect relative intensity maps
  • Quantile-based scaling (scale parameter) is sensitive to outlier pixels; extreme signals in a small region can compress the dynamic range of the rest of the image
  • MSIGen is designed with nano-DESI MSI in mind; applicability to other MSI acquisition modes (e.g., MALDI, ambient ionization) has not been validated in the article

Evidence

  • [other] MSIGen supports image normalization to total ion current (TIC) via normalize='TIC' parameter and to an internal standard via normalize='intl_std' parameter when processing pixel arrays.: "MSIGen supports image normalization to total ion current (TIC) via normalize='TIC' parameter and to an internal standard via normalize='intl_std' parameter"
  • [other] Load the pixel array (NumPy format) and associated metadata JSON file using MSIGen's load_pixels function. Select normalization mode and, if using internal standard, identify the standard by mass list index (std_idx) or by matching precursor m/z, fragment m/z, mobility, and charge parameters.: "Load the pixel array (NumPy format) and associated metadata JSON file using MSIGen's load_pixels function. 2. Select normalization mode ('TIC', 'intl_std', or 'none') and, if using internal standard,"
  • [other] Call MSIGen's get_and_display_images function with the chosen normalization parameters (normalize, std_idx, std_precursor, std_mass, std_fragment, std_mobility, std_charge) to apply normalization across all image layers.: "Call MSIGen's get_and_display_images function with the chosen normalization parameters (normalize, std_idx, std_precursor, std_mass, std_fragment, std_mobility, std_charge) to apply normalization"
  • [other] Optionally apply pixel intensity scaling via scale parameter (quantile-based; e.g., 0.999 sets max to 99.9th percentile) or manual threshold.: "Optionally apply pixel intensity scaling via scale parameter (quantile-based; e.g., 0.999 sets max to 99.9th percentile) or manual threshold."
  • [readme] MSIGen is designed for converting mass spectrometry imaging (MSI) data from the raw line-scan data to a visualizable format and is designed with nano-DESI MSI in mind.: "MSIGen is designed for converting mass spectrometry imaging (MSI) data from the raw line-scan data to a visualizable format and is designed with nano-DESI MSI in mind."

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.