-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix tree file opening in beast import #1439
bugfix tree file opening in beast import #1439
Conversation
bugfix beast import file opening: parse_nexus() had a block to inspect the tree argument provided and if a path string, open the file and read tree data, or if a file handle, use directly. Comparable functionality was made available via the augur.io.file.open_file() context manager, which was used in place of open() calls across the codebase. This broke parse_beast_tree() since augur.io.file.open_file() returns a context manager rather than an open file handle. This commit removes the use file-or-handle logic from parse_beast_tree(), and makes use of the file handle yielded by the context manager (i.e. it adds "with open_file(tree_path,'r') as handle:")
pin nextstrain/base image to build-20240209T204939Z until a tagged release of the image includes a version of augur with the bugfix included in nextstrain/augur#1439
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1439 +/- ##
==========================================
+ Coverage 68.67% 68.73% +0.05%
==========================================
Files 69 69
Lines 7557 7551 -6
Branches 1851 1851
==========================================
Hits 5190 5190
+ Misses 2089 2083 -6
Partials 278 278 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the bug fix @tomkinsc! I added an entry in the changelog for this update. We try to avoid releases on Fridays, so I'll plan to do a release of Augur with this fix on Monday.
For our own reference, the bug was introduced in 51a77a9 and we didn't catch it because we don't have any test coverage for the augur import
command.
FYI @tomkinsc, this fix has been released as part of Augur 24.3.0. The latest nextstrain/base image ( |
update nextstrain/base image to build-20240318T173028Z, which should include a version of augur incorporating the bugfix from nextstrain/augur#1439
Hi @tomkinsc, thank you for handling this! I should have checked all new references to |
This allows setting defaults and supporting various compression formats all from one central function. Maybe a similar central function should be used for pandas.read_csv().
Description of proposed changes
parse_nexus()
had a block to inspect the tree argument provided and if a path string, open the file and read tree data, or if a file handle, use it directly. Comparable functionality was recently made available via theaugur.io.file.open_file()
context manager, which was then employed in place ofopen()
calls across the codebase. The change fromopen()
toopen_file()
brokeparse_beast_tree()
sinceaugur.io.file.open_file()
returns a context manager rather than the file handle expected byparse_nexus()
.This commit removes the use file-or-handle logic from
parse_beast_tree()
, and has the function consume the file handle yielded by theaugur.io.file.open_file()
context manager (i.e. it adds awith open_file(...) as handle:
).