kinopt 0.10.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.
Files changed (67) hide show
  1. kinopt-0.10.0/LICENSE +29 -0
  2. kinopt-0.10.0/LICENSE-docs.md +16 -0
  3. kinopt-0.10.0/PKG-INFO +134 -0
  4. kinopt-0.10.0/README.md +95 -0
  5. kinopt-0.10.0/THIRD_PARTY.md +137 -0
  6. kinopt-0.10.0/config_loader.py +122 -0
  7. kinopt-0.10.0/kinopt/__init__.py +9 -0
  8. kinopt-0.10.0/kinopt/fitanalysis/__init__.py +7 -0
  9. kinopt-0.10.0/kinopt/fitanalysis/__main__.py +9 -0
  10. kinopt-0.10.0/kinopt/fitanalysis/helpers/__init__.py +1 -0
  11. kinopt-0.10.0/kinopt/fitanalysis/helpers/postfit.py +598 -0
  12. kinopt-0.10.0/kinopt/fitanalysis/performance.py +61 -0
  13. kinopt-0.10.0/kinopt/local/__init__.py +7 -0
  14. kinopt-0.10.0/kinopt/local/__main__.py +154 -0
  15. kinopt-0.10.0/kinopt/local/config/__init__.py +1 -0
  16. kinopt-0.10.0/kinopt/local/config/constants.py +145 -0
  17. kinopt-0.10.0/kinopt/local/config/helpers/__init__.py +21 -0
  18. kinopt-0.10.0/kinopt/local/config/logconf.py +159 -0
  19. kinopt-0.10.0/kinopt/local/exporter/__init__.py +1 -0
  20. kinopt-0.10.0/kinopt/local/exporter/helpers/__init__.py +31 -0
  21. kinopt-0.10.0/kinopt/local/exporter/plotout.py +326 -0
  22. kinopt-0.10.0/kinopt/local/exporter/sheetutils.py +124 -0
  23. kinopt-0.10.0/kinopt/local/objfn/__init__.py +9 -0
  24. kinopt-0.10.0/kinopt/local/objfn/minfn.py +252 -0
  25. kinopt-0.10.0/kinopt/local/opt/__init__.py +1 -0
  26. kinopt-0.10.0/kinopt/local/opt/methods.py +26 -0
  27. kinopt-0.10.0/kinopt/local/opt/optrun.py +559 -0
  28. kinopt-0.10.0/kinopt/local/optcon/__init__.py +18 -0
  29. kinopt-0.10.0/kinopt/local/optcon/construct.py +400 -0
  30. kinopt-0.10.0/kinopt/local/utils/__init__.py +4 -0
  31. kinopt-0.10.0/kinopt/local/utils/iodata.py +268 -0
  32. kinopt-0.10.0/kinopt/local/utils/params.py +90 -0
  33. kinopt-0.10.0/kinopt/optimality/KKT.py +22 -0
  34. kinopt-0.10.0/kinopt/optimality/__init__.py +1 -0
  35. kinopt-0.10.0/kinopt/optimality/checks.py +247 -0
  36. kinopt-0.10.0/kinopt.egg-info/PKG-INFO +134 -0
  37. kinopt-0.10.0/kinopt.egg-info/SOURCES.txt +65 -0
  38. kinopt-0.10.0/kinopt.egg-info/dependency_links.txt +1 -0
  39. kinopt-0.10.0/kinopt.egg-info/entry_points.txt +2 -0
  40. kinopt-0.10.0/kinopt.egg-info/requires.txt +14 -0
  41. kinopt-0.10.0/kinopt.egg-info/top_level.txt +2 -0
  42. kinopt-0.10.0/pyproject.toml +59 -0
  43. kinopt-0.10.0/setup.cfg +4 -0
  44. kinopt-0.10.0/tests/test_check_release.py +58 -0
  45. kinopt-0.10.0/tests/test_checks_module.py +47 -0
  46. kinopt-0.10.0/tests/test_cli.py +81 -0
  47. kinopt-0.10.0/tests/test_config_discovery.py +30 -0
  48. kinopt-0.10.0/tests/test_default_config.py +17 -0
  49. kinopt-0.10.0/tests/test_dependency_bounds.py +35 -0
  50. kinopt-0.10.0/tests/test_docs_assets.py +19 -0
  51. kinopt-0.10.0/tests/test_gitignore.py +19 -0
  52. kinopt-0.10.0/tests/test_import_side_effects.py +58 -0
  53. kinopt-0.10.0/tests/test_input_consistency.py +23 -0
  54. kinopt-0.10.0/tests/test_k1_kinase_ordering.py +175 -0
  55. kinopt-0.10.0/tests/test_leftovers.py +19 -0
  56. kinopt-0.10.0/tests/test_method_validation.py +23 -0
  57. kinopt-0.10.0/tests/test_multistart_selection.py +41 -0
  58. kinopt-0.10.0/tests/test_multistart_settings.py +43 -0
  59. kinopt-0.10.0/tests/test_ode_copy_option.py +28 -0
  60. kinopt-0.10.0/tests/test_optimality.py +63 -0
  61. kinopt-0.10.0/tests/test_outputs_and_fitanalysis.py +65 -0
  62. kinopt-0.10.0/tests/test_plotting_current_matplotlib.py +26 -0
  63. kinopt-0.10.0/tests/test_processing_outputs.py +38 -0
  64. kinopt-0.10.0/tests/test_release_notes.py +16 -0
  65. kinopt-0.10.0/tests/test_scipy_slsqp.py +51 -0
  66. kinopt-0.10.0/tests/test_start_seed.py +21 -0
  67. kinopt-0.10.0/tests/test_workflows.py +32 -0
