use of beast.util.TreeParser in project beast2 by CompEvol.
the class TreeParserTest method testOnlyLeafLabels2.
@Test
public void testOnlyLeafLabels2() throws Exception {
String newick = "((D:5.0,C:4.0):6.0,(A:1.0,B:2.0):3.0):0.0;";
TreeParser treeParser = new TreeParser();
treeParser.initByName("IsLabelledNewick", true, "newick", newick, "adjustTipHeights", false);
String newick2 = treeParser.getRoot().toNewick();
Assert.assertEquals(newick.replaceAll(";", ""), newick2);
}
use of beast.util.TreeParser in project beast2 by CompEvol.
the class TreeParserTest method testNodeLengthMetadata.
@Test
public void testNodeLengthMetadata() throws Exception {
String newick = "((A:1.0,B[&key=42]:[&key=2.5]1.0):1.0,(C:1.0,D:1.0):1.0):0.0;";
boolean isLabeled = true;
TreeParser treeParser = new TreeParser(newick, false, false, isLabeled, 1);
Assert.assertTrue(treeParser.getNode(1).getLengthMetaData("key").equals(2.5));
Assert.assertTrue(treeParser.getNode(1).getMetaData("key").equals(42.0));
}
Aggregations