Skip to main content

Thyra

Tests PyPI Python 3.12+ License: MIT Code style: black Docs Open in Colab

Thyra converts imaging mass spectrometry data into one open format: the spectra, the ion mobility and the MS/MS. It reads the MSI files your MALDI, DESI or ToF-SIMS instrument writes (Bruker, Waters, PHI, or imzML from any vendor) and saves them in SpatialData, the open format of the scverse tools. Ion mobility (TIMS 1/K0, Waters drift time) and MS/MS (PASEF, iprm-PASEF) are kept beside the spectra, not dropped. Converting needs no programming.

What you gain: your data leaves the vendor format and can sit beside the microscopy and spatial transcriptomics data of the same tissue, in a format built to hold them together. In Python it opens as an AnnData table, one row per pixel, with the optical image next to it.

Documentation | Install | Your first conversion | Tutorial | Technical reference

The total ion current and two ion images of a sagittal mouse brain section, converted with Thyra

A sagittal mouse brain section converted with Thyra: the total ion current and two ion images. MALDI-MSI data from 10.5281/zenodo.18326569, CC-BY-4.0.

Quick start

uv tool install --python 3.13 thyra                     # or: pip install thyra (Python 3.12 to 3.14)
thyra-example-data example_data/synthetic_brain.imzML   # makes a small example dataset
thyra example_data/synthetic_brain.imzML example_data/synthetic_brain.zarr

New to the terminal or to uv? The Install page walks you through every step. To try Thyra with nothing installed, open the notebook in Google Colab. The Tutorial also converts the published example dataset (10.5281/zenodo.18326569).

What you can convert

Your instrument Point Thyra at Kept beside the spectra
Bruker timsTOF the folder ending in .d ion mobility (1/K0), MS/MS (PASEF, iprm-PASEF), optical image and its alignment, regions
Bruker solariX the folder ending in .d optical image
Bruker rapifleX the acquisition folder optical image and its alignment
Waters (MassLynx) the folder ending in .raw ion mobility (drift time, Synapt and Cyclic IMS), regions
PHI nanoTOF (ToF-SIMS) the file ending in .raw mosaic tiles joined into one image
Any instrument that exports imzML the .imzML file, with its .ibd file next to it ion mobility array, 3D data
mzPeak (experimental) the .mzpeak file

imzML with a mobility array is read too. In continuous mode, as TIMSImaging writes it, the mobility is kept as its own table. In processed mode, as TIMSCONVERT writes it, add --mobility-grid for that table.

Thyra reads timsTOF and Waters data on Windows and Linux; everything else also works on macOS. Shimadzu support is in development: until then, export imzML from IMAGEREVEAL MS.

PHI mosaic, MS/MS and depth-profiling acquisitions have so far been tested only on synthetic files. If you have real data in those modes, please get in touch.

Not supported yet, and how to change that

Only the formats in the table are read natively. Other vendor formats (Thermo, Shimadzu, Agilent, SCIEX and others) are not: export imzML from the vendor software and convert that.

A gap is there because nobody has needed it yet or because time ran out, not because it cannot be done. If your instrument, format or acquisition mode is missing, tell us in the discussions. A small example dataset is the fastest way to a new reader. Collaborations are welcome: on formats, on tools that read the result, and on the metadata schema.

What you get

One folder ending in .zarr, holding:

  • the spectrum of every pixel, on one shared m/z axis
  • an image of the total ion current (TIC)
  • the optical image of the slide, when the acquisition has one
  • ion mobility and MS/MS data, when the acquisition has them (below)
  • a validated description of the acquisition, which Thyra can export as a METASPACE submission file

Thyra handles datasets larger than your computer's memory, slides with several regions, and 3D data.

Ion mobility and MS/MS

Thyra keeps the extra dimensions of Bruker timsTOF data instead of dropping them.

  • By default each spectrum is added up over mobility, so every tool can read the main table. The table also carries a mass-mobility heatmap of the whole image, uns["mobility_heatmap"].
  • {table}_mobility has one column for each (m/z, 1/K0) pair. It is written by itself from continuous imzML with a mobility array, and from Bruker TDF and processed imzML with --mobility-grid. var["ccs"] holds each pair's collision cross section (CCS) in square angstroms, for an assumed charge of 1; uns["ccs"] records the assumptions.
  • {table}_msms splits PASEF and iprm-PASEF MS/MS by precursor: one block of fragment columns per precursor, so every fragment has its own image.

Two ions at one m/z, told apart by mobility:

import numpy as np
import spatialdata as sd

sdata = sd.read_zarr("output/sample.zarr")
mob = sdata.tables["msi_dataset_z0_mobility"]
mz, k0 = mob.var["mz"].to_numpy(), mob.var["mobility"].to_numpy()
near = np.abs(mz - 600.25) < 0.01
low = np.asarray(mob.X[:, near & (k0 < 1.3)].sum(axis=1)).ravel()   # one value per pixel
high = np.asarray(mob.X[:, near & (k0 >= 1.3)].sum(axis=1)).ravel()

