# Path: phydmslib/constants.py
# N_NT = len(INDEX_TO_NT)
# 
# N_AA = len(INDEX_TO_AA)
# 
# AA_TO_INDEX = {aa: i for (i, aa) in INDEX_TO_AA.items()}


import os
import numpy
import unittest
import random
import phydmslib.models
import phydmslib.treelikelihood
import phydmslib.simulate
import Bio.SeqIO
import Bio.Phylo
import pyvolve
from phydmslib.constants import N_NT, N_AA, AA_TO_INDEX
"""Tests branch scaling.

Makes sure we can correctly re-scale branch lengths into
units of substitutions per site.

Written by Jesse Bloom.
"""



class test_branchScale_ExpCM(unittest.TestCase):
    """Tests `branchScale` of `ExpCM_empirical_phi` model."""

    # use approach here to run multiple tests:
    # http://stackoverflow.com/questions/17260469/instantiate-python-unittest-testcase-with-arguments
    MODEL = phydmslib.models.ExpCM_empirical_phi

    def test_branchScale(self):
        """Simulate evolution, ensure scaled branches match number of subs."""
        numpy.random.seed(1)
        random.seed(1)

        # define model, only free parameter is mu for testing simulations
        nsites = 50
        prefs = []
        minpref = 0.01
        for _r in range(nsites):

# Path: phydmslib/constants.py
# N_NT = len(INDEX_TO_NT)
# 
# N_AA = len(INDEX_TO_AA)
# 
# AA_TO_INDEX = {aa: i for (i, aa) in INDEX_TO_AA.items()}


# Path: tests/test_branchScale.py
import os
import numpy
import unittest
import random
import phydmslib.models
import phydmslib.treelikelihood
import phydmslib.simulate
import Bio.SeqIO
import Bio.Phylo
import pyvolve
from phydmslib.constants import N_NT, N_AA, AA_TO_INDEX

"""Tests branch scaling.

Makes sure we can correctly re-scale branch lengths into
units of substitutions per site.

Written by Jesse Bloom.
"""



class test_branchScale_ExpCM(unittest.TestCase):
    """Tests `branchScale` of `ExpCM_empirical_phi` model."""

    # use approach here to run multiple tests:
    # http://stackoverflow.com/questions/17260469/instantiate-python-unittest-testcase-with-arguments
    MODEL = phydmslib.models.ExpCM_empirical_phi

    def test_branchScale(self):
        """Simulate evolution, ensure scaled branches match number of subs."""
        numpy.random.seed(1)
        random.seed(1)

        # define model, only free parameter is mu for testing simulations
        nsites = 50
        prefs = []
        minpref = 0.01
        for _r in range(nsites):

            rprefs = numpy.random.dirichlet([1] * N_AA)