Search in sources :

Example 1 with TemporalRooting

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();
}
Also used : F84DistanceMatrix(dr.evolution.distance.F84DistanceMatrix) NeighborJoiningTree(dr.evolution.tree.NeighborJoiningTree) PartitionData(dr.app.beauti.options.PartitionData) UPGMATree(dr.evolution.tree.UPGMATree) NeighborJoiningTree(dr.evolution.tree.NeighborJoiningTree) Tree(dr.evolution.tree.Tree) TemporalRooting(dr.app.pathogen.TemporalRooting) F84DistanceMatrix(dr.evolution.distance.F84DistanceMatrix) DistanceMatrix(dr.evolution.distance.DistanceMatrix) UPGMATree(dr.evolution.tree.UPGMATree) Patterns(dr.evolution.alignment.Patterns)

Example 2 with TemporalRooting

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();
}
Also used : TemporalRooting(dr.app.pathogen.TemporalRooting)

Aggregations

TemporalRooting (dr.app.pathogen.TemporalRooting)2 PartitionData (dr.app.beauti.options.PartitionData)1 Patterns (dr.evolution.alignment.Patterns)1 DistanceMatrix (dr.evolution.distance.DistanceMatrix)1 F84DistanceMatrix (dr.evolution.distance.F84DistanceMatrix)1 NeighborJoiningTree (dr.evolution.tree.NeighborJoiningTree)1 Tree (dr.evolution.tree.Tree)1 UPGMATree (dr.evolution.tree.UPGMATree)1