pygecko-gc 0.1.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.
- pygecko_gc-0.1.0/LICENSE.txt +21 -0
- pygecko_gc-0.1.0/PKG-INFO +248 -0
- pygecko_gc-0.1.0/README.md +198 -0
- pygecko_gc-0.1.0/pygecko/__init__.py +9 -0
- pygecko_gc-0.1.0/pygecko/analysis/__init__.py +1 -0
- pygecko_gc-0.1.0/pygecko/analysis/analysis.py +534 -0
- pygecko_gc-0.1.0/pygecko/data_handling/__init__.py +1 -0
- pygecko_gc-0.1.0/pygecko/data_handling/reports.py +423 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/__init__.py +10 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/analysis/__init__.py +4 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/analysis/analysis_settings.py +165 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/analysis/quantification.py +95 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/analysis/retention_indices.py +214 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/analysis/spectral_matching.py +206 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/analyte.py +41 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/history.py +175 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/injection/__init__.py +3 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/injection/fid_injection.py +197 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/injection/injection.py +393 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/injection/ms_injection.py +256 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/peak/__init__.py +5 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/peak/fid_peak.py +25 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/peak/ms_peak.py +65 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/peak/peak.py +43 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/peak/peak_detection_fid.py +351 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/peak/peak_detection_ms.py +134 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/sequence/__init__.py +3 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/sequence/fid_sequence.py +16 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/sequence/gc_sequence.py +180 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/sequence/ms_sequence.py +15 -0
- pygecko_gc-0.1.0/pygecko/gc_tools/utilities.py +88 -0
- pygecko_gc-0.1.0/pygecko/parsers/__init__.py +12 -0
- pygecko_gc-0.1.0/pygecko/parsers/agilent_fid_parser.py +585 -0
- pygecko_gc-0.1.0/pygecko/parsers/agilent_ms_parser.py +209 -0
- pygecko_gc-0.1.0/pygecko/parsers/fid_base_parser.py +97 -0
- pygecko_gc-0.1.0/pygecko/parsers/file_readers.py +119 -0
- pygecko_gc-0.1.0/pygecko/parsers/file_writers.py +183 -0
- pygecko_gc-0.1.0/pygecko/parsers/ms_base_parser.py +156 -0
- pygecko_gc-0.1.0/pygecko/parsers/msconvert_wraper.py +70 -0
- pygecko_gc-0.1.0/pygecko/parsers/splitgc_parser.py +228 -0
- pygecko_gc-0.1.0/pygecko/parsers/utilities.py +35 -0
- pygecko_gc-0.1.0/pygecko/reaction/__init__.py +15 -0
- pygecko_gc-0.1.0/pygecko/reaction/array.py +201 -0
- pygecko_gc-0.1.0/pygecko/reaction/layout.py +62 -0
- pygecko_gc-0.1.0/pygecko/reaction/reaction_parser.py +236 -0
- pygecko_gc-0.1.0/pygecko/reaction/transformation.py +42 -0
- pygecko_gc-0.1.0/pygecko/reaction/utilities.py +26 -0
- pygecko_gc-0.1.0/pygecko/visualization/__init__.py +2 -0
- pygecko_gc-0.1.0/pygecko/visualization/utilities.py +64 -0
- pygecko_gc-0.1.0/pygecko/visualization/visuals.py +335 -0
- pygecko_gc-0.1.0/pygecko_gc.egg-info/PKG-INFO +248 -0
- pygecko_gc-0.1.0/pygecko_gc.egg-info/SOURCES.txt +55 -0
- pygecko_gc-0.1.0/pygecko_gc.egg-info/dependency_links.txt +1 -0
- pygecko_gc-0.1.0/pygecko_gc.egg-info/requires.txt +28 -0
- pygecko_gc-0.1.0/pygecko_gc.egg-info/top_level.txt +1 -0
- pygecko_gc-0.1.0/pyproject.toml +73 -0
- pygecko_gc-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Felix Katzenburg
|
|
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.
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pygecko-gc
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: An open-source Python library for the parsing, processing and analysis of GC/MS and GC/FID raw data
|
|
5
|
+
Author-email: Felix Katzenburg <felix.katzenburg@uni-muenster.de>, Florian Boser <florian.boser@uni-muenster.de>
|
|
6
|
+
License: MIT License
|
|
7
|
+
Project-URL: Homepage, https://github.com/FelixKatz77/pyGecko
|
|
8
|
+
Project-URL: Documentation, https://pygecko.readthedocs.io/en/latest/
|
|
9
|
+
Project-URL: Repository, https://github.com/FelixKatz77/pyGecko
|
|
10
|
+
Project-URL: Issues, https://github.com/FelixKatz77/pyGecko/issues
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
15
|
+
Classifier: Operating System :: Microsoft :: Windows :: Windows 11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE.txt
|
|
24
|
+
Requires-Dist: brain_isotopic_distribution>=1.5.14
|
|
25
|
+
Requires-Dist: epam.indigo>=1.13.0
|
|
26
|
+
Requires-Dist: lxml>=6.1.0
|
|
27
|
+
Requires-Dist: matplotlib>=3.6.2
|
|
28
|
+
Requires-Dist: netCDF4>=1.6.5
|
|
29
|
+
Requires-Dist: numpy>=1.26.3
|
|
30
|
+
Requires-Dist: pandas>=2.0.3
|
|
31
|
+
Requires-Dist: pybaselines>=1.0.0
|
|
32
|
+
Requires-Dist: psims>=1.3.2
|
|
33
|
+
Requires-Dist: pymzml>=2.5.2
|
|
34
|
+
Requires-Dist: pyteomics[xml]>=4.6.2
|
|
35
|
+
Requires-Dist: rdkit>=2023.3.1
|
|
36
|
+
Requires-Dist: reportlab>=4.0.5
|
|
37
|
+
Requires-Dist: scikit-learn>=1.7.2
|
|
38
|
+
Requires-Dist: scipy>=1.11.4
|
|
39
|
+
Requires-Dist: statsmodels>=0.14.0
|
|
40
|
+
Requires-Dist: xarray>=2023.6.0
|
|
41
|
+
Provides-Extra: ord
|
|
42
|
+
Requires-Dist: ord-schema>=0.5.9; extra == "ord"
|
|
43
|
+
Provides-Extra: test
|
|
44
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
45
|
+
Requires-Dist: pytest-cov>=5; extra == "test"
|
|
46
|
+
Provides-Extra: docs
|
|
47
|
+
Requires-Dist: sphinx>=7; extra == "docs"
|
|
48
|
+
Requires-Dist: sphinx-rtd-theme>=2; extra == "docs"
|
|
49
|
+
Dynamic: license-file
|
|
50
|
+
|
|
51
|
+
# pyGecko
|
|
52
|
+
<img src="docs/pyGecko_icon.png" alt="pyGecko_Logo" width="300" height="300"/>
|
|
53
|
+
|
|
54
|
+
> pyGecko an open-source Python library for the parsing, processing and analysis of GC-MS and GC-FID raw data.
|
|
55
|
+
|
|
56
|
+
With increasing amounts of analytical and metadata generated in HTE, data processing and analysis quickly become a
|
|
57
|
+
workflow's limiting step if conducted manually. The automated processing of analytical data opens up time for chemists
|
|
58
|
+
to focus on relevant outcomes, enables the standardized storage of reaction data, and facilitates the integration of
|
|
59
|
+
analytical methods into closed-loop systems. Herein we present pyGecko, an open-source Python library for the parsing,
|
|
60
|
+
processing and analysis of GC-MS and GC-FID raw data. pyGecko offers a variety of analysis tools for the automated or
|
|
61
|
+
semi-automated handling of GC measurements and sequences. This includes the interpretation of measurements in the context
|
|
62
|
+
of the experiment, the automatic identification of internal standards and compound identifications based on retention
|
|
63
|
+
times, the mass of a molecular ion or fragment and spectral comparison. Quantification relative to an internal standard
|
|
64
|
+
can be performed for GC-FID measurements. Results of an analysis as well as chromatograms and spectra can be visualized
|
|
65
|
+
and reported in standardized formats like the Open Reaction Database (ORD) schema. pyGecko is designed to be easily
|
|
66
|
+
integrated into automated workflows and can be used as a stand-alone tool or as a python library.
|
|
67
|
+
|
|
68
|
+
Preprint: https://chemrxiv.org/engage/chemrxiv/article-details/66adfc465101a2ffa8001761 <br>
|
|
69
|
+
Paper: https://doi.org/10.1039/D4DD00347K
|
|
70
|
+
|
|
71
|
+
## Installation
|
|
72
|
+
|
|
73
|
+
> [!IMPORTANT]
|
|
74
|
+
> To read vendor files you need to install the msConvert tool from ProteoWizard. You can download it from [here](http://proteowizard.sourceforge.net/download.html).
|
|
75
|
+
> You need to specify the path to the msConvert.exe before the first run of pyGecko.
|
|
76
|
+
|
|
77
|
+
pyGecko requires Python 3.10 or newer and is published on PyPI as `pygecko-gc`
|
|
78
|
+
(the import name stays `pygecko`):
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install pygecko-gc
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Optional extras: `pip install "pygecko-gc[ord]"` adds Open Reaction Database export
|
|
85
|
+
(`Reaction_Parser`), `"pygecko-gc[test]"` the test dependencies and `"pygecko-gc[docs]"` the
|
|
86
|
+
documentation build.
|
|
87
|
+
|
|
88
|
+
To work on pyGecko itself, install an editable checkout instead:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
git clone https://github.com/FelixKatz77/pyGecko.git
|
|
92
|
+
cd pyGecko
|
|
93
|
+
pip install -e ".[test]"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
To install the exact, pinned set of dependency versions instead of the newest compatible ones,
|
|
97
|
+
use [uv](https://docs.astral.sh/uv/) with the committed lock file:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
uv sync
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Configuring msConvert
|
|
104
|
+
|
|
105
|
+
pyGecko looks for the msConvert executable each time a vendor file is converted, in this order:
|
|
106
|
+
|
|
107
|
+
1. the `PYGECKO_MSCONVERT` environment variable, set to the full path of the executable
|
|
108
|
+
2. an `msconvert` found on your `PATH`
|
|
109
|
+
|
|
110
|
+
Set the variable once for your user account, e.g. on Windows via *Start → "Edit environment
|
|
111
|
+
variables for your account" → New* (name `PYGECKO_MSCONVERT`, value
|
|
112
|
+
`C:\path\to\msconvert.exe`), or on Linux/macOS by adding
|
|
113
|
+
`export PYGECKO_MSCONVERT=/path/to/msconvert` to your shell profile. Inside a script or notebook
|
|
114
|
+
you can also set it for the current session before calling pyGecko:
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
import os
|
|
118
|
+
os.environ["PYGECKO_MSCONVERT"] = r"C:\path\to\msconvert.exe"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Without msConvert, open formats (`.mzML`, `.mzXML`, `.cdf`, `.xy`, `.csv`) still work.
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
## Documentation
|
|
125
|
+
The documentation for pyGecko can be found [here](https://pygecko.readthedocs.io/en/latest/).
|
|
126
|
+
|
|
127
|
+
## Running the tests
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
pip install -e ".[test,ord]"
|
|
131
|
+
pytest
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Two integration tests load Agilent `.D` directories and therefore need a configured msConvert
|
|
135
|
+
executable; they fail without one. To skip them, run `pytest -m "not msconvert"`.
|
|
136
|
+
|
|
137
|
+
The normal offline suite includes small, attributed `.xy` and mzML excerpts from the pyGecko study.
|
|
138
|
+
It also checks ORD/PDF export using the corresponding plate metadata. Run it with the coverage gate:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
pytest -m "not msconvert and not slow" --cov=pygecko --cov-report=term-missing --cov-fail-under=80
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Full study-data regressions
|
|
145
|
+
|
|
146
|
+
The complete plate tests use release 1.2 of the study dataset, pinned to
|
|
147
|
+
[Zenodo record 14316687](https://zenodo.org/records/14316687). Raw archives and extracted files are
|
|
148
|
+
kept in the ignored `.test-data/` directory and are never added to Git. Download all three
|
|
149
|
+
checksum-verified archives, then run the plate regressions:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
python -m tests.support.fetch_zenodo
|
|
153
|
+
PYGECKO_REAL_DATA_DIR="$PWD/.test-data/zenodo/14316687" \
|
|
154
|
+
pytest tests/real_data -m "realdata and slow"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
These regressions process all 96 FID and all 96 mzML injections for thiolation,
|
|
158
|
+
Buchwald–Hartwig, and AD-HoC. Thiolation and AD-HoC reproduce the checked-in yields, retention
|
|
159
|
+
times, and analyte assignments exactly. Buchwald–Hartwig reproduces every assignment and retention
|
|
160
|
+
time; 26 of its 27 reported yields are exact. Well C9 is expected to be 67% with the current peak
|
|
161
|
+
overlap-border correction rather than the paper's 74%, and the test requires its `overlap` flag.
|
|
162
|
+
The same full run is scheduled weekly in CI and can be started with `workflow_dispatch`.
|
|
163
|
+
|
|
164
|
+
## Usage
|
|
165
|
+
For non-automated workflows pyGecko is best used with jupyter notebooks. The notebooks folder of the repository contains
|
|
166
|
+
examples for the usage of pyGecko for the quantitative analysis of reaction outcomes and spectral matching. The Python
|
|
167
|
+
scripts used to perform the data processing for the publication can be found in the examples folder. GC-MS and GC-FID
|
|
168
|
+
raw data for all experiments is available on Zenodo.
|
|
169
|
+
|
|
170
|
+
### Split-GC: single-injection FID + MS
|
|
171
|
+
|
|
172
|
+
For instruments that split one GC column post-column to both an MS and a Polyarc-FID detector, both traces
|
|
173
|
+
come from a single injection and share a retention-time axis. `SplitGC_Parser.load_sequence` reads such an
|
|
174
|
+
OpenLab `.rslt`/`.sirslt` folder and returns paired FID/MS sequences. Because the detectors share a time axis,
|
|
175
|
+
FID and MS peaks can be matched directly by **nearest retention time** (`matching='rt'` in
|
|
176
|
+
`Analysis.calc_plate_yield` / `Analysis.calc_plate_conv`), so no retention-index alkane standard is required;
|
|
177
|
+
the legacy two-machine retention-index workflow remains available via `matching='ri'` (the default). If the
|
|
178
|
+
result folder's `.acaml` metadata file is missing (e.g. an incomplete export), the FID injections are
|
|
179
|
+
enumerated directly from the `AIA/*_FID1A.cdf` files.
|
|
180
|
+
|
|
181
|
+
### Starting-material conversion and remaining starting material
|
|
182
|
+
|
|
183
|
+
In addition to product yields (`Analysis.calc_plate_yield`), pyGecko can quantify a **starting material**
|
|
184
|
+
relative to the internal standard:
|
|
185
|
+
|
|
186
|
+
- `Analysis.calc_plate_conv` reports **conversion** (`100 - remaining%`). By default it assumes the substrate
|
|
187
|
+
was charged at the same loading as the internal standard (1 equiv); for a substrate charged in excess pass
|
|
188
|
+
`equivalents` (e.g. `equivalents=1.5`) so its conversion is referenced to its actual starting amount instead
|
|
189
|
+
of reading as a negative conversion. The result is floored at 0.
|
|
190
|
+
- `Analysis.calc_plate_rsm` reports the **remaining starting material** (the raw carbon-normalised area
|
|
191
|
+
relative to the internal standard, in percent). It is reported as measured and never clamped, so an
|
|
192
|
+
excess substrate can read above 100%.
|
|
193
|
+
|
|
194
|
+
See `examples/split_gc/` for a worked split-GC plate.
|
|
195
|
+
|
|
196
|
+
## Supported File Formats
|
|
197
|
+
pyGecko supports the following file formats:
|
|
198
|
+
|
|
199
|
+
| GC-MS | GC-FID |
|
|
200
|
+
|---------------|----------------|
|
|
201
|
+
| .mzML | .xy |
|
|
202
|
+
| .mzXML | .CSV |
|
|
203
|
+
| .D (Agilent) | .cdf (ANDI/AIA)|
|
|
204
|
+
| .RAW (Thermo) ||
|
|
205
|
+
| .cdf (ANDI/AIA) ||
|
|
206
|
+
|
|
207
|
+
> [!NOTE]
|
|
208
|
+
> To achieve the best performance, we recommend using the .mzML file format for GC-MS data.
|
|
209
|
+
|
|
210
|
+
## Exporting Data
|
|
211
|
+
|
|
212
|
+
Processed injections and sequences can be written back out to open formats. MS data goes to mzML,
|
|
213
|
+
FID data to ANDI/AIA netCDF:
|
|
214
|
+
|
|
215
|
+
```python
|
|
216
|
+
from pygecko.parsers import (write_injection_to_mzml, write_sequence_to_mzml,
|
|
217
|
+
write_injection_to_cdf, write_sequence_to_cdf)
|
|
218
|
+
|
|
219
|
+
write_injection_to_mzml(ms_injection, 'FKB-FA-060-A1.mzML')
|
|
220
|
+
write_sequence_to_mzml(ms_sequence, 'exported/') # one file per injection
|
|
221
|
+
|
|
222
|
+
write_injection_to_cdf(fid_injection, 'FBS-FA-033-A1.cdf')
|
|
223
|
+
write_sequence_to_cdf(fid_sequence, 'exported/')
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
mzML is written with [psims](https://github.com/mobiusklein/psims) and netCDF with netCDF4;
|
|
227
|
+
both ship with the default install.
|
|
228
|
+
|
|
229
|
+
> [!IMPORTANT]
|
|
230
|
+
> An export is a record of the injection **as pyGecko holds it**, not a copy of the original
|
|
231
|
+
> vendor file. pyGecko's readers round m/z to nominal integer mass and keep no polarity,
|
|
232
|
+
> instrument or acquisition metadata, so the MS1/centroid/positive terms in the written mzML are
|
|
233
|
+
> the writer's defaults rather than values from the source. Data written by pyGecko reads back
|
|
234
|
+
> through pyGecko's own readers unchanged; it is not a faithful round-trip of the raw file.
|
|
235
|
+
|
|
236
|
+
FID data is written as netCDF rather than mzML deliberately. The PSI-MS controlled vocabulary has
|
|
237
|
+
no term for a flame ionization detector, and none of its chromatogram types describes one, so an
|
|
238
|
+
mzML export of FID data would be schema-valid but semantically wrong. ANDI/AIA (ASTM E1947/E1948)
|
|
239
|
+
is the chromatography standard for a detector trace, and pyGecko already reads it.
|
|
240
|
+
|
|
241
|
+
## How to Cite
|
|
242
|
+
|
|
243
|
+
If you use pyGecko in your research, please cite the following publication:
|
|
244
|
+
|
|
245
|
+
**Calibration-free quantification and automated data analysis for high-throughput reaction screening**
|
|
246
|
+
Felix Katzenburg, et al.
|
|
247
|
+
*Digital Discovery*, 2025, **4**, 384-394.
|
|
248
|
+
DOI: [10.1039/D4DD00347K](https://doi.org/10.1039/D4DD00347K)
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# pyGecko
|
|
2
|
+
<img src="docs/pyGecko_icon.png" alt="pyGecko_Logo" width="300" height="300"/>
|
|
3
|
+
|
|
4
|
+
> pyGecko an open-source Python library for the parsing, processing and analysis of GC-MS and GC-FID raw data.
|
|
5
|
+
|
|
6
|
+
With increasing amounts of analytical and metadata generated in HTE, data processing and analysis quickly become a
|
|
7
|
+
workflow's limiting step if conducted manually. The automated processing of analytical data opens up time for chemists
|
|
8
|
+
to focus on relevant outcomes, enables the standardized storage of reaction data, and facilitates the integration of
|
|
9
|
+
analytical methods into closed-loop systems. Herein we present pyGecko, an open-source Python library for the parsing,
|
|
10
|
+
processing and analysis of GC-MS and GC-FID raw data. pyGecko offers a variety of analysis tools for the automated or
|
|
11
|
+
semi-automated handling of GC measurements and sequences. This includes the interpretation of measurements in the context
|
|
12
|
+
of the experiment, the automatic identification of internal standards and compound identifications based on retention
|
|
13
|
+
times, the mass of a molecular ion or fragment and spectral comparison. Quantification relative to an internal standard
|
|
14
|
+
can be performed for GC-FID measurements. Results of an analysis as well as chromatograms and spectra can be visualized
|
|
15
|
+
and reported in standardized formats like the Open Reaction Database (ORD) schema. pyGecko is designed to be easily
|
|
16
|
+
integrated into automated workflows and can be used as a stand-alone tool or as a python library.
|
|
17
|
+
|
|
18
|
+
Preprint: https://chemrxiv.org/engage/chemrxiv/article-details/66adfc465101a2ffa8001761 <br>
|
|
19
|
+
Paper: https://doi.org/10.1039/D4DD00347K
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
> [!IMPORTANT]
|
|
24
|
+
> To read vendor files you need to install the msConvert tool from ProteoWizard. You can download it from [here](http://proteowizard.sourceforge.net/download.html).
|
|
25
|
+
> You need to specify the path to the msConvert.exe before the first run of pyGecko.
|
|
26
|
+
|
|
27
|
+
pyGecko requires Python 3.10 or newer and is published on PyPI as `pygecko-gc`
|
|
28
|
+
(the import name stays `pygecko`):
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install pygecko-gc
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Optional extras: `pip install "pygecko-gc[ord]"` adds Open Reaction Database export
|
|
35
|
+
(`Reaction_Parser`), `"pygecko-gc[test]"` the test dependencies and `"pygecko-gc[docs]"` the
|
|
36
|
+
documentation build.
|
|
37
|
+
|
|
38
|
+
To work on pyGecko itself, install an editable checkout instead:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git clone https://github.com/FelixKatz77/pyGecko.git
|
|
42
|
+
cd pyGecko
|
|
43
|
+
pip install -e ".[test]"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
To install the exact, pinned set of dependency versions instead of the newest compatible ones,
|
|
47
|
+
use [uv](https://docs.astral.sh/uv/) with the committed lock file:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
uv sync
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Configuring msConvert
|
|
54
|
+
|
|
55
|
+
pyGecko looks for the msConvert executable each time a vendor file is converted, in this order:
|
|
56
|
+
|
|
57
|
+
1. the `PYGECKO_MSCONVERT` environment variable, set to the full path of the executable
|
|
58
|
+
2. an `msconvert` found on your `PATH`
|
|
59
|
+
|
|
60
|
+
Set the variable once for your user account, e.g. on Windows via *Start → "Edit environment
|
|
61
|
+
variables for your account" → New* (name `PYGECKO_MSCONVERT`, value
|
|
62
|
+
`C:\path\to\msconvert.exe`), or on Linux/macOS by adding
|
|
63
|
+
`export PYGECKO_MSCONVERT=/path/to/msconvert` to your shell profile. Inside a script or notebook
|
|
64
|
+
you can also set it for the current session before calling pyGecko:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
import os
|
|
68
|
+
os.environ["PYGECKO_MSCONVERT"] = r"C:\path\to\msconvert.exe"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Without msConvert, open formats (`.mzML`, `.mzXML`, `.cdf`, `.xy`, `.csv`) still work.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## Documentation
|
|
75
|
+
The documentation for pyGecko can be found [here](https://pygecko.readthedocs.io/en/latest/).
|
|
76
|
+
|
|
77
|
+
## Running the tests
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pip install -e ".[test,ord]"
|
|
81
|
+
pytest
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Two integration tests load Agilent `.D` directories and therefore need a configured msConvert
|
|
85
|
+
executable; they fail without one. To skip them, run `pytest -m "not msconvert"`.
|
|
86
|
+
|
|
87
|
+
The normal offline suite includes small, attributed `.xy` and mzML excerpts from the pyGecko study.
|
|
88
|
+
It also checks ORD/PDF export using the corresponding plate metadata. Run it with the coverage gate:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pytest -m "not msconvert and not slow" --cov=pygecko --cov-report=term-missing --cov-fail-under=80
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Full study-data regressions
|
|
95
|
+
|
|
96
|
+
The complete plate tests use release 1.2 of the study dataset, pinned to
|
|
97
|
+
[Zenodo record 14316687](https://zenodo.org/records/14316687). Raw archives and extracted files are
|
|
98
|
+
kept in the ignored `.test-data/` directory and are never added to Git. Download all three
|
|
99
|
+
checksum-verified archives, then run the plate regressions:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
python -m tests.support.fetch_zenodo
|
|
103
|
+
PYGECKO_REAL_DATA_DIR="$PWD/.test-data/zenodo/14316687" \
|
|
104
|
+
pytest tests/real_data -m "realdata and slow"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
These regressions process all 96 FID and all 96 mzML injections for thiolation,
|
|
108
|
+
Buchwald–Hartwig, and AD-HoC. Thiolation and AD-HoC reproduce the checked-in yields, retention
|
|
109
|
+
times, and analyte assignments exactly. Buchwald–Hartwig reproduces every assignment and retention
|
|
110
|
+
time; 26 of its 27 reported yields are exact. Well C9 is expected to be 67% with the current peak
|
|
111
|
+
overlap-border correction rather than the paper's 74%, and the test requires its `overlap` flag.
|
|
112
|
+
The same full run is scheduled weekly in CI and can be started with `workflow_dispatch`.
|
|
113
|
+
|
|
114
|
+
## Usage
|
|
115
|
+
For non-automated workflows pyGecko is best used with jupyter notebooks. The notebooks folder of the repository contains
|
|
116
|
+
examples for the usage of pyGecko for the quantitative analysis of reaction outcomes and spectral matching. The Python
|
|
117
|
+
scripts used to perform the data processing for the publication can be found in the examples folder. GC-MS and GC-FID
|
|
118
|
+
raw data for all experiments is available on Zenodo.
|
|
119
|
+
|
|
120
|
+
### Split-GC: single-injection FID + MS
|
|
121
|
+
|
|
122
|
+
For instruments that split one GC column post-column to both an MS and a Polyarc-FID detector, both traces
|
|
123
|
+
come from a single injection and share a retention-time axis. `SplitGC_Parser.load_sequence` reads such an
|
|
124
|
+
OpenLab `.rslt`/`.sirslt` folder and returns paired FID/MS sequences. Because the detectors share a time axis,
|
|
125
|
+
FID and MS peaks can be matched directly by **nearest retention time** (`matching='rt'` in
|
|
126
|
+
`Analysis.calc_plate_yield` / `Analysis.calc_plate_conv`), so no retention-index alkane standard is required;
|
|
127
|
+
the legacy two-machine retention-index workflow remains available via `matching='ri'` (the default). If the
|
|
128
|
+
result folder's `.acaml` metadata file is missing (e.g. an incomplete export), the FID injections are
|
|
129
|
+
enumerated directly from the `AIA/*_FID1A.cdf` files.
|
|
130
|
+
|
|
131
|
+
### Starting-material conversion and remaining starting material
|
|
132
|
+
|
|
133
|
+
In addition to product yields (`Analysis.calc_plate_yield`), pyGecko can quantify a **starting material**
|
|
134
|
+
relative to the internal standard:
|
|
135
|
+
|
|
136
|
+
- `Analysis.calc_plate_conv` reports **conversion** (`100 - remaining%`). By default it assumes the substrate
|
|
137
|
+
was charged at the same loading as the internal standard (1 equiv); for a substrate charged in excess pass
|
|
138
|
+
`equivalents` (e.g. `equivalents=1.5`) so its conversion is referenced to its actual starting amount instead
|
|
139
|
+
of reading as a negative conversion. The result is floored at 0.
|
|
140
|
+
- `Analysis.calc_plate_rsm` reports the **remaining starting material** (the raw carbon-normalised area
|
|
141
|
+
relative to the internal standard, in percent). It is reported as measured and never clamped, so an
|
|
142
|
+
excess substrate can read above 100%.
|
|
143
|
+
|
|
144
|
+
See `examples/split_gc/` for a worked split-GC plate.
|
|
145
|
+
|
|
146
|
+
## Supported File Formats
|
|
147
|
+
pyGecko supports the following file formats:
|
|
148
|
+
|
|
149
|
+
| GC-MS | GC-FID |
|
|
150
|
+
|---------------|----------------|
|
|
151
|
+
| .mzML | .xy |
|
|
152
|
+
| .mzXML | .CSV |
|
|
153
|
+
| .D (Agilent) | .cdf (ANDI/AIA)|
|
|
154
|
+
| .RAW (Thermo) ||
|
|
155
|
+
| .cdf (ANDI/AIA) ||
|
|
156
|
+
|
|
157
|
+
> [!NOTE]
|
|
158
|
+
> To achieve the best performance, we recommend using the .mzML file format for GC-MS data.
|
|
159
|
+
|
|
160
|
+
## Exporting Data
|
|
161
|
+
|
|
162
|
+
Processed injections and sequences can be written back out to open formats. MS data goes to mzML,
|
|
163
|
+
FID data to ANDI/AIA netCDF:
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
from pygecko.parsers import (write_injection_to_mzml, write_sequence_to_mzml,
|
|
167
|
+
write_injection_to_cdf, write_sequence_to_cdf)
|
|
168
|
+
|
|
169
|
+
write_injection_to_mzml(ms_injection, 'FKB-FA-060-A1.mzML')
|
|
170
|
+
write_sequence_to_mzml(ms_sequence, 'exported/') # one file per injection
|
|
171
|
+
|
|
172
|
+
write_injection_to_cdf(fid_injection, 'FBS-FA-033-A1.cdf')
|
|
173
|
+
write_sequence_to_cdf(fid_sequence, 'exported/')
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
mzML is written with [psims](https://github.com/mobiusklein/psims) and netCDF with netCDF4;
|
|
177
|
+
both ship with the default install.
|
|
178
|
+
|
|
179
|
+
> [!IMPORTANT]
|
|
180
|
+
> An export is a record of the injection **as pyGecko holds it**, not a copy of the original
|
|
181
|
+
> vendor file. pyGecko's readers round m/z to nominal integer mass and keep no polarity,
|
|
182
|
+
> instrument or acquisition metadata, so the MS1/centroid/positive terms in the written mzML are
|
|
183
|
+
> the writer's defaults rather than values from the source. Data written by pyGecko reads back
|
|
184
|
+
> through pyGecko's own readers unchanged; it is not a faithful round-trip of the raw file.
|
|
185
|
+
|
|
186
|
+
FID data is written as netCDF rather than mzML deliberately. The PSI-MS controlled vocabulary has
|
|
187
|
+
no term for a flame ionization detector, and none of its chromatogram types describes one, so an
|
|
188
|
+
mzML export of FID data would be schema-valid but semantically wrong. ANDI/AIA (ASTM E1947/E1948)
|
|
189
|
+
is the chromatography standard for a detector trace, and pyGecko already reads it.
|
|
190
|
+
|
|
191
|
+
## How to Cite
|
|
192
|
+
|
|
193
|
+
If you use pyGecko in your research, please cite the following publication:
|
|
194
|
+
|
|
195
|
+
**Calibration-free quantification and automated data analysis for high-throughput reaction screening**
|
|
196
|
+
Felix Katzenburg, et al.
|
|
197
|
+
*Digital Discovery*, 2025, **4**, 384-394.
|
|
198
|
+
DOI: [10.1039/D4DD00347K](https://doi.org/10.1039/D4DD00347K)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from pygecko.analysis.analysis import Analysis
|