Skip to content

fix(VariantScreen): use mapped coordinate mode for histogram#674

Open
bencap wants to merge 1 commit into
mainfrom
bugfix/bencap/653/variant-view-coordinate-mode
Open

fix(VariantScreen): use mapped coordinate mode for histogram#674
bencap wants to merge 1 commit into
mainfrom
bugfix/bencap/653/variant-view-coordinate-mode

Conversation

@bencap
Copy link
Copy Markdown
Collaborator

@bencap bencap commented May 13, 2026

The Variant view histogram fell back to raw-mode tooltip labels because three things lined up: the coordinates prop defaulted to 'raw', the variant cache only ran parseScoresOrCounts (so parsedPostMappedHgvs* and translated_hgvs_p were never populated), and the fetch omitted include_post_mapped_hgvs plus the vep/clingen namespaces — so even a mapped-mode tooltip would have had nothing to render. Pass coordinates="mapped" on VariantScreen and route the fetch + parse through the same pipeline ScoreSetView uses.

Along the way, consolidate the variant-data plumbing that had drifted between the two screens:

  • Extract histogramScoreSetVariantDataUrl and a small params/URL builder in api/mavedb/score-sets.ts; ScoreSetView and the histogram fetch now share one definition of the endpoint and namespace set.
  • Add parseScoreSetVariantData in lib/variants.ts as the single entrypoint for the parseScoresOrCountsparseSimpleCodingVariantstranslateSimpleCodingVariants chain; the latter two are now internal.
  • Rename getVariantScoresgetHistogramVariantData to reflect that it returns full variant rows, not just scores.
  • Type useVariantLookup's scores/variantScoreRow as Variant instead of ScoresOrCountsRow, removing the as any cast at the histogram :variants binding.
  • Introduce ParsedSimpleDnaVariation/ParsedSimpleProteinVariation aliases so the residueType/origin fields added by parseSimpleCodingVariants are reflected in the type.

The Variant view histogram fell back to raw-mode tooltip labels because
three things lined up: the `coordinates` prop defaulted to `'raw'`, the
variant cache only ran `parseScoresOrCounts` (so `parsedPostMappedHgvs*`
and `translated_hgvs_p` were never populated), and the fetch omitted
`include_post_mapped_hgvs` plus the `vep`/`clingen` namespaces — so even
a mapped-mode tooltip would have had nothing to render. Pass
`coordinates="mapped"` on VariantScreen and route the fetch + parse
through the same pipeline ScoreSetView uses.

Along the way, consolidate the variant-data plumbing that had drifted
between the two screens:

- Extract `histogramScoreSetVariantDataUrl` and a small params/URL
  builder in `api/mavedb/score-sets.ts`; ScoreSetView and the histogram
  fetch now share one definition of the endpoint and namespace set.
- Add `parseScoreSetVariantData` in `lib/variants.ts` as the single
  entrypoint for the `parseScoresOrCounts` → `parseSimpleCodingVariants`
  → `translateSimpleCodingVariants` chain; the latter two are now
  internal.
- Rename `getVariantScores` → `getHistogramVariantData` to reflect that
  it returns full variant rows, not just scores.
- Type `useVariantLookup`'s `scores`/`variantScoreRow` as `Variant`
  instead of `ScoresOrCountsRow`, removing the `as any` cast at the
  histogram `:variants` binding.
- Introduce `ParsedSimpleDnaVariation`/`ParsedSimpleProteinVariation`
  aliases so the `residueType`/`origin` fields added by
  `parseSimpleCodingVariants` are reflected in the type.
@bencap bencap requested review from jstone-dev and sallybg May 13, 2026 23:27
@bencap bencap linked an issue May 13, 2026 that may be closed by this pull request
4 tasks
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.

Variant view histogram uses raw coordinate mode instead of mapped mode

1 participant