augur lbi CalledProcessError: returned non-zero exit status 1

Hi, Community members

My Goal
interpret the local branching index (fitness) of H7 avian influenza virus

Current Behavior
an error was met when interpreting the LBI: CalledProcessError: returned non-zero exit status 1

the error details I met:

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/lbi.py", line 102, in run
    node.attr = branch_lengths["nodes"][node.name]
KeyError: None
---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
/tmp/ipykernel_1471/351339975.py in <module>
----> 1 get_ipython().run_cell_magic('bash', '', 'augur lbi \\\n--tree H7_HA/h7n9_ha_03_iqtree_rename.tree \\\n--branch-lengths H7_HA/h7_ha_05_node_data.json \\\n--output H7_HA/h7_ha_06_lbi.json \\\n--attribute-names lbi \\\n--tau 0.25 \\\n--window 0.75\n')

~/miniconda3/envs/nst/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
   2401             with self.builtin_trap:
   2402                 args = (magic_arg_s, cell)
-> 2403                 result = fn(*args, **kwargs)
   2404             return result
   2405 

~/miniconda3/envs/nst/lib/python3.8/site-packages/IPython/core/magics/script.py in named_script_magic(line, cell)
    140             else:
    141                 line = script
--> 142             return self.shebang(line, cell)
    143 
    144         # write a basic docstring:

<decorator-gen-103> in shebang(self, line, cell)

~/miniconda3/envs/nst/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

~/miniconda3/envs/nst/lib/python3.8/site-packages/IPython/core/magics/script.py in shebang(self, line, cell)
    243             sys.stderr.flush()
    244         if args.raise_error and p.returncode!=0:
--> 245             raise CalledProcessError(p.returncode, cell, output=out, stderr=err)
    246 
    247     def _run_script(self, p, cell, to_close):

CalledProcessError: Command 'b'augur lbi \\\n--tree H7_HA/h7n9_ha_03_iqtree_rename.tree \\\n--branch-lengths H7_HA/h7_ha_05_node_data.json \\\n--output H7_HA/h7_ha_06_lbi.json \\\n--attribute-names lbi \\\n--tau 0.25 \\\n--window 0.75\n'' returned non-zero exit status 1.

how did I get the h7_ha_05_node_data.json file

%%bash
augur refine \
-a H7_HA/h7_ha_02_align.fasta \
-t H7_HA/h7n9_ha_03_iqtree_rename.tree \
--metadata H7_HA/h7_ha_metadate.tsv \
--timetree \
--output-tree H7_HA/h7_ha_05_refine_tree.nwk \
--output-node-data H7_HA/h7_ha_05_node_data.json \
--branch-length-inference auto

how the h7_ha_05_node_data.json looks like

Expected behavior
a json file

How to reproduce
Steps to reproduce the current behavior:

  1. Open / run jupyter-lab
  2. augur refine to get the json file meet the demand --branch-lengths
  3. augur lbi, see the detail below
%%bash
augur lbi \
--tree H7_HA/h7_ha_05_refine_tree.nwk \
--branch-lengths H7_HA/h7_ha_05_node_data.json \
--output H7_HA/h7_ha_06_lbi.json \
--attribute-names lbi \
--tau 0.25 \
--window 0.75 
  1. See error

Your environment: if running Nextstrain locally

  • Operating system: Ubuntu 20.04.2 LTS
  • Browser: Chrome Version 91
  • Version: augur 12.0.0

Any help would be greatly appreciated!
Yang

Hi, in augur lbi use the tree.nwk obtained from the --output-tree option in augur refine.

I just tried and I got the same error

node.attr = branch_lengths["nodes"][node.name] line 102 of lbi.py

when using the tree_raw.nwk from augur tree, while it worked when using the tree.nwk from augur refine.

Hi, babarlelephant
Thanks for your reply.
It’s worked since I build the tree with nextstrain rather than import the tree from another program.

Thank you very much.

glad you could solve it. augur refine labels all nodes and such that later steps have a common set of node names to refer to. That is why the “refined” tree is necessary.