feat: no head looks empty on the map; cap the shareable card; pin safety across stereoisomers - #249
Merged
Conversation
Food-use status, the structural-alert screen and the Tox21 heads all key on CONNECTIVITY, not stereochemistry β food-use listings key on the InChIKey skeleton (first block), and the Morgan fingerprint the tox heads read is generated without chirality. So a listing or a tox flag on carvone necessarily covers both (R)- and (S)-carvone. That is correct β a regulator lists the substance, not one enantiomer β but nothing pinned it, and chirality-aware reads (#218) would touch exactly this machinery. Without a test, a future change could silently split safety by stereochemistry and under-report a hazard. Five assertions over three classic enantiomer pairs (carvone, limonene, menthol): the pairs are genuinely distinct molecules that share a skeleton, and their food-use status, structural alerts, per-assay tox probabilities and assembled safety block all match. Verified the test actually bites β stubbing the lookup to key on the full stereo-aware InChIKey makes it fail. The tox assertion no-ops when the heads are absent, so it stays green in CI (no model artifacts) and exercises fully on the box. Deliberate asymmetry, documented in the module docstring: SENSORY reads may legitimately differ between enantiomers ((R)-carvone is spearmint, (S)- is caraway) β that difference is documented, not predicted. Safety must not differ. Closes #238. Signed-off-by: Austin L. <86896075+rvnminers-A-and-N@users.noreply.github.com>
β¦fires MAP (#233): the map colours each molecule by a single WINNING label, so a head could read "(0)" in the legend while being trained on plenty of molecules β they were simply displayed under a rarer co-occurring label. Highlighting matched that winner-take-all label, so those heads lit up nothing and looked broken; it was the first thing that made the head roster look untrustworthy. New GET /api/map_members returns TRUE membership from the profile index β every molecule whose head fires >= 0.5, not just where it wins. Verified on the heads that read zero: clarysage 25 members, violetleaf 21, blackpepper 14, juniper 13, freesia 12, rosemary 12. Shipping 8,834 x 175 scores to the browser was not viable; the endpoint keeps the payload small and is cached. Zero-count legend entries are now clickable (with a tooltip explaining the distinction) and highlighting routes through one mapHit() predicate applied consistently across the 2D, properties and 3D views. Terms may be bare or dimension-qualified. CARD (#236): the shareable PNG rendered ALL 164 aroma cells β 28 grid rows β and omitted mouthfeel and safety entirely. A snapshot cannot scroll, so it now shows the 6 tastes ALWAYS (a fixed row, comparable across cards) and only what FIRES for the rest: aroma capped at 18, mouthfeel when a sensation fires, Tox21 only when flagged (warning red, caution-only wording). Labels state the subset honestly β "AROMA MODEL Β· 12 of 164 heads firing" β so nobody mistakes it for the whole model, and a molecule with nothing firing falls back to its strongest 3 rather than printing a blank card. Layout is adaptive: verified vanillin 692px (aroma only), menthol 766px (+cooling), capsaicin 840px (+pungent/warming, +NR-Aromatase/SR-ARE). Closes #233. Closes #236. Signed-off-by: Austin L. <86896075+rvnminers-A-and-N@users.noreply.github.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.
Closes #238. Closes #233. Closes #236.
Safety is identical across stereoisomers (#238) β now pinned. Food-use status, the structural-alert screen and the Tox21 heads all key on connectivity, not stereochemistry: food-use listings key on the InChIKey skeleton, and the Morgan fingerprint the tox heads read is generated without chirality. So a listing or a tox flag on carvone necessarily covers both (R)- and (S)-carvone. That's correct β a regulator lists the substance, not one enantiomer β but nothing pinned it, and chirality-aware reads (#218) would touch exactly this machinery. Five assertions across carvone/limonene/menthol cover skeleton identity, food-use status, structural alerts, per-assay tox probabilities and the assembled safety block. I verified the test actually bites: stubbing the lookup to key on the full stereo-aware InChIKey makes it fail. It stays green in CI (no model artifacts β the tox assertion no-ops) and exercises fully on the box. The docstring records the deliberate asymmetry β sensory reads may legitimately differ between enantiomers ((R)-carvone spearmint vs (S)- caraway, documented not predicted); safety must not.
No head looks empty any more (#233). The map colours each molecule by a single winning label, so a head could read (0) in the legend while being trained on plenty of molecules β they were just displayed under a rarer co-occurring label. Highlighting matched that winner-take-all label, so those heads lit up nothing and looked broken. This was the first thing that made the head roster look untrustworthy ("why do we even have a head for them?").
New
GET /api/map_membersreturns true membership from the profile index β every molecule whose head fires β₯0.5. Verified on the heads that read zero: clarysage 25 members, violetleaf 21, blackpepper 14, juniper 13, freesia 12, rosemary 12. Shipping 8,834 Γ 175 scores to the browser wasn't viable, so the endpoint keeps the payload small and is cached. Zero-count legend entries are now clickable with a tooltip explaining the distinction, and highlighting routes through a singlemapHit()predicate applied consistently across the 2D, properties and 3D views.The shareable card is capped at what fires (#236). It was rendering all 164 aroma cells β 28 grid rows β and omitting mouthfeel and safety entirely. A PNG can't scroll, so: the 6 tastes always render (a fixed row, comparable across cards) and everything else shows only what fires β aroma capped at 18, mouthfeel when a sensation fires, Tox21 only when flagged (warning red, caution-only wording). Labels state the subset honestly ("AROMA MODEL Β· 12 of 164 heads firing") so nobody mistakes it for the whole model, and a molecule with nothing firing falls back to its strongest 3 rather than printing a blank card. Layout is adaptive β verified vanillin 692px (aroma only), menthol 766px (+cooling), capsaicin 840px (+pungent/warming, +NR-Aromatase/SR-ARE).
ruff check .clean and 30 unit tests pass (was 25).