Skip to content

Find phosphatases in every compartment, not just the cytosol - #81

Closed
adamjohnwright wants to merge 1 commit into
mainfrom
fix/depletion-all-compartments
Closed

adamjohnwright wants to merge 1 commit into
mainfrom
fix/depletion-all-compartments

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

The bug

The depletion rule's stated criterion is "the reaction's OUTPUTS include Pi".
It tested one hard-coded stable id:

PI_STID = "R-ALL-29372"   # inorganic phosphate

That is Pi [cytosol] specifically. A phosphatase acting in the nucleoplasm
or the mitochondrial matrix produces a different Pi species and was invisible to
a rule written to include it.

Release-wide, catalysed reactions the criterion intends to match and misses:

reactions
Pi [nucleoplasm] 475
Pi [mitochondrial matrix] 343
Pi [extracellular region] 186
smaller compartments ~143

Inside the 92-pathway benchmark catalog it is 28 reactions against the 66
already caught
— a 42% increase in scope. The new ones are nucleoplasmic,
which is where transcriptional regulation happens, and DOWN (our weakest class
against curators, F1 0.737) is weakest there.

The fix

Derive the Pi species by ChEBI from the release, reusing the contract
get_cofactor_species() already states for exactly this reason:

Derived rather than hand-maintained so a new compartment appears by itself and
a renamed or retired stable id disappears by itself.

"Pi": ["43474"] is already in that ChEBI table, so this adds no new list to
maintain. 12 species at Release97, the old id among them.

Only success is cached — a transient Neo4j failure must not pin the
one-compartment seed for the rest of the process and silently generate every
later pathway with the narrow rule. That exact failure mode has been found in
this file before.

Not yet measured

This changes generated networks. It needs a catalog regeneration and a paired
A/B on the wide curator set before the result is claimed either way. Filing it
now so the reasoning and the scope are on record; the measurement follows.

The related, larger question — kinases consume their substrates just as
completely and get no depletion edges at all — is deliberately not in this
PR. That is 2,267 catalysed reactions in nucleoplasm alone against the current
rule's 3,446, and blanket consumption has already regressed twice
(−14pp; macro-F1 0.663 → 0.529). Separate change, separate A/B.

🤖 Generated with Claude Code

The depletion rule's criterion is "the reaction's OUTPUTS include Pi",
and it tested one hard-coded stable id: R-ALL-29372, which is
Pi [cytosol] alone. A phosphatase acting in the nucleoplasm or the
mitochondrial matrix produces a different Pi species and was invisible to
a rule written to include it.

Release-wide that is ~1,150 catalysed reactions the criterion intends to
match and does not: Pi [nucleoplasm] 475, Pi [mitochondrial matrix] 343,
Pi [extracellular region] 186, plus smaller compartments. Inside the
92-pathway benchmark catalog it is 28 reactions against the 66 already
caught, a 42% increase in scope -- and the new ones are nucleoplasmic,
which is where transcriptional regulation happens and where DOWN, our
weakest class, is weakest.

Derived by ChEBI from the release rather than hard-coded, reusing the
contract get_cofactor_species() already states for exactly this reason:
"so a new compartment appears by itself and a renamed or retired stable
id disappears by itself". Pi is already in that ChEBI table, so this adds
no new list to maintain. 12 species at Release97, the old id among them.

Only success is cached: a transient Neo4j failure must not pin the
one-compartment seed for the rest of the process and silently generate
every later pathway with the narrow rule. That failure mode has bitten
this file before.

NOT YET MEASURED. This changes generated networks, so it needs a catalog
regeneration and a paired A/B on the wide curator set before the result
can be claimed either way.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@adamjohnwright

Copy link
Copy Markdown
Contributor Author

Closing — superseded by the held-out re-read, and this branch carries the wrong combination.

This branch has both commits (compartment detection + root detection). On the paper's tuning/held-out split:

arm all pathways tuning ten held-out (70)
compartment fix alone −9 −7 −2
root-detection fix alone −54 −55 +2
both, i.e. this branch −26 −19 −6

The two are worse together than either alone, and that interaction is unexplained. The root-detection fix is the one worth landing — it is neutral-to-positive on held-out and stops our own inference edges deleting curator-derived complex composition, which is happening on main today. It gets its own PR.

The compartment fix stays unmerged: it matches its own stated criterion ("outputs include Pi", where the code tested cytosolic Pi alone), but it buys nothing measurable and combining it with the root fix costs. Recorded in docs/RESULTS.md in deltasignal rather than retried.

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.

1 participant