Pymsio
Pymsio is a lightweight module for reading mass-spectrometry data files into a unified NumPy/Polars representation.
Its design and implementation are based on the AlphaRaw project: https://github.com/MannLabs/alpharaw/.
It currently supports:
- Thermo RAW files (via
pythonnet+ Thermo Fisher CommonCore DLLs) - mzML files
Both formats are exposed through a common interface.
Requirements
- Supported OS: Windows, Linux
- Python: >= 3.8
- Thermo RAW:
- Requires Thermo Fisher CommonCore DLLs (
ThermoFisher.CommonCore.Data.dll,ThermoFisher.CommonCore.RawFileReader.dll) obtained from the RawFileReader project (https://github.com/thermofisherlsms/RawFileReader). - Linux also needs Mono (use
install_mono.sh).
- Requires Thermo Fisher CommonCore DLLs (
Installation
-
Clone the repository
git clone https://github.com/bertis-informatics/pymsio.git cd pymsio
-
Quick Install (recommended)
The install script downloads the Thermo RawFileReader DLLs (with license agreement) and installs pymsio in one step.
Windows PowerShell
.\install.ps1
Linux / macOS
chmod +x install.sh ./install.sh
-
Manual Install
Click to expand manual installation steps
a. Provide the Thermo DLLs (only needed for Thermo RAW)
-
Linux only: ensure Mono is installed (required by pythonnet). Use the helper script:
./install_mono.sh
- Download (or
git clone) RawFileReader: https://github.com/thermofisherlsms/RawFileReader - Copy the two DLLs from
RawFileReader/Libs/Net471/:ThermoFisher.CommonCore.Data.dllThermoFisher.CommonCore.RawFileReader.dll
- Make the DLLs discoverable:
- Option A — Bundle DLLs inside the package
<path-to-pymsio>/pymsio/dlls/thermo_fisher/- Copy the DLLs into
pymsio/dlls/thermo_fisher/before runningpip install -e .so they ship with the installation. - Example:
mkdir -p pymsio/dlls/thermo_fisher cp /path/to/RawFileReader/Libs/Net471/*.dll /path/to/pymsio/pymsio/dlls/thermo_fisher/
- Copy the DLLs into
- Option B — Set up an environment variable
PYMSIO_THERMO_DLL_DIR- Windows example:
setx PYMSIO_THERMO_DLL_DIR "<path-to-your-dll-folder>"
- Linux example:
export PYMSIO_THERMO_DLL_DIR="<path-to-your-dll-folder>"
(Add the export line to~/.bashrcto keep it persistent.) - Copy the DLLs into the folder referenced by the variable.
- Windows example:
- Option A — Bundle DLLs inside the package
b. Install pymsio
pip install .
-
Quick Test
Run the test suite with pytest:
# Basic tests (import check, DLL binding check)
pytest tests/
# With reader tests (provide file paths)
pytest tests/ --raw "path/to/file.raw" --mzml "path/to/file.mzML"
Tests for readers whose file path is not provided will be automatically skipped.
Code Example
Click to expand
from pathlib import Path
from pymsio.readers import ReaderFactory
path = Path("path/to/your/file.raw") # or .mzML
# 1) Get appropriate reader (Thermo RAW or mzML)
reader = ReaderFactory.get_reader(path)
# 2) Read metadata (Polars DataFrame)
meta_df = reader.get_meta_df()
print(meta_df.head())
# 3) Read one frame (np.ndarray, shape (N, 2), columns: [mz, intensity])
frame_num = int(meta_df.item(0, "frame_num"))
peaks = reader.get_frame(frame_num)
print(peaks.shape)
# 4) Load full dataset
msdata = reader.load()
print(msdata.peak_arr.shape)
License
This project is licensed under the Apache License 2.0.
Note: The Thermo RawFileReader DLLs are proprietary and subject to their own license. They are not included in this repository.
Metadata
Release files for pymsio 0.1.15
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 |
|---|---|---|---|---|
| pymsio-0.1.15.tar.gz | 21.4 kB | Without provenance | Details for pymsio-0.1.15.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pymsio-0.1.15-py3-none-any.whl | Python 3 | none | any | Details for pymsio-0.1.15-py3-none-any.whl |
Total release size: 42.6 kB
Release files / pymsio-0.1.15.tar.gz
| Download URL | pymsio-0.1.15.tar.gz |
|---|---|
| Size | 21.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d7fe5375527be64d44600f3e4c911d4eccb4a8b5669285a6398393f06add7ce0
|
|
BLAKE2b-256 checksum How to use checksums |
accd53bccdb997e89b929e4b7b3cb281fc9838c292435b29d060c5b24ad08340
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.0
|
Release files / pymsio-0.1.15-py3-none-any.whl
| Download URL | pymsio-0.1.15-py3-none-any.whl |
|---|---|
| Size | 21.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4af8e9580228b9dcdf9dc03804a354af99b96e0bdd282e544d31a9730c789b47
|
|
BLAKE2b-256 checksum How to use checksums |
e3967b7b42325a98f3d57c0783a38638312a7c75b55b803e0953e97714aecead
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.0
|
Security for pymsio 0.1.15
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.