Skip to content

Record which diagram glyph each node came from - #77

Merged
adamjohnwright merged 1 commit into
mainfrom
feature/glyph-identity
Sep 14, 2026
Merged

adamjohnwright merged 1 commit into
mainfrom
feature/glyph-identity

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

Answers the pathway-browser half of specs/005-node-identity-mapping.

"two nodes in the reactome pathway diagram that are in the same compartment
could be the same thing but in two different places. We need to be able to
know which one the uuid was from."

The identity was already being read, then thrown away

diagram_connectivity.py collects x["id"] from each input/output/catalyst
entry — the DiagramObject id, which is what the pathway browser selects and
highlights — uses it to pair producers with consumers, and discards it.
diagram_glyph_positions() exposes it, and node_resolution.csv's
glyph_id / diagram_stid columns are now populated.

(reaction, entity, role) is a unique key

0 of 156 triples in R-HSA-1257604 and 0 of 245 in R-HSA-69620 resolve
to more than one glyph, while four entities in each are drawn up to 19
times. An entity drawn many times is drawn once per reaction, so naming the
reaction and the role disambiguates it exactly. No new identifier scheme, no
heuristic.

Coverage

1,432 of 1,644 diagram triples — 87.1%, against the ~89% predicted before
implementation. Both directions work: a glyph resolves to its nodes, and a
node resolves back to the glyphs to highlight.

Two findings from measuring it

WNT and TP53 score zero, structurally. Their diagrams are overviews with
4 and 5 nodes and no edges — boxes pointing at sub-pathways, not
reaction-level drawings — so no glyph exists to attribute at that level.
Sub-pathway diagrams would be needed; separate work, recorded rather than
papered over.

For cofactors the answer is "they are the same node, deliberately." ATP's
19 glyphs in Cell Cycle Checkpoints resolve to one uuid, because the
generator collapses cofactor occurrences through the boundary cache. Clicking
any of the 19 correctly lands on the same node, and the reverse direction
returns all 19 to highlight. Ubiquitin is the opposite: 3 glyphs to 15
uuids
from positional decomposition. Neither was visible before.

Invariant

A test pins that glyph_id and diagram_stid are written together or not at
all — a glyph id is unique only within its diagram, so one without the
other cannot be resolved back to anything.

mypy clean on 12 files, ruff clean on changed files, 189 tests at 49.66%
coverage.

🤖 Generated with Claude Code

Adam: "two nodes in the reactome pathway diagram that are in the same
compartment could be the same thing but in two different places. We need to
be able to know which one the uuid was from. this is especially important
when interacting with deltasignal through the pathwaydiagram."

That identity exists and this module already read it — x["id"] on each
input/output/catalyst entry is the DiagramObject id, the one the pathway
browser selects and highlights — and then discarded it after pairing
producers with consumers. diagram_glyph_positions() exposes it instead, and
node_resolution.csv's glyph_id/diagram_stid columns are now populated.

(reaction_stId, entity_stId, role) is a UNIQUE key for a glyph, which is what
makes the question answerable: 0 of 156 triples in R-HSA-1257604 and 0 of 245
in R-HSA-69620 resolve to more than one glyph, while four entities in each are
drawn up to 19 times. An entity drawn many times is drawn once per reaction,
so naming the reaction and the role disambiguates it exactly.

Join coverage over the ten-pathway catalog: 1,432 of 1,644 diagram triples,
87.1%, against the ~89% the research predicted. Both directions work — a
glyph resolves to its nodes, and a node resolves back to the glyphs to
highlight.

Two honest findings from the measurement:

Signaling_by_WNT and Transcriptional_Regulation_by_TP53 score ZERO, and that
is structural rather than a defect: their diagrams are overviews with 4 and 5
nodes and NO edges — boxes pointing at sub-pathways, not reaction-level
drawings — so no glyph exists to attribute at that level. Sub-pathway
diagrams would be needed, which is a separate piece of work.

The answer for cofactors is "they are the same node, deliberately". ATP's 19
glyphs in Cell Cycle Checkpoints resolve to ONE uuid, because the generator
collapses cofactor occurrences via the boundary cache. Clicking any of them
correctly lands on the same node, and the reverse direction returns all 19 to
highlight. Ubiquitin is the opposite case: 3 glyphs to 15 uuids from
positional decomposition. Neither was visible before.

A test pins the invariant that glyph_id and diagram_stid are written together
or not at all — a glyph id is unique only within its diagram, so one without
the other cannot be resolved back to anything.

Verified with the full CI command set this time — mypy clean on 12 files,
ruff clean on the changed files, 189 tests at 49.66% coverage.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@adamjohnwright
adamjohnwright merged commit da6122d into main Sep 14, 2026
4 checks passed
@adamjohnwright
adamjohnwright deleted the feature/glyph-identity branch September 14, 2026 17:16
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