Skip to content

KinOpt 0.10.0

Choose a tag to compare

@github-actions github-actions released this 30 Nov 08:15
· 48 commits to main since this release
d0a19f7

KinOpt 0.10.0

The first tagged release of KinOpt. It changes results: it fixes defect K1, which put β on the wrong kinase's
series, and it makes SciPy SLSQP with hard constraints the default solver. α and β from earlier KinOpt runs,
including the KinOpt code formerly inside PhosKinTime, should be recomputed.

Breaking changes

  • Results change. The K1 fix (below) changes α and β, and with them the Estimated series; recompute earlier
    results.
  • New default solver settings in config.toml: method = "scipy-slsqp" (SciPy SLSQP, hard constraints),
    n_starts = 64, jitter_scale = 0.10, start_seed = 20260115. Runs take longer (about 20 minutes on a machine
    with enough cores). The JAXopt methods remain available as approximate options.
  • Output layout: the workbook is results_dir/kinopt_results.xlsx (before: results_dir/kinopt/…); the
    multistart files (multistart_summary.csv, multistart_params.npz) and the analysis plots and tables are in
    results_dir/General/; one folder per fitted gene. The workbook is no longer copied into data/ unless
    --copy_to_ode_data_dir is given.
  • Command line: --method accepts exactly the supported methods (scipy-slsqp, projected-gradient,
    lbfgsb, slsqp, non-negative, unconstrained, and their aliases), also for the value in config.toml;
    trust-constr is rejected with an error. In python -m config.cli, --mode, --conf and the all command are
    removed; kinopt passes its options to kinopt.local. kinopt.local.config.constants.parse_args() returns a
    ninth value (copy_to_ode_data_dir).
  • Module rename: kinopt.optimality.KKT is now kinopt.optimality.checks (the old name is a deprecated alias
    until 0.11), and its functions and output files are renamed (see below).
  • Errors instead of silent fallbacks: unmappable inputs, and constraints a penalty method cannot apply, stop the
    run with an error.
  • Preprocessing: python -m processing.cleanup writes only to [paths] data_dir; it no longer copies into
    kinopt/data/ and tfopt/data/.
  • Logging: the logger and log files are named kinopt (before: phoskintime).

Fixed: β was applied to other kinases' series (K1)

