KinOpt local tutorial overview
Download the notebook (executed for this page) ยท source
This notebook introduces the small educational workflow used by the rest of the suite. It explains the data model, alpha and beta parameters, and the KinOpt modules that will be reused.
from pathlib import Path
import sys
import os
import pandas as pd
def find_repo_root(start=None):
start = Path(start or Path.cwd()).resolve()
for path in [start, *start.parents]:
if (path / "config.toml").is_file():
return path
raise RuntimeError("Could not find repository root")
ROOT = find_repo_root()
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from config_loader import load
cfg = load("local", "kinopt")
ROOT, cfg["method"], cfg["loss_type"], len(cfg["time_points"])
(PosixPath('<repository>'), 'scipy-slsqp', 'weighted', 14)
KinOpt local mode estimates how kinase phosphosite activity explains substrate phosphorylation over time. For a substrate phosphosite, alpha values weight the upstream kinases. For each kinase, beta values weight that kinase's own phosphosites, representing autophosphorylation or kinase-site activity contributions.
The local prediction is therefore: kinase-site time series -> beta-weighted kinase activity -> alpha-weighted substrate prediction.
roadmap = pd.DataFrame([
("00", "Concepts and module map"),
("01", "Toy CSV schemas and raw data"),
("02", "Internal KinOpt objects"),
("03", "Preprocessing and mapping"),
("04", "Parameter layout and constraints"),
("05", "Objective and prediction"),
("06", "Local optimization run"),
("07", "Fit metrics and diagnostics"),
("08", "KKT and feasibility checks"),
("09", "End-to-end reproducible pipeline"),
], columns=["Notebook", "Purpose"])
roadmap
| Notebook | Purpose | |
|---|---|---|
| 0 | 00 | Concepts and module map |
| 1 | 01 | Toy CSV schemas and raw data |
| 2 | 02 | Internal KinOpt objects |
| 3 | 03 | Preprocessing and mapping |
| 4 | 04 | Parameter layout and constraints |
| 5 | 05 | Objective and prediction |
| 6 | 06 | Local optimization run |
| 7 | 07 | Fit metrics and diagnostics |
| 8 | 08 | KKT and feasibility checks |
| 9 | 09 | End-to-end reproducible pipeline |
modules = [
"processing.cleanup",
"processing.map",
"kinopt.local.optcon",
"kinopt.local.objfn",
"kinopt.local.opt.optrun",
"kinopt.local.utils.params",
"kinopt.fitanalysis",
"kinopt.optimality.checks",
"config",
"config_loader",
]
status = []
for module in modules:
try:
__import__(module)
status.append((module, "ok"))
except Exception as exc:
status.append((module, type(exc).__name__))
os.chdir(ROOT)
pd.DataFrame(status, columns=["Module", "Import status"])
| Module | Import status | |
|---|---|---|
| 0 | processing.cleanup | ok |
| 1 | processing.map | ok |
| 2 | kinopt.local.optcon | ok |
| 3 | kinopt.local.objfn | ok |
| 4 | kinopt.local.opt.optrun | ok |
| 5 | kinopt.local.utils.params | ok |
| 6 | kinopt.fitanalysis | ok |
| 7 | kinopt.optimality.checks | ok |
| 8 | config | ok |
| 9 | config_loader | ok |