From 1ab9ddd2ea9a1af39e0a7443450daca0790020f3 Mon Sep 17 00:00:00 2001 From: Eduard Kerkhoven Date: Fri, 25 Sep 2026 20:59:03 +0200 Subject: [PATCH 1/2] docs(init): pass Human-GEM's spontaneous reactions in the Python example and explain why --- docs/guide/init.md | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/docs/guide/init.md b/docs/guide/init.md index 760640e..9bfa6d1 100644 --- a/docs/guide/init.md +++ b/docs/guide/init.md @@ -133,9 +133,10 @@ prepData.mat: 159 MB ``` Human-GEM also has a wrapper, `prepHumanModelForftINIT`, which reads those -two files for you. It does **not** run against RAVEN `develop3`: its -`importTsvFile` returns the `spontaneous` column as text, so the `== 1` -inside it throws. Calling `prepINITModel` directly, as above, sidesteps that. +two files for you. Before Human-GEM 2.0.1 it did not run against RAVEN +`develop3`: `importTsvFile` returned the `spontaneous` column as text, so the +`== 1` inside it threw. From 2.0.1 on it converts the column first; with an +older Human-GEM, call `prepINITModel` directly, as above. ::: :::{tab-item} 🐍 Python :sync: python @@ -144,6 +145,7 @@ inside it throws. Calling `prepINITModel` directly, as above, sidesteps that. ```python import cobra +import pandas as pd from cobra.io import read_sbml_model from raven_toolbox.init import prep_init_model @@ -155,7 +157,11 @@ model = read_sbml_model("Human-GEM/model/Human-GEM.xml") model.solver = "gurobi" tasks = parse_task_list("Human-GEM/data/metabolicTasks/metabolicTasks_Essential.txt") -prep = prep_init_model(model, tasks, ext_comp="e") +# spontaneous reactions are flagged in the model's own annotation table +tsv = pd.read_csv("Human-GEM/model/reactions.tsv", sep="\t") +spont = tsv.loc[tsv["spontaneous"] == 1, "rxns"].tolist() + +prep = prep_init_model(model, tasks, ext_comp="e", spontaneous=spont) ``` ```text @@ -176,6 +182,20 @@ same machine and solver. Two things affect the run: ::: :::: +:::{note} Pass the spontaneous reactions +ftINIT keeps every reaction passed as +spontaneous in every extracted model, whatever the data say. Other reactions +without a gene rule are kept only where the optimisation needs them, so they can +differ from sample to sample. In Human-GEM, `spontaneous` marks reactions that need +no enzyme. That includes diffusion: transport between cytosol and nucleus through +the nuclear pores, and gases and water (O2, CO2, H2O, NH3, H2O2, NO, H2S) crossing +membranes. Leaving out the list, or using a Human-GEM older than the release that +added these flags, lets ftINIT drop such transports in some samples. The model then +falls back on other routes. For example, without the dCTP transport into the nucleus, +deoxycytidine kinase (DCK) becomes essential for DNA synthesis, which is an artefact +of the extraction rather than biology. +::: + ## 14.2 Bring in the expression data RAVEN wants one struct: the genes, the sample names, and a genes × samples matrix From 81d6fb2fc3740dc2dd19e5bb6d7ff33e346404f6 Mon Sep 17 00:00:00 2001 From: Eduard Kerkhoven Date: Sat, 17 Oct 2026 22:27:02 +0200 Subject: [PATCH 2/2] docs(init): describe the current Human-GEM and RAVEN requirements only --- docs/guide/init.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/docs/guide/init.md b/docs/guide/init.md index 9bfa6d1..006c658 100644 --- a/docs/guide/init.md +++ b/docs/guide/init.md @@ -57,7 +57,7 @@ Every other page in this guide is re-executed on every commit. This one is not: preparing Human-GEM took **113 minutes** in MATLAB and **126 minutes** in Python, the MATLAB run producing a **159 MB** artefact, which no documentation build should attempt. The numbers below come -from one real run (Human-GEM `main`, RAVEN `develop3`, Gurobi 13.0.2) and +from one real run (Human-GEM `main`, RAVEN 3, Gurobi 13.0.2) and are quoted with their wall-clock so you can plan around them. For the same MATLAB workflow as the model's own documentation presents it, @@ -133,10 +133,7 @@ prepData.mat: 159 MB ``` Human-GEM also has a wrapper, `prepHumanModelForftINIT`, which reads those -two files for you. Before Human-GEM 2.0.1 it did not run against RAVEN -`develop3`: `importTsvFile` returned the `spontaneous` column as text, so the -`== 1` inside it threw. From 2.0.1 on it converts the column first; with an -older Human-GEM, call `prepINITModel` directly, as above. +two files for you; it needs Human-GEM 2.0.1 or later. ::: :::{tab-item} 🐍 Python :sync: python @@ -189,8 +186,8 @@ without a gene rule are kept only where the optimisation needs them, so they can differ from sample to sample. In Human-GEM, `spontaneous` marks reactions that need no enzyme. That includes diffusion: transport between cytosol and nucleus through the nuclear pores, and gases and water (O2, CO2, H2O, NH3, H2O2, NO, H2S) crossing -membranes. Leaving out the list, or using a Human-GEM older than the release that -added these flags, lets ftINIT drop such transports in some samples. The model then +membranes. Leaving out the list lets ftINIT drop such transports in some +samples. The model then falls back on other routes. For example, without the dCTP transport into the nucleus, deoxycytidine kinase (DCK) becomes essential for DNA synthesis, which is an artefact of the extraction rather than biology.