Skip to content

Commit

Permalink
avoid code duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
rambaut committed Nov 4, 2024
1 parent c765cb3 commit 854e465
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/dr/app/tools/newtreeannotator/TreeAnnotator.java
Original file line number Diff line number Diff line change
Expand Up @@ -465,11 +465,7 @@ private Tree getMCCTree(int burnin, CladeSystem cladeSystem, String inputFileNam
progressStream.println();
progressStream.println("Best tree: " + bestTree.getId() + " (tree number " + bestTreeNumber + ")");
progressStream.println("Best tree's log clade credibility: " + String.format("%.4f", bestScore));
progressStream.println("Lowest individual clade credibility: " + String.format("%.4f", cladeSystem.getMinimumCladeCredibility(bestTree)));
progressStream.println("Mean individual clade credibility: " + String.format("%.4f", cladeSystem.getMeanCladeCredibility(bestTree)));
progressStream.println("Number of clades with credibility 1.0: " + cladeSystem.getTopCladeCredibility(bestTree, 1.0));
progressStream.println("Number of clades with credibility >= 0.95: " + cladeSystem.getTopCladeCredibility(bestTree, 0.95));
progressStream.println("Number of clades with credibility >= 0.5: " + cladeSystem.getTopCladeCredibility(bestTree, 0.5));
reportStatistics(cladeSystem, bestTree);
progressStream.println();

return bestTree;
Expand All @@ -487,13 +483,18 @@ private MutableTree getHIPSTRTree(CladeSystem cladeSystem) {
progressStream.println("[" + timeElapsed + " secs]");
progressStream.println();
progressStream.println("HIPSTR tree's log clade credibility: " + String.format("%.4f", score));
reportStatistics(cladeSystem, tree);
progressStream.println();

return tree;
}

private static void reportStatistics(CladeSystem cladeSystem, Tree tree) {
progressStream.println("Lowest individual clade credibility: " + String.format("%.4f", cladeSystem.getMinimumCladeCredibility(tree)));
progressStream.println("Mean individual clade credibility: " + String.format("%.4f", cladeSystem.getMeanCladeCredibility(tree)));
progressStream.println("Number of clades with credibility 1.0: " + cladeSystem.getTopCladeCredibility(tree, 1.0));
progressStream.println("Number of clades with credibility > 0.95: " + cladeSystem.getTopCladeCredibility(tree, 0.95));
progressStream.println("Number of clades with credibility > 0.5: " + cladeSystem.getTopCladeCredibility(tree, 0.5));
progressStream.println();

return tree;
}

private void annotateTargetTree(CladeSystem cladeSystem, HeightsSummary heightsOption, MutableTree targetTree) {
Expand Down

0 comments on commit 854e465

Please sign in to comment.