Skip to content

Route all spectrum reading through open_spectra; unpin AlphaFold models - #3

Merged
lfu46 merged 2 commits into
mainfrom
open-spectra-routing
Aug 22, 2026
Merged

Route all spectrum reading through open_spectra; unpin AlphaFold models#3
lfu46 merged 2 commits into
mainfrom
open-spectra-routing

Conversation

@lfu46

@lfu46 lfu46 commented Aug 22, 2026

Copy link
Copy Markdown
Owner

All spectrum reading now goes through the cache-aware mzml_utils.open_spectra instead of instantiating MzMLReader directly, and the AlphaFold model lookup no longer pins a version (resolved via mzml_utils.structure). CLAUDE.md updated to point at open_spectra.

lfu46 and others added 2 commits August 4, 2026 20:35
Four global rules were violated across the active analysis scripts. None
changes any output today; each removes a way the scripts break tomorrow.

pyteomics.mzml (4 scripts) streamed whole calibrated mzML files to pull a
handful of scans, re-deriving precursor m/z, filter string and RT from raw
dict paths. Replaced with indexed reader.get_spectrum(). The two
extract_spectrum_data() helpers keep their contract exactly: None for a
missing scan, and precursor keys left absent for MS1 -- get_spectrum reports
precursor_mz as 0.0 rather than None there, so the guard is a truthiness
check, matching what callers' .get(..., 0) fallbacks expect.

Direct MzMLReader construction (9 scripts, 13 sites) became open_spectra,
the documented drop-in. With no spectra cache built yet it returns an
MzMLReader, so behaviour is identical now and the cache speedup arrives for
free once one exists.

sys.path.insert of /Users/longpingfu/Downloads/... (4 scripts) pinned this
machine's layout for two packages that are pip-installed editable; verified
both import without them. Removed, along with the imports left unused.

Hard-coded AF-{acc}-F1-model_v6.pdb paths (4 PyMOL scripts) now resolve the
newest cached model, the pattern Figure6F_EWSR1_S274_pymol.py already uses --
that script was pinned to model_v4 while the rest of the figure used v6.
All three accessions resolve to the same v6 file they named, so the panels
render unchanged. Sort is numeric on the version, not lexical.

Verified: every active script compiles; open_spectra and both rewritten
helpers exercised against a real calibrated mzML (MS1, HCD, EThcD and a
missing scan); each PyMOL resolver block executed as it sits in the file.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The file still told the next session to use MzMLReader directly, which now
contradicts both the global rule and every script in data_analysis/.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@lfu46
lfu46 merged commit 547d84c into main Aug 22, 2026
@lfu46
lfu46 deleted the open-spectra-routing branch August 22, 2026 10:45
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.

1 participant