alphadia 1.9.1__tar.gz → 1.9.3.dev2__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.
Files changed (85) hide show
  1. {alphadia-1.9.1/alphadia.egg-info → alphadia-1.9.3.dev2}/PKG-INFO +33 -15
  2. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/README.md +15 -4
  3. alphadia-1.9.3.dev2/alphadia/__init__.py +3 -0
  4. alphadia-1.9.3.dev2/alphadia/cli.py +249 -0
  5. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/constants/default.yaml +59 -83
  6. alphadia-1.9.3.dev2/alphadia/constants/keys.py +34 -0
  7. alphadia-1.9.3.dev2/alphadia/constants/multistep.yaml +50 -0
  8. alphadia-1.9.3.dev2/alphadia/exceptions.py +122 -0
  9. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/fdr.py +11 -7
  10. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/fdrexperimental.py +57 -0
  11. alphadia-1.9.3.dev2/alphadia/fdrx/models/logistic_regression.py +126 -0
  12. alphadia-1.9.3.dev2/alphadia/fdrx/models/two_step_classifier.py +350 -0
  13. alphadia-1.9.3.dev2/alphadia/fdrx/utils.py +51 -0
  14. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/libtransform.py +17 -5
  15. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/outputaccumulator.py +2 -2
  16. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/outputtransform.py +32 -13
  17. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/quadrupole.py +4 -11
  18. alphadia-1.9.3.dev2/alphadia/search_plan.py +221 -0
  19. alphadia-1.9.3.dev2/alphadia/search_step.py +420 -0
  20. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/transferlearning/train.py +3 -1
  21. alphadia-1.9.3.dev2/alphadia/utilities/__init__.py +0 -0
  22. alphadia-1.9.3.dev2/alphadia/utilities/logging.py +48 -0
  23. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/utils.py +23 -104
  24. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/workflow/base.py +12 -9
  25. alphadia-1.9.3.dev2/alphadia/workflow/config.py +309 -0
  26. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/workflow/manager.py +128 -29
  27. alphadia-1.9.3.dev2/alphadia/workflow/managers/__init__.py +0 -0
  28. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/workflow/managers/raw_file_manager.py +0 -14
  29. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/workflow/peptidecentric.py +63 -5
  30. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/workflow/reporting.py +5 -0
  31. {alphadia-1.9.1 → alphadia-1.9.3.dev2/alphadia.egg-info}/PKG-INFO +33 -15
  32. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia.egg-info/SOURCES.txt +11 -2
  33. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia.egg-info/requires.txt +14 -6
  34. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/misc/distributed_search/parse_parameters.py +3 -3
  35. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/misc/distributed_search/speclib_config.py +3 -3
  36. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/pyproject.toml +9 -36
  37. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/requirements/requirements.txt +1 -0
  38. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/requirements/requirements_development.txt +2 -2
  39. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/requirements/requirements_loose.txt +3 -1
  40. alphadia-1.9.1/alphadia/__init__.py +0 -3
  41. alphadia-1.9.1/alphadia/cli.py +0 -405
  42. alphadia-1.9.1/alphadia/exceptions.py +0 -61
  43. alphadia-1.9.1/alphadia/planning.py +0 -419
  44. alphadia-1.9.1/alphadia/workflow/config.py +0 -588
  45. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/LICENSE.txt +0 -0
  46. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/MANIFEST.in +0 -0
  47. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/calibration/models.py +0 -0
  48. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/calibration/property.py +0 -0
  49. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/consensus/utils.py +0 -0
  50. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/constants/classifier/fa9945ae23db872d.pth +0 -0
  51. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/data/alpharaw_wrapper.py +0 -0
  52. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/data/bruker.py +0 -0
  53. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/fdrx/base.py +0 -0
  54. {alphadia-1.9.1/alphadia/workflow/managers → alphadia-1.9.3.dev2/alphadia/fdrx/models}/__init__.py +0 -0
  55. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/fdrx/plotting.py +0 -0
  56. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/fdrx/stats.py +0 -0
  57. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/features.py +0 -0
  58. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/fragcomp.py +0 -0
  59. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/grouping.py +0 -0
  60. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/numba/config.py +0 -0
  61. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/numba/fft.py +0 -0
  62. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/numba/fragments.py +0 -0
  63. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/numba/numeric.py +0 -0
  64. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/peakgroup/kernel.py +0 -0
  65. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/peakgroup/search.py +0 -0
  66. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/peakgroup/utils.py +0 -0
  67. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/plexscoring.py +0 -0
  68. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/plotting/cycle.py +0 -0
  69. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/plotting/debug.py +0 -0
  70. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/plotting/utils.py +0 -0
  71. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/test_data_downloader.py +0 -0
  72. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/transferlearning/metrics.py +0 -0
  73. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/validate.py +0 -0
  74. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia/workflow/optimization.py +0 -0
  75. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia.egg-info/dependency_links.txt +0 -0
  76. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia.egg-info/entry_points.txt +0 -0
  77. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/alphadia.egg-info/top_level.txt +0 -0
  78. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/docs/conf.py +0 -0
  79. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/misc/distributed_search/discover_project_files.py +0 -0
  80. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/release/pyinstaller/cli_hook.py +0 -0
  81. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/release/pyinstaller/hookdir/hook-huggingface_hub.py +0 -0
  82. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/release/pyinstaller/hookdir/hook-rocket_fft.py +0 -0
  83. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/requirements/requirements_docs.txt +0 -0
  84. /alphadia-1.9.1/requirements/requirements_test.txt → /alphadia-1.9.3.dev2/requirements/requirements_tests.txt +0 -0
  85. {alphadia-1.9.1 → alphadia-1.9.3.dev2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: alphadia
3
- Version: 1.9.1
3
+ Version: 1.9.3.dev2
4
4
  Summary: A novel proteomics search engine for DIA data based on end-to-end transfer learning.
5
5
  Author-email: Mann Labs <wallmann@biochem.mpg.de>
6
6
  License: Apache License
@@ -223,8 +223,9 @@ Requires-Dist: numba
223
223
  Requires-Dist: argparse
224
224
  Requires-Dist: alpharaw>=0.3.1
225
225
  Requires-Dist: alphatims
226
- Requires-Dist: alphabase>=1.4.0
226
+ Requires-Dist: alphabase<1.5.0,>=1.4.0
227
227
  Requires-Dist: peptdeep>=1.3.0
228
+ Requires-Dist: dask==2024.11.2
228
229
  Requires-Dist: progressbar
229
230
  Requires-Dist: neptune
230
231
  Requires-Dist: seaborn
@@ -254,26 +255,32 @@ Requires-Dist: transformers==4.40.2; extra == "stable"
254
255
  Requires-Dist: directlfq==0.2.19; extra == "stable"
255
256
  Requires-Dist: pythonnet==3.0.3; extra == "stable"
256
257
  Requires-Dist: zstandard==0.22.0; extra == "stable"
258
+ Requires-Dist: dask==2024.11.2; extra == "stable"
257
259
  Requires-Dist: numpy<2; extra == "stable"
258
260
  Requires-Dist: scipy==1.12.0; extra == "stable"
259
- Provides-Extra: test
260
- Requires-Dist: coverage; extra == "test"
261
- Requires-Dist: coverage-badge; extra == "test"
262
- Requires-Dist: pytest; extra == "test"
261
+ Provides-Extra: tests
262
+ Requires-Dist: coverage; extra == "tests"
263
+ Requires-Dist: coverage-badge; extra == "tests"
264
+ Requires-Dist: pytest; extra == "tests"
265
+ Provides-Extra: docs
266
+ Requires-Dist: autodocsumm; extra == "docs"
267
+ Requires-Dist: sphinx-rtd-theme; extra == "docs"
268
+ Requires-Dist: nbsphinx; extra == "docs"
269
+ Requires-Dist: myst_parser; extra == "docs"
270
+ Requires-Dist: sphinx_design; extra == "docs"
271
+ Requires-Dist: furo; extra == "docs"
272
+ Requires-Dist: pandoc; extra == "docs"
263
273
  Provides-Extra: development
264
274
  Requires-Dist: jupyter; extra == "development"
265
275
  Requires-Dist: jupyter_contrib_nbextensions; extra == "development"
266
276
  Requires-Dist: pyinstaller; extra == "development"
267
277
  Requires-Dist: twine; extra == "development"
268
- Requires-Dist: bumpversion; extra == "development"
278
+ Requires-Dist: bump-my-version; extra == "development"
269
279
  Requires-Dist: pipdeptree; extra == "development"
270
280
  Requires-Dist: ipykernel; extra == "development"
271
281
  Requires-Dist: psutil; extra == "development"
272
282
  Requires-Dist: pre-commit==3.7.0; extra == "development"
273
283
  Requires-Dist: pywin32; sys_platform == "win32" and extra == "development"
274
- Requires-Dist: coverage; extra == "development"
275
- Requires-Dist: coverage-badge; extra == "development"
276
- Requires-Dist: pytest; extra == "development"
277
284
  Requires-Dist: autodocsumm; extra == "development"
278
285
  Requires-Dist: sphinx-rtd-theme; extra == "development"
279
286
  Requires-Dist: nbsphinx; extra == "development"
@@ -361,8 +368,13 @@ AlphaDIA can be installed on Windows, macOS and Linux. Please choose the preferr
361
368
  Currently available for **MacOS** and **Windows**.
362
369
  You can download the latest release of alphaDIA [here](https://github.com/Mannlabs/alphadia/releases/latest).
363
370
 
364
- * **Windows:** Download the latest `win-x64` build. Save it and double click it to install. If you receive a warning during installation click *Run anyway*.
365
- * **MacOS:** Download the latest `darwin-arm64` build. Please note that alphaDIA currently requires an ARM based M1/2/3 processor for the one-click installer. Save the installer and open the parent folder in Finder. Right-click and select *open*. If you receive a warning during installation click *Open*. If you want to use `.raw` files on Thermo instruments alphaRaw is required, which depends on Mono. A detailed guide to installing alphaRaw with mono can be found [here](https://github.com/MannLabs/alpharaw#installation).
371
+ * **Windows:** Download the latest `alphadia-X.Y.Z-windows-amd64.exe` build and double click it to install. If you receive a warning during installation click *Run anyway*.
372
+ * **MacOS:** Download the latest build suitable for your chip architecture
373
+ (can be looked up by clicking on the Apple Symbol > *About this Mac* > *Chip* ("M1", "M2", "M3" -> `arm64`, "Intel" -> `x64`),
374
+ `alphadia-X.Y.Z-macos-darwin-arm64.pkg` or `alphadia-X.Y.Z-macos-darwin-x64.pkg`. Open the parent folder of the downloaded file in Finder,
375
+ right-click and select *open*. If you receive a warning during installation click *Open*. If you want to use `.raw` files on Thermo instruments alphaRaw is required, which depends on Mono. A detailed guide to installing alphaRaw with mono can be found [here](https://github.com/MannLabs/alpharaw#installation).
376
+ * **Linux:** Download the latest `alphadia-X.Y.Z-linux-x64.deb` build and install it via `dpkg -i alphadia-X.Y.Z-linux-x64.deb`.
377
+
366
378
 
367
379
  As of now, **Linux** users need follow the steps for the
368
380
  [developer installation](docs/installation.md#developer-installation) in order to use the GUI.
@@ -406,7 +418,10 @@ Make sure you have installed the GUI using the one-click installer. To verify yo
406
418
 
407
419
  ### 2. Test data
408
420
 
409
- For the first search we will be using a spectral library to search 60SPD bulk HeLa samples on the Orbitrap Astral. Download the test samples and save them: [HeLa library](https://datashare.biochem.mpg.de/s/Uw2yfNSbApfPpTk), [RAW files].(https://datashare.biochem.mpg.de/s/339jg5HtGrwLwDN)
421
+ For the first search we will be using a spectral library to search 60SPD bulk HeLa samples on the Orbitrap Astral.
422
+ Download the test samples and save them:
423
+ [HeLa library](https://datashare.biochem.mpg.de/s/Uw2yfNSbApfPpTk),
424
+ [RAW files](https://datashare.biochem.mpg.de/s/339jg5HtGrwLwDN)
410
425
 
411
426
  ### 3. Search settings
412
427
 
@@ -437,7 +452,10 @@ In case of issues, check out the following:
437
452
  ---
438
453
  ## Citations
439
454
 
440
- A manuscript has been submitted to bioRxiv.
455
+ A manuscript has been submitted to bioRxiv:
456
+ > **AlphaDIA enables End-to-End Transfer Learning for Feature-Free Proteomics**
457
+ > Georg Wallmann, Patricia Skowronek, Vincenth Brennsteiner, Mikhail Lebedev, Marvin Thielert, Sophia Steigerwald, Mohamed Kotb, Tim Heymann, Xie-Xuan Zhou, Magnus Schwörer, Maximilian T. Strauss, Constantin Ammar, Sander Willems, Wen-Feng Zeng, Matthias Mann
458
+ > bioRxiv 2024.05.28.596182; doi: https://doi.org/10.1101/2024.05.28.596182
441
459
 
442
460
  ---
443
461
  ## How to contribute
@@ -77,8 +77,13 @@ AlphaDIA can be installed on Windows, macOS and Linux. Please choose the preferr
77
77
  Currently available for **MacOS** and **Windows**.
78
78
  You can download the latest release of alphaDIA [here](https://github.com/Mannlabs/alphadia/releases/latest).
79
79
 
80
- * **Windows:** Download the latest `win-x64` build. Save it and double click it to install. If you receive a warning during installation click *Run anyway*.
81
- * **MacOS:** Download the latest `darwin-arm64` build. Please note that alphaDIA currently requires an ARM based M1/2/3 processor for the one-click installer. Save the installer and open the parent folder in Finder. Right-click and select *open*. If you receive a warning during installation click *Open*. If you want to use `.raw` files on Thermo instruments alphaRaw is required, which depends on Mono. A detailed guide to installing alphaRaw with mono can be found [here](https://github.com/MannLabs/alpharaw#installation).
80
+ * **Windows:** Download the latest `alphadia-X.Y.Z-windows-amd64.exe` build and double click it to install. If you receive a warning during installation click *Run anyway*.
81
+ * **MacOS:** Download the latest build suitable for your chip architecture
82
+ (can be looked up by clicking on the Apple Symbol > *About this Mac* > *Chip* ("M1", "M2", "M3" -> `arm64`, "Intel" -> `x64`),
83
+ `alphadia-X.Y.Z-macos-darwin-arm64.pkg` or `alphadia-X.Y.Z-macos-darwin-x64.pkg`. Open the parent folder of the downloaded file in Finder,
84
+ right-click and select *open*. If you receive a warning during installation click *Open*. If you want to use `.raw` files on Thermo instruments alphaRaw is required, which depends on Mono. A detailed guide to installing alphaRaw with mono can be found [here](https://github.com/MannLabs/alpharaw#installation).
85
+ * **Linux:** Download the latest `alphadia-X.Y.Z-linux-x64.deb` build and install it via `dpkg -i alphadia-X.Y.Z-linux-x64.deb`.
86
+
82
87
 
83
88
  As of now, **Linux** users need follow the steps for the
84
89
  [developer installation](docs/installation.md#developer-installation) in order to use the GUI.
@@ -122,7 +127,10 @@ Make sure you have installed the GUI using the one-click installer. To verify yo
122
127
 
123
128
  ### 2. Test data
124
129
 
125
- For the first search we will be using a spectral library to search 60SPD bulk HeLa samples on the Orbitrap Astral. Download the test samples and save them: [HeLa library](https://datashare.biochem.mpg.de/s/Uw2yfNSbApfPpTk), [RAW files].(https://datashare.biochem.mpg.de/s/339jg5HtGrwLwDN)
130
+ For the first search we will be using a spectral library to search 60SPD bulk HeLa samples on the Orbitrap Astral.
131
+ Download the test samples and save them:
132
+ [HeLa library](https://datashare.biochem.mpg.de/s/Uw2yfNSbApfPpTk),
133
+ [RAW files](https://datashare.biochem.mpg.de/s/339jg5HtGrwLwDN)
126
134
 
127
135
  ### 3. Search settings
128
136
 
@@ -153,7 +161,10 @@ In case of issues, check out the following:
153
161
  ---
154
162
  ## Citations
155
163
 
156
- A manuscript has been submitted to bioRxiv.
164
+ A manuscript has been submitted to bioRxiv:
165
+ > **AlphaDIA enables End-to-End Transfer Learning for Feature-Free Proteomics**
166
+ > Georg Wallmann, Patricia Skowronek, Vincenth Brennsteiner, Mikhail Lebedev, Marvin Thielert, Sophia Steigerwald, Mohamed Kotb, Tim Heymann, Xie-Xuan Zhou, Magnus Schwörer, Maximilian T. Strauss, Constantin Ammar, Sander Willems, Wen-Feng Zeng, Matthias Mann
167
+ > bioRxiv 2024.05.28.596182; doi: https://doi.org/10.1101/2024.05.28.596182
157
168
 
158
169
  ---
159
170
  ## How to contribute
@@ -0,0 +1,3 @@
1
+ #!python
2
+
3
+ __version__ = "1.9.3-dev2"
@@ -0,0 +1,249 @@
1
+ #!python
2
+ """CLI for alphaDIA.
3
+
4
+ Ideally the CLI module should have as little logic as possible so that the search behaves the same from the CLI or a jupyter notebook.
5
+ """
6
+
7
+ import argparse
8
+ import json
9
+ import logging
10
+ import os
11
+ import re
12
+ import sys
13
+
14
+ import matplotlib
15
+ import yaml
16
+
17
+ import alphadia
18
+ from alphadia import utils
19
+ from alphadia.constants.keys import ConfigKeys
20
+ from alphadia.exceptions import CustomError
21
+ from alphadia.search_plan import SearchPlan
22
+ from alphadia.workflow import reporting
23
+
24
+ logger = logging.getLogger()
25
+
26
+ epilog = "Parameters passed via CLI will overwrite parameters from config file (except for '--file': will be merged)."
27
+
28
+ parser = argparse.ArgumentParser(
29
+ description="Search DIA experiments with alphaDIA", epilog=epilog
30
+ )
31
+ parser.add_argument(
32
+ "--version",
33
+ "-v",
34
+ action="store_true",
35
+ help="Print version and exit",
36
+ )
37
+ parser.add_argument(
38
+ "--output",
39
+ "--output-directory",
40
+ "-o",
41
+ type=str,
42
+ help="Output directory.",
43
+ nargs="?",
44
+ default=None,
45
+ )
46
+ parser.add_argument(
47
+ "--file",
48
+ "--raw-path",
49
+ "-f",
50
+ type=str,
51
+ help="Path to raw data input file. Can be passed multiple times.",
52
+ action="append",
53
+ default=[],
54
+ )
55
+ parser.add_argument(
56
+ "--directory",
57
+ "-d",
58
+ type=str,
59
+ help="Directory containing raw data input files.",
60
+ action="append",
61
+ default=[],
62
+ )
63
+ parser.add_argument(
64
+ "--regex",
65
+ "-r",
66
+ type=str,
67
+ help="Regex to match raw files in 'directory'.",
68
+ nargs="?",
69
+ default=".*",
70
+ )
71
+ parser.add_argument(
72
+ "--library",
73
+ "--library-path",
74
+ "-l",
75
+ type=str,
76
+ help="Path to spectral library file.",
77
+ nargs="?",
78
+ default=None,
79
+ )
80
+ parser.add_argument(
81
+ "--fasta",
82
+ "--fasta-path",
83
+ help="Path to fasta file used to generate or annotate the spectral library. Can be passed multiple times.",
84
+ action="append",
85
+ default=[],
86
+ )
87
+ parser.add_argument(
88
+ "--config",
89
+ "-c",
90
+ type=str,
91
+ help="Path to config yaml file which will be used to update the default config.",
92
+ nargs="?",
93
+ default=None,
94
+ )
95
+ parser.add_argument(
96
+ "--config-dict",
97
+ type=str,
98
+ help="Python dictionary which will be used to update the default config.",
99
+ nargs="?",
100
+ default="{}",
101
+ )
102
+ parser.add_argument(
103
+ "--quant-dir", # TODO deprecate
104
+ "--quant-directory",
105
+ type=str,
106
+ help="Directory to save the quantification results (psm & frag parquet files) to be reused in a distributed search.",
107
+ nargs="?",
108
+ default=None,
109
+ )
110
+
111
+
112
+ def _get_config_from_args(args: argparse.Namespace) -> dict:
113
+ """Parse config file from `args.config` if given and update with optional JSON string `args.config_dict`."""
114
+
115
+ config = {}
116
+ if args.config is not None:
117
+ with open(args.config) as f:
118
+ config = yaml.safe_load(f)
119
+
120
+ try:
121
+ utils.recursive_update(config, json.loads(args.config_dict))
122
+ except Exception as e:
123
+ print(f"Could not parse config update: {e}")
124
+
125
+ return config
126
+
127
+
128
+ def _get_from_args_or_config(
129
+ args: argparse.Namespace, config: dict, *, args_key: str, config_key: str
130
+ ) -> str:
131
+ """Get a value from command line arguments (key: `args_key`) or config file (key: `config_key`), the former taking precedence."""
132
+ value_from_args = args.__dict__.get(args_key)
133
+ return value_from_args if value_from_args is not None else config.get(config_key)
134
+
135
+
136
+ def _get_raw_path_list_from_args_and_config(
137
+ args: argparse.Namespace, config: dict
138
+ ) -> list:
139
+ """
140
+ Generate a list of raw file paths based on command-line arguments and configuration.
141
+
142
+ This function combines file paths specified in the configuration and command-line
143
+ arguments, including files from specified directories. It filters the resulting
144
+ list of file paths using a regular expression provided in the arguments.
145
+
146
+ Parameters
147
+ ----------
148
+ args : argparse.Namespace
149
+ Command-line arguments containing file and directory
150
+ paths, as well as a regex pattern for filtering.
151
+ config : dict
152
+ Configuration dictionary that may include a list of raw paths
153
+ and a directory to search for files.
154
+
155
+ Returns
156
+ -------
157
+ list: a list of file paths that match the specified regex pattern.
158
+ """
159
+
160
+ raw_path_list = config.get(ConfigKeys.RAW_PATHS, [])
161
+ raw_path_list += args.file
162
+
163
+ if (config_directory := config.get("directory")) is not None:
164
+ raw_path_list += [
165
+ os.path.join(config_directory, f) for f in os.listdir(config_directory)
166
+ ]
167
+
168
+ for directory in args.directory:
169
+ raw_path_list += [os.path.join(directory, f) for f in os.listdir(directory)]
170
+
171
+ # filter raw files by regex
172
+ len_before = len(raw_path_list)
173
+ raw_path_list = [
174
+ f
175
+ for f in raw_path_list
176
+ if re.search(args.regex, os.path.basename(f)) is not None
177
+ ]
178
+ len_after = len(raw_path_list)
179
+
180
+ if len_removed := len_before - len_after:
181
+ print(
182
+ f"Ignoring {len_removed} / {len_before} file(s) from arguments list due to --regex."
183
+ )
184
+
185
+ return raw_path_list
186
+
187
+
188
+ def run(*args, **kwargs):
189
+ # parse command line arguments
190
+ args, unknown = parser.parse_known_args()
191
+
192
+ if unknown:
193
+ print(f"Unknown arguments: {unknown}")
194
+ parser.print_help()
195
+ return
196
+
197
+ if args.version:
198
+ print(f"{alphadia.__version__}")
199
+ return
200
+
201
+ user_config = _get_config_from_args(args)
202
+
203
+ output_directory = _get_from_args_or_config(
204
+ args, user_config, args_key="output", config_key="output_directory"
205
+ )
206
+ if output_directory is None:
207
+ parser.print_help()
208
+
209
+ print("No output directory specified. Please do so via CL-argument or config.")
210
+ return
211
+ reporting.init_logging(output_directory)
212
+
213
+ # TODO revisit the multiple sources of raw files (cli, config, regex, ...)
214
+ raw_paths = _get_raw_path_list_from_args_and_config(args, user_config)
215
+ cli_params_config = {
216
+ **({ConfigKeys.RAW_PATHS: raw_paths} if raw_paths else {}),
217
+ **({ConfigKeys.LIBRARY_PATH: args.library} if args.library is not None else {}),
218
+ **({ConfigKeys.FASTA_PATHS: args.fasta} if args.fasta else {}),
219
+ **(
220
+ {ConfigKeys.QUANT_DIRECTORY: args.quant_dir}
221
+ if args.quant_dir is not None
222
+ else {}
223
+ ),
224
+ }
225
+
226
+ # TODO rename all output_directory, output_folder => output_path, quant_dir->quant_path (except cli parameter)
227
+
228
+ # important to suppress matplotlib output
229
+ matplotlib.use("Agg")
230
+
231
+ try:
232
+ SearchPlan(output_directory, user_config, cli_params_config).run_plan()
233
+
234
+ except Exception as e:
235
+ if isinstance(e, CustomError):
236
+ exit_code = 1
237
+ else:
238
+ import traceback
239
+
240
+ logger.info(traceback.format_exc())
241
+ exit_code = 127
242
+
243
+ logger.error(e)
244
+ sys.exit(exit_code)
245
+
246
+
247
+ # uncomment for debugging:
248
+ # if __name__ == "__main__":
249
+ # run()
@@ -1,6 +1,14 @@
1
1
  # configuration for the extraction plan
2
2
  version: 1
3
3
 
4
+ # These values are typically filled via CLI parameters
5
+ workflow_name: null
6
+ output_directory: null
7
+ library_path: null
8
+ raw_paths: []
9
+ fasta_paths: []
10
+ quant_directory: null
11
+
4
12
  general:
5
13
  thread_count: 10
6
14
  # maximum number of threads or processes to use per raw file
@@ -8,7 +16,6 @@ general:
8
16
  reuse_quant: false
9
17
  astral_ms1: false
10
18
  log_level: 'INFO'
11
- wsl: false
12
19
  mmap_detector_events: false
13
20
  use_gpu: true
14
21
  # whether to save the libraries to the output directory
@@ -26,6 +33,7 @@ library_prediction:
26
33
  variable_modifications: 'Oxidation@M;Acetyl@Protein_N-term'
27
34
  max_var_mod_num: 2
28
35
  missed_cleavages: 1
36
+ # using tuples here as it makes interaction with the GUI easier
29
37
  precursor_len:
30
38
  - 7
31
39
  - 35
@@ -39,8 +47,13 @@ library_prediction:
39
47
  - 200
40
48
  - 2000
41
49
  nce: 25.0
42
- # semicolon separated list of fragment types. Supported types are: a, b, c, x, y, z, b_modloss, y_modloss
43
- fragment_types: 'b;y'
50
+
51
+ # list of fragment types (see alphabase.peptide.fragment.FRAGMENT_TYPES for supported types)
52
+ # Supported types are: a, b, c, x, y, z, b_modloss, y_modloss, b_H2O, y_H2O, b_NH3, y_NH3, c_lossH, z_addH
53
+ fragment_types:
54
+ - 'b'
55
+ - 'y'
56
+
44
57
  # maximum charge state for predicted fragments
45
58
  max_fragment_charge: 2
46
59
  instrument: Lumos
@@ -53,33 +66,33 @@ library_prediction:
53
66
 
54
67
  # define custom alphabase modifications not part of unimod or alphabase
55
68
  # also used for decoy channels
56
- custom_modififcations:
69
+ custom_modifications:
57
70
  # Dimethyl @K channel decoy
58
- Dimethyl:d12@K:
71
+ - name: Dimethyl:d12@K
59
72
  composition: H(-2)2H(8)13C(2)
60
73
 
61
74
  # Dimethyl @Any_N-term channel decoy
62
- Dimethyl:d12@Any_N-term:
75
+ - name: Dimethyl:d12@Any_N-term
63
76
  composition: H(-2)2H(8)13C(2)
64
77
 
65
78
  # Dimethyl @Protein_N-term channel decoy
66
- Dimethyl:d12@Protein_N-term:
79
+ - name: Dimethyl:d12@Protein_N-term
67
80
  composition: H(-2)2H(8)13C(2)
68
81
 
69
82
  # mTRAQ @K channel decoy
70
- mTRAQ:d12@K:
83
+ - name: mTRAQ:d12@K
71
84
  composition: H(12)C(1)13C(10)15N(2)O(1)
72
85
 
73
86
  # mTRAQ @Any_N-term channel decoy
74
- mTRAQ:d12@Any_N-term:
87
+ - name: mTRAQ:d12@Any_N-term
75
88
  composition: H(12)C(1)13C(14)15N(2)O(1)
76
89
 
77
90
  # mTRAQ @Protein_N-term channel decoy
78
- mTRAQ:d12@Protein_N-term:
91
+ - name: mTRAQ:d12@Protein_N-term
79
92
  composition: H(12)C(1)13C(14)15N(2)O(1)
80
93
 
81
94
  # SILAC heavy @K channel decoy
82
- Label:13C(12)@K:
95
+ - name: Label:13C(12)@K
83
96
  composition: C(12)
84
97
 
85
98
  search:
@@ -120,9 +133,6 @@ calibration:
120
133
  # the maximum number of times an automatic optimizer can be skipped before it is considered to have converged
121
134
  max_skips: 1
122
135
 
123
- # TODO: remove this parameter
124
- final_full_calibration: False
125
-
126
136
  # TODO: remove this parameter
127
137
  norm_rt_mode: 'linear'
128
138
 
@@ -191,23 +201,27 @@ library_multiplexing:
191
201
  # channels can be either a number or a string
192
202
  # for every channel, the library gets copied and the modifications are translated according to the mapping
193
203
  # the following example shows how to multiplex mTRAQ to three sample channels and a decoy channel
194
- multiplex_mapping: {}
204
+ multiplex_mapping: []
205
+ # - channel_name: 0
206
+ # modifications:
207
+ # mTRAQ@K: mTRAQ@K
208
+ # mTRAQ@Any_N-term: mTRAQ@Any_N-term
209
+ #
210
+ # - channel_name: 4
211
+ # modifications:
212
+ # mTRAQ@K: mTRAQ:13C(3)15N(1)@K
213
+ # mTRAQ@Any_N-term: mTRAQ:13C(3)15N(1)@Any_N-term
214
+ #
215
+ # - channel_name: 8
216
+ # modifications:
217
+ # mTRAQ@K: mTRAQ:13C(6)15N(2)@K
218
+ # mTRAQ@Any_N-term: mTRAQ:13C(6)15N(2)@Any_N-term
219
+ #
220
+ # - channel_name: 12
221
+ # modifications:
222
+ # mTRAQ@K: mTRAQ:d12@K
223
+ # mTRAQ@Any_N-term: mTRAQ:d12@Any_N-term
195
224
 
196
- #0:
197
- # mTRAQ@K: mTRAQ@K
198
- # mTRAQ@Any_N-term: mTRAQ@Any_N-term
199
-
200
- #4:
201
- # mTRAQ@K: mTRAQ:13C(3)15N(1)@K
202
- # mTRAQ@Any_N-term: mTRAQ:13C(3)15N(1)@Any_N-term
203
-
204
- #8:
205
- # mTRAQ@K: mTRAQ:13C(6)15N(2)@K
206
- # mTRAQ@Any_N-term: mTRAQ:13C(6)15N(2)@Any_N-term
207
-
208
- #12:
209
- # mTRAQ@K: mTRAQ:d12@K
210
- # mTRAQ@Any_N-term: mTRAQ:d12@Any_N-term
211
225
 
212
226
 
213
227
 
@@ -225,6 +239,13 @@ fdr:
225
239
  keep_decoys: false
226
240
  channel_wise_fdr: false
227
241
  inference_strategy: "heuristic"
242
+ # (Experimental)
243
+ # uses a two-step classifier consisting of a logistic regression and a neural network, with a default maximum of 5 iterations per fitting call
244
+ enable_two_step_classifier: false
245
+ two_step_classifier_max_iterations: 5
246
+ # (Experimental)
247
+ # Optimizes the batch size and learning rate of the neural network
248
+ enable_nn_hyperparameter_tuning: false
228
249
 
229
250
  search_output:
230
251
  peptide_level_lfq: false
@@ -313,8 +334,9 @@ transfer_library:
313
334
  # if true, the library is created for transfer learning
314
335
  enabled: False
315
336
 
316
- # semicolon separated list of fragment types to include in the library. possible values are 'a', 'b', 'c', 'x', 'y', 'z'
317
- fragment_types: 'b;y'
337
+ # list of fragment types (see alphabase.peptide.fragment.FRAGMENT_TYPES for supported types)
338
+ # Supported types are: a, b, c, x, y, z, b_modloss, y_modloss, b_H2O, y_H2O, b_NH3, y_NH3, c_lossH, z_addH
339
+ fragment_types: ['b', 'y']
318
340
 
319
341
  # maximum charge for fragments
320
342
  max_charge: 2
@@ -373,54 +395,8 @@ transfer_learning:
373
395
  # instrument type encoded during training
374
396
  instrument: 'Lumos'
375
397
 
376
- # configuration for the calibration manager
377
- # the config has to start with the calibration keyword and consists of a list of calibration groups.
378
- # each group consists of datapoints which have multiple properties.
379
- # This can be for example precursors (mz, rt ...), fragments (mz, ...), quadrupole (transfer_efficiency)
380
- calibration_manager:
381
- - name: fragment
382
- estimators:
383
- - name: mz
384
- model: LOESSRegression
385
- model_args:
386
- n_kernels: 2
387
- input_columns:
388
- - mz_library
389
- target_columns:
390
- - mz_observed
391
- output_columns:
392
- - mz_calibrated
393
- transform_deviation: 1e6
394
- - name: precursor
395
- estimators:
396
- - name: mz
397
- model: LOESSRegression
398
- model_args:
399
- n_kernels: 2
400
- input_columns:
401
- - mz_library
402
- target_columns:
403
- - mz_observed
404
- output_columns:
405
- - mz_calibrated
406
- transform_deviation: 1e6
407
- - name: rt
408
- model: LOESSRegression
409
- model_args:
410
- n_kernels: 6
411
- input_columns:
412
- - rt_library
413
- target_columns:
414
- - rt_observed
415
- output_columns:
416
- - rt_calibrated
417
- - name: mobility
418
- model: LOESSRegression
419
- model_args:
420
- n_kernels: 2
421
- input_columns:
422
- - mobility_library
423
- target_columns:
424
- - mobility_observed
425
- output_columns:
426
- - mobility_calibrated
398
+
399
+ # scope of default yaml should be one search step
400
+ multistep_search:
401
+ transfer_step_enabled: False
402
+ mbr_step_enabled: False
@@ -0,0 +1,34 @@
1
+ class ConstantsClass(type):
2
+ """A metaclass for classes that should only contain string constants."""
3
+
4
+ def __setattr__(self, name, value):
5
+ raise TypeError("Constants class cannot be modified")
6
+
7
+ def get_values(cls):
8
+ """Get all user-defined string values of the class."""
9
+ return [
10
+ value
11
+ for key, value in cls.__dict__.items()
12
+ if not key.startswith("__") and isinstance(value, str)
13
+ ]
14
+
15
+
16
+ class StatOutputKeys(metaclass=ConstantsClass):
17
+ """String constants for reading and writing output columns for the `stat` file."""
18
+
19
+ # optimization
20
+ OPTIMIZATION_PREFIX = "optimization."
21
+ MS1_ERROR = "ms1_error"
22
+ MS2_ERROR = "ms2_error"
23
+ RT_ERROR = "rt_error"
24
+ MOBILITY_ERROR = "mobility_error"
25
+
26
+
27
+ class ConfigKeys(metaclass=ConstantsClass):
28
+ """String constants for accessing the config."""
29
+
30
+ OUTPUT_DIRECTORY = "output_directory"
31
+ LIBRARY_PATH = "library_path"
32
+ RAW_PATHS = "raw_paths"
33
+ FASTA_PATHS = "fasta_paths"
34
+ QUANT_DIRECTORY = "quant_directory"