Repository navigation
Optionally sign simulated mzML with mzprov - #550
Open
theGreatHerrLebert wants to merge 1 commit into
Open
theGreatHerrLebert wants to merge 1 commit into
theGreatHerrLebert wants to merge 1 commit into
Conversation
write_mzml(..., sign_with_mzprov=True) writes an mzprov provenance sidecar declaring the file SMITER-simulated, bound to the simulation parameters and the SHA-256 of molecule_summary.csv. 'mzprov verify' then detects later edits to the spectra or the parameters. Off by default; the dependency is the optional extra smiter[mzprov].
Member
|
Hi, thanks for the PR, appreciate it! I'll need some time to test it and fix the failing test before, but I generally want to have mzprov implemented in SMITER. |
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.
This adds an opt-in way to mark SMITER output as simulated, using mzprov (Apache-2.0, on PyPI). mzprov signs mass spectrometry files with an Ed25519 provenance record. Simulated files are hard to tell apart from real ones once they leave the output directory, and a signature that names the simulator and its parameters makes that explicit. The same mechanism will be used for the simulators in a benchmark we are preparing, PhantomBENCH, and we would like SMITER to be able to take part on the same terms.
What changes
write_mzml(..., sign_with_mzprov=False): off by default, so nothing changes for existing users.sign_mzml_with_mzprov()does two things:<stem>.smiter_params.jsonbeside the mzML, holding the simulation parameters and the SHA-256 ofmolecule_summary.csv;<stem>.provenance.json.mzprov verify <file>.mzMLthen reports any later change to the spectra or to the signed parameters.pip install smiter[mzprov]. mzprov supports Python 3.8–3.13 and depends only oncryptography.Limitation
The ground truth (
molecule_summary.csv) is bound only through the hash recorded in the signed parameters.mzprov verifydoes not re-hash the CSV itself; checking it means comparing it against that hash.Tests
New tests in
tests/test_synthetic_mzml.py:The signing test is skipped when mzprov isn't installed.
Locally (Python 3.9,
requirements.txt),tests/test_synthetic_mzml.pypasses 18 of 19.test_write_peptide_gauss_mzmlfails with anAttributeError, and it fails the same way ondevwithout this change. black (line length 88) is clean, and flake8 shows no new warnings.Happy to adjust naming or placement to fit how you'd like this exposed.