Incorperating `argur distance` outputs

Hi
I have been using augur distance to generate a distance matrix for my data using the --compare-to pairwise argument. This is producing a sensible .json output. What I haven’t been able to work out is how to incorporate the information into the .json file for auspice visualization. When I provide the distance.json to augur export v2 via --node-data the distance information isn’t included in the output .json. Any help would be much appreciated.

Hmm, it should be - could you post a section of the “nodes” section of the node-data file you are getting from augur distance and we’ll take a look…

Thanks @james. Here’s a snippet of the output I’m getting:

"nodes": {
    "AF-12-00295-18": {
      "nuc_pairwise": {
        "AF-12-00295-18": 0,
        "AF-12-00718-20": 143,
        "AF-12-00854-20": 147,
        "AF-21-01019-20": 150,
        "AF-21-05026-19": 150,
        "AF-21-05164-20": 148,
        "AF-21-05499-19": 149,
        "AF-21-05570-20": 149,
        "AF-21-05582-20": 149,
        "AF-21-06456-19": 142,
        "AF-21-06494-18": 145,
        "AF-21-07283-18": 145,
        "AF-21-07955-19": 143,
        "AF-21-08209-18": 148,
        "AF-61-01011-12": 146,
        "AF-61-01239-17": 142,
        "AF-61-01240-17": 143,
        "AF-61-01241-17": 162,
        "AF-61-01739-20": 149,
        "AF-61-03390-12": 154,
        "AFT-21-05137-22": 143,
        "AFT-21-05138-22": 143,
        "AFT-21-05139-22": 143,
        "AFT-21-05597-21": 145,
        "AFT-21-06266-22": 142,
        "AFT-21-07052-21": 143,
        "AFT-61-03665-21": 145,
        "AFT-61-03666-21": 145,
        "AFT-61-04335-21": 144
      }
    },
    "AF-12-00718-20": {
      "nuc_pairwise": {
        "AF-12-00295-18": 143,
        "AF-12-00718-20": 0,
        "AF-12-00854-20": 14,
        "AF-21-01019-20": 17,
        "AF-21-05026-19": 15,
        "AF-21-05164-20": 15,
        "AF-21-05499-19": 14,
        "AF-21-05570-20": 16,
        "AF-21-05582-20": 16,
        "AF-21-06456-19": 1,
        "AF-21-06494-18": 12,
        "AF-21-07283-18": 12,
        "AF-21-07955-19": 8,
        "AF-21-08209-18": 13,
        "AF-61-01011-12": 11,
        "AF-61-01239-17": 1,
        "AF-61-01240-17": 2,
        "AF-61-01241-17": 21,
        "AF-61-01739-20": 16,
        "AF-61-03390-12": 19,
        "AFT-21-05137-22": 8,
        "AFT-21-05138-22": 8,
        "AFT-21-05139-22": 8,
        "AFT-21-05597-21": 12,
        "AFT-21-06266-22": 9,
        "AFT-21-07052-21": 8,
        "AFT-61-03665-21": 10,
        "AFT-61-03666-21": 10,
        "AFT-61-04335-21": 3
      }
    },

I’m starting to think it’s something to do with the attribute name but can’t figure it out. When I use this as input for augur export I get the following error suggesting that the node_attr is invalid:

Traceback (most recent call last):
  File "/home/richardellis/miniconda3/envs/nextstrain/lib/python3.10/site-packages/augur/__init__.py", line 66, in run
    return args.__command__.run(args)
  File "/home/richardellis/miniconda3/envs/nextstrain/lib/python3.10/site-packages/augur/export_v2.py", line 1027, in run
    set_colorings(
  File "/home/richardellis/miniconda3/envs/nextstrain/lib/python3.10/site-packages/augur/export_v2.py", line 426, in set_colorings
    colorings = [c for c in colorings if _is_valid(c)]
  File "/home/richardellis/miniconda3/envs/nextstrain/lib/python3.10/site-packages/augur/export_v2.py", line 426, in <listcomp>
    colorings = [c for c in colorings if _is_valid(c)]
  File "/home/richardellis/miniconda3/envs/nextstrain/lib/python3.10/site-packages/augur/export_v2.py", line 373, in _is_valid
    trait_values = get_values_across_nodes(node_attrs, key) # e.g. list of countries, regions etc
  File "/home/richardellis/miniconda3/envs/nextstrain/lib/python3.10/site-packages/augur/export_v2.py", line 186, in get_values_across_nodes
    vals.add(data.get(key))
TypeError: unhashable type: 'dict'

Yeah, augur export is expecting something more like the following:

"nodes": {
    "AF-12-00295-18": {
      "some_single_distance_value": 123.456,
      "potentially_another_value": 78.9
    }

I didn’t write augur distance so I’ll ask internally and see what’s going on here.

Thinking more broadly, how would you want/expect pairwise values to be represented on a tree? It’s not clear to me how you would do it. I could imagine a colouring like “distance of nodes away from X”, but not pairwise…

Thanks for the update. To be fair, I didn’t have any expectations and was mainly interested to see how this information would be displayed, so it would be good to get some understanding of what was envisaged from whoever wrote this functionality. We use SNP-distance values to suggest linked cases, so if could be incorporated into the display somehow it could be useful for our use case