MCPcopy Create free account
hub / github.com/rambaut/figtree / nodeLengthsToHeights

Method nodeLengthsToHeights

src/figtree/treeviewer/ReRootedTree.java:528–541  ·  view source on GitHub ↗

Set the node heights from the current node branch lengths. Actually sets distance from root so the heights then need to be reversed.

(ReRootedNode node, double height)

Source from the content-addressed store, hash-verified

526 * sets distance from root so the heights then need to be reversed.
527 */
528 private void nodeLengthsToHeights(ReRootedNode node, double height) {
529
530 double newHeight = height;
531
532 if (node.getLength() > 0.0) {
533 newHeight += node.getLength();
534 }
535
536 node.setHeight(newHeight);
537
538 for (Node child : node.getChildren()) {
539 nodeLengthsToHeights((ReRootedNode)child, newHeight);
540 }
541 }
542
543 /**
544 * Calculate branch lengths from the current node heights.

Callers 1

calculateNodeHeightsMethod · 0.95

Calls 3

getLengthMethod · 0.45
setHeightMethod · 0.45
getChildrenMethod · 0.45

Tested by

no test coverage detected