Skip to content

Exclude cofactors and free ubiquitin from diagram bridges (#61) - #65

Merged
adamjohnwright merged 1 commit into
mainfrom
fix/bridge-cofactor-guard
Sep 9, 2026
Merged

Exclude cofactors and free ubiquitin from diagram bridges (#61)#65
adamjohnwright merged 1 commit into
mainfrom
fix/bridge-cofactor-guard

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

Stacked on #64 (the memo fix), because bridge counts are quadratic in virtual-reaction count and that fix already removes most of them. Measuring against unfixed main would have credited this change with the memo fix's effect.

The bug

The bridge pass says "cofactor hubs already excluded by the caller". Nothing excluded them. _node_leaves does subtract _COFACTOR_STIDS | _UBIQUITIN_STIDS on the handoff path; the bridge path did not.

A bridge asserts "this producer feeds that consumer" — meaningless for a shared cofactor or free ubiquitin, since every reaction in a pathway touches ATP. Curators sometimes draw a single shared Ub glyph, and VR multiplicity turns two glyphs into hundreds of edges.

Effect

Removes exactly the 168 predicted cofactor/Ub bridges across the ten evaluation pathways, and nothing else:

pathway before after
S Phase 77 12
Mitotic G1 105 41
Cell Cycle Checkpoints 983 946
ERBB2 214 213
RAF/MAPK 732 731

(For scale, #64 alone had already taken S Phase 158 → 77 and Mitotic Prophase 3,567 → 12.)

A/B: neutral — and the apparent gain is noise

arm scored correct accuracy macro-F1
memo fix (base) 627 452 0.7209 0.664946
+ cofactor guard 627 455 0.7257 0.668600

That +3 is not this change. All 12 changed predictions are in TP53 — a pathway with zero diagram bridges in both arms, whose canonical structure is byte-identical between them. Every changed case is a non-converged solve. In the five pathways the guard actually touched, no prediction moved. Clustered by perturbation solve: p = 1.00, 0 net gains.

Methodological finding — affects every LNG A/B here

uuid4 node ids are minted fresh on each regeneration (0 of TP53's 2,307 shared between arms). Dict iteration order over those ids sets Gauss-Seidel sweep order inside an SCC, so a non-converged solve returns different values for a structurally identical network. This matches the independent finding that edge-order deviations appear only in solves reporting converged=false.

An LNG A/B must therefore restrict to converged cases or hold uuids stable. The cheap tell is a per-pathway breakdown: a gain in a pathway the change did not touch. This compounds reactome/deltasignal#14, where half the diagram-on/off "gains" also come from pairs with a non-converged arm.

Why land it

Prediction-neutral, mirrors a guard the codebase already applies elsewhere, and removes 168 edges asserting causal coupling Reactome does not curate — concentrated in two evaluation pathways (S Phase was 84% cofactor bridges, Mitotic G1 61%). The case is correctness, not accuracy.

Recorded as specs/003-bridge-cofactor-guard. Closes #61.

🤖 Generated with Claude Code

The bridge pass carries the comment "cofactor hubs already excluded by the
caller". Nothing excluded them. `_node_leaves` does subtract
_COFACTOR_STIDS | _UBIQUITIN_STIDS on the handoff path; the bridge path did not.

A bridge asserts "this producer feeds that consumer", which is meaningless for
a shared cofactor or free ubiquitin — every reaction in a pathway touches ATP,
so bridging on one couples reactions with no causal relationship. Curators
sometimes draw a single shared Ub glyph, and virtual-reaction multiplicity
turns two glyphs into hundreds of edges.

Measured on top of the memo fix (#58), because bridge counts are quadratic in
VR count and that fix already removes most of them; measuring against unfixed
main would have credited this change with the memo fix's effect.

Removes exactly the 168 predicted cofactor/ubiquitin bridges across the ten
evaluation pathways and nothing else. S Phase 77 -> 12, Mitotic G1 105 -> 41.

DeltaSignal A/B: NEUTRAL. The summary shows 452 -> 455 correct, but that is
NOT this change. All 12 changed predictions are in TP53 — a pathway with zero
diagram bridges in both arms, whose canonical structure is byte-identical
between them — and every one is a non-converged solve. In the five pathways
the guard actually touched, no prediction moved. Clustered by perturbation
solve the McNemar is p = 1.00 with 0 net gains.

Worth recording, because it affects every LNG A/B here: uuid4 node ids are
minted fresh on each regeneration (0 of TP53's 2,307 shared between arms), and
Dict iteration order over those ids sets Gauss-Seidel sweep order inside an
SCC, so a non-converged solve returns different values for a structurally
identical network. That can manufacture a flattering delta. A per-pathway
breakdown is the cheap tell: a gain in a pathway the change did not touch.

Landing it as a correctness fix. It is prediction-neutral, mirrors a guard the
codebase already applies elsewhere, and removes edges asserting causal coupling
Reactome does not curate — concentrated in two evaluation pathways (S Phase was
84% cofactor bridges, Mitotic G1 61%).

Recorded as specs/003-bridge-cofactor-guard. Closes #61.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Base automatically changed from fix/break-apart-memo to main September 9, 2026 19:22
@adamjohnwright
adamjohnwright merged commit 338f38d into main Sep 9, 2026
1 check passed
@adamjohnwright
adamjohnwright deleted the fix/bridge-cofactor-guard branch September 9, 2026 19:24
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.

diagram_bridge has no cofactor guard despite the comment claiming one; 134 of 158 S Phase bridges are ubiquitin

1 participant