A modern Python library for converting Mass Spectrometry Imaging (MSI) data into SpatialData/Zarr format - your portal to spatial omics
Project description
Thyra
Thyra (from Greek θύρα, 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.
Features
- Multiple Input Formats: ImzML, Bruker (.d directories), Waters (.raw directories)
- SpatialData Output: Modern, cloud-ready format with Zarr backend
- Memory Efficient: Handles large datasets (100+ GB) through streaming processing
- Metadata Preservation: Extracts and maintains all acquisition parameters
- 3D Support: Process volume data or treat as 2D slices
- Cross-Platform: Windows, macOS, and Linux support
Installation
Via pip (Recommended)
pip install thyra
Via conda
conda install -c conda-forge thyra
From source
git clone https://github.com/Tomatokeftes/thyra.git
cd thyra
poetry install
Quick Start
Command Line Interface
# Basic conversion
thyra input.imzML output.zarr
# Bruker data with custom parameters
thyra data.d output.zarr --pixel-size 50 --dataset-id "experiment_001"
# Waters data
thyra data.raw output.zarr
# 3D volume processing
thyra volume.imzML output.zarr --handle-3d
Python API
from thyra import convert_msi
# Simple conversion
success = convert_msi(
input_path="data/sample.imzML",
output_path="output/sample.zarr",
pixel_size_um=25.0
)
# Advanced usage with custom parameters
success = convert_msi(
input_path="data/experiment.d",
output_path="output/experiment.zarr",
dataset_id="exp_001",
pixel_size_um=10.0,
handle_3d=True
)
Supported Formats
Input Formats
| Format | Extension | Description | Status |
|---|---|---|---|
| ImzML | .imzML |
Open standard for MS imaging | Full support |
| Bruker | .d |
Bruker proprietary format | Full support |
| Waters | .raw |
Waters MassLynx imaging format | Full support |
Output Formats
| Format | Description | Benefits |
|---|---|---|
| SpatialData/Zarr | Modern spatial omics standard | Cloud-ready, efficient, standardized |
Advanced Usage
Configuration Options
# All available options
thyra input.imzML output.zarr \
--pixel-size 25 \
--dataset-id "my_experiment" \
--handle-3d \
--optimize-chunks \
--log-level DEBUG \
--log-file conversion.log
Batch Processing
import glob
from thyra import convert_msi
# Process multiple files
for input_file in glob.glob("data/*.imzML"):
output_file = input_file.replace(".imzML", ".zarr")
convert_msi(input_file, output_file)
Working with SpatialData
import spatialdata as sd
# Load converted data
sdata = sd.read_zarr("output/sample.zarr")
# Access the MSI data
msi_data = sdata.tables["msi_dataset"]
print(f"Shape: {msi_data.shape}")
print(f"Mass channels: {msi_data.var.index}")
Development
Setup Development Environment
# Clone repository
git clone https://github.com/Tomatokeftes/thyra.git
cd thyra
# Install with development dependencies
poetry install
# Install pre-commit hooks
poetry run pre-commit install
Running Tests
# Unit tests only
poetry run pytest -m "not integration"
# All tests
poetry run pytest
# With coverage
poetry run pytest --cov=thyra
Code Quality
# Format code
poetry run black .
poetry run isort .
# Run linting
poetry run flake8
# Run all checks
poetry run pre-commit run --all-files
Documentation
- API Documentation: Auto-generated docs
- Contributing Guide: CONTRIBUTING.md
- Architecture Overview: docs/architecture.md
- Changelog: CHANGELOG.md
Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Quick Contribution Steps
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes and add tests
- Run the test suite (
poetry run pytest) - Commit your changes (
git commit -m 'Add amazing feature') - Push to your branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: t.visvikis@maastrichtuniversity.nl
Citation
If you use Thyra in your research, please cite:
@software{thyra2024,
title = {Thyra: Modern Mass Spectrometry Imaging Data Conversion - Portal to Spatial Omics},
author = {Visvikis, Theodoros},
year = {2024},
url = {https://github.com/Tomatokeftes/thyra}
}
Acknowledgments
- Built with SpatialData ecosystem
- Powered by Zarr for efficient storage
- Uses pyimzML for ImzML parsing
Thyra - Your portal from traditional MSI formats to modern spatial omics workflows
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file thyra-1.16.0.tar.gz.
File metadata
- Download URL: thyra-1.16.0.tar.gz
- Upload date:
- Size: 10.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eeade509f4ad9aec3090bf56f1bca798ffd701a131b3528b5c9cfe0c0d635e04
|
|
| MD5 |
d135d405f42b6101c48c43ec5e8713bb
|
|
| BLAKE2b-256 |
a98534f36469823b8ae9298c0cebc5a01be0494d5b5f898b9be00c82c7a6cdeb
|
Provenance
The following attestation bundles were made for thyra-1.16.0.tar.gz:
Publisher:
release.yml on M4i-Imaging-Mass-Spectrometry/thyra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
thyra-1.16.0.tar.gz -
Subject digest:
eeade509f4ad9aec3090bf56f1bca798ffd701a131b3528b5c9cfe0c0d635e04 - Sigstore transparency entry: 1030050038
- Sigstore integration time:
-
Permalink:
M4i-Imaging-Mass-Spectrometry/thyra@77fed1de8edc6129a9fb6908cfc3b928810529ec -
Branch / Tag:
refs/heads/main - Owner: https://github.com/M4i-Imaging-Mass-Spectrometry
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@77fed1de8edc6129a9fb6908cfc3b928810529ec -
Trigger Event:
push
-
Statement type:
File details
Details for the file thyra-1.16.0-py3-none-any.whl.
File metadata
- Download URL: thyra-1.16.0-py3-none-any.whl
- Upload date:
- Size: 10.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e512c7a8d97f226e75700c0bf23b68de034941871a25c1487c5d28d327e3898
|
|
| MD5 |
461a26803b1945828ea2d81883e8bc2f
|
|
| BLAKE2b-256 |
f7c1c0f945acefc7c8784ffa552d8f3117589498f28dc8a0a420508677f68801
|
Provenance
The following attestation bundles were made for thyra-1.16.0-py3-none-any.whl:
Publisher:
release.yml on M4i-Imaging-Mass-Spectrometry/thyra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
thyra-1.16.0-py3-none-any.whl -
Subject digest:
7e512c7a8d97f226e75700c0bf23b68de034941871a25c1487c5d28d327e3898 - Sigstore transparency entry: 1030050126
- Sigstore integration time:
-
Permalink:
M4i-Imaging-Mass-Spectrometry/thyra@77fed1de8edc6129a9fb6908cfc3b928810529ec -
Branch / Tag:
refs/heads/main - Owner: https://github.com/M4i-Imaging-Mass-Spectrometry
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@77fed1de8edc6129a9fb6908cfc3b928810529ec -
Trigger Event:
push
-
Statement type: