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

frequencies: error with --region flag #1423

Closed
joverlee521 opened this issue Feb 23, 2024 · 3 comments · Fixed by #1424
Closed

frequencies: error with --region flag #1423

joverlee521 opened this issue Feb 23, 2024 · 3 comments · Fixed by #1424
Assignees
Labels
bug Something isn't working

Comments

@joverlee521
Copy link
Contributor

This bug initially discovered in the private seasonal flu workflow.

Use of the --region flag results in the following error:

[batch] [2024-02-22T16:28:59-08:00] Traceback (most recent call last):
[batch] [2024-02-22T16:28:59-08:00]   File "/nextstrain/augur/augur/__init__.py", line 66, in run
[batch] [2024-02-22T16:28:59-08:00]     return args.__command__.run(args)
[batch] [2024-02-22T16:28:59-08:00]   File "/nextstrain/augur/augur/frequencies.py", line 148, in run
[batch] [2024-02-22T16:28:59-08:00]     tree_freqs = tree_frequencies(tree, pivots, method='SLSQP',
[batch] [2024-02-22T16:28:59-08:00]   File "/nextstrain/augur/augur/frequency_estimators.py", line 502, in __init__
[batch] [2024-02-22T16:28:59-08:00]     self.prepare()
[batch] [2024-02-22T16:28:59-08:00]   File "/nextstrain/augur/augur/frequency_estimators.py", line 516, in prepare
[batch] [2024-02-22T16:28:59-08:00]     if self.node_filter(node):
[batch] [2024-02-22T16:28:59-08:00]   File "/nextstrain/augur/augur/frequencies.py", line 145, in <lambda>
[batch] [2024-02-22T16:28:59-08:00]     node_filter_func = lambda node: (node.attr["region"] == region
[batch] [2024-02-22T16:28:59-08:00] KeyError: 'region'
[batch] [2024-02-22T16:28:59-08:00] An error occurred (see above) that has not been properly handled by Augur.
[batch] [2024-02-22T16:28:59-08:00] To report this, please open a new issue including the original command and the error above:
[batch] [2024-02-22T16:28:59-08:00]     <https://github.com/nextstrain/augur/issues/new/choose>
@joverlee521 joverlee521 added the bug Something isn't working label Feb 23, 2024
@joverlee521
Copy link
Contributor Author

Hmm, most likely a result of the change to read a subset of metadata columns in #1294

@joverlee521
Copy link
Contributor Author

Errors for any regions that are not global because it requires the region metadata field:

augur/augur/frequencies.py

Lines 139 to 146 in f81e6a3

for region in args.regions:
# Omit strains sampled prior to the first pivot from frequency calculations.
# (these tend to be reference strains included for phylogenetic context)
if region=='global':
node_filter_func = lambda node: node.attr["num_date"] >= pivots[0]
else:
node_filter_func = lambda node: (node.attr["region"] == region
and node.attr["num_date"] >= pivots[0])

@joverlee521 joverlee521 self-assigned this Feb 23, 2024
@joverlee521
Copy link
Contributor Author

Ah, also because we changed to only annotating tips with weight_attributes in dde857a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant