Skip to content

BUG(refine/utils): Uncaught TypeError: '<' not supported between instances of 'NoneType' and 'str' #1086

@corneliusroemer

Description

@corneliusroemer

Current Behavior

Running augur refine I get an uncaught TypeError: '<' not supported between instances of 'NoneType' and 'str'

The error is thrown by write_json from utils.py but the bug should probably be caught in refine already.

Expected behavior

Clear error message that helps me debug

How to reproduce

Here's a simple copy/paste/run reproducible example:

wget https://github.com/nextstrain/augur/files/9914307/nonetype-bug.tar.zst.txt
tar xf nonetype-bug.tar.zst.txt
augur refine             --tree results/b1/tree_fixed.nwk             --alignment results/b1/masked.fasta             --metadata results/b1/metadata.tsv             --output-tree results/b1/tree.nwk             --root ref_in_coord             --divergence-unit mutations             --keep-polytomies             --use-fft             --output-node-data results/b1/branch_lengths.json

Augur 18.1.1 with Python 3.10

cc @victorlin

augur refine is using TreeTime version 0.9.4

190.58  ***WARNING: TreeAnc._check_alignment_tree_gtr_consistency: NO SEQUENCE
        FOR LEAF: 'None'

190.58  ***WARNING: TreeAnc._check_alignment_tree_gtr_consistency: NO SEQUENCE
        FOR LEAF: 'None'

190.59  ***WARNING: TreeAnc: 2 nodes don't have a matching sequence in the
        alignment. POSSIBLE ERROR.

204.88  WARNING: Previous versions of TreeTime (<0.7.0) RECONSTRUCTED sequences
        of tips at positions with AMBIGUOUS bases. This resulted in unexpected
        behavior is some cases and is no longer done by default. If you want to
        replace those ambiguous sites with their most likely state, rerun with
        `reconstruct_tip_states=True` or `--reconstruct-tip-states`.
updated tree written to results/b1/tree.nwk
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/nextstrain/lib/python3.10/site-packages/augur/__init__.py", line 66, in run
    return args.__command__.run(args)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/nextstrain/lib/python3.10/site-packages/augur/refine.py", line 316, in run
    write_json(node_data, node_data_fname)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/nextstrain/lib/python3.10/site-packages/augur/utils.py", line 127, in write_json
    json.dump(data, handle, indent=indent, sort_keys=sort_keys)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/nextstrain/lib/python3.10/json/__init__.py", line 179, in dump
    for chunk in iterable:
  File "/opt/homebrew/Caskroom/miniforge/base/envs/nextstrain/lib/python3.10/json/encoder.py", line 431, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/nextstrain/lib/python3.10/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/opt/homebrew/Caskroom/miniforge/base/envs/nextstrain/lib/python3.10/json/encoder.py", line 353, in _iterencode_dict
    items = sorted(dct.items())
TypeError: '<' not supported between instances of 'NoneType' and 'str'


An error occurred (see above) that has not been properly handled by Augur.
To report this, please open a new issue including the original command and the error above:
    <https://github.com/nextstrain/augur/issues/new/choose>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions