Skip to content

Commit 8d2c79a

Browse files
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

AGENTS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ src/
9595
stats.rs — Length statistics reproducing seqkit stats -a
9696
defects.rs — Internal stops, non-standard residues, duplicates
9797
output.rs — The seqkit-compatible table and the RustQC report
98+
spectra/ — behind the `proteomics` cargo feature
99+
mod.rs — mzML reading via mzdata
100+
metrics.rs — Per-run and per-level spectrum metrics
101+
output.rs — The run report
98102
rna/
99103
mod.rs — Re-exports the RNA submodules (dupradar, featurecounts, rseqc, qualimap)
100104
and re-exports the shared ones from `common` for compatibility

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
length statistics reproducing `seqkit stats -a` exactly, plus amino acid
1919
composition and defect detection (internal stop codons, non-standard
2020
residues, duplicate sequences and identifiers) that seqkit does not report.
21+
- New `rustqc protein spectra` mode: mass spectrometry run QC from mzML, with
22+
per-level spectrum and peak counts, total ion current, retention time range
23+
and precursor charge distribution. Behind the `proteomics` cargo feature,
24+
which is on by default; `--no-default-features` drops it along with mzdata.
2125

2226
### Changed
2327

Cargo.lock

Lines changed: 211 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,17 @@ path = "src/lib.rs"
2121
name = "rustqc"
2222
path = "src/main.rs"
2323

24+
[features]
25+
default = ["proteomics"]
26+
# Mass spectrometry support for `rustqc protein spectra`. Enabled by default;
27+
# disable with `--no-default-features` to drop mzdata and its transitive
28+
# packages, which is worth doing when only the sequencing pipelines are needed.
29+
proteomics = ["dep:mzdata"]
30+
2431
[dependencies]
32+
# mzML reading for the protein spectra mode (optional, see the `proteomics` feature)
33+
mzdata = { version = "0.66", default-features = false, features = ["mzml"], optional = true }
34+
2535
# CLI argument parsing
2636
clap = { version = "4", features = ["derive", "env"] }
2737

0 commit comments

Comments
 (0)