Commit 8d2c79a
feat(protein): add the spectra mode for mass spectrometry QC
rustqc protein spectra reads mzML and reports per-level spectrum and peak
counts, total ion current, the retention time range, the fragmentation ratio
and the precursor charge distribution.
mzdata does the reading, behind a `proteomics` cargo feature that is on by
default. Building with --no-default-features drops the mode from the help
entirely rather than offering it and then failing, and drops mzdata's
transitive packages with it. Both configurations are tested.
Validated against pyteomics 5.0.1 on mzdata's own test file: two independent
readers agree on all 48 spectra, 305213 peaks, the per-level minima and
maxima, the retention time bounds and the precursor m/z range. Total ion
current is compared with a relative tolerance rather than exactly, because
the intensities are 32-bit in the file and the two readers accumulate them at
different precision.
Two reporting decisions worth noting. Total ion current is summed from the
peaks actually present rather than read from the spectrum header, so a
profile spectrum that has since been centroided reports what the file now
holds. And a run with no survey scans reports its fragmentation ratio as NA
rather than 0, since 0 would read as "no fragmentation" when the truth is
"nothing to divide by".
The fixture annotates no precursor charge states, which the run warns about
and the report shows as `without_charge`, rather than quietly reporting an
empty charge distribution.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 907b328 commit 8d2c79a
15 files changed
Lines changed: 3924 additions & 2 deletions
File tree
- src
- protein
- spectra
- tests
- data/protein
- expected/protein
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
98 | 102 | | |
99 | 103 | | |
100 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
24 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
25 | 35 | | |
26 | 36 | | |
27 | 37 | | |
| |||
0 commit comments