Skip to main content

OpenWRaw

CI DOI crates.io PyPI docs.rs License: Apache-2.0 Rust MSRV

Part of the OpenMassSpec stack for mass spectrometry raw-file access.

Rust and Python reader for the Waters MassLynx RAW mass spectrometry data format. Cross-platform (Linux, macOS, Windows), with no native or system dependencies.

Documentation: sigilweaver.app/openwraw/docs

Install

Prefer openmassspec-io with the waters feature/extra unless you need this parser standalone (minimal dependencies, or building your own abstraction) - the umbrella gives you format auto-detection, mzML conversion, and Arrow streaming across all wired-in vendors for free:

cargo add openmassspec-io --features waters
pip install openmassspec[waters]

Standalone:

Rust:

cargo add openwraw

Python:

pip install openwraw

Quickstart

Rust:

use openwraw::Reader;

let r = Reader::open("sample.raw")?;
for f in &r.functions {
    println!("function {}: {} scans", f.index, f.scan_count());
}

Python:

import openwraw

r = openwraw.RawReader("sample.raw")
spec = r.read_spectrum(1, 0)
print(spec.mz[:5], spec.intensity[:5])

See the docs site for the full quickstart, guide, and format specification.

Known issues and gaps

  • m/z is not lock-mass corrected, and is typically 30 to 100 ppm off. m/z uses only the calibration stored in _HEADER.TXT. Lock-mass (reference) functions are skipped when iterating spectra and are not used to correct the others. Measured on the 69 lock-mass functions of the public test corpus, the reference ion reads about 46 ppm from its true m/z (median), 98 ppm at the 95th percentile and up to 162 ppm. For accurate-mass work, recalibrate against known masses (most search engines have a mass recalibration step; the bundle's own lock-mass scans are available through Reader::decode_scan), or search with tolerances of at least 100 ppm.
  • No ion mobility decoding. SYNAPT, Vion and Cyclic IMS scans are returned as m/z and intensity only. There is no drift-time output, and mzML output carries no mobility arrays.
  • DDA precursors carry m/z only. Data-dependent MS/MS scans report the precursor m/z recorded for each scan, as both isolation window target and selected ion m/z. No charge state, isolation width or reference to the triggering survey scan is reported; none has been found in the files.
  • MS level of Vion MSe data. The high-energy function of an MSe acquisition is reported as MS2 when the bundle labels it TOF PARENT, or labels it TOF MS and records its collision-energy ramp. Vion bundles exported by UNIFI record no collision energy, so both of their TOF MS functions are reported as MS1.
  • Polarity is reported only when the bundle records it. UNIFI exports do not, so their spectra have no polarity.
  • Encoding D and E: intensity flag bits (bits 27-31 of the intensity word) are not interpreted; flagged peaks are kept. Both encodings return a parse error for an intensity word the format does not produce, except that Encoding D reads the word 0x20000000 (flag bit 29 only, no mantissa) as a flagged zero intensity and keeps the point with intensity 0.0. That reading rests on the neighbouring records in two public bundles (PXD053170), not on a documented meaning of the flag. Encoding E has not been observed with that word.
  • Encoding E (12-byte records): the auxiliary word is not interpreted. Encoding E spectra behind the 30-byte index are labelled centroid, which point spacing confirms for the Xevo G2-XS lock-mass functions. LCT Premier bundles (Encoding E behind the 22-byte index) have no scan mode, because their point spacing has not been checked. The mzML writer refuses their spectra unless the unknown_scan_mode check is allowed (WriteOptions::with_leniency; --allow unknown_scan_mode on the OpenMassSpec command line).
  • Collision energy is written only when the bundle states one per scan. _FUNCnnn.STS has a "Collision Energy" channel and, on trap and transfer instruments, a "Collision Energy2" channel, and records no unit. A function with a collision-energy ramp in _extern.inf (MSe and HDMSe high-energy functions, some DDA functions) stores only the ramp start in the channel, and a function with two channels has two energies with no statement of which cell fragments the precursor. Both cases get no collision energy (a ramp is not an entry of collision_energies). The record carries an openwraw.collision_energy_unstated warning, the reason in the openwraw.collision_energy_unstated extra entry, the ramp bounds in openwraw.collision_energy_ramp_ev, and the raw channels under openwraw.sts.*.
  • Collision energy unit. A single-channel function's energy is in eV when its _extern.inf section labels a collision energy (eV). Older Q-Tof sections (PXD010569) say only Collision Energy 10.0; their MS/MS spectra carry the energy with no unit, and the mzML writer refuses them unless the unknown_collision_energy_unit check is allowed (--allow unknown_collision_energy_unit).
  • Chromatogram channels with a NaN sample. A _CHROnnn.DAT sample whose time or intensity is not finite (PXD003126, channel nBSM Measured Flow Rate A, one sample) is left out of the chromatogram, time and intensity together. The chromatogram carries an openwraw.nonfinite_samples_dropped warning that gives the number dropped and the index of the first, so the mzML writes and the loss is visible.
  • Unreadable _FUNCnnn.STS. A function whose STS file exists but does not parse still decodes its peaks. Without the STS table its records have no per-scan precursor m/z or collision energy, and each carries an openwraw.sts_unreadable warning and extra entry with the path and the parse error. The same text is logged once at warn level when the bundle opens.
  • Empty scans. A scan that decodes to no peaks is written with the empty_spectrum warning and no base peak or m/z range.
  • Tested instruments. The public test corpus covers Q-Tof, SYNAPT, Vion, Cyclic IMS and Xevo G2-XS/G3 QTof data in positive mode, including MSe, HDMSe, DDA, targeted MS/MS and one MALDI MS/MS bundle. Triple and single quadrupole (MRM/SIR), GC and negative-mode data are untested.

Debug logging

OpenWRaw logs how it reads a bundle: which side files it resolved (including sample-prefixed names), instrument and geometry from _extern.inf, and for each function the scan count, mass range, chosen record encoding and why, and calibration. Warnings flag skipped functions, missing calibration, unreadable _FUNCnnn.STS files, and indexes that address more bytes than their DAT file holds. Per-scan byte ranges are logged at trace level.

Rust uses the log facade; install any logger:

RUST_LOG=openwraw=debug your-program sample.raw   # with env_logger

Python forwards to the standard logging module under the openwraw logger. Configure it before opening files:

import logging
logging.basicConfig(level=logging.DEBUG)

import openwraw
openwraw.RawReader("sample.raw")

Include this output when reporting a file that fails to open or decode.

Corpus decode audit

Run every non-lock-mass scan in a directory tree of Waters RAW bundles:

cargo run -p openwraw --release --example audit_corpus -- /path/to/corpus

The command reports opened bundles, decoded scans, and the first error per bundle, then checks each lock-mass function against its reference compound (ReferenceMass1 in _extern.inf, or Leu-Enk / Glu-fib). It exits with an error if any bundle fails to open, any scan fails to decode, or any lock-mass function is more than 100 ppm off. Add --lock-only to skip the full scan pass.

The 2026-09-26 corpus audit records the expanded corpus results and the format gaps it exposed.

Repository layout

crates/
  openwraw/      Core Rust library
  openwraw-py/   PyO3 / maturin Python bindings
docs/            Docusaurus site (format spec + guides)

License

Apache-2.0. See LICENSE.

The format specification was developed by binary analysis of public mass-spectrometry datasets (PRIDE accessions). See ATTRIBUTION.md.

Metadata

Release files for openwraw 5.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openwraw 5.0.0
File Size Uploaded Provenance Actions
openwraw-5.0.0.tar.gz 87.4 kB With provenance Details for openwraw-5.0.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for openwraw 5.0.0
File Actions
openwraw-5.0.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for openwraw-5.0.0-cp310-abi3-win_amd64.whl
openwraw-5.0.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for openwraw-5.0.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
openwraw-5.0.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for openwraw-5.0.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
openwraw-5.0.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for openwraw-5.0.0-cp310-abi3-macosx_11_0_arm64.whl
openwraw-5.0.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for openwraw-5.0.0-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 2.6 MB

Release files / openwraw-5.0.0.tar.gz

Download URL openwraw-5.0.0.tar.gz
Size 87.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4083577797e2c198669ca9bd8cd1bbfa7027b34069f4837489c479bfa0ea9757
BLAKE2b-256 checksum
How to use checksums
27b3f5d74293125e2a157ccb517a4d1b9607bf2c26ce129254672f6e7cc139fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / openwraw-5.0.0-cp310-abi3-win_amd64.whl

Download URL openwraw-5.0.0-cp310-abi3-win_amd64.whl
Size 402.9 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
1a7bfde962c1bfe2b57d4b6df3be99e4657af0111c6d808c2a5a5320e05adfbb
BLAKE2b-256 checksum
How to use checksums
26b7f4c77018c6d2dc0fb647511bf217efbbee86b31134ac12ed08c033fff224
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / openwraw-5.0.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL openwraw-5.0.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 563.0 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
67f0e5463380e895ddf664de5b9ac1319f7b2efce26ae1a3eaf1ca90f45e7b9b
BLAKE2b-256 checksum
How to use checksums
9d39ddbc6d7f8eea67b7eaa33717ce3182017ac3117870b9a76d4d5d7311f796
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / openwraw-5.0.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL openwraw-5.0.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 549.0 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
5c294470547c1e59a5f8d9258367d3c3de86c129d06a990d4970829f497bb798
BLAKE2b-256 checksum
How to use checksums
c209743da70ce6f70b6e9295b39675ce31a20720e02b70348d495b546463a06f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / openwraw-5.0.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL openwraw-5.0.0-cp310-abi3-macosx_11_0_arm64.whl
Size 498.9 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
091d926b674e08ce0eedbc5ee368571be425eca16de100b95dedd0f51ded9fe5
BLAKE2b-256 checksum
How to use checksums
2c1c754620144ba887e2911e75550486ac440c787881a68ad2887bc34bad0f09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / openwraw-5.0.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL openwraw-5.0.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 501.5 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
1381d41b8cf197dbc76c6e52483e6d40adb3e2489e0937990aeaab503926ec5c
BLAKE2b-256 checksum
How to use checksums
8d77ea24330bcf9eaa69e70ce6e4e20df1fe68bac7eea7c2b575b576acb51ae8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for openwraw 5.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for openwraw-5.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page