thyra 1.8.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- thyra-1.8.4/LICENSE +21 -0
- thyra-1.8.4/PKG-INFO +274 -0
- thyra-1.8.4/README.md +224 -0
- thyra-1.8.4/pyproject.toml +198 -0
- thyra-1.8.4/thyra/__init__.py +52 -0
- thyra-1.8.4/thyra/__main__.py +429 -0
- thyra-1.8.4/thyra/config.py +51 -0
- thyra-1.8.4/thyra/convert.py +294 -0
- thyra-1.8.4/thyra/converters/__init__.py +17 -0
- thyra-1.8.4/thyra/converters/spatialdata/__init__.py +11 -0
- thyra-1.8.4/thyra/converters/spatialdata/base_spatialdata_converter.py +1111 -0
- thyra-1.8.4/thyra/converters/spatialdata/converter.py +102 -0
- thyra-1.8.4/thyra/converters/spatialdata/spatialdata_2d_converter.py +326 -0
- thyra-1.8.4/thyra/converters/spatialdata/spatialdata_3d_converter.py +305 -0
- thyra-1.8.4/thyra/core/__init__.py +13 -0
- thyra-1.8.4/thyra/core/base_converter.py +525 -0
- thyra-1.8.4/thyra/core/base_extractor.py +85 -0
- thyra-1.8.4/thyra/core/base_reader.py +131 -0
- thyra-1.8.4/thyra/core/registry.py +160 -0
- thyra-1.8.4/thyra/metadata/__init__.py +138 -0
- thyra-1.8.4/thyra/metadata/extractors/__init__.py +80 -0
- thyra-1.8.4/thyra/metadata/extractors/bruker_extractor.py +372 -0
- thyra-1.8.4/thyra/metadata/extractors/imzml_extractor.py +409 -0
- thyra-1.8.4/thyra/metadata/ontology/__init__.py +0 -0
- thyra-1.8.4/thyra/metadata/ontology/_ims.py +191 -0
- thyra-1.8.4/thyra/metadata/ontology/_ms.py +3738 -0
- thyra-1.8.4/thyra/metadata/ontology/_uo.py +398 -0
- thyra-1.8.4/thyra/metadata/ontology/cache.py +100 -0
- thyra-1.8.4/thyra/metadata/types.py +57 -0
- thyra-1.8.4/thyra/metadata/validator.py +163 -0
- thyra-1.8.4/thyra/readers/__init__.py +4 -0
- thyra-1.8.4/thyra/readers/bruker/__init__.py +22 -0
- thyra-1.8.4/thyra/readers/bruker/bruker_reader.py +848 -0
- thyra-1.8.4/thyra/readers/bruker/sdk/__init__.py +7 -0
- thyra-1.8.4/thyra/readers/bruker/sdk/dll/README.md +37 -0
- thyra-1.8.4/thyra/readers/bruker/sdk/dll/timsdata.dll +0 -0
- thyra-1.8.4/thyra/readers/bruker/sdk/dll/timsdata.so +0 -0
- thyra-1.8.4/thyra/readers/bruker/sdk/dll_manager.py +230 -0
- thyra-1.8.4/thyra/readers/bruker/sdk/platform_detector.py +310 -0
- thyra-1.8.4/thyra/readers/bruker/sdk/sdk_functions.py +430 -0
- thyra-1.8.4/thyra/readers/bruker/utils/__init__.py +14 -0
- thyra-1.8.4/thyra/readers/bruker/utils/batch_processor.py +497 -0
- thyra-1.8.4/thyra/readers/bruker/utils/coordinate_cache.py +423 -0
- thyra-1.8.4/thyra/readers/bruker/utils/mass_axis_builder.py +386 -0
- thyra-1.8.4/thyra/readers/bruker/utils/memory_manager.py +404 -0
- thyra-1.8.4/thyra/readers/imzml_reader.py +489 -0
- thyra-1.8.4/thyra/resampling/__init__.py +22 -0
- thyra-1.8.4/thyra/resampling/common_axis.py +106 -0
- thyra-1.8.4/thyra/resampling/decision_tree.py +213 -0
- thyra-1.8.4/thyra/resampling/mass_axis/__init__.py +17 -0
- thyra-1.8.4/thyra/resampling/mass_axis/base_generator.py +61 -0
- thyra-1.8.4/thyra/resampling/mass_axis/fticr_generator.py +129 -0
- thyra-1.8.4/thyra/resampling/mass_axis/linear_generator.py +67 -0
- thyra-1.8.4/thyra/resampling/mass_axis/linear_tof_generator.py +132 -0
- thyra-1.8.4/thyra/resampling/mass_axis/orbitrap_generator.py +130 -0
- thyra-1.8.4/thyra/resampling/mass_axis/reflector_tof_generator.py +130 -0
- thyra-1.8.4/thyra/resampling/strategies/__init__.py +11 -0
- thyra-1.8.4/thyra/resampling/strategies/base.py +51 -0
- thyra-1.8.4/thyra/resampling/strategies/nearest_neighbor.py +83 -0
- thyra-1.8.4/thyra/resampling/strategies/tic_preserving.py +109 -0
- thyra-1.8.4/thyra/resampling/types.py +65 -0
- thyra-1.8.4/thyra/tools/__init__.py +8 -0
- thyra-1.8.4/thyra/tools/check_ontology.py +93 -0
- thyra-1.8.4/thyra/utils/__init__.py +27 -0
- thyra-1.8.4/thyra/utils/bruker_exceptions.py +49 -0
- thyra-1.8.4/thyra/utils/data_processors.py +95 -0
- thyra-1.8.4/thyra/utils/logging_config.py +48 -0
thyra-1.8.4/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Theodoros Visvikis
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
thyra-1.8.4/PKG-INFO
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: thyra
|
|
3
|
+
Version: 1.8.4
|
|
4
|
+
Summary: A modern Python library for converting Mass Spectrometry Imaging (MSI) data into SpatialData/Zarr format - your portal to spatial omics
|
|
5
|
+
License: MIT
|
|
6
|
+
Keywords: mass-spectrometry,imaging,spatialdata,zarr,omics,bioinformatics,msi,imzml,bruker,spatial-omics,data-conversion,scientific-computing
|
|
7
|
+
Author: Theodoros Visvikis
|
|
8
|
+
Author-email: t.visvikis@maastrichtuniversity.nl
|
|
9
|
+
Maintainer: Theodoros Visvikis
|
|
10
|
+
Maintainer-email: t.visvikis@maastrichtuniversity.nl
|
|
11
|
+
Requires-Python: >=3.11,<3.13
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Topic :: File Formats
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
|
+
Classifier: Typing :: Typed
|
|
27
|
+
Requires-Dist: Shapely (>=1.8.0)
|
|
28
|
+
Requires-Dist: anndata (>=0.11.0)
|
|
29
|
+
Requires-Dist: cryptography (>=45.0.5,<46.0.0)
|
|
30
|
+
Requires-Dist: dask (>=2023.0.0)
|
|
31
|
+
Requires-Dist: geopandas (>=0.9.0)
|
|
32
|
+
Requires-Dist: lxml (>=4.6.0)
|
|
33
|
+
Requires-Dist: matplotlib (>=3.10.6,<4.0.0)
|
|
34
|
+
Requires-Dist: numpy (>=2.0.0)
|
|
35
|
+
Requires-Dist: pandas (>=2.0.0)
|
|
36
|
+
Requires-Dist: pyimzML (>=1.4.0)
|
|
37
|
+
Requires-Dist: scipy (>=1.7.0)
|
|
38
|
+
Requires-Dist: spatialdata (>=0.2.0)
|
|
39
|
+
Requires-Dist: tqdm (>=4.50.0)
|
|
40
|
+
Requires-Dist: zarr (>=3.0.0)
|
|
41
|
+
Project-URL: Bug Tracker, https://github.com/Tomatokeftes/thyra/issues
|
|
42
|
+
Project-URL: Changelog, https://github.com/Tomatokeftes/thyra/blob/main/CHANGELOG.md
|
|
43
|
+
Project-URL: Contributing, https://github.com/Tomatokeftes/thyra/blob/main/CONTRIBUTING.md
|
|
44
|
+
Project-URL: Documentation, https://github.com/Tomatokeftes/thyra#readme
|
|
45
|
+
Project-URL: Discussions, https://github.com/Tomatokeftes/thyra/discussions
|
|
46
|
+
Project-URL: Homepage, https://github.com/Tomatokeftes/thyra
|
|
47
|
+
Project-URL: Repository, https://github.com/Tomatokeftes/thyra
|
|
48
|
+
Description-Content-Type: text/markdown
|
|
49
|
+
|
|
50
|
+
# Thyra
|
|
51
|
+
|
|
52
|
+
[](https://github.com/Tomatokeftes/thyra/actions/workflows/tests.yml)
|
|
53
|
+
[](https://www.python.org/downloads/)
|
|
54
|
+
[](https://opensource.org/licenses/MIT)
|
|
55
|
+
[](https://github.com/psf/black)
|
|
56
|
+
|
|
57
|
+
**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.
|
|
58
|
+
|
|
59
|
+
## Features
|
|
60
|
+
|
|
61
|
+
- **Multiple Input Formats**: ImzML, Bruker (.d directories)
|
|
62
|
+
- **SpatialData Output**: Modern, cloud-ready format with Zarr backend
|
|
63
|
+
- **Memory Efficient**: Handles large datasets (100+ GB) through streaming processing
|
|
64
|
+
- **Metadata Preservation**: Extracts and maintains all acquisition parameters
|
|
65
|
+
- **3D Support**: Process volume data or treat as 2D slices
|
|
66
|
+
- **Cross-Platform**: Windows, macOS, and Linux support
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
|
|
70
|
+
### Via pip (Recommended)
|
|
71
|
+
```bash
|
|
72
|
+
pip install thyra
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Via conda
|
|
76
|
+
```bash
|
|
77
|
+
conda install -c conda-forge thyra
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### From source
|
|
81
|
+
```bash
|
|
82
|
+
git clone https://github.com/Tomatokeftes/thyra.git
|
|
83
|
+
cd thyra
|
|
84
|
+
poetry install
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Quick Start
|
|
88
|
+
|
|
89
|
+
### Command Line Interface
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Basic conversion
|
|
93
|
+
thyra input.imzML output.zarr
|
|
94
|
+
|
|
95
|
+
# With custom parameters
|
|
96
|
+
thyra data.d output.zarr --pixel-size 50 --dataset-id "experiment_001"
|
|
97
|
+
|
|
98
|
+
# 3D volume processing
|
|
99
|
+
thyra volume.imzML output.zarr --handle-3d
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Python API
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from thyra import convert_msi
|
|
106
|
+
|
|
107
|
+
# Simple conversion
|
|
108
|
+
success = convert_msi(
|
|
109
|
+
input_path="data/sample.imzML",
|
|
110
|
+
output_path="output/sample.zarr",
|
|
111
|
+
pixel_size_um=25.0
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
# Advanced usage with custom parameters
|
|
115
|
+
success = convert_msi(
|
|
116
|
+
input_path="data/experiment.d",
|
|
117
|
+
output_path="output/experiment.zarr",
|
|
118
|
+
dataset_id="exp_001",
|
|
119
|
+
pixel_size_um=10.0,
|
|
120
|
+
handle_3d=True
|
|
121
|
+
)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Supported Formats
|
|
125
|
+
|
|
126
|
+
### Input Formats
|
|
127
|
+
| Format | Extension | Description | Status |
|
|
128
|
+
|--------|-----------|-------------|--------|
|
|
129
|
+
| ImzML | `.imzML` | Open standard for MS imaging | ✅ Full support |
|
|
130
|
+
| Bruker | `.d` | Bruker proprietary format | ✅ Full support |
|
|
131
|
+
|
|
132
|
+
### Output Formats
|
|
133
|
+
| Format | Description | Benefits |
|
|
134
|
+
|--------|-------------|----------|
|
|
135
|
+
| SpatialData/Zarr | Modern spatial omics standard | Cloud-ready, efficient, standardized |
|
|
136
|
+
|
|
137
|
+
## Advanced Usage
|
|
138
|
+
|
|
139
|
+
### Configuration Options
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
# All available options
|
|
143
|
+
thyra input.imzML output.zarr \
|
|
144
|
+
--pixel-size 25 \
|
|
145
|
+
--dataset-id "my_experiment" \
|
|
146
|
+
--handle-3d \
|
|
147
|
+
--optimize-chunks \
|
|
148
|
+
--log-level DEBUG \
|
|
149
|
+
--log-file conversion.log
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Batch Processing
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
import glob
|
|
156
|
+
from thyra import convert_msi
|
|
157
|
+
|
|
158
|
+
# Process multiple files
|
|
159
|
+
for input_file in glob.glob("data/*.imzML"):
|
|
160
|
+
output_file = input_file.replace(".imzML", ".zarr")
|
|
161
|
+
convert_msi(input_file, output_file)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Working with SpatialData
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
import spatialdata as sd
|
|
168
|
+
|
|
169
|
+
# Load converted data
|
|
170
|
+
sdata = sd.read_zarr("output/sample.zarr")
|
|
171
|
+
|
|
172
|
+
# Access the MSI data
|
|
173
|
+
msi_data = sdata.tables["msi_dataset"]
|
|
174
|
+
print(f"Shape: {msi_data.shape}")
|
|
175
|
+
print(f"Mass channels: {msi_data.var.index}")
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Development
|
|
179
|
+
|
|
180
|
+
### Setup Development Environment
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# Clone repository
|
|
184
|
+
git clone https://github.com/Tomatokeftes/thyra.git
|
|
185
|
+
cd thyra
|
|
186
|
+
|
|
187
|
+
# Install with development dependencies
|
|
188
|
+
poetry install
|
|
189
|
+
|
|
190
|
+
# Install pre-commit hooks
|
|
191
|
+
poetry run pre-commit install
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Running Tests
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# Unit tests only
|
|
198
|
+
poetry run pytest -m "not integration"
|
|
199
|
+
|
|
200
|
+
# All tests
|
|
201
|
+
poetry run pytest
|
|
202
|
+
|
|
203
|
+
# With coverage
|
|
204
|
+
poetry run pytest --cov=thyra
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Code Quality
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Format code
|
|
211
|
+
poetry run black .
|
|
212
|
+
poetry run isort .
|
|
213
|
+
|
|
214
|
+
# Run linting
|
|
215
|
+
poetry run flake8
|
|
216
|
+
|
|
217
|
+
# Run all checks
|
|
218
|
+
poetry run pre-commit run --all-files
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Documentation
|
|
222
|
+
|
|
223
|
+
- **API Documentation**: [Auto-generated docs](https://github.com/Tomatokeftes/thyra#readme)
|
|
224
|
+
- **Contributing Guide**: [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
225
|
+
- **Architecture Overview**: [docs/architecture.md](docs/architecture.md)
|
|
226
|
+
- **Changelog**: [CHANGELOG.md](CHANGELOG.md)
|
|
227
|
+
|
|
228
|
+
## Contributing
|
|
229
|
+
|
|
230
|
+
We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.
|
|
231
|
+
|
|
232
|
+
### Quick Contribution Steps
|
|
233
|
+
|
|
234
|
+
1. Fork the repository
|
|
235
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
236
|
+
3. Make your changes and add tests
|
|
237
|
+
4. Run the test suite (`poetry run pytest`)
|
|
238
|
+
5. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
239
|
+
6. Push to your branch (`git push origin feature/amazing-feature`)
|
|
240
|
+
7. Open a Pull Request
|
|
241
|
+
|
|
242
|
+
## License
|
|
243
|
+
|
|
244
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
245
|
+
|
|
246
|
+
## Support
|
|
247
|
+
|
|
248
|
+
- **Issues**: [GitHub Issues](https://github.com/Tomatokeftes/thyra/issues)
|
|
249
|
+
- **Discussions**: [GitHub Discussions](https://github.com/Tomatokeftes/thyra/discussions)
|
|
250
|
+
- **Email**: t.visvikis@maastrichtuniversity.nl
|
|
251
|
+
|
|
252
|
+
## Citation
|
|
253
|
+
|
|
254
|
+
If you use Thyra in your research, please cite:
|
|
255
|
+
|
|
256
|
+
```bibtex
|
|
257
|
+
@software{thyra2024,
|
|
258
|
+
title = {Thyra: Modern Mass Spectrometry Imaging Data Conversion - Portal to Spatial Omics},
|
|
259
|
+
author = {Visvikis, Theodoros},
|
|
260
|
+
year = {2024},
|
|
261
|
+
url = {https://github.com/Tomatokeftes/thyra}
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Acknowledgments
|
|
266
|
+
|
|
267
|
+
- Built with [SpatialData](https://spatialdata.scverse.org/) ecosystem
|
|
268
|
+
- Powered by [Zarr](https://zarr.readthedocs.io/) for efficient storage
|
|
269
|
+
- Uses [pyimzML](https://github.com/alexandrovteam/pyimzML) for ImzML parsing
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
**Thyra** - Your portal from traditional MSI formats to modern spatial omics workflows
|
|
274
|
+
|
thyra-1.8.4/README.md
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Thyra
|
|
2
|
+
|
|
3
|
+
[](https://github.com/Tomatokeftes/thyra/actions/workflows/tests.yml)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://github.com/psf/black)
|
|
7
|
+
|
|
8
|
+
**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.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- **Multiple Input Formats**: ImzML, Bruker (.d directories)
|
|
13
|
+
- **SpatialData Output**: Modern, cloud-ready format with Zarr backend
|
|
14
|
+
- **Memory Efficient**: Handles large datasets (100+ GB) through streaming processing
|
|
15
|
+
- **Metadata Preservation**: Extracts and maintains all acquisition parameters
|
|
16
|
+
- **3D Support**: Process volume data or treat as 2D slices
|
|
17
|
+
- **Cross-Platform**: Windows, macOS, and Linux support
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
### Via pip (Recommended)
|
|
22
|
+
```bash
|
|
23
|
+
pip install thyra
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Via conda
|
|
27
|
+
```bash
|
|
28
|
+
conda install -c conda-forge thyra
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### From source
|
|
32
|
+
```bash
|
|
33
|
+
git clone https://github.com/Tomatokeftes/thyra.git
|
|
34
|
+
cd thyra
|
|
35
|
+
poetry install
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
### Command Line Interface
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Basic conversion
|
|
44
|
+
thyra input.imzML output.zarr
|
|
45
|
+
|
|
46
|
+
# With custom parameters
|
|
47
|
+
thyra data.d output.zarr --pixel-size 50 --dataset-id "experiment_001"
|
|
48
|
+
|
|
49
|
+
# 3D volume processing
|
|
50
|
+
thyra volume.imzML output.zarr --handle-3d
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Python API
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from thyra import convert_msi
|
|
57
|
+
|
|
58
|
+
# Simple conversion
|
|
59
|
+
success = convert_msi(
|
|
60
|
+
input_path="data/sample.imzML",
|
|
61
|
+
output_path="output/sample.zarr",
|
|
62
|
+
pixel_size_um=25.0
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
# Advanced usage with custom parameters
|
|
66
|
+
success = convert_msi(
|
|
67
|
+
input_path="data/experiment.d",
|
|
68
|
+
output_path="output/experiment.zarr",
|
|
69
|
+
dataset_id="exp_001",
|
|
70
|
+
pixel_size_um=10.0,
|
|
71
|
+
handle_3d=True
|
|
72
|
+
)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Supported Formats
|
|
76
|
+
|
|
77
|
+
### Input Formats
|
|
78
|
+
| Format | Extension | Description | Status |
|
|
79
|
+
|--------|-----------|-------------|--------|
|
|
80
|
+
| ImzML | `.imzML` | Open standard for MS imaging | ✅ Full support |
|
|
81
|
+
| Bruker | `.d` | Bruker proprietary format | ✅ Full support |
|
|
82
|
+
|
|
83
|
+
### Output Formats
|
|
84
|
+
| Format | Description | Benefits |
|
|
85
|
+
|--------|-------------|----------|
|
|
86
|
+
| SpatialData/Zarr | Modern spatial omics standard | Cloud-ready, efficient, standardized |
|
|
87
|
+
|
|
88
|
+
## Advanced Usage
|
|
89
|
+
|
|
90
|
+
### Configuration Options
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# All available options
|
|
94
|
+
thyra input.imzML output.zarr \
|
|
95
|
+
--pixel-size 25 \
|
|
96
|
+
--dataset-id "my_experiment" \
|
|
97
|
+
--handle-3d \
|
|
98
|
+
--optimize-chunks \
|
|
99
|
+
--log-level DEBUG \
|
|
100
|
+
--log-file conversion.log
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Batch Processing
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
import glob
|
|
107
|
+
from thyra import convert_msi
|
|
108
|
+
|
|
109
|
+
# Process multiple files
|
|
110
|
+
for input_file in glob.glob("data/*.imzML"):
|
|
111
|
+
output_file = input_file.replace(".imzML", ".zarr")
|
|
112
|
+
convert_msi(input_file, output_file)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Working with SpatialData
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
import spatialdata as sd
|
|
119
|
+
|
|
120
|
+
# Load converted data
|
|
121
|
+
sdata = sd.read_zarr("output/sample.zarr")
|
|
122
|
+
|
|
123
|
+
# Access the MSI data
|
|
124
|
+
msi_data = sdata.tables["msi_dataset"]
|
|
125
|
+
print(f"Shape: {msi_data.shape}")
|
|
126
|
+
print(f"Mass channels: {msi_data.var.index}")
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Development
|
|
130
|
+
|
|
131
|
+
### Setup Development Environment
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Clone repository
|
|
135
|
+
git clone https://github.com/Tomatokeftes/thyra.git
|
|
136
|
+
cd thyra
|
|
137
|
+
|
|
138
|
+
# Install with development dependencies
|
|
139
|
+
poetry install
|
|
140
|
+
|
|
141
|
+
# Install pre-commit hooks
|
|
142
|
+
poetry run pre-commit install
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Running Tests
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# Unit tests only
|
|
149
|
+
poetry run pytest -m "not integration"
|
|
150
|
+
|
|
151
|
+
# All tests
|
|
152
|
+
poetry run pytest
|
|
153
|
+
|
|
154
|
+
# With coverage
|
|
155
|
+
poetry run pytest --cov=thyra
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Code Quality
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Format code
|
|
162
|
+
poetry run black .
|
|
163
|
+
poetry run isort .
|
|
164
|
+
|
|
165
|
+
# Run linting
|
|
166
|
+
poetry run flake8
|
|
167
|
+
|
|
168
|
+
# Run all checks
|
|
169
|
+
poetry run pre-commit run --all-files
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Documentation
|
|
173
|
+
|
|
174
|
+
- **API Documentation**: [Auto-generated docs](https://github.com/Tomatokeftes/thyra#readme)
|
|
175
|
+
- **Contributing Guide**: [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
176
|
+
- **Architecture Overview**: [docs/architecture.md](docs/architecture.md)
|
|
177
|
+
- **Changelog**: [CHANGELOG.md](CHANGELOG.md)
|
|
178
|
+
|
|
179
|
+
## Contributing
|
|
180
|
+
|
|
181
|
+
We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.
|
|
182
|
+
|
|
183
|
+
### Quick Contribution Steps
|
|
184
|
+
|
|
185
|
+
1. Fork the repository
|
|
186
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
187
|
+
3. Make your changes and add tests
|
|
188
|
+
4. Run the test suite (`poetry run pytest`)
|
|
189
|
+
5. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
190
|
+
6. Push to your branch (`git push origin feature/amazing-feature`)
|
|
191
|
+
7. Open a Pull Request
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
196
|
+
|
|
197
|
+
## Support
|
|
198
|
+
|
|
199
|
+
- **Issues**: [GitHub Issues](https://github.com/Tomatokeftes/thyra/issues)
|
|
200
|
+
- **Discussions**: [GitHub Discussions](https://github.com/Tomatokeftes/thyra/discussions)
|
|
201
|
+
- **Email**: t.visvikis@maastrichtuniversity.nl
|
|
202
|
+
|
|
203
|
+
## Citation
|
|
204
|
+
|
|
205
|
+
If you use Thyra in your research, please cite:
|
|
206
|
+
|
|
207
|
+
```bibtex
|
|
208
|
+
@software{thyra2024,
|
|
209
|
+
title = {Thyra: Modern Mass Spectrometry Imaging Data Conversion - Portal to Spatial Omics},
|
|
210
|
+
author = {Visvikis, Theodoros},
|
|
211
|
+
year = {2024},
|
|
212
|
+
url = {https://github.com/Tomatokeftes/thyra}
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Acknowledgments
|
|
217
|
+
|
|
218
|
+
- Built with [SpatialData](https://spatialdata.scverse.org/) ecosystem
|
|
219
|
+
- Powered by [Zarr](https://zarr.readthedocs.io/) for efficient storage
|
|
220
|
+
- Uses [pyimzML](https://github.com/alexandrovteam/pyimzML) for ImzML parsing
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
**Thyra** - Your portal from traditional MSI formats to modern spatial omics workflows
|