Skip to content

feat(wasap): add GenSpectrum collections analysis mode#1327

Open
fhennig wants to merge 11 commits into
mainfrom
implement-wastewater-cov-spectrum-collection-mode
Open

feat(wasap): add GenSpectrum collections analysis mode#1327
fhennig wants to merge 11 commits into
mainfrom
implement-wastewater-cov-spectrum-collection-mode

Conversation

@fhennig

@fhennig fhennig commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Closes #1324, closes #1328

Summary

  • Adds a new 'collection' analysis mode to WASAP that uses GenSpectrum's own backend collections, separate from the existing 'covSpectrumCollection' mode (CovSpectrum API)
  • COVID gets both modes side by side; RSV-A and RSV-B get only the new collection mode (CovSpectrum collections don't exist for RSV)
  • CollectionInfo component updated to accept sourceLabel and optional collectionUrl to show appropriate links per source

New files

  • CollectionAnalysisFilter.tsx — filter dropdown that lists collections for the current organism via getCollectionSummaries({ organism })

Key implementation notes

  • Data fetch uses getBackendServiceForClientside().getCollection({ id })
  • Handles both query variants (countQuery used directly) and filterObject variants (mutation arrays joined into a query string)
  • All query strings validated through LAPIS parseQuery + validateGenomeOnly before display, same as the CovSpectrum path
  • filterObject variants with only mutation arrays (no lineage catchall fields) are converted; empty results are marked invalid

Test plan

  • TypeScript passes (npx tsc --noEmit)
  • COVID WASAP page shows both "Collection" and "CovSpectrum Collection" in the mode dropdown
  • RSV-A and RSV-B WASAP pages show "Collection" mode (no CovSpectrum mode)
  • Selecting a collection and applying the filter renders GsQueriesOverTime with the collection's variants
  • Info box shows "GenSpectrum collection" label with a link to the collection page; CovSpectrum mode still shows the CovSpectrum link

TODO

  • Consider adding a WasapPage.browser.spec.tsx that mocks getCollection via BackendRouteMocker and asserts the "No valid variants" message renders when all variants are empty/invalid

🤖 Generated with Claude Code

@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dashboards Ready Ready Preview, Comment Jul 15, 2026 9:03am

Request Review

@fhennig

fhennig commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Waiting for #1332 so we can add some more tests.

@fhennig fhennig force-pushed the implement-wastewater-cov-spectrum-collection-mode branch from 209b0e1 to 0973b71 Compare July 13, 2026 10:47
@fhennig fhennig changed the base branch from main to add-wasap-page-data-tests July 14, 2026 13:42
@fhennig

fhennig commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

waiting on base branch (#1332) to be merged first

Base automatically changed from add-wasap-page-data-tests to main July 15, 2026 06:58
fhennig and others added 7 commits July 15, 2026 09:59
Adds a new 'collection' analysis mode to the WASAP dashboard that browses
GenSpectrum's own collection system, enabling RSV-A and RSV-B to have a
collections mode (CovSpectrum collections only exist for COVID).

- Config: CollectionAnalysisModeConfig discriminated union; no extra URL
  needed since the backend is our own
- Data fetch: getBackendServiceForClientside().getCollection(), handles
  both 'query' and 'filterObject' variant types via parseQuery validation
- Filter UI: GsCollectionAnalysisFilter lists collections by organism via
  getCollectionSummaries()
- COVID gets both modes; RSV-A and RSV-B get only the new mode
- CollectionInfo now accepts sourceLabel/collectionUrl to distinguish
  CovSpectrum vs GenSpectrum collection links in the page view

Closes #1324

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…llection link

- Deduplicate display labels in fetchCollectionModeData: duplicate names
  get a counter suffix ("Resistance", "Resistance (2)") so GsQueriesOverTime
  doesn't throw on collections like the RSV-A resistance set
- Add clickable link to the GenSpectrum collection info box using
  Page.viewCollection(config.internalName, id)

See #1328 for the same fix on the CovSpectrum path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…pdown

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…isFilter

Also auto-selects the first collection on load via useEffect and removes
the empty placeholder option from the dropdown.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@fhennig fhennig force-pushed the implement-wastewater-cov-spectrum-collection-mode branch from 29808ac to ef784b5 Compare July 15, 2026 08:01
… lineage fields

- Replace truthy `!analysis.collectionId` / ternary checks with explicit
  `=== undefined` / `!== undefined` comparisons in useWasapPageData.ts and
  WasapPageStateHandler.ts, since a collectionId of 0 would otherwise be
  wrongly treated as unset.
- filterObjectToQueryString now includes FilterObject's catchall lineage
  fields (e.g. pangoLineage) via getLineageFields, matching how
  detailedMutationsToQuery already handles CoV-Spectrum lineage filters.
  Previously these were silently dropped from the generated LAPIS query.
- Remove an unnecessary `as Collection` type assertion flagged by
  @typescript-eslint/no-unnecessary-type-assertion.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

fix(wasap): handle duplicate variant display labels in CovSpectrum collection mode feat(wasap): add GenSpectrum collections analysis mode

1 participant