From 7792f2438becef8faff222c5f201a9a6d8b34ddb Mon Sep 17 00:00:00 2001 From: Adam Wright Date: Wed, 16 Sep 2026 22:15:21 -0400 Subject: [PATCH] Stop our own depletion edges from deleting curator assembly edges Isolated from the compartment change so the two can be measured apart. They differ in kind: this restores CURATOR-derived complex composition that our own inference was deleting, while the compartment change extends that inference into more compartments. Root detection ran over the edge list after depletion edges were appended and counted them. A root is "produced by no reaction in this pathway" -- the code's own words -- and a depletion edge is not production, it is catalyst -> consumed input, invented by us. Counting it makes a boundary complex look produced, so it silently loses its subunit decomposition and knockouts of its subunits stop reaching it. Live on main today wherever a cytosolic depletion edge lands on a boundary complex. Co-Authored-By: Claude Opus 5 (1M context) --- src/logic_network_generator.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/logic_network_generator.py b/src/logic_network_generator.py index aae1238..7190865 100755 --- a/src/logic_network_generator.py +++ b/src/logic_network_generator.py @@ -1512,10 +1512,28 @@ def _emit_boundary_decomposition_edges( """ from src.neo4j_connector import get_labels - # Positional roots / terminals from the current edge list. + # Positional roots / terminals from the current edge list, IGNORING + # depletion edges. + # + # A root is "produced by no reaction in this pathway", which is what makes + # it a boundary complex worth decomposing into subunits. A depletion edge is + # not production: it is our own modelling inference, catalyst -> consumed + # input, emitted earlier in this same function. Counting it as an incoming + # edge makes a boundary complex look produced, so it silently loses its + # assembly decomposition and a knockout of one of its subunits stops + # reaching it. + # + # Found by extending phosphatase detection to non-cytosolic compartments: + # three MAPK dimers in R-HSA-450294 (p-MAPK1/3/7 -> dimer) lost their + # assembly edges purely because a new depletion edge landed on them. The + # same thing already happens wherever a cytosolic depletion edge lands on a + # boundary complex, so this is a pre-existing bug, not one the compartment + # change introduced. sources: Set[str] = set() targets: Set[str] = set() for edge in pathway_logic_network_data: + if edge.get("edge_type") == "depletion": + continue sources.add(edge["source_id"]) targets.add(edge["target_id"]) root_uuids = sources - targets # produced by no reaction in this pathway