コード例 #1
0
    def test_numTopologyHistories(self):
        """numTopologyHistories"""

        tree = treelib.parseNewick("((a,b),(c,d));")
        ctree = spidir.tree2ctree(tree)
        self.assertEqual(spidir.numTopologyHistories(ctree), 2)
        self.assertEqual(numTopologyHistories(tree.root), 2)
        spidir.deleteTree(ctree)

        tree = treelib.parseNewick("(((a,b),(c,d)),(e,f));")
        ctree = spidir.tree2ctree(tree)
        self.assertEqual(spidir.numTopologyHistories(ctree), 8)
        self.assertEqual(numTopologyHistories(tree.root), 8)
        spidir.deleteTree(ctree)

        tree = treelib.parseNewick("((((a,b),(c,d)),(e,f)),g);")
        ctree = spidir.tree2ctree(tree)
        self.assertEqual(spidir.numTopologyHistories(ctree), 8)
        self.assertEqual(numTopologyHistories(tree.root), 8)
        spidir.deleteTree(ctree)

        tree = treelib.parseNewick("((((a,b),(c,d)),(e,f)),((g,h),i));")
        ctree = spidir.tree2ctree(tree)
        self.assertEqual(spidir.numTopologyHistories(ctree), 7 * 6 / 2 * 8)
        self.assertEqual(numTopologyHistories(tree.root), 7 * 6 / 2 * 8)
        spidir.deleteTree(ctree)
コード例 #2
0
ファイル: birthdeath.py プロジェクト: Watermelon876/spimap
    def test_numTopologyHistories(self):
        """numTopologyHistories"""
        
        tree = treelib.parseNewick("((a,b),(c,d));")
        ctree = spidir.tree2ctree(tree)
        self.assertEqual(spidir.numTopologyHistories(ctree), 2)
        self.assertEqual(numTopologyHistories(tree.root), 2)
        spidir.deleteTree(ctree)

        tree = treelib.parseNewick("(((a,b),(c,d)),(e,f));")
        ctree = spidir.tree2ctree(tree)
        self.assertEqual(spidir.numTopologyHistories(ctree), 8)
        self.assertEqual(numTopologyHistories(tree.root), 8)
        spidir.deleteTree(ctree)

        tree = treelib.parseNewick("((((a,b),(c,d)),(e,f)),g);")
        ctree = spidir.tree2ctree(tree)
        self.assertEqual(spidir.numTopologyHistories(ctree), 8)
        self.assertEqual(numTopologyHistories(tree.root), 8)
        spidir.deleteTree(ctree)

        tree = treelib.parseNewick("((((a,b),(c,d)),(e,f)),((g,h),i));")
        ctree = spidir.tree2ctree(tree)
        self.assertEqual(spidir.numTopologyHistories(ctree), 7*6/2*8)
        self.assertEqual(numTopologyHistories(tree.root), 7*6/2*8)
        spidir.deleteTree(ctree)
コード例 #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)
コード例 #4
0
ファイル: birthdeath.py プロジェクト: Watermelon876/spimap
    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)
コード例 #5
0
ファイル: birthdeath.py プロジェクト: Watermelon876/spimap
    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)
コード例 #6
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)