use of dr.app.pathogen.TemporalRooting in project beast-mcmc by beast-dev.
the class OldTreesPanel method createTree.
private void createTree() {
if (generateTreeDialog == null) {
generateTreeDialog = new GenerateTreeDialog(frame);
}
int result = generateTreeDialog.showDialog(options);
if (result != JOptionPane.CANCEL_OPTION) {
GenerateTreeDialog.MethodTypes methodType = generateTreeDialog.getMethodType();
PartitionData partition = generateTreeDialog.getDataPartition();
Patterns patterns = new Patterns(partition.getAlignment());
DistanceMatrix distances = new F84DistanceMatrix(patterns);
Tree tree;
TemporalRooting temporalRooting;
switch(methodType) {
case NJ:
tree = new NeighborJoiningTree(distances);
temporalRooting = new TemporalRooting(tree);
tree = temporalRooting.findRoot(tree, TemporalRooting.RootingFunction.CORRELATION);
break;
case UPGMA:
tree = new UPGMATree(distances);
temporalRooting = new TemporalRooting(tree);
break;
default:
throw new IllegalArgumentException("unknown method type");
}
tree.setId(generateTreeDialog.getName());
options.userTrees.add(tree);
treesTableModel.fireTableDataChanged();
int row = options.userTrees.size() - 1;
treesTable.getSelectionModel().setSelectionInterval(row, row);
}
fireTreePriorsChanged();
}
use of dr.app.pathogen.TemporalRooting in project beast-mcmc by beast-dev.
the class TreeDisplayPanel method setupPanel.
private void setupPanel() {
if (tree != null) {
treePanel.setTree(tree);
TemporalRooting temporalRooting = new TemporalRooting(tree);
// Regression r = temporalRooting.getRootToTipRegression(tree);
//
// rootToTipChart.removeAllPlots();
// rootToTipChart.addPlot(new ScatterPlot(r.getXData(), r.getYData()));
// rootToTipChart.addPlot(new RegressionPlot(r));
// rootToTipChart.getXAxis().addRange(r.getXIntercept(), r.getXData().getMax());
scaledTreePanel.setTree(temporalRooting.adjustTreeToConstraints(tree, null));
} else {
treePanel.setTree(null);
// rootToTipChart.removeAllPlots();
scaledTreePanel.setTree(null);
}
repaint();
}
Aggregations