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

Filter priority hotfix #530

Merged
merged 2 commits into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions augur/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ def write_vcf(input_filename, output_filename, dropped_samps):
def read_priority_scores(fname):
try:
with open(fname) as pfile:
return {
return defaultdict(float, {
elems[0]: float(elems[1])
for elems in (line.strip().split() for line in pfile.readlines())
}
})
except Exception as e:
print(f"ERROR: missing or malformed priority scores file {fname}", file=sys.stderr)
raise e
Expand Down
2 changes: 2 additions & 0 deletions tests/test_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def test_read_priority_scores_valid(self, mock_priorities_file_valid):
)

assert priorities == {"strain1": 5, "strain2": 6, "strain3": 8}
assert priorities["strain1"] == 5
assert priorities["strain42"] == 0, "Default priority is 0 for unlisted sequences"

def test_read_priority_scores_malformed(self, mock_priorities_file_malformed):
with pytest.raises(ValueError):
Expand Down