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


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

Makes sure we can correctly simulate an alignment given an `ExpCM` with
divpressure and a tree.

Written by Sarah Hilton and Jesse Bloom.
"""



class test_simulateAlignment_ExpCM_divselection(unittest.TestCase):
    """Tests `simulateAlignment` of `simulate.py` module."""

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

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

        alignmentPrefix = "test"

        # define model
        nsites = 1000
        prefs = []
        minpref = 0.01
        for _r in range(nsites):

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


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

"""Tests alignment simulation.

Makes sure we can correctly simulate an alignment given an `ExpCM` with
divpressure and a tree.

Written by Sarah Hilton and Jesse Bloom.
"""



class test_simulateAlignment_ExpCM_divselection(unittest.TestCase):
    """Tests `simulateAlignment` of `simulate.py` module."""

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

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

        alignmentPrefix = "test"

        # define model
        nsites = 1000
        prefs = []
        minpref = 0.01
        for _r in range(nsites):

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