KinOpt built each kinase's rows in the order the kinases first appear in input2, while the β offsets assumed
sorted kinase order. Unless input2 listed kinases in sorted order, a kinase's activity was built from other
proteins' series. On the PhosKinTime inputs, 24 of 27 kinases were affected, and the shipped Estimated sheet
reproduced from input1 only under that misassignment (1 of 36 sites from each kinase's own series). The kinase rows
and the β offsets now use one ordering, and a guard stops the run if they ever disagree. The objective, constraints
and bounds are unchanged.

Validation on the PhosKinTime inputs (same 64 seeded starts, SciPy SLSQP, all starts converged with constraint
residuals ≤ 1e-10), against a control run with the old indexing:

old indexing (control) 0.10.0
best objective (weighted loss) 0.1807 0.1593
R² 0.655 0.696
Estimated reproduced from each kinase's own series 2 of 36 sites 36 of 36 (max error 1.8e-15)

Across the two runs, α changes by 0.23 on average (up to 1) and β by 1.85 on average (up to 6.5); which α are exactly
zero changes for 31 edges.

Changed: default solver and multistart (approved for this release)

config.toml now uses:

  • method = "scipy-slsqp": SciPy SLSQP with Σα = 1 per site, Σβ = 1 per kinase and the bounds as hard
    constraints (maxiter 20000).
  • n_starts = 64 and jitter_scale = 0.10: 64 seeded starts (start_seed = 20260115; start i uses seed
    20260115 + i), the best converged start is kept.

These are the settings validated above. The JAX/JAXopt methods (projected-gradient, lbfgsb, non-negative,
unconstrained, and the compatibility name slsqp, which runs LBFGSB) remain available as
approximate options: they enforce the sum-to-one constraints with a penalty, so the sums hold only approximately
(about 1e-6), and runs may stop at the iteration cap without converging.

Run time: one SLSQP start takes several minutes, so a default run of 64 starts takes about 20 minutes on a
machine with enough cores (starts run in parallel).

Other changes

  • trust-constr is rejected with a clear error. Before, it ran without any sum-to-one constraint (its
    constraint object was skipped by the penalty). The penalty methods now refuse any constraint they cannot apply.
  • Constraint check renamed and corrected (kinopt.optimality): it checks Σα = 1, Σβ = 1 and the bounds within a
    tolerance (1e-10) instead of an exact != 1, and its outputs are named for what they compute:
    constraint_residuals.png and observed_range.png replace constraint_violations.png and sensitivity.png, and
    the log reports one "constraint check". The functions print_primal_feasibility_results,
    print_sensitivity_and_active_constraints, plot_constraint_violations and plot_sensitivity_analysis are
    replaced by log_constraint_check, plot_constraint_residuals and plot_observed_range. No KKT conditions or
    sensitivities are computed. The module is renamed kinopt.optimality.checks; kinopt.optimality.KKT remains as
    a deprecated alias (with a DeprecationWarning) until 0.11.
  • Output layout: the results workbook stays at the top of paths.results_dir; per-gene plots go to one folder
    per fitted gene, everything else to General/. Before, any file named <word>_… got its own folder, so
    kinopt/, multistart/ and others were listed as genes in the report.
  • python -m kinopt.fitanalysis (task kinopt-fitanalysis) runs the fit analysis on an existing results
    folder; before, it did nothing. The fit analysis also runs on small problems (t-SNE perplexity capped).
  • Logger name: KinOpt logs as kinopt (log files kinopt_<date>.log), no longer as phoskintime. The unused
    PhosKinTime classes PhosKinConfig and load_config_toml are removed from config_loader.
  • Current Matplotlib: the exporter uses matplotlib.colormaps instead of matplotlib.cm.get_cmap, which recent
    Matplotlib releases removed (a pip install kinopt with Matplotlib 3.11 failed at the first plot).
  • Preprocessing writes to one folder: python -m processing.cleanup writes its CSV files only to [paths] data_dir (or the out_dir given to each function). It no longer writes into processing/ and no longer copies
    into kinopt/data/ and tfopt/data/ (PhosKinTime-era locations); move_processed_files is removed.
  • Documentation: the background page on mass-spectrometry proteomics (docs/assets/background/) and its figures
    are removed from the repository and the documentation site.
  • Errors instead of silent fallbacks. A site in input2 without an input1 row, a site listed twice, or a
    kinase without any input1 series now stops the run with a ValueError. Before, another series was silently
    reused, or the rows were misaligned.
  • Multistart ranking. Among feasible starts, a converged start comes first, then the lowest objective. Before,
    tiny differences in constraint violation could outrank the objective.
  • No copy into data/ by default. The results workbook is copied into paths.ode_data_dir only with
    --copy_to_ode_data_dir. Before, every run overwrote data/kinopt_results.xlsx.
  • Seeded starting values through [kinopt] start_seed. Before, they were unseeded and runs were not
    reproducible.
  • n_starts and jitter_scale are [kinopt] settings (10 and 0.20 if the keys are absent).
  • kinopt.local.config.constants.parse_args() returns a ninth value (copy_to_ode_data_dir). Code that
    unpacks it must take nine values.
  • On PyPI: pip install kinopt installs the kinopt package and the kinopt-local command. An installed
    KinOpt looks for config.toml above the working directory (a clone still uses its own config.toml), so run it
    from a project folder with a config.toml; without one it stops with a clear error.
  • Removed: the Dockerfile and the kinopt-evol task (the kinopt.evol module was removed earlier).
  • Project: documentation corrected to the current code, with an API reference generated from the (rewritten)
    docstrings of every module and the site configured in zensical.toml, and a License page (code BSD-3-Clause, documentation
    CC BY 4.0; LICENSE, LICENSE-docs.md, THIRD_PARTY.md); a KinOpt logo and wordmark; a changelog generated with
    git-cliff. Releases are published by a tag-triggered workflow: GitHub release, archived on Zenodo, and PyPI.
    Tests, the import check and the docs build run on every push and pull request (test.yml).

Reproducibility and dependency versions

For exact reproduction of published results use pixi.lock; pip install gives compatible versions. The PyPI package
requires at least the versions this release was validated with (NumPy 2.4.6, SciPy 1.17.1, JAX/jaxlib 0.9.2, JAXopt
0.8.4, Matplotlib 3.10.9, pandas 3.0.3, scikit-learn 1.8.0, statsmodels 0.14.6, seaborn 0.13.2, Plotly 6.6.0,
openpyxl 3.1.5, adjustText 1.3.0, joblib 1.5.3), with upper bounds NumPy < 3, SciPy < 2, Matplotlib < 4 and
JAX/jaxlib < 0.13.

Check on a synthetic case (4 sites, 3 kinases, scipy-slsqp, 4 starts): the Pixi environment (NumPy 2.4.6,
SciPy 1.17.1, JAX 0.9.2, Matplotlib 3.10.9) and a clean pip install (NumPy 2.5.5, SciPy 1.18.1, JAX 0.12.1,
Matplotlib 3.11.2) reach best objectives that differ by 4.0e-14 (relative 1.1e-10). Over the 4 starts, objectives
differ by at most 2.6e-11, α by at most 8.5e-10, β by at most 4.0e-9.

Upgrading

  • Re-run KinOpt on your inputs and replace earlier kinopt_results.xlsx workbooks; their α and β are affected by
    K1.
  • Expect longer runs with the new defaults. For a quick exploratory run, set n_starts lower or choose an
    approximate method in config.toml.
  • If you relied on the copy into data/, add --copy_to_ode_data_dir.

Known issues

  • The prediction is clipped at 0 inside the objective, so a site predicted below zero at every time point gets no
    gradient (#4). Kept so that the objective is unchanged.
  • The Summary sheet's "SSE" row holds the weighted objective, not a sum of squares
    (#5).
  • SLSQP evaluates the equality constraints slowly; a NumPy evaluation would cut run time
    (#6).