Skip to content

/genome: endless procedural double-helix viewer over the live CPIC gene catalogue#67

Merged
AdaWorldAPI merged 3 commits into
mainfrom
claude/q2-genome-helix
Jun 29, 2026
Merged

/genome: endless procedural double-helix viewer over the live CPIC gene catalogue#67
AdaWorldAPI merged 3 commits into
mainfrom
claude/q2-genome-helix

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Jun 29, 2026

Copy link
Copy Markdown
Owner

What

A new /genome route — an endless procedural double helix that visualises the GUID address space CPIC lives in, rather than a sized mesh. Standalone (GenomeHelix.tsx); shares nothing with the working /cpic CpicCockpit, so it can never break it (same isolation discipline as /helix vs /body).

The premise: the OGAR GUID address space is billions of slots (HEEL·HIP·TWIG cascade); CPIC fills almost none of it. So this isn't a fixed mesh — it's an infinite scaffold that is the address space, with the sparse real pharmacogenes lighting up loci in it.

How (cheap by construction — repetition placed by a function of the address)

  • One instanced sugar-bead per strand + one instanced rung, a fixed pool of 240 base-pairs (THREE.InstancedMesh). Position is a pure function of the integer step: angle = step·goldenAngle, y = step·rise. No baked geometry, no forced shape.
  • Endless: the 240 instances are a sliding window over an infinite strand — scroll advances, the same instances re-address higher steps, the ends fade into fog. Infinite length, constant instance count, no reallocation.
  • Fractal: the wheel grows density; spacing subdivides ×16 per tier, so zoom descends the 16-ary cascade ("scale = the next cascade level"). The golden angle (most-irrational) makes the scaffold aperiodic — endless, not looped.

Real CPIC data (not placeholders)

  • Loci come from GET /api/cpic/catalog (the live gene list); the canonical CPIC level-A list is only a fallback when the endpoint is absent (old deploy), so /genome always renders. The header shows live vs fallback + the real gene count.
  • Each gene gets a stable FNV-1a address from its name (linear-probe on the rare collision) → same gene, same locus forever; addressability with zero storage.
  • Click a lit gene (drag-aware, so orbiting never triggers it) raycasts the rung InstancedMesh and hands off to the working reasoner at /cpic?gene=<gene>.
  • CpicCockpit now honors ?gene= as its initial gene (additive, backward-compatible — no param ⇒ the existing default), so the handoff lands on the clicked gene and its diplotype→phenotype→recommendation 2-hop.

Scope / safety

Verification

  • tsc --noEmit + vite build clean.
  • /api/cpic/catalog + /api/cpic/reason are the existing endpoints the working /cpic cockpit already uses; /genome consumes the catalog read-only and deep-links into the reasoner.

Follow-ups (not in this PR)

  • Hover-highlight + a small inline panel (gene → its CPIC drugs) so the payload is visible without leaving the helix.
  • Literal per-rung 16-child expansion on deep zoom (the current zoom subdivides spacing; a true recursive node expansion is the next step).

🤖 Generated with Claude Code

https://claude.ai/code/session_01RhpwkHGgia2TuDFvdnuQdE


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Added a new genome visualization page with interactive orbit, zoom, and click-to-open gene navigation.
    • The CPIC view now opens with a gene from the URL when provided, making shared links more precise.
  • Bug Fixes

    • Updated tissue and layer classification so connective structures are handled correctly in visualizations and analysis.
    • Refreshed embedded assets to the latest published version.

claude added 3 commits June 29, 2026 10:26
…ayer 7

The organ view showed tan limb-shaped strays floating in the lower body — a
foot, forearm/leg "bone shafts", and detached pieces below the abdomen. They
weren't organs: they were connective tissue misfiled as organ.

Root cause: FMA's is_a tree files ligaments/tendons/membranes under
/viscera/solid_organ/ligament_organ and /membrane_organ. tissue_of walks that
chain and hits the "viscus" TYPEKEY (→ layer 3 organ) before recognising them
as connective. The UI's connective layer (7) was defined but NO tissue type
ever mapped to it — it was a dead compartment end to end. So interosseous
membrane of leg/forearm, calcaneal tendon, long plantar ligament, stylohyoid/
thyrohyoid/vocal ligaments, retinacula, iliotibial tract, tarsal plates, and
the superior-oblique trochlea all rendered as organ-layer strays.

