Search in sources :

Example 1 with F84DistanceMatrix

use of dr.evolution.distance.F84DistanceMatrix 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 F84DistanceMatrix

use of dr.evolution.distance.F84DistanceMatrix in project beast-mcmc by beast-dev.

the class DistanceMatrixParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    PatternList patterns = (PatternList) xo.getChild(PatternList.class);
    DistanceMatrix matrix = null;
    String type = xo.getStringAttribute(CORRECTION);
    if (type.equals(Nucleotides.JC)) {
        Logger.getLogger("dr.evoxml").info("Creating Jukes-Cantor distance matrix");
        matrix = new JukesCantorDistanceMatrix(patterns);
    } else if (type.equals(Nucleotides.F84)) {
        Logger.getLogger("dr.evoxml").info("Creating F84 distance matrix");
        matrix = new F84DistanceMatrix(patterns);
    } else if (type.equals("SMM")) {
        Logger.getLogger("dr.evoxml").info("Creating SMM distance matrix");
        matrix = new SMMDistanceMatrix(patterns);
    } else {
        matrix = new DistanceMatrix(patterns);
    }
    return matrix;
}
Also used : F84DistanceMatrix(dr.evolution.distance.F84DistanceMatrix) SMMDistanceMatrix(dr.evolution.distance.SMMDistanceMatrix) PatternList(dr.evolution.alignment.PatternList) F84DistanceMatrix(dr.evolution.distance.F84DistanceMatrix) JukesCantorDistanceMatrix(dr.evolution.distance.JukesCantorDistanceMatrix) DistanceMatrix(dr.evolution.distance.DistanceMatrix) SMMDistanceMatrix(dr.evolution.distance.SMMDistanceMatrix) JukesCantorDistanceMatrix(dr.evolution.distance.JukesCantorDistanceMatrix)

Aggregations

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