agentsclimarketplace

Msimagingexperiment subset operations

Skill HolobiomicsLab/asb-skill-collections/packs/metabolomics/ms-generic/skills/msimagingexperiment-subset-operations

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 msimagingexperiment-subset-operations

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 after peak alignment with peakAlign(), when you have an MSImagingExperiment with many detected peaks but want to retain only those present in a sufficient fraction of pixels.

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

5.6 KB, as published. Nobody here has run it

MSImagingExperiment subset operations

Summary

Subset features in a Cardinal MSImagingExperiment object based on frequency thresholds to retain only peaks present in a minimum proportion of pixels. This skill filters detected and aligned peaks to reduce feature dimensionality while preserving spatially informative mass-to-charge ratios.

When to use

After peak alignment with peakAlign(), when you have an MSImagingExperiment with many detected peaks but want to retain only those present in a sufficient fraction of pixels. Use this when peak sparsity is high and you need to focus statistical analysis on robustly observed features rather than rare or noisy peaks.

When NOT to use

  • Peak alignment has not yet been applied — subsetFeatures() operates on aligned peak sets, not raw detected peaks.
  • You require all detected peaks for downstream statistical modeling that explicitly handles sparsity (e.g., zero-inflated models).
  • Your analysis goal is to preserve rare or region-specific biomarkers that appear in <10% of pixels.

Inputs

  • MSImagingExperiment object (post-peakAlign)
  • frequency threshold parameter (numeric, typically 0.0–1.0)

Outputs

  • MSImagingExperiment object with filtered featureData
  • Subset of peaks meeting frequency criterion

How to apply

Apply subsetFeatures() to the aligned MSImagingExperiment object with a frequency threshold parameter (e.g., freq > 0.1 to retain peaks present in >10% of pixels). The function filters the featureData by computing the proportion of non-zero or detected peaks in each m/z bin across all spectra and removes those failing the threshold. This reduces feature dimensionality while preserving peaks with consistent spatial or spectral support. Verify the output by checking the featureData of the resulting MSImagingExperiment to confirm the expected number of retained peaks.

Related tools

  • Cardinal 3.6 (Provides peakAlign() for pre-subset peak alignment and subsetFeatures() for frequency-based filtering of MSImagingExperiment featureData) — https://github.com/kuwisdelu/Cardinal
  • R (Execution environment for loading Cardinal library and running subset operations)
  • BiocParallel (Optional parallel processing backend for accelerating subset operations on large imaging datasets)

Examples

# Load Cardinal, import aligned MSImagingExperiment, and subset to peaks with frequency > 0.1
library(Cardinal)
mse_aligned <- peakAlign(mse_detected)
mse_filtered <- subsetFeatures(mse_aligned, freq > 0.1)
print(nrow(featureData(mse_filtered)))  # Should print 37

Evaluation signals

  • Verify featureData of the output MSImagingExperiment contains exactly the expected number of peaks after filtering (e.g., 37 peaks for freq > 0.1 threshold).
  • Confirm all retained peaks have frequency ≥ threshold across the imaging dataset pixels.
  • Check that no peaks below the frequency threshold remain in the output object.
  • Validate that the m/z values and other feature annotations are preserved correctly in the filtered featureData.
  • Compare feature count before and after subsetting to ensure expected magnitude of dimensionality reduction.

Limitations

  • Threshold selection (e.g., 0.1) is user-defined and may require empirical justification or sensitivity analysis; no guidance is provided in the article for threshold selection.
  • Frequency is computed across all pixels; spatial heterogeneity or region-specific peaks with lower global frequency will be discarded.
  • The skill assumes peaks are already aligned; misalignment prior to subsetting will produce spurious frequency counts.

Evidence

  • [other] Peak frequency filtering via subsetFeatures: "Subset features using subsetFeatures() with a frequency threshold of > 0.1 to retain only peaks present in >10% of pixels."
  • [other] Output verification on featureData: "Verify that the featureData of the resulting MSImagingExperiment contains exactly 37 peaks."
  • [intro] MSImagingExperiment class structure: "Updated MSImagingExperiment class with a new counterpart MSImagingArrays class for better representing raw spectra"
  • [other] Peak alignment prerequisite: "Apply peakAlign() to align detected peaks across all spectra in the imaging dataset."

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.