Exemplo n.º 1
0
    def test_birthDeathCounts(self):
        """birthDeathCounts"""
        l = 3.0
        u = .5
        t = 1.0

        print spidir.birthDeathCount(1, t, l, u)

        for s in range(1, 10):
            for e in range(0, 10):
                p1 = spidir.birthDeathCounts(s, e, t, l, u)
                p2 = birthdeath.prob_birth_death(s, e, t, l, u)
                print s, e, p1, p2
                fequal(p1, p2, .01)
Exemplo n.º 2
0
    def test_birthDeathCounts(self):
        """birthDeathCounts"""
        l = 3.0
        u = .5
        t = 1.0

        print spidir.birthDeathCount(1, t, l, u)
        
        for s in range(1, 10):
            for e in range(0, 10):
                p1 = spidir.birthDeathCounts(s, e, t, l, u)
                p2 = birthdeath.prob_birth_death(s, e, t, l, u)
                print s, e, p1, p2
                fequal(p1, p2, .01)
Exemplo n.º 3
0
    def test_birthDeathCount(self):
        """birthDeathCount"""
        l = 3
        u = .5

        for t in frange(0, 5, .01):
            for s in range(0, 20):
                p1 = spidir.birthDeathCount(s, t, l, u)
                p2 = birthdeath.prob_birth_death1(s, t, l, u)
                fequal(p1, p2, .01)
Exemplo n.º 4
0
    def test_birthDeathCount(self):
        """birthDeathCount"""
        l = 3
        u = .5

        for t in frange(0, 5, .01):
            for s in range(0, 20):
                p1 = spidir.birthDeathCount(s, t, l, u)
                p2 = birthdeath.prob_birth_death1(s, t, l, u)
                fequal(p1, p2, .01)
Exemplo n.º 5
0
    def test_sample_birth_times(self):

        stree = read_tree("test/data/flies.stree")

        birth = 8.1
        death = 2.1 * 1.0001

        print spidir.birthDeathCount(4, .005, birth, death)
        print spidir.birthDeathCounts(1, 4, .005, birth, death)

        maxgenes = [5, 10, 20, 40, 50]
        tic("time")
        counts = [2, 2, 3, 3, 3, 2, 1, 1, 1, 3, 3, 2]
        for maxgene in maxgenes:
            logl = spidir.birth_death_tree_counts(stree,
                                                  counts,
                                                  birth,
                                                  death,
                                                  maxgene=maxgene,
                                                  rootgene=1)
            print maxgene, logl
        toc()

        counts = [1] * 12
        for maxgene in maxgenes:
            logl = spidir.birth_death_tree_counts(stree,
                                                  counts,
                                                  birth,
                                                  death,
                                                  maxgene=maxgene,
                                                  rootgene=1)
            print maxgene, logl

        counts = [4] * 12
        for maxgene in maxgenes:
            logl = spidir.birth_death_tree_counts(stree,
                                                  counts,
                                                  birth,
                                                  death,
                                                  maxgene=maxgene,
                                                  rootgene=1)
            print maxgene, logl
Exemplo n.º 6
0
    def test_sample_birth_times(self):

        stree = read_tree("test/data/flies.stree")
        
        birth = 8.1
        death = 2.1 * 1.0001

        print spidir.birthDeathCount(4, .005, birth, death)
        print spidir.birthDeathCounts(1, 4, .005, birth, death)
        

        
        maxgenes = [5, 10, 20, 40, 50]
        tic("time")
        counts = [2, 2, 3, 3, 3, 2, 1, 1, 1, 3, 3, 2]
        for maxgene in maxgenes:
            logl = spidir.birth_death_tree_counts(stree, counts,
                                                     birth, death,
                                                     maxgene=maxgene,
                                                     rootgene=1)
            print maxgene, logl
        toc()

        counts = [1] * 12
        for maxgene in maxgenes:
            logl = spidir.birth_death_tree_counts(stree, counts,
                                                     birth, death,
                                                     maxgene=maxgene,
                                                     rootgene=1)
            print maxgene, logl

                                          
        counts = [4] * 12        
        for maxgene in maxgenes:
            logl = spidir.birth_death_tree_counts(stree, counts,
                                                     birth, death,
                                                     maxgene=maxgene,
                                                     rootgene=1)
            print maxgene, logl