nextstrain/seasonal-flu

Divergence tree does not display properly on the x-axis for nextflu site

huddlej opened this issue · 4 comments

Current Behavior
The time tree view on nextflu works as expected:

image

When one deselects the "timetree" option to view the divergence tree, the tree collapses to one position on the x-axis:

image

Expected behavior

The divergence view should show the branch length in divergence along the x-axis.

How to reproduce
Steps to reproduce the current behavior:

  1. Navigate to nextflu site
  2. Deselect "timetree" checkbox under "Options" in the left-hand navigation

Additional context

It is not clear if this issue is with the seasonal-flu build's tree JSONs or the nextflu code itself. In the latter case, we should transfer this issue to the nextflu repository.

The seasonal-flu build's tree JSONs are missing the xvalue attribute leading to a NaN value in the nextflu code.
The xvalue attribute should be included in the augur v1 export, but it's not guaranteed since it's technically a deprecated attribute.

Great catch! Would it be reasonable to update the calculation of branch lengths in nextflu to use the branch_length attribute we export in the auspice JSONs instead of the missing xvalue parameter?

We probably don't want to start exporting a deprecated field just for nextflu and updating the nextflu code would allow all existing datasets to work as they are without regenerating them...

When the "timetree" is off, the d3 x value gets assigned to the xvalue. So all downstream d3 transformations error out with the NaN x value.

If I assign the d3 x value to node.attr['div'], this results in a divergence view with no gridlines. From what I can see, the drawGrid() function only applies to the timetree view. Is this the expected behavior?

Screen Shot 2021-04-21 at 10 21 55 AM

Edit: see blab/nextflu#154