Repository navigation
Add MS1 trace primitives: reader filter push-down, exact isotope envelopes, isotope co-elution - #12
Merged
Merged
Conversation
…lopes, isotope co-elution - iter_spectra(ms_level=, rt_range=) on SpectrumCache and MzMLReader. The cache filters in SQL (the idx_scans_mslevel index existed but was never used), so an MS1 sweep no longer zlib-decodes every MS2 scan. extract_xics pushes its filters down when the reader accepts them and keeps the Python-side checks as the guard for any other reader. On a 5,386 MS1 / 55,338 MS2 cached run: whole-run MS1 XIC 1.16 s -> 0.21 s, a +/-1 min window 1.15 s -> <0.01 s, traces identical. - mzml_utils.isotopes.isotope_distribution(): isotope envelope of an elemental composition, aggregated by nominal mass with the centroid mass of each peak. Element data comes from pyteomics.mass.nist_mass, no new dependency. The averagine in deisotope cannot express a halogen tag or a heavy label; this can. Agrees with brute-force isotopologue enumeration to 1e-9 and reproduces a published 4-bromo-Phe peptide envelope. - coelution_score() and isotope_trace_evidence(): whether a precursor's isotope traces co-elute, how the observed envelope fits theory (cosine, not a 3-point Pearson), and whether a trace one isotope BELOW the assigned monoisotopic m/z co-elutes with it. Prompted by Li et al., Angew Chem Int Ed 2026 (BrIS / BrScan-MS1, DOI 10.1002/anie.1708018). No code from that repository is used. Co-Authored-By: Claude Fable 5.1 <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.
Three small MS1-level additions:
iter_spectra(ms_level=, rt_range=)pushed into SQL on the spectrum cache,isotope_distribution()for exact-composition isotope envelopes (any element), andcoelution_score()/isotope_trace_evidence()for trace-level precursor evidence. 195 offline tests pass.🤖 Generated with Claude Code