augur icon indicating copy to clipboard operation
augur copied to clipboard

Unhandled exception in `clades`: index error in `is_node_in_clade`

Open corneliusroemer opened this issue 2 years ago • 1 comments

Running augur clade I got the following unhandled exception that I didn't know immediately how to debug:

monkeypox-nextclade on  nextclade [$!] via 🅒 nextstrain took 2m16s 
❯ augur clades             --tree results/HPXV1/tree.nwk             --mutations results/HPXV1/nt_muts.json results/HPXV1/aa_muts.json             --clades config/clades.tsv             --output-node-data results/HPXV1/clades.json 2>&1 | tee
Validating schema of 'results/HPXV1/aa_muts.json'...
Traceback (most recent call last):
  File "/usr/local/Caskroom/mambaforge/base/envs/nextstrain/bin/augur", line 10, in <module>
    sys.exit(main())
  File "/usr/local/Caskroom/mambaforge/base/envs/nextstrain/lib/python3.8/site-packages/augur/__main__.py", line 10, in main
    return augur.run( argv[1:] )
  File "/usr/local/Caskroom/mambaforge/base/envs/nextstrain/lib/python3.8/site-packages/augur/__init__.py", line 75, in run
    return args.__command__.run(args)
  File "/usr/local/Caskroom/mambaforge/base/envs/nextstrain/lib/python3.8/site-packages/augur/clades.py", line 280, in run
    clade_membership = assign_clades(clade_designations, all_muts, tree, ref)
  File "/usr/local/Caskroom/mambaforge/base/envs/nextstrain/lib/python3.8/site-packages/augur/clades.py", line 217, in assign_clades
    if is_node_in_clade(clade_alleles, node, ref):
  File "/usr/local/Caskroom/mambaforge/base/envs/nextstrain/lib/python3.8/site-packages/augur/clades.py", line 143, in is_node_in_clade
    state = ref[gene][pos]
IndexError: list index out of range

All files needed to reproduce are in the following tar archive (named .txt so I can upload to Github). reproduce.tar.txt

Unpack through: tar xf reproudce.tar.txt --directory .

corneliusroemer avatar Jun 07 '22 14:06 corneliusroemer

Augur clades neds quite a bit of work under the hood to make it more robust and to consider & document edge-cases in behavior. I wrote a bit about this at https://github.com/nextstrain/augur/issues/735. After reading the code I'm not surprised with bugs like the one described here. I think we'd be better served by a major lift on the code rather than a small patch over this particular bug.

jameshadfield avatar Jun 08 '22 19:06 jameshadfield