Fix:
- bake_torso_splat.py: a "connective" TYPEKEY (ligament organ / membrane organ /
  tendon / aponeurosis / fascia / retinaculum), placed after muscle and before
  the organ-group keys so it wins over viscus. Added connective to TISSUE_RGB
  (ivory 224,219,204), TISSUE_OPACITY (0.60), TISSUE_CONTAINERS, SYSTEM_OF.
- soabake + helixbake layer_of (scratch emitters): "connective" => 7.
- bake_body_v3.py + audit_body_semantics.py LAYER_OF mirrors: connective => 7.
- audit_body_semantics.py: new QA-3 assertion that interosseous membrane /
  calcaneal tendon / long plantar ligament / iliotibial tract are layer 7
  (regression guard). Fixed a latent bug it exposed — the eyeball check's bare
  "retina" matched "retinaculum"; tightened to \bretina\b.

Validated against the FMA is_a tree before re-emit: exactly 39 concepts move to
connective (21 from organ, 16 from skin, 2 from muscle); zero real organs move.
New layer histogram: organ 151→130, connective 0→39. The lowest organ concepts
are now real pelvic organs (testis/prostate/bladder) — no foot, no limb bones.

Re-emitted as the stamped 20260629c artifacts (geometry byte-identical to
20260629b — only the per-concept tissue/layer changed, so no mesh re-read or
slicer-fill needed; body.blocks is unchanged, the server LOD asset stays valid).
Dockerfile + manifest bumped to 20260629c. QA-3 audit passes.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RhpwkHGgia2TuDFvdnuQdE
A new /genome route — an infinite golden-angle double helix that visualises the
GUID address space CPIC lives in, rather than a sized mesh. Standalone
(GenomeHelix.tsx), shares nothing with the working /cpic CpicCockpit, so it
can never break it (same isolation discipline as /helix vs /body).

Cheap by construction — pure repetition placed by a function of the address:
- One instanced sugar-bead per strand + one instanced rung, a fixed pool of
  240 base-pairs (THREE.InstancedMesh). Position is a pure function of the
  integer step: angle = step·goldenAngle, y = step·rise. No baked geometry.
- Endless: the 240 instances are a sliding WINDOW over an infinite strand —
  scroll advances, the same instances re-address higher steps, ends fade into
  fog. Infinite length, constant instance count, no reallocation.
- Fractal: the wheel grows density; spacing subdivides ×16 per tier, so zoom
  descends the 16-ary cascade ("scale = the next cascade level"). The golden
  angle (most-irrational) makes the scaffold aperiodic — endless, not looped.
- CPIC as sparse lit loci: the 16 canonical CPIC level-A pharmacogenes
  (CYP2D6, CYP2C19, TPMT, DPYD, SLCO1B1…) light up as labelled white rungs in
  the vast scaffold — the tiny dataset in a huge address space, made visual.

Prototype scope: the gene set is the hardcoded canonical CPIC-A list at
placeholder golden-scatter addresses. Next step (not done here): light loci
from the real graph via POST /api/cpic/reason (the existing gene→diplotype→
phenotype→drug 2-hop), making each rung an expandable real gene. tsc + vite
build clean.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RhpwkHGgia2TuDFvdnuQdE
…cpic

Replace the hardcoded gene placeholders with the REAL pharmacogene set:
- GET /api/cpic/catalog on mount → the live gene list lights the loci; the
  canonical CPIC-A list stays only as a fallback when the endpoint is absent
  (old deploy), so /genome always renders. Header shows live vs fallback + the
  real gene count.
- Each gene gets a STABLE address from an FNV-1a hash of its name (linear-probe
  on the rare collision) → same gene, same locus forever; addressability with
  zero storage, the whole point of the scaffold.
