Skip to content
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

Fix single trait inference #891

Merged
merged 4 commits into from
Apr 19, 2022
Merged

Fix single trait inference #891

merged 4 commits into from
Apr 19, 2022

Conversation

huddlej
Copy link
Contributor

@huddlej huddlej commented Apr 14, 2022

Description of proposed changes

Fixes an issue where trait inference on a metadata column with a single value can cause an AttributeError when the user (or workflow) requests confidence intervals or entropy and TreeTime has not calculated any.

Related issue(s)

This issue was reported at least three separate times and commented on several times in at least one of these original issues.

Fixes #575
Fixes #715
Fixes #828

Testing

  • Adds functional tests for augur traits

huddlej added 3 commits April 14, 2022 16:09
Adds simplest call to traits and then two cases when traits should print
a warning to stderr instead of throwing an error.
Follow convention by printing warnings and errors to stderr instead of
stdout.
Uses `getattr` to check for the existence of traits metadata from
TreeTime before attempting to access those values.

Fixes #575
Fixes #715
Fixes #828
@huddlej huddlej force-pushed the fix-single-trait-inference branch from fcb96df to a7fce8c Compare April 14, 2022 23:10
@codecov
Copy link

codecov bot commented Apr 14, 2022

Codecov Report

Merging #891 (53cf195) into master (b464692) will increase coverage by 2.24%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master     #891      +/-   ##
==========================================
+ Coverage   34.64%   36.89%   +2.24%     
==========================================
  Files          41       42       +1     
  Lines        6003     6418     +415     
  Branches     1536     1685     +149     
==========================================
+ Hits         2080     2368     +288     
- Misses       3850     3949      +99     
- Partials       73      101      +28     
Impacted Files Coverage Δ
augur/traits.py 7.56% <0.00%> (-0.27%) ⬇️
augur/frequencies.py 13.48% <0.00%> (-1.16%) ⬇️
augur/dates.py 100.00% <0.00%> (ø)
augur/filter.py 73.75% <0.00%> (+2.14%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b464692...53cf195. Read the comment docs.

@huddlej huddlej requested a review from a team April 14, 2022 23:25
augur/traits.py Outdated Show resolved Hide resolved
Checks for missing values (i.e., `None`) instead of any false-y values
that could be valid and desired (e.g., 0.0).
@huddlej huddlej added this to the Next release X.X.X milestone Apr 19, 2022
@huddlej huddlej merged commit 002c44f into master Apr 19, 2022
@huddlej huddlej deleted the fix-single-trait-inference branch April 19, 2022 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
2 participants