Tree options layout

Hi. I’m still submitting my dataset to nextstrain, however I would like to have clock layout available in the tree options panel.(That is not available in my case, see below)

I’m wondering if the attribute “div” in the displayed JSON is the node attribute that allows this layout. In case of augur refine calculates the divergence, I’d like to know if there was a way to use the one calculated from BEAST (Because I’m currently using a BEAST continuous phylogeography, that I’ve discretized to display it using nextstrain.)

Thanks.
Kélian

Hi @kelianP – yes Auspice uses the presence of div on nodes in the JSON to represent a divergence view.

In a typical augur workflow, augur refine produces a branch_lengths.json which augur export v2 parses to calculate the div and num_date attributes on nodes in the final (auspice) JSON. Unfortunately there is a lot of duplication in these files due to changes over the years which can make them hard to interpret! As an example:

# example branch_lengths.json 
  "nodes": {
    NODE_NAME: {
      "mutation_length": 4 # used by `augur export` to calculate (cumulative) divergence
      "branch_length": 4, # not used, but _would be used_ if 'mutation_length' not present
      "clock_length": 0.00017860867215792312, # not used
      "date": "2022-05-01", # not used
      "numdate": 2022.3301369863013, # exported. You could also use "num_date" as the key here.
      "raw_date": "2022-05-01" # not used
    },

# resulting auspice / dataset JSON
  {
    "name": NODE_NAME,
    "node_attrs": {
      "div": 33, # cumulative -- i.e. root -> this node
      "num_date": {
        "value": 2022.3301369863013
      },
      ...

It should be enough to provide a custom node-data JSON which defines the "mutation_length" for each node in the tree. If there is another node-data file which also defines this value, ensure the file you want to use is specified last (e.g. in augur export --node-data).

Let me know if this doesn’t work and I’ll look into it more!

1 Like

Hi @james - as you suggested, it is sufficient to provide a custom node data JSON that defines the "mutation_length" or the "branch_length" for each node in the tree.

Indeed, it is necessary to provide the file containing this data/attributes in the last position of the augur export --node-data arguments, and in a separate file from the geographic information of the node data.

Following your approach, I am now able to display the MCC BEAST tree under the clock layout.

Thank you very much for your help.

1 Like