Tree.py
def greedy_loglikelihood(cls, helper, tree, data=None):
        "Gets maximum likelihood of a tree"
        nodes_list = tree.phylogeny.get_cached_content()
        node_genotypes = [
            [0 for j in range(helper.mutations)]
            for i in range(len(nodes_list))
        ]

        for i, n in enumerate(nodes_list):
            n.get_genotype_profile(node_genotypes[i])

        maximum_likelihood = 0

        for i in range(helper.cells):
            best_sigma = -1
            best_lh = float("-inf")

            for n in range(len(nodes_list)):
                lh = 0
                for j in range(helper.mutations):
                    p = Op.prob(helper.matrix[i][j], node_genotypes[n][j], node_genotypes, helper, tree, data)
                    lh += math.log(p)

                if lh > best_lh:
                    best_sigma = n
                    best_lh = lh
            tree.best_sigma[i] = best_sigma
            maximum_likelihood += best_lh

        return maximum_likelihood
Gets maximum likelihood of a tree
Gets maximum likelihood of a tree
Gets maximum likelihood of a tree
def greedy_loglikelihood(cls, helper, tree, data=None):
        nodes_list = tree.phylogeny.get_cached_content()
        node_genotypes = [
            [0 for j in range(helper.mutations)]
            for i in range(len(nodes_list))
        ]
        for i, n in enumerate(nodes_list):
            n.get_genotype_profile(node_genotypes[i])
        maximum_likelihood = 0
        for i in range(helper.cells):
            best_sigma = -1
            best_lh = float("-inf")
            for n in range(len(nodes_list)):
                lh = 0
                for j in range(helper.mutations):
                    p = Op.prob(helper.matrix[i][j], node_genotypes[n][j], node_genotypes, helper, tree, data)
                    lh += math.log(p)
                if lh > best_lh:
                    best_sigma = n
                    best_lh = lh
            tree.best_sigma[i] = best_sigma
            maximum_likelihood += best_lh
        return maximum_likelihood
def greedy_loglikelihood ( cls , helper , tree , data = None ) : nodes_list = tree . phylogeny . get_cached_content ( ) node_genotypes = [ [ 0 for j in range ( helper . mutations ) ] for i in range ( len ( nodes_list ) ) ] for i , n in enumerate ( nodes_list ) : n . get_genotype_profile ( node_genotypes [ i ] ) maximum_likelihood = 0 for i in range ( helper . cells ) : best_sigma = - 1 best_lh = float ( "-inf" ) for n in range ( len ( nodes_list ) ) : lh = 0 for j in range ( helper . mutations ) : p = Op . prob ( helper . matrix [ i ] [ j ] , node_genotypes [ n ] [ j ] , node_genotypes , helper , tree , data ) lh += math . log ( p ) if lh > best_lh : best_sigma = n best_lh = lh tree . best_sigma [ i ] = best_sigma maximum_likelihood += best_lh return maximum_likelihood
Gets maximum likelihood of a tree
Gets maximum likelihood of a tree
"Gets maximum likelihood of a tree"
cls
helper
tree
data