示例#1
0
  private void setStatusMessage() {
    Tree tree = treesPanel.getTree();
    if (tree != null) {
      String message = "";
      message += "Tree loaded, " + tree.getTaxonCount() + " taxa";

      TemporalRooting tr = treesPanel.getTemporalRooting();
      if (tr.isContemporaneous()) {
        message += ", contemporaneous tips";
      } else {
        NumberFormatter nf = new NumberFormatter(3);
        message += ", dated tips with range " + nf.format(tr.getDateRange());
      }
      statusLabel.setText(message);
    }
  }
示例#2
0
  protected void writeTimeTreeFile(PrintStream ps) throws IOException {

    FlexibleTree tree = new FlexibleTree(treesPanel.getTreeAsViewed());

    Regression r =
        treesPanel.getTemporalRooting().getRootToTipRegression(treesPanel.getTreeAsViewed());

    for (int i = 0; i < tree.getInternalNodeCount(); i++) {
      NodeRef node = tree.getInternalNode(i);
      double height = tree.getNodeHeight(node);
      tree.setNodeHeight(node, height / r.getGradient());
    }

    TreeUtils.setHeightsFromDates(tree);

    NexusExporter nexusExporter = new NexusExporter(new PrintStream(ps));
    nexusExporter.exportTree(tree);
  }