fix: subtyping_report.py edge cases#135
Open
peterk87 wants to merge 3 commits into
Open
Conversation
Test data under tests/data/ was blocked by the top-level data/ gitignore, so nf-test could not find flu_metadata.csv on CI. Pin setup-uv to v8.1.0 since @v8 is no longer a valid immutable tag. Co-authored-by: Cursor <cursoragent@cursor.com>
setup-uv v8 requires an explicit virtual environment before uv pip install when the repo has no pyproject.toml. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses reported edge cases in bin/subtyping_report.py around missing HA/NA segments and improves robustness against IAV contamination skewing genus detection, while adding automated coverage via nf-test and pytest and wiring those tests into CI.
Changes:
- Update
subtyping_report.pyto (a) always populate H/N result columns even when segments are missing and (b) determine genus via segment-level voting to reduce contamination bias. - Add
nf-testcoverage for missing HA/NA segments and IBV-with-IAV-contamination scenarios; addpytestunit tests for key helper logic. - Add a
pytestjob to CI (viauv) and expand.gitignoreto cover common Nextflow, nf-test, and Python artifacts.
Reviewed changes
Copilot reviewed 10 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
bin/subtyping_report.py |
Implements genus voting changes and missing-segment handling; refactors typing annotations and result table column handling. |
tests/bin/test_subtyping_report.py |
Adds unit tests for genus voting, missing-segment behavior, and result column reindexing. |
tests/modules/local/subtyping_report.nf.test |
Adds nf-test coverage for HA/NA missing inputs and contamination scenario. |
tests/modules/local/subtyping_report.nf.test.snap |
Stores nf-test snapshots for the added module tests. |
tests/nextflow.config |
Ensures bin/ is on PATH for SUBTYPING_REPORT during nf-test runs. |
tests/requirements.txt |
Adds a dedicated dependency set for running pytest against bin scripts. |
tests/data/subtyping_report/flu_metadata.csv |
Provides metadata fixtures for nf-test scenarios. |
tests/data/subtyping_report/blastn_results/* |
Provides BLAST fixtures for missing-segment and contamination scenarios. |
tests/data/subtyping_report/vadr_outdirs/.gitkeep |
Placeholder to stage an empty VADR directory in tests. |
.github/workflows/ci.yml |
Adds a pytest job and updates caches/artifact actions; updates Nextflow matrix latest version. |
.github/workflows/linting.yml |
Updates GitHub Actions versions used by markdown linting. |
.gitignore |
Expands ignores for Nextflow/nf-test/Python/IDE outputs while keeping tests/data/ tracked. |
CHANGELOG.md |
Adds an Unreleased entry describing the bugfixes and new tests/CI updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This PR fixes #134
subtyping_report.pyedge cases when HA/NA segments are absent or IAV contamination skews genus detection ([BUG]: Edge cases affecting the suptyping_report.py #134)subtyping_report.nfcovering missing HA/NA segments and IBV/IAV contamination ([BUG]: Edge cases affecting the suptyping_report.py #134)tests/requirements.txtfor bin script unit tests