Skip to content

feat(collection-seeder): add influenza resistance mutation collections#1316

Merged
fhennig merged 12 commits into
mainfrom
feat/flu-resistance-mutations-1272
Jul 22, 2026
Merged

feat(collection-seeder): add influenza resistance mutation collections#1316
fhennig merged 12 commits into
mainfrom
feat/flu-resistance-mutations-1272

Conversation

@fhennig

@fhennig fhennig commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

resolves #1272

Summary

Adds resistance mutations for all influenza viruses.

Screenshot

image
Screen.Recording.2026-07-14.at.15.10.05.mov

PR Checklist

  • All necessary documentation has been adapted.
  • The implemented feature is covered by an appropriate test.

@vercel

vercel Bot commented Jul 6, 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 12:00pm

Request Review

@fhennig fhennig self-assigned this Jul 6, 2026
@fhennig
fhennig force-pushed the feat/flu-resistance-mutations-1272 branch from a72f603 to e8b4e99 Compare July 6, 2026 09:55
@fhennig fhennig changed the title Feat/flu resistance mutations 1272 feat(collection-seeder): add influenza resistance mutation collections Jul 7, 2026
@fhennig
fhennig marked this pull request as ready for review July 14, 2026 13:26
Felix Hennig and others added 8 commits July 14, 2026 15:26
Adds four new Source classes (h1n1pdm, h3n2, h5n1, victoria) that fetch
antiviral resistance mutation data from the BU-ISCIII flu_resistance repo
and produce one Collection per antiviral per organism.

NA inhibitors (Oseltamivir, Zanamivir, Peramivir, Laninamivir) are sourced
from NA-inhibitors.json with NI/RI/HRI classification.  Baloxavir is sourced
from PA-inhibitors.json with fold-change values.  NI-only and unknown (?, ?e)
entries are excluded.

Open questions about strain mapping, fold-change thresholds, LAPIS gene name
conventions, and additional data files are documented in QUESTIONS.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Baloxavir variants now named by mutation (e.g. 'PA:I38T') with
  fold-change surfaced in the new variant description field
- Add description field to Variant TypedDict (NotRequired[str])
- Remove QUESTIONS.md (all questions resolved)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Some entries in NA-inhibitors.json have leading spaces (e.g. " S227N"),
which produced invalid strings like "NA: S227N" in aminoAcidMutations.

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>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ction descriptions

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new collection-seeding source that pulls influenza antiviral resistance mutations from the BU-ISCIII flu_resistance repository and generates seeded collections for the influenza dashboards (H1N1pdm, H3N2, H5N1, and B/Victoria), resolving #1272.

Changes:

  • Introduces influenza_resistance_mutations seeding sources that fetch NA- and PA-inhibitor mutation datasets and build collections/variants per subtype.
  • Registers the new influenza sources in the seeder source registry so they run in the default seed flow.
  • Extends the shared Variant typed model to allow an optional description, and adds a dedicated test suite for the influenza sources and parsing.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
collection-seeding/sources/influenza_resistance_mutations.py New influenza resistance mutation sources and JSON fetching/parsing to produce collections.
collection-seeding/sources/registry.py Registers the new influenza sources in ALL_SOURCES.
collection-seeding/models.py Makes Variant.description optional via NotRequired.
collection-seeding/tests/test_influenza_resistance_mutations.py Adds unit tests for parsing and for collection/variant generation across influenza subtypes.

Comment thread collection-seeding/tests/test_influenza_resistance_mutations.py Outdated
Comment thread collection-seeding/tests/test_influenza_resistance_mutations.py Outdated
Comment thread collection-seeding/sources/influenza_resistance_mutations.py
Comment thread collection-seeding/tests/test_influenza_resistance_mutations.py Outdated
Comment thread collection-seeding/sources/influenza_resistance_mutations.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

]


@functools.lru_cache

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI: 🔴 bug: @lru_cache persists for the whole pytest process, which breaks test isolation. The first fetch test (test_h1n1_organism) populates the cache; every later @responses.activate test then registers NA/PA mocks that never fire, and responses (0.26.2, default assert_all_requests_are_fired=True) fails any test with unfired mocks — so ~15 tests go red. It also leaks fixture data across tests. Clear the cache between tests, e.g. add a conftest.py (or module-level fixture) with:

import pytest
from sources.influenza_resistance_mutations import _fetch_json

@pytest.fixture(autouse=True)
def _clear_fetch_cache():
    _fetch_json.cache_clear()
    yield
    _fetch_json.cache_clear()

(Could not run the suite locally — assessment from the responses default + call ordering; please confirm on CI.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(Not sure whether that's true - in any case I think it's not that important)

@fhennig
fhennig merged commit 1d51c42 into main Jul 22, 2026
12 checks passed
@fhennig
fhennig deleted the feat/flu-resistance-mutations-1272 branch July 22, 2026 07:35
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.

pull resistance mutations for Influenza from flu_resistance repo and generate collections

3 participants