Metadata-Version: 2.4
Name: kinopt
Version: 0.10.0
Summary: Optimization-based estimation of cumulative kinase effects on substrate phosphorylation, including the effect of kinase autophosphorylation on its own activity.
Author: Abhinav Mishra
License-Expression: BSD-3-Clause
Project-URL: Homepage, https://github.com/bibymaths/KinOpt
Project-URL: Documentation, https://bibymaths.github.io/KinOpt/
Project-URL: Changelog, https://github.com/bibymaths/KinOpt/blob/main/docs/CHANGELOG.md
Project-URL: Release notes, https://github.com/bibymaths/KinOpt/tree/main/release-notes
Project-URL: Issues, https://github.com/bibymaths/KinOpt/issues
Keywords: phosphorylation,kinase,phosphoproteomics,time series,constrained optimization,systems biology
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: LICENSE-docs.md
License-File: THIRD_PARTY.md
Requires-Dist: numpy<3,>=2.4.6
Requires-Dist: pandas>=3.0.3
Requires-Dist: scipy<2,>=1.17.1
Requires-Dist: scikit-learn>=1.8.0
Requires-Dist: statsmodels>=0.14.6
Requires-Dist: jax<0.13,>=0.9.2
Requires-Dist: jaxlib<0.13,>=0.9.2
Requires-Dist: jaxopt>=0.8.4
Requires-Dist: matplotlib<4,>=3.10.9
Requires-Dist: seaborn>=0.13.2
Requires-Dist: plotly>=6.6.0
Requires-Dist: openpyxl>=3.1.5
Requires-Dist: adjustText>=1.3.0
Requires-Dist: joblib>=1.5.3
Dynamic: license-file

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/bibymaths/KinOpt/main/docs/assets/brand/wordmark-dark.svg">
    <img alt="KinOpt: kinase effects on phosphorylation" src="https://raw.githubusercontent.com/bibymaths/KinOpt/main/docs/assets/brand/wordmark-light.svg" width="520">
  </picture>
</p>

<p align="center">
  <a href="https://pypi.org/project/kinopt/"><img alt="PyPI" src="https://img.shields.io/pypi/v/kinopt"></a>
  <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>
  <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>
  <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>
  <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>
  <a href="https://bibymaths.github.io/KinOpt/"><img alt="Documentation" src="https://img.shields.io/badge/docs-bibymaths.github.io%2FKinOpt-1f2a44"></a>
  <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>
  <img alt="Python 3.12" src="https://img.shields.io/badge/python-3.12-3a8fd6">
  <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>
  <!-- DOI badge: added after the first Zenodo release mints KinOpt's DOI -->
</p>

# KinOpt

**Documentation:** <https://bibymaths.github.io/KinOpt/> · [Release notes](https://github.com/bibymaths/KinOpt/tree/main/release-notes) ·
[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)

KinOpt estimates the cumulative effect of kinases on the phosphorylation of their substrate sites from
phosphoproteomics time series, including the effect of a kinase's own phosphorylation on its activity. For every
site it fits how much each of its kinases contributes (α), and for every kinase how its protein and site series
combine into its activity (β):

$$\hat P_i(t) = \max\Big(0, \sum_k \alpha_{ik} \sum_j \beta_{kj} X_{kj}(t)\Big),\qquad
\sum_k \alpha_{ik} = 1,\ \alpha_{ik} \in [0, 1],\qquad \sum_j \beta_{kj} = 1$$

The default solver is SciPy SLSQP with these constraints and the bounds as hard constraints, run from 64 seeded
starts. KinOpt was split out of [PhosKinTime](https://github.com/bibymaths/phoskintime), which uses its results.

## Install and run

From PyPI:

```bash
pip install kinopt
kinopt-local                   # or: python -m kinopt.local
```

For exact reproduction of published results use pixi.lock; pip install gives compatible versions.

Run it from a project folder that contains a `config.toml` (copy the
[template from the repository](https://github.com/bibymaths/KinOpt/blob/main/config.toml)); KinOpt also takes its
input and output folders from there. From a clone of the repository, with [Pixi](https://pixi.sh):

```bash
pixi install
pixi run kinopt-local          # PYTHONPATH=. python -m kinopt.local
```

Put `input1.csv` (time series: `GeneID`, `Psite`, `x1` … `x14`) and `input2.csv` (sites and their kinases:
`GeneID`, `Psite`, `Kinase`) in `data/`, or set `[paths]` in `config.toml`. Results go to `paths.results_dir`: the
workbook `kinopt_results.xlsx` (α, β, summary, observed, estimated and residual series), the multistart
records, per-protein plots and `report.html`. Use a new results folder for each run.

Settings are in `config.toml` (see the [configuration reference](https://bibymaths.github.io/KinOpt/Documentation/configuration.html)):

| Setting | Default |
|---|---|
| `method` | `scipy-slsqp` (hard constraints). The JAXopt methods (`projected-gradient`, `lbfgsb`, …) are approximate options with penalty-enforced constraints |
| `n_starts`, `jitter_scale` | 64, 0.10 |
| `start_seed` | 20260115 |
| `loss_type` | `weighted` |
| β bounds | −4, 4 |

A default run takes about 20 minutes on a machine with enough cores (one start takes several minutes).

## Development

```bash
pixi run -e dev test            # tests (synthetic inputs, no data needed)
pixi run -e dev check-import
pixi run -e docs docs-build     # documentation (Zensical)
pixi run check-release v0.10.0  # versions, changelog and release notes agree
```

Releases: see [release-notes/README.md](https://github.com/bibymaths/KinOpt/blob/main/release-notes/README.md).

## Citation

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.

## License

- **Code:** BSD-3-Clause, see [LICENSE](https://github.com/bibymaths/KinOpt/blob/main/LICENSE).
- **Documentation:** CC BY 4.0, see [LICENSE-docs.md](https://github.com/bibymaths/KinOpt/blob/main/LICENSE-docs.md).
- **Third-party material** (wordmark font outlines under SIL OFL 1.1, dependencies):
  [THIRD_PARTY.md](https://github.com/bibymaths/KinOpt/blob/main/THIRD_PARTY.md).
- 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).
