use of beast.util.TreeParser in project beast2 by CompEvol.
the class BEASTTestCase method getTree.
public static Tree getTree(Alignment data) throws Exception {
TreeParser tree = new TreeParser();
tree.initByName("taxa", data, "newick", "((((human:0.024003,(chimp:0.010772,bonobo:0.010772):0.013231):0.012035,gorilla:0.036038):0.033087000000000005,orangutan:0.069125):0.030456999999999998,siamang:0.099582);", "IsLabelledNewick", true);
return tree;
}
use of beast.util.TreeParser in project beast2 by CompEvol.
the class UncertainAlignmentTest method getTreeB.
public static Tree getTreeB(Alignment data) throws Exception {
TreeParser tree = new TreeParser();
tree.initByName("taxa", data, "newick", "(seq1:2,(seq2:1,seq3:1):1);", "IsLabelledNewick", true);
return tree;
}
use of beast.util.TreeParser in project beast2 by CompEvol.
the class TreeParserTest method testFullyLabelledWithIntegers.
@Test
public void testFullyLabelledWithIntegers() {
String newick = "((0:1.0,1:1.0)4:1.0,(2:1.0,3:1.0)5:1.0)6:0.0;";
try {
boolean isLabeled = false;
TreeParser treeParser = new TreeParser(newick, false, false, isLabeled, 0);
treeParser.offsetInput.setValue(0, treeParser);
Assert.assertEquals(newick.split(";")[0], treeParser.getRoot().toShortNewick(true));
} catch (Exception e) {
// To change body of catch statement use File | Settings | File Templates. \
e.printStackTrace();
Assert.assertTrue("Exception!", false);
}
}
use of beast.util.TreeParser in project beast2 by CompEvol.
the class TreeParserTest method testInternalNodeLabels.
@Test
public void testInternalNodeLabels() throws Exception {
String newick = "((xmr),((knw)ctm));";
boolean isLabeled = true;
TreeParser treeParser = new TreeParser(newick, false, true, isLabeled, 0, false);
Assert.assertTrue(treeParser.getNode(0).getID().equals("knw"));
Assert.assertTrue(treeParser.getNode(1).getID().equals("xmr"));
Assert.assertTrue(treeParser.getNode(0).getParent().getID().equals("ctm"));
Assert.assertTrue(treeParser.getNode(1).getParent().getID() == null);
}
use of beast.util.TreeParser in project beast2 by CompEvol.
the class TreeParserTest method testVectorMetadata.
@Test
public void testVectorMetadata() throws Exception {
String newick = "((A:1.0,B[&key={1,2,3}]: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).getMetaData("key") instanceof Double[]) && ((Double[]) (treeParser.getNode(1).getMetaData("key"))).length == 3);
}
Aggregations