Skip to content

Commit 7b06a96

Browse files
committed
Prune redundant low-score genes in the classic tINIT path
Classic get_init_model kept every isozyme gene of each retained reaction, unlike MATLAB getINITModel2 (called with removeGenes=true), so context models carried unexpressed alternatives that masked genes essential for the expressed isozyme and depressed the essentiality metrics. Apply remove_low_score_genes to each context model with the tissue gene scores, keeping the highest-scoring isozyme per OR rule.
1 parent 48eb94d commit 7b06a96

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

code/test/estimateEssentialGenes.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
ftINIT. Two steps are needed and are applied here directly to the classic path:
1313
orient each task-essential reaction irreversibly in its required direction, and
1414
rescale the stoichiometry (rescale_for_init) so a single fixed big-M (100) is
15-
valid across all reactions. Classic tINIT keeps fewer reactions than ftINIT, so
16-
its models are sparser and give a stronger gene-essentiality signal.
15+
valid across all reactions. After the MILP, redundant low-expression isozyme
16+
genes are pruned with remove_low_score_genes, matching getINITModel2's
17+
removeGenes=true step, so unexpressed alternatives in an OR rule do not mask the
18+
genes that are actually essential for the expressed isozyme.
1719
1820
Gene identifiers
1921
----------------
@@ -36,7 +38,11 @@
3638
import pandas as pd
3739
from cobra.flux_analysis import find_blocked_reactions
3840

39-
from raven_toolbox.init import gene_scores_from_expression, get_init_model
41+
from raven_toolbox.init import (
42+
gene_scores_from_expression,
43+
get_init_model,
44+
remove_low_score_genes,
45+
)
4046
from raven_toolbox.init.prep import rescale_for_init
4147
from raven_toolbox.tasks.check import find_task_essential_reactions
4248
from raven_toolbox.tasks.tasklist import parse_task_list
@@ -216,4 +222,9 @@ def _build_context_model(
216222
kept = {r.id for r in result.model.reactions}
217223
context = reference.copy()
218224
context.remove_reactions([r for r in context.reactions if r.id not in kept], remove_orphans=True)
225+
# Prune redundant low-expression isozyme genes, as MATLAB getINITModel2 does with
226+
# removeGenes=true: keep the highest-scoring isozyme in each OR rule so unexpressed
227+
# alternatives do not mask genes that are essential for the expressed isozyme.
228+
context, removed = remove_low_score_genes(context, gene_scores)
229+
_log(f" pruned {len(removed)} redundant low-score genes")
219230
return context

0 commit comments

Comments
 (0)