Tools should recognise these tables by their columns ("mobility" in var.columns, "precursor_mz" in var.columns), not by their names. The Ion mobility and MS/MS guide walks through both, and the output format describes the mobility and MS/MS tables in full. For tool developers lists the rules a tool can rely on, and what may change.

Waters Synapt and Cyclic IMS runs with ion mobility on keep their drift times; older Synapt G1 mobility runs are refused. CCS is computed from 1/K0 only, never from a drift time.

From Python

from thyra import convert_msi
import spatialdata as sd

convert_msi("data/sample.imzML", "output/sample.zarr")

sdata = sd.read_zarr("output/sample.zarr")
table = sdata.tables["msi_dataset_z0"]  # one row per pixel, one column per m/z bin

Two commands show a converted store without any Python:

thyra report output.zarr              # one HTML page: TIC image, mean spectrum, ion images
thyra ion-image output.zarr 760.513   # a PNG of one m/z value

The acquisition description has its own commands:

thyra metadata raw_data.d                                # describe a dataset without converting it
thyra validate output.zarr                               # check a result against the schema
thyra export-metaspace output.zarr --merge sample.json   # METASPACE submission file

Every option, format and output detail is in the Technical reference.

Development

git clone https://github.com/M4i-Imaging-Mass-Spectrometry/thyra.git
cd thyra
uv sync
uv run pre-commit install
uv run pytest

CI runs the same hooks on every pull request. Installing them locally shows you a failure before you push.

Contributing

See CONTRIBUTING.md for guidelines.

License

MIT -- see LICENSE.

Citation

If you use Thyra, please cite:

Visvikis, T.; Hendriks, T. F. E.; Vierdag, W.-M.; Marconato, L.; Heeren, R. M. A.; Cuypers, E. Thyra: bridging mass spectrometry imaging and SpatialData for unified multimodal analysis. Nat. Methods 2026. doi:10.1038/s41592-026-03305-5

If your work relies on how Thyra reads vendor files or keeps memory bounded while converting, please also cite:

Visvikis, T.; Vierdag, W.-M.; Marconato, L.; Birmpili, A.; Heeren, R. M. A.; Cuypers, E. Native, Memory-Bounded Conversion of Mass Spectrometry Imaging Data into the SpatialData Ecosystem. J. Am. Soc. Mass Spectrom. 2026, 37 (10), 2379-2387. doi:10.1021/jasms.6c00169

BibTeX for both is in CITATION.bib. GitHub's "Cite this repository" button reads CITATION.cff, which shows the Nature Methods paper and lists the JASMS paper under its references.

Papers

Paper Published DOI
Thyra: bridging mass spectrometry imaging and SpatialData for unified multimodal analysis (Nat. Methods) 2026-10 10.1038/s41592-026-03305-5
Native, Memory-Bounded Conversion of Mass Spectrometry Imaging Data into the SpatialData Ecosystem (J. Am. Soc. Mass Spectrom.) 2026-09 10.1021/jasms.6c00169
Thyra: Bridging Mass Spectrometry Imaging and SpatialData for Unified Multi-Modal Analysis (bioRxiv preprint) 2026-01 10.64898/2026.01.26.700792

Ion mobility and MS/MS support came after the JASMS paper and the preprint. If you use them, please also name the Thyra version you used.

Acknowledgments

Visual identity

Logomark and logotype designed by Nepsis Scriptorium.

Instagram @nepsis.scriptorium Email nepsisscriptorium@gmail.com

Metadata

Release files for thyra 4.8.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 thyra 4.8.0
File Size Uploaded Provenance Actions
thyra-4.8.0.tar.gz 12.2 MB With provenance Details for thyra-4.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for thyra 4.8.0
File Interpreter ABI Platform Actions
thyra-4.8.0-py3-none-any.whl Python 3 none any Details for thyra-4.8.0-py3-none-any.whl

Total release size: 24.6 MB

Release files / thyra-4.8.0.tar.gz

Download URL thyra-4.8.0.tar.gz
Size 12.2 MB
Tags Source
SHA-256 checksum
How to use checksums
5f19db9e65d5ee6e53cca102ee04d352f6400845f644ac3042db3b450c30086e
BLAKE2b-256 checksum
How to use checksums
c82d7c6bebfbd5caefe9d51ff78716ff5fd7fcd354edd0cc90dfe757ec3452bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 16, 2026.

Transparency log

Release files / thyra-4.8.0-py3-none-any.whl

Download URL thyra-4.8.0-py3-none-any.whl
Size 12.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
27129d05957d570b5ac5415f2e9978391cde3ca4e7db1f2748d5b61a19e27ddf
BLAKE2b-256 checksum
How to use checksums
52dbe09bebd69fc8a503cecf0fb385412dc791301c87746285339ff8796b3305
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 16, 2026.

Transparency log

Security for thyra 4.8.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for thyra-4.8.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 16, 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.

Release history Release notifications | RSS feed

This release

4.8.0 This release

2 release files Full provenance

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