Example #1
0
    def test_make_trees(self):
        """makeTree"""
        tree = treelib.parse_newick("((a,b),(c,d));")
        ctree = spidir.tree2ctree(tree)
        spidir.deleteTree(ctree)

        ctree = spidir.ptree2ctree([3,3,4,4,-1])
        spidir.deleteTree(ctree)

        ctree = spidir.makeTree(5, spidir.c_list(spidir.c_int, [3,3,4,4,-1]))
        spidir.deleteTree(ctree)
Example #2
0
    def test_make_trees(self):
        """makeTree"""
        tree = treelib.parse_newick("((a,b),(c,d));")
        ctree = spidir.tree2ctree(tree)
        spidir.deleteTree(ctree)

        ctree = spidir.ptree2ctree([3, 3, 4, 4, -1])
        spidir.deleteTree(ctree)

        ctree = spidir.makeTree(5, spidir.c_list(spidir.c_int,
                                                 [3, 3, 4, 4, -1]))
        spidir.deleteTree(ctree)
Example #3
0
    def assert_doom_table(self, tree, l, u, maxdoom):
        ctree = spidir.tree2ctree(tree)
        ptree, nodes, nodelookup = spidir.make_ptree(tree)

        treelib.draw_tree(tree, scale=10)

        doomtable = [0] * len(tree.nodes)
        doomtable = spidir.c_list(ctypes.c_double, doomtable)
        spidir.calcDoomTable(ctree, l, u, maxdoom, doomtable)
        spidir.deleteTree(ctree)

        doomtable2 = calc_doom_table(tree, l, u, maxdoom)

        print list(doomtable)
        print doomtable2

        for i, j in zip(doomtable, doomtable2):
            fequal(i, j)
Example #4
0
    def assert_doom_table(self, tree, l, u, maxdoom):
        ctree = spidir.tree2ctree(tree)
        ptree, nodes, nodelookup = spidir.make_ptree(tree)        

        treelib.draw_tree(tree, scale=10)

        doomtable = [0] * len(tree.nodes)
        doomtable = spidir.c_list(ctypes.c_double, doomtable)
        spidir.calcDoomTable(ctree, l, u, maxdoom, doomtable)
        spidir.deleteTree(ctree)
        
        doomtable2 = calc_doom_table(tree, l, u, maxdoom)
        
        print list(doomtable)        
        print doomtable2

        for i, j in zip(doomtable, doomtable2):            
            fequal(i, j)