OpenTFRaw
Part of the OpenMassSpec stack for mass spectrometry raw-file access.
Rust and Python reader for Thermo Fisher .raw mass spectrometry files.
It is tested on format versions 63, 64 and 66, from LTQ ion traps through
Orbitrap Astral and TSQ Altis (see Known issues and gaps
and CORPUS.md).
Documentation: sigilweaver.app/opentfraw/docs
Known issues and gaps
Measured on the public test corpus (291 files from 56 PRIDE datasets).
- Scan metadata is wrong on 34 of 291 corpus files (12%). On these files the scan event is misread: MS level, polarity, analyzer, activation and precursor fields can be wrong, for example MS2 scans reported as negative-polarity MS1 in a positive-mode run. Peak m/z and intensity values are not affected. Affected: 30 of 52 Orbitrap Fusion Lumos files (PXD007683, PXD025230, PXD037285, PXD064117, PXD067311, PXD070648), 2 of 2 Orbitrap Ascend files (PXD061791), 1 of 18 Orbitrap Eclipse files (PXD054530) and 1 LTQ file (PXD039587).
- Precursor m/z reads as 0.5 on the MS2 scans of 4 Orbitrap Fusion
Lumos files (PXD023217):
target_mzandselected_mzare 0.5 while the scan filter and the reaction hold the real precursor (for example 652.9). - Activation methods: CID, HCD, ETD and EThcD are identified. ETD and EThcD are read only from format version 66 files (no older ETD file is in the corpus). Other methods (UVPD, ECD, PQD and so on) decode as unknown, and mzML then has no dissociation-method term.
- Collision energy unit. A collision energy has a unit only when the
file states it. A trailer label states its own:
HCD Energy:andHCD Energy V:are normalized collision energy (NCE),HCD Energy eV:is electronvolts, and an SRM transition's energy is electronvolts. The scan event stores a bare number; its unit is the one the embedded method states (Normalized Coll. Energy: 35.0,Collision Energy (%) = 30orEnergyType="normalized"), and unknown when the method states none or contradicts itself. In the corpus, 427 of 11.9 million scans have an energy with no unit: PXD061791 (2 Orbitrap Ascend files) and one Fusion Lumos file of PXD064117, all among the files whose scan events are misread (first item).to_mzmlstops at the first such scan withunknown_collision_energy_unit. Passallow=["unknown_collision_energy_unit"](Python) or--allow unknown_collision_energy_unit(to_mzmlexample) to write them with a warning userParam and a count. - Charge without precursor m/z. On 50 scans in 5 files whose scan events
are misread (PXD039587, PXD064117 FOXK2, three PXD070648 files) the trailer
holds a charge state and the misread scan event no precursor m/z. mzML puts
a charge inside the selected ion, so the record has no precursor
charge; the charge is inextra["opentfraw.precursor_charge"]and the record carries the warningopentfraw.charge_without_selected_mz. - Scans with no peaks (8,822 in 57 corpus files, mostly ion-trap MS2) are
written with no base peak and the Core warning
empty_spectrum. - Scan filter
locktoken:scan_filter()renderslockonly on a scan whose trailer reports at least one found lock mass. A scan that reports zero found but keeps the previous scan's nonzero correction renders nolock. This is the case for 24,273 of 27,832 scans in the public Q Exactive HF-X acquisition PXD071477 and 35,221 of 51,254 in the Exploris 480 acquisition PXD064947. The files do not show whether such a scan counts as lock-corrected: on the Q Exactive Plus and HF-X files a preamble byte separates it from both a found lock mass and a method with no lock mass, but the byte has no public documentation and is constant on Exploris 480, so it is not used. - Analyzer is not reported for Orbitrap Astral MS2 scans and for TSQ triple-quadrupole scans.
- SRM data: polarity is always reported as positive and isolation width
as 0.7. A TSQ Vantage (format version 63) flat-peak record does not state
its peak count, so the reader checks the default count (
data_size - 1, elsedata_size - 2) against the scan index: finite and ascending m/z, an intensity sum equal to the total current, m/z inside the indexed range (with a total current of 0 an agreeing read cannot be told from an all-zero misaligned one). When the default count disagrees, every count fromdata_size - 1down todata_size - 12is tried. If exactly one agrees the scan is recovered: its peaks use that count and the spectrum carries the warningopentfraw.peak_count_recovered(1,969 of the 35,098 scans of PXD020246, none of the other public files, whichto_mzmlconverts in full). If none agrees, or more than one does (a tie is never broken), the scan is unverified: the default peaks are returned unchanged, may hold NaN or descending m/z, and the spectrum carries the warningopentfraw.peak_count_unverified(none in the public corpus). The mzML writer refuses an unverified scan whose m/z is not finite and ascending, and has no check to relax;skip_unreadable=Trueleaves it out and counts it. A true count of zero is never tried, so a scan withdata_sizeof 2 or more and no peaks is unverified, not empty. Recovered and unverified scans are flagged wherever they are read:OpenTfRawSource::recovered_peak_count_scans()andunverified_peak_count_scans()count the scans the source has yielded,RawFileReader::peak_counts_recovered()andpeak_counts_unverified()count the decodes since open, thepeak_countfield ofextract_spectrum/iter_spectrarecords says how each was settled,iter_records()and the mzML writer carry the Core warnings (counted in the write summary), and Pythonpeaks(),scan()andto_mzmlemit aUserWarning, as does theto_mzmlexample. A record that matches no layout raises an error, andto_mzml(..., skip_unreadable=True)(Python) or theto_mzmlexample's--skip-unreadableflag writes the other scans and reports how many were left out. - Profile spectra with an unrecognised calibration layout have NaN m/z
values; mzML reports the count in
opentfraw.unconverted_profile_bins. - m/z accuracy follows the instrument's stored calibration. In FTMS MS1 scans of 223 corpus files, background ions with known masses (polysiloxanes, diisooctyl phthalate) are within 0.55 ppm of their theoretical m/z at the median and 4.1 ppm at the 95th percentile.
- Tested files: format versions 63, 64 and 66 only; positive polarity only in the corpus (two negative-mode Q Exactive Plus files back opt-in tests, see CORPUS.md); no GC-Orbitrap, LCQ-family, Orbitrap ID-X, Exactive, TSQ Quantis/Endura/Fortis or single-quadrupole files; no data from non-MS controllers (UV, PDA). Other versions and instruments may open but are untested.
Install
Prefer openmassspec-io
with the thermo 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 thermo
pip install openmassspec[thermo]
Standalone:
Rust:
cargo add opentfraw
Python:
pip install opentfraw
Quickstart
Rust:
use std::{fs::File, io::BufReader};
use opentfraw::RawFileReader;
let raw = RawFileReader::open_path("sample.raw")?;
// Buffer the scan reads: an unbuffered File is about 11x slower.
let mut file = BufReader::new(File::open("sample.raw")?);
let info = &raw.run_header.sample_info;
for scan_num in info.first_scan_number..=info.last_scan_number {
let peaks = raw.read_scan_peaks(&mut file, scan_num)?;
println!("scan {scan_num}: {} peaks", peaks.len());
}
Python:
import opentfraw
raw = opentfraw.RawFile("run.raw")
mz, intensity = raw.peaks(3)
print(raw.scan(3)["filter_string"])
raw.to_mzml("run.mzML")
See the docs site for the full guide, format specification, and API reference.
Used by
| Project | Description |
|---|---|
| Mascope by Ultra Trace | Mass spectrometry data analysis platform using OpenTFRaw to ingest Thermo .raw files. |
License
Apache-2.0. See LICENSE.
The format specification was developed by binary analysis of public mass-spectrometry datasets (PRIDE accessions). See CORPUS.md and ATTRIBUTION.md.
Metadata
Release files for opentfraw 4.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| opentfraw-4.0.0.tar.gz | 176.5 kB | With provenance | Details for opentfraw-4.0.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| opentfraw-4.0.0-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details for opentfraw-4.0.0-cp310-abi3-win_amd64.whl |
| opentfraw-4.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 opentfraw-4.0.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| opentfraw-4.0.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ ARM64 | Details for opentfraw-4.0.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
| opentfraw-4.0.0-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details for opentfraw-4.0.0-cp310-abi3-macosx_11_0_arm64.whl |
| opentfraw-4.0.0-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details for opentfraw-4.0.0-cp310-abi3-macosx_10_12_x86_64.whl |
Total release size: 3.7 MB
Release files / opentfraw-4.0.0.tar.gz
| Download URL | opentfraw-4.0.0.tar.gz |
|---|---|
| Size | 176.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7cc6bb155796e40902e75d5a3af61cbe1f2d7af0b72c255c1809aee835ea21d2
|
|
BLAKE2b-256 checksum How to use checksums |
fd027753adfe4357ff899a9380eb009cd39f1c6e46480084c5358486d822bdea
|
| 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 logRelease files / opentfraw-4.0.0-cp310-abi3-win_amd64.whl
| Download URL | opentfraw-4.0.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 600.6 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
077908f56e7aa7e560c536aea04df2628cdd2d7418313424326700c2074913bd
|
|
BLAKE2b-256 checksum How to use checksums |
a9fcd6c5aa6ae93384846a6029e09c3f6f089a9182f8c70362b88b457309f770
|
| 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 logRelease files / opentfraw-4.0.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | opentfraw-4.0.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 786.8 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e52e6747405cbbda59285b22c46603d7cb9a99c7d5428faf84941fd22beddc8d
|
|
BLAKE2b-256 checksum How to use checksums |
41ea952695dbe12d34be85606dddbbb9aa4a54b991c36796459f12a54e4a09b8
|
| 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 logRelease files / opentfraw-4.0.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | opentfraw-4.0.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 762.2 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
cfe5217295a28c82448ccc431df52c940e0cb398ce93a7fa3f1ffecf97fe07d5
|
|
BLAKE2b-256 checksum How to use checksums |
270f8f49fc46cf1bfcf113754d1573238f4fd741238d72084c55a7572663ba7f
|
| 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 logRelease files / opentfraw-4.0.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | opentfraw-4.0.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 705.5 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
8449505319b27367725c71826a4b63f4da258bea0e0225f624eb505035a4fd2c
|
|
BLAKE2b-256 checksum How to use checksums |
4ba1f0a3683ced2bb4b280ebff7e81c39e7f7467ad605096fdfa5c42c4e8ab58
|
| 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 logRelease files / opentfraw-4.0.0-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | opentfraw-4.0.0-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 716.7 kB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
4d26481c74588171e4c3adc1bee7dcd82a929b43120813d77688c79ccfaaf537
|
|
BLAKE2b-256 checksum How to use checksums |
f4201ea9360b3f29f370c525dc98321d36ec269cfc2036fed915a3ab223f7fe8
|
| 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 logSecurity for opentfraw 4.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.
Attestation for opentfraw-4.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 logA 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.