Skip to content

Bring mass spec utilities into ViMMS - #331

Merged
joewandy merged 1 commit into
mainfrom
jw/retrieve-ms-utils
Jul 3, 2026
Merged

joewandy merged 1 commit into
mainfrom
jw/retrieve-ms-utils

Conversation

@joewandy

@joewandy joewandy commented Jul 3, 2026

Copy link
Copy Markdown
Member

Summary

Copy the mass-spec-utils code currently used by ViMMS back into this repository as vimms.mass_spec_utils, then update ViMMS imports to use the internal package.

This removes the runtime dependency on the unmaintained external mass-spec-utils package while keeping behavior as mechanical as possible.

Changes

  • Added vimms/mass_spec_utils/ with the utility modules ViMMS already depended on:
    • adduct calculation
    • mzML and MZmine import helpers
    • MZmine processing helpers
    • peak alignment helpers
    • library matching helpers
  • Rewrote ViMMS imports from mass_spec_utils... to vimms.mass_spec_utils....
  • Removed mass-spec-utils from Poetry dependencies.
  • Added direct dependencies for packages previously pulled in through mass-spec-utils: molmass and sortedcontainers.
  • Regenerated poetry.lock.

Validation

Ran with the vimms conda environment:

  • python -m compileall -q vimms tests
  • direct import smoke check for copied modules
  • pytest -q tests/test_chemical_generation.py -> 17 passed
  • pytest -q tests/test_controllers_targeted.py tests/test_feature_dsda.py tests/test_more_coverage.py -> 12 passed
  • poetry check -> passed with existing Poetry metadata deprecation warnings
  • poetry install --no-interaction --no-root
  • pytest -q -> 148 passed, 2 warnings
  • git diff --check

Fixes #274.

@joewandy
joewandy force-pushed the jw/retrieve-ms-utils branch from e717cd5 to bbb082c Compare July 3, 2026 16:49
@joewandy
joewandy marked this pull request as ready for review July 3, 2026 17:02
@joewandy
joewandy merged commit 3156627 into main Jul 3, 2026
3 checks passed
@joewandy
joewandy deleted the jw/retrieve-ms-utils branch July 3, 2026 17:04

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bbb082c3b0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pyproject.toml
pymzml = "^2.5.11"
psims = "^1.3.5"
mass-spec-utils = "^0.0.12"
molmass = "^2025.4.14"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update notebook imports after vendoring

Removing mass-spec-utils here leaves checked-in example notebooks that still import the old top-level package, so a fresh Poetry install from this commit can no longer run them without an undeclared extra install. I searched the repo and found live code cells such as examples/02. DDA Strategies (Davies et al 2020)/01. Model Optimisation.ipynb and the DDA-vs-DIA notebooks still using from mass_spec_utils...; either rewrite those to vimms.mass_spec_utils... or provide a compatibility alias before dropping the dependency.

Useful? React with 👍 / 👎.

try:
precursor_mz = scan.selected_precursors[0]['mz']
except:
precursot_mz = None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reset missing MS2 precursors instead of reusing the last one

When an MS2 scan has no selected_precursors, this typo assigns precursot_mz and leaves precursor_mz unchanged from the previous loop iteration. In mzML files with consecutive MS2 scans where one omits precursor metadata, that scan is recorded with the previous precursor m/z, which can make map_boxes_to_scans and downstream MS2 matching attach fragments to the wrong feature; set precursor_mz = None in the exception path.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Retrieve mass-spec-utils Code

1 participant