Error: augur clades\ KeyError: 'muts'

Hi, community members.

When I performed the augur clades with the below commands, I met an error: KeyError: 'muts'.

!augur clades \
--tree H7N9_HA_454/o5_ha_refined_tree.newick \
--mutations H7N9_HA_454/o9_ha_mutations.json \
--reference H7N9_HA_454/reference_SH02.fasta \
--clades H7N9_HA_454/clades.tsv \
--output-node-data H7N9_HA_454/o11_ha_clades.json

Error I got

Validating schema of 'H7N9_HA_454/o9_ha_mutations.json'...
Traceback (most recent call last):
  File "/home/yzu/miniconda3/envs/nst/bin/augur", line 10, in <module>
    sys.exit(main())
  File "/home/yzu/miniconda3/envs/nst/lib/python3.8/site-packages/augur/__main__.py", line 10, in main
    return augur.run( argv[1:] )
  File "/home/yzu/miniconda3/envs/nst/lib/python3.8/site-packages/augur/__init__.py", line 75, in run
    return args.__command__.run(args)
  File "/home/yzu/miniconda3/envs/nst/lib/python3.8/site-packages/augur/clades.py", line 208, in run
    clade_membership = assign_clades(clade_designations, all_muts, tree, ref)
  File "/home/yzu/miniconda3/envs/nst/lib/python3.8/site-packages/augur/clades.py", line 126, in assign_clades
    for mut in all_muts[node.name]['muts']:
KeyError: 'muts'

I guess this error may be triggered by my metadate (clades.tsv or something else).
But I don’t have a clue to solve it. The code in Github.
Any help would be greatly appreciated.

Best,
Yang

Hi Yang,

the augur clades command needs the inferred nucleotide mutations in addition to the mutations in HA. There should be a command augur ancestral somewhere in your workflow that produces this additional file. This is necessary since the clade definitions include both mutations in HA and mutations in the nucleotide sequence.

best,
richard

Hi, Richard

Thank you very much. You saved me AGAIN. I solved it under your instruction.

!augur clades \
--tree H7N9_HA_454/o5_ha_refined_tree.newick \
--mutations H7N9_HA_454/o8_ha_ancestor.json H7N9_HA_454/o9_ha_mutations.json \
--reference H7N9_HA_454/reference_SH02.fasta \
--clades H7N9_HA_454/clades.tsv \
--output-node-data H7N9_HA_454/o11_ha_clades.json

the --mutations paramater nedd two inputs, which are {input.nuc_muts}=o8_ha_ancestor.json {input.aa_muts}=o9_ha_mutations.json

For other user
https://docs.nextstrain.org/projects/augur/en/stable/faq/clades.html

Thanks again.
Best wishes,
Yang