Record which diagram glyph each node came from - #77
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Answers the pathway-browser half of
specs/005-node-identity-mapping.The identity was already being read, then thrown away
diagram_connectivity.pycollectsx["id"]from each input/output/catalystentry — 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, andnode_resolution.csv'sglyph_id/diagram_stidcolumns are now populated.(reaction, entity, role)is a unique key0 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_idanddiagram_stidare written together or not atall — 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