Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of proposed changes
Sets branch length to the difference in divergence between each node and its parent instead of setting the cumulative branch length from the root of the tree. Auspice JSONs store the cumulative branch length for easier plotting in Auspice, but when we import the JSON into Python as a tree, the branch length should not be cumulative. Since this cumulative branch length is useful on its own and also required for calculating the actual branch length (in the current recursive implementation of
json_to_tree
, at least), this commit adds acumulative_branch_length
attribute to each node of the tree produced byjson_to_tree
and passes this value as a new optional argument to recursive calls.We should really reimplement this function as a non-recursive function, though. See the cartography script for annotating Auspice JSONs, for an example of this kind of non-cursive implementation.
Related issue(s)
Fixes #714
Testing