Skip to content

Add ModelSEED-retrained dGPredictor as an additive reaction-energy source - #264

Merged
samseaver merged 1 commit into
ModelSEED:devfrom
freiburgermsu:dgpredictor-modelseed-retrained-energies
Aug 4, 2026
Merged

Add ModelSEED-retrained dGPredictor as an additive reaction-energy source#264
samseaver merged 1 commit into
ModelSEED:devfrom
freiburgermsu:dgpredictor-modelseed-retrained-energies

Conversation

@freiburgermsu

Copy link
Copy Markdown
Member

Summary

Adds the ModelSEED-retrained dGPredictor as its own additive per-method reaction-energy source, dGPredictor-ModelSEED, alongside the existing Group contribution / eQuilibrator / dGPredictor records. Purely additive — the original KEGG-based dGPredictor record is left untouched, there are no canonical deltag/deltagerr/reversibility changes, and no .tsv or compound-file changes (thermodynamics is a JSON-only field). This continues the additive per-source philosophy of #263.

What this is

dGPredictor (Wang et al. 2021) as shipped under Biochemistry/Thermodynamics/dGPredictor/ was trained on KEGG compound structures. dGPredictor-ModelSEED is the same model retrained on the ModelSEED compound structures: every ModelSEED compound carrying a complete structure is re-decomposed into atom-centered fragments (radius 1 & 2), expanding the group vocabulary, and the BayesianRidge model is refit on the same 4,001 experimental measurements remapped into ModelSEED ID space. It predicts dG for 31,924 reactions (pH 7, I 0.25 M, 298.15 K), including ~11,400 reactions the original KEGG-based model could not reach (compounds with no KEGG cross-reference).

Each reaction now carries both dGPredictor estimates side-by-side, e.g. rxn00001:

"thermodynamics": {
    "Group contribution":    [4.15, 1.22, "="],
    "eQuilibrator":          [-3.46, 0.05, ">"],
    "dGPredictor":           [-3.82, 0.02, ">"],
    "dGPredictor-ModelSEED": [-3.77, 0.87, ">"]
}

New-coverage reactions (e.g. rxn00013) carry a dGPredictor-ModelSEED record where there is no original dGPredictor one — and their canonical deltag is still left untouched.

How

  • New staged predictions: Biochemistry/Thermodynamics/dGPredictor/modelseed_retrained_dG.json{rxn: {dG_mean, dG_uncer}} in kJ/mol, 31,924 reactions.
  • New writer: Scripts/Thermodynamics/Update_Reaction_dGPredictor_ModelSEED_Energies.py — stores dGPredictor-ModelSEED [energy, error, operator] (kJ→kcal /4.184); the operator is this estimate's own thermodynamic direction via the shared reversibility_from_energy(). Added to Rerun_Thermodynamics.sh.
  • All predictions are recorded as-is; the heavy-tailed extrapolations (macromolecule biosynthesis) carry correspondingly large error bars and never affect the canonical served value.

Data changed

  • 31,924 reactions gained a dGPredictor-ModelSEED record; 24,088 reactions unchanged.
  • Verified: every modified reaction differs from dev only by the added dGPredictor-ModelSEED key (deep per-reaction JSON equality across all 56,012 reactions; 0 other-field changes), every added value equals dG_mean/4.184, and re-running the writer is idempotent (byte-identical output). Zero changes to canonical deltag/deltagerr/reversibility/notes, the original dGPredictor record, any other field, or any .tsv.

Docs updated in Scripts/Thermodynamics/README.md and Biochemistry/Structures/sources.yaml.

🤖 Generated with Claude Code

…urce

Records the dGPredictor group-contribution model retrained on the ModelSEED
compound structures as its own per-method entry, "dGPredictor-ModelSEED", in
each reaction's `thermodynamics` dict. Purely additive: it sits next to the
Group contribution / eQuilibrator / (original KEGG-based) dGPredictor records,
and the original "dGPredictor" entry is left untouched. The canonical
deltag / deltagerr / reversibility are not changed, and no .tsv or compound
files change.

- New staged predictions: Biochemistry/Thermodynamics/dGPredictor/
  modelseed_retrained_dG.json (31,924 reactions, kJ/mol).
- New writer: Scripts/Thermodynamics/Update_Reaction_dGPredictor_ModelSEED_
  Energies.py (kJ->kcal /4.184; operator via reversibility_from_energy).
- 31,924 reactions gain a dGPredictor-ModelSEED record (incl. ~11,400 the
  original KEGG-based dGPredictor could not reach); 24,088 reactions unchanged.
- Verified: every modified reaction differs from dev ONLY by the added
  dGPredictor-ModelSEED key; added values equal dG_mean/4.184; the writer is
  idempotent.
- Docs: sources.yaml, Scripts/Thermodynamics/README.md, Rerun_Thermodynamics.sh.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@samseaver
samseaver merged commit 4e14e90 into ModelSEED:dev Aug 4, 2026
samseaver pushed a commit that referenced this pull request Aug 4, 2026
From freiburgermsu:promote-thermodynamics-to-canonical-deltag

Two commits:
1. dGPredictor-ModelSEED additive source (already landed via #264;
   this branch was stacked on it).
2. Promotion: new
   Scripts/Thermodynamics/Promote_Reaction_Thermodynamics_to_Canonical.py
   re-aggregates the stored per-source estimates into the canonical
   top-level deltag/deltagerr/reversibility fields for 14,141
   reactions that were missing them (Group contribution 1,474;
   dGPredictor 8,635; dGPredictor-ModelSEED 4,032).

