Skip to content

Order heatmap columns by how widely each vocabulary is shared - #60

Merged
realmarcin merged 2 commits into
mainfrom
feat/heatmap-column-order
Sep 16, 2026
Merged

realmarcin merged 2 commits into
mainfrom
feat/heatmap-column-order

Conversation

@realmarcin

Copy link
Copy Markdown
Contributor

The Shared vocabulary columns were in the order someone first typed them, so the shape of the table carried no information. They now sort left to right by the number of Mechs that ground anything in the vocabulary, ties broken by the total records citing it across the fleet, then by name so the order is stable for a vocabulary with no record counts.

PMID and DOI are pinned to the right rather than sorted. Every Mech cites literature, so both would tie for first on Mech count and push the vocabularies that actually distinguish the Mechs off the left edge. They also have nothing to break the tie with: build_subsets.py skips citation prefixes, so neither has record counts.

The resulting order:

vocabulary Mechs records
NCBITaxon 9 103,058
CHEBI 9 41,836
GO 6 111,299
UniProt 5 159,706
ENVO 5 1,634
UBERON 5 835
InterPro 3 120,166
PDB 3 51,723
CAS 3 2,072
KEGG 3 613
METPO 3 595
FOODON 3 384
PATO 3 119
Pfam 2 107,570
ARO 2 8,020
BTO 2 582
RHEA 1 29,506
MIBiG 1 3,115
NPAtlas 1 1,740
GTDB 1 313
PMID pinned n/a
DOI pinned n/a

The sort lives in build_data.py, so a corpus refresh re-derives it instead of leaving the columns stale. The prose and the note under the table now say what the order means: the left edge is the fleet's common ground, the right edge is what one Mech needs alone.

Verified in Chrome on a local harness: 22 columns render in the order above and the card still has zero horizontal overflow at the default width.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BXHrBTSU8fU4Zg7HfaMKs9

Copilot AI lite review requested due to automatic review settings September 11, 2026 04:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

realmarcin added a commit that referenced this pull request Sep 11, 2026
Review of #60 found the list of prefixes that name a paper rather than a
concept written down twice, in scripts that cannot see each other:
build_subsets.py skipped them with a literal tuple so they get no record
lists, and build_data.py declared its own copy to pin them to the right of the
heatmap. Adding a third prefix to one would have left the other sorting it to
the far left on Mech count with no record total to break the tie, which is the
failure the pin exists to prevent.

Both now import CITATION from roots.py, which already owned the other shared
fact about the corpora. build_data.py also stops redeclaring ORDER, which
roots.py has derived from RECORD_GLOBS since #40.

fleet_data.json rebuilds byte-identical, so this changes no published number.

Closes #61

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BXHrBTSU8fU4Zg7HfaMKs9
@realmarcin

Copy link
Copy Markdown
Contributor Author

Adversarial review done, read-only, against main. Findings filed as #61 and #62.

Checked the thing most likely to be wrong here, that the sort mixes two metrics: Mech count comes from the prefix census (occurrences) while the tie-break comes from the record subsets. Those could disagree, so I checked every pair in fleet_data.json: zero cells have occurrences without a record count, and zero have a record count without occurrences. The two agree on reach for all twenty non-citation vocabularies, so the mixed sources cannot change the ranking.

Also verified that nothing else reads the column order. The page takes it from DATA.voc at fleet_fragment.html:719; the VOCS list at line 394 is the graph's chord palette and is unrelated.

One assumption worth stating: "sort by Mech count" is read as descending, so the most widely shared vocabulary is leftmost. Say the word if you want it the other way round.

Addressed here: #61, the duplicated citation-prefix list, now a single CITATION in roots.py that both scripts import. build_data.py also stops redeclaring ORDER. fleet_data.json rebuilds byte-identical, so no published number moved.

Left filed: #62, a DOI filter in build_subsets.py that is a no-op because of an or True. It predates this PR, and fixing it properly would change edge weights on the graph, which needs a decision rather than a patch.

realmarcin and others added 2 commits September 16, 2026 10:19
The 22 columns were in the order they were first written down, so the table
said nothing by its shape: a vocabulary every Mech uses sat next to one only
ProteinTraitsMech has. They now sort left to right by the number of Mechs that
ground anything in the vocabulary, ties broken by the total records citing it
across the fleet, then by name so the order is stable when a vocabulary
appears in no records at all.

PMID and DOI are pinned to the right end instead of sorted. Every Mech cites
literature, so both would rank first on Mech count and crowd out the
vocabularies that actually say what the fleet shares; they also have no record
counts to rank by, since build_subsets.py skips citation prefixes.

The result runs NCBITaxon and ChEBI at nine Mechs each, through GO at six and
a five-Mech tier of UniProt, ENVO and UBERON, down to RHEA, MIBiG, NPAtlas and
GTDB at one. The order is computed in build_data.py, so a corpus refresh
re-derives it rather than leaving the columns stale.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BXHrBTSU8fU4Zg7HfaMKs9
Review of #60 found the list of prefixes that name a paper rather than a
concept written down twice, in scripts that cannot see each other:
build_subsets.py skipped them with a literal tuple so they get no record
lists, and build_data.py declared its own copy to pin them to the right of the
heatmap. Adding a third prefix to one would have left the other sorting it to
the far left on Mech count with no record total to break the tie, which is the
failure the pin exists to prevent.

Both now import CITATION from roots.py, which already owned the other shared
fact about the corpora. build_data.py also stops redeclaring ORDER, which
roots.py has derived from RECORD_GLOBS since #40.

fleet_data.json rebuilds byte-identical, so this changes no published number.

Closes #61

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BXHrBTSU8fU4Zg7HfaMKs9
@realmarcin
realmarcin force-pushed the feat/heatmap-column-order branch from b5652ed to c2312ce Compare September 16, 2026 17:19
@realmarcin

Copy link
Copy Markdown
Contributor Author

Rebased onto main after #71 and #72 landed. One conflict, in the heatmap note: main had added a caveat that the census predates the September 15 refresh and does not cover TaxonMech, while this PR was adding the sentence explaining the column order. Kept both.

Re-checked against the new gates on main, which did not exist when this PR was opened:

  • python -m unittest discover -s tests — 11 tests, OK.
  • python scripts/fleet/assemble_page.py --check — generated page current.

The ordering still derives from the nine-Mech census, and main's new assembler validates that the census order is a subset of fleet membership, which nine of ten satisfies. TaxonMech has no vocabulary census yet, and the note now says so.

Findings from the original review stand: #61 addressed here, #62 left filed.

@realmarcin
realmarcin merged commit 5c756d4 into main Sep 16, 2026
1 check passed
@realmarcin
realmarcin deleted the feat/heatmap-column-order branch September 16, 2026 17:20
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.

2 participants