MaldiAMRKit 0.19.0__tar.gz → 0.20.0__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.
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0/MaldiAMRKit.egg-info}/PKG-INFO +16 -2
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/MaldiAMRKit.egg-info/SOURCES.txt +2 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/MaldiAMRKit.egg-info/requires.txt +8 -0
- {maldiamrkit-0.19.0/MaldiAMRKit.egg-info → maldiamrkit-0.20.0}/PKG-INFO +16 -2
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/README.md +10 -1
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/__init__.py +1 -1
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/input_layouts.py +18 -5
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/dataset.py +3 -2
- maldiamrkit-0.20.0/maldiamrkit/io/readers.py +600 -0
- maldiamrkit-0.20.0/maldiamrkit/io/writers.py +139 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/spectrum.py +8 -3
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/pyproject.toml +1 -0
- maldiamrkit-0.20.0/requirements-formats.txt +5 -0
- maldiamrkit-0.19.0/maldiamrkit/io/readers.py +0 -343
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/LICENSE +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/MaldiAMRKit.egg-info/dependency_links.txt +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/MaldiAMRKit.egg-info/entry_points.txt +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/MaldiAMRKit.egg-info/top_level.txt +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/_compat.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/_registry.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/alignment/__init__.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/alignment/peak_align.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/alignment/raw_warping.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/alignment/strategies.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/alignment/warping.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/cli.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/__init__.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/README.md +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v1.0.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v1.1.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v1.2.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v1.3.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v10.0.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v11.0.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v12.0.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v13.1.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v14.0.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v15.0.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v16.0.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v2.0.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v4.0.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v5.0.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v6.0.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v7.1.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v8.0.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v8.1.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/eucast/eucast_v9.0.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/breakpoints/example.yaml +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/builder.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/dataset_layouts.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/duplicates.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/loader.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/data/site_info.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/detection/__init__.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/detection/peak_detector.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/detection/peaklist.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/differential/__init__.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/differential/analysis.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/differential/plots.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/differential/stats.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/drift/__init__.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/drift/monitor.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/drift/pca_drift.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/drift/peak_drift.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/drift/plots.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/drift/reference.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/evaluation/__init__.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/evaluation/metrics.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/evaluation/mic_regression.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/evaluation/splitting.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/filters.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/io/__init__.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/io/mic.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/preprocessing/__init__.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/preprocessing/binning.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/preprocessing/merging.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/preprocessing/pipeline.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/preprocessing/preprocessing_pipeline.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/preprocessing/quality.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/preprocessing/transformers.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/py.typed +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/similarity/__init__.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/similarity/clustering.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/similarity/metrics.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/similarity/pairwise.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/similarity/plots.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/susceptibility/__init__.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/susceptibility/breakpoint.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/susceptibility/label_encoder.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/susceptibility/mic_encoder.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/visualization/__init__.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/visualization/_common.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/visualization/alignment_plots.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/visualization/exploratory_plots.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/visualization/peak_plots.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/maldiamrkit/visualization/spectrum_plots.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/requirements-batch.txt +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/requirements-dev.txt +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/requirements-docs.txt +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/requirements.txt +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/setup.cfg +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/tests/test_compat.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/tests/test_numerical_edge_cases.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/tests/test_peak_detector.py +0 -0
- {maldiamrkit-0.19.0 → maldiamrkit-0.20.0}/tests/test_peaklist.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: MaldiAMRKit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.20.0
|
|
4
4
|
Summary: A comprehensive toolkit for MALDI-TOF mass spectrometry data preprocessing for antimicrobial resistance (AMR) prediction purposes
|
|
5
5
|
Author-email: Ettore Rocchi <ettore.rocchi3@unibo.it>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -52,6 +52,11 @@ Requires-Dist: hypothesis>=6.0.0; extra == "dev"
|
|
|
52
52
|
Provides-Extra: batch
|
|
53
53
|
Requires-Dist: umap-learn>=0.5; extra == "batch"
|
|
54
54
|
Requires-Dist: combatlearn>=1.3; extra == "batch"
|
|
55
|
+
Provides-Extra: formats
|
|
56
|
+
Requires-Dist: pyteomics>=4.0; extra == "formats"
|
|
57
|
+
Requires-Dist: lxml>=4.0; extra == "formats"
|
|
58
|
+
Requires-Dist: psims>=1.0; extra == "formats"
|
|
59
|
+
Requires-Dist: pynumpress>=0.1.5; python_version >= "3.11" and extra == "formats"
|
|
55
60
|
Dynamic: license-file
|
|
56
61
|
|
|
57
62
|
# MaldiAMRKit
|
|
@@ -108,6 +113,14 @@ pip install maldiamrkit[batch]
|
|
|
108
113
|
|
|
109
114
|
Installs [`combatlearn`](https://github.com/EttoreRocchi/combatlearn) for ComBat-based batch effect correction and `umap-learn` for UMAP exploratory plots.
|
|
110
115
|
|
|
116
|
+
### Optional: extended mzML/mzXML support
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
pip install maldiamrkit[formats]
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`.mzML` and `.mzXML` files are read out of the box (zlib-compressed or uncompressed arrays). This extra installs [`pyteomics`](https://pyteomics.readthedocs.io/) with `lxml`, `psims`, and `pynumpress`, which additionally handle numpress-compressed arrays. `pynumpress` ships no wheels for Python 3.10, so numpress arrays need Python 3.11 or newer.
|
|
123
|
+
|
|
111
124
|
### Development Installation
|
|
112
125
|
|
|
113
126
|
```bash
|
|
@@ -160,9 +173,10 @@ pip install -e .[dev]
|
|
|
160
173
|
- **Dataset Building & Loading**: `DatasetBuilder` and `DatasetLoader` with pluggable layout adapters (`FlatLayout`, `BrukerTreeLayout`, `DRIAMSLayout`, `MARISMaLayout`)
|
|
161
174
|
- **Replicate Collapsing**: `DRIAMSLayout(collapse_replicates=True)` merges technical replicates (`_MALDI<N>`) to one row per isolate at load time via the active `duplicate_strategy`
|
|
162
175
|
- **Bruker Format Support**: Read Bruker flexAnalysis binary data (fid/1r + acqus) natively via `read_spectrum()` on directories
|
|
176
|
+
- **Open Formats**: Read `.mzML` and `.mzXML` files (optionally gzipped) via `read_spectrum()`, `MaldiSpectrum`, and `FlatLayout(spectrum_ext=".mzML")`; `pip install maldiamrkit[formats]` adds `pyteomics` for numpress-compressed arrays
|
|
163
177
|
- **MIC Parsing**: `parse_mic_column()` for parsing MIC strings with qualifiers and European decimals
|
|
164
178
|
- **Composable Filters**: `SpeciesFilter`, `DrugFilter`, `QualityFilter`, `MetadataFilter` combinable with `&`/`|`/`~` operators
|
|
165
|
-
- **Spectrum Export**: Save spectra to CSV or
|
|
179
|
+
- **Spectrum Export**: Save spectra to CSV, TXT, or mzML via `MaldiSpectrum.save()` and `MaldiSet.save_spectra()`
|
|
166
180
|
|
|
167
181
|
### Visualization & Tools
|
|
168
182
|
- **Exploratory Plots**: PCA, t-SNE, and UMAP scatter plots colored by species, resistance phenotype, or any metadata column
|
|
@@ -4,6 +4,7 @@ pyproject.toml
|
|
|
4
4
|
requirements-batch.txt
|
|
5
5
|
requirements-dev.txt
|
|
6
6
|
requirements-docs.txt
|
|
7
|
+
requirements-formats.txt
|
|
7
8
|
requirements.txt
|
|
8
9
|
MaldiAMRKit.egg-info/PKG-INFO
|
|
9
10
|
MaldiAMRKit.egg-info/SOURCES.txt
|
|
@@ -72,6 +73,7 @@ maldiamrkit/evaluation/splitting.py
|
|
|
72
73
|
maldiamrkit/io/__init__.py
|
|
73
74
|
maldiamrkit/io/mic.py
|
|
74
75
|
maldiamrkit/io/readers.py
|
|
76
|
+
maldiamrkit/io/writers.py
|
|
75
77
|
maldiamrkit/preprocessing/__init__.py
|
|
76
78
|
maldiamrkit/preprocessing/binning.py
|
|
77
79
|
maldiamrkit/preprocessing/merging.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: MaldiAMRKit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.20.0
|
|
4
4
|
Summary: A comprehensive toolkit for MALDI-TOF mass spectrometry data preprocessing for antimicrobial resistance (AMR) prediction purposes
|
|
5
5
|
Author-email: Ettore Rocchi <ettore.rocchi3@unibo.it>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -52,6 +52,11 @@ Requires-Dist: hypothesis>=6.0.0; extra == "dev"
|
|
|
52
52
|
Provides-Extra: batch
|
|
53
53
|
Requires-Dist: umap-learn>=0.5; extra == "batch"
|
|
54
54
|
Requires-Dist: combatlearn>=1.3; extra == "batch"
|
|
55
|
+
Provides-Extra: formats
|
|
56
|
+
Requires-Dist: pyteomics>=4.0; extra == "formats"
|
|
57
|
+
Requires-Dist: lxml>=4.0; extra == "formats"
|
|
58
|
+
Requires-Dist: psims>=1.0; extra == "formats"
|
|
59
|
+
Requires-Dist: pynumpress>=0.1.5; python_version >= "3.11" and extra == "formats"
|
|
55
60
|
Dynamic: license-file
|
|
56
61
|
|
|
57
62
|
# MaldiAMRKit
|
|
@@ -108,6 +113,14 @@ pip install maldiamrkit[batch]
|
|
|
108
113
|
|
|
109
114
|
Installs [`combatlearn`](https://github.com/EttoreRocchi/combatlearn) for ComBat-based batch effect correction and `umap-learn` for UMAP exploratory plots.
|
|
110
115
|
|
|
116
|
+
### Optional: extended mzML/mzXML support
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
pip install maldiamrkit[formats]
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`.mzML` and `.mzXML` files are read out of the box (zlib-compressed or uncompressed arrays). This extra installs [`pyteomics`](https://pyteomics.readthedocs.io/) with `lxml`, `psims`, and `pynumpress`, which additionally handle numpress-compressed arrays. `pynumpress` ships no wheels for Python 3.10, so numpress arrays need Python 3.11 or newer.
|
|
123
|
+
|
|
111
124
|
### Development Installation
|
|
112
125
|
|
|
113
126
|
```bash
|
|
@@ -160,9 +173,10 @@ pip install -e .[dev]
|
|
|
160
173
|
- **Dataset Building & Loading**: `DatasetBuilder` and `DatasetLoader` with pluggable layout adapters (`FlatLayout`, `BrukerTreeLayout`, `DRIAMSLayout`, `MARISMaLayout`)
|
|
161
174
|
- **Replicate Collapsing**: `DRIAMSLayout(collapse_replicates=True)` merges technical replicates (`_MALDI<N>`) to one row per isolate at load time via the active `duplicate_strategy`
|
|
162
175
|
- **Bruker Format Support**: Read Bruker flexAnalysis binary data (fid/1r + acqus) natively via `read_spectrum()` on directories
|
|
176
|
+
- **Open Formats**: Read `.mzML` and `.mzXML` files (optionally gzipped) via `read_spectrum()`, `MaldiSpectrum`, and `FlatLayout(spectrum_ext=".mzML")`; `pip install maldiamrkit[formats]` adds `pyteomics` for numpress-compressed arrays
|
|
163
177
|
- **MIC Parsing**: `parse_mic_column()` for parsing MIC strings with qualifiers and European decimals
|
|
164
178
|
- **Composable Filters**: `SpeciesFilter`, `DrugFilter`, `QualityFilter`, `MetadataFilter` combinable with `&`/`|`/`~` operators
|
|
165
|
-
- **Spectrum Export**: Save spectra to CSV or
|
|
179
|
+
- **Spectrum Export**: Save spectra to CSV, TXT, or mzML via `MaldiSpectrum.save()` and `MaldiSet.save_spectra()`
|
|
166
180
|
|
|
167
181
|
### Visualization & Tools
|
|
168
182
|
- **Exploratory Plots**: PCA, t-SNE, and UMAP scatter plots colored by species, resistance phenotype, or any metadata column
|
|
@@ -52,6 +52,14 @@ pip install maldiamrkit[batch]
|
|
|
52
52
|
|
|
53
53
|
Installs [`combatlearn`](https://github.com/EttoreRocchi/combatlearn) for ComBat-based batch effect correction and `umap-learn` for UMAP exploratory plots.
|
|
54
54
|
|
|
55
|
+
### Optional: extended mzML/mzXML support
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install maldiamrkit[formats]
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`.mzML` and `.mzXML` files are read out of the box (zlib-compressed or uncompressed arrays). This extra installs [`pyteomics`](https://pyteomics.readthedocs.io/) with `lxml`, `psims`, and `pynumpress`, which additionally handle numpress-compressed arrays. `pynumpress` ships no wheels for Python 3.10, so numpress arrays need Python 3.11 or newer.
|
|
62
|
+
|
|
55
63
|
### Development Installation
|
|
56
64
|
|
|
57
65
|
```bash
|
|
@@ -104,9 +112,10 @@ pip install -e .[dev]
|
|
|
104
112
|
- **Dataset Building & Loading**: `DatasetBuilder` and `DatasetLoader` with pluggable layout adapters (`FlatLayout`, `BrukerTreeLayout`, `DRIAMSLayout`, `MARISMaLayout`)
|
|
105
113
|
- **Replicate Collapsing**: `DRIAMSLayout(collapse_replicates=True)` merges technical replicates (`_MALDI<N>`) to one row per isolate at load time via the active `duplicate_strategy`
|
|
106
114
|
- **Bruker Format Support**: Read Bruker flexAnalysis binary data (fid/1r + acqus) natively via `read_spectrum()` on directories
|
|
115
|
+
- **Open Formats**: Read `.mzML` and `.mzXML` files (optionally gzipped) via `read_spectrum()`, `MaldiSpectrum`, and `FlatLayout(spectrum_ext=".mzML")`; `pip install maldiamrkit[formats]` adds `pyteomics` for numpress-compressed arrays
|
|
107
116
|
- **MIC Parsing**: `parse_mic_column()` for parsing MIC strings with qualifiers and European decimals
|
|
108
117
|
- **Composable Filters**: `SpeciesFilter`, `DrugFilter`, `QualityFilter`, `MetadataFilter` combinable with `&`/`|`/`~` operators
|
|
109
|
-
- **Spectrum Export**: Save spectra to CSV or
|
|
118
|
+
- **Spectrum Export**: Save spectra to CSV, TXT, or mzML via `MaldiSpectrum.save()` and `MaldiSet.save_spectra()`
|
|
110
119
|
|
|
111
120
|
### Visualization & Tools
|
|
112
121
|
- **Exploratory Plots**: PCA, t-SNE, and UMAP scatter plots colored by species, resistance phenotype, or any metadata column
|
|
@@ -80,6 +80,10 @@ class FlatLayout(InputLayout):
|
|
|
80
80
|
``spectra_dir`` is itself flat but the years are known from another
|
|
81
81
|
source. Takes precedence over the inferred subfolder year,
|
|
82
82
|
but not over ``year_column``.
|
|
83
|
+
spectrum_ext : str, default=".txt"
|
|
84
|
+
File extension of the spectrum files. Any format understood by
|
|
85
|
+
:func:`~maldiamrkit.io.read_spectrum` works, e.g. ``".mzML"`` or
|
|
86
|
+
``".mzXML"`` for open-format exports.
|
|
83
87
|
"""
|
|
84
88
|
|
|
85
89
|
def __init__(
|
|
@@ -90,30 +94,39 @@ class FlatLayout(InputLayout):
|
|
|
90
94
|
id_column: str = "ID",
|
|
91
95
|
year_column: str | None = None,
|
|
92
96
|
year_overrides: dict[str, str] | None = None,
|
|
97
|
+
spectrum_ext: str = ".txt",
|
|
93
98
|
) -> None:
|
|
94
99
|
self.spectra_dir = Path(spectra_dir)
|
|
95
100
|
self.metadata_csv = Path(metadata_csv)
|
|
96
101
|
self.id_column = id_column
|
|
97
102
|
self.year_column = year_column
|
|
98
103
|
self.year_overrides = year_overrides
|
|
104
|
+
self.spectrum_ext = (
|
|
105
|
+
spectrum_ext if spectrum_ext.startswith(".") else f".{spectrum_ext}"
|
|
106
|
+
)
|
|
99
107
|
self._year_map: dict[str, str] | None = None
|
|
100
108
|
self._folder_year_map: dict[str, str] = {}
|
|
101
109
|
|
|
102
110
|
def discover_spectra(self) -> list[Path]:
|
|
103
|
-
"""Find
|
|
111
|
+
"""Find spectrum files, whether flat or in (possibly nested) subfolders.
|
|
112
|
+
|
|
113
|
+
The extension is ``spectrum_ext`` (``.txt`` by default).
|
|
104
114
|
|
|
105
115
|
Files are searched flat first, then one level down, then
|
|
106
116
|
recursively. Whenever a spectrum sits under a four-digit-year
|
|
107
117
|
folder, that year is recorded so it can serve as a fallback when
|
|
108
118
|
no ``year_column`` is supplied (see :meth:`get_year`).
|
|
109
119
|
"""
|
|
110
|
-
|
|
120
|
+
pattern = f"*{self.spectrum_ext}"
|
|
121
|
+
files = sorted(self.spectra_dir.glob(pattern))
|
|
111
122
|
if not files:
|
|
112
|
-
files = sorted(self.spectra_dir.glob("
|
|
123
|
+
files = sorted(self.spectra_dir.glob(f"*/{pattern}"))
|
|
113
124
|
if not files:
|
|
114
|
-
files = sorted(self.spectra_dir.rglob(
|
|
125
|
+
files = sorted(self.spectra_dir.rglob(pattern))
|
|
115
126
|
if not files:
|
|
116
|
-
raise ValueError(
|
|
127
|
+
raise ValueError(
|
|
128
|
+
f"No {self.spectrum_ext} spectrum files found in {self.spectra_dir}"
|
|
129
|
+
)
|
|
117
130
|
|
|
118
131
|
self._folder_year_map = {}
|
|
119
132
|
for f in files:
|
|
@@ -625,8 +625,9 @@ class MaldiSet:
|
|
|
625
625
|
Which processing stage to save. One of ``"raw"``,
|
|
626
626
|
``"preprocessed"``, ``"binned"``.
|
|
627
627
|
fmt : str, default="txt"
|
|
628
|
-
Output format
|
|
629
|
-
tab-separated
|
|
628
|
+
Output format, also used as file extension. ``"csv"`` for
|
|
629
|
+
comma-separated, ``"txt"`` for tab-separated, ``"mzML"`` for
|
|
630
|
+
mzML files.
|
|
630
631
|
|
|
631
632
|
Raises
|
|
632
633
|
------
|