# Path: phydmslib/constants.py
# N_CODON = len(CODON_TO_INDEX)
# 
# N_NT = len(INDEX_TO_NT)
# 
# AA_TO_INDEX = {aa: i for (i, aa) in INDEX_TO_AA.items()}
# 
# N_AA = len(INDEX_TO_AA)
# 
# CODON_NT_COUNT = numpy.zeros((N_NT, N_CODON), dtype='int')


import random
import unittest
import scipy.linalg
import scipy.optimize
import numpy
import phydmslib.models
from phydmslib.constants import (N_CODON, N_NT, AA_TO_INDEX, N_AA,
                                 CODON_NT_COUNT)
"""Tests `phydmslib.models.ExpCM_empirical_phi_divpressure` class.

Written by Jesse Bloom.
Edited by Sarah Hilton
"""




class test_compare_ExpCM_emp_phi_with_without_divpress(unittest.TestCase):
    """Tests ``ExpCM`` with and without div pressure."""

    def test_compare(self):
        """Make sure all attributes are the same when `divpressure` is 0."""
        random.seed(1)
        numpy.random.seed(1)

        nsites = 6
        prefs = []
        minpref = 0.01
        for _r in range(nsites):
            rprefs = numpy.random.dirichlet([0.5] * N_AA)
            rprefs[rprefs < minpref] = minpref
            rprefs /= rprefs.sum()

# Path: phydmslib/constants.py
# N_CODON = len(CODON_TO_INDEX)
# 
# N_NT = len(INDEX_TO_NT)
# 
# AA_TO_INDEX = {aa: i for (i, aa) in INDEX_TO_AA.items()}
# 
# N_AA = len(INDEX_TO_AA)
# 
# CODON_NT_COUNT = numpy.zeros((N_NT, N_CODON), dtype='int')


# Path: tests/test_expcm_divpressure.py
import random
import unittest
import scipy.linalg
import scipy.optimize
import numpy
import phydmslib.models
from phydmslib.constants import (N_CODON, N_NT, AA_TO_INDEX, N_AA,
                                 CODON_NT_COUNT)

"""Tests `phydmslib.models.ExpCM_empirical_phi_divpressure` class.

Written by Jesse Bloom.
Edited by Sarah Hilton
"""




class test_compare_ExpCM_emp_phi_with_without_divpress(unittest.TestCase):
    """Tests ``ExpCM`` with and without div pressure."""

    def test_compare(self):
        """Make sure all attributes are the same when `divpressure` is 0."""
        random.seed(1)
        numpy.random.seed(1)

        nsites = 6
        prefs = []
        minpref = 0.01
        for _r in range(nsites):
            rprefs = numpy.random.dirichlet([0.5] * N_AA)
            rprefs[rprefs < minpref] = minpref
            rprefs /= rprefs.sum()

            prefs.append(dict(zip(sorted(AA_TO_INDEX.keys()), rprefs)))