mzML-Format Output Generation and Validation
Summary
Export simulated LC-MS/MS scan data from ViMMS to industry-standard mzML format, enabling downstream analysis, archival, and comparative evaluation against real or baseline acquisition strategies. This skill bridges virtual simulation output to standard proteomics/metabolomics workflows.
When to use
After running a ViMMS simulation loop with a fragmentation controller (e.g., TopNController, WeightedDEWController) to completion, you need to serialize the in-memory scan list to a portable, standards-compliant file format that can be processed by third-party tools (OpenMS, MZmine) or compared against reference acquisitions.
When NOT to use
- Input scans have not yet been generated (env.run() has not completed) — wait for simulation loop to finish.
- Output format is required by a tool that demands NetCDF or proprietary binary formats (e.g., vendor-specific .raw files) — mzML is text-based and may be slower to parse for very large datasets.
- Evaluation metrics are needed before mzML export — prioritize EvaluationData pickle capture instead, as mzML is primarily for archival and secondary analysis.
Inputs
- Environment object (instantiated with IndependentMassSpectrometer, controller instance, and save_eval=True)
- In-memory scan list from completed env.run()
- Specification of output file path (out_file) and directory (out_dir)
Outputs
- mzML file (XML-formatted mass spectrometry data)
- EvaluationData pickle (optional; contains coverage, intensity, and fragmentation statistics)
- Metadata: scan count, retention time range, m/z range, intensity distribution
How to apply
Within the ViMMS workflow, after instantiating an Environment with a mass spectrometer and controller and calling env.run() to accumulate scans, invoke env.write_mzML() to serialize the complete scan list to mzML format. Set the save_eval=True flag when creating the Environment to enable simultaneous capture of EvaluationData pickles. The output mzML file contains all MS1 and MS/MS spectra in their acquisition order, preserving scan metadata (retention time, m/z, intensity, isolation windows, fragmentation parameters). Validate the mzML output by opening it in peak-picking tools (e.g., OpenMS) or by loading the parallel EvaluationData pickle to cross-check scan counts, intensity ranges (e.g., cumulative intensity thresholds), and fragmentation coverage metrics against baseline controller results.
Related tools
- VIMMS (Core simulation framework; provides Environment class and write_mzML() method to export scan data) — https://github.com/glasgowcompbio/vimms
- OpenMS (Processes mzML output from simulation to compute fragmentation coverage metrics and validate file integrity)
- Python (Language for executing Environment.write_mzML() and post-hoc mzML parsing)
Examples
from vimms.Env import Environment
from vimms.Controller import TopNController
from vimms.MassSpec import IndependentMassSpectrometer
env = Environment(ms, controller, min_time=0, max_time=1440, save_eval=True, out_file='simulation_output.mzML', out_dir='./results')
env.run()
env.write_mzML()
Evaluation signals
- mzML file exists at specified out_file path and is valid XML (parseable by standard XML tools and mzML validators).
- Scan count in mzML header matches the length of the in-memory scan list from env.run().
- EvaluationData pickle cumulative intensity and times_fragmented_summary values are consistent with MS1 and MS/MS peak intensities in the mzML file.
- Retention time, m/z, and isolation window values in mzML scans match the chemical mixture and controller parameters (e.g., isolation_width=1, rt_tol=15).
- mzML file can be successfully imported by downstream tools (OpenMS, MZmine) without parsing errors; peak picking yields expected coverage metrics (e.g., fragmentation rate within ±10% of baseline TopN controller).
Limitations
- mzML is a verbose, text-based format; exporting very large simulations (>10,000 scans) may incur significant I/O overhead and disk space.
- mzML export does not perform real-time validation; file correctness depends on the integrity of the Environment's scan list. Corrupted or incomplete simulations will propagate to mzML.
- mzML output lacks vendor-specific metadata (e.g., instrument tuning parameters, calibration curves) present in raw binary formats, limiting comparison to real instrument data beyond basic m/z, intensity, and retention time.
- Peak picking for downstream evaluation relies on external tools (OpenMS, MZmine) with their own parameter sensitivity; mzML alone does not guarantee reproducible coverage metrics without consistent peak-picking configuration.
Evidence
- [other] The Environment class provides write_mzML to export the generated scans: "The
Environment class provides write_mzML to export the generated scans"
- [other] When running an Environment you can enable the save_eval flag: "When running an
Environment you can enable the save_eval flag"
- [readme] ViMMS can extract scan results as mzML files: "extract the scan results as mzML files"
- [other] Call env.write_mzML() to serialize the scan list to mzML format: "Call env.write_mzML() to serialize the scan list to mzML format"
- [other] Processes mzML output from a simulation to compute fragmentation coverage: "Processes mzML output from a simulation (or real acquisition) to compute fragmentation coverage using OpenMS"
1---2name: mzml-format-output-generation-and-validation3description: Use when after running a ViMMS simulation loop with a fragmentation controller (e.4license: CC-BY-4.05---67# mzML-Format Output Generation and Validation89## Summary1011Export simulated LC-MS/MS scan data from ViMMS to industry-standard mzML format, enabling downstream analysis, archival, and comparative evaluation against real or baseline acquisition strategies. This skill bridges virtual simulation output to standard proteomics/metabolomics workflows.1213## When to use1415After running a ViMMS simulation loop with a fragmentation controller (e.g., TopNController, WeightedDEWController) to completion, you need to serialize the in-memory scan list to a portable, standards-compliant file format that can be processed by third-party tools (OpenMS, MZmine) or compared against reference acquisitions.1617## When NOT to use1819- Input scans have not yet been generated (env.run() has not completed) — wait for simulation loop to finish.20- Output format is required by a tool that demands NetCDF or proprietary binary formats (e.g., vendor-specific .raw files) — mzML is text-based and may be slower to parse for very large datasets.21- Evaluation metrics are needed before mzML export — prioritize EvaluationData pickle capture instead, as mzML is primarily for archival and secondary analysis.2223## Inputs2425- Environment object (instantiated with IndependentMassSpectrometer, controller instance, and save_eval=True)26- In-memory scan list from completed env.run()27- Specification of output file path (out_file) and directory (out_dir)2829## Outputs3031- mzML file (XML-formatted mass spectrometry data)32- EvaluationData pickle (optional; contains coverage, intensity, and fragmentation statistics)33- Metadata: scan count, retention time range, m/z range, intensity distribution3435## How to apply3637Within the ViMMS workflow, after instantiating an Environment with a mass spectrometer and controller and calling env.run() to accumulate scans, invoke env.write_mzML() to serialize the complete scan list to mzML format. Set the save_eval=True flag when creating the Environment to enable simultaneous capture of EvaluationData pickles. The output mzML file contains all MS1 and MS/MS spectra in their acquisition order, preserving scan metadata (retention time, m/z, intensity, isolation windows, fragmentation parameters). Validate the mzML output by opening it in peak-picking tools (e.g., OpenMS) or by loading the parallel EvaluationData pickle to cross-check scan counts, intensity ranges (e.g., cumulative intensity thresholds), and fragmentation coverage metrics against baseline controller results.3839## Related tools4041- **VIMMS** (Core simulation framework; provides Environment class and write_mzML() method to export scan data) — https://github.com/glasgowcompbio/vimms42- **OpenMS** (Processes mzML output from simulation to compute fragmentation coverage metrics and validate file integrity)43- **Python** (Language for executing Environment.write_mzML() and post-hoc mzML parsing)4445## Examples4647```48from vimms.Env import Environment49from vimms.Controller import TopNController50from vimms.MassSpec import IndependentMassSpectrometer5152env = Environment(ms, controller, min_time=0, max_time=1440, save_eval=True, out_file='simulation_output.mzML', out_dir='./results')53env.run()54env.write_mzML()55```5657## Evaluation signals5859- mzML file exists at specified out_file path and is valid XML (parseable by standard XML tools and mzML validators).60- Scan count in mzML header matches the length of the in-memory scan list from env.run().61- EvaluationData pickle cumulative intensity and times_fragmented_summary values are consistent with MS1 and MS/MS peak intensities in the mzML file.62- Retention time, m/z, and isolation window values in mzML scans match the chemical mixture and controller parameters (e.g., isolation_width=1, rt_tol=15).63- mzML file can be successfully imported by downstream tools (OpenMS, MZmine) without parsing errors; peak picking yields expected coverage metrics (e.g., fragmentation rate within ±10% of baseline TopN controller).6465## Limitations6667- mzML is a verbose, text-based format; exporting very large simulations (>10,000 scans) may incur significant I/O overhead and disk space.68- mzML export does not perform real-time validation; file correctness depends on the integrity of the Environment's scan list. Corrupted or incomplete simulations will propagate to mzML.69- mzML output lacks vendor-specific metadata (e.g., instrument tuning parameters, calibration curves) present in raw binary formats, limiting comparison to real instrument data beyond basic m/z, intensity, and retention time.70- Peak picking for downstream evaluation relies on external tools (OpenMS, MZmine) with their own parameter sensitivity; mzML alone does not guarantee reproducible coverage metrics without consistent peak-picking configuration.7172## Evidence7374- [other] The Environment class provides write_mzML to export the generated scans: "The `Environment` class provides `write_mzML` to export the generated scans"75- [other] When running an Environment you can enable the save_eval flag: "When running an `Environment` you can enable the `save_eval` flag"76- [readme] ViMMS can extract scan results as mzML files: "extract the scan results as mzML files"77- [other] Call env.write_mzML() to serialize the scan list to mzML format: "Call env.write_mzML() to serialize the scan list to mzML format"78- [other] Processes mzML output from a simulation to compute fragmentation coverage: "Processes mzML output from a simulation (or real acquisition) to compute fragmentation coverage using OpenMS"