- Click a lit locus (drag-aware: ignored while orbiting) raycasts the rung
  InstancedMesh and hands off to the working reasoner at /cpic?gene=<gene>.
- CpicCockpit now honors ?gene= as its initial gene (additive, backward-
  compatible — no param ⇒ the existing default), so the handoff lands on the
  clicked gene and its diplotype→phenotype→recommendation 2-hop.

The scaffold (golden-angle, windowed-endless, 16-ary zoom) is unchanged; only
the loci became real and clickable. tsc + vite build clean.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RhpwkHGgia2TuDFvdnuQdE
@AdaWorldAPI AdaWorldAPI merged commit f334859 into main Jun 29, 2026
3 of 4 checks passed
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ed099aab-4951-4783-a38f-e3aaf1307398

📥 Commits

Reviewing files that changed from the base of the PR and between e32429d and 360a386.

📒 Files selected for processing (8)
  • Dockerfile
  • cockpit/public/body.manifest.json
  • cockpit/src/CpicCockpit.tsx
  • cockpit/src/GenomeHelix.tsx
  • cockpit/src/main.tsx
  • crates/osint-bake/tools/audit_body_semantics.py
  • crates/osint-bake/tools/bake_body_v3.py
  • crates/osint-bake/tools/bake_torso_splat.py

📝 Walkthrough

Walkthrough

Adds a new connective tissue type (layer 7) to the body bake and audit pipeline tools. Introduces a GenomeHelix Three.js React page at /genome that renders an animated double-helix with CPIC gene loci, raycast picking, and navigation. Reads the gene URL param in CpicCockpit. Bumps wire asset downloads to version 20260629c.

Changes

Connective tissue layer 7 in bake pipeline

Layer / File(s) Summary
Connective tissue classification and rendering params
crates/osint-bake/tools/bake_torso_splat.py, crates/osint-bake/tools/bake_body_v3.py
TYPEKEYS gains a "connective" entry matching ligament/membrane/tendon/fascia/retinaculum keywords; SYSTEM_OF maps it to "musculoskeletal"; TISSUE_RGB, TISSUE_OPACITY, TISSUE_CONTAINERS extended; LAYER_OF in bake_body_v3 adds "connective": 7.
Audit layer mapping and QA-3 assertions
crates/osint-bake/tools/audit_body_semantics.py
Adds "connective": 7 to LAYER_OF, fixes retina regex to word-boundary form, and asserts connective landmarks (interosseous membrane, tendons, ligaments) resolve to layer 7.

GenomeHelix page and asset bump

Layer / File(s) Summary
Wire asset version bump to 20260629c
Dockerfile, cockpit/public/body.manifest.json
Dockerfile curl URLs updated from 20260629b to 20260629c for both body SoA and helix SoA; manifest helix_latest and note updated to match.
GenomeHelix Three.js scene and helpers
cockpit/src/GenomeHelix.tsx
New file: FNV-1a gene-to-step hashing (lociFrom), canvas label sprites, Three.js instanced strand/rung scene with scroll animation, raycast picking, drag-orbit, wheel zoom, and full GPU/listener cleanup on unmount.
GenomeHelix React component and /genome route
cockpit/src/GenomeHelix.tsx, cockpit/src/main.tsx, cockpit/src/CpicCockpit.tsx
React component fetches /api/cpic/catalog with FALLBACK_GENES fallback, mounts renderer when genes are ready, renders overlay UI; /genome route added to router; CpicCockpit reads ?gene= URL param.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • AdaWorldAPI/q2#52: Introduces bake_torso_splat.py, which this PR directly extends with the new "connective" tissue bucket.
  • AdaWorldAPI/q2#65: Modifies the same helix_latest manifest field and Dockerfile helix SoA download that this PR advances to 20260629c.
  • AdaWorldAPI/q2#66: Updates the same Dockerfile helix SoA download path and body.manifest.json helix_latest field for the prior version bump.

Poem

🐇 Hop along the double helix strand,
connective tissue now has layer seven planned,
the genome page spins up with Three.js might,
gene loci glow like stars in the night,
20260629c freshly baked and bright! 🧬

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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