|
12 | 12 | ftINIT. Two steps are needed and are applied here directly to the classic path: |
13 | 13 | orient each task-essential reaction irreversibly in its required direction, and |
14 | 14 | 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. |
17 | 19 |
|
18 | 20 | Gene identifiers |
19 | 21 | ---------------- |
|
36 | 38 | import pandas as pd |
37 | 39 | from cobra.flux_analysis import find_blocked_reactions |
38 | 40 |
|
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 | +) |
40 | 46 | from raven_toolbox.init.prep import rescale_for_init |
41 | 47 | from raven_toolbox.tasks.check import find_task_essential_reactions |
42 | 48 | from raven_toolbox.tasks.tasklist import parse_task_list |
@@ -216,4 +222,9 @@ def _build_context_model( |
216 | 222 | kept = {r.id for r in result.model.reactions} |
217 | 223 | context = reference.copy() |
218 | 224 | 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") |
219 | 230 | return context |
0 commit comments