Route all spectrum reading through open_spectra; unpin AlphaFold models - #3
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All spectrum reading now goes through the cache-aware
mzml_utils.open_spectrainstead of instantiatingMzMLReaderdirectly, and the AlphaFold model lookup no longer pins a version (resolved viamzml_utils.structure). CLAUDE.md updated to point atopen_spectra.