Skip to content

Assign kcats from the kcat source files, as model_adapter.toml sets - #9

Merged
edkerk merged 7 commits into
developfrom
feat/kcat-assignment
Oct 17, 2026
Merged

edkerk merged 7 commits into
developfrom
feat/kcat-assignment

Conversation

@edkerk

@edkerk edkerk commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Kcats are assigned from the kcat source files in data/kcats (#3), in an order that model_adapter.toml sets. geckopy has the same functions and settings (CompMetEng/geckopy#66). This is step K2 of the plan in CompMetEng/raven-gecko-parity#134.

Builds on #3 (kcat source files); the diff shows its changes until it is merged.

Functions

Function Does
collectKcats Decides one kcat per reaction from the source files, without changing the model; writes output/<model id>_kcatDecisions.tsv (stage, source, kcat, number of values and their spread per reaction)
assignKcats collectKcats, then writes ec.kcat and ec.source and applies the kcat constraints. Replaces mergeKcats → assignKcatValues → applyCustomKcats → getKcatAcrossIsozymes → getStandardKcat → applyKcatConstraints, which stay callable
updateKcatSources Gathers the source files the configuration needs (kcatsFromBrenda, kcatsFromDLKcat, kcatsFromOKP) when they are missing, or when their header records other settings or another BRENDA release than asked; 'dryRun', true only reports
kcatAssignmentConfig The settings of [kcat_assignment] and [kcat_sources.*], with a preset expanded into its stages

Configuration

[kcat_assignment]
preset = "gecko_median"   # the default; or gecko_classic
isozymes = true           # fill from isozymes after the stages
standard = true           # standard kcat for the rest

# instead of a preset:
[[kcat_assignment.stage]]
sources = ["custom", "database_top", "dlkcat", "database_bottom"]
criteria = "max"
top_origin_limit = 4

[kcat_sources.brenda]
aggregation = "median"
  • A stage decides the reactions that are still open, by the first listed source with a value (mergeKcats). Sources are source file names and the BRENDA tiers database_exact, database_top and database_bottom, which read brenda.tsv.
  • A listed source file that does not exist is reported and left out. Without data/kcats/custom.tsv, data/customKcats.tsv is applied as before.
  • A preset together with stages, an unknown preset or an unknown stage action is an error.

Presets

Preset Order BRENDA value
gecko_median (default) custom → BRENDA without EC wildcards, origin 1–4 → DLKcat → other BRENDA matches (EC wildcards; specific activities, origin 5–6) median
gecko_classic custom → BRENDA without EC wildcards, origin 1–6 → DLKcat → other BRENDA matches maximum

The order of gecko_median comes from comparing each BRENDA tier with DLKcat on measured kcats hidden from the search: the BRENDA median was as close or closer at every origin without wildcards, and the maximum was further off than the median in every tier. Specific-activity matches could not be compared; they rank below DLKcat because a specific activity converted with a molecular weight from another organism broke kcat tuning in ecYeastGEM (geckopy#58). The figures are in CompMetEng/raven-gecko-parity#134.

Tutorial

full_ecModel uses kcatsFromBrenda, kcatsFromDLKcat and assignKcats for STEP 18–31, with preset = "gecko_classic". The ecModel is identical to the one the previous steps gave: 4834 ec.rxns, the same ec.kcat, ec.source and S.

Tests

kcatAssignmentTests (tc0079–tc0083): gecko_classic and gecko_median against the chain of functions they replace, collectKcats leaving the model unchanged, custom.tsv deciding first, stages from TOML and their errors, and updateKcatSources gathering missing and outdated files only.

Gathered kcats are written to data/kcats/<source>.tsv in the project,
keyed by conventional reaction and enzyme set rather than model.ec.rxns,
so a file stays valid when the ecModel is rebuilt and applies to full and
light models alike. geckopy reads and writes the same files.

- kcatsFromBrenda, kcatsFromDLKcat and kcatsFromOKP gather one source each,
  with that source's own options, and write its file. OKP keeps a job and
  a result per method, and only uses a stored result of the current job.
- saveKcatSource writes any kcat list; readKcatSource reads a file;
  loadKcatSource maps a file to a model and reports rows with an invalid
  kcat, rows that fit no reaction, and rows that match only part of an
  enzyme set.
- getEcRxnKeys gives the conventional reaction and enzyme set of every
  model.ec reaction.
- fetchOpenKineticsPredictor takes the file to store the result in.

Original-commit: SysBioChalmers/GECKO@f3a696c
collectKcats decides one kcat per reaction from the files in data/kcats,
in the stages of [kcat_assignment] (a preset, or [[kcat_assignment.stage]]
tables), without changing the model, and writes
output/<model id>_kcatDecisions.tsv. assignKcats applies the decisions and
the kcat constraints. updateKcatSources gathers the source files the
configuration needs that are missing, or outdated against
[kcat_sources.<name>].

The default preset, gecko_median, orders custom kcats, the BRENDA median
of matches without EC wildcards at origins 1 to 4, DLKcat, then the other
BRENDA matches. gecko_classic keeps the GECKO 3 order with the BRENDA
maximum; the full_ecModel tutorial uses it and gives the same model as
before.
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Unit test results

61 tests   61 ✅  9s ⏱️
 1 suites   0 💤
 1 files     0 ❌

Results for commit 4dc7292.

♻️ This comment has been updated with latest results.

…iles

# Conflicts:
#	test/VerificationMatrix.tsv
loadKcatSource reads the file itself and returns the header lines and the
rows as read in report.header and report.records; readKcatSource is gone.
The helpers of src/gather_kcats/private are local functions of the
functions that use them. kcatsFrom<Source> no longer check the file name
before gathering; saveKcatSource does when it writes.
…t/kcat-assignment

# Conflicts:
#	test/VerificationMatrix.tsv
Base automatically changed from feat/kcat-source-files to develop October 17, 2026 21:17
@edkerk
edkerk merged commit 07cbe0f into develop Oct 17, 2026
2 checks passed
@edkerk
edkerk deleted the feat/kcat-assignment branch October 17, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant