agentsclimarketplace

Unit test validation for preprocessing

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/unit-test-validation-for-preprocessing

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 unit-test-validation-for-preprocessing

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 implementing or modifying basic peak filtering operations (e.g., low-intensity peak removal, intensity normalization) on mass spectrometry spectral data in supported formats (mzML, mzXML, msp, MGF, JSON).

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.4 KB, as published. Nobody here has run it

unit-test-validation-for-preprocessing

Summary

Validate mass spectrometry data preprocessing operations (peak filtering, normalization, metadata cleaning) by running automated unit tests to confirm that filtering logic preserves data integrity and produces expected output. This ensures reproducible, correct transformation of raw spectral data into cleaned peak lists.

When to use

After implementing or modifying basic peak filtering operations (e.g., low-intensity peak removal, intensity normalization) on mass spectrometry spectral data in supported formats (mzML, mzXML, msp, MGF, JSON). Apply this skill before exporting pre-processed spectral data to confirm that filtering logic is correct and does not introduce unintended artifacts.

When NOT to use

  • When preprocessing code is not yet implemented; write or modify the code first, then test.
  • When input spectra are already validated and in final form; this skill targets pre-processed data quality assurance during pipeline development.
  • When only performing exploratory data analysis without modifying preprocessing logic; unit tests are unnecessary for read-only analysis.

Inputs

  • Raw mass spectrometry spectral data (mzML, mzXML, msp, MGF, or JSON format)
  • Preprocessing code implementing peak filtering and normalization
  • Existing pytest test suite

Outputs

  • Pytest test results (pass/fail status for each test case)
  • Coverage report indicating which filtering branches are exercised
  • Validated preprocessing code ready for export or integration

How to apply

Write or extend pytest test cases that validate the output of each peak filtering step applied to representative mass spectra. Tests should verify: (1) low-intensity or noise peaks are removed according to configured thresholds; (2) peak intensity normalization produces values in the expected range (e.g., 0–1 or 0–100); (3) metadata fields remain intact after peak list modification; (4) filtered spectra retain correct m/z and intensity correspondence. Run the full test suite using pytest to ensure both new filtering logic and existing preprocessing functionality pass. Verify that test output reports no failures and coverage includes all major filtering branches.

Related tools

  • pytest (Execute automated unit tests to validate peak filtering and preprocessing logic correctness) — https://github.com/matchms/matchms
  • matchms (Provides peak filtering operations and test infrastructure for mass spectrometry preprocessing validation) — https://github.com/matchms/matchms
  • Python (Language for implementing test cases and preprocessing functions)

Examples

pytest tests/ -v --cov=matchms.filtering

Evaluation signals

  • All pytest test cases pass without failures or errors; pytest exit code is 0.
  • Test coverage report shows ≥80–90% coverage of peak filtering functions, including branches for low-intensity removal and normalization.
  • Peak intensity values in filtered spectra fall within expected ranges (e.g., 0–1 after normalization); m/z arrays remain monotonic and aligned with intensity arrays.
  • Metadata fields (e.g., precursor_mz, compound name) are preserved unchanged after peak filtering; no unintended loss of spectral annotations.
  • Regression tests confirm that existing filtering behavior is not disrupted by new code; previously passing tests continue to pass.

Limitations

  • Unit tests validate logic correctness but do not assess biological or chemical validity of filtered spectra; domain-specific review is still necessary.
  • Test suite coverage depends on quality and comprehensiveness of test cases; edge cases (e.g., spectra with very few peaks, extreme m/z ranges) may not be covered by default tests.
  • Pytest does not detect performance regressions (e.g., filtering becoming slower); additional profiling tools are needed to monitor runtime.
  • Tests validate matchms preprocessing in isolation; integration testing with downstream similarity comparisons or spectral library matching requires separate workflow validation.

Evidence

  • [other] Validate filtered peak lists pass existing pytest test suite to confirm filtering logic is correct: "Validate filtered peak lists pass existing pytest test suite to confirm filtering logic is correct."
  • [other] make sure the existing tests still work by running pytest: "make sure the existing tests still work by running pytest"
  • [other] Apply basic peak filtering operations including peak removal (e.g., low-intensity or noise peaks) and peak intensity normalization to ensure data accuracy and integrity: "Apply basic peak filtering operations including peak removal (e.g., low-intensity or noise peaks) and peak intensity normalization to ensure data accuracy and integrity."
  • [intro] Matchms offers an array of tools for metadata cleaning and validation, alongside basic peak filtering, to ensure data accuracy and integrity: "Matchms offers an array of tools for metadata cleaning and validation, alongside basic peak filtering, to ensure data accuracy and integrity"

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.