Predictive thermodynamics: pluggable dG'/dGf backends (equilibrator, dGPredictor, ModelSEED-DB)#45
Closed
VibhavSetlur wants to merge 1 commit into
Conversation
Add a PredictiveThermoUtils facade that estimates standard transformed Gibbs energies of formation (compounds) and reaction (delta_r G'^0) by dispatching across a priority-ordered set of pluggable backends, each of which degrades gracefully and never fabricates a value (unknown -> None plus a warning). Backends (src/kbutillib/thermo_predictors/): - equilibrator: live component-contribution via equilibrator-api (optional dep). Condition-aware (pH, ionic strength, T, p_Mg). - dgpredictor: Maranas/Tyo-lab group-contribution reaction predictor (Andrew Freiburger's fork). Runs out-of-process against a local clone to keep rdkit/openbabel and the ~150 MB model out of this process; KEGG stoichiometry in, kJ/mol transformed dG' out. Detects a missing/LFS-pointer model and reports unavailable. - modelseed_db: baked transformed dG from the expanded-eQuilibrator ModelSEED Database fork, read directly from compounds.tsv/reactions.tsv with the stdlib csv reader (kcal->kJ, fixed pH7/I0.25/298.15 K, EQU/EQC/EQP-preferred provenance gate). - modelseed: always-on fallback over the existing ThermoUtils lookups. - molgpk: stub for the Tyo-lab molGPK/OPAM2 predictor (unreleased); reports unavailable until configured. Dispatch order: equilibrator -> dgpredictor -> modelseed_db -> modelseed. Nothing in the subpackage imports a heavy/optional dependency at import time. Exposed as the lazy `predictive_thermo` property on KBUtilLib. Adds [project.optional-dependencies] equilibrator / thermo extras and a dependency-free test suite (tests/test_predictive_thermo.py) covering graceful degradation, the no-fabrication invariant, dispatch fall-through, and the kcal->kJ conversion against worked ATP / rxn00001 values.
Author
|
Closing for now — keeping this branch open as a draft of work-in-progress rather than a review-ready PR. The predictive-thermodynamics layer is complete, but I'm holding the PR until the full thermo + cheminformatics scope is finished so it lands as one coherent, reviewable unit. The feature branch (VibhavSetlur:feature/thermo-cheminformatics-foundation) stays pushed; I'll reopen / re-file once everything is done. |
cshenry
pushed a commit
that referenced
this pull request
Jul 6, 2026
- Move kbu-literature-review/review/diagnose to .claude/agents/ as kbu-sub-* with type: agent frontmatter (AC #44, #45, #47) - Add data/, models/, genomes/ .gitkeep to template (AC #42) - Append [layout] shared_dirs block to kbu-project.toml.template (AC #43) - Add 9 root_gitignore_lines patterns to .gitignore template - Update bootstrap.py: _CLAUDE_AGENT_FILES list, agents dir creation loop, shared-dir .gitkeep scaffolding, [layout] in manifest, kbu-migrate.md in command list (skips silently when template absent - Option 1) - Update new_project.py: _TRACKED_DIRS includes .claude/agents, [layout] in manifest - Update tests: AC9 entry counts, _make_stub_template includes agents, new AC 42-47 tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
PredictiveThermoUtilsfacade that estimates standard transformed Gibbs energies of formation (compounds) and reaction (Δ_r G'°) by dispatching across a priority-ordered set of pluggable backends. Every backend degrades gracefully and never fabricates a value — unknown inputs returnNoneplus a warning, so callers always know provenance.Exposed as the lazy
predictive_thermoproperty onKBUtilLib.Backends (
src/kbutillib/thermo_predictors/)equilibratorequilibrator-api, optional dep)dgpredictormodelseed_dbcompounds.tsv/reactions.tsvdirectly with the stdlib csv reader; kcal→kJ; fixed pH 7 / I 0.25 M / 298.15 K; EQU/EQC/EQP provenance gatemodelseedThermoUtilsModelSEED lookupsmolgpkDispatch order:
equilibrator → dgpredictor → modelseed_db → modelseed.Design invariants
None+ warning, never a stand-in value.thermo.dgpredictor.repo_path/DGPREDICTOR_REPO(andthermo.dgpredictor.python);modelseed_dbviathermo.modelseed_db.biochem_root/MODELSEED_DATABASE_BIOCHEM_ROOT.Packaging & tests
[project.optional-dependencies]equilibrator/thermoextras (core install unchanged).tests/test_predictive_thermo.py(22 passing, 1 skipped): graceful degradation, the no-fabrication invariant, dispatch fall-through, backend-status reporting, and kcal→kJ conversion against worked ATP / rxn00001 values.Live validation (local)
ruffclean on all touched files.