Skip to main content

Thyra

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

Thyra (from Greek thyra, meaning "door" or "portal") -- a modern Python library for converting Mass Spectrometry Imaging (MSI) data into the standardized SpatialData/Zarr format, serving as your portal to spatial omics analysis workflows.

Read the documentation | Getting Started | Tutorial | CLI Reference | API Reference

Try it without any data

pip install thyra
thyra-example-data example_data/synthetic_brain.imzML   # generates a small synthetic dataset
thyra example_data/synthetic_brain.imzML example_data/synthetic_brain.zarr

See the Tutorial for a full walkthrough, including the published example dataset (10.5281/zenodo.18326569).

Features

  • Multiple Input Formats: ImzML, Bruker (.d directories), Waters (.raw directories), PHI SmartSoft-TOF ToF-SIMS (.raw files)
  • SpatialData Output: Modern, cloud-ready format with Zarr backend
  • Memory Efficient: Handles large datasets (100+ GB) through streaming processing
  • Optical Alignment: Automatic MSI-to-optical image registration for Bruker data
  • Multi-Region Support: Handles slides with multiple tissue sections
  • Resampling: Physics-aware mass axis resampling (on by default in the CLI; opt-in from the Python API)
  • Validated Metadata: Versioned, ontology-mapped metadata schema (PSI-MS, NCBITaxon, UBERON, CHEBI) with thyra validate and one-command METASPACE export
  • 3D Support: Process volume data or treat as 2D slices
  • Cross-Platform: Windows, macOS, and Linux

Installation

pip install thyra

Quick Start

Command Line

# Basic conversion (resampling enabled by default)
thyra input.imzML output.zarr

# Bruker data with verbose logging
thyra data.d output.zarr -v DEBUG

# PHI SmartSoft-TOF ToF-SIMS (a .raw file, not a directory)
thyra tofsims_run.raw output.zarr

# Disable resampling
thyra input.imzML output.zarr --no-resample

Thyra auto-detects the input format. Note that .raw is claimed by two vendors and resolved by shape: Waters writes a directory, PHI writes a single file. See Supported Formats.

Python API

from thyra import convert_msi

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

Working with the Output

import spatialdata as sd

sdata = sd.read_zarr("output/sample.zarr")
msi_table = sdata.tables["msi_dataset_z0"]

print(f"Shape: {msi_table.shape}")  # (pixels, m/z bins)
print(f"m/z range: {msi_table.var['mz'].min():.1f} -- {msi_table.var['mz'].max():.1f}")

Metadata

Every converted store carries a versioned, ontology-mapped metadata block (uns["msi_metadata"]), auto-populated from the source file:

thyra validate output.zarr                               # schema + ontology checks
thyra export-metaspace output.zarr --merge sample.json   # METASPACE submission JSON

See Metadata Schema.

Documentation

Full documentation: M4i-Imaging-Mass-Spectrometry.github.io/thyra

Supported Formats

Input Extension Status
ImzML .imzML Full support
Bruker .d Full support (timsTOF + Rapiflex)
Waters .raw Full support
PHI SmartSoft-TOF .raw Full support
Shimadzu .imdx, .kbd In development (workaround: imzML export from IMAGEREVEAL MS)

Output: SpatialData/Zarr -- cloud-ready, efficient, standardized

Development

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

Contributing

See CONTRIBUTING.md for guidelines.

License

MIT -- see LICENSE.

Citation

@software{thyra2024,
  title = {Thyra: Modern Mass Spectrometry Imaging Data Conversion},
  author = {Visvikis, Theodoros},
  year = {2024},
  url = {https://github.com/M4i-Imaging-Mass-Spectrometry/thyra}
}

Acknowledgments

Visual identity

Logomark and logotype designed by Nepsis Scriptorium.

Instagram @nepsis.scriptorium Email nepsisscriptorium@gmail.com

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thyra-3.6.0.tar.gz (11.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thyra-3.6.0-py3-none-any.whl (11.8 MB view details)

Uploaded Python 3

File details

Details for the file thyra-3.6.0.tar.gz.

File metadata

  • Download URL: thyra-3.6.0.tar.gz
  • Upload date:
  • Size: 11.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for thyra-3.6.0.tar.gz
Algorithm Hash digest
SHA256 ce3a469f5f3acf3d16e16be04be2d742b67adeac73dc4283a40e6d6a81c2adcd
MD5 3467f5d5b337b9f2f4df7695cc2e3f91
BLAKE2b-256 51b305ef9233ec6fbe9c7ba1c8bd657ea3acb964354585ac94da1d3e5090574b

See more details on using hashes here.

Provenance

The following attestation bundles were made for thyra-3.6.0.tar.gz:

Publisher: release.yml on M4i-Imaging-Mass-Spectrometry/thyra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file thyra-3.6.0-py3-none-any.whl.

File metadata

  • Download URL: thyra-3.6.0-py3-none-any.whl
  • Upload date:
  • Size: 11.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for thyra-3.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ba92a8977888c149c764e98d0c85efe7a3845aecd43326a6175f725d697bcec
MD5 b6f4d18b05f686f361d2889a9d4ce4ee
BLAKE2b-256 190d67d5d72a498d210c70172136037cb3a1bf0e9b0eb66fdbdd6106e1b88122

See more details on using hashes here.

Provenance

The following attestation bundles were made for thyra-3.6.0-py3-none-any.whl:

Publisher: release.yml on M4i-Imaging-Mass-Spectrometry/thyra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

3.7.3

2 files

3.7.2

2 files

3.7.1

2 files

3.7.0

2 files

This release

3.6.0 This release

2 files

3.5.1

2 files

3.5.0

2 files

3.4.0

2 files

3.3.0

2 files

3.2.2

2 files

3.2.1

2 files

3.2.0

2 files

3.1.1

2 files

3.1.0

2 files

3.0.3

2 files

3.0.2

2 files

3.0.1

2 files

3.0.0

2 files

2.3.1

2 files

2.3.0

2 files

2.2.4

2 files

2.2.3

2 files

2.2.2

2 files

2.2.1

2 files

2.2.0

2 files

2.1.0

2 files

2.0.4

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

1.27.3

2 files

1.27.2

2 files

1.27.1

2 files

1.27.0

2 files

1.26.0

2 files

1.25.5

2 files

1.25.4

2 files

1.25.3

2 files

1.25.2

2 files

1.25.1

2 files

1.25.0

2 files

1.24.0

2 files

1.23.0

2 files

1.22.0

2 files

1.21.0

2 files

1.20.3

2 files

1.20.2

2 files

1.20.1

2 files

1.20.0

2 files

1.19.0

2 files

1.18.2

2 files

1.18.1

2 files

1.18.0

2 files

1.17.2

2 files

1.17.1

2 files

1.17.0

2 files

1.16.0

2 files

1.15.1

2 files

1.15.0

2 files

1.14.1

2 files

1.14.0

2 files

1.13.0

2 files

1.12.1

2 files

1.12.0

2 files

1.11.1

2 files

1.11.0

2 files

1.10.0

2 files

1.9.0

2 files

1.8.4

2 files

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