Esempio n. 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);
    }
  }
Esempio n. 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);
  }
Esempio n. 3
0
  protected void writeTreeFile(PrintStream ps, boolean newickFormat) throws IOException {

    Tree tree = treesPanel.getTreeAsViewed();

    //        if (newickFormat) {
    //            NewickExporter newickExporter = new NewickExporter(ps);
    //            newickExporter.exportTree(tree);
    //        } else {
    NexusExporter nexusExporter = new NexusExporter(new PrintStream(ps));
    nexusExporter.exportTree(tree);
    //        }
  }
Esempio n. 4
0
  @Override
  public void doCopy() {
    StringWriter writer = new StringWriter();
    PrintWriter pwriter = new PrintWriter(writer);

    for (String tip : treesPanel.getSelectedTips()) {
      pwriter.println(tip);
    }

    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
    StringSelection selection = new StringSelection(writer.toString());
    clipboard.setContents(selection, selection);
  }
Esempio n. 5
0
  protected void doExportData() {
    FileDialog dialog = new FileDialog(this, "Export Data File...", FileDialog.SAVE);

    dialog.setVisible(true);
    if (dialog.getFile() != null) {
      File file = new File(dialog.getDirectory(), dialog.getFile());

      Writer writer = null;
      try {
        writer = new PrintWriter(file);
        treesPanel.writeDataFile(writer);
        writer.close();
      } catch (IOException ioe) {
        JOptionPane.showMessageDialog(
            this,
            "Error writing data file: " + ioe.getMessage(),
            "Export Error",
            JOptionPane.ERROR_MESSAGE);
      }
    }
  }
Esempio n. 6
0
 public void timeScaleChanged() {
   treesPanel.timeScaleChanged();
   setStatusMessage();
 }