agentsclimarketplace

Msi preprocessing parameter configuration

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/msi-preprocessing-parameter-configuration

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 msi-preprocessing-parameter-configuration

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 raw line-scan MSI data (from Bruker .d/.baf, converted to .mzML, or other supported formats) and need to configure MSIGen before calling msigen() to generate image arrays.

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

MSI Preprocessing Parameter Configuration

Summary

Define and validate processing parameters (file paths, mass tolerances, image dimensions, normalization mode) before initializing MSIGen for conversion of raw mass spectrometry imaging line-scan data to visualizable NumPy arrays. This skill ensures correct parameter alignment with input data characteristics and desired output resolution.

When to use

Apply this skill when you have raw line-scan MSI data (from Bruker .d/.baf, converted to .mzML, or other supported formats) and need to configure MSIGen before calling msigen() to generate image arrays. Specifically use it when you know the physical image dimensions (height, width in pixels or lines), possess a mass list file (.xlsx format with m/z targets), and must decide on mass tolerance windows (MS1, precursor, fragment, and optional ion mobility) to match peaks correctly.

When NOT to use

  • Input is already a processed NumPy array (.npy) with associated metadata JSON — use msigen.load_pixels() instead.
  • Mass list is in a non-.xlsx format and no conversion step is performed — MSIGen expects .xlsx by design.
  • Image dimensions are unknown and cannot be recovered from acquisition metadata — parameter configuration will fail at runtime.

Inputs

  • Raw MSI data file (Bruker .d/.baf converted to .mzML, or equivalent supported format)
  • Mass list file (.xlsx) with target m/z values
  • Image acquisition metadata (physical dimensions: height, width in pixels; pixels per line)
  • Instrument specifications (mass resolving power or mass accuracy in ppm/Da)

Outputs

  • Configured MSIGen object (msigen instance) ready for get_image_data() call
  • Validated parameter dictionary (file paths, tolerances, dimensions, normalization settings)
  • Log of parameter choices for reproducibility

How to apply

Begin by preparing a mass list file in .xlsx format containing target m/z values, and determine physical image dimensions (img_height, img_width in pixels) and pixels per line from your acquisition metadata. Set mass_tolerance_MS1 and mass_tolerance_MS1_units based on your instrument's resolving power (e.g., 5 ppm for high-resolution or 0.1 Da for lower-resolution instruments); if MS/MS data is present, also specify mass_tolerance_prec and mass_tolerance_frag with corresponding units. If ion mobility dimension exists, set mobility_tolerance and mobility_tolerance_units. Choose normalization mode ('TIC', 'intl_std', or None) based on sample complexity and availability of internal standard m/z values. Pass all parameters to the msigen() constructor (example_file, mass_list_dir, mass_tolerance_MS1, mass_tolerance_MS1_units, img_height, img_width, pixels_per_line, normalize_img_sizes, output_file_loc, and optional normalize). The rationale: correct tolerances prevent false peak matches or missed peaks; accurate dimensions prevent pixel mapping errors; normalization choice affects downstream quantitative interpretation.

Related tools

Examples

msigen_gen = msigen(example_file='/path/to/data.mzML', mass_list_dir='/path/to/mass_list.xlsx', mass_tolerance_MS1=5, mass_tolerance_MS1_units='ppm', img_height=100, img_width=150, pixels_per_line=150, normalize_img_sizes=True, output_file_loc='/output/dir/')

Evaluation signals

  • All required parameters (example_file, mass_list_dir, mass_tolerance_MS1, img_height, img_width, pixels_per_line) are non-null and of expected types (string paths, numeric tolerances, integers for dimensions).
  • Mass tolerance values are physically plausible (e.g., 1–20 ppm for high-resolution MS; 0.05–0.5 Da for lower-resolution; mobility tolerance in range 0.01–0.1 1/K0 if applicable).
  • Image dimensions (img_height × img_width) match the total expected pixel count from acquisition metadata (e.g., number_of_lines × pixels_per_line).
  • Subsequent call to get_image_data(verbose=True) completes without ValueError or KeyError related to missing parameters or type mismatches.
  • Output NumPy array (pixels.npy) has shape (num_masses, img_height, img_width) matching configured dimensions and mass list length; metadata JSON contains entries for all configured tolerance windows and normalization mode.

Limitations

  • Parameter configuration assumes mass list is already in .xlsx format; no automatic format conversion is provided within MSIGen.
  • Ion mobility tolerance is only applicable if input data contains ion mobility dimension (e.g., TIMS-TOF); setting mobility_tolerance on non-mobility data has no effect but does not error.
  • Normalization to internal standard ('intl_std' mode) requires that the internal standard m/z is present in the mass list; if absent, normalization defaults to TIC without warning.
  • Image dimensions must be known a priori from acquisition metadata; MSIGen cannot auto-detect dimensions from .mzML metadata and will fail if dimensions are misspecified.
  • Python version must be >=3.9 and <=3.11 for pyBaf2Sql compatibility; versions outside this range may cause installation or runtime errors during parameter setup.

Evidence

  • [methods] Define processing parameters including file path, mass list, tolerances, image dimensions: "example_file, mass_list_dir, mass_tolerance_MS1, img_height, img_width, normalize_img_sizes, pixels_per_line, output_file_loc"
  • [methods] MSIGen processes MSI data with mass and dimension configuration: "mass_tolerance_MS1, mass_tolerance_MS1_units for matching m/z values in MS1 spectra"
  • [methods] Ion mobility tolerance filtering for multi-dimensional MSI: "mobility_tolerance, mobility_tolerance_units for matching ion mobility values"
  • [methods] Normalization mode selection during parameter configuration: "normalize = 'TIC' to normalize the images to total ion current"
  • [methods] Environment and version constraints for parameter setup: "Using an environment with python version >=3.9 and <=3.11"
  • [methods] MSIGen initialization with configured parameters: "MSIGen_generator = msigen(example_file=example_file, mass_list_dir=mass_list_dir, ...)"
  • [methods] Mass list file format requirement: "An example mass list file is included in the GitHub repository (https://github.com/LabLaskin/MSIGen/blob/main/other_files/example_mass_list.xlsx)"
  • [methods] Precursor and fragment ion tolerance for MS/MS data: "mass_tolerance_prec, mass_tolerance_prec_units for precursor ions in MS2 spectra"

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.