External tools: KinOpt and TFOpt
KinOpt and TFOpt are standalone tools. PhosKinTime does not import, install or vendor them. It only reads their result workbooks (Excel files), checks them against the file contract on this page, and records where they came from.
| Tool | Repository | Status |
|---|---|---|
| KinOpt (Mishra 2026) | https://github.com/bibymaths/KinOpt, docs | Use 0.11.0 or later. |
| TFOpt (Normann and Mishra 2026) | https://github.com/bibymaths/TFOpt, docs | Use 0.2.0 or later. |
The kinopt/ and tfopt/ code was last included in PhosKinTime at commit 6eb04fa.
Use the tools' own repositories for current code; git show 6eb04fa:kinopt/... shows the
last copy that lived here.
This page describes only the file interface. It does not describe the tools' equations or
what their parameters mean; see each tool's own documentation for that. Known issues that
apply to KinOpt/TFOpt are listed in KNOWN_ISSUES.md in the repository root, under
"Applies to KinOpt/TFOpt".
File contract
The contract is defined in phoskintime/common/external_results.py (KINOPT and TFOPT). It lists
only what PhosKinTime actually reads.
KinOpt: kinopt_results.xlsx
| Sheet | Required columns | Read by | Used for |
|---|---|---|---|
Alpha Values |
Gene, Psite, Kinase, Alpha |
phoskintime/networkmodel/io.py |
Kinase→site edge weights (merged on Gene/Psite/Kinase). |
Beta Values |
Kinase, Psite, Beta |
phoskintime/networkmodel/io.py |
Kinase priors. Rows with an empty Psite are the kinase-level values. |
Estimated |
Gene, Psite (+ time columns x1..x14) |
phoskintime analyze similarity (phoskintime/networkmodel/analysis/curve_similarity.py) |
Fitted phosphosite time courses, compared with Observed (not a model input). |
TFOpt: tfopt_results.xlsx
| Sheet | Required columns | Read by | Used for |
|---|---|---|---|
Alpha Values |
mRNA, TF, Value |
phoskintime/networkmodel/io.py |
TF→target edge weights (merged on mRNA/TF). |
Beta Values |
TF, PSite, Value |
phoskintime/networkmodel/io.py |
TF priors. Rows with an empty PSite are the TF-level values. |
Estimated |
mRNA (+ time columns x1..x9) |
phoskintime analyze similarity |
Fitted mRNA time courses, compared with Observed (not a model input). |
Notes:
- Each consumer checks only the sheets it reads. networkmodel checks
Alpha ValuesandBeta Values. Since v0.7.0 (protwise removed) no model stage readsEstimated. - Extra sheets and extra columns are allowed. KinOpt and TFOpt usually also write sheets
such as
ObservedandResiduals; the contract ignores them. - Column names are case-sensitive. Note
Psite(KinOpt) versusPSite(TFOpt). - TFOpt 0.2.0 adds a
Sourcecolumn toBeta Values(protein,mrnaorsite: the series a β row weighs). It is optional. The TF-level β is still the row with an emptyPSite; networkmodel counts theSourceof those rows inmetadata.jsoninputs_report.tfopt.tf_level_beta_source. - KinOpt 0.11.0 and TFOpt 0.2.0 also write
KKT,KKT MultipliersandPrediction Checksheets; they are not part of the contract. The summary sheet (Summaryin KinOpt,Optimization Resultsin TFOpt) is read for provenance only. - In the KinOpt workbook, α is the contribution of a kinase to a protein's phosphosite (it sums to 1 per site). β is the contribution of the kinase's own protein level and phosphosites to the kinase itself (it sums to 1 per kinase and is signed). TFOpt is analogous: α is a TF's contribution to a target mRNA, and β is the contribution of the TF's own level and phosphosites to the TF. networkmodel reads α and only the kinase- or TF-level β (the empty-Psite rows).
Optional Metadata sheet
A sheet named Metadata (any capitalisation) with two columns, key and value, for
example:
| key | value |
|---|---|
tool |
KinOpt |
version |
… |
git_commit |
… |
If the sheet is present, its contents are recorded in the run's provenance. Since KinOpt
has no tagged release yet, git_commit is the most useful entry.
Provenance
For every workbook it reads, PhosKinTime records in the run's metadata.json, under
external_results: the tool, the role of the file, the path as given and the resolved
path, the file's SHA-256, the sheets read, the Metadata contents (if any) and the workbook's own summary sheet
(summary_sheet: method, objective, R², …). With kinopt_alpha_source other than workbook it also records the
KinOpt run folder, the sha256 of its per-start files and the starts used (per_start). When networkmodel runs without
a KinOpt/TFOpt file, it records the file as absent with priors: none. With tf_sign_source = "network" the
CollecTRI file is recorded the same way (tool CollecTRI, path, sha256).
Per-start results (KinOpt run folder)
KinOpt's α are not uniquely determined (vertex solutions, KNOWN_ISSUES N32): different starts reach different α with
similar objectives. kinopt_alpha_source uses the per-start results of the KinOpt run folder instead of the
workbook's selected start: General/multistart_params.npz (params: one row per start, the Alpha Values rows then
the Beta Values rows, in workbook order; start_id) and General/multistart_summary.csv (start_id, fun,
accepted, rank). The folder must belong to the workbook: its rank-1 start must equal the workbook's α and β to
1e-12, else the run stops.
ensemble_mean: the mean α and β over the accepted starts with an objective withinkinopt_ensemble_tol(relative, default 0.01) of the best accepted start. Sums to 1 per site and per kinase are preserved.ensemble_member: one start (kinopt_ensemble_member).phoskintime analyze kinopt-ensemblefits every member and summarises how the fitted parameters and labels vary across them.
Where the paths are configured
All in config.toml (the repository's: configs/config.toml). Relative paths are resolved against the repository root.
| Key | Tool | Read by | Default |
|---|---|---|---|
[networkmodel] kinopt |
KinOpt | networkmodel (priors) | data/kinopt_results.xlsx |
[networkmodel] tfopt |
TFOpt | networkmodel (priors) | data/tfopt_results.xlsx |
The same paths can be given on the command line: --kinopt / --tfopt.
What happens when a file is missing:
- networkmodel: the KinOpt/TFOpt files are optional. If one is not configured or does
not exist, a WARNING is logged, all edges of that kind get alpha = 1.0, no priors are
used, and the provenance says
priors: none. A file that exists but breaks the contract is an error.
Errors
| Error | Base class | Meaning |
|---|---|---|
ExternalResultsMissing |
FileNotFoundError |
No path is configured, or the file does not exist. |
ExternalResultsError |
ValueError |
The file exists but cannot be read as an Excel workbook, or a required sheet or column is missing. The message names the file, the sheet and the missing columns. |
Both messages point back to this page.
Other places that read the workbooks
phoskintime analyze kinopt-tables <kinopt_results.xlsx> [--outdir DIR](phoskintime/common/utils/tables.py): per-site LaTeX/CSV tables fromAlpha ValuesandBeta Values.phoskintime analyze counts(phoskintime/networkmodel/analysis/analyze_tf_kin_counts.py): readsAlpha ValuesandBeta Valuesfrom both workbooks (--kinopt-xlsx,--tfopt-xlsx).phoskintime analyze similarity(phoskintime/networkmodel/analysis/curve_similarity.py): readsObservedandEstimatedfrom both workbooks (--kinopt-xlsx,--tfopt-xlsx).Observedis not part of the contract, so this analysis needs it in addition.
These analyses read the sheets directly with pandas; they do not go through the contract check.
Known limitations
How networkmodel uses the weights: vertex solutions silently delete edges (KNOWN_ISSUES N32)
KinOpt and TFOpt fit their edge weights under hard simplex constraints. Their solutions sit on vertices of the simplex: a few edges take all the weight and the rest are exactly 0, or about 1e-17. When several regulators fit about equally well, which one wins is close to arbitrary.
PhosKinTime currently uses the weights as they are:
- Weights used. The kinase→site weight in W is KinOpt α. The TF→target weight is TFOpt α × β, with β looked up under the proxy's name for orphan TFs (KNOWN_ISSUES N31).
- Zero edges are deleted in effect, silently. An edge with weight 0 stays in the network, in W and in the TF matrix, but contributes nothing, and no warning is given.
- Missing edges get full weight by default. An edge that is in the network but missing from the workbook gets
weight 1.0 (KNOWN_ISSUES N35).
missing_alpha_policy = "row_mean"gives it the mean α of its row's covered edges,"drop"removes it; the counts are inmetadata.jsoninputs_report. - Kinases and sites can be left with nothing. A kinase whose edges are all about 0 gets a c_k with no data
influence; it is fixed and labelled (KNOWN_ISSUES N24). A site whose edges are all about 0 has no kinase inflow; it
is listed in
metadata.jsonunderzero_influence.sites_without_kinase_inflow. - Negative weights are not rejected. α is read as is, and a TF weight α·β is negative wherever β < 0. Some TFOpt
β values are negative. β is a share inside TFOpt's TF activity, not the mode of regulation;
tf_sign_source = "network"takes the sign of each edge from CollecTRI (is_stimulation/is_inhibition) and the weight becomes sign·α·|β| ("none": α·|β|, every edge activating). Default"beta"(the reading above) until the v0.7.0 freeze.
Example, B4–B7 (ABL2 subnetwork):
| site | kinase | KinOpt α | other edges of the site |
|---|---|---|---|
| ABL2_S_620 | CDK1 | 2.7e-17 | CDK2 0.330, CDK5 0.670 |
| ABL2_S_936 | CDK1 | 1.0e-16 | MAPK3 0.955, MAPK8 0.045 |
| MAPK3_T_202 | MAPK3 | 0 | none in the subnetwork |
CDK1 has no effective edge, so c_k[CDK1] is fixed. MAPK3_T_202 has no kinase inflow at all: in the full KinOpt
result its weight lies on DAPK3 and the MAP2Ks, which are not in the subnetwork. On the TF side, TP53 → ABL2 has
α = 3.5e-17. Details and counts: KNOWN_ISSUES N32.
Weight smoothing (weight_smoothing_kin, weight_smoothing_tf)
Two options, each between 0 and 1, default 0 (unchanged): λ_kin for the kinase→site matrix W and λ_tf for the TF matrix. Per row (a site in W, a target gene in the TF matrix), over all edges of the row including zero-weight ones:
w′ = (1 − λ)·w + λ·(row sum / number of edges in the row)
- The row sum is preserved, so c_k, tf_scale and the bounds keep their meaning.
- In the TF matrix, smoothing applies to α × β before the row normalisation. A target whose TF weights are all zero gets uniform weights when λ_tf > 0 (a warning each).
- In W, a site whose weights are all zero also gets uniform weights when λ_kin > 0, with a warning (for example MAPK3_T_202 on the ABL2 subnetwork).
- A row with a negative weight is left unsmoothed, with a warning (
weight_smoothing_signed = "exclude", default). With"magnitude"it is smoothed on |w|: the target of an edge is sign(w)·Σ|w|/n (a zero-weight edge takes its network sign, else +); Σ|w| of the row is preserved. weight_smoothing_estimate = truefits λ_kin and λ_tf as two parameters (one per matrix): the model uses W(λ) = (1 − λ)·W + λ·W₁ with W₁ the smoothing targets, at every evaluation; the configured λ (at least 1e-3) is the start, and every row is blended, including all-zero rows (the fixed-λ rule sets those to uniform at any λ > 0).- When every edge of a target comes from the same model TF (as under the proxy on the ABL2 subnetwork), λ_tf changes nothing.
- Every run logs the number of zero-weight edges before and after, and records λ and these counts
(
metadata.jsonregulators.weight_smoothing).