kinopt-0.10.0/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2025-2026, Abhinav Mishra
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of Abhinav Mishra nor the names of its contributors
17
+ may be used to endorse or promote products derived from this software
18
+ without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,16 @@
1
+ # Documentation license
2
+
3
+ The KinOpt documentation (the text of `docs/`, the README, the release notes and the changelog, and figures made
4
+ for KinOpt) is licensed under the **Creative Commons Attribution 4.0 International License (CC BY 4.0)**:
5
+ <https://creativecommons.org/licenses/by/4.0/> (legal code:
6
+ <https://creativecommons.org/licenses/by/4.0/legalcode>).
7
+
8
+ Attribution: "KinOpt documentation, Abhinav Mishra, https://bibymaths.github.io/KinOpt/".
9
+
10
+ **Not covered:**
11
+
12
+ - **Source code** in the documentation (code blocks, configuration examples) and everywhere else in the repository
13
+ is licensed under the BSD-3-Clause license in [`LICENSE`](LICENSE).
14
+ - **The KinOpt logo, wordmarks and favicons** (`docs/assets/brand/`) are covered by [`LICENSE`](LICENSE)
15
+ (BSD-3-Clause); the wordmark letter shapes come from a font under the SIL Open Font License 1.1 (see
16
+ [`THIRD_PARTY.md`](THIRD_PARTY.md)).
kinopt-0.10.0/PKG-INFO ADDED
@@ -0,0 +1,134 @@
1
+ Metadata-Version: 2.4
2
+ Name: kinopt
3
+ Version: 0.10.0
4
+ Summary: Optimization-based estimation of cumulative kinase effects on substrate phosphorylation, including the effect of kinase autophosphorylation on its own activity.
5
+ Author: Abhinav Mishra
6
+ License-Expression: BSD-3-Clause
7
+ Project-URL: Homepage, https://github.com/bibymaths/KinOpt
8
+ Project-URL: Documentation, https://bibymaths.github.io/KinOpt/
9
+ Project-URL: Changelog, https://github.com/bibymaths/KinOpt/blob/main/docs/CHANGELOG.md
10
+ Project-URL: Release notes, https://github.com/bibymaths/KinOpt/tree/main/release-notes
11
+ Project-URL: Issues, https://github.com/bibymaths/KinOpt/issues
12
+ Keywords: phosphorylation,kinase,phosphoproteomics,time series,constrained optimization,systems biology
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
19
+ Requires-Python: >=3.12
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ License-File: LICENSE-docs.md
23
+ License-File: THIRD_PARTY.md
24
+ Requires-Dist: numpy<3,>=2.4.6
25
+ Requires-Dist: pandas>=3.0.3
26
+ Requires-Dist: scipy<2,>=1.17.1
27
+ Requires-Dist: scikit-learn>=1.8.0
28
+ Requires-Dist: statsmodels>=0.14.6
29
+ Requires-Dist: jax<0.13,>=0.9.2
30
+ Requires-Dist: jaxlib<0.13,>=0.9.2
31
+ Requires-Dist: jaxopt>=0.8.4
32
+ Requires-Dist: matplotlib<4,>=3.10.9
33
+ Requires-Dist: seaborn>=0.13.2
34
+ Requires-Dist: plotly>=6.6.0
35
+ Requires-Dist: openpyxl>=3.1.5
36
+ Requires-Dist: adjustText>=1.3.0
37
+ Requires-Dist: joblib>=1.5.3
38
+ Dynamic: license-file
39
+
40
+ <p align="center">
41
+ <picture>
42
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/bibymaths/KinOpt/main/docs/assets/brand/wordmark-dark.svg">
43
+ <img alt="KinOpt: kinase effects on phosphorylation" src="https://raw.githubusercontent.com/bibymaths/KinOpt/main/docs/assets/brand/wordmark-light.svg" width="520">
44
+ </picture>
45
+ </p>
46
+
47
+ <p align="center">
48
+ <a href="https://pypi.org/project/kinopt/"><img alt="PyPI" src="https://img.shields.io/pypi/v/kinopt"></a>
49
+ <a href="https://github.com/bibymaths/KinOpt/releases"><img alt="Latest release" src="https://img.shields.io/github/v/release/bibymaths/KinOpt?sort=semver"></a>
50
+ <a href="https://github.com/bibymaths/KinOpt/actions/workflows/test.yml"><img alt="Tests" src="https://github.com/bibymaths/KinOpt/actions/workflows/test.yml/badge.svg"></a>
51
+ <a href="https://github.com/bibymaths/KinOpt/actions/workflows/publish.yml"><img alt="Release workflow" src="https://github.com/bibymaths/KinOpt/actions/workflows/publish.yml/badge.svg"></a>
52
+ <a href="https://github.com/bibymaths/KinOpt/actions/workflows/deploy-docs.yml"><img alt="Docs workflow" src="https://github.com/bibymaths/KinOpt/actions/workflows/deploy-docs.yml/badge.svg"></a>
53
+ <a href="https://bibymaths.github.io/KinOpt/"><img alt="Documentation" src="https://img.shields.io/badge/docs-bibymaths.github.io%2FKinOpt-1f2a44"></a>
54
+ <a href="https://pixi.sh"><img alt="Pixi" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/prefix-dev/pixi/main/assets/badge/v0.json"></a>
55
+ <img alt="Python 3.12" src="https://img.shields.io/badge/python-3.12-3a8fd6">
56
+ <a href="https://github.com/bibymaths/KinOpt/blob/main/LICENSE"><img alt="License: BSD-3-Clause" src="https://img.shields.io/badge/license-BSD--3--Clause-c4692f"></a>
57
+ <!-- DOI badge: added after the first Zenodo release mints KinOpt's DOI -->
58
+ </p>
59
+
60
+ # KinOpt
61
+
62
+ **Documentation:** <https://bibymaths.github.io/KinOpt/> · [Release notes](https://github.com/bibymaths/KinOpt/tree/main/release-notes) ·
63
+ [Changelog](https://github.com/bibymaths/KinOpt/blob/main/docs/CHANGELOG.md) · [Cite](https://github.com/bibymaths/KinOpt/blob/main/CITATION.cff) · [Security](https://github.com/bibymaths/KinOpt/blob/main/SECURITY.md) · [Terms of use](https://github.com/bibymaths/KinOpt/blob/main/TERMS_OF_USE.md)
64
+
65
+ KinOpt estimates the cumulative effect of kinases on the phosphorylation of their substrate sites from
66
+ phosphoproteomics time series, including the effect of a kinase's own phosphorylation on its activity. For every
67
+ site it fits how much each of its kinases contributes (α), and for every kinase how its protein and site series
68
+ combine into its activity (β):
69
+
70
+ $$\hat P_i(t) = \max\Big(0, \sum_k \alpha_{ik} \sum_j \beta_{kj} X_{kj}(t)\Big),\qquad
71
+ \sum_k \alpha_{ik} = 1,\ \alpha_{ik} \in [0, 1],\qquad \sum_j \beta_{kj} = 1$$
72
+
73
+ The default solver is SciPy SLSQP with these constraints and the bounds as hard constraints, run from 64 seeded
74
+ starts. KinOpt was split out of [PhosKinTime](https://github.com/bibymaths/phoskintime), which uses its results.
75
+
76
+ ## Install and run
77
+
78
+ From PyPI:
79
+
80
+ ```bash
81
+ pip install kinopt
82
+ kinopt-local # or: python -m kinopt.local
83
+ ```
84
+
85
+ For exact reproduction of published results use pixi.lock; pip install gives compatible versions.
86
+
87
+ Run it from a project folder that contains a `config.toml` (copy the
88
+ [template from the repository](https://github.com/bibymaths/KinOpt/blob/main/config.toml)); KinOpt also takes its
89
+ input and output folders from there. From a clone of the repository, with [Pixi](https://pixi.sh):
90
+
91
+ ```bash
92
+ pixi install
93
+ pixi run kinopt-local # PYTHONPATH=. python -m kinopt.local
94
+ ```
95
+
96
+ Put `input1.csv` (time series: `GeneID`, `Psite`, `x1` … `x14`) and `input2.csv` (sites and their kinases:
97
+ `GeneID`, `Psite`, `Kinase`) in `data/`, or set `[paths]` in `config.toml`. Results go to `paths.results_dir`: the
98
+ workbook `kinopt_results.xlsx` (α, β, summary, observed, estimated and residual series), the multistart
99
+ records, per-protein plots and `report.html`. Use a new results folder for each run.
100
+
101
+ Settings are in `config.toml` (see the [configuration reference](https://bibymaths.github.io/KinOpt/Documentation/configuration.html)):
102
+
103
+ | Setting | Default |
104
+ |---|---|
105
+ | `method` | `scipy-slsqp` (hard constraints). The JAXopt methods (`projected-gradient`, `lbfgsb`, …) are approximate options with penalty-enforced constraints |
106
+ | `n_starts`, `jitter_scale` | 64, 0.10 |
107
+ | `start_seed` | 20260115 |
108
+ | `loss_type` | `weighted` |
109
+ | β bounds | −4, 4 |
110
+
111
+ A default run takes about 20 minutes on a machine with enough cores (one start takes several minutes).
112
+
113
+ ## Development
114
+
115
+ ```bash
116
+ pixi run -e dev test # tests (synthetic inputs, no data needed)
117
+ pixi run -e dev check-import
118
+ pixi run -e docs docs-build # documentation (Zensical)
119
+ pixi run check-release v0.10.0 # versions, changelog and release notes agree
120
+ ```
121
+
122
+ Releases: see [release-notes/README.md](https://github.com/bibymaths/KinOpt/blob/main/release-notes/README.md).
123
+
124
+ ## Citation
125
+
126
+ Cite KinOpt with the metadata in [CITATION.cff](https://github.com/bibymaths/KinOpt/blob/main/CITATION.cff). Each release is archived on Zenodo with its own DOI.
127
+
128
+ ## License
129
+
130
+ - **Code:** BSD-3-Clause, see [LICENSE](https://github.com/bibymaths/KinOpt/blob/main/LICENSE).
131
+ - **Documentation:** CC BY 4.0, see [LICENSE-docs.md](https://github.com/bibymaths/KinOpt/blob/main/LICENSE-docs.md).
132
+ - **Third-party material** (wordmark font outlines under SIL OFL 1.1, dependencies):
133
+ [THIRD_PARTY.md](https://github.com/bibymaths/KinOpt/blob/main/THIRD_PARTY.md).
134
+ - Research use and no warranty: [TERMS_OF_USE.md](https://github.com/bibymaths/KinOpt/blob/main/TERMS_OF_USE.md). Reporting vulnerabilities: [SECURITY.md](https://github.com/bibymaths/KinOpt/blob/main/SECURITY.md).
@@ -0,0 +1,95 @@
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/bibymaths/KinOpt/main/docs/assets/brand/wordmark-dark.svg">
4
+ <img alt="KinOpt: kinase effects on phosphorylation" src="https://raw.githubusercontent.com/bibymaths/KinOpt/main/docs/assets/brand/wordmark-light.svg" width="520">
5
+ </picture>
6
+ </p>
7
+
8
+ <p align="center">
9
+ <a href="https://pypi.org/project/kinopt/"><img alt="PyPI" src="https://img.shields.io/pypi/v/kinopt"></a>
10
+ <a href="https://github.com/bibymaths/KinOpt/releases"><img alt="Latest release" src="https://img.shields.io/github/v/release/bibymaths/KinOpt?sort=semver"></a>
11
+ <a href="https://github.com/bibymaths/KinOpt/actions/workflows/test.yml"><img alt="Tests" src="https://github.com/bibymaths/KinOpt/actions/workflows/test.yml/badge.svg"></a>
12
+ <a href="https://github.com/bibymaths/KinOpt/actions/workflows/publish.yml"><img alt="Release workflow" src="https://github.com/bibymaths/KinOpt/actions/workflows/publish.yml/badge.svg"></a>
13
+ <a href="https://github.com/bibymaths/KinOpt/actions/workflows/deploy-docs.yml"><img alt="Docs workflow" src="https://github.com/bibymaths/KinOpt/actions/workflows/deploy-docs.yml/badge.svg"></a>
14
+ <a href="https://bibymaths.github.io/KinOpt/"><img alt="Documentation" src="https://img.shields.io/badge/docs-bibymaths.github.io%2FKinOpt-1f2a44"></a>
15
+ <a href="https://pixi.sh"><img alt="Pixi" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/prefix-dev/pixi/main/assets/badge/v0.json"></a>
16
+ <img alt="Python 3.12" src="https://img.shields.io/badge/python-3.12-3a8fd6">
17
+ <a href="https://github.com/bibymaths/KinOpt/blob/main/LICENSE"><img alt="License: BSD-3-Clause" src="https://img.shields.io/badge/license-BSD--3--Clause-c4692f"></a>
18
+ <!-- DOI badge: added after the first Zenodo release mints KinOpt's DOI -->
19
+ </p>
20
+
21
+ # KinOpt
22
+
23
+ **Documentation:** <https://bibymaths.github.io/KinOpt/> · [Release notes](https://github.com/bibymaths/KinOpt/tree/main/release-notes) ·
24
+ [Changelog](https://github.com/bibymaths/KinOpt/blob/main/docs/CHANGELOG.md) · [Cite](https://github.com/bibymaths/KinOpt/blob/main/CITATION.cff) · [Security](https://github.com/bibymaths/KinOpt/blob/main/SECURITY.md) · [Terms of use](https://github.com/bibymaths/KinOpt/blob/main/TERMS_OF_USE.md)
25
+
26
+ KinOpt estimates the cumulative effect of kinases on the phosphorylation of their substrate sites from
27
+ phosphoproteomics time series, including the effect of a kinase's own phosphorylation on its activity. For every
28
+ site it fits how much each of its kinases contributes (α), and for every kinase how its protein and site series
29
+ combine into its activity (β):
30
+
31
+ $$\hat P_i(t) = \max\Big(0, \sum_k \alpha_{ik} \sum_j \beta_{kj} X_{kj}(t)\Big),\qquad
32
+ \sum_k \alpha_{ik} = 1,\ \alpha_{ik} \in [0, 1],\qquad \sum_j \beta_{kj} = 1$$
33
+
34
+ The default solver is SciPy SLSQP with these constraints and the bounds as hard constraints, run from 64 seeded
35
+ starts. KinOpt was split out of [PhosKinTime](https://github.com/bibymaths/phoskintime), which uses its results.
36
+
37
+ ## Install and run
38
+
39
+ From PyPI:
40
+
41
+ ```bash
42
+ pip install kinopt
43
+ kinopt-local # or: python -m kinopt.local
44
+ ```
45
+
46
+ For exact reproduction of published results use pixi.lock; pip install gives compatible versions.
47
+
48
+ Run it from a project folder that contains a `config.toml` (copy the
49
+ [template from the repository](https://github.com/bibymaths/KinOpt/blob/main/config.toml)); KinOpt also takes its
50
+ input and output folders from there. From a clone of the repository, with [Pixi](https://pixi.sh):
51
+
52
+ ```bash
53
+ pixi install
54
+ pixi run kinopt-local # PYTHONPATH=. python -m kinopt.local
55
+ ```
56
+
57
+ Put `input1.csv` (time series: `GeneID`, `Psite`, `x1` … `x14`) and `input2.csv` (sites and their kinases:
58
+ `GeneID`, `Psite`, `Kinase`) in `data/`, or set `[paths]` in `config.toml`. Results go to `paths.results_dir`: the
59
+ workbook `kinopt_results.xlsx` (α, β, summary, observed, estimated and residual series), the multistart
60
+ records, per-protein plots and `report.html`. Use a new results folder for each run.
61
+
62
+ Settings are in `config.toml` (see the [configuration reference](https://bibymaths.github.io/KinOpt/Documentation/configuration.html)):
63
+
64
+ | Setting | Default |
65
+ |---|---|
66
+ | `method` | `scipy-slsqp` (hard constraints). The JAXopt methods (`projected-gradient`, `lbfgsb`, …) are approximate options with penalty-enforced constraints |
67
+ | `n_starts`, `jitter_scale` | 64, 0.10 |
68
+ | `start_seed` | 20260115 |
69
+ | `loss_type` | `weighted` |
70
+ | β bounds | −4, 4 |
71
+
72
+ A default run takes about 20 minutes on a machine with enough cores (one start takes several minutes).
73
+
74
+ ## Development
75
+
76
+ ```bash
77
+ pixi run -e dev test # tests (synthetic inputs, no data needed)
78
+ pixi run -e dev check-import
79
+ pixi run -e docs docs-build # documentation (Zensical)
80
+ pixi run check-release v0.10.0 # versions, changelog and release notes agree
81
+ ```
82
+
83
+ Releases: see [release-notes/README.md](https://github.com/bibymaths/KinOpt/blob/main/release-notes/README.md).
84
+
85
+ ## Citation
86
+
87
+ Cite KinOpt with the metadata in [CITATION.cff](https://github.com/bibymaths/KinOpt/blob/main/CITATION.cff). Each release is archived on Zenodo with its own DOI.
88
+
89
+ ## License
90
+
91
+ - **Code:** BSD-3-Clause, see [LICENSE](https://github.com/bibymaths/KinOpt/blob/main/LICENSE).
92
+ - **Documentation:** CC BY 4.0, see [LICENSE-docs.md](https://github.com/bibymaths/KinOpt/blob/main/LICENSE-docs.md).
93
+ - **Third-party material** (wordmark font outlines under SIL OFL 1.1, dependencies):
94
+ [THIRD_PARTY.md](https://github.com/bibymaths/KinOpt/blob/main/THIRD_PARTY.md).
95
+ - Research use and no warranty: [TERMS_OF_USE.md](https://github.com/bibymaths/KinOpt/blob/main/TERMS_OF_USE.md). Reporting vulnerabilities: [SECURITY.md](https://github.com/bibymaths/KinOpt/blob/main/SECURITY.md).
@@ -0,0 +1,137 @@
1
+ # Third-party material
2
+
3
+ KinOpt itself is licensed under BSD-3-Clause ([`LICENSE`](LICENSE)); its documentation under CC BY 4.0
4
+ ([`LICENSE-docs.md`](LICENSE-docs.md)). This file lists material from others that is part of, or used by, this
5
+ repository.
6
+
7
+ ## PKV Sans (wordmark outlines)
8
+
9
+ The wordmarks in `docs/assets/brand/` contain letter shapes outlined from **PKV Sans Bold**, a font of
10
+ PhosKinTime-Vis built from **Noto Sans** Bold, Copyright 2022 The Noto Project Authors
11
+ (https://github.com/notofonts/latin-greek-cyrillic). Noto Sans and PKV Sans are licensed under the SIL Open Font
12
+ License, Version 1.1 (text below). The font file itself is not distributed with KinOpt.
13
+
14
+ ## Documentation site (loaded from a CDN, not distributed)
15
+
16
+ | Library | Version | License | Used for |
17
+ |---|---|---|---|
18
+ | KaTeX | 0.16.0 | MIT | Mathematics in the documentation |
19
+ | Mermaid | 10 | MIT | Diagrams in the documentation |
20
+
21
+ The site is built with Zensical (MIT), mkdocstrings and pymdown-extensions (build tools). The published site
22
+ contains the Zensical theme's assets, including the Lucide icons (ISC) and Font Awesome Free icons (icons CC BY 4.0,
23
+ fonts SIL OFL 1.1, code MIT), under their own licenses as noted in the site files.
24
+
25
+ ## Python dependencies (installed separately, not distributed)
26
+
27
+ KinOpt's runtime dependencies are installed by Pixi (`pixi.toml`) or pip (`pyproject.toml`); none is bundled.
28
+ Versions as resolved in `pixi.lock` at release 0.10.0:
29
+
30
+ | Package | Version | License |
31
+ |---|---|---|
32
+ | NumPy | 2.4.6 | BSD-3-Clause (bundled parts: 0BSD, MIT, Zlib, CC0-1.0) |
33
+ | pandas | 3.0.3 | BSD-3-Clause |
34
+ | SciPy | 1.17.1 | BSD-3-Clause |
35
+ | scikit-learn | 1.8.0 | BSD-3-Clause |
36
+ | statsmodels | 0.14.6 | BSD-3-Clause |
37
+ | JAX / jaxlib | 0.9.2 | Apache-2.0 |
38
+ | JAXopt | 0.8.4 | Apache-2.0 |
39
+ | Matplotlib | 3.10.9 | Matplotlib License (PSF-based) |
40
+ | seaborn | 0.13.2 | BSD-3-Clause |
41
+ | Plotly | 6.6.0 | MIT |
42
+ | openpyxl | 3.1.5 | MIT |
43
+ | adjustText | 1.3.0 | MIT |
44
+ | joblib | 1.5.3 | BSD-3-Clause |
45
+
46
+ The development, documentation and visualization environments in `pixi.toml` add further tools under their own
47
+ licenses.
48
+
49
+ ## SIL Open Font License 1.1
50
+
51
+ ```
52
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
53
+ -----------------------------------------------------------
54
+
55
+ PREAMBLE
56
+ The goals of the Open Font License (OFL) are to stimulate worldwide
57
+ development of collaborative font projects, to support the font creation
58
+ efforts of academic and linguistic communities, and to provide a free and
59
+ open framework in which fonts may be shared and improved in partnership
60
+ with others.
61
+
62
+ The OFL allows the licensed fonts to be used, studied, modified and
63
+ redistributed freely as long as they are not sold by themselves. The
64
+ fonts, including any derivative works, can be bundled, embedded,
65
+ redistributed and/or sold with any software provided that any reserved
66
+ names are not used by derivative works. The fonts and derivatives,
67
+ however, cannot be released under any other type of license. The
68
+ requirement for fonts to remain under this license does not apply
69
+ to any document created using the fonts or their derivatives.
70
+
71
+ DEFINITIONS
72
+ "Font Software" refers to the set of files released by the Copyright
73
+ Holder(s) under this license and clearly marked as such. This may
74
+ include source files, build scripts and documentation.
75
+
76
+ "Reserved Font Name" refers to any names specified as such after the
77
+ copyright statement(s).
78
+
79
+ "Original Version" refers to the collection of Font Software components as
80
+ distributed by the Copyright Holder(s).
81
+
82
+ "Modified Version" refers to any derivative made by adding to, deleting,
83
+ or substituting -- in part or in whole -- any of the components of the
84
+ Original Version, by changing formats or by porting the Font Software to a
85
+ new environment.
86
+
87
+ "Author" refers to any designer, engineer, programmer, technical
88
+ writer or other person who contributed to the Font Software.
89
+
90
+ PERMISSION & CONDITIONS
91
+ Permission is hereby granted, free of charge, to any person obtaining
92
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
93
+ redistribute, and sell modified and unmodified copies of the Font
94
+ Software, subject to the following conditions:
95
+
96
+ 1) Neither the Font Software nor any of its individual components,
97
+ in Original or Modified Versions, may be sold by itself.
98
+
99
+ 2) Original or Modified Versions of the Font Software may be bundled,
100
+ redistributed and/or sold with any software, provided that each copy
101
+ contains the above copyright notice and this license. These can be
102
+ included either as stand-alone text files, human-readable headers or
103
+ in the appropriate machine-readable metadata fields within text or
104
+ binary files as long as those fields can be easily viewed by the user.
105
+
106
+ 3) No Modified Version of the Font Software may use the Reserved Font
107
+ Name(s) unless explicit written permission is granted by the corresponding
108
+ Copyright Holder. This restriction only applies to the primary font name as
109
+ presented to the users.
110
+
111
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
112
+ Software shall not be used to promote, endorse or advertise any
113
+ Modified Version, except to acknowledge the contribution(s) of the
114
+ Copyright Holder(s) and the Author(s) or with their explicit written
115
+ permission.
116
+
117
+ 5) The Font Software, modified or unmodified, in part or in whole,
118
+ must be distributed entirely under this license, and must not be
119
+ distributed under any other license. The requirement for fonts to
120
+ remain under this license does not apply to any document created
121
+ using the Font Software.
122
+
123
+ TERMINATION
124
+ This license becomes null and void if any of the above conditions are
125
+ not met.
126
+
127
+ DISCLAIMER
128
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
129
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
130
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
131
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
132
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
133
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
134
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
135
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
136
+ OTHER DEALINGS IN THE FONT SOFTWARE.
137
+ ```
@@ -0,0 +1,122 @@
1
+ """Read KinOpt settings from `config.toml`.
2
+
3
+ `load` returns the settings of one section (for example `[kinopt]`) merged with one of its modes, plus the
4
+ `[paths]` table and the project root. `ensure_dirs` creates the folders named in `[paths]`.
5
+ """
6
+ from __future__ import annotations
7
+
8
+ from functools import lru_cache
9
+ from pathlib import Path
10
+ from typing import Any
11
+
12
+ try:
13
+ import tomllib # py>=3.11
14
+ except ModuleNotFoundError: # pragma: no cover
15
+ import tomli as tomllib # py<3.11
16
+
17
+
18
+ def _project_root(start: Path | None = None) -> Path:
19
+ """Find the project root, the first folder upwards that contains `config.toml`.
20
+
21
+ Walks upwards from `start` first (in a checkout this finds the repository), then from the working directory
22
+ (for an installed package run from a project folder).
23
+
24
+ Args:
25
+ start: Folder to start the first walk from. If None, the folder of this module is used.
26
+
27
+ Returns:
28
+ The first folder found that contains `config.toml`.
29
+
30
+ Raises:
31
+ FileNotFoundError: Neither walk finds a `config.toml`.
32
+ """
33
+ start = Path(start or Path(__file__).resolve().parent).resolve()
34
+ cwd = Path.cwd().resolve()
35
+ for base in (start, cwd):
36
+ for p in [base, *base.parents]:
37
+ if (p / "config.toml").is_file():
38
+ return p
39
+ raise FileNotFoundError(
40
+ f"No config.toml found above {start} or above the working directory {cwd}. "
41
+ "Run KinOpt from a project folder that contains config.toml (see the KinOpt repository for a template)."
42
+ )
43
+
44
+
45
+ def _deep_merge(base: dict[str, Any], override: dict[str, Any]) -> dict[str, Any]:
46
+ """Merge two dictionaries recursively; values in `override` take precedence.
47
+
48
+ Nested dictionaries present in both are merged; any other value in `override` replaces the one in `base`.
49
+ Neither input is modified.
50
+
51
+ Args:
52
+ base: Dictionary with the default values.
53
+ override: Dictionary with the values that take precedence. None is treated as empty.
54
+
55
+ Returns:
56
+ A new merged dictionary.
57
+ """
58
+ out = dict(base)
59
+ for k, v in (override or {}).items():
60
+ if isinstance(v, dict) and isinstance(out.get(k), dict):
61
+ out[k] = _deep_merge(out[k], v)
62
+ else:
63
+ out[k] = v
64
+ return out
65
+
66
+
67
+ @lru_cache(maxsize=8)
68
+ def load(mode: str, section: str) -> dict[str, Any]:
69
+ """Load one section of `config.toml`, merged with the settings of one mode.
70
+
71
+ Reads `[<section>]` and deep-merges `[<section>.modes.<mode>]` over it. Results are cached per
72
+ `(mode, section)`, so later changes to the file are not seen within the same process.
73
+
74
+ Args:
75
+ mode: Mode name under `<section>.modes`, for example `"local"`.
76
+ section: Top-level table name, for example `"kinopt"`.
77
+
78
+ Returns:
79
+ The merged settings. The `modes` table itself is kept, and two keys are added: `_paths` (the `[paths]`
80
+ table) and `_root` (the project root as a string).
81
+
82
+ Raises:
83
+ FileNotFoundError: No `config.toml` is found (see `_project_root`).
84
+ """
85
+ root = _project_root()
86
+ with (root / "config.toml").open("rb") as f:
87
+ raw = tomllib.load(f)
88
+
89
+ base = raw.get(section, {}) or {}
90
+ modes = (base.get("modes", {}) or {})
91
+ merged = _deep_merge(base, modes.get(mode, {}))
92
+
93
+ merged["_paths"] = raw.get("paths", {}) or {}
94
+ merged["_root"] = str(root)
95
+
96
+ return merged
97
+
98
+
99
+ def ensure_dirs() -> None:
100
+ """Create the data, results, logs and ODE data folders named in `[paths]` of `config.toml`.
101
+
102
+ Paths are relative to the project root. Defaults: `data_dir="data"`, `results_dir="results"`,
103
+ `logs_dir="results/logs"`, `ode_data_dir="data"`. Existing folders are left as they are.
104
+
105
+ Raises:
106
+ FileNotFoundError: No `config.toml` is found (see `_project_root`).
107
+ """
108
+ root = _project_root()
109
+ with (root / "config.toml").open("rb") as f:
110
+ raw = tomllib.load(f)
111
+
112
+ paths = raw.get("paths", {}) or {}
113
+
114
+ data_dir = paths.get("data_dir", "data")
115
+ results_dir = paths.get("results_dir", "results")
116
+ logs_dir = paths.get("logs_dir", "results/logs")
117
+ ode_data_dir = paths.get("ode_data_dir", "data")
118
+
119
+ (root / data_dir).mkdir(parents=True, exist_ok=True)
120
+ (root / results_dir).mkdir(parents=True, exist_ok=True)
121
+ (root / logs_dir).mkdir(parents=True, exist_ok=True)
122
+ (root / ode_data_dir).mkdir(parents=True, exist_ok=True)
@@ -0,0 +1,9 @@
1
+ """KinOpt: optimization-based estimation of cumulative kinase effects on substrate phosphorylation.
2
+
3
+ Subpackages:
4
+
5
+ - `kinopt.local`: fits the kinase-substrate model with local (gradient-based) optimization and writes the
6
+ results workbook.
7
+ - `kinopt.fitanalysis`: post-fit plots and tables built from the results workbook.
8
+ - `kinopt.optimality`: constraint (feasibility) checks and summary statistics on the results workbook.
9
+ """
@@ -0,0 +1,7 @@
1
+ """Post-fit analysis of a KinOpt optimization run.
2
+
3
+ Reads the results workbook written by `kinopt.local` and produces goodness-of-fit plots, parameter
4
+ distribution plots, PCA and t-SNE plots of the estimated α and β, a Sankey diagram of kinase-substrate
5
+ connections, and CSV tables. The entry point is `optimization_performance`.
6
+ """
7
+ from kinopt.fitanalysis.performance import optimization_performance
@@ -0,0 +1,9 @@
1
+ """Run the post-fit analysis on an existing results folder: `python -m kinopt.fitanalysis`.
2
+
3
+ Reads the results workbook `OUT_FILE` (at the top of `results_dir` in config.toml) and writes the analysis plots
4
+ and tables to `OUT_DIR`; the Pixi task is `kinopt-fitanalysis`.
5
+ """
6
+ from kinopt.fitanalysis.performance import optimization_performance
7
+
8
+ if __name__ == "__main__":
9
+ optimization_performance()
@@ -0,0 +1 @@
1
+ """Helper functions for the post-fit analysis in `kinopt.fitanalysis`."""