def nllk_drate_fix_drate_times_b(dRate, multiAlign, dRateTimesTreeTotalBranchLength, tree, qMat, piProb, cList, qRates=[1.]): """ negative log-likelihood for rate = (iRate, dRate) based on PIP """ if dRate <= 0: return 1.e10 seqNames = multiAlign.keys() mLen = len(multiAlign.values()[0]) treeScaled = copy.deepcopy(tree) treeScaled.scale_edges(dRateTimesTreeTotalBranchLength / (dRate * tree.length())) # print treeScaled.length() # print dRate # print treeScaled.length() * dRate pc0 = pc0_from_dRate_and_tree(dRate, seqNames, treeScaled, qMat, piProb, cList, qRates) iRate = mle_irate_given_drate(dRate, treeScaled, pc0, mLen) nllk = -logprob_msa(multiAlign, treeScaled, qMat, piProb, iRate, dRate, cList, qRates) # print nllk return nllk
def nllk_rate(rate, multiAlign, tree, qMat, piProb, cList): """ negative log-likelihood for rate = (iRate, dRate) based on PIP """ iRate, dRate = rate if iRate <= 0 or dRate <= 0: return 1.e10 nllk = - logprob_msa(multiAlign, tree, qMat, piProb, iRate, dRate, cList) return nllk
def nllk_rate(rate, multiAlign, tree, qMat, piProb, cList): """ negative log-likelihood for rate = (iRate, dRate) based on PIP """ iRate, dRate = rate if iRate <= 0 or dRate <= 0: return 1.e10 nllk = -logprob_msa(multiAlign, tree, qMat, piProb, iRate, dRate, cList) return nllk
def nllk_drate(dRate, multiAlign, tree, qMat, piProb, cList, qRates=[1.]): """ negative log-likelihood for rate = (iRate, dRate) based on PIP """ if dRate <= 0: return 1.e10 seqNames = multiAlign.keys() mLen = len(multiAlign.values()[0]) pc0 = pc0_from_dRate_and_tree(dRate, seqNames, tree, qMat, piProb, cList, qRates) iRate = mle_irate_given_drate(dRate, tree, pc0, mLen) nllk = - logprob_msa(multiAlign, tree, qMat, piProb, iRate, dRate, cList, qRates) return nllk
def nllk_drate(dRate, multiAlign, tree, qMat, piProb, cList, qRates=[1.]): """ negative log-likelihood for rate = (iRate, dRate) based on PIP """ if dRate <= 0: return 1.e10 seqNames = multiAlign.keys() mLen = len(multiAlign.values()[0]) pc0 = pc0_from_dRate_and_tree(dRate, seqNames, tree, qMat, piProb, cList, qRates) iRate = mle_irate_given_drate(dRate, tree, pc0, mLen) nllk = -logprob_msa(multiAlign, tree, qMat, piProb, iRate, dRate, cList, qRates) return nllk
def nllk_drate_fix_drate_times_b(dRate, multiAlign, dRateTimesTreeTotalBranchLength, tree, qMat, piProb, cList, qRates=[1.]): """ negative log-likelihood for rate = (iRate, dRate) based on PIP """ if dRate <= 0: return 1.e10 seqNames = multiAlign.keys() mLen = len(multiAlign.values()[0]) treeScaled = copy.deepcopy(tree) treeScaled.scale_edges(dRateTimesTreeTotalBranchLength / (dRate * tree.length())) # print treeScaled.length() # print dRate # print treeScaled.length() * dRate pc0 = pc0_from_dRate_and_tree(dRate, seqNames, treeScaled, qMat, piProb, cList, qRates) iRate = mle_irate_given_drate(dRate, treeScaled, pc0, mLen) nllk = - logprob_msa(multiAlign, treeScaled, qMat, piProb, iRate, dRate, cList, qRates) # print nllk return nllk