This repository is KinOpt, a scientific Python package for optimization-based estimation of cumulative kinase effects on substrate phosphorylation, including kinase autophosphorylation effects on its own activity.
The repository should be treated as a working scientific software package. Do not rewrite it from scratch.
Primary code areas:
kinopt/processing/config/config_loader.pydocs/pixi.toml
Do not assume the existence of unrelated packages unless they are present in the filesystem.
- Preserve the existing package flow.
- Make minimal, targeted changes.
- Do not perform broad rewrites unless explicitly requested.
- Do not rename public functions, modules, CLI tasks, or output files unless required.
- Do not change scientific meaning, objective functions, parameter interpretation, or output semantics without documenting why.
- Do not delete working functionality to make a task easier.
- Prefer small, reviewable patches over large architectural changes.
- Keep existing folder structure unless explicitly instructed otherwise.
- Do not introduce hidden global state except for required numerical backend configuration.
- Always validate changes with Pixi commands where possible.
This project uses Pixi, not Poetry, Conda directly, or plain pip.
Use:
pixi run -e dev check-import
pixi run -e dev test
pixi run -e docs docs-buildDo not add Poetry files.
Do not create requirements.txt unless explicitly requested.
Dependency changes must go into pixi.toml.
If adding publishing/build dependencies, prefer a dedicated Pixi feature/environment.
The actual project modules are:
kinopt/
processing/
config/
config_loader.py
Do not document or import nonexistent modules such as:
tfopt
protwise
networkmodel
common
config.config
unless they actually exist in the repository.
If an existing task still references nonexistent modules, update it carefully. For example:
check-import = "PYTHONPATH=. python -c \"import kinopt, processing, config, config_loader; print('project imports ok')\""The intended backend migration is:
- Replace SciPy local optimization with JAX/JAXopt.
- Replace pymoo evolutionary optimization with QDax.
- Use
jax.numpyin optimization core functions. - Enable JAX float64 globally in optimization modules.
Required JAX setup:
import jax
jax.config.update("jax_enable_x64", True)Use:
import jax.numpy as jnpConvert numerical inputs entering optimization cores with:
jnp.asarray(x, dtype=jnp.float64)Convert back to NumPy/Pandas only at export, plotting, or reporting boundaries.
Do not convert the whole package blindly to JAX. Restrict JAX conversion to optimization-relevant numerical cores.
Local optimization code is primarily under:
kinopt/local/
Replace SciPy optimizer calls with JAXopt.
Preferred mappings:
- Bounded optimization:
jaxopt.ProjectedGradientwithprojection_box - Non-negative optimization:
projection_non_negative - Unconstrained optimization:
jaxopt.LBFGSorjaxopt.GradientDescent
Preserve existing function names and return structure where possible.
Do not silently ignore unsupported solver names. Either map old names explicitly or raise a clear error.
Do not redesign configuration.
Files such as:
config.toml
config/
config_loader.py
should remain stable.
Allowed config changes:
- solver/backend option names
- bounds handling required for JAXopt/QDax
- tech-stack labels
- backward-compatible mapping of old solver names to new backends
Disallowed config changes:
- changing unrelated defaults
- changing file formats
- renaming unrelated keys
- removing existing working options without replacement
Docs must reflect the real repository.
Allowed mkdocstrings targets include only importable modules, for example:
::: kinopt
::: kinopt.local
::: kinopt.fitanalysis
::: kinopt.optimality
::: processing
::: config
::: config.cli
::: config.logconf
::: config_loaderDo not use:
::: config.configbecause config/config.py does not exist.
When updating docs for backend migration, replace implementation references to:
- SciPy optimization
scipy.optimize- pymoo
- COBYLA/SLSQP/pymoo NSGA-II as active backends
with:
- JAX
- JAX NumPy
- JAXopt
- QDax
- QDax NSGA2/SPEA2
Historical mentions are acceptable only in changelog/migration notes.
After code changes, run:
pixi run -e dev check-import
pixi run -e dev testAfter documentation changes, run:
pixi run -e docs docs-buildIf docs fail due to mkdocstrings, fix the broken module path. Do not disable mkdocstrings globally just to pass the build.
If tests fail, identify whether the failure is caused by the current changes or pre-existing issues.
- Keep code readable and explicit.
- Avoid clever abstractions.
- Prefer direct numerical code.
- Keep scientific logic transparent.
- Do not add excessive comments.
- Add comments only where backend translation or numerical semantics could be unclear.
- Avoid broad formatting-only diffs.
Do not modify generated/cache/build files unless explicitly requested.
Do not commit or generate:
.pixi/
.venv/
__pycache__/
.pytest_cache/
dist/
build/
*.egg-info/
logs/
results_*/
Keep .gitignore aligned with these exclusions.
When finished, report:
- What files were changed.
- What backend or docs changes were made.
- What validation commands were run.
- Which commands passed or failed.
- Any remaining limitations.
Do not claim success unless the relevant validation command actually passed.