def get_mixture(cls,
         log_counts, codon_distn,
         ts, tv, syn, nonsyn, compo, asym_compo,
         natural_theta,
         ):
     """
     @return: finite_distn, pre_Q_matrices
     """
     cls.check_theta(natural_theta)
     p0 = natural_theta[0]
     p1 = 1 - p0
     first_omega = natural_theta[1]
     second_omega = natural_theta[2]
     kappa = natural_theta[3]
     nt_distn = markovutil.ratios_to_distn(natural_theta[4:4+3])
     first_pre_Q = fmutsel.get_pre_Q(
             log_counts,
             fmutsel.genic_fixation,
             ts, tv, syn, nonsyn, compo, asym_compo,
             nt_distn, kappa, first_omega,
             )
     second_pre_Q = fmutsel.get_pre_Q(
             log_counts,
             fmutsel.genic_fixation,
             ts, tv, syn, nonsyn, compo, asym_compo,
             nt_distn, kappa, second_omega,
             )
     return (p0, p1), (first_pre_Q, second_pre_Q)
 def get_distn(cls,
         log_counts, codon_distn,
         ts, tv, syn, nonsyn, compo, asym_compo,
         natural_theta,
         ):
     cls.check_theta(natural_theta)
     nt_distn = markovutil.ratios_to_distn(natural_theta[2:5])
     codon_distn = codon1994.get_f1x4_codon_distn(compo, nt_distn)
     return codon_distn
 def get_pre_Q(cls, log_counts, codon_distn, ts, tv, syn, nonsyn, compo, asym_compo, natural_theta):
     cls.check_theta(natural_theta)
     kimura_d = natural_theta[0]
     kappa = natural_theta[1]
     omega = natural_theta[2]
     nt_distn = markovutil.ratios_to_distn(natural_theta[3:6])
     pre_Q = fmutsel.get_pre_Q_unconstrained(
         log_counts, ts, tv, syn, nonsyn, compo, asym_compo, kimura_d, nt_distn, kappa, omega
     )
     return pre_Q
 def get_pre_Q(cls,
         log_counts, codon_distn,
         ts, tv, syn, nonsyn, compo, asym_compo,
         natural_theta,
         ):
     cls.check_theta(natural_theta)
     kappa = natural_theta[0]
     omega = natural_theta[1]
     nt_distn = markovutil.ratios_to_distn(natural_theta[2:5])
     pre_Q = codon1994.get_MG_pre_Q(
             ts, tv, syn, nonsyn, asym_compo,
             nt_distn, kappa, omega)
     return pre_Q
 def get_pre_Q(cls,
         log_counts, codon_distn,
         ts, tv, syn, nonsyn, compo, asym_compo,
         natural_theta,
         ):
     cls.check_theta(natural_theta)
     kappa = natural_theta[0]
     omega = natural_theta[1]
     nt_distn = markovutil.ratios_to_distn(natural_theta[2:5])
     pre_Q = fmutsel.get_pre_Q(
             log_counts,
             fmutsel.preferred_recessive_fixation,
             ts, tv, syn, nonsyn, compo, asym_compo,
             nt_distn, kappa, omega,
             )
     return pre_Q
 def get_pre_Q(cls,
         log_counts, codon_distn,
         ts, tv, syn, nonsyn, compo, asym_compo,
         natural_theta,
         ):
     cls.check_theta(natural_theta)
     first_proportion = natural_theta[0]
     first_omega = natural_theta[1]
     second_omega = natural_theta[2]
     kappa = natural_theta[3]
     nt_distn = markovutil.ratios_to_distn(natural_theta[4:4+3])
     pre_Q = fmutsel.get_pre_Q(
             log_counts,
             fmutsel.genic_fixation,
             ts, tv, syn, nonsyn, compo, asym_compo,
             nt_distn, kappa, omega,
             )
     return pre_Q
 def get_mixture(cls,
         log_counts, codon_distn,
         ts, tv, syn, nonsyn, compo, asym_compo,
         natural_theta,
         ):
     cls.check_theta(natural_theta)
     p0 = natural_theta[0]
     p1 = 1 - p0
     first_omega = natural_theta[1]
     second_omega = natural_theta[2]
     kimura_d = natural_theta[3]
     kappa = natural_theta[4]
     nt_distn = markovutil.ratios_to_distn(natural_theta[5:5+3])
     first_pre_Q = fmutsel.get_pre_Q_unconstrained(
             log_counts,
             ts, tv, syn, nonsyn, compo, asym_compo,
             kimura_d, nt_distn, kappa, first_omega,
             )
     second_pre_Q = fmutsel.get_pre_Q_unconstrained(
             log_counts,
             ts, tv, syn, nonsyn, compo, asym_compo,
             kimura_d, nt_distn, kappa, second_omega,
             )
     return (p0, p1), (first_pre_Q, second_pre_Q)