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

curate rename: does not work if some fields do not exist #1757

Open
joverlee521 opened this issue Feb 14, 2025 · 0 comments
Open

curate rename: does not work if some fields do not exist #1757

joverlee521 opened this issue Feb 14, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@joverlee521
Copy link
Contributor

Discovered in ebola workflow

If some requested fields in the --field-map do not exist, then some fields might not be renamed as expected.
This is due to the use of field_map.pop while looping through the list

for idx,names in enumerate(field_map[:]):
old_name, new_name = names
if old_name not in existing_fields:
print_err(f"WARNING: Asked to rename field {old_name!r} (to {new_name!r}) but it doesn't exist in the input data.")
field_map.pop(idx)

The indexes doesn't match, resulting in the wrong elements getting dropped:

my_list = [1,2,3,4,5]
for idx, num in enumerate(my_list[:]):
    if num in {2, 4}:
         my_list.pop(idx)

print(my_list) 
# Expects [1,3,5]
[1, 3, 4]
@joverlee521 joverlee521 added the bug Something isn't working label Feb 14, 2025
joverlee521 referenced this issue in nextstrain/ebola Feb 14, 2025
Preview: <https://nextstrain.org/community/victorlin/nextstrain-test@e88bb6a/ebola/all-outbreaks-pathoplexus>

Downloading the data is trivial with the public API endpoints. Some
de-duplication is required, and the column names were the main hurdle.
There were many unhandled exceptions from augur curate commands which
for the most part I could figure out what was going wrong, however, in
some cases such as apply-geolocation-rules, I couldn't figure out how to
add division info without causing an error.
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

No branches or pull requests

1 participant