Selection policy: prefer mechanistic tier (eQuilibrator, GC) over
ML tier (dGPredictor-ModelSEED, dGPredictor); within tier, lowest
uncertainty. Guards reject implausible magnitudes (|dG| > 1000) and
useless uncertainties (> 100 kcal/mol). Never overwrites existing
canonical values.

Notes ~732 reactions have >50 kcal/mol cross-source disagreement
worth curator spot-check.

Directly relevant to Papers/NAR_Update_2026 §6 (multi-source
thermodynamics) -- the 'combined direction ledger' concept in the
Methods draft IS this promotion pipeline.

Conflict resolution: 34 reaction .tsv files conflicted between
dev's regeneration and freiburgermsu's regeneration. Resolved by
taking dev's side then regenerating all TSVs from the merged JSONs
via Reprint_Biochemistry.py in the next commit.

Co-Authored-By: Andrew Freiburger <freiburgermsu@gmail.com>
samseaver pushed a commit that referenced this pull request Aug 4, 2026
Fixes eQuilibrator retrieval scripts for equilibrator_api 0.6.x
(API drift; module-level ccache singleton removed, ComponentContribution
no longer takes reaction conditions as constructor kwargs).

Re-runs the pipeline against updated ModelSEED structures. Coverage
expansion in the pre-computed source tables:

- MetaNetX_Compound_Energies.tbl: 20,828 -> 31,219 rows
  (+10,391 compounds)
- MetaNetX_Reaction_Energies.tbl:  22,441 -> 27,022 rows
  (+4,581 reactions)
- 16,412 reactions re-tagged EQP -> EQC / EQC -> EQP in notes to
  reflect the new per-reagent coverage.

Andrew's commit explicitly notes: only the eQuilibrator energy
tables and reaction notes change here; canonical
deltag/deltagerr/reversibility and the additive thermodynamics
dicts are untouched. Propagation into served compound_*.json and
reaction_*.json records is a separate step, run in follow-up
commits.

Directly fills the compound-level coverage gap identified during
audit of the post-#264/#265 dev state (30,479 non-R structured
compounds, only 22,616 with any deltag before this branch).

Conflict resolution: 61 reaction .tsv files conflicted between
dev's TSVs and freiburgermsu's TSVs. Resolved by taking dev's side
then regenerating all TSVs from the merged JSONs via
Reprint_Biochemistry.py in the next commit.

Co-Authored-By: Andrew Freiburger <freiburgermsu@aol.com>

# Conflicts:
#	Biochemistry/reaction_00.tsv
#	Biochemistry/reaction_01.tsv
#	Biochemistry/reaction_02.tsv
#	Biochemistry/reaction_03.tsv
#	Biochemistry/reaction_04.tsv
#	Biochemistry/reaction_05.tsv
#	Biochemistry/reaction_06.tsv
#	Biochemistry/reaction_07.tsv
#	Biochemistry/reaction_08.tsv
#	Biochemistry/reaction_09.tsv
#	Biochemistry/reaction_10.tsv
#	Biochemistry/reaction_11.tsv
#	Biochemistry/reaction_12.tsv
#	Biochemistry/reaction_13.tsv
#	Biochemistry/reaction_14.tsv
#	Biochemistry/reaction_15.tsv
#	Biochemistry/reaction_16.tsv
#	Biochemistry/reaction_17.tsv
#	Biochemistry/reaction_18.tsv
#	Biochemistry/reaction_19.tsv
#	Biochemistry/reaction_20.tsv
#	Biochemistry/reaction_21.tsv
#	Biochemistry/reaction_22.tsv
#	Biochemistry/reaction_23.tsv
#	Biochemistry/reaction_24.tsv
#	Biochemistry/reaction_25.tsv
#	Biochemistry/reaction_26.tsv
#	Biochemistry/reaction_27.tsv
#	Biochemistry/reaction_28.tsv
#	Biochemistry/reaction_29.tsv
#	Biochemistry/reaction_30.tsv
#	Biochemistry/reaction_31.tsv
#	Biochemistry/reaction_32.tsv
#	Biochemistry/reaction_33.tsv
#	Biochemistry/reaction_34.tsv
#	Biochemistry/reaction_35.tsv
#	Biochemistry/reaction_36.tsv
#	Biochemistry/reaction_37.tsv
#	Biochemistry/reaction_38.tsv
#	Biochemistry/reaction_39.tsv
#	Biochemistry/reaction_40.tsv
#	Biochemistry/reaction_41.tsv
#	Biochemistry/reaction_42.tsv
#	Biochemistry/reaction_43.tsv
#	Biochemistry/reaction_44.tsv
#	Biochemistry/reaction_45.tsv
#	Biochemistry/reaction_46.tsv
#	Biochemistry/reaction_47.tsv
#	Biochemistry/reaction_48.tsv
#	Biochemistry/reaction_49.tsv
#	Biochemistry/reaction_50.tsv
#	Biochemistry/reaction_51.tsv
#	Biochemistry/reaction_52.tsv
#	Biochemistry/reaction_53.tsv
#	Biochemistry/reaction_54.tsv
#	Biochemistry/reaction_55.tsv
#	Biochemistry/reaction_56.tsv
#	Biochemistry/reaction_57.tsv
#	Biochemistry/reaction_58.tsv
#	Biochemistry/reaction_59.tsv
#	Biochemistry/reaction_60.tsv
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.

2 participants