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();
}
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;
}
Aggregations